修改bug
This commit is contained in:
parent
646859aeef
commit
ebcf3d4d78
@ -19,9 +19,10 @@ export function createOrUpdateList(data) {
|
||||
}
|
||||
|
||||
// 自动排班,填充上月已有的排班
|
||||
export function autoSet() {
|
||||
export function autoSet(query) {
|
||||
return request({
|
||||
url: '/base/group-team-scheduling/autoSet',
|
||||
method: 'get'
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
@ -443,7 +443,7 @@ export default {
|
||||
background-color: #0B58FF;
|
||||
border-radius: 1px;
|
||||
margin-right: 8px;
|
||||
margin-top: 10px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -407,7 +407,7 @@ export default {
|
||||
background-color: #0B58FF;
|
||||
border-radius: 1px;
|
||||
margin-right: 8px;
|
||||
margin-top: 10px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -13,7 +13,9 @@
|
||||
:limit="queryParams.pageSize"
|
||||
:table-props="tableProps"
|
||||
:table-data="list"
|
||||
:selectWidth="55"
|
||||
:max-height="tableH"
|
||||
@selection-change="selectChange"
|
||||
/>
|
||||
<pagination
|
||||
:page.sync="queryParams.pageNo"
|
||||
@ -25,9 +27,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getEnergyQuantityRealtimePage, exportEnergyQuantityRealtimeExcel } from "@/api/base/energyQuantityRealtime";
|
||||
import { getEnergyTypeListAll } from "@/api/base/energyType";
|
||||
import { getEnergyQuantityRealtimePage, exportEnergyQuantityRealtimeExcel } from "@/api/base/energyQuantityRealtime"
|
||||
import { getEnergyTypeListAll } from "@/api/base/energyType"
|
||||
// import { publicFormatter } from '@/utils/dict'
|
||||
import FileSaver from "file-saver"
|
||||
import * as XLSX from 'xlsx/xlsx.mjs'
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'objName',
|
||||
@ -113,7 +117,8 @@ export default {
|
||||
startTime: null,
|
||||
endTime: null
|
||||
},
|
||||
energyTypeList: []
|
||||
energyTypeList: [],
|
||||
exportList: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@ -134,12 +139,13 @@ export default {
|
||||
this.getList()
|
||||
break
|
||||
default:
|
||||
this.$modal.confirm('是否确认导出').then(() => {
|
||||
return exportEnergyQuantityRealtimeExcel({...this.queryParams});
|
||||
}).then(response => {
|
||||
console.log(response)
|
||||
this.$download.excel(response, '能源抄表.xls');
|
||||
}).catch(() => {})
|
||||
this.exportTable()
|
||||
// this.$modal.confirm('是否确认导出').then(() => {
|
||||
// return exportEnergyQuantityRealtimeExcel({...this.queryParams});
|
||||
// }).then(response => {
|
||||
// console.log(response)
|
||||
// this.$download.excel(response, '能源抄表.xls');
|
||||
// }).catch(() => {})
|
||||
}
|
||||
},
|
||||
/** 查询列表 */
|
||||
@ -147,6 +153,7 @@ export default {
|
||||
getEnergyQuantityRealtimePage(this.queryParams).then(response => {
|
||||
this.list = response.data.list || []
|
||||
this.total = response.data.total;
|
||||
this.exportList = []
|
||||
});
|
||||
},
|
||||
getTypeList() {
|
||||
@ -154,6 +161,48 @@ export default {
|
||||
this.formConfig[0].selectOptions = 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('请勾选需要导出的数据')
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
<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-cascader
|
||||
style='width: 100%;'
|
||||
@ -11,7 +11,7 @@
|
||||
clearable></el-cascader>
|
||||
</el-form-item>
|
||||
<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
|
||||
v-for="item in this.energyTypeList"
|
||||
:key="item.id"
|
||||
@ -26,7 +26,7 @@
|
||||
<el-option label="详细" :value= "2" ></el-option>
|
||||
</el-select>
|
||||
</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-option
|
||||
v-for="item in detailList"
|
||||
@ -128,8 +128,16 @@ export default {
|
||||
console.log(this.form)
|
||||
this.form.plcParamId = ''
|
||||
if (val === 2) {
|
||||
if (this.form.objectId && this.form.energyTypeId) {
|
||||
this.getDetailList()
|
||||
}
|
||||
}
|
||||
},
|
||||
toggleType() {
|
||||
if (this.form.energyTypeId && this.form.type) {
|
||||
this.getDetailList()
|
||||
this.form.plcParamId = ''
|
||||
}
|
||||
},
|
||||
// 递归处理分类回显问题
|
||||
changeDetSelect(key, treeData) {
|
||||
@ -158,6 +166,10 @@ export default {
|
||||
selectObj(val) {
|
||||
this.form.objectId = val[val.length-1]
|
||||
this.form.objectType = val.length-1
|
||||
if (this.form.energyTypeId && this.form.type) {
|
||||
this.getDetailList()
|
||||
this.form.plcParamId = ''
|
||||
}
|
||||
},
|
||||
selectDetail() {
|
||||
this.$forceUpdate()
|
||||
|
@ -65,7 +65,8 @@ const tableProps = [
|
||||
},
|
||||
{
|
||||
prop: 'type',
|
||||
label: '监控模式'
|
||||
label: '监控模式',
|
||||
filter: (val) => (val != null ? ['合并', '详细'][val-1] : '-'),
|
||||
},
|
||||
{
|
||||
prop: 'plcParamName',
|
||||
|
@ -116,7 +116,7 @@ export default {
|
||||
energyTypeList: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
mounted() {
|
||||
window.addEventListener('resize', () => {
|
||||
this.tableH = this.tableHeight(260)
|
||||
this.isFold = this.searchBarWidth('energyReportSearchBox', 1180)
|
||||
@ -130,11 +130,24 @@ export default {
|
||||
this.queryParams.endTime = this.formConfig[2].defaultSelect[1]
|
||||
this.getList()
|
||||
this.getTypeList()
|
||||
},
|
||||
mounted() {
|
||||
this.isFold = this.searchBarWidth('energyReportSearchBox', 1180)
|
||||
},
|
||||
watch: {
|
||||
$route: 'initData'
|
||||
},
|
||||
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() {
|
||||
getEnergyTypeListAll().then((res) => {
|
||||
this.formConfig[1].selectOptions = res.data || []
|
||||
|
@ -243,7 +243,11 @@ export default {
|
||||
this.list = tempData
|
||||
} else {
|
||||
// 次月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 || {}
|
||||
})
|
||||
}
|
||||
|
@ -222,8 +222,25 @@ export default {
|
||||
this.searchBarFormConfig[0].defaultSelect = []
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
watch: {
|
||||
$route: 'initData'
|
||||
},
|
||||
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() {
|
||||
this.getSummaryList();
|
||||
this.getDetailedList();
|
||||
|
Loading…
Reference in New Issue
Block a user