|
@@ -1,8 +1,8 @@
|
|
|
-<!-- 四级审核页面 -->
|
|
|
|
|
|
|
+<!-- 四级审核页面:动态获取表格字段、正则表达式 -->
|
|
|
<template>
|
|
<template>
|
|
|
<div class="examination secondApprove">
|
|
<div class="examination secondApprove">
|
|
|
<div class="common-head-search">
|
|
<div class="common-head-search">
|
|
|
- <el-form :inline="true" :model="search" ref="search" :rules="rules">
|
|
|
|
|
|
|
+ <el-form :inline="true" :model="search" ref="search">
|
|
|
<el-form-item label="检验车间" prop="deptNo">
|
|
<el-form-item label="检验车间" prop="deptNo">
|
|
|
<el-select v-model="search.deptNo" filterable clearable style="width: 140px" @clear="clearSelect"
|
|
<el-select v-model="search.deptNo" filterable clearable style="width: 140px" @clear="clearSelect"
|
|
|
@change="selectClass" size="small">
|
|
@change="selectClass" size="small">
|
|
@@ -57,18 +57,6 @@
|
|
|
<el-date-picker v-model="search.times[1]" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date"
|
|
<el-date-picker v-model="search.times[1]" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date"
|
|
|
placeholder="结束日期" size="mini" style="width: 140px" :default-time="'23:59:59'">
|
|
placeholder="结束日期" size="mini" style="width: 140px" :default-time="'23:59:59'">
|
|
|
</el-date-picker>
|
|
</el-date-picker>
|
|
|
- <!-- <el-date-picker
|
|
|
|
|
- v-model="search.times"
|
|
|
|
|
- type="daterange"
|
|
|
|
|
- range-separator="至"
|
|
|
|
|
- start-placeholder="开始日期"
|
|
|
|
|
- end-placeholder="结束日期"
|
|
|
|
|
- size="small"
|
|
|
|
|
- style="width: 300px"
|
|
|
|
|
- format="yyyy-MM-dd"
|
|
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
|
|
- >
|
|
|
|
|
- </el-date-picker> -->
|
|
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
|
<el-button icon="el-icon-search" type="goon" size="mini" :disable="disSearch" @click="searchData"
|
|
<el-button icon="el-icon-search" type="goon" size="mini" :disable="disSearch" @click="searchData"
|
|
@@ -583,26 +571,26 @@ export default {
|
|
|
carNo: "",
|
|
carNo: "",
|
|
|
sampleTypeCode: "",
|
|
sampleTypeCode: "",
|
|
|
matName: "",
|
|
matName: "",
|
|
|
- times: "",
|
|
|
|
|
|
|
+ times: [null, null],
|
|
|
type: ""
|
|
type: ""
|
|
|
},
|
|
},
|
|
|
- rules: {
|
|
|
|
|
- times: [
|
|
|
|
|
- {
|
|
|
|
|
- trigger: ['change', 'blur'],
|
|
|
|
|
- validator: (rule, value, callback) => {
|
|
|
|
|
- const startDate = value[0];
|
|
|
|
|
- const endDate = value[1];
|
|
|
|
|
- if (!startDate || !endDate) {
|
|
|
|
|
- return callback(new Error('请选择完整的日期范围'));
|
|
|
|
|
- }
|
|
|
|
|
- if (new Date(startDate) > new Date(endDate)) {
|
|
|
|
|
- return callback(new Error('开始日期不能晚于结束日期'));
|
|
|
|
|
- }
|
|
|
|
|
- callback();
|
|
|
|
|
- }
|
|
|
|
|
- }],
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ // rules: {
|
|
|
|
|
+ // times: [
|
|
|
|
|
+ // {
|
|
|
|
|
+ // trigger: ['change', 'blur'],
|
|
|
|
|
+ // validator: (rule, value, callback) => {
|
|
|
|
|
+ // const startDate = value[0];
|
|
|
|
|
+ // const endDate = value[1];
|
|
|
|
|
+ // if (!startDate || !endDate) {
|
|
|
|
|
+ // return callback(new Error('请选择完整的日期范围'));
|
|
|
|
|
+ // }
|
|
|
|
|
+ // if (new Date(startDate) > new Date(endDate)) {
|
|
|
|
|
+ // return callback(new Error('开始日期不能晚于结束日期'));
|
|
|
|
|
+ // }
|
|
|
|
|
+ // callback();
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }],
|
|
|
|
|
+ // },
|
|
|
loading: false,
|
|
loading: false,
|
|
|
dialogTableVisible: false,
|
|
dialogTableVisible: false,
|
|
|
dialogEntrustVisible: false,
|
|
dialogEntrustVisible: false,
|
|
@@ -688,8 +676,11 @@ export default {
|
|
|
this.activeName = this.fromDaiban.status == 1 ? "second" : "first";
|
|
this.activeName = this.fromDaiban.status == 1 ? "second" : "first";
|
|
|
} else {
|
|
} else {
|
|
|
this.search.times = [
|
|
this.search.times = [
|
|
|
- this.getYNM(new Date(timestamp)) + " 00:00:00",
|
|
|
|
|
- this.getYNM(new Date()) + " 23:59:59",
|
|
|
|
|
|
|
+ null, null
|
|
|
|
|
+ ];
|
|
|
|
|
+ this.search.times = [
|
|
|
|
|
+ this.getYNM(new Date(timestamp)),
|
|
|
|
|
+ this.getYNM(new Date()),
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -860,10 +851,10 @@ export default {
|
|
|
this.search.sampleNo = "";
|
|
this.search.sampleNo = "";
|
|
|
let timestamp = new Date().getTime() - 7 * 24 * 60 * 60 * 1000; // 默认前一周
|
|
let timestamp = new Date().getTime() - 7 * 24 * 60 * 60 * 1000; // 默认前一周
|
|
|
|
|
|
|
|
- this.search.times = [
|
|
|
|
|
- this.getYNM(new Date(timestamp)) + " 00:00:00",
|
|
|
|
|
- this.getYNM(new Date()) + " 23:59:59",
|
|
|
|
|
- ];
|
|
|
|
|
|
|
+ // this.search.times = [
|
|
|
|
|
+ // this.getYNM(new Date(timestamp)) + " 00:00:00",
|
|
|
|
|
+ // this.getYNM(new Date()) + " 23:59:59",
|
|
|
|
|
+ // ];
|
|
|
this.searchData();
|
|
this.searchData();
|
|
|
},
|
|
},
|
|
|
refresh() { },
|
|
refresh() { },
|
|
@@ -1201,35 +1192,38 @@ export default {
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
//查询
|
|
//查询
|
|
|
|
|
+ // searchData() {
|
|
|
|
|
+ // if (this.loading) return;
|
|
|
|
|
+ // this.loading = true;
|
|
|
|
|
+ // this.pageIndex = 1;
|
|
|
|
|
+ // this.pageSize = 500;
|
|
|
|
|
+ // this.pageIndex2 = 1;
|
|
|
|
|
+ // this.pageSize2 = 500;
|
|
|
|
|
+ // try {
|
|
|
|
|
+ // this.dataMainWl11().catch(err => console.error('dataMainWl11失败:', err))
|
|
|
|
|
+ // .then(() => this.dataMainWl21().catch(err => console.error('dataMainWl21失败:', err)))
|
|
|
|
|
+ // .finally(() => this.loading = false);
|
|
|
|
|
+ // } catch (error) {
|
|
|
|
|
+ // console.error('数据加载失败:', error);
|
|
|
|
|
+ // this.loading = false;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // },
|
|
|
searchData() {
|
|
searchData() {
|
|
|
if (this.loading) return;
|
|
if (this.loading) return;
|
|
|
- console.log("search time1......", this.search);
|
|
|
|
|
- // this.$refs['search'].validate((valid) => {
|
|
|
|
|
- // this.loading = true;
|
|
|
|
|
- this.$nextTick(() => {
|
|
|
|
|
- this.$refs['search'].validate((valid) => {
|
|
|
|
|
- if (valid) {
|
|
|
|
|
- try {
|
|
|
|
|
- console.log('表单验证通过.......')
|
|
|
|
|
- this.loading = true;
|
|
|
|
|
- this.pageIndex = 1;
|
|
|
|
|
- this.pageSize = 500;
|
|
|
|
|
- this.pageIndex2 = 1;
|
|
|
|
|
- this.pageSize2 = 500;
|
|
|
|
|
- this.dataMainWl11(),
|
|
|
|
|
- this.dataMainWl21()
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error('数据加载失败:', error);
|
|
|
|
|
- this.loading = false;
|
|
|
|
|
- } finally {
|
|
|
|
|
- this.loading = false;
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- console.log('表单验证失败');
|
|
|
|
|
- this.loading = false;
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ this.loading = true;
|
|
|
|
|
+ this.pageIndex = 1;
|
|
|
|
|
+ this.pageSize = 500;
|
|
|
|
|
+ this.pageIndex2 = 1;
|
|
|
|
|
+ this.pageSize2 = 500;
|
|
|
|
|
+ this.dataMainWl11(),
|
|
|
|
|
+ this.dataMainWl21()
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('数据加载失败:', error);
|
|
|
|
|
+ this.loading = false;
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ this.loading = false;
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
// 车间列表(检测中心下)
|
|
// 车间列表(检测中心下)
|
|
|
selectDepartment(val) {
|
|
selectDepartment(val) {
|
|
@@ -1255,15 +1249,10 @@ export default {
|
|
|
this.click_main = {};
|
|
this.click_main = {};
|
|
|
this.tableData1 = [];
|
|
this.tableData1 = [];
|
|
|
this.total_main = 0;
|
|
this.total_main = 0;
|
|
|
- // let startTime = "";
|
|
|
|
|
- // let endTime = "";
|
|
|
|
|
- let startTime = this.search.times[0];
|
|
|
|
|
- let endTime = this.search.times[1];
|
|
|
|
|
- if (new Date(startTime) > new Date(endTime)) {
|
|
|
|
|
- this.$message.error('开始时间不能晚于结束时间');
|
|
|
|
|
- this.loading = false;
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ let startTime = null;
|
|
|
|
|
+ let endTime = null;
|
|
|
|
|
+ startTime = this.search.times[0] === null ? null : (this.search.times[0] + ' 00:00:00')
|
|
|
|
|
+ endTime = this.search.times[1] === null ? null : (this.search.times[1] + ' 23:59:59')
|
|
|
let obj = {
|
|
let obj = {
|
|
|
object: {
|
|
object: {
|
|
|
validFlag: "1",
|
|
validFlag: "1",
|
|
@@ -1286,19 +1275,21 @@ export default {
|
|
|
{ individualType: "json" }
|
|
{ individualType: "json" }
|
|
|
)
|
|
)
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
|
|
+ console.log('search1 res', res)
|
|
|
if (res.code == 0 || res.code == 200) {
|
|
if (res.code == 0 || res.code == 200) {
|
|
|
|
|
+ console.log('search1......', res.data);
|
|
|
this.tableData11 = res.data;
|
|
this.tableData11 = res.data;
|
|
|
this.loading = false;
|
|
this.loading = false;
|
|
|
} else {
|
|
} else {
|
|
|
this.loading = false;
|
|
this.loading = false;
|
|
|
- this.$message.error(res.message);
|
|
|
|
|
|
|
+ // this.$message.error(res.message);
|
|
|
}
|
|
}
|
|
|
this.tableLoading11 = false;
|
|
this.tableLoading11 = false;
|
|
|
})
|
|
})
|
|
|
.catch((err) => {
|
|
.catch((err) => {
|
|
|
this.loading = false;
|
|
this.loading = false;
|
|
|
this.tableLoading11 = false;
|
|
this.tableLoading11 = false;
|
|
|
- this.$message.error(err.message);
|
|
|
|
|
|
|
+ // this.$message.error(err.message);
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
// 已审核物料
|
|
// 已审核物料
|
|
@@ -1306,13 +1297,10 @@ export default {
|
|
|
this.click_main2 = {};
|
|
this.click_main2 = {};
|
|
|
this.tableData2 = [];
|
|
this.tableData2 = [];
|
|
|
this.total_main2 = 0;
|
|
this.total_main2 = 0;
|
|
|
- let startTime = this.search.times[0];
|
|
|
|
|
- let endTime = this.search.times[1];
|
|
|
|
|
- if (new Date(startTime) > new Date(endTime)) {
|
|
|
|
|
- this.$message.error('开始时间不能晚于结束时间');
|
|
|
|
|
- this.loading = false;
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ let startTime = null;
|
|
|
|
|
+ let endTime = null;
|
|
|
|
|
+ startTime = this.search.times[0] === null ? null : (this.search.times[0] + ' 00:00:00')
|
|
|
|
|
+ endTime = this.search.times[1] === null ? null : (this.search.times[1] + ' 23:59:59')
|
|
|
let obj = {
|
|
let obj = {
|
|
|
object: {
|
|
object: {
|
|
|
validFlag: "1",
|
|
validFlag: "1",
|
|
@@ -1336,6 +1324,7 @@ export default {
|
|
|
)
|
|
)
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
if (res.code == 0 || res.code == 200) {
|
|
if (res.code == 0 || res.code == 200) {
|
|
|
|
|
+ console.log('search2......', res.data);
|
|
|
this.tableData21 = res.data;
|
|
this.tableData21 = res.data;
|
|
|
this.loading = false;
|
|
this.loading = false;
|
|
|
} else {
|
|
} else {
|
|
@@ -1388,7 +1377,7 @@ export default {
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
if (res.code == 0 || res.code == 200) {
|
|
if (res.code == 0 || res.code == 200) {
|
|
|
this.tableData1 = res.data.data.list;
|
|
this.tableData1 = res.data.data.list;
|
|
|
- this.cols = res.data.head;
|
|
|
|
|
|
|
+ this.cols = res.data.head;//如何动态获取表头!!!!
|
|
|
this.total_main = res.data.data.total;
|
|
this.total_main = res.data.data.total;
|
|
|
if (this.tableData1.length > 0) {
|
|
if (this.tableData1.length > 0) {
|
|
|
this.isShowSuppName = res.data.data.list[0].SUPP_NAME
|
|
this.isShowSuppName = res.data.data.list[0].SUPP_NAME
|
|
@@ -1411,6 +1400,35 @@ export default {
|
|
|
this.$message.error(err.message);
|
|
this.$message.error(err.message);
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+ parseFieldWithBracket(val) {
|
|
|
|
|
+ // 初始化返回结果
|
|
|
|
|
+ const result = {
|
|
|
|
|
+ isValid: false, // 是否整体有效
|
|
|
|
|
+ restValue: '', // 括号后的剩余内容
|
|
|
|
|
+ matchedValue: null // 匹配成功的拼接值
|
|
|
|
|
+ };
|
|
|
|
|
+ if (!val || typeof val !== 'string') {
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+ const reg = /([\d,.]+)\(([\d,.]+)\)/;
|
|
|
|
|
+ const match = val.match(reg);
|
|
|
|
|
+ if (!match) {
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+ const before = match[1].trim();
|
|
|
|
|
+ const inside = match[2].trim();
|
|
|
|
|
+
|
|
|
|
|
+ const bracketStartIndex = val.indexOf(')') + 1;
|
|
|
|
|
+ if (bracketStartIndex > 0) {
|
|
|
|
|
+ result.restValue = val.substring(bracketStartIndex);
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log('val.....', val, 'bracketStartIndex.....', bracketStartIndex, 'restValue.....', result.restValue);
|
|
|
|
|
+ const numCheckReg = /^[\d,.]+$/;
|
|
|
|
|
+ if (!numCheckReg.test(before) || !numCheckReg.test(inside)) {
|
|
|
|
|
+ console.log('包含非数字内容,跳过:', before, inside);
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
// 已审核数据
|
|
// 已审核数据
|
|
|
dataMain2() {
|
|
dataMain2() {
|
|
|
if (!this.click_main2 || !this.click_main2.MAT_NO) {
|
|
if (!this.click_main2 || !this.click_main2.MAT_NO) {
|
|
@@ -1448,6 +1466,7 @@ export default {
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
if (res.code == 0 || res.code == 200) {
|
|
if (res.code == 0 || res.code == 200) {
|
|
|
this.tableData2 = res.data.data.list;
|
|
this.tableData2 = res.data.data.list;
|
|
|
|
|
+ console.log('tableData2....', this.tableData2)
|
|
|
this.cols2 = res.data.head;
|
|
this.cols2 = res.data.head;
|
|
|
this.total_main2 = res.data.data.total;
|
|
this.total_main2 = res.data.data.total;
|
|
|
if (this.tableData2.length > 0) {
|
|
if (this.tableData2.length > 0) {
|