From 06941e042043eb97c3721074d768c935da92751b Mon Sep 17 00:00:00 2001 From: yujt Date: Tue, 23 Jun 2020 09:24:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E9=97=BB=E6=A8=A1=E5=9D=97=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=EF=BC=8C=E5=90=84=E5=8A=9F=E8=83=BD=E7=89=88=E5=9D=97?= =?UTF-8?q?=E7=8B=AC=E7=AB=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/news/allnews.vue | 7 +- src/views/modules/news/news-add-or-update.vue | 100 +--- .../modules/news/news-healthy-publish.vue | 449 ++++++++++++++++++ src/views/modules/news/news-healthy.vue | 282 +++++++++++ src/views/modules/news/news-publish.vue | 59 +-- .../modules/news/news-safety-publish.vue | 447 +++++++++++++++++ src/views/modules/news/news-safety.vue | 282 +++++++++++ src/views/modules/news/news.vue | 106 +---- 8 files changed, 1474 insertions(+), 258 deletions(-) create mode 100644 src/views/modules/news/news-healthy-publish.vue create mode 100644 src/views/modules/news/news-healthy.vue create mode 100644 src/views/modules/news/news-safety-publish.vue create mode 100644 src/views/modules/news/news-safety.vue diff --git a/src/views/modules/news/allnews.vue b/src/views/modules/news/allnews.vue index ad751a2..9457561 100644 --- a/src/views/modules/news/allnews.vue +++ b/src/views/modules/news/allnews.vue @@ -148,7 +148,8 @@ export default { startTime: '', endTime: '', keyword: '', - category: '' + category: '', + sectionCode: 'home_page_news' }, time: '', options: [], @@ -195,12 +196,11 @@ export default { } }, setRegistTime () { - console.log(this.time[0]) this.dataForm.startTime = this.time[0] this.dataForm.endTime = this.time[1] }, getListCategory () { - this.$http.get(`/news/newscategory/category/`).then(({ data: res }) => { + this.$http.get(`/news/newscategory/category/${this.dataForm.sectionCode}`).then(({ data: res }) => { if (res.code !== 0) { return this.$message.error(res.msg) } @@ -215,7 +215,6 @@ export default { }).then(() => { this.onLine.id = row.id this.onLine.onLineState = '0' - console.log(this.onLine) this.$http.post(`/news/news/modifyOnLine/`, this.onLine).then(({ data: res }) => { if (res.code !== 0) { return this.$message.error(res.msg) diff --git a/src/views/modules/news/news-add-or-update.vue b/src/views/modules/news/news-add-or-update.vue index f911a74..be38550 100644 --- a/src/views/modules/news/news-add-or-update.vue +++ b/src/views/modules/news/news-add-or-update.vue @@ -15,40 +15,6 @@ clearable collapse-tags> - { }) - this.getDeptInfoList('street', localStorage.getItem('street') === null ? '1169154711480528897' : localStorage.getItem('street')) - this.getListCategory() this.visible = true this.$nextTick(() => { this.dataForm.communityId = this.dataForm.streetId = this.dataForm.gridId = null @@ -254,66 +210,18 @@ export default { return this.$message.error(res.msg) } this.dataForm = { ...this.dataForm, ...res.data } + this.getListCategory(this.dataForm.sectionCode) this.resetRegistTime() this.quillEditor.root.innerHTML = res.data.newsContent - if (this.dataForm.streetId) { - if (this.dataForm.communityId === 0) { - this.dataForm.communityId = this.dataForm.gridId = null - } - this.getDeptInfoList('community', this.dataForm.streetId) - } - if (this.dataForm.communityId) { - if (this.dataForm.gridId === 0) { - this.dataForm.gridId = null - } - this.getDeptInfoList('grid', this.dataForm.communityId) - } - }).catch(() => { }) - }, - // 获取部门列表 - getDeptInfoList (dataReceiver, faDeptId) { - if (!faDeptId) { - return - } - this.$http.get(`/sys/dept/sublist/` + faDeptId).then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg) - } - if (dataReceiver === 'street') { - let all = [{ id: '1', name: '全部' }] - this.streetList = all.concat(res.data) - } else if (dataReceiver === 'community') { - this.communityList = res.data - } else if (dataReceiver === 'grid') { - this.gridList = res.data - } }).catch(() => { }) }, - changeStreet (event) { - 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.dataForm.grid = null - this.communityList = this.gridList = [] - this.getDeptInfoList('community', event) - }, - changeCommunity (event) { - 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) { - let choosenItem = this.gridList.filter(item => item.id === this.dataForm.gridId)[0] - this.dataForm.grid = choosenItem.name - }, changeCaterory () { // 给新闻类别变量赋值 let choosenItem = this.categorys.filter(item => item.id === this.dataForm.newsCateroryId)[0] this.dataForm.newsProperty = choosenItem.name }, - getListCategory () { - this.$http.get(`/news/newscategory/category`).then(({ data: res }) => { + getListCategory (sectionCode) { + this.$http.get(`/news/newscategory/category/${sectionCode}`).then(({ data: res }) => { if (res.code !== 0) { return this.$message.error(res.msg) } diff --git a/src/views/modules/news/news-healthy-publish.vue b/src/views/modules/news/news-healthy-publish.vue new file mode 100644 index 0000000..b3fe1cf --- /dev/null +++ b/src/views/modules/news/news-healthy-publish.vue @@ -0,0 +1,449 @@ + + + diff --git a/src/views/modules/news/news-healthy.vue b/src/views/modules/news/news-healthy.vue new file mode 100644 index 0000000..7b8b3e6 --- /dev/null +++ b/src/views/modules/news/news-healthy.vue @@ -0,0 +1,282 @@ + + diff --git a/src/views/modules/news/news-publish.vue b/src/views/modules/news/news-publish.vue index 72143ec..73887f9 100644 --- a/src/views/modules/news/news-publish.vue +++ b/src/views/modules/news/news-publish.vue @@ -116,25 +116,17 @@ export default { return { dataForm: { id: '', - streetId: '', - communityId: null, - gridId: null, newsCateroryId: '', newsTitle: '', newsReleaseStartTime: '', newsReleaseEndTime: '', newsContent: '', newsImageUrl: '', - street: '', - community: null, - grid: null, newsProperty: '', + sectionCode: 'home_page_news', allDeptIdsShow: [] }, time: [], - streetList: [], - communityList: [], - gridList: [], options: [], categorys: [], loading: false, @@ -161,12 +153,10 @@ export default { } }, activated () { - this.getDeptInfoList('street', localStorage.getItem('street') === null ? '1169154711480528897' : localStorage.getItem('street')) this.getListCategory() }, watch: { 'dataForm.allDeptIdsShow': function (val) { - console.log(this.dataForm.allDeptIdsShow) } }, created () { @@ -179,7 +169,6 @@ export default { this.options = res.data.options }) .catch(() => { }) - this.getDeptInfoList('street', localStorage.getItem('street') === null ? '1169154711480528897' : localStorage.getItem('street')) this.getListCategory() this.visible = true this.$nextTick(() => { @@ -220,57 +209,13 @@ export default { } }, methods: { - // 获取部门列表 - getDeptInfoList (dataReceiver, faDeptId) { - if (!faDeptId) { - return - } - this.$http.get(`/sys/dept/sublist/` + faDeptId).then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg) - } - if (dataReceiver === 'street') { - let all = [{ id: '1', name: '全部' }] - this.streetList = all.concat(res.data) - } else if (dataReceiver === 'community') { - this.communityList = res.data - } else if (dataReceiver === 'grid') { - this.gridList = res.data - } - }).catch(() => { }) - }, - 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.dataForm.grid = null - this.communityList = this.gridList = [] - // 获取街道下属社区 - this.getDeptInfoList('community', this.dataForm.streetId) - }, - 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', this.dataForm.communityId) - }, - changeGrid () { - // 给网格变量赋值 - let choosenItem = this.gridList.filter(item => item.id === this.dataForm.gridId)[0] - this.dataForm.grid = choosenItem.name - }, changeCaterory () { // 给新闻类别变量赋值 let choosenItem = this.categorys.filter(item => item.id === this.dataForm.newsCateroryId)[0] this.dataForm.newsProperty = choosenItem.name }, getListCategory () { - this.$http.get(`/news/newscategory/category`).then(({ data: res }) => { + this.$http.get(`/news/newscategory/category/${this.dataForm.sectionCode}`).then(({ data: res }) => { if (res.code !== 0) { return this.$message.error(res.msg) } diff --git a/src/views/modules/news/news-safety-publish.vue b/src/views/modules/news/news-safety-publish.vue new file mode 100644 index 0000000..0573893 --- /dev/null +++ b/src/views/modules/news/news-safety-publish.vue @@ -0,0 +1,447 @@ + + + diff --git a/src/views/modules/news/news-safety.vue b/src/views/modules/news/news-safety.vue new file mode 100644 index 0000000..06433ad --- /dev/null +++ b/src/views/modules/news/news-safety.vue @@ -0,0 +1,282 @@ + + diff --git a/src/views/modules/news/news.vue b/src/views/modules/news/news.vue index a7b07f4..a9ce434 100644 --- a/src/views/modules/news/news.vue +++ b/src/views/modules/news/news.vue @@ -11,43 +11,6 @@ :props="{ checkStrictly: true }" clearable> -
提交时间   { }) - this.getDeptInfoList('street', localStorage.getItem('street') === null ? '1169154711480528897' : localStorage.getItem('street')) this.getListCategory() }, methods: { @@ -247,65 +205,12 @@ export default { return '已下线' } }, - // 获取部门列表 - getDeptInfoList (dataReceiver, faDeptId) { - this.$http.get(`/sys/dept/sublist/` + faDeptId).then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg) - } - if (dataReceiver === 'street') { - this.streetList = res.data - } else if (dataReceiver === 'community') { - this.communityList = res.data - } else if (dataReceiver === 'grid') { - this.gridList = res.data - } - }).catch(() => { }) - }, - changeStreet (event) { - if (this.dataForm.streetId === '') { - this.communityList = [] - this.gridList = [] - this.dataForm.communityId = '' - this.dataForm.gridId = '' - return - } - this.dataForm.streetId = event - let choosenItem = this.streetList.filter(item => item.id === this.dataForm.streetId)[0] - this.initDeptIdAndName(choosenItem) - this.dataForm.communityId = this.dataForm.gridId = null - this.communityList = this.gridList = [] - this.getDeptInfoList('community', event) - }, - changeCommunity (event) { - if (this.dataForm.communityId === '') { - this.gridList = [] - this.dataForm.gridId = '' - return - } - this.communityId = event - let choosenItem = this.communityList.filter(item => item.id === this.dataForm.communityId)[0] - this.initDeptIdAndName(choosenItem) - this.dataForm.gridId = null - this.gridList = [] - this.getDeptInfoList('grid', event) - }, - changeGrid (event) { - this.dataForm.gridId = event - let choosenItem = this.gridList.filter(item => item.id === this.gridId)[0] - this.initDeptIdAndName(choosenItem) - }, - initDeptIdAndName (choosenItem) { - this.dataForm.dept = choosenItem.name - this.dataForm.deptId = choosenItem.id - }, setRegistTime () { - console.log(this.time[0]) this.dataForm.startTime = this.time[0] this.dataForm.endTime = this.time[1] }, getListCategory () { - this.$http.get(`/news/newscategory/category/`).then(({ data: res }) => { + this.$http.get(`/news/newscategory/category/${this.dataForm.sectionCode}`).then(({ data: res }) => { if (res.code !== 0) { return this.$message.error(res.msg) } @@ -320,7 +225,6 @@ export default { }).then(() => { this.onLine.id = row.id this.onLine.onLineState = '0' - console.log(this.onLine) this.$http.post(`/news/news/modifyOnLine/`, this.onLine).then(({ data: res }) => { if (res.code !== 0) { return this.$message.error(res.msg) @@ -395,9 +299,9 @@ export default { watch: { 'deptIdList': function (val) { if (val.length !== 0) { - this.dataForm.gridId = val[val.length - 1] + this.dataForm.deptId = val[val.length - 1] } else { - this.dataForm.gridId = '' + this.dataForm.deptId = '' } } }