|
|
|
@ -9,8 +9,8 @@ |
|
|
|
@keyup.enter.native="dataFormSubmitHandle()" |
|
|
|
:label-width="$i18n.locale === 'en-US' ? '120px' : '80px'"> |
|
|
|
<el-form-item label="所属街道" |
|
|
|
prop="deptId"> |
|
|
|
<el-select v-model="streetId" |
|
|
|
prop="streetId"> |
|
|
|
<el-select v-model="dataForm.streetId" |
|
|
|
@change="changeStreet" |
|
|
|
placeholder="所属街道"> |
|
|
|
<el-option v-for="item in streetList" |
|
|
|
@ -21,7 +21,7 @@ |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="所属社区"> |
|
|
|
<el-select v-model="communityId" |
|
|
|
<el-select v-model="dataForm.communityId" |
|
|
|
@change="changeCommunity" |
|
|
|
placeholder="所属社区"> |
|
|
|
<el-option v-for="item in communityList" |
|
|
|
@ -32,7 +32,7 @@ |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="所属网格"> |
|
|
|
<el-select v-model="gridId" |
|
|
|
<el-select v-model="dataForm.gridId" |
|
|
|
@change="changeGrid" |
|
|
|
placeholder="所属网格"> |
|
|
|
<el-option v-for="item in gridList" |
|
|
|
@ -82,8 +82,12 @@ export default { |
|
|
|
visible: false, |
|
|
|
dataForm: { |
|
|
|
id: '', |
|
|
|
dept: '', |
|
|
|
deptId: '', |
|
|
|
streetId: '', |
|
|
|
street: '', |
|
|
|
communityId: '', |
|
|
|
community: '', |
|
|
|
gridId: '', |
|
|
|
grid: '', |
|
|
|
noticeTitle: '', |
|
|
|
noticeContent: '' |
|
|
|
}, |
|
|
|
@ -106,18 +110,15 @@ export default { |
|
|
|
], |
|
|
|
uploadUrl: '', |
|
|
|
// 富文本end |
|
|
|
streetId: '', |
|
|
|
streetList: [], |
|
|
|
communityId: '', |
|
|
|
communityList: [], |
|
|
|
gridId: '', |
|
|
|
gridList: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
dataRule () { |
|
|
|
return { |
|
|
|
deptId: [ |
|
|
|
streetId: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
noticeTitle: [ |
|
|
|
@ -130,6 +131,7 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
created () { |
|
|
|
// 1169154711480528897 为市北区部门ID |
|
|
|
this.getDeptInfoList('street', '1169154711480528897') |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
@ -167,7 +169,7 @@ export default { |
|
|
|
init () { |
|
|
|
this.visible = true |
|
|
|
this.$nextTick(() => { |
|
|
|
this.communityId = this.streetId = this.gridId = null |
|
|
|
this.dataForm.communityId = this.dataForm.streetId = this.dataForm.gridId = null |
|
|
|
// 富文本 |
|
|
|
this.hideUpload = false |
|
|
|
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/oss/file/upload?token=${Cookies.get('token')}` |
|
|
|
@ -191,6 +193,12 @@ export default { |
|
|
|
} |
|
|
|
this.dataForm = res.data |
|
|
|
this.quillEditor.root.innerHTML = res.data.noticeContent |
|
|
|
if (this.dataForm.streetId) { |
|
|
|
this.getDeptInfoList('community', this.dataForm.streetId) |
|
|
|
} |
|
|
|
if (this.dataForm.communityId) { |
|
|
|
this.getDeptInfoList('grid', this.dataForm.communityId) |
|
|
|
} |
|
|
|
}).catch(() => { }) |
|
|
|
}, |
|
|
|
// 表单提交 |
|
|
|
@ -199,7 +207,7 @@ export default { |
|
|
|
if (!valid) { |
|
|
|
return false |
|
|
|
} |
|
|
|
this.$http[!this.dataForm.id ? 'post' : 'put']('/news/notice/', this.dataForm).then(({ data: res }) => { |
|
|
|
this.$http[!this.dataForm.id ? 'post' : 'put']('/news/notice', this.dataForm).then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
@ -230,30 +238,30 @@ export default { |
|
|
|
} |
|
|
|
}).catch(() => { }) |
|
|
|
}, |
|
|
|
changeStreet (event) { |
|
|
|
this.streetId = event |
|
|
|
let choosenItem = this.streetList.filter(item => item.id === this.streetId)[0] |
|
|
|
this.initDeptIdAndName(choosenItem) |
|
|
|
this.communityId = this.gridId = null |
|
|
|
changeStreet () { |
|
|
|
// 给街道变量赋值 |
|
|
|
let choosenItem = this.streetList.filter(item => item.id === this.dataForm.streetId)[0] |
|
|
|
this.dataForm.street = choosenItem.name |
|
|
|
// 清空社区与网格的变量值 |
|
|
|
this.dataForm.communityId = this.dataForm.gridId = this.dataForm.community = this.grid = null |
|
|
|
this.communityList = this.gridList = [] |
|
|
|
this.getDeptInfoList('community', event) |
|
|
|
// 获取街道下属社区 |
|
|
|
this.getDeptInfoList('community', this.dataForm.streetId) |
|
|
|
}, |
|
|
|
changeCommunity (event) { |
|
|
|
this.communityId = event |
|
|
|
let choosenItem = this.communityList.filter(item => item.id === this.communityId)[0] |
|
|
|
this.initDeptIdAndName(choosenItem) |
|
|
|
this.gridId = null |
|
|
|
changeCommunity () { |
|
|
|
// 给社区变量赋值 |
|
|
|
let choosenItem = this.communityList.filter(item => item.id === this.dataForm.communityId)[0] |
|
|
|
this.dataForm.community = choosenItem.name |
|
|
|
// 情况网格的变量值 |
|
|
|
this.dataForm.gridId = this.dataForm.grid = null |
|
|
|
this.gridList = [] |
|
|
|
this.getDeptInfoList('grid', event) |
|
|
|
}, |
|
|
|
changeGrid (event) { |
|
|
|
this.gridId = event |
|
|
|
let choosenItem = this.gridList.filter(item => item.id === this.gridId)[0] |
|
|
|
this.initDeptIdAndName(choosenItem) |
|
|
|
// 获取社区下属网格 |
|
|
|
this.getDeptInfoList('grid', this.dataForm.communityId) |
|
|
|
}, |
|
|
|
initDeptIdAndName (choosenItem) { |
|
|
|
this.dataForm.dept = choosenItem.name |
|
|
|
this.dataForm.deptId = choosenItem.id |
|
|
|
changeGrid () { |
|
|
|
// 给网格变量赋值 |
|
|
|
let choosenItem = this.gridList.filter(item => item.id === this.dataForm.gridId)[0] |
|
|
|
this.dataForm.grid = choosenItem.name |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|