|
|
@ -10,14 +10,14 @@ |
|
|
|
class="form"> |
|
|
|
|
|
|
|
<el-form-item label="单位名称" |
|
|
|
prop="unitName" |
|
|
|
prop="name" |
|
|
|
label-width="150px" |
|
|
|
style="display: block"> |
|
|
|
<el-input class="item_width_1" |
|
|
|
maxlength="50" |
|
|
|
show-word-limit |
|
|
|
placeholder="请输入单位名称" |
|
|
|
v-model="formData.unitName"> |
|
|
|
v-model="formData.name"> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="分类" |
|
|
@ -45,8 +45,8 @@ |
|
|
|
style="display:flex;flex-wrap:wrap" |
|
|
|
v-model="formData.serviceMatterList"> |
|
|
|
<el-checkbox v-for="item in serviceList" |
|
|
|
:key="item.value" |
|
|
|
:label="item.value">{{item.label}}</el-checkbox> |
|
|
|
:key="item.categoryCode" |
|
|
|
:label="item.categoryCode">{{item.categoryName}}</el-checkbox> |
|
|
|
|
|
|
|
</el-checkbox-group> |
|
|
|
|
|
|
@ -69,16 +69,7 @@ |
|
|
|
v-model="formData.contactMobile"> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="在职党员" |
|
|
|
style="display: block" |
|
|
|
prop="memberCount" |
|
|
|
label-width="150px"> |
|
|
|
<el-input-number class="item_width_4" |
|
|
|
v-model="formData.memberCount" |
|
|
|
:min="0" |
|
|
|
:max="9999" |
|
|
|
label="在职党员"></el-input-number> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="备注" |
|
|
|
prop="remark" |
|
|
|
label-width="150px" |
|
|
@ -154,16 +145,15 @@ export default { |
|
|
|
data () { |
|
|
|
let initFormData = () => { |
|
|
|
let _form = { |
|
|
|
unitName: '', |
|
|
|
name: '', |
|
|
|
serviceMatterList: [], |
|
|
|
type: '', |
|
|
|
contact: '', |
|
|
|
contactMobile: '', |
|
|
|
memberCount: 0, |
|
|
|
remark: '', //备注【最大500字】 |
|
|
|
address: '', //详细地址 |
|
|
|
longitude: this.$store.state.user.longitude, //经度 |
|
|
|
latitude: this.$store.state.user.latitude//纬度 |
|
|
|
longitude: this.$store.state.user.longitude, //经度 |
|
|
|
latitude: this.$store.state.user.latitude //纬度 |
|
|
|
} |
|
|
|
|
|
|
|
return _form |
|
|
@ -174,7 +164,7 @@ export default { |
|
|
|
searchValue: '', |
|
|
|
resultList: [], |
|
|
|
loading: false, |
|
|
|
|
|
|
|
serviceMatterListCody:[], |
|
|
|
btnDisable: false, |
|
|
|
|
|
|
|
unitId: '', |
|
|
@ -189,7 +179,8 @@ export default { |
|
|
|
|
|
|
|
// this.initMap() |
|
|
|
}, |
|
|
|
|
|
|
|
watch:{ |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
|
|
|
|
async initForm (type, unitId) { |
|
|
@ -205,8 +196,7 @@ export default { |
|
|
|
this.formType = type |
|
|
|
if (unitId) { |
|
|
|
this.unitId = unitId |
|
|
|
this.formData.id = unitId |
|
|
|
await this.loadFormData() |
|
|
|
await this.getDetail() |
|
|
|
} else { |
|
|
|
this.formData.latitude = latitude |
|
|
|
this.formData.longitude = longitude |
|
|
@ -224,23 +214,44 @@ export default { |
|
|
|
|
|
|
|
//获取服务事项下拉框 |
|
|
|
async loadService () { |
|
|
|
const url = "/heart/serviceitem/dict-list" |
|
|
|
const url = "/heart/serviceitem/dict-options" |
|
|
|
let params = { |
|
|
|
type: 'usable' |
|
|
|
// parentCategoryCode: '1010' |
|
|
|
} |
|
|
|
|
|
|
|
const { data, code, msg } = await requestPost(url, params) |
|
|
|
|
|
|
|
|
|
|
|
if (code === 0) { |
|
|
|
this.serviceList = data |
|
|
|
|
|
|
|
} else { |
|
|
|
this.$message.error(msg) |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
async getDetail () { |
|
|
|
const url = `/heart/icPublicServiceOrg/detail/${this.unitId}` |
|
|
|
|
|
|
|
const { data, code, msg } = await requestPost(url) |
|
|
|
if (code === 0) { |
|
|
|
for(let key in data){ |
|
|
|
if(key == 'serviceMatterList'){ |
|
|
|
let arr =[] |
|
|
|
for(let val of data[key]){ |
|
|
|
arr.push(val.categoryCode) |
|
|
|
} |
|
|
|
this.serviceMatterListCody = arr |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.formData = data |
|
|
|
this.formData.serviceMatterList = this.serviceMatterListCody |
|
|
|
|
|
|
|
} else { |
|
|
|
this.$message.error(msg) |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
//加载组织 |
|
|
|
async loadFormData () { |
|
|
|
const url = '/heart/icpartyunit/detail' |
|
|
@ -252,7 +263,7 @@ export default { |
|
|
|
const { data, code, msg } = await requestPost(url, params) |
|
|
|
|
|
|
|
if (code === 0) { |
|
|
|
if (!data.serviceMatterList || !Array.isArray(data.serviceMatterList)) { |
|
|
|
if (!data.serviceMatterList) { |
|
|
|
data.serviceMatterList = [] |
|
|
|
} |
|
|
|
|
|
|
@ -292,13 +303,27 @@ export default { |
|
|
|
// return false; |
|
|
|
// } |
|
|
|
|
|
|
|
let url = '/heart/icpartyunit/save' |
|
|
|
let url = '/heart/icPublicServiceOrg/save' |
|
|
|
// let url = "http://yapi.elinkservice.cn/mock/245/heart/icpartyunit/save" |
|
|
|
// if (this.formType === 'edit') { |
|
|
|
// this.formData.id = this.unitId |
|
|
|
// } |
|
|
|
|
|
|
|
const { data, code, msg } = await requestPost(url, this.formData) |
|
|
|
if (this.formType === 'edit') { |
|
|
|
this.formData.id = this.unitId |
|
|
|
url = '/heart/icPublicServiceOrg/update' |
|
|
|
} |
|
|
|
if(this.formData.serviceMatterList.length>0){ |
|
|
|
let arr = [] |
|
|
|
for( let code of this.formData.serviceMatterList){ |
|
|
|
this.serviceList.forEach(item=>{ |
|
|
|
if( item.categoryCode == code){ |
|
|
|
arr.push({categoryCode:item.categoryCode,categoryId:item.categoryId}) |
|
|
|
} |
|
|
|
return arr |
|
|
|
}) |
|
|
|
} |
|
|
|
this.formData.serviceMatterList = arr |
|
|
|
this.formData.latitude = this.formData.latitude.toString() |
|
|
|
this.formData.longitude = this.formData.longitude.toString() |
|
|
|
} |
|
|
|
const { data, code, msg } = await requestPost(url,this.formData) |
|
|
|
|
|
|
|
if (code === 0) { |
|
|
|
this.$message({ |
|
|
@ -321,7 +346,6 @@ export default { |
|
|
|
this.$emit('dialogCancle') |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 地图初始化函数,本例取名为init,开发者可根据实际情况定义 |
|
|
|
initMap (latitude, longitude) { |
|
|
|
|
|
|
@ -415,12 +439,11 @@ export default { |
|
|
|
this.unitId = '' |
|
|
|
this.keyWords = '' |
|
|
|
this.formData = { |
|
|
|
unitName: '', |
|
|
|
name: '', |
|
|
|
serviceMatterList: [], |
|
|
|
type: '', |
|
|
|
contact: '', |
|
|
|
contactMobile: '', |
|
|
|
memberCount: 0, |
|
|
|
remark: '', //备注【最大500字】 |
|
|
|
address: '', //详细地址 |
|
|
|
longitude: this.$store.state.user.longitude, //经度 |
|
|
@ -447,7 +470,7 @@ export default { |
|
|
|
dataRule () { |
|
|
|
return { |
|
|
|
|
|
|
|
unitName: [ |
|
|
|
name: [ |
|
|
|
{ required: true, message: '单位名称不能为空', trigger: 'blur' }, |
|
|
|
], |
|
|
|
type: [ |
|
|
@ -460,9 +483,6 @@ export default { |
|
|
|
contactMobile: [ |
|
|
|
{ required: true, message: '联系电话不能为空', trigger: 'blur' } |
|
|
|
], |
|
|
|
memberCount: [ |
|
|
|
{ required: true, message: '在职党员数不能为空', trigger: 'blur' } |
|
|
|
], |
|
|
|
address: [ |
|
|
|
{ required: true, message: '详细地址不能为空', trigger: 'blur' } |
|
|
|
], |
|
|
@ -479,7 +499,7 @@ export default { |
|
|
|
type: Array, |
|
|
|
default: [] |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|