巡检点编辑
This commit is contained in:
parent
056f955e5c
commit
ba745a36d2
@ -78,9 +78,9 @@
|
||||
</view>
|
||||
<view class="c_body">
|
||||
<input class="c_input" v-model="item.value" :placeholder="`请输入${item.title}`" />
|
||||
<radio-group>
|
||||
<radio style="margin-right: 12rpx;" value="1" :checked="item.isRequired">必填</radio>
|
||||
<radio value="2" :checked="!item.isRequired">非必填</radio>
|
||||
<radio-group @change="((e) => handleChangeRadio(e.detail.value, item))">
|
||||
<radio style="margin-right: 12rpx;" value="1" :checked="item.isRequired == '1'">必填</radio>
|
||||
<radio value="2" :checked="item.isRequired == '2'">非必填</radio>
|
||||
</radio-group>
|
||||
</view>
|
||||
</view>
|
||||
@ -131,7 +131,12 @@
|
||||
longitude: "", //经度
|
||||
addr: "", //地图区域
|
||||
},
|
||||
dyFormData: []
|
||||
dyFormData: [{
|
||||
title: "表单标题",
|
||||
name: "",
|
||||
isRequired: "1",
|
||||
value: "",
|
||||
}]
|
||||
}
|
||||
},
|
||||
async onLoad(option) {
|
||||
@ -148,22 +153,16 @@
|
||||
this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
|
||||
|
||||
this.editId = ""
|
||||
await this.getPointAreaFn();
|
||||
|
||||
// 编辑
|
||||
if(option.id) {
|
||||
this.editId = option.id;
|
||||
// await this.getData()
|
||||
await this.getPointAreaFn();
|
||||
await this.getData()
|
||||
} else {
|
||||
await this.getPointAreaFn();
|
||||
this.mapGetLocation();
|
||||
}
|
||||
|
||||
console.info(option, '-------')
|
||||
// this.taskId = option.taskId
|
||||
// this.itemId = option.itemId
|
||||
// this.form.taskId = option.taskId
|
||||
// this.form.itemId = option.itemId
|
||||
// if(option.engineeringId) this.engineeringId = option.engineeringId
|
||||
// if(option.type) this.type = Number(option.type)
|
||||
},
|
||||
mounted() {
|
||||
var that = this
|
||||
@ -175,45 +174,74 @@
|
||||
}
|
||||
})
|
||||
console.log('this.mobileTopHeight',this.mobileTopHeight)
|
||||
|
||||
this.dyFormData.splice(0);
|
||||
this.dyFormData.push({
|
||||
title: "表单标题",
|
||||
name: "",
|
||||
isRequired: "1",
|
||||
value: "",
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
// 编辑回显
|
||||
getData() {
|
||||
this.sendRequest({
|
||||
url: 'xmgl/checkingPoint/queryById',
|
||||
method: 'get',
|
||||
data: {
|
||||
id: this.editId
|
||||
},
|
||||
success: (res) => {
|
||||
if(res.code === 200) {
|
||||
this.form = res.result
|
||||
console.info(this.pointAreaList.find(item => item.id === this.form.qualityRegionId))
|
||||
new Promise((resolve, reject) => {
|
||||
console.info("getData", new Date().getTime())
|
||||
this.sendRequest({
|
||||
url: 'xmgl/checkingPoint/queryById',
|
||||
method: 'get',
|
||||
data: {
|
||||
id: this.editId
|
||||
},
|
||||
success: (res) => {
|
||||
if(res.code === 200) {
|
||||
this.form = res.result
|
||||
|
||||
// 区域
|
||||
const obj = this.pointAreaList.find(item => item.id === this.form.qualityRegionId)
|
||||
this.areaData = obj || {}
|
||||
|
||||
// 责任企业
|
||||
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")
|
||||
// 动态表单
|
||||
this.dyFormData = tempArr
|
||||
|
||||
console.info(eObj, 'eObj', this.dyFormData, tempArr)
|
||||
resolve(res)
|
||||
}
|
||||
console.log(res, 'xiangqing');
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(err)
|
||||
}
|
||||
console.log(res, 'xiangqing');
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
// 获取区域列表
|
||||
getPointAreaFn() {
|
||||
let requestData = {
|
||||
projectSn: this.projectSn,
|
||||
};
|
||||
this.sendRequest({
|
||||
url: 'xmgl/qualityRegion/notTreeList',
|
||||
method: 'post',
|
||||
data: requestData,
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
this.pointAreaList = res.result;
|
||||
}
|
||||
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)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
// 切换区域
|
||||
@ -232,7 +260,6 @@
|
||||
},
|
||||
// 切换责任企业
|
||||
handleChangeEnterprise(e,values,labels) {
|
||||
console.info(e, 'eee', this.form.enterpriseId, values, labels)
|
||||
this.form.enterpriseId = values.join(',');
|
||||
this.$nextTick(() => {
|
||||
if(this.form.enterpriseId) {
|
||||
@ -252,15 +279,16 @@
|
||||
},
|
||||
// 切换责任人
|
||||
handleChangeCharger(e,values,labels) {
|
||||
console.info(e, 'eeeee')
|
||||
this.form.inspectUserIds = values.join(',');
|
||||
console.info(this.form.inspectUserIds, "inspectUserIds")
|
||||
},
|
||||
// 切换选中范围
|
||||
handleChangeStandArea(e) {
|
||||
console.info(e,'eee')
|
||||
this.form.standArea = this.standOptions[e.detail.value];
|
||||
},
|
||||
handleChangeRadio(e, item) {
|
||||
item.isRequired = e;
|
||||
},
|
||||
handleJumpMap() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/projectEnd/InspectionRoute/mapLocatoin/mapLocatoin?standArea=${this.form.standArea}&latitude=${this.form.latitude}&longitude=${this.form.longitude}&addr=${this.form.addr}`
|
||||
@ -308,17 +336,28 @@
|
||||
params.createUserId = this.userInfo.userId;
|
||||
params.createUserName = this.userInfo.account;
|
||||
let newDyForm = this.deepClone(this.dyFormData);
|
||||
params.template = JSON.stringify(newDyForm.forEach(item => item.isRequired = item.isRequired == "1" ? true : false));
|
||||
newDyForm.forEach(item => {
|
||||
item.isRequired = item.isRequired == "1" ? true : false
|
||||
})
|
||||
params.template = JSON.stringify(newDyForm);
|
||||
|
||||
let apiUrl = 'xmgl/checkingPoint/add';
|
||||
let msg = "添加成功"
|
||||
|
||||
// 编辑
|
||||
if(this.editId) {
|
||||
apiUrl = "xmgl/checkingPoint/edit"
|
||||
msg = "保存成功";
|
||||
}
|
||||
this.sendRequest({
|
||||
url: 'xmgl/checkingPoint/add',
|
||||
url: apiUrl,
|
||||
method: 'post',
|
||||
data: params,
|
||||
success: res => {
|
||||
console.info(res,'res')
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: '保存成功'
|
||||
title: msg
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.redirectTo({
|
||||
@ -399,21 +438,6 @@
|
||||
return false
|
||||
}
|
||||
return true
|
||||
// checkingPointName: "",
|
||||
// position: "",
|
||||
// qualityRegionId: "", // 区域ID
|
||||
// enterpriseId: "", // 责任企业
|
||||
// inspectUserIds: "", //检查人
|
||||
// noticeUserIds: "", //通知人
|
||||
// startTime: "",
|
||||
// endTime: "",
|
||||
// frequencyType: 1,
|
||||
// frequencyNum: 1,
|
||||
// minInspectTime: undefined,
|
||||
// standArea: 100, //范围
|
||||
// latitude: "", //纬度
|
||||
// longitude: "", //经度
|
||||
// addr: "", //地图区域
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
</view>
|
||||
<view class="btn_wrap">
|
||||
<view class="common_btn primary" @click="handleEdit(item)"><image class="b_ic" src="@/static/icon/edit.svg"></image></view>
|
||||
<view class="common_btn danger"><image class="b_ic" src="@/static/icon/delete.svg"></image></view>
|
||||
<view class="common_btn danger" @click="handleDel(item)"><image class="b_ic" src="@/static/icon/delete.svg"></image></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -208,6 +208,23 @@
|
||||
url: `/pages/projectEnd/InspectionRoute/editInspectionPoint?id=${data.id}`
|
||||
})
|
||||
},
|
||||
handleDel(data) {
|
||||
this.sendRequest({
|
||||
url: 'xmgl/checkingPoint/delete',
|
||||
method: 'get',
|
||||
data:{id: data.id},
|
||||
success: res => {
|
||||
console.info(res,'res')
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: "删除成功"
|
||||
})
|
||||
this.condition.pageNo = 1
|
||||
this.getListData(true)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//搜索
|
||||
loadData(e) {
|
||||
// this.condition.search = e.detail.value
|
||||
|
||||
2
unpackage/dist/dev/app-plus/app-service.js
vendored
2
unpackage/dist/dev/app-plus/app-service.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user