master
yujialong 2 years ago
parent 3702d68d69
commit 09a68b39a2
  1. 10
      src/pages/article/add/index.vue
  2. 27
      src/pages/article/list/index.vue
  3. 62
      src/pages/column/add/index.vue
  4. 4
      src/pages/column/list/index.vue

@ -637,7 +637,9 @@ export default {
classifications: [],
classVisible: false,
labels: [],
labelVisible: false
labelVisible: false,
originalName: '',
originColumnId: ''
};
},
computed: {
@ -802,6 +804,7 @@ export default {
}).catch(err => {})
}
this.originalName = data.title
this.originColumnId = data.columnId
this.form = data
data.siteSelection && this.getOtherColumn()
this.getColumn()
@ -868,8 +871,6 @@ export default {
//
getOtherColumn(val) {
this.$post(this.api.listWithTree, {
siteId: this.form.siteSelection,
columnName: '',
templateId: '',
@ -1241,6 +1242,7 @@ export default {
const tId = form.articleTemplate
//
if (isRelease) {
// id
if (tId !== 25) {
if (!form.releaseTime) return Util.errorMsg('请选择发布日期')
}
@ -1290,7 +1292,7 @@ export default {
this.$post(this.api.updateArticle, form).then(res => {
this.updateFile(fileId, form, form.id)
Util.successMsg('修改成功')
next ? next() : this.$router.push(`list?columnId=` + form.columnId)
next ? next() : this.$router.push(`list?columnId=` + form.columnId + (form.columnId != this.originColumnId ? '&last=1' : ''))
}).catch(err => {
this.submiting = false
})

@ -37,7 +37,11 @@
</div>
<el-table :data="list" class="table" ref="table" header-align="center" @selection-change="handleSelectionChange" row-key="id" @sort-change="sortChange">
<el-table-column v-if="settings[0].show" type="selection" width="55" align="center" :reserve-selection="true"></el-table-column>
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column>
<el-table-column type="index" width="60" label="序号" align="center">
<template scope="scope">
<span>{{(page - 1) * pageSize + scope.$index + 1}}</span>
</template>
</el-table-column>
<el-table-column v-if="settings[1].show" show-overflow-tooltip prop="title" label="标题" align="center" min-width="150"></el-table-column>
<el-table-column v-if="settings[2].show" prop="columnName" label="栏目" align="center" min-width="120"></el-table-column>
<el-table-column prop="classificationName" label="所属分类" align="center" min-width="120"></el-table-column>
@ -93,6 +97,7 @@ import ColumnConst from '@/const/column'
export default {
data() {
return {
last: this.$route.query.last, //
types: ColumnConst.types,
siteName: this.$store.state.content.site.siteName,
columns: [],
@ -126,7 +131,7 @@ export default {
total: 0,
modifiedTimeSort: '',
publicationTimeSort: '',
ordinalSort: 0,
topSort: 0,
multipleSelection: [],
originSettings: [],
settings: [
@ -232,7 +237,7 @@ export default {
columnIds: [id],
pageNum: this.page,
pageSize: this.pageSize,
ordinalSort: this.ordinalSort,
topSort: this.topSort,
title: this.field === 'title' ? keyword : '',
founder: this.field === 'founder' ? keyword : '',
column: this.field === 'column' ? keyword : '',
@ -247,7 +252,15 @@ export default {
})
this.originList = JSON.parse(JSON.stringify(data.records))
this.list = data.records
this.total = +data.total
const total = +data.total
this.total = total
if (this.last) {
let page = parseInt(total / 10)
total % 10 && page++
this.page = page
this.last = ''
this.getData()
}
}).catch(err => {})
},
//
@ -333,19 +346,19 @@ export default {
this.modifiedTimeSort = order ? order === 'ascending' ? 1 : 0 : ''
if (order) {
this.publicationTimeSort = ''
this.ordinalSort = ''
this.topSort = ''
}
}
if (column.prop === 'releaseTime') {
this.publicationTimeSort = order ? order === 'ascending' ? 1 : 0 : ''
if (order) {
this.modifiedTimeSort = ''
this.ordinalSort = ''
this.topSort = ''
}
}
// 0 1
if (column.prop === 'sequence') {
this.ordinalSort = order ? order === 'ascending' ? 0 : 1 : ''
this.topSort = order ? order === 'ascending' ? 0 : 1 : ''
if (order) {
this.publicationTimeSort = ''
this.modifiedTimeSort = ''

@ -9,7 +9,7 @@
v-model="form.columnName"
clearable
maxlength="40"
@change="nameChange"
@input="nameChange"
></el-input>
</el-form-item>
<el-form-item prop="fatherId" label="设置上级">
@ -17,7 +17,8 @@
v-model="form.fatherId"
:options="columns"
:props="columnProps"
clearable></el-cascader>
clearable
@change="fatherIdChange"></el-cascader>
</el-form-item>
</div>
<div class="item-line">
@ -305,7 +306,9 @@ export default {
cropperModel: false,
isUpload: false,
file: {}, //
fileId: ''
fileId: '',
level: 0,
nameTimer: null
};
},
components: {
@ -372,8 +375,6 @@ export default {
//
getList() {
this.$post(this.api.listWithTree, {
siteId: this.site.id,
columnName: '',
templateId: '',
@ -504,8 +505,6 @@ export default {
//
getOtherColumn(val) {
this.form.siteSelection && this.$post(this.api.listWithTree, {
siteId: this.form.siteSelection,
columnName: '',
templateId: '',
@ -522,22 +521,45 @@ export default {
},
//
nameChange(){
const { columnName, level, id } = this.form
if (columnName && columnName !== this.originalName) {
this.$post(this.api.sameLevelJudgment, {
siteId: this.site.id,
columnName,
level: +level,
id: +id || ''
}).then(res => {
clearTimeout(this.nameTimer)
this.nameTimer = setTimeout(() => {
const { columnName, level, id } = this.form
if (columnName && columnName !== this.originalName) {
const data = {
siteId: this.site.id,
columnName,
level: +level,
}
if (id) data.id = +id
this.$post(this.api.sameLevelJudgment, data).then(res => {
this.nameRepeat = false
}).catch(res => {
this.nameRepeat = true
})
}else{
this.nameRepeat = false
}).catch(res => {
this.nameRepeat = true
})
}else{
this.nameRepeat = false
}
}, 500)
},
// level
getLevel(list, id) {
for (const e of list) {
if (e.id == id) {
this.level = e.level
break
} else if (e.children) {
this.getLevel(e.children, id)
}
}
},
//
fatherIdChange(val) {
const id= val[val.length - 1]
this.getLevel(this.columns, id)
this.form.level = this.level
this.form.id = id
this.nameChange()
},
//
customUpload(data) {
const formData = new FormData()

@ -237,8 +237,6 @@ export default {
methods: {
getData() {
this.$post(this.api.listWithTree, {
siteId: this.siteId,
columnName: this.keyword,
templateId: '',
@ -339,7 +337,7 @@ export default {
},
//
sort() {
// this.$post(this.api.deleteUselessData).then(res => {}).catch(err => {})
this.$post(this.api.deleteUselessData).then(res => {}).catch(err => {})
this.$post(this.api.listWithTree, {
siteId: this.siteId,

Loading…
Cancel
Save