diff --git a/src/api/policy.js b/src/api/policy.js index ddb8d39..eeae194 100644 --- a/src/api/policy.js +++ b/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: {} + }) +} diff --git a/src/views/firstPages/policy.vue b/src/views/firstPages/policy.vue index 6ee077d..3a692f0 100644 --- a/src/views/firstPages/policy.vue +++ b/src/views/firstPages/policy.vue @@ -3,10 +3,10 @@
+ + + + @@ -186,13 +195,21 @@ - + + + @@ -200,6 +217,7 @@
'
@@ -222,13 +239,16 @@
- 添加标签 - + + + + + @@ -301,13 +321,21 @@ - + + + @@ -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) + // } } }