Compare commits

...

2 Commits

Author SHA1 Message Date
ebcf3d4d78 修改bug 2023-09-20 16:57:20 +08:00
646859aeef Merge pull request '修bug' (#27) from zjl into test
Reviewed-on: #27
2023-09-19 15:47:12 +08:00
9 changed files with 118 additions and 21 deletions

View File

@ -19,9 +19,10 @@ export function createOrUpdateList(data) {
} }
// 自动排班,填充上月已有的排班 // 自动排班,填充上月已有的排班
export function autoSet() { export function autoSet(query) {
return request({ return request({
url: '/base/group-team-scheduling/autoSet', url: '/base/group-team-scheduling/autoSet',
method: 'get' method: 'get',
params: query
}) })
} }

View File

@ -443,7 +443,7 @@ export default {
background-color: #0B58FF; background-color: #0B58FF;
border-radius: 1px; border-radius: 1px;
margin-right: 8px; margin-right: 8px;
margin-top: 10px; margin-top: 12px;
} }
} }
</style> </style>

View File

@ -407,7 +407,7 @@ export default {
background-color: #0B58FF; background-color: #0B58FF;
border-radius: 1px; border-radius: 1px;
margin-right: 8px; margin-right: 8px;
margin-top: 10px; margin-top: 12px;
} }
} }
</style> </style>

View File

@ -13,7 +13,9 @@
:limit="queryParams.pageSize" :limit="queryParams.pageSize"
:table-props="tableProps" :table-props="tableProps"
:table-data="list" :table-data="list"
:selectWidth="55"
:max-height="tableH" :max-height="tableH"
@selection-change="selectChange"
/> />
<pagination <pagination
:page.sync="queryParams.pageNo" :page.sync="queryParams.pageNo"
@ -25,9 +27,11 @@
</template> </template>
<script> <script>
import { getEnergyQuantityRealtimePage, exportEnergyQuantityRealtimeExcel } from "@/api/base/energyQuantityRealtime"; import { getEnergyQuantityRealtimePage, exportEnergyQuantityRealtimeExcel } from "@/api/base/energyQuantityRealtime"
import { getEnergyTypeListAll } from "@/api/base/energyType"; import { getEnergyTypeListAll } from "@/api/base/energyType"
// import { publicFormatter } from '@/utils/dict' // import { publicFormatter } from '@/utils/dict'
import FileSaver from "file-saver"
import * as XLSX from 'xlsx/xlsx.mjs'
const tableProps = [ const tableProps = [
{ {
prop: 'objName', prop: 'objName',
@ -113,7 +117,8 @@ export default {
startTime: null, startTime: null,
endTime: null endTime: null
}, },
energyTypeList: [] energyTypeList: [],
exportList: []
}; };
}, },
created() { created() {
@ -134,12 +139,13 @@ export default {
this.getList() this.getList()
break break
default: default:
this.$modal.confirm('是否确认导出').then(() => { this.exportTable()
return exportEnergyQuantityRealtimeExcel({...this.queryParams}); // this.$modal.confirm('').then(() => {
}).then(response => { // return exportEnergyQuantityRealtimeExcel({...this.queryParams});
console.log(response) // }).then(response => {
this.$download.excel(response, '能源抄表.xls'); // console.log(response)
}).catch(() => {}) // this.$download.excel(response, '.xls');
// }).catch(() => {})
} }
}, },
/** 查询列表 */ /** 查询列表 */
@ -147,6 +153,7 @@ export default {
getEnergyQuantityRealtimePage(this.queryParams).then(response => { getEnergyQuantityRealtimePage(this.queryParams).then(response => {
this.list = response.data.list || [] this.list = response.data.list || []
this.total = response.data.total; this.total = response.data.total;
this.exportList = []
}); });
}, },
getTypeList() { getTypeList() {
@ -154,6 +161,48 @@ export default {
this.formConfig[0].selectOptions = res.data || [] this.formConfig[0].selectOptions = res.data || []
this.energyTypeList = res.data || [] this.energyTypeList = res.data || []
}) })
},
selectChange(val) {
console.log(val)
this.exportList = val
},
//
exportTable() {
if (this.exportList.length > 0) {
let body = this.exportList.map((x) => [
x.objName,
x.objRemark,
x.energyTypeName,
x.startValue,
x.endValue,
x.diffValue,
x.amount
])
let header = []
this.tableProps.map((y) => {
header.push(y.label)
})
body.unshift(header)
console.log(body)
const filename = '能源抄表.xlsx'
const ws_name = 'Sheet1'
const wb = XLSX.utils.book_new()
const ws = XLSX.utils.aoa_to_sheet(body)
XLSX.utils.book_append_sheet(wb, ws, ws_name)
let wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: false,
type: 'array'
})
FileSaver.saveAs(
new Blob([wbout], {
type: 'application/octet-stream'
}),
filename
)
} else {
this.$modal.msgWarning('请勾选需要导出的数据')
}
} }
} }
}; };

View File

