From fe011cf7399e8ad5738ab7668a7d6109d9a5cbc6 Mon Sep 17 00:00:00 2001 From: zhaowei <zhaowei> Date: 星期一, 09 六月 2025 16:56:36 +0800 Subject: [PATCH] 联调终端停机上报页面列表查询、维护停机和拆分停机信息功能 --- src/views/dnc/base/modules/TerminalIndex/ReportEquipmentClose/MaintainShutdownModal.vue | 77 +++++---- src/views/dnc/base/modules/TerminalIndex/ReportEquipmentClose/SplitShutdownInfoModal.vue | 245 +++++++++++++++++++++--------- src/views/dnc/base/modules/TerminalIndex/ReportEquipmentClose.vue | 130 +++++++++------- 3 files changed, 286 insertions(+), 166 deletions(-) diff --git a/src/views/dnc/base/modules/TerminalIndex/ReportEquipmentClose.vue b/src/views/dnc/base/modules/TerminalIndex/ReportEquipmentClose.vue index 0f5f685..955c7a1 100644 --- a/src/views/dnc/base/modules/TerminalIndex/ReportEquipmentClose.vue +++ b/src/views/dnc/base/modules/TerminalIndex/ReportEquipmentClose.vue @@ -7,33 +7,34 @@ <div class="table-page-search-wrapper"> <a-form layout="inline"> <a-row :gutter="24"> - <a-col :span="4"> + <a-col :span="5"> <a-form-item label="璁惧"> - <a-select placeholder="璇烽�夋嫨璁惧" v-model="queryParam.equipmentId"></a-select> + <a-select placeholder="璇烽�夋嫨璁惧" v-model="queryParam.equipmentId"> + <a-select-option v-for="item in equipmentList" :key="item.equipmentId"> + {{item.equipmentId+`[${item.equipmentName}]`}} + </a-select-option> + </a-select> </a-form-item> </a-col> - <a-col :span="4"> + <a-col :span="5"> <a-form-item label="寮�濮嬫椂闂�"> - <a-date-picker style="width: 100%" show-time placeholder="璇烽�夋嫨寮�濮嬫椂闂�" v-model="queryParam.startTime"/> + <a-date-picker style="width: 100%" show-time placeholder="璇烽�夋嫨寮�濮嬫椂闂�" v-model="queryParam.startDate"/> </a-form-item> </a-col> - <a-col :span="4"> + <a-col :span="5"> <a-form-item label="缁撴潫鏃堕棿"> - <a-date-picker style="width: 100%" show-time placeholder="璇烽�夋嫨缁撴潫鏃堕棿" v-model="queryParam.endTime"/> + <a-date-picker style="width: 100%" show-time placeholder="璇烽�夋嫨缁撴潫鏃堕棿" v-model="queryParam.endDate"/> </a-form-item> </a-col> - <a-col :span="4"> + <a-col :span="5"> <a-form-item label="鍋滄満鍘熷洜"> - <a-select placeholder="璇烽�夋嫨鍋滄満鍘熷洜" v-model="queryParam.closeReason"></a-select> - </a-form-item> - </a-col> - - <a-col :span="4"> - <a-form-item label="鍋滄満鏃堕棿"> - <a-date-picker style="width: 100%" placeholder="璇烽�夋嫨鍋滄満鏃堕棿" v-model="queryParam.closeTime"/> + <a-select placeholder="璇烽�夋嫨鍋滄満鍘熷洜" v-model="queryParam.downtimeDescription"> + <a-select-option v-for="item in downtimeDescriptionList" :key="item.value">{{item.label}} + </a-select-option> + </a-select> </a-form-item> </a-col> @@ -51,17 +52,26 @@ <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> <div class="table-operator"> - <a-button type="primary" @click="handleMaintainShutdown">缁存姢鍋滄満</a-button> - <a-button type="primary" @click="handleSplitShutdownInfo">鎷嗗垎鍋滄満淇℃伅</a-button> + <a-button type="primary" @click="handleMaintainShutdown" :disabled="selectedRowKeys.length===0">缁存姢鍋滄満</a-button> + <a-button type="primary" @click="handleSplitShutdownInfo" + :disabled="selectedRowKeys.length===0||selectedRowKeys.length>1">鎷嗗垎鍋滄満淇℃伅 + </a-button> </div> - <a-table :dataSource="dataSource" :columns="columns" rowKey="id" bordered :pagination="false" - :rowSelection="{selectedRowKeys, onChange: onSelectChange}"/> + <a-table :dataSource="dataSource" :columns="columns" rowKey="id" bordered :pagination="false" :loading="loading" + :rowSelection="{selectedRowKeys, onChange: onSelectChange}"> + <template slot="downtimeType" slot-scope="text"> + {{ text!=null?text === 0 ? '璁″垝鍋滄満' : '闈炶鍒掑仠鏈�':'' }} + </template> + </a-table> </a-card> - <maintain-shutdown-modal ref="maintainShutdownModal"/> + <maintain-shutdown-modal :downtimeDescriptionList="downtimeDescriptionList" ref="maintainShutdownModal" + @submitSuccess="loadData"/> - <split-shutdown-info-modal ref="splitShutdownInfoModal"/> + <split-shutdown-info-modal ref="splitShutdownInfoModal" :selectedRow="selectionRows[0]" + :downtimeDescriptionList="downtimeDescriptionList" + @submitSuccess="clearSelectedRowKeysAndLoadData"/> </div> </template> @@ -69,6 +79,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin' import MaintainShutdownModal from './ReportEquipmentClose/MaintainShutdownModal' import SplitShutdownInfoModal from './ReportEquipmentClose/SplitShutdownInfoModal' + import { getAction } from '@/api/manage' export default { name: 'ReportEquipmentClose', @@ -76,6 +87,8 @@ mixins: [JeecgListMixin], data() { return { + equipmentList: [], + downtimeDescriptionList: [], columns: [ { title: '璁惧缂栧彿', @@ -89,17 +102,19 @@ dataIndex: 'equipmentName' }, { - title: '鍋滄満缂栧彿', + title: '鍋滄満鍘熷洜', align: 'center', - dataIndex: 'shutdownId' + dataIndex: 'downtimeDescription' }, { title: '鍋滄満绫诲瀷', align: 'center', - dataIndex: 'shutdownType' + scopedSlots: { customRender: 'downtimeType' }, + dataIndex: 'downtimeType', + width: 150 }, { - title: '鍋滄満鏃堕棿', + title: '鍋滄満鏃堕棿(MIN)', align: 'center', width: 150, dataIndex: 'shutdownDuration' @@ -108,63 +123,62 @@ title: '寮�濮嬫椂闂�', align: 'center', width: 200, - dataIndex: 'startTime' + dataIndex: 'startDate' }, { title: '缁撴潫鏃堕棿', align: 'center', width: 200, - dataIndex: 'endTime' + dataIndex: 'endDate' }, { title: '褰曞叆绫诲瀷', align: 'center', width: 100, - dataIndex: 'recordType' - } - ], - dataSource: [ - { - id: 1, - equipmentId: '3140221', - equipmentName: '鏁版帶鏈哄簥', - shutdownDuration: 360, - startTime: '2025-05-20 02:21:49', - endTime: '2525-05-20 08:21:59', - recordType: '鑷姩涓婃姤' - }, - { - id: 2, - equipmentId: '3140221', - equipmentName: '鏁版帶鏈哄簥', - shutdownDuration: 360, - startTime: '2025-05-20 02:21:49', - endTime: '2525-05-20 08:21:59', - recordType: '鑷姩涓婃姤' - }, - { - id: 3, - equipmentId: '3140221', - equipmentName: '鏁版帶鏈哄簥', - shutdownDuration: 360, - startTime: '2025-05-20 02:21:49', - endTime: '2525-05-20 08:21:59', - recordType: '鑷姩涓婃姤' + dataIndex: 'enterType_dictText' } ], url: { - list: '' + equipmentList: '/mdc/mdcEquipment/getEquipmentList', + downtimeDescriptionList: '/mdc/mdcDowntimeReason/reasonList', + list: '/mdc/operator/mdcDowntime/list' } } }, + created() { + this.getEquipmentListByApi() + this.getDowntimeDescriptionListByApi() + }, methods: { + getEquipmentListByApi() { + const that = this + getAction(this.url.equipmentList) + .then(res => { + if (res.success) that.equipmentList = res.result + }) + }, + + getDowntimeDescriptionListByApi() { + const that = this + getAction(this.url.downtimeDescriptionList) + .then(res => { + if (res.success) that.downtimeDescriptionList = res.result + }) + }, + handleMaintainShutdown() { this.$refs.maintainShutdownModal.visible = true - this.$refs.maintainShutdownModal.model = {} + this.$refs.maintainShutdownModal.model = { downTimeIds: this.selectedRowKeys.join() } }, handleSplitShutdownInfo() { this.$refs.splitShutdownInfoModal.visible = true + this.$refs.splitShutdownInfoModal.setDateTime(this.selectionRows[0]) + }, + + clearSelectedRowKeysAndLoadData() { + this.selectedRowKeys = this.selectionRows = [] + this.loadData() } } } diff --git a/src/views/dnc/base/modules/TerminalIndex/ReportEquipmentClose/MaintainShutdownModal.vue b/src/views/dnc/base/modules/TerminalIndex/ReportEquipmentClose/MaintainShutdownModal.vue index 36053ea..b43965e 100644 --- a/src/views/dnc/base/modules/TerminalIndex/ReportEquipmentClose/MaintainShutdownModal.vue +++ b/src/views/dnc/base/modules/TerminalIndex/ReportEquipmentClose/MaintainShutdownModal.vue @@ -1,58 +1,69 @@ <template> - <a-modal :visible="visible" title="缁存姢鍋滄満" @ok="handleSubmit" @cancel="handleCancel"> + <j-modal :visible="visible" title="缁存姢鍋滄満" @ok="handleSubmit" @cancel="handleCancel" :confirmLoading="confirmLoading"> <a-form-model ref="form" :model="model" :rules="validateRules" :labelCol="{span:5}" :wrapperCol="{span:18}"> - <a-form-model-item prop="closeReason" label="鍋滄満鍘熷洜"> - <a-select v-model="model.closeReason" placeholder="璇烽�夋嫨鍋滄満鍘熷洜"> - <a-select-option v-for="item in closeReasonList" :key="item.id"> + <a-form-model-item prop="reasonId" label="鍋滄満鍘熷洜"> + <a-select v-model="model.reasonId" placeholder="璇烽�夋嫨鍋滄満鍘熷洜"> + <a-select-option v-for="item in downtimeDescriptionList" :key="item.value"> {{item.label}} </a-select-option> </a-select> </a-form-model-item> </a-form-model> - </a-modal> + </j-modal> </template> <script> + import { postAction } from '@/api/manage' + export default { name: 'MaintainShutdownModal', + props: { + downtimeDescriptionList: { + type: Array + } + }, data() { return { visible: false, model: {}, validateRules: { - closeReason: [{ required: true, message: '璇烽�夋嫨鍋滄満鍘熷洜锛�' }] + reasonId: [{ required: true, message: '璇烽�夋嫨鍋滄満鍘熷洜锛�' }] }, - closeReasonList: [ - { - id: 1, - label: '鍚冮キ鏃堕棿浼戞伅' - }, - { - id: 2, - label: '宸ヤ綔鏃堕棿浼戞伅' - }, - { - id: 3, - label: '璁″垝鎬у仠鐢�' - }, - { - id: 4, - label: '寰呮枡鍋滄満' - }, - { - id: 5, - label: '棣栦欢璋冭瘯' - }, - { - id: 6, - label: '鍒�閲忓叿鍑嗗' - } - ] + confirmLoading: false, + url: { + submit: '/mdc/operator/mdcDowntime/updateReason' + } } }, methods: { handleSubmit() { - + const that = this + this.confirmLoading = true + this.$refs.form.validate(valid => { + if (valid) { + postAction(that.url.submit, that.model) + .then(res => { + if (res.success) { + that.$notification.success({ + message: '娑堟伅', + description: res.message + }) + that.handleCancel() + that.$emit('submitSuccess') + } else { + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }) + .finally(() => { + that.confirmLoading = false + }) + } else { + return false + } + }) }, handleCancel() { diff --git a/src/views/dnc/base/modules/TerminalIndex/ReportEquipmentClose/SplitShutdownInfoModal.vue b/src/views/dnc/base/modules/TerminalIndex/ReportEquipmentClose/SplitShutdownInfoModal.vue index 967c357..c6eab92 100644 --- a/src/views/dnc/base/modules/TerminalIndex/ReportEquipmentClose/SplitShutdownInfoModal.vue +++ b/src/views/dnc/base/modules/TerminalIndex/ReportEquipmentClose/SplitShutdownInfoModal.vue @@ -1,113 +1,208 @@ <template> - <a-modal :visible="visible" :width="800" title="鎷嗗垎鍋滄満淇℃伅" @ok="handleSubmit" @cancel="handleCancel"> - <a-form-model ref="form" :model="model" :rules="validateRules" :labelCol="{span:8}" :wrapperCol="{span:12}"> + <j-modal :visible="visible" :width="800" title="鎷嗗垎鍋滄満淇℃伅" @ok="handleSubmit" @cancel="handleCancel" + :confirmLoading="confirmLoading" + :maskClosable="false"> + <a-form-model ref="form" :model="model" :rules="validateRules" :hideRequiredMark="true" :labelCol="{span:8}" + :wrapperCol="{span:12}"> <a-row> - <a-col :span="10"> - <a-form-model-item prop="startTime" label="寮�濮嬫椂闂�"> - <a-date-picker show-time value-format="YYYY-MM-DD HH:mm:ss" v-model="model.startTime"/> + <a-col :span="12"> + <a-form-model-item label="寮�濮嬫椂闂�"> + <a-date-picker disabled show-time value-format="YYYY-MM-DD HH:mm:ss" v-model="model.startDate"/> </a-form-model-item> </a-col> </a-row> - <div v-for="item in splitList" :key="item.title"> - <a-divider orientation="left">{{item.title}}</a-divider> + <a-divider orientation="left">鎷嗗垎涓�娈�</a-divider> - <a-row> - <a-col :span="10"> - <a-form-model-item prop="endTime" label="缁撴潫鏃ユ湡"> - <a-date-picker show-time value-format="YYYY-MM-DD HH:mm:ss" v-model="item.splitParams.endTime"/> - </a-form-model-item> - </a-col> + <a-row> + <a-col :span="12"> + <a-form-model-item label=" " :colon="false" prop="firstMiddleTime"> + <a-date-picker show-time :showToday="false" value-format="YYYY-MM-DD HH:mm:ss" + v-model="model.firstMiddleTime" + @change="handleFirstMiddleTimeChange" + :disabledDate="disabledDate1"/> + </a-form-model-item> + </a-col> - <a-col :span="10"> - <a-form-model-item prop="closeReason" label="鍋滄満鍘熷洜"> - <a-select v-model="item.splitParams.closeReason" placeholder="璇烽�夋嫨鍋滄満鍘熷洜"> - <a-select-option v-for="item in closeReasonList" :key="item.id"> - {{item.label}} - </a-select-option> - </a-select> - </a-form-model-item> - </a-col> + <a-col :span="12"> + <a-form-model-item label="鍋滄満鍘熷洜"> + <a-select v-model="model.firstDowntimeDescription" placeholder="璇烽�夋嫨鍋滄満鍘熷洜"> + <a-select-option v-for="item in downtimeDescriptionList" :key="item.value"> + {{item.label}} + </a-select-option> + </a-select> + </a-form-model-item> + </a-col> + </a-row> - <a-col :span="4"> - <a-form-model-item label="閫夋嫨"> - <a-checkbox @change="handleCheckboxChange(item,$event)"/> - </a-form-model-item> - </a-col> - </a-row> - </div> + <a-divider orientation="left">鎷嗗垎浜屾</a-divider> + + <a-row> + <a-col :span="12"> + <a-form-model-item label=" " :colon="false"> + <a-date-picker show-time :showToday="false" value-format="YYYY-MM-DD HH:mm:ss" + v-model="model.secondMiddleTime" + :disabled="!model.firstMiddleTime" :disabledDate="disabledDate2"/> + </a-form-model-item> + </a-col> + + <a-col :span="12"> + <a-form-model-item label="鍋滄満鍘熷洜"> + <a-select v-model="model.secondDowntimeDescription" placeholder="璇烽�夋嫨鍋滄満鍘熷洜" + :disabled="!model.firstMiddleTime"> + <a-select-option v-for="item in downtimeDescriptionList" :key="item.value"> + {{item.label}} + </a-select-option> + </a-select> + </a-form-model-item> + </a-col> + </a-row> + + <a-divider orientation="left">鎷嗗垎涓夋</a-divider> + + <a-row> + <a-col :span="12"> + <a-form-model-item label="缁撴潫鏃ユ湡"> + <a-date-picker disabled show-time value-format="YYYY-MM-DD HH:mm:ss" v-model="model.endDate"/> + </a-form-model-item> + </a-col> + + <a-col :span="12"> + <a-form-model-item label="鍋滄満鍘熷洜"> + <a-select v-model="model.thirdDowntimeDescription" placeholder="璇烽�夋嫨鍋滄満鍘熷洜"> + <a-select-option v-for="item in downtimeDescriptionList" :key="item.value"> + {{item.label}} + </a-select-option> + </a-select> + </a-form-model-item> + </a-col> + </a-row> </a-form-model> - </a-modal> + </j-modal> </template> <script> + import moment from 'moment' + import { postAction } from '@/api/manage' + export default { name: 'SplitShutdownInfoModal', + props: { + downtimeDescriptionList: { + type: Array + } + }, data() { return { visible: false, model: {}, validateRules: { - startTime: [{ required: true, message: '璇烽�夋嫨寮�濮嬫椂闂达紒', trigger: 'change' }] + firstMiddleTime: [{ required: true, message: '璇烽�夋嫨鎷嗗垎涓�娈垫椂闂达紒', trigger: 'change' }] }, - closeReasonList: [ - { - id: 1, - label: '鍚冮キ鏃堕棿浼戞伅' - }, - { - id: 2, - label: '宸ヤ綔鏃堕棿浼戞伅' - }, - { - id: 3, - label: '璁″垝鎬у仠鐢�' - }, - { - id: 4, - label: '寰呮枡鍋滄満' - }, - { - id: 5, - label: '棣栦欢璋冭瘯' - }, - { - id: 6, - label: '鍒�閲忓叿鍑嗗' - } - ], - splitList: [ - { - title: '鎷嗗垎涓�娈�', - splitParams: {} - }, - { - title: '鎷嗗垎浜屾', - splitParams: {} - }, - { - title: '鎷嗗垎涓夋', - splitParams: {} - } - ] + confirmLoading: false, + url: { + submit: '/mdc/operator/mdcDowntime/splitDowntime' + } } }, methods: { - handleCheckboxChange(record, event) { - console.log('record', record) - record.splitParams.checked = event.target.checked + /** + * 璁剧疆寮�濮嬪強缁撴潫鏃ユ湡鏃堕棿 + * @param record 鍒楄〃琛岃褰曞璞� + */ + setDateTime(record) { + this.model = { + id: record.id, + startDate: record.startDate, + endDate: record.endDate + } }, + /** + * 鎷嗗垎涓�娈垫椂闂村�煎彂鐢熸敼鍙樻椂瑙﹀彂 + * @param value 鏀瑰彉鍚庣殑鍊� + */ + handleFirstMiddleTimeChange(value) { + // 鑻ユ椂闂村�艰娓呯┖鏃惰Е鍙� + if (!value) { + delete this.model.secondMiddleTime + delete this.model.secondDowntimeDescription + } + }, + + /** + * 鎷嗗垎涓�娈电鐢ㄦ棩鏈熻寖鍥� + * @param current 绂佺敤鑼冨洿 + * @returns {boolean} + */ + disabledDate1(current) { + const { startDate, endDate, secondMiddleTime } = this.model + let nextEndTime + + if (!secondMiddleTime) nextEndTime = endDate + else nextEndTime = secondMiddleTime + + return current < moment(startDate).startOf('days') || current > moment(nextEndTime).endOf('days') + }, + + /** + * 鎷嗗垎浜屾绂佺敤鏃ユ湡鑼冨洿 + * @param current 绂佺敤鑼冨洿 + * @returns {boolean} + */ + disabledDate2(current) { + const { endDate, firstMiddleTime } = this.model + + return current < moment(firstMiddleTime).startOf('days') || current > moment(endDate).endOf('days') + }, + + /** + * 鍒涘缓绂佺敤鏃堕棿鑼冨洿鏁扮粍 + * @param start 寮�濮嬫椂闂达紙鏃跺垎绉掞級 + * @param end 缁撴潫鏃堕棿锛堟椂鍒嗙锛� + * @returns {Array} + */ + handleCreateTimeRangeArray(start, end) { + const result = [] + for (let i = start; i < end; i++) { + result.push(i) + } + return result + }, + + // 琛ㄥ崟鎻愪氦浜嬩欢 handleSubmit() { + const that = this + that.confirmLoading = true this.$refs.form.validate(valid => { if (valid) { - + postAction(that.url.submit, that.model) + .then(res => { + if (res.success) { + that.$notification.success({ + message: '娑堟伅', + description: res.message + }) + that.handleCancel() + that.$emit('submitSuccess') + } else { + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }) + .finally(() => { + that.confirmLoading = false + }) + console.log('model', this.model) } else { return false } }) }, + // 鍏抽棴寮圭獥浜嬩欢 handleCancel() { this.$refs.form.clearValidate() this.visible = false -- Gitblit v1.9.3