list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. <template>
  2. <el-card shadow="never">
  3. <seekPage :seekList="seekList" :maxLength="4" @search="reload"></seekPage>
  4. <ele-pro-table
  5. ref="table"
  6. row-key="id"
  7. :columns="columns"
  8. :datasource="datasource"
  9. cacheKey="batchRecordBefore"
  10. :cache-key="'batchRecordTableRules-reportWorkType-' + reportWorkType"
  11. autoAmendPage
  12. >
  13. <!-- 操作列 -->
  14. <!-- 表头工具栏 -->
  15. <template v-slot:toolbar>
  16. <el-button
  17. size="small"
  18. type="primary"
  19. icon="el-icon-plus"
  20. class="ele-btn-icon"
  21. @click="openEdit('add', null)"
  22. >
  23. 新建
  24. </el-button>
  25. </template>
  26. <template v-slot:action="{ row }">
  27. <el-link
  28. v-if="row.executeStatus == 0"
  29. type="primary"
  30. :underline="false"
  31. @click="openEdit('edit', row)"
  32. >
  33. 编辑
  34. </el-link>
  35. <el-link
  36. v-if="row.executeStatus != 0"
  37. type="primary"
  38. :underline="false"
  39. @click="openDetial(row, 'detail')"
  40. >
  41. 详情
  42. </el-link>
  43. <el-link
  44. v-if="
  45. row.executeStatus == 0 ||
  46. (row.executeStatus == 1 && row.executeMethod == 2)
  47. "
  48. type="primary"
  49. :underline="false"
  50. @click="execute(row)"
  51. >
  52. 执行
  53. </el-link>
  54. <el-link
  55. v-if="row.executeStatus == 2 && showBut"
  56. type="primary"
  57. :underline="false"
  58. @click="openApproval"
  59. >
  60. 处理
  61. </el-link>
  62. <el-popconfirm
  63. v-if="row.executeStatus == 0"
  64. title="确定要删除此用户吗?"
  65. class="ele-action"
  66. @confirm="deleteById(row)"
  67. >
  68. <template v-slot:reference>
  69. <el-link type="danger" :underline="false"> 删除 </el-link>
  70. </template>
  71. </el-popconfirm>
  72. </template>
  73. </ele-pro-table>
  74. <!-- 编辑添加组件 -->
  75. <editModal
  76. ref="detailsRef"
  77. :reportWorkType="reportWorkType"
  78. @reload="reload"
  79. ></editModal>
  80. <!-- 详情 审核组件 -->
  81. <detialsModal ref="detialsModalRef"></detialsModal>
  82. <!-- 记录规则 执行 -->
  83. <releaseRulesDialog
  84. ref="releaseRulesDialogRef"
  85. @reload="reload"
  86. :isTempRecord="1"
  87. />
  88. <programRulesDialog
  89. ref="programRulesDialogRef"
  90. @reload="reload"
  91. :isTempRecord="1"
  92. />
  93. <process-submit-dialog
  94. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  95. v-if="processSubmitDialogFlag"
  96. ref="processSubmitDialogRef"
  97. @reload="reload"
  98. :isNotNeedProcess="false"
  99. ></process-submit-dialog>
  100. </el-card>
  101. </template>
  102. <script>
  103. import dictMixins from '@/mixins/dictMixins';
  104. import tableColumnsMixin from '@/mixins/tableColumnsMixin';
  105. import {
  106. producetaskrulerecordPage,
  107. logicDeleteById
  108. } from '@/api/producetaskrulerecord/index';
  109. import editModal from './editModal.vue';
  110. import detialsModal from './detialsModal.vue';
  111. import { parameterGetByCode } from '@/api/system/dictionary-data';
  112. import releaseRulesDialog from '@/views/produce/components/prenatalExamination/releaseRulesDialog.vue';
  113. import programRulesDialog from '@/views/produce/components/prenatalExamination/programRulesDialog.vue';
  114. import { getById } from '@/api/produceOrder/index.js';
  115. import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
  116. export default {
  117. components: {
  118. editModal,
  119. detialsModal,
  120. releaseRulesDialog,
  121. programRulesDialog,
  122. processSubmitDialog
  123. },
  124. name: 'batchRecordTable',
  125. mixins: [dictMixins, tableColumnsMixin],
  126. props: {
  127. // 1-产前准备,2-过程监测,3-产后检查
  128. reportWorkType: {
  129. type: Number,
  130. default: 1
  131. }
  132. },
  133. data() {
  134. return {
  135. // 表格字段
  136. columns: [
  137. {
  138. width: 50,
  139. type: 'index',
  140. columnKey: 'index',
  141. label: '序号',
  142. align: 'center'
  143. },
  144. {
  145. label: '记录编码',
  146. prop: 'code',
  147. minWidth: 180
  148. },
  149. {
  150. label: '产品编码',
  151. prop: 'productCode',
  152. minWidth: 180
  153. },
  154. {
  155. label: '产品名称',
  156. prop: 'productName',
  157. minWidth: 180
  158. },
  159. {
  160. label: '批次号',
  161. prop: 'batchNo',
  162. minWidth: 180
  163. },
  164. {
  165. label: '生产工单号',
  166. prop: 'workOrderCode',
  167. minWidth: 180
  168. },
  169. {
  170. label: '类型',
  171. prop: 'itemType',
  172. formatter: (row) => {
  173. return this.getDictValue('事项类型', row.itemType + '');
  174. }
  175. },
  176. {
  177. label: '执行方式',
  178. prop: 'executeMethod',
  179. minWidth: 180,
  180. formatter: (row) => {
  181. return this.getDictValue('执行方式', row.executeMethod + '');
  182. }
  183. },
  184. {
  185. label: '事项名称',
  186. prop: 'ruleName',
  187. minWidth: 180
  188. },
  189. {
  190. label: '状态',
  191. minWidth: 180,
  192. prop: 'executeStatus',
  193. formatter: (row) => {
  194. switch (row.executeStatus) {
  195. case 0:
  196. return '未执行';
  197. case 1:
  198. return '执行中';
  199. default:
  200. return '已执行';
  201. }
  202. }
  203. },
  204. {
  205. label: '审核状态',
  206. prop: 'approvalStatus',
  207. minWidth: 180,
  208. formatter: (row) => {
  209. switch (row.approvalStatus) {
  210. case 0:
  211. return '未提交';
  212. case 1:
  213. return '审核中';
  214. case 2:
  215. return '审核通过';
  216. case 3:
  217. return '审核不通过';
  218. case 4:
  219. return '终止审核中';
  220. case 5:
  221. return '终止审核通过';
  222. case 7:
  223. return '流程废止';
  224. default:
  225. return '';
  226. }
  227. }
  228. },
  229. {
  230. label: '创建人',
  231. prop: 'createUserName',
  232. minWidth: 180
  233. },
  234. {
  235. label: '创建时间',
  236. prop: 'createTime',
  237. minWidth: 180
  238. },
  239. {
  240. label: '操作',
  241. columnKey: 'action',
  242. slot: 'action',
  243. showOverflowTooltip: true,
  244. minWidth: 180,
  245. align: 'center',
  246. fixed: 'right'
  247. }
  248. ],
  249. // 是否展示处理按钮
  250. showBut: false,
  251. showReleaseRulesDialog: false,
  252. processSubmitDialogFlag: false
  253. };
  254. },
  255. computed: {
  256. seekList() {
  257. return [
  258. {
  259. label: '记录编码:',
  260. value: 'code',
  261. type: 'input',
  262. placeholder: '请输入'
  263. },
  264. {
  265. label: '类型:',
  266. value: 'itemType',
  267. type: 'select',
  268. placeholder: '请选择',
  269. planList: this.getDictListByName('事项类型')
  270. },
  271. {
  272. label: '产品名称:',
  273. value: 'productName',
  274. type: 'input',
  275. placeholder: '请输入'
  276. },
  277. {
  278. label: '状态:',
  279. value: 'executeStatus',
  280. type: 'select',
  281. placeholder: '请选择',
  282. planList: [
  283. {
  284. label: '未执行',
  285. value: 0
  286. },
  287. {
  288. label: '执行中',
  289. value: 1
  290. },
  291. {
  292. label: '已执行',
  293. value: 2
  294. }
  295. ]
  296. }
  297. ];
  298. }
  299. },
  300. created() {
  301. this.requestDict('事项类型');
  302. this.requestDict('报工类型');
  303. this.requestDict('执行方式');
  304. this.parameterGetByCode();
  305. },
  306. methods: {
  307. // 刷新表格
  308. reload(where = {}) {
  309. this.$nextTick(() => {
  310. this.$refs.table.reload({
  311. page: 1,
  312. where,
  313. reportWorkType: this.reportWorkType
  314. });
  315. });
  316. },
  317. /* 表格数据源 */
  318. datasource({ page, limit, where, order }) {
  319. return producetaskrulerecordPage({
  320. ...where,
  321. ...order,
  322. page,
  323. limit,
  324. reportWorkType: this.reportWorkType
  325. });
  326. },
  327. // 打开编辑新增
  328. openEdit(type, row) {
  329. this.$refs.detailsRef.open(type, row);
  330. },
  331. // 删除临时记录
  332. async deleteById(item) {
  333. await logicDeleteById(item.id);
  334. this.$message.warning('删除成功!');
  335. this.reload();
  336. },
  337. // 打开详情
  338. openDetial(row, type) {
  339. this.$refs.detialsModalRef?.open(row, type);
  340. },
  341. // 查询是否显示处理按钮
  342. async parameterGetByCode() {
  343. const data = await parameterGetByCode({
  344. code: 'form_submission_requires_approval',
  345. moduleCode: 'mes_'
  346. });
  347. this.showBut = data?.tenantId == '1';
  348. console.log('是否显示处理按钮(审批)', this.showBut);
  349. },
  350. // 提交审批
  351. openApproval(row) {
  352. console.log('row', row);
  353. this.processSubmitDialogFlag = true;
  354. this.$nextTick(() => {
  355. let params = {
  356. businessId: row.id,
  357. businessKey: 'mes_produce_task_record_rule_check',
  358. formCreateUserId: row.createUserId,
  359. variables: {
  360. businessCode: row.code
  361. }
  362. };
  363. console.log('1', 1);
  364. this.$refs.processSubmitDialogRef.init(params);
  365. });
  366. },
  367. // 执行
  368. async execute(row) {
  369. console.log('row', row);
  370. const workOrderInfo = await getById(row.workOrderId);
  371. if (row.executeMethod == 1) {
  372. // 设备保养计划相关逻辑
  373. this.$refs.programRulesDialogRef.init(
  374. { ...row, recordId: row.id },
  375. workOrderInfo,
  376. {}
  377. );
  378. return;
  379. }
  380. console.log('workOrderInfo', workOrderInfo);
  381. this.$refs.releaseRulesDialogRef?.open(
  382. { ...row, recordId: row.id },
  383. workOrderInfo
  384. );
  385. }
  386. }
  387. };
  388. </script>
  389. <style lang="scss" scoped></style>