Browse Source

Merge branch 'feature/dev_party_mange' of http://git.elinkit.com.cn:7070/r/epmet-oper-gov into feature/dev_party_mange

shibei_master
13176889840 3 years ago
parent
commit
b312456295
  1. 118
      src/views/modules/partymember/icpartyorg-add-or-update.vue

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

@ -7,8 +7,8 @@
ref="dataForm" ref="dataForm"
@keyup.enter.native="dataFormSubmitHandle()" @keyup.enter.native="dataFormSubmitHandle()"
:label-width="$i18n.locale === 'en-US' ? '120px' : '100px'"> :label-width="$i18n.locale === 'en-US' ? '120px' : '100px'">
<el-form-item prop="partyOrgType" label="组织类型"> <el-form-item prop="partyOrgType" label="组织类型">
<el-select v-model="dataForm.partyOrgType" @change="changePartyOrgType" clearable placeholder="请选择组织类型"> <el-select :disabled="dataForm.id ? true : false" v-model="dataForm.partyOrgType" @change="changePartyOrgType" clearable placeholder="请选择组织类型">
<el-option <el-option
v-for="item in partyOrgTypeList" v-for="item in partyOrgTypeList"
:key="item.value" :key="item.value"
@ -17,36 +17,38 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item prop="partyOrgName" label="组织名称"> <el-form-item prop="partyOrgName" label="组织名称">
<el-input v-model="dataForm.partyOrgName" placeholder="请输入组织名称" style="width:300px"></el-input> <el-input v-model="dataForm.partyOrgName" placeholder="请输入组织名称" style="width:300px"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="组织编码" prop="partyOrgCode"> <el-form-item label="组织编码" prop="partyOrgCode">
<el-input v-model="dataForm.partyOrgCode" placeholder="组织编码" style="width:300px"></el-input> <el-input v-model="dataForm.partyOrgCode" placeholder="组织编码" style="width:300px"></el-input>
</el-form-item> </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 <el-cascader
style="width:300px" style="width:300px"
v-model="dataForm.maSelectAgency" v-model="dataForm.agencyId"
:options="agencyOrgList" :options="agencyOrgList"
placeholder="请选择行政组织" placeholder="请选择行政组织"
:props="{ checkStrictly: true, label: 'name', value: 'id', children: 'children' }" :props="{ emitPath:false, checkStrictly: true, label: 'name', value: 'id', children: 'children' }"
@change="handleChangeAgency" :disabled="dataForm.id ? true : false"
:show-all-levels="false"
clearable /> clearable />
</el-form-item> </el-form-item>
<el-form-item prop="mySelectOrg" label="上级组织"> <el-form-item prop="mySelectOrg" label="上级组织">
<el-cascader <el-cascader
style="width:300px" style="width:300px"
v-model="dataForm.mySelectOrg" v-model="dataForm.mySelectOrg"
:options="orgList" :options="orgList"
placeholder="请选择上级组织" placeholder="请选择上级组织"
:props="{ checkStrictly: true, label: 'partyOrgName', value: 'id', children: 'children' }" :props="{ checkStrictly: true, label: 'partyOrgName', value: 'id', children: 'children' }"
@change="handleChangeOrg" @change="handleChangeOrg"
:disabled="dataForm.id ? true : false"
clearable /> clearable />
</el-form-item> </el-form-item>
<el-form-item label="党组织介绍" prop="introduction"> <el-form-item label="党组织介绍" prop="introduction">
<el-input style="width:300px" v-model="dataForm.introduction" type="textarea" maxlength="500" placeholder="党组织介绍"></el-input> <el-input style="width:300px" v-model="dataForm.introduction" type="textarea" maxlength="500" placeholder="党组织介绍"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="位置坐标" <el-form-item label="党组织位置"
prop="longitude" prop="longitude"
style="display: block"> style="display: block">
<div class="item_width_1"> <div class="item_width_1">
@ -69,7 +71,7 @@
</div> </div>
</div> </div>
<div id="lon_lat_id" style="margin-top: 10px; display: none"> <!-- <div id="lon_lat_id" style="margin-top: 10px; display: none">
<span>经度</span> <span>经度</span>
<el-input class="item_width_3" <el-input class="item_width_3"
maxlength="50" maxlength="50"
@ -84,7 +86,7 @@
:readonly="true" :readonly="true"
v-model="dataForm.latitude"> v-model="dataForm.latitude">
</el-input> </el-input>
</div> </div> -->
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -116,11 +118,10 @@
mySelectOrg:'', // mySelectOrg:'', //
orgPid: '', // ID,0 orgPid: '', // ID,0
orgPids: '', // ID,0 orgPids: '', // ID,0
maSelectAgency: '', //
agencyId: '', // id agencyId: '', // id
agencyPids:'', // ids() agencyPids:'', // ids()
longitude: 36.0722275, // longitude: '', //
latitude: 120.38945519, // latitude: '', //
address: '', address: '',
introduction: '', // introduction: '', //
@ -137,11 +138,12 @@
agencyOrgList:[] agencyOrgList:[]
} }
}, },
mounted () { // mounted () {
setTimeout(() => { // setTimeout(() => {
this.initMap() // console.log(':::::::::::::::::::::::')
}, 800); // this.initMap()
}, // }, 800);
// },
methods: { methods: {
init() { init() {
this.visible = true this.visible = true
@ -150,12 +152,14 @@
this.dataForm.staffId = localStorage.getItem('staffId') this.dataForm.staffId = localStorage.getItem('staffId')
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields() this.$refs['dataForm'].resetFields()
this.dataForm.latitude = ''
// //
this.setPartyOrgType() this.setPartyOrgType()
this.getOrgList().then(() => { this.getOrgList().then(() => {
if (this.dataForm.id) { if (this.dataForm.id) {
this.getInfo() this.getInfo()
} else { } else {
this.initMap()
if(this.dataForm.orgPids) { if(this.dataForm.orgPids) {
this.dataForm.mySelectOrg = this.dataForm.orgPids.split(':') this.dataForm.mySelectOrg = this.dataForm.orgPids.split(':')
} else { } else {
@ -214,13 +218,12 @@
if(value != '5'){ // if(value != '5'){ //
this.dataForm.agencyId = '' this.dataForm.agencyId = ''
this.dataForm.agencyPids = '' this.dataForm.agencyPids = ''
this.dataForm.maSelectAgency = ''
} }
this.$http.get('/gov/org/customeragency/getOrgTreeByUserAndType', {params: {agencyId: this.agencyId, orgType:value}}).then(({data: res}) => { this.$http.get('/gov/org/customeragency/getOrgTreeByUserAndType', {params: {agencyId: this.agencyId, orgType:value}}).then(({data: res}) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
this.agencyOrgList = res.data this.agencyOrgList = this.removeEmptyChildren(res.data)
}).catch(() => {}) }).catch(() => {})
}, },
// //
@ -228,8 +231,8 @@
return this.$http.get('/resi/partymember/icPartyOrg/getTreelist', {params: {agencyId: this.agencyId}}).then(({data: res}) => { return this.$http.get('/resi/partymember/icPartyOrg/getTreelist', {params: {agencyId: this.agencyId}}).then(({data: res}) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
this.orgList = res.data this.orgList = this.removeEmptyChildren(res.data)
this.orgList.unshift({ this.orgList.unshift({
partyOrgName: '一级组织', partyOrgName: '一级组织',
id: '0' id: '0'
@ -237,6 +240,18 @@
}).catch(() => { }).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) { handleChangeOrg(e) {
if (this.dataForm.mySelectOrg.length > 0 && this.dataForm.mySelectOrg) { if (this.dataForm.mySelectOrg.length > 0 && this.dataForm.mySelectOrg) {
@ -250,20 +265,6 @@
this.dataForm.orgPids = '' 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() { getInfo() {
this.$http.get(`/resi/partymember/icPartyOrg/${this.dataForm.id}`).then(({data: res}) => { this.$http.get(`/resi/partymember/icPartyOrg/${this.dataForm.id}`).then(({data: res}) => {
@ -275,10 +276,10 @@
...res.data ...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(() => { }).catch(() => {
}) })
@ -305,13 +306,14 @@
}, },
// init // init
initMap () { initMap () {
document.getElementById('app').innerHTML = ''
if (document.getElementById('app')) { if (document.getElementById('app')) {
document.getElementById('mapSeach_id').style.display = "block" document.getElementById('mapSeach_id').style.display = "block"
document.getElementById('lon_lat_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 TMap.Map()
map = new window.TMap.Map(document.getElementById('app'), { map = new window.TMap.Map(document.getElementById('app'), {
center: center, // center: center, //
@ -380,8 +382,13 @@
const center = map.getCenter() const center = map.getCenter()
const lat = center.getLat() const lat = center.getLat()
const lng = center.getLng() const lng = center.getLng()
this.dataForm.latitude = lat if (lng === 120.38945519) {
this.dataForm.longitude = lng this.dataForm.latitude = ''
this.dataForm.longitude = ''
} else {
this.dataForm.latitude = lat
this.dataForm.longitude = lng
}
this.setMarker(lat, lng) this.setMarker(lat, lng)
this.convert(lat, lng) this.convert(lat, lng)
}, },
@ -410,6 +417,9 @@
}, },
// //
dataFormSubmitHandle: debounce(function () { dataFormSubmitHandle: debounce(function () {
if (!this.dataForm.latitude || !this.dataForm.longitude) {
return this.$message.error('请滑动地图选择党组织位置')
}
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate((valid) => {
if (!valid) { if (!valid) {
return false return false
@ -435,20 +445,16 @@
computed: { computed: {
dataRule() { dataRule() {
return { return {
mySelectOrg: [ partyOrgName: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'} {required: true, message: this.$t('validate.required'), trigger: 'blur'}
], ],
partyOrgType: [ mySelectOrg: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
],
longitude: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'} {required: true, message: this.$t('validate.required'), trigger: 'blur'}
], ],
latitude: [ partyOrgType: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'} {required: true, message: this.$t('validate.required'), trigger: 'blur'}
], ],
maSelectAgency: [ agencyId: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'} {required: true, message: this.$t('validate.required'), trigger: 'blur'}
] ]
} }

Loading…
Cancel
Save