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. 42
      src/pages/column/add/index.vue
  4. 4
      src/pages/column/list/index.vue

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

@ -37,7 +37,11 @@
</div> </div>
<el-table :data="list" class="table" ref="table" header-align="center" @selection-change="handleSelectionChange" row-key="id" @sort-change="sortChange"> <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 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[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 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> <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 { export default {
data() { data() {
return { return {
last: this.$route.query.last, //
types: ColumnConst.types, types: ColumnConst.types,
siteName: this.$store.state.content.site.siteName, siteName: this.$store.state.content.site.siteName,
columns: [], columns: [],
@ -126,7 +131,7 @@ export default {
total: 0, total: 0,
modifiedTimeSort: '', modifiedTimeSort: '',
publicationTimeSort: '', publicationTimeSort: '',
ordinalSort: 0, topSort: 0,
multipleSelection: [], multipleSelection: [],
originSettings: [], originSettings: [],
settings: [ settings: [
@ -232,7 +237,7 @@ export default {
columnIds: [id], columnIds: [id],
pageNum: this.page, pageNum: this.page,
pageSize: this.pageSize, pageSize: this.pageSize,
ordinalSort: this.ordinalSort, topSort: this.topSort,
title: this.field === 'title' ? keyword : '', title: this.field === 'title' ? keyword : '',
founder: this.field === 'founder' ? keyword : '', founder: this.field === 'founder' ? keyword : '',
column: this.field === 'column' ? keyword : '', column: this.field === 'column' ? keyword : '',
@ -247,7 +252,15 @@ export default {
}) })
this.originList = JSON.parse(JSON.stringify(data.records)) this.originList = JSON.parse(JSON.stringify(data.records))
this.list = 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 => {}) }).catch(err => {})
}, },
// //
@ -333,19 +346,19 @@ export default {
this.modifiedTimeSort = order ? order === 'ascending' ? 1 : 0 : '' this.modifiedTimeSort = order ? order === 'ascending' ? 1 : 0 : ''
if (order) { if (order) {
this.publicationTimeSort = '' this.publicationTimeSort = ''
this.ordinalSort = '' this.topSort = ''
} }
} }
if (column.prop === 'releaseTime') { if (column.prop === 'releaseTime') {
this.publicationTimeSort = order ? order === 'ascending' ? 1 : 0 : '' this.publicationTimeSort = order ? order === 'ascending' ? 1 : 0 : ''
if (order) { if (order) {
this.modifiedTimeSort = '' this.modifiedTimeSort = ''
this.ordinalSort = '' this.topSort = ''
} }
} }
// 0 1 // 0 1
if (column.prop === 'sequence') { if (column.prop === 'sequence') {
this.ordinalSort = order ? order === 'ascending' ? 0 : 1 : '' this.topSort = order ? order === 'ascending' ? 0 : 1 : ''
if (order) { if (order) {
this.publicationTimeSort = '' this.publicationTimeSort = ''
this.modifiedTimeSort = '' this.modifiedTimeSort = ''

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

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

Loading…
Cancel
Save