Browse Source

修改

master
rose 4 years ago
parent
commit
8bedc85e42
  1. 10
      src/api/policy.js
  2. 139
      src/views/firstPages/policy.vue

10
src/api/policy.js

@ -33,7 +33,8 @@ export function PolicyUpdate(data) {
title: data.title, title: data.title,
pushDep: data.pushDep, pushDep: data.pushDep,
titleUrl: data.titleUrl, titleUrl: data.titleUrl,
type: data.type type: data.type,
publishTime: data.publishTime
} }
} }
}) })
@ -77,3 +78,10 @@ export function getAreaBranch() {
data: {} data: {}
}) })
} }
export function queryCategoryAll() {
return request({
url: `/gateway/enterprise/category/queryCategoryAll`,
method: 'post',
data: {}
})
}

139
src/views/firstPages/policy.vue

@ -3,10 +3,10 @@
<!-- 头部搜索添加 --> <!-- 头部搜索添加 -->
<div class="filter-container"> <div class="filter-container">
<el-input <el-input
v-model="policyTitle"
placeholder="政策标题" placeholder="政策标题"
style="width: 190px; margin-right: 10px" style="width: 190px; margin-right: 10px"
class="filter-item" class="filter-item"
v-model="policyTitle"
/> />
<el-select <el-select
v-model="policyType" v-model="policyType"
@ -176,6 +176,15 @@
<el-form-item label="政策标题" prop="title" style="width: 180%"> <el-form-item label="政策标题" prop="title" style="width: 180%">
<el-input v-model="temp.title" /> <el-input v-model="temp.title" />
</el-form-item> </el-form-item>
<el-form-item label="发布时间" prop="time" style="width: 180%">
<el-date-picker
id="TimeUpdate"
v-model="temp.publishTime"
type="date"
placeholder="请选择时间"
/>
</el-form-item>
<el-form-item label="原文链接" prop="titleUrl" style="width: 180%"> <el-form-item label="原文链接" prop="titleUrl" style="width: 180%">
<el-input v-model="temp.titleUrl" /> <el-input v-model="temp.titleUrl" />
@ -186,13 +195,21 @@
</el-form-item> </el-form-item>
<el-form-item label="发布部门" prop="imgUrl" style="width: 180%"> <el-form-item label="发布部门" prop="imgUrl" style="width: 180%">
<el-cascader <el-select v-model="temp.pushDep" placeholder="请选择">
v-model="cascader" <el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<!-- <el-cascader
v-if="options.length > 0" v-if="options.length > 0"
v-model="cascader"
:options="options" :options="options"
@change="handleChange"
:props="{ value: 'id', label: 'areaName', children: 'next' }" :props="{ value: 'id', label: 'areaName', children: 'next' }"
></el-cascader> @change="handleChange"
/> -->
</el-form-item> </el-form-item>
<el-form-item label="原文内容" prop="content" style="width: 180%"> <el-form-item label="原文内容" prop="content" style="width: 180%">
@ -200,6 +217,7 @@
<!-- <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" /> -->
<div <div
v-if="show111 === false" v-if="show111 === false"
id="edit-content"
contentEditable="true" contentEditable="true"
style=" style="
border: 1px solid #000; border: 1px solid #000;
@ -210,7 +228,6 @@
overflow-y: auto; overflow-y: auto;
" "
v-html="temp.content" v-html="temp.content"
id="edit-content"
> >
' '
</div> </div>
@ -222,13 +239,16 @@
</el-form-item> </el-form-item>
<el-form-item label="政策标签" prop="intro" style="width: 180%"> <el-form-item label="政策标签" prop="intro" style="width: 180%">
<el-button @click="addLabel">添加标签</el-button> <!-- <el-button @click="addLabel">添加标签</el-button> -->
<el-input <el-select v-model="temp.projectLabels" multiple-limit="5" multiple placeholder="请选择标签">
style="margin-top: 4px" <el-option
v-for="(item, index) in temp.projectLabels" v-for="item in projectLabels"
:key="index" :key="item.name"
v-model="temp.projectLabels[index]" :label="item.name"
:value="item.name"
/> />
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="政策类型" prop="type"> <el-form-item label="政策类型" prop="type">
@ -301,13 +321,21 @@
</el-form-item> </el-form-item>
<el-form-item label="发布部门" prop="imgUrl" style="width: 180%"> <el-form-item label="发布部门" prop="imgUrl" style="width: 180%">
<el-cascader <el-select v-model="value" placeholder="请选择">
v-model="cascader1" <el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<!-- <el-cascader
v-if="options.length > 0" v-if="options.length > 0"
v-model="cascader1"
:options="options" :options="options"
@change="handleChange1"
:props="{ value: 'id', label: 'areaName', children: 'next' }" :props="{ value: 'id', label: 'areaName', children: 'next' }"
></el-cascader> @change="handleChange1"
/> -->
</el-form-item> </el-form-item>
<el-form-item label="原文内容" prop="content" style="width: 180%"> <el-form-item label="原文内容" prop="content" style="width: 180%">
@ -392,8 +420,24 @@ export default {
intro: '', intro: '',
pushDep: '' pushDep: ''
}, },
options: [], options: [{
contentDetail: '' value: '0',
label: '部委政策'
}, {
value: '1',
label: '省政策'
}, {
value: '2',
label: '市政策'
}, {
value: '3',
label: '区政策'
}],
contentDetail: '',
projectLabels: [],
value: '',
value1: '',
publishTime: ''
} }
}, },
computed: { computed: {
@ -401,18 +445,22 @@ export default {
}, },
async created() { async created() {
await this.getList() await this.getList()
await api.getAreaBranch().then(res => {
this.options = res // optionsPolicy
await api.queryCategoryAll().then(res => {
this.projectLabels = res
}) })
}, },
methods: { methods: {
handleChange(value) {
this.temp.pushDep = value[value.length - 1] //
console.log(this.temp) // handleChange(value) {
}, // this.temp.pushDep = value[value.length - 1]
handleChange1(value) { // console.log(this.temp)
this.addPolicy.pushDep = value[value.length - 1] // },
}, // 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
@ -468,6 +516,9 @@ export default {
}) })
}, },
handleUpdate(row) { handleUpdate(row) {
console.log(row)
console.log(this.options)
const that = this const that = this
that.temp = Object.assign({}, row) // copy obj that.temp = Object.assign({}, row) // copy obj
that.temp.timestamp = new Date().toLocaleDateString() that.temp.timestamp = new Date().toLocaleDateString()
@ -489,20 +540,27 @@ export default {
}, },
async Commit() { async Commit() {
const that = this const that = this
//
var editPolicyBox = document.getElementById('edit-content') var editPolicyBox = document.getElementById('edit-content')
that.temp.content = editPolicyBox.innerHTML that.temp.content = editPolicyBox.innerHTML
that.temp.type = that.typeList[`${that.policyType1}`] that.temp.type = that.typeList[`${that.policyType1}`]
that.temp.auditStatus = that.status[`${that.policyStatus1}`] that.temp.auditStatus = that.status[`${that.policyStatus1}`]
for (let i = 0; i < that.temp.projectLabels.length; i++) { // for (let i = 0; i < that.temp.projectLabels.length; i++) {
if (that.temp.projectLabels[i] === '') { // if (that.temp.projectLabels[i] === '') {
that.temp.projectLabels.splice(i, 1) // that.temp.projectLabels.splice(i, 1)
i -= 1 // i -= 1
} // }
} // }
console.log(that.temp)
console.log(that.temp.publishTime)
that.temp.publishTime = that.temp.publishTime.replaceAll('/', '-')
// that.temp.pushDep = that.value
// that.temp.projectLabels = this.value1
console.log('commit=========>', that.temp)
await api.PolicyUpdate(that.temp).then(res => { await api.PolicyUpdate(that.temp).then(res => {
this.getList() this.getList()
this.cascader = '' this.value = ''
that.dialogFormVisible = false that.dialogFormVisible = false
}) })
}, },
@ -529,6 +587,7 @@ export default {
}, },
async CommitAdd() { async CommitAdd() {
const that = this const that = this
that.addPolicy.pushDep = this.value
var Content = document.getElementById('Content') var Content = document.getElementById('Content')
var Time = document.getElementById('Time').value var Time = document.getElementById('Time').value
that.addPolicy.content = Content.innerHTML that.addPolicy.content = Content.innerHTML
@ -541,14 +600,14 @@ export default {
} }
} }
api.PolicyAdd(that.addPolicy).then(res => { api.PolicyAdd(that.addPolicy).then(res => {
this.cascader1 = '' this.value = ''
that.dialogFormVisible1 = false that.dialogFormVisible1 = false
}) })
},
addLabel() {
this.temp.projectLabels = this.temp.projectLabels.concat([''])
console.log(this.temp.projectLabels)
} }
// addLabel() {
// this.temp.projectLabels = this.temp.projectLabels.concat([''])
// console.log(this.temp.projectLabels)
// }
} }
} }
</script> </script>

Loading…
Cancel
Save