From c4bd5940bcd71de72d05c341a110e8eb7e9346a1 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期一, 02 六月 2025 09:57:20 +0800 Subject: [PATCH] art: 工作流-维修审批详情修改 --- src/views/flowable/workflow/repairOrder/RepairOrderApprovalModal.vue | 464 ++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 275 insertions(+), 189 deletions(-) diff --git a/src/views/flowable/workflow/repairOrder/RepairOrderApprovalModal.vue b/src/views/flowable/workflow/repairOrder/RepairOrderApprovalModal.vue index 76c6210..d1b9f35 100644 --- a/src/views/flowable/workflow/repairOrder/RepairOrderApprovalModal.vue +++ b/src/views/flowable/workflow/repairOrder/RepairOrderApprovalModal.vue @@ -1,69 +1,150 @@ <template> - <a-modal - :width="1000" + <j-modal + :width="1200" :visible="visible" + :title="title" + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" @cancel="handCancel" @ok="submitForm" :mask-closable="false" + :confirmLoading="confirmLoading" centered > - <a-card :bordered="false"> - <div> - <b>{{ selectShenpiData.title }}</b> - <br/> - <br/> - <a-tag color="blue"> - 澶勭悊浜� {{ selectShenpiData.assignee }} - </a-tag> - <a-tag color="blue"> - 鍒涘缓鏃堕棿 {{ selectShenpiData.createTime }} - </a-tag> - <br> - <br> - <a-button @click="fetchAndShowBmp" :loading="showBmpButtonLoading" class="btn-custom">娴佺▼鍥�</a-button> - <div v-if="imageSrc&&isDisplayBmp"> - <img :src="imageSrc" alt="Fetched Image"/> - </div> - <!--<hr class="shallow-hr"/>--> - </div> + <a-spin :spinning="spinning"> + <a-form-model ref="form" :model='tableRowRecord' :rules='validatorRules' :labelCol='labelCol' + :wrapperCol='wrapperCol'> + <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;">鎶ヤ慨鍩虹淇℃伅</a-divider> - <div> - <a-spin :spinning="spinning"> - <a-tabs default-active-key='1'> - <a-tab-pane key='1' tab='鍩烘湰淇℃伅'> - <a-form-model :model='tableRowRecord' :rules='validatorRules' :labelCol='labelCol' - :wrapperCol='wrapperCol'> - <a-row> - <a-col :span='span'> - <a-form-model-item label='宸ュ崟缂栧彿'> - <a-input :readOnly='inputReadOnly' v-model='tableRowRecord.repairCode'/> - </a-form-model-item> - </a-col> - <a-col :span='span'> - <a-form-model-item label='璁惧缂栧彿'> - <lx-search-equipment-select disabled v-model='tableRowRecord.equipmentId'/> - </a-form-model-item> - </a-col> - <a-col :span='span'> - <a-form-model-item label='鍗曟嵁鐘舵��'> - <a-input :readOnly='inputReadOnly' v-model='tableRowRecord.repairStatus_dictText'/> - </a-form-model-item> - </a-col> - <a-col :span='span'> - <a-form-model-item label='缁翠慨璐熻矗浜�'> - <a-input :readOnly='inputReadOnly' v-model='tableRowRecord.repairer'/> - </a-form-model-item> - </a-col> - </a-row> - </a-form-model> - </a-tab-pane> + <a-row> + <a-col :span='threeColSpan'> + <a-form-model-item label='宸ュ崟缂栧彿'> + <a-input :readOnly='inputReadOnly' v-model='tableRowRecord.repairCode'/> + </a-form-model-item> + </a-col> + <a-col :span='threeColSpan'> + <a-form-model-item label='宸ュ崟鐘舵��'> + <a-input :readOnly='inputReadOnly' v-model='tableRowRecord.repairStatus_dictText'/> + </a-form-model-item> + </a-col> + <a-col :span='threeColSpan'> + <a-form-model-item label='璁惧缂栧彿'> + <lx-search-equipment-select disabled v-model='tableRowRecord.equipmentId'/> + </a-form-model-item> + </a-col> + </a-row> + <a-row> + <a-col :span='threeColSpan'> + <a-form-model-item label='瀹夎浣嶇疆'> + <a-input :readOnly='inputReadOnly' v-model='tableRowRecord.installationPosition_dictText'/> + </a-form-model-item> + </a-col> + <a-col :span='threeColSpan'> + <a-form-model-item label='鎶ヤ慨浜�'> + <a-input :readOnly='inputReadOnly' v-model='tableRowRecord.reporter_dictText'/> + </a-form-model-item> + </a-col> + <a-col :span='threeColSpan'> + <a-form-model-item label='鎶ヤ慨浜虹數璇�'> + <a-input :readOnly='inputReadOnly' v-model='tableRowRecord.reporterPhone_dictText'/> + </a-form-model-item> + </a-col> + </a-row> + <a-row> + <a-col :span='threeColSpan'> + <a-form-model-item label='缁翠慨浜�'> + <a-input :readOnly='inputReadOnly' v-model='tableRowRecord.repairer_dictText'/> + </a-form-model-item> + </a-col> + <a-col :span='threeColSpan'> + <a-form-model-item label='缁翠慨浜虹數璇�'> + <a-input :readOnly='inputReadOnly' v-model='tableRowRecord.repairerPhone_dictText'/> + </a-form-model-item> + </a-col> + <a-col :span='threeColSpan'> + <a-form-model-item label='鏁呴殰绠�绉�'> + <a-input :readOnly='inputReadOnly' v-model='tableRowRecord.faultName'/> + </a-form-model-item> + </a-col> + </a-row> + <a-row> + <a-col :span="threeColSpan"> + <a-form-model-item label="鏁呴殰寮�濮嬫椂闂�"> + <a-input :readOnly='inputReadOnly' v-model="tableRowRecord.faultStartTime"/> + </a-form-model-item> + </a-col> + + <a-col :span="threeColSpan"> + <a-form-model-item label="鏄惁鍋滄満"> + <j-dict-select-tag type='radio' v-model='tableRowRecord.breakdownFlag' dictCode='breakdown_flag' + disabled/> + </a-form-model-item> + </a-col> + </a-row> + <a-row> + <a-col :span="24"> + <a-form-model-item label='鏁呴殰鎻忚堪' :labelCol='labelColLong' :wrapperCol='wrapperColLong'> + <a-textarea :readOnly='inputReadOnly' v-model='tableRowRecord.faultDescription'/> + </a-form-model-item> + </a-col> + </a-row> + <a-row> + <a-col :span='threeColSpan*3'> + <a-form-model-item label='鎶ヤ慨鍥剧墖' :labelCol='labelColLong' :wrapperCol='wrapperColLong'> + <lx-upload :returnUrl="false" :isMultiple="true" file-type="image" disabled :number="3" + v-model="tableRowRecord.reportImageFiles"/> + </a-form-model-item> + </a-col> + </a-row> + + <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;">鏄惁闇�瑕侀鐢ㄥ浠�</a-divider> + + <a-tabs v-model="activeTabKey"> + <a-tab-pane key="1" tab="棰嗙敤澶囦欢"> + <a-row> + <a-col :span="twoColSpan*2"> + <a-form-model-item label="鏄惁闇�瑕侀鐢ㄥ浠�" prop="isUseSpare"> + <a-radio-group v-model="tableRowRecord.isUseSpare" + :disabled="isDisableUseSpare"> + <a-radio :value="1">鏄�</a-radio> + <a-radio :value="0">鍚�</a-radio> + </a-radio-group> + </a-form-model-item> + </a-col> + + <template v-if="tableRowRecord.isUseSpare===0"> + <a-col :span="twoColSpan*2"> + <a-form-model-item label="鏁呴殰鍘熷洜" prop="faultReason"> + <a-input :readOnly="disableSubmit||tableRowRecord.repairStatus!=='UNDER_REPAIR'" + v-model="tableRowRecord.faultReason" rows="4" + placeholder="璇疯緭鍏ユ晠闅滃師鍥�"/> + </a-form-model-item> + </a-col> + <a-col :span="twoColSpan*2"> + <a-form-model-item label="缁翠慨缁撴灉鎻忚堪" prop="repairDescription"> + <a-textarea :readOnly="disableSubmit||tableRowRecord.repairStatus!=='UNDER_REPAIR'" + v-model="tableRowRecord.repairDescription" + placeholder="璇疯緭鍏ョ淮淇粨鏋滄弿杩�"/> + </a-form-model-item> + </a-col> + <a-col :span="twoColSpan*2"> + <a-form-model-item label="缁翠慨鍥剧墖"> + <lx-upload :returnUrl="false" :isMultiple="true" file-type="image" :number="3" + :disabled="disableSubmit||tableRowRecord.repairStatus!=='UNDER_REPAIR'" + v-model="tableRowRecord.imageFiles"/> + </a-form-model-item> + </a-col> + </template> + </a-row> + </a-tab-pane> + + <template v-if="selectShenpiData.procInstId"> <a-tab-pane key='2' tab='娴佺▼鑺傜偣'> <a-card :bordered="false"> <a-timeline> <a-timeline-item v-for="(item,index) in hitaskDataSource" :key="index"> <div> - <h3 style="font-weight: bold">{{item.taskName}}</h3> + <h3 style="font-weight: bold;">{{item.taskName}}</h3> <div>澶勭悊浜猴細{{item.assignee_dictText}}</div> <div v-if="index !==0">澶勭悊鏃堕暱锛歿{item.duration}}</div> <div v-if="item.name !== '鎻愪氦鐢宠'">澶勭悊绫诲瀷锛歿{item.sequenceFlowName}}</div> @@ -73,47 +154,61 @@ </a-timeline> </a-card> </a-tab-pane> - </a-tabs> - </a-spin> - </div> - <a-tabs default-active-key='1'> - <a-tab-pane key="1" tab="瀹℃壒璇︽儏"> - <a-form-model ref="form" :model="approveData" :rules="validatorRules" :labelCol='labelCol' - :wrapperCol='wrapperCol'> - <a-row> - <a-col :span="24"> - <a-form-model-item label="鏄惁闇�瑕侀鐢ㄥ浠�" prop="status"> - <a-radio-group v-model="approveData.status"> - <a-radio :value="1">鏄�</a-radio> - <a-radio :value="0">鍚�</a-radio> - </a-radio-group> - </a-form-model-item> - </a-col> + <a-tab-pane key='3' tab='娴佺▼鍥�'> + <img :src="imageSrc" alt="Fetched Image"/>--> + </a-tab-pane> + </template> + </a-tabs> - <template v-if="approveData.status===0"> - <a-col :span="24"> - <a-form-model-item label="鏁呴殰鍘熷洜" prop="faultReason"> - <a-input v-model="approveData.faultReason" rows="4" placeholder="璇疯緭鍏ユ晠闅滃師鍥�"/> - </a-form-model-item> - </a-col> - <a-col :span="24"> - <a-form-model-item label="缁翠慨缁撴灉鎻忚堪" prop="repairResultDescription"> - <a-textarea v-model="approveData.repairResultDescription" placeholder="璇疯緭鍏ョ淮淇粨鏋滄弿杩�"/> - </a-form-model-item> - </a-col> - <a-col :span="24"> - <a-form-model-item label="缁翠慨鍥剧墖"> - <j-image-upload v-model="approveData.imageFiles" :is-multiple="true" :number="3"/> - </a-form-model-item> - </a-col> - </template> - </a-row> - </a-form-model> - </a-tab-pane> - </a-tabs> - </a-card> - </a-modal> + <template v-if="tableRowRecord.isUseSpare===1&&isDisableUseSpare"> + <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;">绠$悊鍛橀鐢ㄥ浠� + </a-divider> + + <a-row> + <a-col :span="twoColSpan*2"> + <a-form-model-item prop="sparePartDescription" label="澶囦欢鎻忚堪"> + <a-textarea placeholder="璇疯緭鍏ュ浠舵弿杩�" :readOnly="disableSubmit||tableRowRecord.repairStatus!=='WAIT_SPARES'" + v-model="tableRowRecord.sparePartDescription"></a-textarea> + </a-form-model-item> + </a-col> + </a-row> + </template> + + <template v-if="Boolean(tableRowRecord.sparePartDescription)&&isDisplayRepairResult"> + <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;">缁翠慨缁撴灉涓婃姤</a-divider> + <a-row> + <a-col :span="twoColSpan*2"> + <a-form-model-item label="鏁呴殰鍘熷洜" prop="faultReason"> + <a-input :readOnly="disableSubmit||isDisableSubmitRepairResult" v-model="tableRowRecord.faultReason" + rows="4" placeholder="璇疯緭鍏ユ晠闅滃師鍥�"/> + </a-form-model-item> + </a-col> + </a-row> + + <a-row> + <a-col :span="twoColSpan*2"> + <a-form-model-item label="缁翠慨缁撴灉鎻忚堪" prop="repairDescription"> + <a-textarea :readOnly="disableSubmit||isDisableSubmitRepairResult" + v-model="tableRowRecord.repairDescription" + placeholder="璇疯緭鍏ョ淮淇粨鏋滄弿杩�"/> + </a-form-model-item> + </a-col> + </a-row> + + <a-row> + <a-col :span="twoColSpan*2"> + <a-form-model-item label="缁翠慨鍥剧墖"> + <lx-upload :disabled="disableSubmit||isDisableSubmitRepairResult" :returnUrl="false" :isMultiple="true" + file-type="image" :number="3" + v-model="tableRowRecord.imageFiles"/> + </a-form-model-item> + </a-col> + </a-row> + </template> + </a-form-model> + </a-spin> + </j-modal> </template> <script> @@ -132,13 +227,17 @@ }, data() { return { - form: this.$form.createForm(this), - span: 12, + title: '', + threeColSpan: 8, + twoColSpan: 12, inputReadOnly: true, + disableSubmit: false, + confirmLoading: false, spinning: false, tableRowRecord: {}, hitaskDataSource: [], imageSrc: null, + activeTabKey: '1', labelCol: { xs: { span: 24 }, sm: { span: 6 } @@ -147,14 +246,25 @@ xs: { span: 24 }, sm: { span: 16 } }, + labelColLong: { + xs: { span: 24 }, + sm: { span: 2 } + }, + wrapperColLong: { + xs: { span: 24 }, + sm: { span: 20 } + }, validatorRules: { - status: [ + isUseSpare: [ { required: true, message: '璇烽�夋嫨鏄惁闇�瑕侀鐢ㄥ浠�' } + ], + sparePartDescription: [ + { required: true, message: '璇疯緭鍏ュ浠舵弿杩�' } ], faultReason: [ { required: true, message: '璇疯緭鍏ユ晠闅滃師鍥�' } ], - repairResultDescription: [ + repairDescription: [ { required: true, message: '璇疯緭鍏ョ淮淇粨鏋滄弿杩�' } ] }, @@ -165,23 +275,49 @@ queryBomDataById: '/eam/eamRepairOrder/queryById', diagramView: '/assign/flow/diagramView', queryHisTaskList: '/assign/flow/queryHisTaskList', - approve: '/activit/assign/file/approve' - }, - isDisplayBmp: false, - showBmpButtonLoading: false + approve: '/eam/eamRepairOrder/perform' + } + } + }, + computed: { + isDisableUseSpare() { + return this.disableSubmit || this.tableRowRecord.repairStatus !== 'UNDER_REPAIR' || Boolean(this.tableRowRecord.sparePartDescription) + }, + isDisplayRepairResult() { + return ['UNDER_REPAIR', 'WAIT_CONFIRM', 'COMPLETE'].includes(this.tableRowRecord.repairStatus) + }, + isDisableSubmitRepairResult() { + return ['WAIT_CONFIRM', 'COMPLETE'].includes(this.tableRowRecord.repairStatus) } }, methods: { /** - * 鑾峰彇娴佺▼鑺傜偣 + * 鑾峰彇娴佺▼鑺傜偣鍜屾祦绋嬪浘 * @param record 寰呭姙璁板綍淇℃伅 */ getAllApproveData(record) { - console.log('selectShenpiData----->', this.selectShenpiData) - const param = { 'procInstId': record.dataId } + if (!record.procInstId) return + console.log('record----->', record) + const { procInstId, processDefinitionId, processInstanceId, processDefinitionKey } = record + const param = { procInstId } + const imageParam = { processDefinitionId, processInstanceId, TaskDefinitionKey: processDefinitionKey } + const that = this + getAction(this.url.queryHisTaskList, param) .then(res => { - this.hitaskDataSource = res.result + that.hitaskDataSource = res.result + }) + + downFile(this.url.diagramView, imageParam, 'get') + .then((res => { + const urlObject = window.URL.createObjectURL(new Blob([res])) + that.imageSrc = urlObject + })) + .catch(err => { + that.$notification.error({ + message: '娑堟伅', + description: res.message + }) }) }, @@ -194,11 +330,15 @@ const that = this const param = { id: record.dataId } this.tableRowRecord = {} - this.approveData = { status: 0 } + this.activeTabKey = '1' getAction(this.url.queryBomDataById, param) .then((res => { if (res.success) { - that.tableRowRecord = res.result + that.tableRowRecord = Object.assign({}, res.result, { + isUseSpare: res.result.isUseSpare === null ? 0 : res.result.isUseSpare, + imageFiles: JSON.parse(res.result.imageFiles), + reportImageFiles: JSON.parse(res.result.reportImageFiles) + }) console.log('this.tableRowRecord----->', that.tableRowRecord) } })) @@ -207,58 +347,41 @@ }) }, - // 鑾峰彇骞跺睍寮�娴佺▼鍥� - fetchAndShowBmp() { - this.isDisplayBmp = !this.isDisplayBmp - if (!this.imageSrc) { - const { processDefinitionId, processInstanceId, processDefinitionKey } = this.selectShenpiData - let param = { processDefinitionId, processInstanceId, TaskDefinitionKey: processDefinitionKey } - this.showBmpButtonLoading = true - const that = this - downFile(this.url.diagramView, param, 'get') - .then((res => { - const urlObject = window.URL.createObjectURL(new Blob([res])) - this.imageSrc = urlObject - })) - .catch(err => { - that.$notification.error({ - message: '娑堟伅', - description: res.message - }) - }) - .finally(() => { - this.showBmpButtonLoading = false - }) - } - }, - submitForm() { const that = this // 瑙﹀彂琛ㄥ崟楠岃瘉 this.$refs.form.validate(valid => { if (valid) { - that.confirmLoading = true + that.confirmLoading = that.spinning = true + const { isUseSpare, faultReason, repairDescription, sparePartDescription, imageFiles, equipmentId } = that.tableRowRecord + const { dataId, id, procInstId, taskDefKey, variables } = that.selectShenpiData + const flowTaskVo = {} - flowTaskVo.status = that.approveData.status - flowTaskVo.approveContent = flowTaskVo.comment = that.approveData.approveContent - flowTaskVo.dataId = this.selectShenpiData.dataId - flowTaskVo.taskId = this.selectShenpiData.id - flowTaskVo.userId = flowTaskVo.assignee = this.selectShenpiData.assignee - flowTaskVo.instanceId = this.selectShenpiData.procInstId - flowTaskVo.targetKey = this.selectShenpiData.taskDefKey - flowTaskVo.values = this.selectShenpiData.variables + flowTaskVo.isUseSpare = isUseSpare + flowTaskVo.faultReason = faultReason + flowTaskVo.repairDescription = repairDescription + flowTaskVo.sparePartDescription = sparePartDescription + flowTaskVo.imageFilesResult = imageFiles + flowTaskVo.equipmentId = equipmentId + flowTaskVo.id = dataId + flowTaskVo.dataId = dataId + flowTaskVo.taskId = id + flowTaskVo.instanceId = procInstId + flowTaskVo.targetKey = taskDefKey + flowTaskVo.values = variables console.log('琛ㄥ崟鎻愪氦鏁版嵁', flowTaskVo) - // httpAction(this.url.approve, flowTaskVo, 'post') - // .then((res) => { - // if (res.success) { - // that.$message.success(res.message) - // that.$emit('ok') - // } else { - // that.$message.warning(res.message) - // } - // }).finally(() => { - // that.confirmLoading = false - // }) + httpAction(this.url.approve, flowTaskVo, 'post') + .then((res) => { + if (res.success) { + that.$message.success(res.message) + that.handCancel() + that.$emit('searchReset') + } else { + that.$message.warning(res.message) + } + }).finally(() => { + that.confirmLoading = that.spinning = false + }) } else { return false } @@ -267,45 +390,8 @@ handCancel() { this.visible = false - this.isDisplayBmp = false - this.imageSrc = null + if (this.$refs.form) this.$refs.form.clearValidate() } } } -</script> -<style scoped> - .btn-custom { - background-color: #4CAF50; /* 缁胯壊鑳屾櫙 */ - color: #fff; /* 鐧借壊鏂囧瓧 */ - } - - .left_qiu { - position: absolute; - left: -74px; - top: 0; - width: 54px; - border-radius: 50%; - height: 54px; - font-size: 13px; - margin: auto; - display: flex; - flex-wrap: wrap; - align-items: center; - justify-content: center; - background: #0099ff; - transform: translate(0, 0); - } - - /deep/ .ant-timeline-item-tail { - left: -29px !important; - } - - .left_qiu span { - width: 3em; - display: block; - color: #fff; - text-align: center; - } - - @import '~@assets/less/common.less'; -</style> \ No newline at end of file +</script> \ No newline at end of file -- Gitblit v1.9.3