fix bugs
This commit is contained in:
@@ -28,59 +28,96 @@
|
||||
|
||||
<script>
|
||||
import basicPage from '../../../core/mixins/basic-page';
|
||||
import { parseTime } from '../../../core/mixins/code-filter';
|
||||
import moment from 'moment';
|
||||
import {
|
||||
getEqAnalysis,
|
||||
exportEqAnalysisExcel
|
||||
exportEqAnalysisExcel,
|
||||
} from '@/api/equipment/analysis/statistics';
|
||||
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'recordTime',
|
||||
label: '时间段',
|
||||
filter: parseTime
|
||||
filter: (val) => {
|
||||
if (val && val.length > 0) {
|
||||
return (
|
||||
moment(val[0]).format('YYYY-MM-DD HH:mm:ss') +
|
||||
' ~ ' +
|
||||
moment(val[1]).format('YYYY-MM-DD HH:mm:ss')
|
||||
);
|
||||
}
|
||||
return '-';
|
||||
},
|
||||
},
|
||||
{
|
||||
prop: 'lineName',
|
||||
label: '产线'
|
||||
label: '产线',
|
||||
},
|
||||
{
|
||||
prop: 'sectionName',
|
||||
label: '工段'
|
||||
label: '工段',
|
||||
},
|
||||
{
|
||||
prop: 'equipmentName',
|
||||
label: '设备名称'
|
||||
label: '设备名称',
|
||||
},
|
||||
{
|
||||
prop: 'equipmentType',
|
||||
label: '设备类型'
|
||||
label: '设备类型',
|
||||
},
|
||||
{
|
||||
prop: 'workTime',
|
||||
label: '工作时间累积(h)'
|
||||
label: '工作时间累积(h)',
|
||||
},
|
||||
{
|
||||
prop: 'repairCount',
|
||||
label: '维修次数'
|
||||
label: '维修次数',
|
||||
},
|
||||
{
|
||||
prop: 'maintainCount',
|
||||
label: '保养次数'
|
||||
}
|
||||
label: '保养次数',
|
||||
},
|
||||
];
|
||||
|
||||
export default {
|
||||
mixins: [basicPage],
|
||||
data() {
|
||||
const today = new Date();
|
||||
|
||||
const todayStart = new Date(
|
||||
today.getFullYear(),
|
||||
today.getMonth(),
|
||||
today.getDate(),
|
||||
0,
|
||||
0,
|
||||
0
|
||||
);
|
||||
const todayEnd = new Date(
|
||||
today.getFullYear(),
|
||||
today.getMonth(),
|
||||
today.getDate(),
|
||||
23,
|
||||
59,
|
||||
59
|
||||
);
|
||||
|
||||
return {
|
||||
urlOptions: {
|
||||
getDataListURL: getEqAnalysis,
|
||||
exportURL: exportEqAnalysisExcel,
|
||||
},
|
||||
tableProps,
|
||||
tableBtn: [].filter((v)=>v),
|
||||
tableBtn: [].filter((v) => v),
|
||||
tableData: [],
|
||||
listQuery: {
|
||||
pageSize: 10,
|
||||
pageNo: 1,
|
||||
total: 1,
|
||||
recordTime: [
|
||||
moment(todayStart).format('YYYY-MM-DD HH:mm:ss'),
|
||||
moment(todayEnd).format('YYYY-MM-DD HH:mm:ss'),
|
||||
],
|
||||
},
|
||||
formConfig: [
|
||||
{
|
||||
type: 'input',
|
||||
@@ -101,7 +138,10 @@ export default {
|
||||
endPlaceholder: '结束日期',
|
||||
defaultTime: ['00:00:00', '23:59:59'],
|
||||
param: 'recordTime',
|
||||
defaultSelect: [],
|
||||
defaultSelect: [
|
||||
moment(todayStart).format('YYYY-MM-DD HH:mm:ss'),
|
||||
moment(todayEnd).format('YYYY-MM-DD HH:mm:ss'),
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
@@ -113,33 +153,38 @@ export default {
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('equipment:analysis-statistics:export') ? 'button' : '',
|
||||
type: this.$auth.hasPermi('equipment:analysis-statistics:export')
|
||||
? 'button'
|
||||
: '',
|
||||
btnName: '导出',
|
||||
name: 'export',
|
||||
color: 'warning',
|
||||
plain: true
|
||||
plain: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
created() {},
|
||||
mounted() {},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true;
|
||||
this.urlOptions.getDataListURL(this.listQuery).then(response => {
|
||||
this.tableData = response.data.list;
|
||||
this.listQuery.total = response.data.total;
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
getDataList() {
|
||||
this.dataListLoading = true;
|
||||
this.urlOptions.getDataListURL(this.listQuery).then((response) => {
|
||||
this.tableData = response.data.list;
|
||||
this.listQuery.total = response.data.total;
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
buttonClick(val) {
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
this.listQuery.pageNo = 1;
|
||||
this.listQuery.pageSize = 10;
|
||||
this.listQuery.equipmentName = val.name ? val.name : undefined;
|
||||
this.listQuery.recordTime = val.recordTime ? val.recordTime : undefined;
|
||||
this.listQuery.recordTime = val.recordTime
|
||||
? val.recordTime
|
||||
: undefined;
|
||||
this.getDataList();
|
||||
break;
|
||||
case 'reset':
|
||||
@@ -158,20 +203,24 @@ export default {
|
||||
console.log(val);
|
||||
}
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = { ...this.listQuery };
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal.confirm('是否确认导出所有数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return this.urlOptions.exportURL(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '设备统计分析.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => { });
|
||||
}
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = { ...this.listQuery };
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal
|
||||
.confirm('是否确认导出所有数据项?')
|
||||
.then(() => {
|
||||
this.exportLoading = true;
|
||||
return this.urlOptions.exportURL(params);
|
||||
})
|
||||
.then((response) => {
|
||||
this.$download.excel(response, '设备统计分析.xls');
|
||||
this.exportLoading = false;
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -237,6 +237,7 @@ export default {
|
||||
label: '工厂',
|
||||
placeholder: '请选择工厂',
|
||||
param: 'factoryId',
|
||||
filterable: true,
|
||||
selectOptions: [],
|
||||
},
|
||||
{
|
||||
@@ -244,6 +245,7 @@ export default {
|
||||
label: '产线',
|
||||
placeholder: '请选择产线',
|
||||
param: 'lineId',
|
||||
filterable: true,
|
||||
selectOptions: [],
|
||||
},
|
||||
// 选项切换
|
||||
|
||||
Reference in New Issue
Block a user