@ -1,5 +1,5 @@
<template> <template>
<el-form ref="form" :rules="rules" label-width="100px" :model="form"> <el-form ref="form" :rules="rules" label-width="110px" :model="form">
<el-form-item label="监控对象" prop="objectId"> <el-form-item label="监控对象" prop="objectId">
<el-cascader <el-cascader
style='width: 100%;' style='width: 100%;'
@ -11,7 +11,7 @@
clearable></el-cascader> clearable></el-cascader>
</el-form-item> </el-form-item>
<el-form-item label="能源类型" prop="energyTypeId"> <el-form-item label="能源类型" prop="energyTypeId">
<el-select v-model="form.energyTypeId" placeholder="请选择" style="width: 100%;"> <el-select v-model="form.energyTypeId" placeholder="请选择" style="width: 100%;" @change="toggleType">
<el-option <el-option
v-for="item in this.energyTypeList" v-for="item in this.energyTypeList"
:key="item.id" :key="item.id"
@ -26,7 +26,7 @@
<el-option label="详细" :value= "2" ></el-option> <el-option label="详细" :value= "2" ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="监控详细参数" prop="plcParamId" v-if="form.type === 2"> <el-form-item label="监控详细参数" prop="type" v-if="form.type === 2">
<el-select v-model="form.plcParamId" placeholder="请选择" style="width: 100%;" @change="selectDetail"> <el-select v-model="form.plcParamId" placeholder="请选择" style="width: 100%;" @change="selectDetail">
<el-option <el-option
v-for="item in detailList" v-for="item in detailList"
@ -128,7 +128,15 @@ export default {
console.log(this.form) console.log(this.form)
this.form.plcParamId = '' this.form.plcParamId = ''
if (val === 2) { if (val === 2) {
if (this.form.objectId && this.form.energyTypeId) {
this.getDetailList()
}
}
},
toggleType() {
if (this.form.energyTypeId && this.form.type) {
this.getDetailList() this.getDetailList()
this.form.plcParamId = ''
} }
}, },
// //
@ -158,6 +166,10 @@ export default {
selectObj(val) { selectObj(val) {
this.form.objectId = val[val.length-1] this.form.objectId = val[val.length-1]
this.form.objectType = val.length-1 this.form.objectType = val.length-1
if (this.form.energyTypeId && this.form.type) {
this.getDetailList()
this.form.plcParamId = ''
}
}, },
selectDetail() { selectDetail() {
this.$forceUpdate() this.$forceUpdate()

View File

@ -65,7 +65,8 @@ const tableProps = [
}, },
{ {
prop: 'type', prop: 'type',
label: '监控模式' label: '监控模式',
filter: (val) => (val != null ? ['合并', '详细'][val-1] : '-'),
}, },
{ {
prop: 'plcParamName', prop: 'plcParamName',

View File

@ -116,7 +116,7 @@ export default {
energyTypeList: [] energyTypeList: []
}; };
}, },
created() { mounted() {
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260) this.tableH = this.tableHeight(260)
this.isFold = this.searchBarWidth('energyReportSearchBox', 1180) this.isFold = this.searchBarWidth('energyReportSearchBox', 1180)
@ -130,11 +130,24 @@ export default {
this.queryParams.endTime = this.formConfig[2].defaultSelect[1] this.queryParams.endTime = this.formConfig[2].defaultSelect[1]
this.getList() this.getList()
this.getTypeList() this.getTypeList()
},
mounted() {
this.isFold = this.searchBarWidth('energyReportSearchBox', 1180) this.isFold = this.searchBarWidth('energyReportSearchBox', 1180)
}, },
watch: {
$route: 'initData'
},
methods: { methods: {
initData(to) {
if (to.name === 'EnergyReportSearch') {
if (this.$route.params.startTime && this.$route.params.endTime) {
this.formConfig[2].defaultSelect = [this.$route.params.startTime, this.$route.params.endTime]
} else {
this.formConfig[2].defaultSelect = [Date.now() - 7*24*3600000, Date.now()]
}
this.queryParams.startTime = this.formConfig[2].defaultSelect[0]
this.queryParams.endTime = this.formConfig[2].defaultSelect[1]
this.getList()
}
},
getTypeList() { getTypeList() {
getEnergyTypeListAll().then((res) => { getEnergyTypeListAll().then((res) => {
this.formConfig[1].selectOptions = res.data || [] this.formConfig[1].selectOptions = res.data || []

View File

@ -243,7 +243,11 @@ export default {
this.list = tempData this.list = tempData
} else { } else {
// 1, // 1,
autoSet().then(res => { // console.log(moment(this.startDay).format("YYYY-MM-DD"))
autoSet({
year: this.year,
month: moment(this.startDay).month() + 1
}).then(res => {
this.list = res.data || {} this.list = res.data || {}
}) })
} }

View File

@ -223,7 +223,24 @@ export default {
} }
this.getList(); this.getList();
}, },
watch: {
$route: 'initData'
},
methods: { methods: {
initData(to) {
// console.log(to)
if (to.name === 'QualityStatistics') {
if (this.$route.params.startTime && this.$route.params.endTime) {
this.searchBarFormConfig[0].defaultSelect = [this.$route.params.startTime, this.$route.params.endTime]
this.queryParams.param = {};
this.$set(this.queryParams.param, 'startTime', this.$route.params.startTime);
this.$set(this.queryParams.param, 'endTime', this.$route.params.endTime);
} else {
this.searchBarFormConfig[0].defaultSelect = []
}
this.getList();
}
},
getList() { getList() {
this.getSummaryList(); this.getSummaryList();
this.getDetailedList(); this.getDetailedList();