Browse Source

政策发布部门相关修改

master
aBin 4 years ago
parent
commit
487ae4e26f
  1. 14
      src/api/policy.js
  2. 46
      src/views/firstPages/policy.vue

14
src/api/policy.js

@ -1,5 +1,6 @@
import request from '@/utils/request' import request from '@/utils/request'
const policy = '/enterprise/policy' const policy = '/enterprise/policy'
const policyArea = '/policy/policy'
export function PolicyDetail(data) { export function PolicyDetail(data) {
return request({ return request({
@ -30,6 +31,7 @@ export function PolicyUpdate(data) {
imgUrl: data.imgUrl, imgUrl: data.imgUrl,
intro: data.intro, intro: data.intro,
title: data.title, title: data.title,
pushDep: data.pushDep,
titleUrl: data.titleUrl, titleUrl: data.titleUrl,
type: data.type type: data.type
} }
@ -61,8 +63,18 @@ export function PolicyAdd(data) {
intro: data.intro, intro: data.intro,
publishTime: data.publishTime, publishTime: data.publishTime,
title: data.title, title: data.title,
titleUrl: data.titleUrl titleUrl: data.titleUrl,
publishDepartId: data.pushDep,
} }
} }
}) })
} }
export function getAreaBranch() {
return request({
url: `/gateway${policyArea}/area`,
method: 'post',
data: {}
})
}

46
src/views/firstPages/policy.vue

@ -185,6 +185,16 @@
<el-input v-model="temp.imgUrl" /> <el-input v-model="temp.imgUrl" />
</el-form-item> </el-form-item>
<el-form-item label="发布部门" prop="imgUrl" style="width: 180%">
<el-cascader
v-model="cascader"
v-if="options.length > 0"
:options="options"
@change="handleChange"
:props="{ value: 'id', label: 'areaName', children: 'next' }"
></el-cascader>
</el-form-item>
<el-form-item label="原文内容" prop="content" style="width: 180%"> <el-form-item label="原文内容" prop="content" style="width: 180%">
<!-- <el-button @click="show111 = !show111">原文/编辑</el-button> --> <!-- <el-button @click="show111 = !show111">原文/编辑</el-button> -->
<!-- <textarea v-if="show111 === false" style="width: 100%;height: 300px" v-text="temp.content" /> --> <!-- <textarea v-if="show111 === false" style="width: 100%;height: 300px" v-text="temp.content" /> -->
@ -289,6 +299,16 @@
<el-input v-model="addPolicy.imgUrl" /> <el-input v-model="addPolicy.imgUrl" />
</el-form-item> </el-form-item>
<el-form-item label="发布部门" prop="imgUrl" style="width: 180%">
<el-cascader
v-model="cascader1"
v-if="options.length > 0"
:options="options"
@change="handleChange1"
:props="{ value: 'id', label: 'areaName', children: 'next' }"
></el-cascader>
</el-form-item>
<el-form-item label="原文内容" prop="content" style="width: 180%"> <el-form-item label="原文内容" prop="content" style="width: 180%">
<!-- <el-button @click="show111 = !show111">原文/编辑</el-button> --> <!-- <el-button @click="show111 = !show111">原文/编辑</el-button> -->
<!-- <textarea v-if="show111 === false" style="width: 100%;height: 300px" v-text="temp.content" /> --> <!-- <textarea v-if="show111 === false" style="width: 100%;height: 300px" v-text="temp.content" /> -->
@ -337,6 +357,8 @@ export default {
show111: false, show111: false,
total: 0, total: 0,
listLoading: true, listLoading: true,
cascader: '',
cascader1: '',
data: { data: {
title: '', title: '',
auditStatus: '', auditStatus: '',
@ -366,17 +388,29 @@ export default {
titleUrl: '', titleUrl: '',
imgUrl: '', imgUrl: '',
content: '', content: '',
intro: '' intro: '',
} pushDep: ''
},
options: []
} }
}, },
computed: { computed: {
...mapGetters(['name']) ...mapGetters(['name'])
}, },
created() { async created() {
this.getList() await this.getList()
await api.getAreaBranch().then(res => {
this.options = res
})
}, },
methods: { methods: {
handleChange(value) {
this.temp.pushDep = value[value.length - 1]
console.log(this.temp)
},
handleChange1(value) {
this.addPolicy.pushDep = value[value.length - 1]
},
async Search() { async Search() {
const that = this const that = this
that.listLoading = true that.listLoading = true
@ -435,6 +469,7 @@ export default {
handleUpdate(row) { handleUpdate(row) {
const that = this const that = this
that.temp = Object.assign({}, row) // copy obj that.temp = Object.assign({}, row) // copy obj
console.log(that.temp)
that.temp.timestamp = new Date(that.temp.timestamp) that.temp.timestamp = new Date(that.temp.timestamp)
that.dialogStatus = 'update' that.dialogStatus = 'update'
for (const key in that.typeList) { for (const key in that.typeList) {
@ -464,6 +499,7 @@ export default {
} }
await api.PolicyUpdate(that.temp).then(res => { await api.PolicyUpdate(that.temp).then(res => {
this.getList() this.getList()
this.cascader = ''
that.dialogFormVisible = false that.dialogFormVisible = false
}) })
}, },
@ -471,6 +507,7 @@ export default {
this.listLoading = true this.listLoading = true
detail.auditStatus = num detail.auditStatus = num
await api.PolicyUpdate(detail).then(res => { await api.PolicyUpdate(detail).then(res => {
this.cascader = ''
this.listLoading = false this.listLoading = false
}) })
}, },
@ -501,6 +538,7 @@ export default {
} }
} }
api.PolicyAdd(that.addPolicy).then(res => { api.PolicyAdd(that.addPolicy).then(res => {
this.cascader1 = ''
that.dialogFormVisible1 = false that.dialogFormVisible1 = false
}) })
}, },

Loading…
Cancel
Save