血透系统PC前端

stockOutOrder.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. <template>
  2. <div class="app-container sign-and-weigh-box">
  3. <div class="filter-container">
  4. <el-row style="float:right;">
  5. <el-button @click="AddNewOrder" type="primary">新增</el-button>
  6. </el-row>
  7. </div>
  8. <div class="filter-container" style="margin-top:20px">
  9. <el-input style="width: 300px;" class="filter-item" placeholder="单据日期/单据编码/制单人/供应商"/>
  10. <el-button class="filter-item" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
  11. </div>
  12. <div class="filter-container">
  13. <span>入库时间:</span>
  14. <el-date-picker v-model="start_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
  15. type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
  16. value-format="yyyy-MM-dd" @change="startTimeChange"></el-date-picker>
  17. <span class="">-</span>
  18. <el-date-picker v-model="end_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
  19. type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
  20. value-format="yyyy-MM-dd" @change="endTimeChange"></el-date-picker>
  21. </div>
  22. <div class="filter-container" style="margin-top: 10px">
  23. <el-checkbox style="width: 30px" v-model="checked" @change="changeAllSelected">全选</el-checkbox>
  24. <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
  25. </div>
  26. <el-row :gutter="12" style="margin-top: 10px">
  27. <el-table
  28. :data="warehouseOutDate"
  29. :class="signAndWeighBoxPatients"
  30. style="width: 100%" border
  31. highlight-current-row
  32. ref="multipleTable"
  33. @selection-change="select"
  34. >
  35. <el-table-column
  36. type="selection"
  37. width="55">
  38. </el-table-column>
  39. <el-table-column label="单据日期" align="center">
  40. <template slot-scope="scope">
  41. {{ scope.row.warehouse_out_time | parseTime('{y}-{m}-{d}')}}
  42. </template>
  43. </el-table-column>
  44. <el-table-column label="单据编号" align="center">
  45. <template slot-scope="scope">
  46. {{scope.row.warehouse_out_order_number}}
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="制单人" align="center">
  50. <template slot-scope="scope">
  51. {{getXuserName(scope.row.creater)}}
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="厂家" align="center">
  55. <template slot-scope="scope">
  56. {{getManufactuerName(scope.row.manufacturer)}}
  57. </template>
  58. </el-table-column>
  59. <el-table-column label="经销商" align="center">
  60. <template slot-scope="scope">
  61. {{getDealerName(scope.row.dealer)}}
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="操作" align="center">
  65. <template slot-scope="scope">
  66. <el-button
  67. size="mini"
  68. type="primary"
  69. icon="el-icon-edit"
  70. @click="handleEdit(scope.$index, scope.row)">
  71. </el-button>
  72. <el-button
  73. size="mini"
  74. type="danger"
  75. icon="el-icon-delete"
  76. @click="handleDelete(scope.$index, scope.row)">
  77. </el-button>
  78. </template>
  79. </el-table-column>
  80. </el-table>
  81. <el-pagination
  82. @size-change="handleSizeChange"
  83. @current-change="handleCurrentChange"
  84. :page-sizes="[7]"
  85. :page-size="7"
  86. background
  87. style="margin-top:20px;float: right"
  88. layout="total, sizes, prev, pager, next, jumper"
  89. :total="total">
  90. </el-pagination>
  91. </el-row>
  92. </div>
  93. </template>
  94. <script>
  95. import { uParseTime } from '@/utils/tools'
  96. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from '@/api/doctor'
  97. import {
  98. deleteWarehouseOut,
  99. GetAllConfig,
  100. getWarehouseOutList,
  101. } from '@/api/stock'
  102. export default {
  103. name: 'salesReturnOrder',
  104. created() {
  105. var year = new Date().getFullYear()
  106. var month = new Date().getMonth() + 1
  107. var day = new Date().getDate()
  108. if (parseInt(month) < 10) {
  109. month = '0' + month
  110. }
  111. if (parseInt(day) < 10) {
  112. day = '0' + day
  113. }
  114. const endTime = year + '-' + month + '-' + day
  115. this.end_time = endTime
  116. var year = new Date().getFullYear()
  117. var month = new Date().getMonth()
  118. var day = new Date().getDate()
  119. if (parseInt(month) < 10) {
  120. month = '0' + month
  121. }
  122. if (parseInt(day) < 10) {
  123. day = '0' + day
  124. }
  125. const startTime = year + '-' + month + '-' + day
  126. this.start_time = startTime
  127. this.GetWarehouseOut()
  128. this.GetConfigInfo()
  129. this.fetchAllAdminUsers()
  130. },
  131. data() {
  132. return {
  133. page: 1,
  134. limit: 7,
  135. checked: false,
  136. total: 0,
  137. pageTotal: 0,
  138. pageSelect: 0,
  139. adminUserOptions: [],
  140. multipleSelection: [],
  141. signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
  142. start_time: '',
  143. warehouseOutDate: [],
  144. end_time: '',
  145. goodType: [],
  146. goodInfo: [],
  147. manufacturer: [],
  148. selectedTableData: [],
  149. dealer: [],
  150. }
  151. },
  152. methods: {
  153. AddNewOrder:function(){
  154. this.$router.push({ name: 'stockOutOrderAdd'})
  155. },
  156. GetWarehouseOut: function() {
  157. const Params = {
  158. page: this.page,
  159. limit: this.limit,
  160. start_time: this.start_time,
  161. end_time: this.end_time
  162. }
  163. this.warehouseOutDate = []
  164. getWarehouseOutList(Params).then(response => {
  165. if (response.data.state == 0) {
  166. this.$message.error(response.data.msg)
  167. return false
  168. } else {
  169. this.total = response.data.data.total
  170. for (let i = 0; i < response.data.data.list.length; i++) {
  171. this.warehouseOutDate.push(response.data.data.list[i])
  172. }
  173. }
  174. })
  175. }, getXuserName(id) {
  176. if (id <= 0) {
  177. return ''
  178. }
  179. var name = ''
  180. if (this.adminUserOptions == null || typeof (this.adminUserOptions.length) === 'undefined') {
  181. return name
  182. }
  183. var leng = this.adminUserOptions.length
  184. if (leng == 0) {
  185. return name
  186. }
  187. for (let index = 0; index < leng; index++) {
  188. if (this.adminUserOptions[index].id == id) {
  189. name = this.adminUserOptions[index].name
  190. break
  191. }
  192. }
  193. return name
  194. }, fetchAllAdminUsers() {
  195. fetchAllAdminUsers().then(response => {
  196. console.log(response)
  197. if (response.data.state == 1) {
  198. this.adminUserOptions = response.data.data.users
  199. var alen = this.adminUserOptions.length
  200. for (let index = 0; index < alen; index++) {
  201. if (this.adminUserOptions[index].user_type == 2) {
  202. // this.doctorOptions.push(this.adminUserOptions[index]);
  203. }
  204. }
  205. }
  206. })
  207. }, handleSelectionChange: function(val) {
  208. this.multipleSelection = val
  209. }, handleSizeChange(val) {
  210. this.limit = val
  211. this.GetWarehouse()
  212. }, handleCurrentChange(val) {
  213. this.page = val
  214. this.GetWarehouse()
  215. }, startTimeChange(val) {
  216. this.GetWarehouse()
  217. }, endTimeChange(val) {
  218. this.GetWarehouse()
  219. }, calculate: function(val) {
  220. return Math.round(parseFloat(val) * 100) / 100
  221. }, GetConfigInfo: function() {
  222. GetAllConfig().then(response => {
  223. if (response.data.state == 0) {
  224. this.$message.error(response.data.msg)
  225. return false
  226. } else {
  227. this.manufacturer = response.data.data.manufacturer
  228. this.dealer = response.data.data.dealer
  229. }
  230. })
  231. }, getManufactuerName: function(manufacturer_id) {
  232. for (let i = 0; i < this.manufacturer.length; i++) {
  233. if (this.manufacturer[i].id == manufacturer_id) {
  234. return this.manufacturer[i].manufacturer_name
  235. }
  236. }
  237. }, getDealerName: function(dealer_id) {
  238. for (let i = 0; i < this.dealer.length; i++) {
  239. if (this.dealer[i].id == dealer_id) {
  240. return this.dealer[i].dealer_name
  241. }
  242. }
  243. }, handleEdit: function(index, row) {
  244. this.$router.push({ name: 'stockOutDetail', query: { id: row.id }})
  245. }, handleDelete: function(index, row) {
  246. const ids = []
  247. ids.push(row.id)
  248. const idStr = ids.join(',')
  249. const params = {
  250. ids: idStr
  251. }
  252. this.$confirm('确认删除退货单记录?', '删除退货单记录', {
  253. confirmButtonText: '确定',
  254. cancelButtonText: '取消',
  255. type: 'warning'
  256. }).then(() => {
  257. deleteWarehouseOut(params).then(response => {
  258. if (response.data.state == 0) {
  259. this.$message.error(response.data.msg)
  260. return false
  261. } else {
  262. this.$notify({
  263. title: '成功',
  264. message: '删除成功',
  265. type: 'success',
  266. duration: 2000
  267. })
  268. for (let i = 0; i < ids.length; i++) {
  269. for (let y = 0; y < this.warehouseOutDate.length; y++) {
  270. if (ids[i] == this.warehouseOutDate[y].id) {
  271. this.warehouseOutDate.splice(y, 1)
  272. }
  273. }
  274. }
  275. }
  276. })
  277. }).catch(() => {
  278. })
  279. }, changeAllSelected: function(val) {
  280. if (val) {
  281. this.$refs.multipleTable.toggleAllSelection()
  282. } else {
  283. this.$refs.multipleTable.clearSelection()
  284. }
  285. }, select(selection) {
  286. this.selectedTableData = selection
  287. }, batchDelete() {
  288. if (this.selectedTableData.length <= 0) {
  289. this.$message.error('请选择要删除的记录')
  290. return
  291. }
  292. const ids = []
  293. for (let i = 0; i < this.selectedTableData.length; i++) {
  294. ids.push(this.selectedTableData[i].id)
  295. }
  296. const idStr = ids.join(',')
  297. const params = {
  298. ids: idStr
  299. }
  300. this.$confirm('确认删除退货单记录?', '删除退货单记录', {
  301. confirmButtonText: '确定',
  302. cancelButtonText: '取消',
  303. type: 'warning'
  304. }).then(() => {
  305. deleteWarehouseOut(params).then(response => {
  306. if (response.data.state == 0) {
  307. this.$message.error(response.data.msg)
  308. return false
  309. } else {
  310. this.$notify({
  311. title: '成功',
  312. message: '删除成功',
  313. type: 'success',
  314. duration: 2000
  315. })
  316. for (let i = 0; i < ids.length; i++) {
  317. for (let y = 0; y < this.warehouseOutDate.length; y++) {
  318. if (ids[i] == this.warehouseOutDate[y].id) {
  319. this.warehouseOutDate.splice(y, 1)
  320. }
  321. }
  322. }
  323. }
  324. })
  325. }).catch(() => {
  326. })
  327. }
  328. }
  329. }
  330. </script>
  331. <style rel="stylesheet/css" lang="scss" scoped>
  332. .information {
  333. border: 1px #dcdfe6 solid;
  334. padding: 30px 20px 30px 20px;
  335. .border {
  336. border-bottom: 1px #dcdfe6 solid;
  337. margin: 0px 0 20px 0;
  338. }
  339. }
  340. .title {
  341. background: #409eff;
  342. height: 44px;
  343. line-height: 44px;
  344. padding: 0 0 0 10px;
  345. color: #fff;
  346. margin: 0 0 10px 0;
  347. }
  348. .edit_separater {
  349. border-top: 1px solid rgb(233, 233, 233);
  350. margin-top: 15px;
  351. margin-bottom: 15px;
  352. }
  353. </style>
  354. <style>
  355. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  356. font-size: 12px;
  357. }
  358. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  359. background: #6fb5fa;
  360. }
  361. .count {
  362. color: #bd2c00;
  363. }
  364. </style>