index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <div id="stocktakingWork_index">
  3. <el-card shadow="never" v-loading="loading">
  4. <work-search @search="reload"> </work-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. <template v-slot:code="{ row }">
  14. <el-link type="primary" @click="goDetail(row)">
  15. {{ row.code }}
  16. </el-link>
  17. </template>
  18. <template v-slot:action="{ row }">
  19. <el-link
  20. v-if="row.status == 0"
  21. type="primary"
  22. :underline="false"
  23. icon="el-icon-edit"
  24. @click="control(row)"
  25. >
  26. 报工
  27. </el-link>
  28. </template>
  29. </ele-pro-table>
  30. </el-card>
  31. <DisposeDialog ref="disposeDialogRef" @flushed="reload"></DisposeDialog>
  32. </div>
  33. </template>
  34. <script>
  35. import DisposeDialog from './components/disposeDialog.vue';
  36. import WorkSearch from './components/work-search.vue';
  37. import { getPlanOrderList } from '@/api/warehouseManagement/inventory';
  38. export default {
  39. components: {
  40. WorkSearch,
  41. DisposeDialog
  42. },
  43. data() {
  44. return {
  45. visibleDialog: false,
  46. // 0-待处理,1-执行中,2-已完成
  47. statusObj: {
  48. 0: '待处理',
  49. 1: '执行中',
  50. 2: '已完成'
  51. },
  52. // 表格列配置
  53. columns: [
  54. {
  55. columnKey: 'index',
  56. label: '序号',
  57. type: 'index',
  58. width: 55,
  59. align: 'center',
  60. showOverflowTooltip: true,
  61. fixed: 'left'
  62. },
  63. {
  64. slot: 'code',
  65. prop: 'code',
  66. label: '盘点单号',
  67. align: 'center',
  68. showOverflowTooltip: true,
  69. minWidth: 200
  70. },
  71. {
  72. prop: 'status',
  73. label: '状态',
  74. align: 'center',
  75. showOverflowTooltip: true,
  76. slot: 'status',
  77. minWidth: 110,
  78. formatter: (row) => {
  79. return this.statusObj[Number(row.status)];
  80. }
  81. },
  82. {
  83. prop: 'planCode',
  84. label: '计划单号',
  85. align: 'center',
  86. showOverflowTooltip: true,
  87. minWidth: 200
  88. },
  89. {
  90. prop: 'planName',
  91. label: '计划名称',
  92. align: 'center',
  93. showOverflowTooltip: true,
  94. minWidth: 110
  95. },
  96. {
  97. prop: 'warehouseName',
  98. label: '盘点仓库',
  99. align: 'center',
  100. showOverflowTooltip: true,
  101. minWidth: 110
  102. },
  103. {
  104. prop: 'executeGroupName',
  105. label: '盘点部门',
  106. align: 'center',
  107. showOverflowTooltip: true,
  108. minWidth: 110
  109. },
  110. {
  111. prop: 'executorName',
  112. label: '盘点人员',
  113. align: 'center',
  114. showOverflowTooltip: true,
  115. minWidth: 110
  116. },
  117. {
  118. prop: 'startTime',
  119. label: '计划开始时间',
  120. align: 'center',
  121. showOverflowTooltip: true,
  122. minWidth: 110
  123. },
  124. {
  125. prop: 'endTime',
  126. label: '计划结束时间',
  127. align: 'center',
  128. showOverflowTooltip: true,
  129. minWidth: 110
  130. },
  131. {
  132. columnKey: 'action',
  133. label: '操作',
  134. width: 80,
  135. align: 'center',
  136. resizable: false,
  137. slot: 'action',
  138. showOverflowTooltip: true
  139. }
  140. ],
  141. // 加载状态
  142. loading: false,
  143. planOrderId: '',
  144. userInfo: {}
  145. };
  146. },
  147. computed: {
  148. userInfo() {
  149. return this.$store.getters.user.info;
  150. }
  151. },
  152. created() {
  153. // let info = JSON.parse(localStorage.getItem('info'));
  154. // this.userInfo = info;
  155. },
  156. methods: {
  157. control(row) {
  158. console.log(row, this.userInfo);
  159. if (row.executorId != this.userInfo.userId) {
  160. this.$message({
  161. type: 'error',
  162. message: '您不是盘点人员,不能报工!',
  163. });
  164. return;
  165. }
  166. this.$refs.disposeDialogRef.open(row.id);
  167. },
  168. /* 表格数据源 */
  169. datasource({ page, limit, where, order }) {
  170. where.status = 0
  171. where.executorId = this.userInfo.userId;
  172. return getPlanOrderList({ pageNum: page, size: limit, ...where });
  173. },
  174. async changeEnable(row) {
  175. const res = await putRoles(row);
  176. if (res.code == 0) {
  177. this.$message({
  178. type: 'success',
  179. message: '修改成功',
  180. customClass: 'ele-message-border'
  181. });
  182. this.reload();
  183. }
  184. },
  185. /* 刷新表格 */
  186. reload(where) {
  187. this.$refs.table.reload({ page: 1, where });
  188. },
  189. // 详情
  190. goDetail(row) {
  191. window.history.pushState(null, '', '/page-wms/warehouseManagement/stocktaking/work/details?id=' + row.id + '&planId=' + row.planId);
  192. // this.$router.push({
  193. // path: '/page-wms/warehouseManagement/stocktaking/work/details',
  194. // query: {
  195. // id: row.id,
  196. // planId: row.planId
  197. // }
  198. // });
  199. }
  200. }
  201. };
  202. </script>
  203. <style lang="scss" scoped>
  204. #stocktakingWork_index {
  205. height: calc(100vh - 96px);
  206. width: 100%;
  207. padding: 10px;
  208. box-sizing: border-box;
  209. // element-ui样式穿透
  210. :deep(.el-card) {
  211. height: 100%;
  212. .el-card__body {
  213. height: 100%;
  214. box-sizing: border-box;
  215. display: flex;
  216. flex-direction: column;
  217. .ele-pro-table {
  218. flex: 1;
  219. display: flex;
  220. flex-direction: column;
  221. .el-table {
  222. flex: 1;
  223. // display: flex;
  224. // flex-direction: column;
  225. // .el-table__body-wrapper {
  226. // flex: 1;
  227. // }
  228. }
  229. }
  230. }
  231. .el-form-item {
  232. margin-bottom: 5px !important;
  233. }
  234. }
  235. }
  236. </style>