| | |
| | | <a-row :gutter="24"> |
| | | <a-col :span="5"> |
| | | <a-form-item label="设备"> |
| | | <a-select placeholder="请选择设备" v-model="queryParam.equipmentId"> |
| | | <a-select placeholder="请选择设备" v-model="queryParam.equipmentId" allow-clear> |
| | | <a-select-option v-for="item in equipmentList" :key="item.equipmentId"> |
| | | {{item.equipmentId+`[${item.equipmentName}]`}} |
| | | </a-select-option> |
| | |
| | | |
| | | <a-col :span="5"> |
| | | <a-form-item label="开始时间"> |
| | | <a-date-picker style="width: 100%" show-time placeholder="请选择开始时间" v-model="queryParam.startDate"/> |
| | | <a-date-picker style="width: 100%" show-time placeholder="请选择开始时间" value-format="YYYY-MM-DD HH:mm:ss" |
| | | v-model="queryParam.startDate"/> |
| | | </a-form-item> |
| | | </a-col> |
| | | |
| | | <a-col :span="5"> |
| | | <a-form-item label="结束时间"> |
| | | <a-date-picker style="width: 100%" show-time placeholder="请选择结束时间" v-model="queryParam.endDate"/> |
| | | <a-date-picker style="width: 100%" show-time placeholder="请选择结束时间" value-format="YYYY-MM-DD HH:mm:ss" |
| | | v-model="queryParam.endDate"/> |
| | | </a-form-item> |
| | | </a-col> |
| | | |
| | | <a-col :span="5"> |
| | | <a-form-item label="停机原因"> |
| | | <a-select placeholder="请选择停机原因" v-model="queryParam.downtimeDescription"> |
| | | <a-select placeholder="请选择停机原因" v-model="queryParam.downtimeDescription" allow-clear> |
| | | <a-select-option v-for="item in downtimeDescriptionList" :key="item.value">{{item.label}} |
| | | </a-select-option> |
| | | </a-select> |
| | |
| | | <!-- 操作按钮区域 --> |
| | | <div class="table-operator"> |
| | | <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> |
| | | <a-button type="primary" @click="handleSplitShutdownInfo" :disabled="selectionRows.length!==1">拆分停机信息</a-button> |
| | | </div> |
| | | |
| | | <a-table :dataSource="dataSource" :columns="columns" rowKey="id" bordered :pagination="false" :loading="loading" |
| | | <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> |
| | | <i class="anticon anticon-info-circle ant-alert-icon"></i>已选择 <a style="font-weight: 600">{{ |
| | | selectedRowKeys.length }}</a>项 |
| | | <a style="margin-left: 24px" @click="onClearSelected">清空</a> |
| | | </div> |
| | | |
| | | <a-table :dataSource="dataSource" :columns="columns" rowKey="id" bordered :pagination="ipagination" |
| | | :loading="loading" @change="handleTableChange" :customRow="customRow" |
| | | :rowSelection="{selectedRowKeys, onChange: onSelectChange}"> |
| | | <template slot="downtimeType" slot-scope="text"> |
| | | {{ text!=null?text === 0 ? '计划停机' : '非计划停机':'' }} |
| | |
| | | <maintain-shutdown-modal :downtimeDescriptionList="downtimeDescriptionList" ref="maintainShutdownModal" |
| | | @submitSuccess="loadData"/> |
| | | |
| | | <split-shutdown-info-modal ref="splitShutdownInfoModal" :selectedRow="selectionRows[0]" |
| | | :downtimeDescriptionList="downtimeDescriptionList" |
| | | @submitSuccess="clearSelectedRowKeysAndLoadData"/> |
| | | <split-shutdown-info-modal ref="splitShutdownInfoModal" :downtimeDescriptionList="downtimeDescriptionList" |
| | | @submitSuccess="modalFormOk"/> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | this.getDowntimeDescriptionListByApi() |
| | | }, |
| | | methods: { |
| | | // 获取设备列表 |
| | | getEquipmentListByApi() { |
| | | const that = this |
| | | getAction(this.url.equipmentList) |
| | |
| | | }) |
| | | }, |
| | | |
| | | // 获取停机原因列表 |
| | | getDowntimeDescriptionListByApi() { |
| | | const that = this |
| | | getAction(this.url.downtimeDescriptionList) |
| | | .then(res => { |
| | | if (res.success) that.downtimeDescriptionList = res.result |
| | | }) |
| | | |
| | | }, |
| | | |
| | | loadData(arg) { |
| | | //加载数据 若传入参数1则加载第一页的内容 |
| | | if (arg === 1) { |
| | | this.ipagination.current = 1 |
| | | } |
| | | const params = this.getQueryParams()//查询条件 |
| | | if (!params) return false |
| | | this.loading = true |
| | | getAction(this.url.list, params) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | this.dataSource = res.result.records || res.result |
| | | this.selectionRows = this.dataSource.filter(item => this.selectedRowKeys.includes(item.id)) |
| | | if (res.result.total) { |
| | | this.ipagination.total = res.result.total |
| | | } else { |
| | | this.ipagination.total = 0 |
| | | } |
| | | } else { |
| | | this.$message.warning(res.message) |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | this.loading = false |
| | | }) |
| | | }, |
| | | |
| | | customRow(record) { |
| | | return { |
| | | style: { |
| | | cursor: 'pointer' |
| | | }, |
| | | on: { |
| | | click: () => { |
| | | let selectedRowKeys = [...this.selectedRowKeys] |
| | | let selectionRows = [...this.selectionRows] |
| | | if (selectedRowKeys.includes(record.id)) { |
| | | selectedRowKeys = selectedRowKeys.filter(item => item !== record.id) |
| | | selectionRows = selectionRows.filter(item => item.id !== record.id) |
| | | } |
| | | else { |
| | | selectedRowKeys.push(record.id) |
| | | selectionRows.push(record) |
| | | } |
| | | this.onSelectChange(selectedRowKeys, selectionRows) |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | |
| | | // 打开维护停机窗口 |
| | | handleMaintainShutdown() { |
| | | this.$refs.maintainShutdownModal.visible = true |
| | | 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() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped lang="less"> |
| | | |
| | | </style> |
| | | </script> |