巡检计划编辑
This commit is contained in:
parent
f39f1c04e6
commit
4390535436
@ -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(',');
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user