|
|
@ -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,36 +17,38 @@ |
|
|
|
</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" |
|
|
|
:disabled="dataForm.id ? true : false" |
|
|
|
clearable /> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="党组织介绍" prop="introduction"> |
|
|
|
<el-input style="width:300px" v-model="dataForm.introduction" type="textarea" maxlength="500" placeholder="党组织介绍"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="位置坐标" |
|
|
|
<el-form-item label="党组织位置" |
|
|
|
prop="longitude" |
|
|
|
style="display: block"> |
|
|
|
<div class="item_width_1"> |
|
|
@ -69,7 +71,7 @@ |
|
|
|
</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> |
|
|
|
<el-input class="item_width_3" |
|
|
|
maxlength="50" |
|
|
@ -84,7 +86,7 @@ |
|
|
|
:readonly="true" |
|
|
|
v-model="dataForm.latitude"> |
|
|
|
</el-input> |
|
|
|
</div> |
|
|
|
</div> --> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
@ -116,11 +118,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 +138,12 @@ |
|
|
|
agencyOrgList:[] |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted () { |
|
|
|
setTimeout(() => { |
|
|
|
this.initMap() |
|
|
|
}, 800); |
|
|
|
}, |
|
|
|
// mounted () { |
|
|
|
// setTimeout(() => { |
|
|
|
// console.log(':::::::::::::::::::::::') |
|
|
|
// this.initMap() |
|
|
|
// }, 800); |
|
|
|
// }, |
|
|
|
methods: { |
|
|
|
init() { |
|
|
|
this.visible = true |
|
|
@ -150,12 +152,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 +218,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(() => {}) |
|
|
|
}, |
|
|
|
// 获取党组织列表 |
|
|
@ -228,8 +231,8 @@ |
|
|
|
return this.$http.get('/resi/partymember/icPartyOrg/getTreelist', {params: {agencyId: this.agencyId}}).then(({data: res}) => { |
|
|
|
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 +240,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 +265,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 +276,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 +306,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" |
|
|
|
// 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 +382,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) |
|
|
|
}, |
|
|
@ -410,6 +417,9 @@ |
|
|
|
}, |
|
|
|
// 表单提交 |
|
|
|
dataFormSubmitHandle: debounce(function () { |
|
|
|
if (!this.dataForm.latitude || !this.dataForm.longitude) { |
|
|
|
return this.$message.error('请滑动地图选择党组织位置') |
|
|
|
} |
|
|
|
this.$refs['dataForm'].validate((valid) => { |
|
|
|
if (!valid) { |
|
|
|
return false |
|
|
@ -435,20 +445,16 @@ |
|
|
|
computed: { |
|
|
|
dataRule() { |
|
|
|
return { |
|
|
|
mySelectOrg: [ |
|
|
|
partyOrgName: [ |
|
|
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|
|
|
], |
|
|
|
partyOrgType: [ |
|
|
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|
|
|
], |
|
|
|
|
|
|
|
longitude: [ |
|
|
|
mySelectOrg: [ |
|
|
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|
|
|
], |
|
|
|
latitude: [ |
|
|
|
partyOrgType: [ |
|
|
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|
|
|
], |
|
|
|
maSelectAgency: [ |
|
|
|
agencyId: [ |
|
|
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|
|
|
] |
|
|
|
} |
|
|
|