src/views/mdc/base/modules/DeviceLog/DeviceLogBatchExportModal.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/mdc/base/modules/DeviceLog/LogInfo.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/mdc/base/modules/EquipmentList/UserModal.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/views/mdc/base/modules/DeviceLog/DeviceLogBatchExportModal.vue
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,130 @@ <template> <j-modal :visible="visible" title="æ¹é导åº" :confirmLoading="confirmLoading" @ok="handleSubmit('è®¾å¤æ¥å¿')" @cancel="handleCancel"> <a-spin :spinning="confirmLoading"> <a-form-model ref="form" :model="model" :rules="validateRules" :labelCol="{span:4}" :wrapperCol="{span:20}"> <a-form-model-item label="æ¥æ" prop="dates"> <a-range-picker v-model="model.dates" value-format="YYYY-MM-DD" :disabledDate="disabledDate" @calendarChange="handleCalendarChange" @openChange="handleCalendarOpenChange" :allow-clear="false"/> </a-form-model-item> </a-form-model> </a-spin> </j-modal> </template> <script> import moment from 'moment' import { downFile } from '@/api/manage' export default { name: 'DeviceLogBatchExportModal', props: { equipmentId: { type: String } }, data() { return { visible: false, confirmLoading: false, model: {}, validateRules: { dates: [{ required: true, message: 'è¯·éæ©æ¥æï¼' }] }, preSelectFirstDate: null, url: { batchExportXlsUrl: '/mdc/mdcEquipmentRunningSection/batchExportLogXls' } } }, computed: { disabledDate() { // current为éè¦ç¦ç¨çæ¶é´æ®µ return current => { if (!this.preSelectFirstDate) { return current > moment().endOf('days') } else { return current < moment(this.preSelectFirstDate).subtract(30, 'days').startOf('days') || current > moment().endOf('days') || current > moment(this.preSelectFirstDate).add(30, 'days').endOf('days') } } } }, methods: { handleSubmit(fileName) { this.$refs.form.validate(valid => { if (valid) { this.confirmLoading = true if (!fileName || typeof fileName != 'string') { fileName = 'å¯¼åºæä»¶' } const param = { equipmentId: this.equipmentId, startTime: this.model.dates[0], endTime: this.model.dates[1] } console.log('导åºåæ°', param) downFile(this.url.batchExportXlsUrl, param) .then((data) => { if (!data) { // this.$message.warning("æä»¶ä¸è½½å¤±è´¥") this.$notification.warning({ message: 'æ¶æ¯', description: 'æä»¶ä¸è½½å¤±è´¥' }) return } if (typeof window.navigator.msSaveBlob !== 'undefined') { window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls') } else { let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' })) let link = document.createElement('a') link.style.display = 'none' link.href = url link.setAttribute('download', fileName + '.xls') document.body.appendChild(link) link.click() document.body.removeChild(link) //ä¸è½½å®æç§»é¤å ç´ window.URL.revokeObjectURL(url) //éæ¾æblob对象 } this.handleCancel() }) .finally(() => { this.confirmLoading = false }) } else { return false } }) }, handleCalendarChange(dates) { console.log('dates', dates) if (dates.length === 1) this.preSelectFirstDate = dates[0] }, handleCalendarOpenChange(status) { if (status) { if (this.model.dates && this.model.dates.length > 0) { this.preSelectFirstDate = this.model.dates[0] } else { this.preSelectFirstDate = null } } }, handleCancel() { this.$refs.form.clearValidate() this.model = {} this.visible = false } } } </script> <style scoped> </style> src/views/mdc/base/modules/DeviceLog/LogInfo.vue
@@ -16,7 +16,7 @@ </a-col> <a-col :md="4" :sm="4"> <a-form-item label="æ¥æ"> <a-date-picker v-model="queryParams.collectTime" :disabledDate="disabledDate" @change="dataChange" <a-date-picker v-model="queryParams.collectTime" :disabledDate="disabledDate" @change="handleDateChange" format='YYYY-MM-DD'/> </a-form-item> </a-col> @@ -25,6 +25,8 @@ <a-button type="primary" @click="searchQuery" icon="search">æ¥è¯¢</a-button> <a-button type="primary" @click="searchReset" icon="reload">éç½®</a-button> <a-button type="primary" icon="download" @click="handleExport">导åº</a-button> <a-button v-if="queryParams.equipmentId" type="primary" icon="download" @click="openBatchExportModal">æ¹éå¯¼åº </a-button> </a-space> </a-col> </a-row> @@ -155,6 +157,8 @@ <work-chart-model ref="workChartModel" :collectTime="this.queryParams.collectTime" :equipment="this.equipment"></work-chart-model> <work-history-model ref="workHistoryModel"></work-history-model> <DeviceLogBatchExportModal ref="batchExportModalRef" :equipmentId="queryParams.equipmentId"/> </div> </template> @@ -167,9 +171,11 @@ import WorkChartModel from './WorkChartModel' import WorkHistoryModel from './WorkHistoryModel' import { downFile, getAction } from '@/api/manage' import DeviceLogBatchExportModal from './DeviceLogBatchExportModal' export default { components: { DeviceLogBatchExportModal, LogList, WorkLogList, AlarmLogList, @@ -255,9 +261,10 @@ this.cardLoading = false }) }, dataChange(val) { handleDateChange(val) { this.queryParams.collectTime = val this.queryParams.collectTimeStr = this.queryParams.collectTime.format('YYYY-MM-DD') }, searchQuery() { // console.log(this.queryParams.collectTime) @@ -347,8 +354,12 @@ }, handleExport(){ this.$refs.logList.queryParam=Object.assign({},this.queryParams,this.$refs.logList.queryParam) this.$refs.logList.queryParam = Object.assign({}, this.queryParams) this.$refs.logList.handleExportXls('è®¾å¤æ¥å¿') }, openBatchExportModal() { this.$refs.batchExportModalRef.visible = true } }, created() { src/views/mdc/base/modules/EquipmentList/UserModal.vue
@@ -120,7 +120,7 @@ </a-form-model-item> </a-col> <a-col :span="12"> <a-form-model-item label="设å¤ç¶æ"> <a-form-model-item label="设å¤ç¶æ" v-has="'equipment_attribute'"> <j-dict-select-tag placeholder="è¯·éæ©è®¾å¤ç¶æ" :triggerChange="true" dictCode="mdc_equipment_status" v-model="model.equipmentStatus" allow-clear/> </a-form-model-item> @@ -128,10 +128,9 @@ </a-row> <a-row :gutter="24"> <a-col :span="12" v-has="'equipment_attribute'"> <a-col :span="12"> <a-form-model-item label="设å¤å±æ§"> <j-dict-select-tag v-model="model.attribute" type="radio" dictCode="equipment_attribute"/> <j-dict-select-tag v-model="model.attribute" type="radio" dictCode="equipment_attribute"/> </a-form-model-item> </a-col> <a-col :span="12">