From 75b875f7538bf7700684c2eb2582c2d8f0aa8675 Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期五, 11 七月 2025 10:02:24 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/eam/maintenance/EamInspectionOrderList.vue | 35 +- src/views/eam/equipment/modules/EamEquipmentModal.vue | 3 src/views/flowable/workflow/InspectionOrder/InspectionOrderHandle.vue | 228 ++++++++++-------- src/views/eam/base/modules/EamMaintenanceStandardModal.vue | 372 +++++++++++++++--------------- src/views/eam/maintenance/modules/EamInspectionOrderModal.vue | 27 - src/views/flowable/workflow/FlowTodo.vue | 5 src/views/eam/base/EamMaintenanceStandardList.vue | 8 7 files changed, 355 insertions(+), 323 deletions(-) diff --git a/src/views/eam/base/EamMaintenanceStandardList.vue b/src/views/eam/base/EamMaintenanceStandardList.vue index a845f64..b786d51 100644 --- a/src/views/eam/base/EamMaintenanceStandardList.vue +++ b/src/views/eam/base/EamMaintenanceStandardList.vue @@ -113,6 +113,14 @@ <a @click.stop="event=>event.stopPropagation()">鍒犻櫎</a> </a-popconfirm> </template> + + <template v-if="record.standardStatus != 'WAIT_SUBMIT'"> + <a-divider type="vertical"/> + + <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)"> + <a @click.stop="event=>event.stopPropagation()">鍒犻櫎</a> + </a-popconfirm> + </template> </span> </a-table> diff --git a/src/views/eam/base/modules/EamMaintenanceStandardModal.vue b/src/views/eam/base/modules/EamMaintenanceStandardModal.vue index 3ac6bc5..fd149fc 100644 --- a/src/views/eam/base/modules/EamMaintenanceStandardModal.vue +++ b/src/views/eam/base/modules/EamMaintenanceStandardModal.vue @@ -1,13 +1,6 @@ <template> - <j-modal - :title="title" - :width="1200" - :visible="visible" - :confirmLoading="confirmLoading" - switchFullscreen - @ok="handleOk" - @cancel="handleCancel" - cancelText="鍏抽棴"> + <j-modal :title="title" :width="1200" :visible="visible" :confirmLoading="confirmLoading" switchFullscreen + @ok="handleOk" @cancel="handleCancel" cancelText="鍏抽棴"> <a-spin :spinning="spinning"> <a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-row :gutter="24"> @@ -44,6 +37,7 @@ <a-col :span="8"> <a-form-model-item prop="maintenancePeriod" label="淇濆吇鍛ㄦ湡"> <a-input-number v-model="model.maintenancePeriod" placeholder="璇疯緭鍏ヤ繚鍏诲懆鏈�" :min="1" :precision="0" + :disabled="model.maintenanceCategory=='POINT_INSPECTION'||model.maintenanceCategory=='SECOND_MAINTENANCE'" style="width: 100%"/> </a-form-model-item> </a-col> @@ -70,33 +64,44 @@ </a-row> <a-row :gutter="24"> - <j-vxe-table - ref="editableDetailTable" - :rowNumber="true" - :rowSelection="true" - :bordered="true" - :alwaysEdit="true" - :toolbar="true" - :toolbarConfig="detail.toolbarConfig" - keep-source - :height="300" - :loading="detail.loading" - :dataSource="detail.dataSource" - :columns="detail.columns" - style="margin-top: 8px;"> - <template v-slot:itemPart="props"> - <a-textarea v-model="props.row.itemPart" allowClear @blur="$refs.editableDetailTable.validateTable()" - :placeholder="!Boolean(model.maintenanceCategory)?'璇烽�夋嫨淇濆吇鍒嗙被':'璇疯緭鍏ラ儴浣�'" :rows="1" - autoSize :disabled="!Boolean(model.maintenanceCategory)"/> + <a-tabs :active-key="activeTabKey" v-if="model.maintenanceCategory" @change="handleTabChange"> + <!--鐐规--> + <template v-if="model.maintenanceCategory=='POINT_INSPECTION'"> + <a-tab-pane tab="鏃ョ偣妫�" key="1" forceRender> + <j-vxe-table ref="editableDetailTable1" rowNumber rowSelection bordered alwaysEdit toolbar + :toolbarConfig="detail.toolbarConfig" keep-source :height="300" + :dataSource="detail.dayInspectionList" :columns="detail.inspectionColumns"/> + </a-tab-pane> + <a-tab-pane tab="鍛ㄧ偣妫�" key="2" forceRender> + <j-vxe-table ref="editableDetailTable2" rowNumber rowSelection bordered alwaysEdit toolbar + :toolbarConfig="detail.toolbarConfig" keep-source :height="300" + :dataSource="detail.weekInspectionList" :columns="detail.inspectionColumns"/> + </a-tab-pane> </template> - <template v-slot:itemCategory="props"> - <j-dict-select-tag v-model="props.row.itemCategory" :dict-code="encodedDictCode" - @change="$refs.editableDetailTable.validateTable()" - :placeholder="!Boolean(model.maintenanceCategory)?'璇烽�夋嫨淇濆吇鍒嗙被':'璇烽�夋嫨椤逛繚鍏诲垎绫�'" - :disabled="!Boolean(model.maintenanceCategory)"/> + <!--浜屼繚--> + <template v-if="model.maintenanceCategory=='SECOND_MAINTENANCE'"> + <a-tab-pane tab="鎿嶄綔宸�" key="1" forceRender> + <j-vxe-table ref="editableDetailTable1" rowNumber rowSelection bordered alwaysEdit toolbar + :toolbarConfig="detail.toolbarConfig" keep-source :height="300" + :dataSource="detail.operatorMaintenanceList" :columns="detail.secondMaintenanceColumns"/> + </a-tab-pane> + <a-tab-pane tab="缁翠慨宸�" key="2" forceRender> + <j-vxe-table ref="editableDetailTable2" rowNumber rowSelection bordered alwaysEdit toolbar + :toolbarConfig="detail.toolbarConfig" keep-source :height="300" + :dataSource="detail.repairerMaintenanceList" :columns="detail.secondMaintenanceColumns"/> + </a-tab-pane> </template> - </j-vxe-table> + + <!--涓変繚--> + <template v-if="model.maintenanceCategory=='THIRD_MAINTENANCE'"> + <a-tab-pane tab="涓変繚" key="1"> + <j-vxe-table ref="editableDetailTable1" rowNumber rowSelection bordered alwaysEdit toolbar + :toolbarConfig="detail.toolbarConfig" keep-source :height="300" + :dataSource="detail.thirdMaintenanceList" :columns="detail.thirdMaintenanceColumns"/> + </a-tab-pane> + </template> + </a-tabs> </a-row> </a-form-model> </a-spin> @@ -132,6 +137,7 @@ }, confirmLoading: false, spinning: false, + activeTabKey: '1', validatorRules: { standardName: [ { required: true, message: '璇疯緭鍏ヨ鑼冨悕绉�', trigger: 'change' } @@ -156,9 +162,12 @@ upgrade: '/eam/maintenanceStandard/upgrade' }, detail: { - loading: false, - dataSource: [], - columns: [ + dayInspectionList: [], + weekInspectionList: [], + operatorMaintenanceList: [], + repairerMaintenanceList: [], + thirdMaintenanceList: [], + inspectionColumns: [ { title: 'ID', key: 'id', @@ -176,27 +185,7 @@ align: 'center', placeholder: '璇疯緭鍏ラ」鐩簭鍙�', width: 150, - validateRules: [ - { required: true, message: '璇疯緭鍏ラ」鐩簭鍙�' }, - { unique: true, message: '椤圭洰搴忓彿涓嶈兘閲嶅' } - ] - }, - { - title: '閮ㄤ綅', - key: 'itemPart', - type: JVXETypes.slot, - slotName: 'itemPart', - placeholder: '璇疯緭鍏ラ儴浣�', - align: 'center', - validateRules: [{ handler: this.itemPartValidate }] - }, - { - title: '淇濆吇椤瑰垎绫�', - key: 'itemCategory', - type: JVXETypes.slot, - slotName: 'itemCategory', - align: 'center', - validateRules: [{ handler: this.itemCategoryValidate }] + validateRules: [{ required: true, message: '璇疯緭鍏�${title}' }] }, { title: '淇濆吇椤圭洰', @@ -204,22 +193,10 @@ placeholder: '璇疯緭鍏ヤ繚鍏婚」鐩�', type: JVXETypes.textarea, align: 'center', - validateRules: [ - { required: true, message: '璇疯緭鍏ヤ繚鍏婚」鐩�' } - ] - }, - { - title: '淇濆吇瑙勮寖鎴栬姹�', - key: 'itemDemand', - placeholder: '璇疯緭鍏ヤ繚鍏昏鑼冩垨瑕佹眰', - type: JVXETypes.textarea, - align: 'center', - validateRules: [ - { required: true, message: '璇疯緭鍏ヤ繚鍏昏鑼冩垨瑕佹眰' } - ] + validateRules: [{ required: true, message: '璇疯緭鍏�${title}' }] } ], - defaultColumns: [ + secondMaintenanceColumns: [ { title: 'ID', key: 'id', @@ -237,27 +214,7 @@ align: 'center', placeholder: '璇疯緭鍏ラ」鐩簭鍙�', width: 150, - validateRules: [ - { required: true, message: '璇疯緭鍏ラ」鐩簭鍙�' }, - { unique: true, message: '椤圭洰搴忓彿涓嶈兘閲嶅' } - ] - }, - { - title: '閮ㄤ綅', - key: 'itemPart', - type: JVXETypes.slot, - slotName: 'itemPart', - placeholder: '璇疯緭鍏ラ儴浣�', - align: 'center', - validateRules: [{ handler: this.itemPartValidate }] - }, - { - title: '淇濆吇椤瑰垎绫�', - key: 'itemCategory', - type: JVXETypes.slot, - slotName: 'itemCategory', - align: 'center', - validateRules: [{ handler: this.itemCategoryValidate }] + validateRules: [{ required: true, message: '璇疯緭鍏�${title}' }] }, { title: '淇濆吇椤圭洰', @@ -265,9 +222,7 @@ placeholder: '璇疯緭鍏ヤ繚鍏婚」鐩�', type: JVXETypes.textarea, align: 'center', - validateRules: [ - { required: true, message: '璇疯緭鍏ヤ繚鍏婚」鐩�' } - ] + validateRules: [{ required: true, message: '璇疯緭鍏�${title}' }] }, { title: '淇濆吇瑙勮寖鎴栬姹�', @@ -275,9 +230,43 @@ placeholder: '璇疯緭鍏ヤ繚鍏昏鑼冩垨瑕佹眰', type: JVXETypes.textarea, align: 'center', - validateRules: [ - { required: true, message: '璇疯緭鍏ヤ繚鍏昏鑼冩垨瑕佹眰' } - ] + validateRules: [{ required: true, message: '璇疯緭鍏�${title}' }] + } + ], + thirdMaintenanceColumns: [ + { + title: 'ID', + key: 'id', + type: JVXETypes.hidden + }, + { + title: 'standardId', + key: 'standardId', + type: JVXETypes.hidden + }, + { + title: '淇濆吇閮ㄤ綅', + key: 'itemPart', + type: JVXETypes.textarea, + slotName: 'itemPart', + align: 'center', + validateRules: [{ required: true, message: '璇疯緭鍏�${title}' }] + }, + { + title: '淇濆吇鍐呭', + key: 'itemName', + placeholder: '璇疯緭鍏�${title}', + type: JVXETypes.textarea, + align: 'center', + validateRules: [{ required: true, message: '璇疯緭鍏�${title}' }] + }, + { + title: '楠屾敹鏍囧噯', + key: 'itemDemand', + placeholder: '璇疯緭鍏�${title}', + type: JVXETypes.textarea, + align: 'center', + validateRules: [{ required: true, message: '璇疯緭鍏�${title}' }] } ], toolbarConfig: { @@ -289,36 +278,14 @@ } } }, - - watch: { - 'model.maintenanceCategory': { - handler(val) { - if (val) { - if (val != 'THIRD_MAINTENANCE') this.detail.columns = [...this.detail.defaultColumns.filter(item => item.key != 'itemPart')] - else this.detail.columns = [...this.detail.defaultColumns.filter(item => item.key != 'itemCategory')] - } - else this.detail.columns = [...this.detail.defaultColumns] - } - } - }, - computed: { - encodedDictCode() { - let suffix - if (!Boolean(this.model.maintenanceCategory) || this.model.maintenanceCategory === 'THIRD_MAINTENANCE') return - else suffix = this.model.maintenanceCategory.split('_')[1] - - const dictCode = `sys_dict_item,item_text,item_value,item_value like '%${suffix}' and dict_id='1940598438685134850'` - return encodeURIComponent(dictCode) - } - }, methods: { // 涓婚〉闈㈢偣鍑绘柊澧炲悗瑙﹀彂 add() { + this.resetData() this.model = {} this.visible = true this.editable = true this.upgradeFlag = false - this.detail.dataSource = [] }, /** @@ -326,11 +293,11 @@ * @param record 涓婚〉闈㈠垪琛ㄨ璁板綍 */ edit(record) { + this.resetData() this.model = Object.assign({}, record) this.visible = true this.editable = false this.upgradeFlag = false - this.detail.dataSource = [] this.loadDetail(record.id) }, @@ -339,12 +306,39 @@ * @param record 涓婚〉闈㈠垪琛ㄨ璁板綍 */ upgrade(record) { + this.resetData() this.model = Object.assign({}, record) this.visible = true this.editable = false this.upgradeFlag = true - this.detail.dataSource = [] this.loadDetail(record.id) + }, + + //鍔犺浇璇︽儏鏁版嵁 + loadDetail(standardId) { + this.spinning = true + getAction(this.url.detail, { standardId }) + .then(res => { + if (res.success) { + switch (this.model.maintenanceCategory) { + case 'POINT_INSPECTION': + this.detail.dayInspectionList = res.result.filter(item => item.itemCategory == 'DAY_INSPECTION') + this.detail.weekInspectionList = res.result.filter(item => item.itemCategory == 'WEEK_INSPECTION') + break + case 'SECOND_MAINTENANCE': + this.detail.operatorMaintenanceList = res.result.filter(item => item.itemCategory == 'OPERATOR_MAINTENANCE') + this.detail.repairerMaintenanceList = res.result.filter(item => item.itemCategory == 'REPAIRER_MAINTENANCE') + break + case 'THIRD_MAINTENANCE': + this.detail.thirdMaintenanceList = res.result.filter(item => !Boolean(item.itemCategory)) + break + default: + } + } + }) + .finally(() => { + this.spinning = false + }) }, /** @@ -352,71 +346,93 @@ * @param value 淇濆吇鍒嗙被鍊� */ handleMaintenanceCategoryChange(value) { + delete this.model.maintenancePeriod switch (value) { case 'THIRD_MAINTENANCE': this.model.periodUnit = '骞�' + if (this.activeTabKey != '1') this.activeTabKey = '1' break case 'SECOND_MAINTENANCE': this.model.periodUnit = '鏈�' + this.model.maintenancePeriod = 6 break case 'POINT_INSPECTION': this.model.periodUnit = '澶�' + this.model.maintenancePeriod = 1 break default: delete this.model.periodUnit } - - const tableData = this.$refs.editableDetailTable.getTableData() - tableData.forEach(item => { - if (value !== 'THIRD_MAINTENANCE') delete item.itemPart - delete item.itemCategory - }) - - this.detail.dataSource = [...tableData] - this.$refs.editableDetailTable.validateTable() + if (this.model.maintenancePeriod) this.$refs.form.clearValidate('maintenancePeriod') }, - /** - * 淇濆吇閮ㄤ綅鏍¢獙 - * @param cellValue 杈撳叆鍊� - * @param callback 鍥炶皟鍑芥暟 - */ - itemPartValidate({ cellValue }, callback) { - if (this.model.maintenanceCategory === 'THIRD_MAINTENANCE') { - if (cellValue) callback(true) - else callback(false, '璇烽�夋嫨${title}') - } else { - callback(true) - } - }, - - /** - * 淇濆吇椤瑰垎绫绘牎楠� - * @param cellValue 杈撳叆鍊� - * @param callback 鍥炶皟鍑芥暟 - */ - itemCategoryValidate({ cellValue }, callback) { - if (this.model.maintenanceCategory === 'THIRD_MAINTENANCE') { - callback(true) - } else { - if (cellValue) callback(true) - else callback(false, '璇烽�夋嫨${title}') - } + async handleTabChange(tabKey) { + let errMap = await this.$refs['editableDetailTable' + this.activeTabKey].validateTable() + if (errMap) return + this.activeTabKey = tabKey }, // 鎻愪氦浜嬩欢 async handleOk() { + // 淇濆吇鍒嗙被涓虹┖鏃朵笉鏍¢獙鏄庣粏 + if (this.model.maintenanceCategory) { + // 鏍¢獙褰撲笅tab涓嬬殑琛ㄦ牸鏄惁涓虹┖ + let tableData = this.$refs['editableDetailTable' + this.activeTabKey].getTableData() + if (tableData.length == 0) { + this.$notification.warning({ + message: '娑堟伅', + description: '褰撳墠淇濆吇鏄庣粏涓嶈兘涓虹┖' + }) + return + } + + // 鏍¢獙褰撳墠tab涓嬬殑琛ㄦ牸鏍¢獙瑙勫垯 + let errMap = await this.$refs['editableDetailTable' + this.activeTabKey].validateTable() + if (errMap) return false + + // 鏍¢獙鍙︿竴tab淇濆吇鏄庣粏琛ㄦ牸鏄惁涓虹┖(涓変繚鏃犻渶) + if (this.model.maintenanceCategory != 'THIRD_MAINTENANCE') { + if (this.activeTabKey == '1') tableData = this.$refs.editableDetailTable2.getTableData() + else tableData = this.$refs.editableDetailTable1.getTableData() + + if (tableData.length == 0) { + this.activeTabKey = this.activeTabKey == '1' ? '2' : '1' + this.$notification.warning({ + message: '娑堟伅', + description: '褰撳墠淇濆吇鏄庣粏涓嶈兘涓虹┖' + }) + return + } + } + } + const that = this - let errMap = await that.$refs.editableDetailTable.validateTable() - if (errMap) return false // 瑙﹀彂琛ㄥ崟楠岃瘉 this.$refs.form.validate(valid => { if (valid) { - let tableData = that.$refs.editableDetailTable.getTableData() - let removeData = that.$refs.editableDetailTable.getDeleteData() - that.model.tableDetailList = [...tableData] - that.model.removeDetailList = [...removeData] - + let tableData1 = that.$refs.editableDetailTable1.getTableData() + let tableData2 = [] + let currentTabItemMaintenanceList = [] + if (this.model.maintenanceCategory != 'THIRD_MAINTENANCE') { + tableData2 = that.$refs.editableDetailTable2.getTableData() + if (this.model.maintenanceCategory == 'POINT_INSPECTION') currentTabItemMaintenanceList = ['DAY_INSPECTION', 'WEEK_INSPECTION'] + else currentTabItemMaintenanceList = ['OPERATOR_MAINTENANCE', 'REPAIRER_MAINTENANCE'] + } + if (currentTabItemMaintenanceList.length != 0) { + tableData1 = tableData1.map(item => { + return { + ...item, + itemCategory: currentTabItemMaintenanceList[0] + } + }) + tableData2 = tableData2.map(item => { + return { + ...item, + itemCategory: currentTabItemMaintenanceList[1] + } + }) + } + that.model.tableDetailList = [...tableData1, ...tableData2] that.confirmLoading = that.spinning = true let httpUrl = '' let method = '' @@ -456,6 +472,15 @@ }) }, + resetData() { + this.activeTabKey = '1' + this.detail.dayInspectionList = [] + this.detail.weekInspectionList = [] + this.detail.operatorMaintenanceList = [] + this.detail.repairerMaintenanceList = [] + this.detail.thirdMaintenanceList = [] + }, + handleCancel() { this.close() }, @@ -464,23 +489,6 @@ this.$emit('close') this.visible = false this.$refs.form.clearValidate() - }, - - //鍔犺浇璇︽儏鏁版嵁 - loadDetail(standardId) { - this.spinning = true - this.detail.dataSource = [] - if (standardId) { - getAction(this.url.detail, { standardId }) - .then(res => { - if (res.success) { - this.detail.dataSource = [...res.result] - } - }) - .finally(() => { - this.spinning = false - }) - } } } diff --git a/src/views/eam/equipment/modules/EamEquipmentModal.vue b/src/views/eam/equipment/modules/EamEquipmentModal.vue index a06b114..f1ebd75 100644 --- a/src/views/eam/equipment/modules/EamEquipmentModal.vue +++ b/src/views/eam/equipment/modules/EamEquipmentModal.vue @@ -352,9 +352,6 @@ } } }, - created() { - this.loadAllProductionTree() - }, methods: { add() { this.editable = true diff --git a/src/views/eam/maintenance/EamInspectionOrderList.vue b/src/views/eam/maintenance/EamInspectionOrderList.vue index 6490a89..fc1b94d 100644 --- a/src/views/eam/maintenance/EamInspectionOrderList.vue +++ b/src/views/eam/maintenance/EamInspectionOrderList.vue @@ -282,21 +282,24 @@ }, handleInspection(id) { var that = this - getAction(that.url.receiveInspectionOrder, { id }).then((res) => { - if (res.success) { - that.$notification.success({ - message: '娑堟伅', - description: res.message - }) - that.loadData() - } else { - // that.$message.warning(res.message); - that.$notification.warning({ - message: '娑堟伅', - description: res.message - }) - } - }) + this.loading = true + getAction(that.url.receiveInspectionOrder, { id }) + .then((res) => { + if (res.success) { + that.$notification.success({ + message: '娑堟伅', + description: res.message + }) + that.loadData() + } else { + // that.$message.warning(res.message); + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + this.loading = false + } + }) }, handleOrReceive(id) { if (!this.url.cancelInspectionOrder) { @@ -400,7 +403,7 @@ onInspectionDateChange: function(value, dateString) { this.queryParam.inspectionDateBegin = dateString[0] this.queryParam.inspectionDateEnd = dateString[1] - }, + } } } </script> diff --git a/src/views/eam/maintenance/modules/EamInspectionOrderModal.vue b/src/views/eam/maintenance/modules/EamInspectionOrderModal.vue index 84c5ec1..8361c6c 100644 --- a/src/views/eam/maintenance/modules/EamInspectionOrderModal.vue +++ b/src/views/eam/maintenance/modules/EamInspectionOrderModal.vue @@ -131,21 +131,18 @@ type: JVXETypes.normal, width: 100, align: 'center', - disabled: true }, { title: '淇濆吇椤�', key: 'itemName', - type: JVXETypes.textarea, + type: JVXETypes.normal, align: 'center', - disabled: true }, { title: '淇濆吇瑙勮寖鎴栬姹�', key: 'itemDemand', - type: JVXETypes.textarea, + type: JVXETypes.normal, align: 'center', - disabled: true } ], weekInspectionColumns: [], @@ -156,40 +153,38 @@ type: JVXETypes.normal, width: 60, align: 'center', - disabled: true }, { title: '淇濆吇椤�', key: 'itemName', - type: JVXETypes.textarea, + type: JVXETypes.normal, align: 'center', - disabled: true }, { title: '淇濆吇瑕佹眰', key: 'itemDemand', - type: JVXETypes.textarea, + type: JVXETypes.normal, align: 'center', - disabled: true }, { title: '鐐规缁撴灉', key: 'inspectionResult', - type: JVXETypes.textarea, + type: JVXETypes.select, + dictCode: 'inspection_project_result', align: 'center', disabled: true }, { title: '寮傚父鎻忚堪', key: 'exceptionDescription', - type: JVXETypes.textarea, + type: JVXETypes.normal, align: 'center', - disabled: true }, { title: '寮傚父鏄惁鎶ヤ慨', key: 'reportFlag', - type: JVXETypes.textarea, + type: JVXETypes.select, + ditCode: 'yn', align: 'center', disabled: true } @@ -302,8 +297,8 @@ }) .then(res => { if (res.success) { - if (res.result.length > 0) { - this.detail.weekInspectionList = res.result + if (res.result.list.length > 0) { + this.detail.weekInspectionList = res.result.list this.detail.weekInspectionColumns = this.detail.weekInspectionOrderColumns } } diff --git a/src/views/flowable/workflow/FlowTodo.vue b/src/views/flowable/workflow/FlowTodo.vue index 7d6937e..cd203f2 100644 --- a/src/views/flowable/workflow/FlowTodo.vue +++ b/src/views/flowable/workflow/FlowTodo.vue @@ -91,7 +91,8 @@ <maintenance-standard-approval-modal ref="maintenanceStandardApprovalModal" @modalFormOk="modalFormOk" :selectShenpiData="selectedRowData"/> - <inspection-order-handle ref="modalFormInspectionOrder" :selectShenpiData="selectedRowData"/> + <inspection-order-handle ref="modalFormInspectionOrder" :selectShenpiData="selectedRowData" + @modalFormOk="modalFormOk"/> </a-card> </template> @@ -278,7 +279,7 @@ handInspectionOrder(record) { console.log('record----->', record) - this.selectInspectionOrderData = Object.assign({}, record) + this.selectedRowData = Object.assign({}, record) this.$refs.modalFormInspectionOrder.visible = true this.$refs.modalFormInspectionOrder.title = record.name this.$refs.modalFormInspectionOrder.getAllApproveData(record) diff --git a/src/views/flowable/workflow/InspectionOrder/InspectionOrderHandle.vue b/src/views/flowable/workflow/InspectionOrder/InspectionOrderHandle.vue index edb6c42..4a6b56f 100644 --- a/src/views/flowable/workflow/InspectionOrder/InspectionOrderHandle.vue +++ b/src/views/flowable/workflow/InspectionOrder/InspectionOrderHandle.vue @@ -1,6 +1,6 @@ <template> <j-modal :title="title" :width="1200" :visible="visible" - :okButtonProps="{ class:{'jee-hidden': disableSubmit||!hasInspectionDateArrived} }" @ok="submitForm" + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" @ok="submitForm" @cancel="handleCancel" :mask-closable="false" :confirmLoading="confirmLoading" fullscreen> <a-spin :spinning="spinning"> <a-form-model ref='form' :model='tableRowRecord' :labelCol="labelCol" :wrapperCol="wrapperCol" @@ -76,13 +76,13 @@ </a-tabs> </a-col> - <a-col :span="disableSubmit||tableRowRecord.inspectionStatus=='UNDER_INSPECTION'?16:10"> - <a-tabs v-model="activeTabKey"> + <a-col :span="!isDisplayConfirm?16:10"> + <a-tabs :active-key="activeTabKey" @change="handleTabChange"> <a-tab-pane key="1" tab="鏃ョ偣妫�"> - <j-vxe-table ref="editableDetailTable" :rowNumber="false" rowSelection bordered + <j-vxe-table ref="editableDetailTable1" :rowNumber="false" rowSelection bordered alwaysEdit :toolbar="false" keep-source :height="300" :loading="detail.loading" - :dataSource="detail.dataSource" :columns="detail.columns" - @selectRowChange="handleTableSelectRowChange"> + :dataSource="detail.dayInspectionList" :columns="detail.columns" + @selectRowChange="handleTableSelectRowChange($event,'Day')"> <template v-slot:inspectionResult="props"> <j-dict-select-tag v-model="props.row.inspectionResult" dictCode="inspection_project_result" :disabled="isDisableOperation" placeholder="璇烽�夋嫨鐐规缁撴灉" @@ -92,77 +92,63 @@ <template v-slot:exceptionDescription="props"> <a-textarea style="height: 32px" v-model="props.row.exceptionDescription" - :placeholder="props.row.inspectionResult==='2'?'璇疯緭鍏ュ紓甯告弿杩�':''" - :disabled="isDisableOperation||!props.row.inspectionResult||props.row.inspectionResult==='1'"/> + :placeholder="props.row.inspectionResult&&props.row.inspectionResult!='NORMAL'?'璇疯緭鍏ュ紓甯告弿杩�':''" + :disabled="isDisableOperation||!props.row.inspectionResult||props.row.inspectionResult=='NORMAL'"/> </template> <template v-slot:reportFlag="props"> <j-dict-select-tag v-model="props.row.reportFlag" - :placeholder="props.row.inspectionResult==='2'?'璇烽�夋嫨寮傚父鏄惁鎶ヤ慨':''" - :disabled="isDisableOperation||!props.row.inspectionResult||props.row.inspectionResult==='1'" + :placeholder="props.row.inspectionResult&&props.row.inspectionResult!='NORMAL'?'璇烽�夋嫨寮傚父鏄惁鎶ヤ慨':''" + :disabled="isDisableOperation||!props.row.inspectionResult||props.row.inspectionResult=='NORMAL'" dictCode="yn" style="width: 100%"/> </template> </j-vxe-table> </a-tab-pane> - <a-tab-pane key="2" tab="鍛ㄧ偣妫�"> - <j-vxe-table ref="editableDetailTable" :rowNumber="false" rowSelection bordered + <a-tab-pane key="2" tab="鍛ㄧ偣妫�" forceRender> + <j-vxe-table ref="editableDetailTable2" :rowNumber="false" rowSelection bordered alwaysEdit :toolbar="false" keep-source :height="300" :loading="detail.loading" :dataSource="detail.weekInspectionList" :columns="detail.columns" - @selectRowChange="handleTableSelectRowChange"> + @selectRowChange="handleTableSelectRowChange($event,'Week')"> <template v-slot:inspectionResult="props"> <j-dict-select-tag v-model="props.row.inspectionResult" dictCode="inspection_project_result" - :disabled="isDisableOperation" placeholder="璇烽�夋嫨鐐规缁撴灉" + :disabled="isDisableOperation||detail.weekInspectionFinishedFlag" + placeholder="璇烽�夋嫨鐐规缁撴灉" @change="handleInspectionResultSelectChange($event,props.row)" style="width: 100%"/> </template> <template v-slot:exceptionDescription="props"> <a-textarea style="height: 32px" v-model="props.row.exceptionDescription" - :placeholder="props.row.inspectionResult==='2'?'璇疯緭鍏ュ紓甯告弿杩�':''" - :disabled="isDisableOperation||!props.row.inspectionResult||props.row.inspectionResult==='1'"/> + :placeholder="props.row.inspectionResult&&props.row.inspectionResult!='NORMAL'?'璇疯緭鍏ュ紓甯告弿杩�':''" + :disabled="isDisableOperation||!props.row.inspectionResult||props.row.inspectionResult=='NORMAL'"/> </template> <template v-slot:reportFlag="props"> <j-dict-select-tag v-model="props.row.reportFlag" - :placeholder="props.row.inspectionResult==='2'?'璇烽�夋嫨寮傚父鏄惁鎶ヤ慨':''" - :disabled="isDisableOperation||!props.row.inspectionResult||props.row.inspectionResult==='1'" + :placeholder="props.row.inspectionResult&&props.row.inspectionResult!='NORMAL'?'璇烽�夋嫨寮傚父鏄惁鎶ヤ慨':''" + :disabled="isDisableOperation||!props.row.inspectionResult||props.row.inspectionResult=='NORMAL'" dictCode="yn" style="width: 100%"/> </template> </j-vxe-table> </a-tab-pane> <template v-if="selectShenpiData.procInstId"> - <a-tab-pane key='3' 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> - <div>澶勭悊浜猴細{{item.assignee_dictText}}</div> - <div v-if="index !==0">澶勭悊鏃堕暱锛歿{item.duration}}</div> - <div v-if="item.name !== '鎻愪氦鐢宠'">澶勭悊绫诲瀷锛歿{item.sequenceFlowName}}</div> - <div v-if="item.description">澶勭悊鎰忚锛歿{item.description}}</div> - </div> - </a-timeline-item> - </a-timeline> - </a-card> - </a-tab-pane> - - <a-tab-pane key='4' tab='娴佺▼鍥�'> - <img :src="imageSrc" width="100%" v-if="imageSrc"/> + <a-tab-pane key='3' tab='娴佺▼鍥�'> + <img :src="imageSrc" v-if="imageSrc"/> </a-tab-pane> </template> <a-button - v-if="selectedRowKeys.length>0&&!isDisableOperation&&hasInspectionDateArrived&&activeTabKey==='1'&&activeTabKey==='2'" + v-if="activeTabKey=='1'||activeTabKey=='2'" + :disabled="(activeTabKey=='1'&&selectedDayInspectionRowKeys.length==0)||(activeTabKey=='2'&&selectedWeekInspectionRowKeys.length==0)||(activeTabKey=='2'&&detail.weekInspectionFinishedFlag)||isDisableOperation" slot="tabBarExtraContent" type="primary" @click="handleSelectAllInspectionResult">鎵归噺鐐规姝e父 </a-button> </a-tabs> </a-col> - <a-col v-if="!disableSubmit&&isDisplayConfirm" :span="6"> + <a-col v-if="isDisplayConfirm" :span="6"> <a-tabs> <a-tab-pane tab="缁翠慨宸ョ‘璁�"> <a-row> @@ -211,7 +197,6 @@ confirmLoading: false, spinning: false, tableRowRecord: {}, - hitaskDataSource: [], validatorRules: { confirmDealType: [ { required: true, message: '璇烽�夋嫨澶勭悊绫诲瀷' } @@ -240,8 +225,6 @@ weekInspectionOrderList: '/eam/eamWeekInspectionDetail/queryStandardList' }, detail: { - loading: false, - dataSource: [], columns: [ { title: '搴忓彿', @@ -296,18 +279,18 @@ ] } ], - weekInspectionList: [] + dayInspectionList: [], + weekInspectionList: [], + weekInspectionFinishedFlag: false }, - selectedRowKeys: [], + selectedDayInspectionRowKeys: [], + selectedWeekInspectionRowKeys: [], disableSubmit: false, activeTabKey: '1', title: '' } }, computed: { - hasInspectionDateArrived() { - return moment(this.tableRowRecord.inspectionDate).diff(moment(), 'hours') <= 0 - }, isDisplayConfirm() { return ['WAIT_CONFIRM', 'COMPLETE'].includes(this.tableRowRecord.inspectionStatus) }, @@ -326,11 +309,6 @@ const param = { procInstId } const imageParam = { processDefinitionId, processInstanceId, TaskDefinitionKey: processDefinitionKey } const that = this - - getAction(this.url.queryHisTaskList, param) - .then(res => { - that.hitaskDataSource = res.result - }) downFile(this.url.diagramView, imageParam, 'get') .then((res => { @@ -352,20 +330,70 @@ */ async getBasicInformation(record) { this.activeTabKey = '1' - this.detail.dataSource = [] + this.detail.dayInspectionList = this.detail.weekInspectionList = [] this.spinning = true const param = { id: record.dataId } let res = await getAction(this.url.queryById, param) this.tableRowRecord = Object.assign({}, res.result) - this.loadDetail(record.dataId) + this.getDayInspectionOrderListByApi(record.dataId) console.log('record', record) this.getWeekInspectionOrderListByApi(this.tableRowRecord.standardId) }, + /** + * 鑾峰彇鐐规宸ュ崟涓殑鏃ョ偣妫�鍒楄〃 + * @param orderId 宸ュ崟鍙� + */ + getDayInspectionOrderListByApi(orderId) { + if (orderId) { + getAction(this.url.detailList, { orderId }) + .then(res => { + if (res.success) { + this.detail.dayInspectionList = [...res.result] + } + }) + .finally(() => { + this.spinning = false + }) + } + }, + + /** + * 鑾峰彇鐐规宸ュ崟涓殑鍛ㄧ偣妫�鍒楄〃 + * @param standardId 瑙勮寖id + */ + getWeekInspectionOrderListByApi(standardId) { + console.log('standardId-------------------------', standardId) + getAction(this.url.weekInspectionOrderList, { standardId, inspectionDate: this.tableRowRecord.inspectionDate }) + .then(res => { + if (res.success) { + this.detail.weekInspectionList = res.result.list + this.detail.weekInspectionFinishedFlag = res.result.weekInsFlag + } + }) + .finally(() => { + this.spinning = false + }) + }, + + handleTabChange(tabKey) { + if (this.activeTabKey == '1') this.$refs.editableDetailTable1.clearValidate() + this.activeTabKey = tabKey + }, + + // 鎻愪氦浜嬩欢 async submitForm() { - let errMap = await this.$refs.editableDetailTable.validateTable() + let errMap = await this.$refs.editableDetailTable1.validateTable() if (errMap) { - console.log('err', errMap) + if (this.activeTabKey != '1') { + this.activeTabKey = '1' + // 鍐呴儴鏍¢獙鎻愮ず鍥爐ab鍒囨崲鏃跺畾浣嶅嚭鐜伴棶棰樺洜姝ゅ湪姝ゅ娓呮鍐呴儴鏍¢獙鎻愮ず锛屽鍔爊otification鎻愮ず + this.$refs.editableDetailTable1.clearValidate() + this.$notification.warning({ + message: '娑堟伅', + description: '鏃ョ偣妫�缁撴灉涓嶈兘涓虹┖' + }) + } return } @@ -377,20 +405,26 @@ flowTaskVo.taskId = this.selectShenpiData.id flowTaskVo.userId = this.selectShenpiData.assignee flowTaskVo.instanceId = this.selectShenpiData.procInstId - flowTaskVo.values = this.selectShenpiData.variables flowTaskVo.confirmDealType = this.tableRowRecord.confirmDealType flowTaskVo.confirmComment = this.tableRowRecord.confirmComment - flowTaskVo.tableDetailList = this.$refs.editableDetailTable.getTableData() + flowTaskVo.tableDetailList = this.$refs.editableDetailTable1.getTableData() + if (!this.detail.weekInspectionFinishedFlag) flowTaskVo.tableWeekDetailList = this.$refs.editableDetailTable2.getTableData() const that = this postAction(this.url.approve, flowTaskVo) .then((res) => { if (res.success) { - that.$message.success(res.message) + that.$notification.success({ + message: '娑堟伅', + description: res.message + }) //鍒锋柊琛ㄦ牸 - that.$emit('searchReset') + that.$emit('modalFormOk') that.handleCancel() } else { - that.$message.warning(res.message) + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) } }) .finally(() => { @@ -410,24 +444,37 @@ // 鎵归噺閫夋嫨鎵�鏈夌偣妫�缁撴灉 handleSelectAllInspectionResult() { - this.selectedRowKeys.forEach(key => { - const dataItem = this.detail.dataSource.find(item => item.id === key) - if (dataItem && dataItem.inspectionResult !== '1') { + let selectedRowKeys, prefix + if (this.activeTabKey == '1') { + selectedRowKeys = this.selectedDayInspectionRowKeys + prefix = 'day' + } + else if (this.activeTabKey == '2') { + selectedRowKeys = this.selectedWeekInspectionRowKeys + prefix = 'week' + } + else selectedRowKeys = [] + if (selectedRowKeys.length == 0) return + + selectedRowKeys.forEach(key => { + const dataItem = this.detail[prefix + 'InspectionList'].find(item => item.id === key) + if (dataItem && dataItem.inspectionResult !== 'NORMAL') { delete dataItem.exceptionDescription delete dataItem.reportFlag - dataItem.inspectionResult = '1' + dataItem.inspectionResult = 'NORMAL' } }) - this.$refs.editableDetailTable.clearCheckboxRow() - this.selectedRowKeys = [] + this.$refs['editableDetailTable' + this.activeTabKey].clearCheckboxRow() + this['selected' + prefix.charAt(0).toUpperCase() + prefix.slice(1) + 'InspectionRowKeys'] = [] }, /** * 琛ㄦ牸澶氶�夋鍙戠敓鏀瑰彉鏃惰Е鍙� * @param {selectedRowIds} 琛ㄦ牸涓凡閫夋嫨鐨処D鍒楄〃 + * @param key 鐐规鍖哄垎key */ - handleTableSelectRowChange({ selectedRowIds }) { - this.selectedRowKeys = selectedRowIds + handleTableSelectRowChange({ selectedRowIds }, key) { + this['selected' + key + 'InspectionRowKeys'] = selectedRowIds }, /** @@ -440,10 +487,16 @@ if (record.reportFlag) delete record.reportFlag }, + /** + * 寮傚父鎻忚堪涓庡紓甯告槸鍚︿繚淇瓧娈佃嚜瀹氫箟鏍¢獙鏂规硶 + * @param cellValue 鍗曞厓鏍煎唴鐨勫�� + * @param row 褰撳墠琛岃褰� + * @param callback 缁撴灉鍥炶皟鍑芥暟 + */ customValidator({ cellValue, row }, callback) { - if (row.inspectionResult === '2') { + if (this.activeTabKey == '1' && row.inspectionResult != 'NORMAL') { if (!cellValue) { - callback(false, '${title}涓嶈兘涓虹┖锛�') // false = 鏈�氳繃锛屽彲浠ヨ窡鑷畾涔夋彁绀� + callback(false, '璇疯緭鍏�${title}') // false = 鏈�氳繃锛屽彲浠ヨ窡鑷畾涔夋彁绀� } else { callback(true) // true = 閫氳繃楠岃瘉 } @@ -453,41 +506,8 @@ }, handleCancel() { - this.selectedRowKeys = [] + this.selectedDayInspectionRowKeys = this.selectedWeekInspectionRowKeys = [] this.visible = false - }, - - /** - * 鑾峰彇鏃ョ偣妫�鏄庣粏 - * @param orderId - */ - loadDetail(orderId) { - if (orderId) { - getAction(this.url.detailList, { orderId }) - .then(res => { - if (res.success) { - this.detail.dataSource = [...res.result] - } - }) - .finally(() => { - this.spinning = false - }) - } - }, - - /** - * 鑾峰彇鐐规宸ュ崟涓殑鍛ㄧ偣妫�鍒楄〃 - * @param standardId 瑙勮寖id - */ - getWeekInspectionOrderListByApi(standardId) { - console.log('standardId-------------------------', standardId) - getAction(this.url.weekInspectionOrderList, { standardId, inspectionDate: this.tableRowRecord.inspectionDate }) - .then(res => { - if (res.success) this.detail.weekInspectionList = res.result - }) - .finally(() => { - this.spinning = false - }) } } } -- Gitblit v1.9.3