Browse Source

优化党组织

shibei_master
zhaoyongnian 3 years ago
parent
commit
b63b19d03e
  1. 97
      src/views/modules/partymember/icpartyorg-add-or-update.vue

97
src/views/modules/partymember/icpartyorg-add-or-update.vue

@ -7,8 +7,8 @@
ref="dataForm"
@keyup.enter.native="dataFormSubmitHandle()"
:label-width="$i18n.locale === 'en-US' ? '120px' : '100px'">
<el-form-item prop="partyOrgType" label="组织类型">
<el-select v-model="dataForm.partyOrgType" @change="changePartyOrgType" clearable placeholder="请选择组织类型">
<el-form-item prop="partyOrgType" label="组织类型">
<el-select :disabled="dataForm.id ? true : false" v-model="dataForm.partyOrgType" @change="changePartyOrgType" clearable placeholder="请选择组织类型">
<el-option
v-for="item in partyOrgTypeList"
:key="item.value"
@ -17,28 +17,29 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="partyOrgName" label="组织名称">
<el-input v-model="dataForm.partyOrgName" placeholder="请输入组织名称" style="width:300px"></el-input>
<el-form-item prop="partyOrgName" label="组织名称">
<el-input v-model="dataForm.partyOrgName" placeholder="请输入组织名称" style="width:300px"></el-input>
</el-form-item>
<el-form-item label="组织编码" prop="partyOrgCode">
<el-input v-model="dataForm.partyOrgCode" placeholder="组织编码" style="width:300px"></el-input>
<el-form-item label="组织编码" prop="partyOrgCode">
<el-input v-model="dataForm.partyOrgCode" placeholder="组织编码" style="width:300px"></el-input>
</el-form-item>
<el-form-item v-if="dataForm.partyOrgType != '5'" prop="maSelectAgency" label="行政组织">
<el-form-item v-if="dataForm.partyOrgType != '5'" prop="agencyId" label="行政组织">
<el-cascader
style="width:300px"
v-model="dataForm.maSelectAgency"
v-model="dataForm.agencyId"
:options="agencyOrgList"
placeholder="请选择行政组织"
:props="{ checkStrictly: true, label: 'name', value: 'id', children: 'children' }"
@change="handleChangeAgency"
:props="{ emitPath:false, checkStrictly: true, label: 'name', value: 'id', children: 'children' }"
:disabled="dataForm.id ? true : false"
:show-all-levels="false"
clearable />
</el-form-item>
<el-form-item prop="mySelectOrg" label="上级组织">
<el-form-item prop="mySelectOrg" label="上级组织">
<el-cascader
style="width:300px"
v-model="dataForm.mySelectOrg"
:options="orgList"
placeholder="请选择上级组织"
placeholder="请选择上级组织"
:props="{ checkStrictly: true, label: 'partyOrgName', value: 'id', children: 'children' }"
@change="handleChangeOrg"
clearable />
@ -116,11 +117,10 @@
mySelectOrg:'', //
orgPid: '', // ID,0
orgPids: '', // ID,0
maSelectAgency: '', //
agencyId: '', // id
agencyPids:'', // ids()
longitude: 36.0722275, //
latitude: 120.38945519, //
longitude: '', //
latitude: '', //
address: '',
introduction: '', //
@ -137,11 +137,12 @@
agencyOrgList:[]
}
},
mounted () {
setTimeout(() => {
this.initMap()
}, 800);
},
// mounted () {
// setTimeout(() => {
// console.log(':::::::::::::::::::::::')
// this.initMap()
// }, 800);
// },
methods: {
init() {
this.visible = true
@ -150,12 +151,14 @@
this.dataForm.staffId = localStorage.getItem('staffId')
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
this.dataForm.latitude = ''
//
this.setPartyOrgType()
this.getOrgList().then(() => {
if (this.dataForm.id) {
this.getInfo()
} else {
this.initMap()
if(this.dataForm.orgPids) {
this.dataForm.mySelectOrg = this.dataForm.orgPids.split(':')
} else {
@ -214,13 +217,12 @@
if(value != '5'){ //
this.dataForm.agencyId = ''
this.dataForm.agencyPids = ''
this.dataForm.maSelectAgency = ''
}
this.$http.get('/gov/org/customeragency/getOrgTreeByUserAndType', {params: {agencyId: this.agencyId, orgType:value}}).then(({data: res}) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.agencyOrgList = res.data
this.agencyOrgList = this.removeEmptyChildren(res.data)
}).catch(() => {})
},
//
@ -229,7 +231,7 @@
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.orgList = res.data
this.orgList = this.removeEmptyChildren(res.data)
this.orgList.unshift({
partyOrgName: '一级组织',
id: '0'
@ -237,6 +239,18 @@
}).catch(() => {
})
},
removeEmptyChildren (orgArray) {
orgArray.forEach((orgInfo) => {
if (orgInfo && orgInfo.children) {
if (orgInfo.children.length === 0) {
orgInfo.children = undefined
} else {
this.removeEmptyChildren(orgInfo.children)
}
}
})
return orgArray;
},
//
handleChangeOrg(e) {
if (this.dataForm.mySelectOrg.length > 0 && this.dataForm.mySelectOrg) {
@ -250,20 +264,6 @@
this.dataForm.orgPids = ''
}
},
//
handleChangeAgency(e){
console.log(this.dataForm.maSelectAgency)
if (this.dataForm.maSelectAgency.length > 0 && this.dataForm.maSelectAgency) {
this.dataForm.agencyId = this.dataForm.maSelectAgency[this.dataForm.maSelectAgency.length - 1]
this.dataForm.agencyPids = ''
this.dataForm.maSelectAgency.forEach(element => {
this.dataForm.agencyPids = this.dataForm.agencyPids ? this.dataForm.agencyPids + ':' + element : element
});
} else {
this.dataForm.agencyId = ''
this.dataForm.agencyPids = ''
}
},
//
getInfo() {
this.$http.get(`/resi/partymember/icPartyOrg/${this.dataForm.id}`).then(({data: res}) => {
@ -275,10 +275,10 @@
...res.data
}
//
this.dataForm.mySelectOrg = this.dataForm.orgPids
this.dataForm.mySelectOrg = this.dataForm.orgPids.split(':')
//
this.dataForm.maSelectAgency = this.dataForm.agencyId
this.dataForm.agencyId = this.dataForm.agencyId
this.initMap()
}).catch(() => {
})
@ -305,13 +305,14 @@
},
// init
initMap () {
document.getElementById('app').innerHTML = ''
if (document.getElementById('app')) {
document.getElementById('mapSeach_id').style.display = "block"
document.getElementById('lon_lat_id').style.display = "block"
}
//
var center = new window.TMap.LatLng(36.0722275, 120.38945519)
var center = new window.TMap.LatLng( this.dataForm.latitude ? this.dataForm.latitude : 36.0722275, this.dataForm.longitude ? this.dataForm.longitude : 120.38945519)
// map TMap.Map()
map = new window.TMap.Map(document.getElementById('app'), {
center: center, //
@ -380,8 +381,13 @@
const center = map.getCenter()
const lat = center.getLat()
const lng = center.getLng()
this.dataForm.latitude = lat
this.dataForm.longitude = lng
if (lng === 120.38945519) {
this.dataForm.latitude = ''
this.dataForm.longitude = ''
} else {
this.dataForm.latitude = lat
this.dataForm.longitude = lng
}
this.setMarker(lat, lng)
this.convert(lat, lng)
},
@ -435,6 +441,9 @@
computed: {
dataRule() {
return {
partyOrgName: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
],
mySelectOrg: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
],
@ -448,7 +457,7 @@
latitude: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
],
maSelectAgency: [
agencyId: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
]
}

Loading…
Cancel
Save