巡检点编辑
This commit is contained in:
parent
056f955e5c
commit
ba745a36d2
@ -78,9 +78,9 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="c_body">
|
<view class="c_body">
|
||||||
<input class="c_input" v-model="item.value" :placeholder="`请输入${item.title}`" />
|
<input class="c_input" v-model="item.value" :placeholder="`请输入${item.title}`" />
|
||||||
<radio-group>
|
<radio-group @change="((e) => handleChangeRadio(e.detail.value, item))">
|
||||||
<radio style="margin-right: 12rpx;" value="1" :checked="item.isRequired">必填</radio>
|
<radio style="margin-right: 12rpx;" value="1" :checked="item.isRequired == '1'">必填</radio>
|
||||||
<radio value="2" :checked="!item.isRequired">非必填</radio>
|
<radio value="2" :checked="item.isRequired == '2'">非必填</radio>
|
||||||
</radio-group>
|
</radio-group>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -131,7 +131,12 @@
|
|||||||
longitude: "", //经度
|
longitude: "", //经度
|
||||||
addr: "", //地图区域
|
addr: "", //地图区域
|
||||||
},
|
},
|
||||||
dyFormData: []
|
dyFormData: [{
|
||||||
|
title: "表单标题",
|
||||||
|
name: "",
|
||||||
|
isRequired: "1",
|
||||||
|
value: "",
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async onLoad(option) {
|
async onLoad(option) {
|
||||||
@ -148,22 +153,16 @@
|
|||||||
this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
|
this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
|
||||||
|
|
||||||
this.editId = ""
|
this.editId = ""
|
||||||
await this.getPointAreaFn();
|
|
||||||
// 编辑
|
// 编辑
|
||||||
if(option.id) {
|
if(option.id) {
|
||||||
this.editId = option.id;
|
this.editId = option.id;
|
||||||
// await this.getData()
|
await this.getPointAreaFn();
|
||||||
|
await this.getData()
|
||||||
} else {
|
} else {
|
||||||
|
await this.getPointAreaFn();
|
||||||
this.mapGetLocation();
|
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() {
|
mounted() {
|
||||||
var that = this
|
var that = this
|
||||||
@ -175,45 +174,74 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log('this.mobileTopHeight',this.mobileTopHeight)
|
console.log('this.mobileTopHeight',this.mobileTopHeight)
|
||||||
|
|
||||||
this.dyFormData.splice(0);
|
|
||||||
this.dyFormData.push({
|
|
||||||
title: "表单标题",
|
|
||||||
name: "",
|
|
||||||
isRequired: "1",
|
|
||||||
value: "",
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 编辑回显
|
||||||
getData() {
|
getData() {
|
||||||
this.sendRequest({
|
new Promise((resolve, reject) => {
|
||||||
url: 'xmgl/checkingPoint/queryById',
|
console.info("getData", new Date().getTime())
|
||||||
method: 'get',
|
this.sendRequest({
|
||||||
data: {
|
url: 'xmgl/checkingPoint/queryById',
|
||||||
id: this.editId
|
method: 'get',
|
||||||
},
|
data: {
|
||||||
success: (res) => {
|
id: this.editId
|
||||||
if(res.code === 200) {
|
},
|
||||||
this.form = res.result
|
success: (res) => {
|
||||||
console.info(this.pointAreaList.find(item => item.id === this.form.qualityRegionId))
|
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() {
|
getPointAreaFn() {
|
||||||
let requestData = {
|
new Promise((resolve, reject) => {
|
||||||
projectSn: this.projectSn,
|
console.info("getPointAreaFn", new Date().getTime())
|
||||||
};
|
let requestData = {
|
||||||
this.sendRequest({
|
projectSn: this.projectSn,
|
||||||
url: 'xmgl/qualityRegion/notTreeList',
|
};
|
||||||
method: 'post',
|
this.sendRequest({
|
||||||
data: requestData,
|
url: 'xmgl/qualityRegion/notTreeList',
|
||||||
success: (res) => {
|
method: 'post',
|
||||||
console.log(res);
|
data: requestData,
|
||||||
this.pointAreaList = res.result;
|
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) {
|
handleChangeEnterprise(e,values,labels) {
|
||||||
console.info(e, 'eee', this.form.enterpriseId, values, labels)
|
|
||||||
this.form.enterpriseId = values.join(',');
|
this.form.enterpriseId = values.join(',');
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if(this.form.enterpriseId) {
|
if(this.form.enterpriseId) {
|
||||||
@ -252,15 +279,16 @@
|
|||||||
},
|
},
|
||||||
// 切换责任人
|
// 切换责任人
|
||||||
handleChangeCharger(e,values,labels) {
|
handleChangeCharger(e,values,labels) {
|
||||||
console.info(e, 'eeeee')
|
|
||||||
this.form.inspectUserIds = values.join(',');
|
this.form.inspectUserIds = values.join(',');
|
||||||
console.info(this.form.inspectUserIds, "inspectUserIds")
|
|
||||||
},
|
},
|
||||||
// 切换选中范围
|
// 切换选中范围
|
||||||
handleChangeStandArea(e) {
|
handleChangeStandArea(e) {
|
||||||
console.info(e,'eee')
|
console.info(e,'eee')
|
||||||
this.form.standArea = this.standOptions[e.detail.value];
|
this.form.standArea = this.standOptions[e.detail.value];
|
||||||
},
|
},
|
||||||
|
handleChangeRadio(e, item) {
|
||||||
|
item.isRequired = e;
|
||||||
|
},
|
||||||
handleJumpMap() {
|
handleJumpMap() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/projectEnd/InspectionRoute/mapLocatoin/mapLocatoin?standArea=${this.form.standArea}&latitude=${this.form.latitude}&longitude=${this.form.longitude}&addr=${this.form.addr}`
|
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.createUserId = this.userInfo.userId;
|
||||||
params.createUserName = this.userInfo.account;
|
params.createUserName = this.userInfo.account;
|
||||||
let newDyForm = this.deepClone(this.dyFormData);
|
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({
|
this.sendRequest({
|
||||||
url: 'xmgl/checkingPoint/add',
|
url: apiUrl,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params,
|
data: params,
|
||||||
success: res => {
|
success: res => {
|
||||||
console.info(res,'res')
|
console.info(res,'res')
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '保存成功'
|
title: msg
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
@ -399,21 +438,6 @@
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
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>
|
||||||
<view class="btn_wrap">
|
<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 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>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -208,6 +208,23 @@
|
|||||||
url: `/pages/projectEnd/InspectionRoute/editInspectionPoint?id=${data.id}`
|
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) {
|
loadData(e) {
|
||||||
// this.condition.search = e.detail.value
|
// 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