巡检计划编辑

This commit is contained in:
jiayu 2024-07-24 11:41:45 +08:00
parent f39f1c04e6
commit 4390535436
2 changed files with 27 additions and 65 deletions

View File

@ -105,7 +105,6 @@ import deepClone from "../../../uview-ui/libs/function/deepClone";
mobileTopHeight: 0,
projectSn: '',
userInfo: {},
pointAreaList: [],
areaData: {},
enterpriseData: {},
chargerList: [],
@ -117,6 +116,7 @@ import deepClone from "../../../uview-ui/libs/function/deepClone";
enterpriseName: "",
inspectUserName: "",
noticeUserName: "",
detailData: {},
form: {
routeName: "",
position: "",
@ -152,8 +152,8 @@ import deepClone from "../../../uview-ui/libs/function/deepClone";
if(option.id) {
this.pageTitle = "编辑巡检计划"
this.editId = option.id;
} else {
// this.getPointAreaFn();
this.detailData = JSON.parse(option.detail);
console.info(this.detailData, 'option')
}
},
mounted() {
@ -169,17 +169,18 @@ import deepClone from "../../../uview-ui/libs/function/deepClone";
},
methods: {
//
init() {
this.getEnterpriseList();
this.getAccountList();
this.getPointList();
async init() {
await this.getEnterpriseList();
await this.getAccountList();
await this.getPointList();
if(this.editId) await this.getData()
},
//
getData() {
return new Promise((resolve, reject) => {
console.info("getData", new Date().getTime())
this.sendRequest({
url: 'xmgl/checkingPoint/queryById',
url: 'xmgl/xzCheckingRoute/queryById',
method: 'get',
data: {
id: this.editId
@ -188,53 +189,23 @@ import deepClone from "../../../uview-ui/libs/function/deepClone";
if(res.code === 200) {
this.form = res.result
//
const obj = this.pointAreaList.find(item => item.id === this.form.qualityRegionId)
this.areaData = obj || {}
this.enterpriseName = this.detailData.enterpriseName;
this.inspectUserName = this.detailData.inspectUserNames;
this.noticeUserName = this.detailData.noticeUserNames;
//
this.enterpriseList = this.areaData.enterpriseInfos || [];
const eObj = this.enterpriseList.filter(item => this.form.enterpriseId.includes(item.id))
this.enterpriseName = eObj.map(item => item.enterpriseName).join(',')
//
this.chargerList = this.areaData.systemUsers.filter((item) => {
return this.form.enterpriseId.includes(item.enterpriseId);
}) || [];
this.inspectUserName = this.chargerList.filter(item => this.form.inspectUserIds.includes(item.userId)).map(item => item.realName).join(',')
let tempArr = JSON.parse(this.form.template) || []
tempArr.forEach(item => item.isRequired = item.isRequired ? "1" : "2")
const list = deepClone(this.accountList)
this.chargerList = list.filter((item) => {
return this.form.enterpriseId.includes(item.enterpriseId);
});
let tempArr = this.form.routeToPointList || []
tempArr.forEach(item => {
item.checkingPointName = this.inspectPointList.find(it => it.id === item.checkingPointId).checkingPointName
})
//
this.dyFormData = tempArr
console.info(eObj, 'eObj', this.dyFormData, tempArr)
resolve(res)
}
console.log(res, 'xiangqing');
},
fail: (err) => {
reject(err)
}
})
})
},
//
getPointAreaFn() {
return new Promise((resolve, reject) => {
console.info("getPointAreaFn", new Date().getTime())
let requestData = {
projectSn: this.projectSn,
};
this.sendRequest({
url: 'xmgl/qualityRegion/notTreeList',
method: 'post',
data: requestData,
success: (res) => {
console.log(res);
this.pointAreaList = res.result;
console.info("getPointAreaFn处理结束", new Date().getTime())
resolve(res)
},
fail: (err) => {
reject(err)
@ -311,20 +282,6 @@ import deepClone from "../../../uview-ui/libs/function/deepClone";
})
})
},
//
handleChangeRegion(e) {
let index = e.detail.value;
let findItem = this.pointAreaList[index];
this.form.qualityRegionId = findItem.id;
this.form.enterpriseId = "";
this.form.inspectUserIds = "";
this.enterpriseData = {};
console.log(findItem);
this.areaData = findItem;
this.chargerList = findItem.systemUsers;
this.enterpriseList = findItem.enterpriseInfos;
console.info(this.enterpriseList, 'enlist')
},
//
handleChangeEnterprise(e,values,labels) {
this.form.enterpriseId = values.join(',');

View File

@ -980,7 +980,12 @@
uni.navigateTo({
url: "/pages/projectEnd/InspectionRoute/editInspectionPlan"
})
}
},
handleEdit(data) {
uni.navigateTo({
url: `/pages/projectEnd/InspectionRoute/editInspectionPlan?id=${data.id}&detail=${JSON.stringify(data)}`
})
},
},
}
</script>