Browse Source

修改

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

10
src/api/policy.js

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

141
src/views/firstPages/policy.vue

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

Loading…
Cancel
Save