index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <div id="inventoryAllocation_index">
  3. <el-card shadow="never" v-loading="loading">
  4. <inventory-search @search="reload"> </inventory-search>
  5. <!-- 数据表格 -->
  6. <ele-pro-table
  7. ref="table"
  8. :columns="columns"
  9. height="calc(100vh-300px)"
  10. :pageSize="20"
  11. :datasource="datasource"
  12. cache-key="systemRoleTable"
  13. :selection.sync="selection"
  14. >
  15. <template v-slot:toolbar>
  16. <el-button icon="el-icon-plus" type="primary" @click="add"
  17. >新建</el-button
  18. >
  19. <!-- <el-button :disabled="selection.length > 1" icon="el-icon-download" type="primary" @click="printExl"
  20. >打印</el-button
  21. > -->
  22. </template>
  23. <!-- 单号链接 -->
  24. <template v-slot:allotCode="{ row }">
  25. <el-link type="primary" @click="goDetail(row)">
  26. {{ row.allotCode }}
  27. </el-link>
  28. </template>
  29. <template v-slot:action="{ row }">
  30. <el-link
  31. v-if="row.status == 0 && row.type == 2"
  32. type="primary"
  33. :underline="false"
  34. icon="el-icon-view"
  35. @click="submit(row)"
  36. >
  37. 提交
  38. </el-link>
  39. <el-link
  40. v-if="row.status == 0"
  41. type="primary"
  42. :underline="false"
  43. icon="el-icon-view"
  44. @click="edit(row)"
  45. >
  46. 修改
  47. </el-link>
  48. <!-- <el-link
  49. type="primary"
  50. :underline="false"
  51. icon="el-icon-view"
  52. @click="goDetail(row)"
  53. >
  54. 详情
  55. </el-link> -->
  56. <el-link
  57. v-if="row.status == 0"
  58. type="primary"
  59. :underline="false"
  60. icon="el-icon-delete"
  61. @click="deleted(row)"
  62. >
  63. 删除
  64. </el-link>
  65. </template>
  66. </ele-pro-table>
  67. </el-card>
  68. <!-- 打印弹窗 -->
  69. <delivery-note-dialog ref="deliveryNoteDialogRef"></delivery-note-dialog>
  70. </div>
  71. </template>
  72. <script>
  73. import { allocationType } from '@/utils/dict/warehouse';
  74. import storageApi from '@/api/warehouseManagement/index.js';
  75. import InventorySearch from './components/inventory-search.vue';
  76. import DeliveryNoteDialog from './components/DeliveryNoteDialog.vue';
  77. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  78. import { pageRoles } from '@/api/system/role';
  79. export default {
  80. components: {
  81. InventorySearch,
  82. DeliveryNoteDialog
  83. },
  84. data() {
  85. return {
  86. allocationType,
  87. stutusOptions: {
  88. 0: '未提交',
  89. 1: '审核中',
  90. 2: '已完成'
  91. },
  92. // 表格列配置
  93. columns: [
  94. {
  95. columnKey: 'index',
  96. label: '序号',
  97. type: 'index',
  98. width: 55,
  99. align: 'center',
  100. showOverflowTooltip: true,
  101. fixed: 'left'
  102. },
  103. {
  104. width: 45,
  105. type: 'selection',
  106. columnKey: 'selection',
  107. align: 'center',
  108. fixed: 'left'
  109. },
  110. {
  111. prop: 'name',
  112. label: '调拨名称',
  113. align: 'center',
  114. showOverflowTooltip: true,
  115. minWidth: 110
  116. },
  117. {
  118. slot: 'allotCode',
  119. prop: 'allotCode',
  120. label: '调拨单号',
  121. align: 'center',
  122. showOverflowTooltip: true,
  123. minWidth: 180
  124. },
  125. {
  126. prop: 'type',
  127. label: '调拨类型',
  128. align: 'center',
  129. showOverflowTooltip: true,
  130. minWidth: 110,
  131. formatter: (row, column, cellValue) => {
  132. return this.allocationType.filter(
  133. (item) => item.code == row.type
  134. )[0].label;
  135. }
  136. },
  137. {
  138. prop: 'categoryName',
  139. label: '物品名称',
  140. align: 'center',
  141. showOverflowTooltip: true,
  142. minWidth: 110
  143. },
  144. {
  145. prop: 'categoryCode',
  146. label: '物品编码',
  147. align: 'center',
  148. showOverflowTooltip: true,
  149. minWidth: 110
  150. },
  151. {
  152. prop: 'sourceWarehouse',
  153. label: '来源仓库',
  154. align: 'center',
  155. showOverflowTooltip: true,
  156. minWidth: 110
  157. },
  158. {
  159. prop: 'targetWarehouse',
  160. label: '目标仓库',
  161. align: 'center',
  162. showOverflowTooltip: true,
  163. minWidth: 110
  164. },
  165. {
  166. prop: 'allotName',
  167. label: '调拨人',
  168. align: 'center',
  169. showOverflowTooltip: true,
  170. minWidth: 110
  171. },
  172. {
  173. prop: 'createTime',
  174. label: '调拨时间',
  175. align: 'center',
  176. showOverflowTooltip: true,
  177. minWidth: 110
  178. },
  179. {
  180. prop: 'status',
  181. label: '状态',
  182. align: 'center',
  183. showOverflowTooltip: true,
  184. formatter: (row, column, cellValue) => {
  185. return this.stutusOptions[row.status];
  186. }
  187. },
  188. {
  189. columnKey: 'action',
  190. label: '操作',
  191. width: 200,
  192. align: 'center',
  193. slot: 'action',
  194. showOverflowTooltip: true
  195. }
  196. ],
  197. // 加载状态
  198. loading: false,
  199. // 选中的行
  200. selection: []
  201. };
  202. },
  203. computed: {},
  204. methods: {
  205. printExl() {
  206. console.log('selection', this.selection)
  207. if (this.selection.length == 0) {
  208. this.$message.warning('请选择要导出的记录');
  209. return;
  210. }
  211. this.$refs.deliveryNoteDialogRef.open(this.selection[0]);
  212. },
  213. // 删除
  214. async deleted(row) {
  215. const data = await storageApi.deleteAllot([row.id]);
  216. if (data.code == '0') {
  217. this.$message.success('删除成功!');
  218. this.reload();
  219. }
  220. },
  221. // 提交
  222. submit(row) {
  223. storageApi
  224. .submitAllot({
  225. id: row.id,
  226. enterVerifyUserId: row.sourceWarehouseUserId,
  227. outVerifyUserId: row.targetWarehouseUserId
  228. })
  229. .then(() => {
  230. this.$message({
  231. type: 'success',
  232. message: '提交成功'
  233. });
  234. this.reload();
  235. });
  236. },
  237. // 修改
  238. edit(row) {
  239. this.$router.push({
  240. path: '/warehouseManagement/inventoryAllocation/add',
  241. query: { isEdit: true, id: row.id }
  242. });
  243. },
  244. // 新建
  245. add() {
  246. this.$router.push({
  247. path: '/warehouseManagement/inventoryAllocation/add'
  248. });
  249. },
  250. /* 表格数据源 */
  251. datasource({ page, limit, where }) {
  252. return storageApi.getAllotApplyPage({
  253. pageNum: page,
  254. size: limit,
  255. ...where
  256. });
  257. },
  258. /* 刷新表格 */
  259. reload(where) {
  260. this.$refs.table.reload({ page: 1, where });
  261. },
  262. // 详情
  263. goDetail(row) {
  264. this.$router.push({
  265. path: '/warehouseManagement/inventoryAllocation/details',
  266. query: { id: row.id }
  267. });
  268. }
  269. }
  270. };
  271. </script>
  272. <style lang="scss" scoped>
  273. #inventoryAllocation_index {
  274. height: calc(100vh - 96px);
  275. width: 100%;
  276. padding: 10px;
  277. box-sizing: border-box;
  278. // element-ui样式穿透
  279. :deep(.el-card) {
  280. height: 100%;
  281. .el-card__body {
  282. height: 100%;
  283. box-sizing: border-box;
  284. display: flex;
  285. flex-direction: column;
  286. .ele-pro-table {
  287. flex: 1;
  288. display: flex;
  289. flex-direction: column;
  290. .el-table {
  291. flex: 1;
  292. // display: flex;
  293. // flex-direction: column;
  294. // .el-table__body-wrapper {
  295. // flex: 1;
  296. // }
  297. }
  298. }
  299. }
  300. .el-form-item {
  301. margin-bottom: 5px !important;
  302. }
  303. }
  304. }
  305. </style>