提交 fdc4b2ad authored 作者: caodi\cd's avatar caodi\cd

fix:提交

上级 554a10da
...@@ -267,7 +267,7 @@ export default { ...@@ -267,7 +267,7 @@ export default {
getInspectionDetails(uid) getInspectionDetails(uid)
.then((res) => { .then((res) => {
const detailsInfo = res; const detailsInfo = res;
console.log("getDetails", res); console.log("getDetails", detailsInfo.originData[this.value - 1]);
this.list = detailsInfo.originData[this.value - 1].details; this.list = detailsInfo.originData[this.value - 1].details;
console.log("list", this.list); console.log("list", this.list);
// this.inspectionResult = list[0].inspectionResult; // this.inspectionResult = list[0].inspectionResult;
...@@ -300,7 +300,7 @@ export default { ...@@ -300,7 +300,7 @@ export default {
if (this.uid) { if (this.uid) {
let posItem = this.detailsInfo.originData[this.value - 1]; let posItem = this.detailsInfo.originData[this.value - 1];
let paramsObj = this.getAllChildFormData(); //获取所有数据 let paramsObj = this.getAllChildFormData(); //获取所有数据
console.log("获取数据",paramsObj) console.log("获取数据", paramsObj);
posItem.details = paramsObj; posItem.details = paramsObj;
posItem.isSubmit = isSubmit; posItem.isSubmit = isSubmit;
if (!this.checkInspectionResult(paramsObj)) { if (!this.checkInspectionResult(paramsObj)) {
...@@ -322,7 +322,6 @@ export default { ...@@ -322,7 +322,6 @@ export default {
// ); // );
// this.detailsInfo.status = notZeroCount; //巡检总数 // this.detailsInfo.status = notZeroCount; //巡检总数
// this.detailsInfo.isException = equalTwoCount; //异常数量 // this.detailsInfo.isException = equalTwoCount; //异常数量
console.log("this.detailsInfo", this.detailsInfo);
this.detailsInfo.submitTime = moment().format("yyyy-MM-DD"); // 记录提交时间 this.detailsInfo.submitTime = moment().format("yyyy-MM-DD"); // 记录提交时间
this.detailsInfo.submitMonth = moment().format("yyyy-MM"); // 记录提交月份 this.detailsInfo.submitMonth = moment().format("yyyy-MM"); // 记录提交月份
return this.detailsInfo; return this.detailsInfo;
...@@ -335,14 +334,14 @@ export default { ...@@ -335,14 +334,14 @@ export default {
value: item.dictValue, value: item.dictValue,
jfType: item.jfType, jfType: item.jfType,
isVaild: false, // 校验通过 isVaild: false, // 校验通过
details: this.itemDetail, details: {},
status: item.status, status: item.status,
refName: `TabContentItem_${index}`, refName: `TabContentItem_${index}`,
statusLable: item.statusLable, statusLable: item.statusLable,
}; };
}); });
let tabList = JSON.parse(JSON.stringify(dataObj)); let tabList = this.deepClone(dataObj);
let posItem = tabList[this.value-1]; let posItem = tabList[this.value - 1];
posItem.details = paramsObj; posItem.details = paramsObj;
if (!this.checkInspectionResult(paramsObj)) { if (!this.checkInspectionResult(paramsObj)) {
posItem.status = 1; //1表示已经巡检过没有异常 posItem.status = 1; //1表示已经巡检过没有异常
...@@ -366,6 +365,28 @@ export default { ...@@ -366,6 +365,28 @@ export default {
return data; return data;
} }
}, },
deepClone(target) {
if (typeof target !== "object" || target === null) {
return target;
}
let clone;
if (Array.isArray(target)) {
clone = [];
for (let i = 0; i < target.length; i++) {
clone[i] = this.deepClone(target[i]);
}
} else {
clone = {};
for (const key in target) {
if (target.hasOwnProperty(key)) {
clone[key] = this.deepClone(target[key]);
}
}
}
return clone;
},
count(originData) { count(originData) {
return originData.reduce( return originData.reduce(
(acc, curr) => { (acc, curr) => {
...@@ -424,7 +445,7 @@ export default { ...@@ -424,7 +445,7 @@ export default {
return false; return false;
} }
const params = this.getParams(isSubmit); //数据获取 const params = this.getParams(isSubmit); //数据获取
console.log("提交时获取一次",params) console.log("提交时获取一次", params);
const all_data = this.$store.state.all_data; //获取全部数据 const all_data = this.$store.state.all_data; //获取全部数据
let logContent = ""; let logContent = "";
console.log("all_data", all_data); console.log("all_data", all_data);
...@@ -484,6 +505,7 @@ export default { ...@@ -484,6 +505,7 @@ export default {
// 遍历 ref 名称数组 // 遍历 ref 名称数组
this.tabs.forEach((item) => { this.tabs.forEach((item) => {
console.log("item.value", item.value);
let refName = item.value; let refName = item.value;
// 通过 this.$refs[refName] 获取子组件实例 // 通过 this.$refs[refName] 获取子组件实例
const childComponent = this.$refs[refName]; const childComponent = this.$refs[refName];
...@@ -492,8 +514,10 @@ export default { ...@@ -492,8 +514,10 @@ export default {
allData[refName] = childComponent.getFromData(); allData[refName] = childComponent.getFromData();
} }
}); });
// console.log("wlhj",this.$refs["wlhj"].getFromData())
console.log("所有子组件的数据:", allData); // console.log("afxt",this.$refs["afxt"].getFromData())
// console.log("dlxt",this.$refs["dlxt"].getFromData())
// console.log("所有子组件的数据:", allData);
return allData; return allData;
}, },
// 判断所有的数据是否通过校验 // 判断所有的数据是否通过校验
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论