|
|
@ -90,10 +90,11 @@ |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item |
|
|
|
label="查找享受服务人员" |
|
|
|
label="查找有该需求人员" |
|
|
|
prop="resiSearchTagId" |
|
|
|
:class="{ 'form-item': source === 'visiual' }" |
|
|
|
label-width="150px" |
|
|
|
:required="true" |
|
|
|
style="display: block" |
|
|
|
> |
|
|
|
<template v-if="formData.resiSearchTagName"> |
|
|
@ -107,25 +108,19 @@ |
|
|
|
</el-button> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="指派服务" label-width="150px"> |
|
|
|
<el-switch |
|
|
|
v-model="formData.assignFlag" |
|
|
|
@change="handelDisabledRules" |
|
|
|
> |
|
|
|
</el-switch> |
|
|
|
<el-switch v-model="formData.assignFlag"> </el-switch> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</el-form> |
|
|
|
<el-form :model="newFormData" :rules="newDataRule" ref="ref_gxxq_form1"> |
|
|
|
<el-form-item |
|
|
|
v-if="formData.assignFlag" |
|
|
|
label="服务方" |
|
|
|
label-width="150px" |
|
|
|
style="display: block" |
|
|
|
v-show="formData.assignFlag" |
|
|
|
prop="serverOrgId" |
|
|
|
> |
|
|
|
<!-- 表单验证是有的但是没有红色*先手写加上吧 --> |
|
|
|
<!-- <el-form-label class="form_label_box"> |
|
|
|
<span class="verifyRed">服务方 : </span> |
|
|
|
</el-form-label> --> |
|
|
|
<el-select |
|
|
|
v-model="formData.assignInfo.serverOrgType" |
|
|
|
v-model="newFormData.serverOrgType" |
|
|
|
class="input-width-small" |
|
|
|
placeholder="请选择" |
|
|
|
clearable |
|
|
@ -141,7 +136,7 @@ |
|
|
|
</el-select> |
|
|
|
- |
|
|
|
<el-select |
|
|
|
v-model="formData.assignInfo.serverOrgId" |
|
|
|
v-model="newFormData.serverOrgId" |
|
|
|
class="input-width-middle" |
|
|
|
filterable |
|
|
|
placeholder="请选择" |
|
|
@ -157,31 +152,29 @@ |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item |
|
|
|
v-if="formData.assignFlag" |
|
|
|
prop="noticeApproches" |
|
|
|
label="自动通知服务方" |
|
|
|
label-width="150px" |
|
|
|
style="display: block" |
|
|
|
v-show="formData.assignFlag" |
|
|
|
> |
|
|
|
<el-checkbox-group v-model="formData.assignInfo.noticeApproches"> |
|
|
|
<el-checkbox label="1">短信通知</el-checkbox> |
|
|
|
<el-checkbox label="2">微信公众号消息通知</el-checkbox> |
|
|
|
<el-checkbox-group v-model="newFormData.noticeApproches"> |
|
|
|
<el-checkbox label="1" value="1">短信通知</el-checkbox> |
|
|
|
<el-checkbox label="2" value="2">微信公众号消息通知</el-checkbox> |
|
|
|
</el-checkbox-group> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item |
|
|
|
v-if="formData.assignFlag" |
|
|
|
label="服务范围" |
|
|
|
label-width="150px" |
|
|
|
prop="serviceScopeList" |
|
|
|
style="display: block" |
|
|
|
v-show="formData.assignFlag" |
|
|
|
prop="serviceScopeList" |
|
|
|
> |
|
|
|
<!-- <el-form-label class="form_label_box"> |
|
|
|
<span class="verifyRed">服务范围 :</span> |
|
|
|
</el-form-label> --> |
|
|
|
<el-cascader |
|
|
|
class="item_width_1" |
|
|
|
ref="myCascader" |
|
|
|
v-model="scopeIdArray" |
|
|
|
v-model="newFormData.serviceScopeList" |
|
|
|
:key="iscascaderShow" |
|
|
|
:options="casOptions" |
|
|
|
:props="optionProps" |
|
|
@ -191,14 +184,14 @@ |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item |
|
|
|
label="服务范围" |
|
|
|
v-if="formData.assignFlag" |
|
|
|
label="服务时间" |
|
|
|
label-width="150px" |
|
|
|
prop="serviceTimeStart" |
|
|
|
v-show="formData.assignFlag" |
|
|
|
prop="serviceTimeEnd" |
|
|
|
> |
|
|
|
<!-- :picker-options="startPickerOptions" --> |
|
|
|
<el-date-picker |
|
|
|
v-model="formData.assignInfo.serviceTimeStart" |
|
|
|
v-model="newFormData.serviceTimeStart" |
|
|
|
class="item_width_2" |
|
|
|
style="width: 220px" |
|
|
|
type="date" |
|
|
@ -210,7 +203,7 @@ |
|
|
|
<!-- :picker-options="endPickerOptions" --> |
|
|
|
<span class="u-data-tag">至</span> |
|
|
|
<el-date-picker |
|
|
|
v-model="formData.assignInfo.serviceTimeEnd" |
|
|
|
v-model="newFormData.serviceTimeEnd" |
|
|
|
class="item_width_2 u-data-tag" |
|
|
|
style="width: 220px" |
|
|
|
type="date" |
|
|
@ -248,7 +241,6 @@ |
|
|
|
> |
|
|
|
<label-form |
|
|
|
ref="ref_label_form" |
|
|
|
:ruleList="ruleList" |
|
|
|
@dialogCancle="addFormCancle" |
|
|
|
@dialogOk="addFormOk" |
|
|
|
> |
|
|
@ -286,11 +278,6 @@ export default { |
|
|
|
required: false, |
|
|
|
default: "", |
|
|
|
}, |
|
|
|
formType: { |
|
|
|
//表单操作类型 add新增,edit编辑,detail详情,feedback反馈 |
|
|
|
type: String, |
|
|
|
required: "", |
|
|
|
}, |
|
|
|
categrayArray: { |
|
|
|
type: Array, |
|
|
|
default() { |
|
|
@ -330,7 +317,7 @@ export default { |
|
|
|
// 公共服务分类 |
|
|
|
serviceTypesLevel1: [], |
|
|
|
serviceTypesLevel2: [], |
|
|
|
|
|
|
|
formType: "", |
|
|
|
btnDisable: false, |
|
|
|
casOptions: [], |
|
|
|
scopeIdArray: [], |
|
|
@ -344,8 +331,7 @@ export default { |
|
|
|
checkStrictly: true, |
|
|
|
emitPath: false, |
|
|
|
}, |
|
|
|
|
|
|
|
keyWords: "", |
|
|
|
newArr: [], |
|
|
|
formData: { |
|
|
|
serviceTypeLevel1Id: "", // 公共服务(政策级别)一级分类id |
|
|
|
commonServiceTypeId: "", // 公共服务(政策级别)二级分类id |
|
|
@ -353,53 +339,50 @@ export default { |
|
|
|
resiSearchTagId: "", //查找享受服务人员 |
|
|
|
resiSearchTagName: "", //享受服务人员名称 |
|
|
|
title: "", //服务名称 |
|
|
|
assignInfo: { |
|
|
|
noticeApproches: [], |
|
|
|
serviceScopeList: [], // |
|
|
|
serviceTimeStart: "", //服务起始时间yyyy-MM-dd |
|
|
|
serviceTimeEnd: "", //服务截止时间yyyy-MM-dd |
|
|
|
serverOrgType: "", //服务组织类型 社区自组织:community_org, 志愿者:ic_user_volunteer, 联建单位:party_unit |
|
|
|
serverOrgId: "", //服务组织Id |
|
|
|
}, |
|
|
|
assignInfo: {}, |
|
|
|
content: "", // |
|
|
|
}, |
|
|
|
newFormData: { |
|
|
|
noticeApproches: [], |
|
|
|
serviceScopeList: [], // |
|
|
|
serviceTimeStart: "", //服务起始时间yyyy-MM-dd |
|
|
|
serviceTimeEnd: "", //服务截止时间yyyy-MM-dd |
|
|
|
serverOrgType: "", //服务组织类型 社区自组织:community_org, 志愿者:ic_user_volunteer, 联建单位:party_unit |
|
|
|
serverOrgId: "", //服务组织Id |
|
|
|
}, |
|
|
|
dataRule: { |
|
|
|
commonServiceTypeId: [ |
|
|
|
{ required: true, message: "政策类型不能为空", trigger: "change" }, |
|
|
|
{ required: true, message: "需求类别不能为空", trigger: "bulr" }, |
|
|
|
], |
|
|
|
title: [ |
|
|
|
{ required: true, message: "服务名称不能为空", trigger: "change" }, |
|
|
|
{ required: true, message: "服务名称不能为空", trigger: "bulr" }, |
|
|
|
], |
|
|
|
|
|
|
|
// serviceTimeStart: [ |
|
|
|
// { required: true, message: "服务时间不能为空", trigger: "change" }, |
|
|
|
// ], |
|
|
|
// serviceScopeList : [ |
|
|
|
// { required: true, message: "服务范围不能为空", trigger: "change" }, |
|
|
|
// ], |
|
|
|
resiSearchTagId: [ |
|
|
|
{ required: true, message: "符合条件人员不能为空", trigger: "bulr" }, |
|
|
|
], |
|
|
|
}, |
|
|
|
|
|
|
|
// endPickerOptions: { |
|
|
|
// disabledDate: endDisabledDate, |
|
|
|
// }, |
|
|
|
// startPickerOptions: { |
|
|
|
// disabledDate: startDisabledDate, |
|
|
|
// }, |
|
|
|
|
|
|
|
newDataRule: { |
|
|
|
serverOrgId: [ |
|
|
|
{ required: true, message: "服务方不能为空", trigger: "bulr" }, |
|
|
|
], |
|
|
|
serviceScopeList: [ |
|
|
|
{ required: true, message: "服务范围不能为空", trigger: "bulr" }, |
|
|
|
], |
|
|
|
serviceTimeEnd: [ |
|
|
|
{ required: true, message: "服务时间不能为空", trigger: "bulr" }, |
|
|
|
], |
|
|
|
}, |
|
|
|
sarr: [], |
|
|
|
scopeId: "", |
|
|
|
serviceOptions: [], |
|
|
|
serviceOptiondList: [], |
|
|
|
policyList: [], |
|
|
|
|
|
|
|
fileList: [], |
|
|
|
uploadUlr: window.SITE_CONFIG["apiURL"] + "/oss/file/uploadvariedfile", |
|
|
|
ruleList: [], |
|
|
|
|
|
|
|
showLabelForm: false, |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
|
computed: {}, |
|
|
|
|
|
|
|
watch: { |
|
|
|
"formData.serviceTimeEnd": function (val) { |
|
|
|
if (val && val != "") { |
|
|
@ -410,20 +393,15 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
components: { personList, labelForm }, |
|
|
|
|
|
|
|
created() {}, |
|
|
|
async mounted() { |
|
|
|
this.startLoading(); |
|
|
|
// 都已经重置了,还放在prop里干嘛,我不理解 |
|
|
|
// this.getCategrayList(); |
|
|
|
this.getDictOptions(); |
|
|
|
this.getPolicyList(); |
|
|
|
|
|
|
|
if (this.formType === "add") { |
|
|
|
await this.loadScopeTree(); |
|
|
|
} else { |
|
|
|
} |
|
|
|
|
|
|
|
await this.iniDefaultData(); |
|
|
|
await this.getPolicyList(); |
|
|
|
await this.loadScopeTree(); |
|
|
|
await this.getDictOptions(); |
|
|
|
await this.endLoading(); |
|
|
|
|
|
|
|
this.endLoading(); |
|
|
|
// 服务分类下拉(其实是获取的共性服务分类) |
|
|
@ -434,7 +412,6 @@ export default { |
|
|
|
return this.$message.error(res.msg); |
|
|
|
} else { |
|
|
|
this.serviceTypesLevel1 = res.data; |
|
|
|
console.log(res.data); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
@ -443,47 +420,67 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
handelDisabledRules(v) { |
|
|
|
// if (!v) { |
|
|
|
// delete this.dataRule.resiSearchTagId,this.dataRule.serviceTimeStart,this.dataRule.serviceScopeList; |
|
|
|
// } else { |
|
|
|
// var serviceOrgId = [ |
|
|
|
// { required: true, message: "服务组织不能为空", trigger: "change" }, |
|
|
|
// ]; |
|
|
|
// var serviceTimeStart = [ |
|
|
|
// { required: true, message: "服务时间不能为空", trigger: "change" }, |
|
|
|
// ]; |
|
|
|
// var serviceScopeList = [ |
|
|
|
// { required: true, message: "服务范围不能为空", trigger: "change" }, |
|
|
|
// ]; |
|
|
|
// this.dataRule.serviceOrgId = serviceOrgId; |
|
|
|
// this.dataRule.serviceTimeStart = serviceTimeStart; |
|
|
|
// this.dataRule.serviceScopeList = serviceScopeList; |
|
|
|
// } |
|
|
|
if (v) { |
|
|
|
this.addRules(); |
|
|
|
async initForm(type, row) { |
|
|
|
this.formType = type; |
|
|
|
this.scopeId = row.id; |
|
|
|
await this.getDetail(row.id); |
|
|
|
}, |
|
|
|
async getDetail(id) { |
|
|
|
const url = `/governance/commonDemand/detail/${id}`; |
|
|
|
const { data, code, msg } = await requestGet(url); |
|
|
|
|
|
|
|
if (code === 0) { |
|
|
|
this.formData.serviceTypeLevel1Id = data.servicePid; |
|
|
|
this.formData.commonServiceTypeId = data.commonServiceTypeId; |
|
|
|
this.formData.title = data.title; |
|
|
|
this.formData.content = data.content; |
|
|
|
this.formData.resiSearchTagId = data.resiSearchTagId; |
|
|
|
this.newFormData.serviceTimeStart = data.assignInfo.serviceTimeStart; |
|
|
|
this.newFormData.serviceTimeEnd = data.assignInfo.serviceTimeEnd; |
|
|
|
this.newFormData.serverOrgType = data.assignInfo.serverOrgType; |
|
|
|
this.newFormData.serverOrgId = data.assignInfo.serverOrgId; |
|
|
|
this.newFormData.noticeApproches = data.assignInfo.noticeApproches; |
|
|
|
if (data.assignFlag == 1) { |
|
|
|
this.formData.assignFlag = true; |
|
|
|
} else { |
|
|
|
this.formData.assignFlag = false; |
|
|
|
} |
|
|
|
for (let i in data.assignInfo.serviceScopeList) { |
|
|
|
this.newFormData.serviceScopeList.push( |
|
|
|
data.assignInfo.serviceScopeList[i].objectId |
|
|
|
); |
|
|
|
} |
|
|
|
await this.handleChangeServiceTypeLevel1(); |
|
|
|
await this.getServiceuserList(data.assignInfo.serverOrgType); |
|
|
|
await // this.formData = { ...data }; |
|
|
|
|
|
|
|
await this.getTagName(); |
|
|
|
} else { |
|
|
|
this.romoveRules(); |
|
|
|
this.$message.error(msg); |
|
|
|
} |
|
|
|
console.log(this.dataRule); |
|
|
|
}, |
|
|
|
addRules() { |
|
|
|
const newRules = [ |
|
|
|
{ required: true, trigger: "change", message: "服务组织不能为空" }, |
|
|
|
]; |
|
|
|
// 给rules对象添加规则 |
|
|
|
let arr = [ |
|
|
|
{ required: true, trigger: "change", message: "服务组织不能为空" }, |
|
|
|
]; |
|
|
|
this.dataRule = { ...this.dataRule, serviceOrgId: newRules }; |
|
|
|
}, |
|
|
|
romoveRules() { |
|
|
|
this.$refs.ref_gxxq_form.clearValidate(["serviceOrgId"]); |
|
|
|
this.rules = { ...this.rules, serviceOrgId: [] }; |
|
|
|
async getTagName() { |
|
|
|
const url = "/governance/resiSearchTag/listResiSearchTags"; |
|
|
|
let params = { |
|
|
|
pageSize: 99, |
|
|
|
}; |
|
|
|
let { data, msg, code } = await requestPost(url, params); |
|
|
|
if (code == 0) { |
|
|
|
let showAddProduct = data.list.filter((item) => { |
|
|
|
return [this.formData.resiSearchTagId].includes(item.tagId); |
|
|
|
}); |
|
|
|
if (this.formData.resiSearchTagId) { |
|
|
|
this.formData.resiSearchTagName = showAddProduct[0].tagName; |
|
|
|
} else { |
|
|
|
this.formData.resiSearchTagName = "--"; |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.$message.error(msg); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 服务类型下拉框选中事件 |
|
|
|
handleChangeServiceTypeLevel1() { |
|
|
|
this.formData.commonServiceTypeId = ""; |
|
|
|
// this.formData.commonServiceTypeId = ""; |
|
|
|
this.$http |
|
|
|
.get( |
|
|
|
"/governance/commonServiceType/selectList/" + |
|
|
@ -500,10 +497,8 @@ export default { |
|
|
|
return this.$message.error("网络错误"); |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 如果服务方有选择第一个的话让它更新一下 |
|
|
|
// 如果服务方有选择第一个的话让它更新 |
|
|
|
handleChangeServiceTypeLevel2() { |
|
|
|
console.log(this.formData.serviceTypeLevel1Id); |
|
|
|
console.log(this.formData.commonServiceTypeId); |
|
|
|
if (this.formData.assignInfo.serviceOrgType) { |
|
|
|
this.getServiceuserList(this.formData.assignInfo.serviceOrgType); |
|
|
|
} else { |
|
|
@ -580,10 +575,7 @@ export default { |
|
|
|
|
|
|
|
async handleServiceChange(type, val) { |
|
|
|
console.log(val); |
|
|
|
if (val === "social_org") { |
|
|
|
if (type === "add") await this.getServiceuserList(val); |
|
|
|
else this.getServiceuserList(val); |
|
|
|
} else this.getServiceuserList(val); |
|
|
|
await this.getServiceuserList(val); |
|
|
|
}, |
|
|
|
|
|
|
|
async getServiceuserList(serverOrgType) { |
|
|
@ -625,41 +617,64 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
handleChangeScope(value) { |
|
|
|
this.formData.assignInfo.serviceScopeList = []; |
|
|
|
let selArray = this.$refs["myCascader"].getCheckedNodes(); |
|
|
|
console.log("handleChangeScope", selArray); |
|
|
|
selArray.forEach((element) => { |
|
|
|
let obj = { |
|
|
|
objectType: |
|
|
|
element.data.objectType === "grid" |
|
|
|
? "grid" |
|
|
|
: element.data.objectType === "neighborhood" |
|
|
|
? "neighborhood" |
|
|
|
: "agency", |
|
|
|
objectId: element.data.objectId, |
|
|
|
objectName: element.data.objectName, |
|
|
|
}; |
|
|
|
this.formData.assignInfo.serviceScopeList.push(obj); |
|
|
|
}); |
|
|
|
// this.newFormData.serviceScopeList = []; |
|
|
|
// let selArray = this.$refs["myCascader"].getCheckedNodes(); |
|
|
|
// console.log("handleChangeScope", selArray); |
|
|
|
// selArray.forEach((element) => { |
|
|
|
// let obj = { |
|
|
|
// objectType: |
|
|
|
// element.data.objectType === "grid" |
|
|
|
// ? "grid" |
|
|
|
// : element.data.objectType === "neighborhood" |
|
|
|
// ? "neighborhood" |
|
|
|
// : "agency", |
|
|
|
// objectId: element.data.objectId, |
|
|
|
// objectName: element.data.objectName, |
|
|
|
// }; |
|
|
|
// this.newFormData.serviceScopeList.push(obj); |
|
|
|
// }); |
|
|
|
}, |
|
|
|
|
|
|
|
async handleComfirm() { |
|
|
|
if (this.formType === "add") { |
|
|
|
this.handleAdd(); |
|
|
|
} else if (this.formType === "feedback") { |
|
|
|
this.handleAdd(); |
|
|
|
}, |
|
|
|
// |
|
|
|
getLastItem(list, vals, key) { |
|
|
|
let LIST = list || []; |
|
|
|
for (let item of LIST) { |
|
|
|
// console.log(item[key]); |
|
|
|
for (let i of vals) { |
|
|
|
if (item[key] === i) { |
|
|
|
console.log(item[key]); |
|
|
|
this.sarr.push(item); |
|
|
|
} else if (item["objectType"] == "district") { |
|
|
|
this.getLastItem(item.children, vals, key); |
|
|
|
} else { |
|
|
|
this.getLastItem(item.children, vals, key); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
async handleAdd() { |
|
|
|
this.btnDisable = true; |
|
|
|
setTimeout(() => { |
|
|
|
this.btnDisable = false; |
|
|
|
}, 10000); |
|
|
|
this.$refs["ref_gxxq_form"].validate((valid, messageObj) => { |
|
|
|
if (!valid) { |
|
|
|
app.util.validateRule(messageObj); |
|
|
|
this.btnDisable = false; |
|
|
|
} else { |
|
|
|
nextTick(1000); |
|
|
|
|
|
|
|
const form = new Promise((resolve, reject) => { |
|
|
|
this.$refs["ref_gxxq_form"].validate((valid) => { |
|
|
|
if (valid) resolve(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
const form1 = new Promise((resolve, reject) => { |
|
|
|
this.$refs["ref_gxxq_form1"].validate((valid) => { |
|
|
|
if (valid) resolve(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
Promise.all([form1, form]) |
|
|
|
.then(() => { |
|
|
|
var oDate1 = new Date(this.formData.serviceTimeStart); |
|
|
|
var oDate2 = new Date(this.formData.serviceTimeEnd); |
|
|
|
if (oDate1.getTime() > oDate2.getTime()) { |
|
|
@ -667,33 +682,82 @@ export default { |
|
|
|
return false; |
|
|
|
} |
|
|
|
this.addFuwu(); |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
app.util.validateRule(messageObj); |
|
|
|
this.btnDisable = false; |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
async addFuwu() { |
|
|
|
// 指派服务绑定0或1 |
|
|
|
if (this.formData.assignFlag) { |
|
|
|
this.formData.assignFlag = 1; |
|
|
|
} else { |
|
|
|
this.formData.assignFlag = 0; |
|
|
|
} |
|
|
|
const url = "/governance/commonDemand/save"; |
|
|
|
// const url = 'http://yapi.elinkservice.cn/mock/245/governance/icServiceProject/service/initiate' |
|
|
|
let params = { |
|
|
|
title: this.formData.title, |
|
|
|
content: this.formData.content, |
|
|
|
commonServiceTypeId: this.formData.commonServiceTypeId, |
|
|
|
resiSearchTagId: this.formData.resiSearchTagId, |
|
|
|
assignFlag: this.formData.assignFlag, |
|
|
|
assignInfo: this.formData.assignInfo, |
|
|
|
}; |
|
|
|
// 通知服务方方式,如果都没有选中传数组字符串'0' |
|
|
|
if (this.newFormData.noticeApproches.length == 0) { |
|
|
|
this.newFormData.noticeApproches.push(0); |
|
|
|
} |
|
|
|
// 使用递归找出符合条件的数据需要 |
|
|
|
const map = new Map(); |
|
|
|
this.getLastItem( |
|
|
|
this.casOptions, |
|
|
|
this.newFormData.serviceScopeList, |
|
|
|
"objectId" |
|
|
|
); |
|
|
|
//递归出的数据会有重复,因为一个街道下面有两个社区的话就会循环push两遍,在这里去重 |
|
|
|
this.newArr = this.sarr.filter( |
|
|
|
(v) => !map.has(v.objectId) && map.set(v.objectId, 1) |
|
|
|
); |
|
|
|
for (let i in this.newArr) { |
|
|
|
this.newFormData.serviceScopeList.push({ |
|
|
|
objectId: this.newArr[i].objectId, |
|
|
|
objectType: this.newArr[i].objectType, |
|
|
|
objectName: this.newArr[i].objectName, |
|
|
|
}); |
|
|
|
} |
|
|
|
// 如果是编辑的话回填的数据会有需要将不是对象属性的过滤掉 |
|
|
|
let arr = []; |
|
|
|
this.newFormData.serviceScopeList.forEach((item) => { |
|
|
|
if (typeof item != "string") { |
|
|
|
arr.push(item); |
|
|
|
} |
|
|
|
}); |
|
|
|
this.newFormData.serviceScopeList = arr; |
|
|
|
var url = ""; |
|
|
|
var params = {}; |
|
|
|
if (this.formType == "edit") { |
|
|
|
url = "/governance/commonDemand/update"; |
|
|
|
params = { |
|
|
|
title: this.formData.title, |
|
|
|
content: this.formData.content, |
|
|
|
commonServiceTypeId: this.formData.commonServiceTypeId, |
|
|
|
resiSearchTagId: this.formData.resiSearchTagId, |
|
|
|
assignFlag: this.formData.assignFlag, |
|
|
|
assignInfo: this.newFormData, |
|
|
|
id: this.scopeId, |
|
|
|
}; |
|
|
|
} else { |
|
|
|
url = "/governance/commonDemand/save"; |
|
|
|
params = { |
|
|
|
title: this.formData.title, |
|
|
|
content: this.formData.content, |
|
|
|
commonServiceTypeId: this.formData.commonServiceTypeId, |
|
|
|
resiSearchTagId: this.formData.resiSearchTagId, |
|
|
|
assignFlag: this.formData.assignFlag, |
|
|
|
assignInfo: this.newFormData, |
|
|
|
}; |
|
|
|
} |
|
|
|
// const url = 'http://yapi.elinkservice.cn/mock/245/governance/icServiceProject/service/initiate' |
|
|
|
console.log(params); |
|
|
|
const { data, code, msg } = await requestPost(url, params); |
|
|
|
|
|
|
|
if (code === 0) { |
|
|
|
this.$message.success("添加成功"); |
|
|
|
this.resetData(); |
|
|
|
this.$emit("handleOk"); |
|
|
|
this.$emit("handleComfirm"); |
|
|
|
} else { |
|
|
|
this.$message.error(msg); |
|
|
|
} |
|
|
|