checklist.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <seek-page :seekList="seekList" @search="search"></seek-page>
  5. <ele-pro-table
  6. ref="table"
  7. row-key="id"
  8. :columns="columns"
  9. :datasource="datasource"
  10. :cache-key="cacheKeyUrl"
  11. autoAmendPage
  12. :pageSize="20"
  13. :height="tableHeight"
  14. @fullscreen-change="fullscreenChange"
  15. >
  16. <template v-slot:toolbar>
  17. <el-button type="primary" size="mini" @click="openCheckAdd('add')"
  18. >新建</el-button
  19. >
  20. </template>
  21. <template v-slot:action="{ row }">
  22. <el-link type="text" @click="checkAddConfirm('edit', row)"
  23. >编辑</el-link
  24. >
  25. <el-link
  26. type="text"
  27. v-if="row.approvalStatus == 0"
  28. @click="openApproval(row)"
  29. >提交</el-link
  30. >
  31. <el-popconfirm
  32. title="您确定要删除这条数据吗?"
  33. @confirm="deleteRow(row)"
  34. >
  35. <el-link style="margin-left: 10px" slot="reference" type="danger"
  36. >删除</el-link
  37. >
  38. </el-popconfirm>
  39. </template>
  40. <template v-slot:code="{ row }">
  41. <el-link type="primary" @click="checkAddConfirm('detail', row)">{{
  42. row.code
  43. }}</el-link>
  44. </template>
  45. </ele-pro-table>
  46. </el-card>
  47. <checkAdd
  48. ref="checkAddRef"
  49. @confirm="checkAddConfirm('add', $event)"
  50. ></checkAdd>
  51. <checkDetails ref="checkDetailsRef" @reload="reload"></checkDetails>
  52. <process-submit-dialog
  53. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  54. v-if="processSubmitDialogFlag"
  55. ref="processSubmitDialogRef"
  56. @reload="reload"
  57. :isNotNeedProcess="false"
  58. ></process-submit-dialog>
  59. </div>
  60. </template>
  61. <script>
  62. import dictMixins from '@/mixins/dictMixins';
  63. import tableColumnsMixin from '@/mixins/tableColumnsMixin';
  64. import {
  65. checklistrecordPage,
  66. checklistrecordDelete
  67. } from '@/api/checklistrecord/index';
  68. import checkAdd from './components/checkAdd.vue';
  69. import checkDetails from './components/checkDetails.vue';
  70. import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
  71. export default {
  72. mixins: [dictMixins, tableColumnsMixin],
  73. components: { checkAdd, checkDetails, processSubmitDialog },
  74. data() {
  75. return {
  76. columns: [
  77. {
  78. width: 50,
  79. type: 'index',
  80. columnKey: 'index',
  81. align: 'center',
  82. label: '序号'
  83. },
  84. {
  85. prop: 'code',
  86. label: '放行单编码',
  87. align: 'center',
  88. minWidth: 110,
  89. showOverflowTooltip: true,
  90. slot: 'code'
  91. },
  92. {
  93. prop: 'name',
  94. label: '放行单名称',
  95. align: 'center',
  96. minWidth: 110,
  97. showOverflowTooltip: true
  98. },
  99. {
  100. prop: 'productCode',
  101. label: '产品编码',
  102. align: 'center',
  103. minWidth: 110,
  104. showOverflowTooltip: true,
  105. formatter: (row) => {
  106. return row.orders.map((i) => i.productCode).join(', ');
  107. }
  108. },
  109. {
  110. prop: 'productName',
  111. label: '产品名称',
  112. align: 'center',
  113. minWidth: 110,
  114. showOverflowTooltip: true,
  115. formatter: (row) => {
  116. return row.orders.map((i) => i.productName).join(', ');
  117. }
  118. },
  119. {
  120. prop: 'batchNo',
  121. label: '批次号',
  122. align: 'center',
  123. minWidth: 110,
  124. showOverflowTooltip: true,
  125. formatter: (row) => {
  126. return row.orders.map((i) => i.batchNo).join(', ');
  127. }
  128. },
  129. {
  130. prop: 'code1',
  131. label: '生产工单号',
  132. align: 'center',
  133. minWidth: 110,
  134. showOverflowTooltip: true,
  135. formatter: (row) => {
  136. return row.orders.map((i) => i.id).join(', ');
  137. }
  138. },
  139. {
  140. prop: 'code2',
  141. label: '数量',
  142. align: 'center',
  143. minWidth: 110,
  144. showOverflowTooltip: true,
  145. formatter: (row) => {
  146. return row.orders.map((i) => i.formingNum).join(', ');
  147. }
  148. },
  149. {
  150. prop: 'code3',
  151. label: '规格',
  152. align: 'center',
  153. minWidth: 110,
  154. showOverflowTooltip: true,
  155. formatter: (row) => {
  156. return row.orders.map((i) => i.specification).join(', ');
  157. }
  158. },
  159. {
  160. prop: 'productModel',
  161. label: '型号',
  162. align: 'center',
  163. minWidth: 110,
  164. showOverflowTooltip: true,
  165. formatter: (row) => {
  166. return row.orders.map((i) => i.productModel).join(', ');
  167. }
  168. },
  169. {
  170. prop: 'approvalStatus',
  171. label: '审核',
  172. align: 'center',
  173. showOverflowTooltip: true,
  174. minWidth: 150,
  175. formatter: (row) => {
  176. switch (row.approvalStatus) {
  177. case 0:
  178. return '未提交';
  179. case 1:
  180. return '审核中';
  181. case 2:
  182. return '审核通过';
  183. case 3:
  184. return '审核不通过';
  185. default:
  186. return '';
  187. }
  188. }
  189. },
  190. {
  191. prop: 'createTime',
  192. label: '创建时间',
  193. align: 'center',
  194. minWidth: 110,
  195. showOverflowTooltip: true
  196. },
  197. {
  198. columnKey: 'action',
  199. label: '操作',
  200. width: 220,
  201. align: 'center',
  202. resizable: false,
  203. fixed: 'right',
  204. slot: 'action',
  205. showOverflowTooltip: true
  206. }
  207. ],
  208. cacheKeyUrl: 'mes-25925-material-table',
  209. tableHeight: 'calc(100vh - 320px)',
  210. processSubmitDialogFlag: false
  211. };
  212. },
  213. computed: {
  214. seekList() {
  215. return [
  216. {
  217. label: '放行单编码:',
  218. value: 'code',
  219. type: 'input',
  220. placeholder: '请输入'
  221. },
  222. {
  223. label: '放行单名称:',
  224. value: 'name',
  225. type: 'input',
  226. placeholder: '请输入'
  227. },
  228. {
  229. label: '审核状态:',
  230. value: 'approvalStatus',
  231. type: 'select',
  232. placeholder: '请输入',
  233. planList: [
  234. { label: '未提交', value: 0 },
  235. { label: '审核中', value: 1 },
  236. { label: '审核通过', value: 2 },
  237. { label: '审核不通过', value: 3 }
  238. ]
  239. }
  240. ];
  241. }
  242. },
  243. methods: {
  244. // 刷新表格
  245. reload(where = {}) {
  246. this.$refs.table.reload({
  247. where
  248. });
  249. },
  250. /* 表格数据源 */
  251. datasource({ page, limit, where, order }) {
  252. // 参数
  253. const body = {
  254. ...where,
  255. ...order,
  256. pageNum: page,
  257. size: limit
  258. };
  259. return checklistrecordPage(body);
  260. },
  261. search(where) {
  262. this.reload(where);
  263. },
  264. // 打开添加弹窗
  265. openCheckAdd(type) {
  266. this.$refs.checkAddRef?.open(type);
  267. },
  268. checkAddConfirm(type, data) {
  269. this.$refs.checkDetailsRef?.open(type, data);
  270. },
  271. // 删除
  272. async deleteRow(row) {
  273. await checklistrecordDelete([row.id]);
  274. this.$message.success('删除成功');
  275. this.reload();
  276. },
  277. fullscreenChange(fullscreen) {
  278. if (fullscreen) {
  279. this.tableHeight = 'calc(100vh - 120px)';
  280. } else {
  281. this.tableHeight = 'calc(100vh - 320px)';
  282. }
  283. },
  284. // 提交审批
  285. openApproval(row) {
  286. console.log('row', row);
  287. this.processSubmitDialogFlag = true;
  288. this.$nextTick(() => {
  289. let params = {
  290. businessId: row.id,
  291. businessKey: 'work_order_checklist_approval',
  292. formCreateUserId: row.createUserId,
  293. variables: {
  294. businessCode: row.code
  295. }
  296. };
  297. console.log('1', 1);
  298. this.$refs.processSubmitDialogRef.init(params);
  299. });
  300. }
  301. }
  302. };
  303. </script>
  304. <style></style>