提交 7a83284c authored 作者: JaxBBLL's avatar JaxBBLL

fix: bugs

上级 aba2afd2
......@@ -3,10 +3,10 @@
<view class="container">
<view class="flex">
<navigator
url="/pages/inspectionContent/inspectionContentList?uid=15"
url="/pages/inspectionContent/inspectionContentList?uid=23"
hover-class="navigator-hover"
>
<button type="default" class="uni-btn">15</button>
<button type="default" class="uni-btn">23</button>
</navigator>
<navigator
url="/pages/inspectionContent/inspectionContentList?uid=16"
......
......@@ -504,7 +504,7 @@ export default {
realSave(data) {
const send = dataToSql(data);
const api = this.uid ? inspectApi.update : inspectApi.save;
api(this.uid ? { id: this.uid, ...send } : send).then((res) => {
return api(this.uid ? { id: this.uid, ...send } : send).then((res) => {
if (!this.uid) {
this.uid = res.lastInsertId;
setTimeout(() => {
......@@ -529,65 +529,58 @@ export default {
const params = this.getParams(isSubmit); //数据获取
console.log("提交时获取一次", params);
this.realSave(params);
// const all_data = this.$store.state.all_data; //获取全部数据
let logContent = "";
console.log("all_data", this.all_data);
if (this.uid) {
const index = this.all_data.findIndex(
(element) => element.uid == this.uid
this.realSave(params).then(() => {
let logContent = "";
console.log("all_data", this.all_data);
if (this.uid) {
const index = this.all_data.findIndex(
(element) => element.uid == this.uid
);
params.uid = this.uid;
this.all_data[index] = params;
logContent = getLogContent(
LOG_TYPE_ENUM.edit,
`${params.recordName}(${params.inspectionCode})`,
"巡检模块"
);
} else {
this.all_data.push(params);
logContent = getLogContent(
LOG_TYPE_ENUM.add,
`${params.recordName}(${params.inspectionCode})`,
"巡检模块"
);
}
// 更新巡检list
const userInfo = this.userInfo;
console.log("all_data存储", this.all_data);
this.$store.commit("SET_ALL_DATA", this.all_data);
const inspectList = this.all_data.filter(
(item) => item.createByName == userInfo.user
);
params.uid = this.uid;
this.all_data[index] = params;
logContent = getLogContent(
LOG_TYPE_ENUM.edit,
`${params.recordName}(${params.inspectionCode})`,
"巡检模块"
);
} else {
this.all_data.push(params);
logContent = getLogContent(
LOG_TYPE_ENUM.add,
`${params.recordName}(${params.inspectionCode})`,
"巡检模块"
);
}
// 更新巡检list
const userInfo = this.userInfo;
console.log("all_data存储", this.all_data);
this.$store.commit("SET_ALL_DATA", this.all_data);
const inspectList = this.all_data.filter(
(item) => item.createByName == userInfo.user
);
console.log("inspectList", inspectList);
writeInspectionData(inspectList, userInfo.user);
console.log("inspectList", inspectList);
writeInspectionData(inspectList, userInfo.user);
// 更新日志
const log_list = this.$store.state.log_list;
logContent.inspectionType = params.inspectionType;
log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list).then((res) => {
console.log("日志文件写入成功");
});
// 更新日志
const log_list = this.$store.state.log_list;
logContent.inspectionType = params.inspectionType;
log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list).then((res) => {
console.log("日志文件写入成功");
if (isSubmit) {
this.startDialog();
} else {
uni.showToast({
title: "暂存成功",
icon: "none",
});
}
});
// 清空基础缓存信息
// this.$store.commit("SET_TEMP_DATA", {}); // 缓存[巡检信息]
// uni.showToast({
// title: isSubmit ? "提交成功" : "保存草稿成功",
// icon: "success",
// });
if (isSubmit) {
this.startDialog();
} else {
uni.showToast({
title: "暂存成功",
icon: "none",
});
}
},
startDialog() {
let allIsSubmitOne = this.listData.every((item) => item.isSubmit === 1);
......@@ -597,7 +590,9 @@ export default {
// let item = this.findTargetObject(this.listData);
const item = this.listData.find((item) => item.status != 1);
const item = this.listData.find(
(item) => !item.status || item.isSubmit == 0
);
console.log("即将操作的机房", item);
this.name = item && item.name ? item.name : "";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论