index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <div id="stocktakingPlan_index">
  3. <el-card shadow="never" v-loading="loading">
  4. <plan-search ref="inventorySearch" @search="reload"> </plan-search>
  5. <!-- 数据表格 -->
  6. <ele-pro-table
  7. ref="table"
  8. :columns="columns"
  9. height="calc(100vh-300px)"
  10. :pageSize="20"
  11. :datasource="datasource"
  12. >
  13. <!-- 表头工具栏 -->
  14. <template v-slot:toolbar>
  15. <el-button
  16. size="small"
  17. type="primary"
  18. icon="el-icon-plus"
  19. class="ele-btn-icon"
  20. @click="openEdit()"
  21. >
  22. 新建临时计划
  23. </el-button>
  24. </template>
  25. <template v-slot:code="{ row }">
  26. <el-link type="primary" @click="goDetail(row)">
  27. {{ row.code }}
  28. </el-link>
  29. </template>
  30. <template v-slot:action="{ row }">
  31. <el-link
  32. v-if="row.planStatus == 0"
  33. type="primary"
  34. :underline="false"
  35. icon="el-icon-edit"
  36. @click="assign(row)"
  37. >
  38. 派单
  39. </el-link>
  40. <el-link
  41. v-if="row.planStatus == 0"
  42. type="primary"
  43. :underline="false"
  44. icon="el-icon-edit"
  45. @click="openEdit(row)"
  46. >
  47. 修改
  48. </el-link>
  49. <el-link
  50. v-if="row.planStatus == 0"
  51. type="danger"
  52. :underline="false"
  53. icon="el-icon-delete"
  54. @click="deleteRow(row)"
  55. >
  56. 删除
  57. </el-link>
  58. <el-link
  59. v-if="row.planStatus == 1"
  60. type="primary"
  61. :underline="false"
  62. icon="el-icon-edit"
  63. @click="revocationRow(row)"
  64. >
  65. 撤回
  66. </el-link>
  67. </template>
  68. </ele-pro-table>
  69. </el-card>
  70. <!-- 新建或编辑弹窗 -->
  71. <AddInventoryDialog
  72. ref="addInventoryDialogRef"
  73. :dialogTile="dialogTitle"
  74. :id="inventoryId"
  75. @refreshList="resetForm"
  76. :isBindPlan="isBindPlan"
  77. />
  78. <!-- 派单 -->
  79. <AssignDialog
  80. :visibleDialog.sync="visibleDialog"
  81. :planId="planId"
  82. @flushed="reload"
  83. ></AssignDialog>
  84. </div>
  85. </template>
  86. <script>
  87. import PlanSearch from './components/plan-search.vue';
  88. import AddInventoryDialog from './components/addInventoryDialog.vue';
  89. import AssignDialog from './components/assignDialog.vue';
  90. import {
  91. deleteInventoryPlan,
  92. getInventoryPlanList,
  93. revocationInventoryPlan
  94. } from '@/api/inventory';
  95. export default {
  96. components: {
  97. PlanSearch,
  98. AddInventoryDialog,
  99. AssignDialog
  100. },
  101. data() {
  102. return {
  103. // 表格列配置
  104. columns: [
  105. {
  106. columnKey: 'index',
  107. label: '序号',
  108. type: 'index',
  109. width: 55,
  110. align: 'center',
  111. showOverflowTooltip: true,
  112. fixed: 'left'
  113. },
  114. {
  115. slot: 'code',
  116. prop: 'code',
  117. label: '计划单号',
  118. align: 'center',
  119. showOverflowTooltip: true,
  120. minWidth: 110
  121. },
  122. {
  123. prop: 'name',
  124. label: '计划名称',
  125. align: 'center',
  126. showOverflowTooltip: true,
  127. slot: 'enable',
  128. minWidth: 110
  129. },
  130. {
  131. prop: 'warehouseName',
  132. label: '盘点仓库',
  133. align: 'center',
  134. showOverflowTooltip: true,
  135. minWidth: 110
  136. },
  137. {
  138. prop: 'ruleName',
  139. label: '计划规则',
  140. align: 'center',
  141. showOverflowTooltip: true,
  142. minWidth: 110
  143. },
  144. {
  145. prop: 'planStatus',
  146. label: '状态',
  147. align: 'center',
  148. showOverflowTooltip: true,
  149. minWidth: 110,
  150. formatter: (row, column) => {
  151. return this.statusList.filter(
  152. (item) => item.value == row.planStatus
  153. )[0].label;
  154. }
  155. },
  156. {
  157. prop: 'createUserName',
  158. label: '创建人',
  159. align: 'center',
  160. showOverflowTooltip: true,
  161. minWidth: 110
  162. },
  163. {
  164. prop: 'createTime',
  165. label: '生成时间',
  166. align: 'center',
  167. showOverflowTooltip: true,
  168. minWidth: 110
  169. },
  170. {
  171. columnKey: 'action',
  172. label: '操作',
  173. width: 250,
  174. align: 'center',
  175. resizable: false,
  176. slot: 'action',
  177. showOverflowTooltip: true
  178. }
  179. ],
  180. // 加载状态
  181. loading: false,
  182. dialogTitle: '',
  183. isBindPlan: false,
  184. inventoryId: '',
  185. planId: '',
  186. // 0未派单;1已派单;2已完成;3已撤回;
  187. statusList: [
  188. { label: '未派单', value: 0 },
  189. { label: '已派单', value: 1 },
  190. { label: '已完成', value: 2 },
  191. { label: '已撤回', value: 3 }
  192. ],
  193. visibleDialog: false
  194. };
  195. },
  196. methods: {
  197. assign(row) {
  198. this.planId = row.id;
  199. this.visibleDialog = true;
  200. },
  201. // 重置
  202. resetForm() {
  203. this.$refs.inventorySearch.reset();
  204. },
  205. /* 表格数据源 */
  206. async datasource({ page, limit, where, order }) {
  207. return await getInventoryPlanList({
  208. pageNum: page,
  209. size: limit,
  210. ...where
  211. });
  212. },
  213. /* 刷新表格 */
  214. reload(where) {
  215. this.$refs.table.reload({ page: 1, where });
  216. },
  217. openEdit(row) {
  218. if (row) {
  219. this.dialogTitle = '修改临时盘点计划';
  220. this.inventoryId = row.id;
  221. } else {
  222. this.dialogTitle = '新增临时盘点计划';
  223. this.inventoryId = '';
  224. }
  225. this.isBindPlan = false;
  226. this.$refs.addInventoryDialogRef.dialogVisible = true;
  227. },
  228. // goDetail(row) {
  229. // this.dialogTitle = '临时盘点计划详情';
  230. // this.inventoryId = row.id;
  231. // this.isBindPlan = true;
  232. // this.$refs.addInventoryDialogRef.dialogVisible = true;
  233. // },
  234. goDetail(row) {
  235. this.$router.push({
  236. path: '/warehouseManagement/stocktaking/plan/details',
  237. query: {
  238. id: row.id
  239. }
  240. });
  241. },
  242. // 删除未派单计划
  243. deleteRow(row) {
  244. this.$confirm('是否确定删除该盘点计划?', '提示', {
  245. confirmButtonText: '确定',
  246. cancelButtonText: '取消',
  247. type: 'warning'
  248. })
  249. .then(async () => {
  250. await deleteInventoryPlan([row.id]);
  251. this.$message.success('删除成功!');
  252. this.$refs.table.reload();
  253. })
  254. .catch(() => {});
  255. },
  256. // 撤回
  257. revocationRow(row) {
  258. this.$confirm('是否确定撤回?', '提示', {
  259. type: 'warning'
  260. })
  261. .then(() => {
  262. revocationInventoryPlan({ id: row.id }).then((data) => {
  263. console.log(data);
  264. this.$message.success('撤回成功!');
  265. this.reload();
  266. });
  267. })
  268. .catch(() => {});
  269. }
  270. }
  271. };
  272. </script>
  273. <style lang="scss" scoped>
  274. #stocktakingPlan_index {
  275. height: calc(100vh - 96px);
  276. width: 100%;
  277. padding: 10px;
  278. box-sizing: border-box;
  279. // element-ui样式穿透
  280. :deep(.el-card) {
  281. height: 100%;
  282. .el-card__body {
  283. height: 100%;
  284. box-sizing: border-box;
  285. display: flex;
  286. flex-direction: column;
  287. .ele-pro-table {
  288. flex: 1;
  289. display: flex;
  290. flex-direction: column;
  291. .el-table {
  292. flex: 1;
  293. // display: flex;
  294. // flex-direction: column;
  295. // .el-table__body-wrapper {
  296. // flex: 1;
  297. // }
  298. }
  299. }
  300. }
  301. .el-form-item {
  302. margin-bottom: 5px !important;
  303. }
  304. }
  305. }
  306. </style>