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

fix:提交

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