This commit is contained in:
lb 2023-09-22 10:54:21 +08:00
parent f43b1c1eab
commit dcda3a6294
3 changed files with 61 additions and 41 deletions

View File

@ -54,6 +54,7 @@
label="按钮盒识别码" label="按钮盒识别码"
prop="buttonId" prop="buttonId"
:rules="[ :rules="[
{ required: true, message: '不能为空', trigger: 'blur' },
{ {
type: 'number', type: 'number',
message: '请输入整数', message: '请输入整数',
@ -98,12 +99,16 @@
label="按钮值" label="按钮值"
prop="keyValue" prop="keyValue"
:rules="[ :rules="[
{ required: true, message: '不能为空', trigger: 'blur' },
{ {
type: 'number', type: 'number',
message: '请输入100以内的整数', message: '请输入100以内的整数',
trigger: 'blur', trigger: 'blur',
transform: (val) => transform: (val) =>
Number(val) <= 100 && Number.isInteger(+val) && Number(val), Number.isInteger(+val) &&
Number(val) >= 0 &&
Number(val) <= 100 &&
Number(val),
}, },
]"> ]">
<el-input <el-input
@ -165,10 +170,10 @@ export default {
watch: { watch: {
'dataForm.productionId': { 'dataForm.productionId': {
handler(id) { handler(id) {
this.getWorksectionList(id); if (id != null) this.getWorksectionList(id);
}, },
immediate: true immediate: true,
} },
}, },
methods: { methods: {
/** 模拟透传 ref */ /** 模拟透传 ref */

View File

@ -236,7 +236,8 @@ export default {
// width: 160, // width: 160,
prop: 'checkTime', prop: 'checkTime',
label: '检测时间', label: '检测时间',
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'), filter: (val) =>
val != null ? moment(val).format('yyyy-MM-DD HH:mm:ss') : '-',
}, },
{ {
width: 90, width: 90,

View File

@ -332,33 +332,51 @@ export default {
}, },
mounted() { mounted() {
if (this.$route.params.startTime && this.$route.params.endTime) { if (this.$route.params.startTime && this.$route.params.endTime) {
this.searchBarFormConfig[0].defaultSelect = [this.$route.params.startTime, this.$route.params.endTime] this.searchBarFormConfig[0].defaultSelect = [
this.$route.params.startTime,
this.$route.params.endTime,
];
this.queryParams.param = {}; this.queryParams.param = {};
this.$set(this.queryParams.param, 'startTime', this.$route.params.startTime); this.$set(
this.queryParams.param,
'startTime',
this.$route.params.startTime
);
this.$set(this.queryParams.param, 'endTime', this.$route.params.endTime); this.$set(this.queryParams.param, 'endTime', this.$route.params.endTime);
} else { } else {
this.searchBarFormConfig[0].defaultSelect = [] this.searchBarFormConfig[0].defaultSelect = [];
} }
this.getList(); this.getList();
}, },
watch: { watch: {
$route: 'initData' $route: 'initData',
}, },
methods: { methods: {
initData(to) { initData(to) {
// console.log(to) // console.log(to)
if (to.name === 'QualityStatistics') { if (to.name === 'QualityStatistics') {
if (this.$route.params.startTime && this.$route.params.endTime) { if (this.$route.params.startTime && this.$route.params.endTime) {
this.searchBarFormConfig[0].defaultSelect = [this.$route.params.startTime, this.$route.params.endTime] this.searchBarFormConfig[0].defaultSelect = [
this.$route.params.startTime,
this.$route.params.endTime,
];
this.queryParams.param = {}; this.queryParams.param = {};
this.$set(this.queryParams.param, 'startTime', this.$route.params.startTime); this.$set(
this.$set(this.queryParams.param, 'endTime', this.$route.params.endTime); this.queryParams.param,
'startTime',
this.$route.params.startTime
);
this.$set(
this.queryParams.param,
'endTime',
this.$route.params.endTime
);
} else { } else {
this.searchBarFormConfig[0].defaultSelect = [] this.searchBarFormConfig[0].defaultSelect = [];
} }
this.getList(); this.getList();
} }
}, },
getList() { getList() {
this.getSummaryList(); this.getSummaryList();
this.getDetailedList(); this.getDetailedList();
@ -367,20 +385,17 @@ export default {
async getSummaryList() { async getSummaryList() {
const response = await this.$axios({ const response = await this.$axios({
url: '/monitoring/statistical-data/getUpPart', url: '/monitoring/statistical-data/getUpPart',
method: 'get', method: 'post',
params: this.queryParams.param data: this.queryParams.param
? { ? {
param: { // startTime: new Date(2022, 6, 1, 0, 0, 0).getTime(), // '2023-07-01 00:00:00',
// startTime: new Date(2022, 6, 1, 0, 0, 0).getTime(), // '2023-07-01 00:00:00', // endTime: new Date(2023, 7, 10, 0, 0, 0).getTime(), // '2023-08-10 00:00:00',
// endTime: new Date(2023, 7, 10, 0, 0, 0).getTime(), // '2023-08-10 00:00:00', startTime: this.queryParams.param.startTime,
startTime: this.queryParams.param.startTime, endTime: this.queryParams.param.endTime,
endTime: this.queryParams.param.endTime,
},
} }
: null, : {},
}); });
this.summaryList = response.data; this.summaryList = response.data;
console.log('summaryList', this.summaryList);
}, },
/** 获取 检测内容和产线关联 列表 */ /** 获取 检测内容和产线关联 列表 */
async getDetailedList() { async getDetailedList() {
@ -388,22 +403,21 @@ export default {
data: { data, otherList, otherMap, nameData }, data: { data, otherList, otherMap, nameData },
} = await this.$axios({ } = await this.$axios({
url: '/monitoring/statistical-data/getDownPart', url: '/monitoring/statistical-data/getDownPart',
params: this.queryParams.param method: 'post',
data: this.queryParams.param
? { ? {
param: { // startTime: new Date(2023, 6, 1).getTime(), // '2023-07-01 00:00:00',
// startTime: new Date(2023, 6, 1).getTime(), // '2023-07-01 00:00:00', // endTime: new Date(2023, 7, 22).getTime(), // '2023-08-10 00:00:00',
// endTime: new Date(2023, 7, 22).getTime(), // '2023-08-10 00:00:00', startTime: this.queryParams.param.startTime,
startTime: this.queryParams.param.startTime, endTime: this.queryParams.param.endTime,
endTime: this.queryParams.param.endTime,
},
} }
: null, : {},
}); });
// this.list = response.data; // this.list = response.data;
console.log('data', data); // console.log('data', data);
console.log('otherList', otherList); // console.log('otherList', otherList);
console.log('otherMap', otherMap); // console.log('otherMap', otherMap);
console.log('nameData', nameData); // console.log('nameData', nameData);
this.dynamicProps = this.filterNameData(nameData); this.dynamicProps = this.filterNameData(nameData);
this.list = this.filterData(data); this.list = this.filterData(data);