parent
00f2117db3
commit
8d7049ec42
16 changed files with 404 additions and 14482 deletions
@ -1,75 +0,0 @@ |
||||
/** |
||||
* 栏目配置 |
||||
* */ |
||||
|
||||
export default { |
||||
// 栏目类型
|
||||
types: [ |
||||
{ |
||||
id: 1, |
||||
name: '常规栏目' |
||||
}, |
||||
{ |
||||
id: 2, |
||||
name: '跳转链接' |
||||
}, |
||||
{ |
||||
id: 3, |
||||
name: '长页栏目' |
||||
}, |
||||
{ |
||||
id: 4, |
||||
name: '子级优先栏目' |
||||
} |
||||
], |
||||
// 出版物类型
|
||||
publicationTypes: [ |
||||
{ |
||||
id: 1, |
||||
name: '科技图书' |
||||
}, |
||||
{ |
||||
id: 2, |
||||
name: '科技期刊' |
||||
}, |
||||
{ |
||||
id: 3, |
||||
name: '专利文献' |
||||
}, |
||||
{ |
||||
id: 4, |
||||
name: '会议文献' |
||||
}, |
||||
{ |
||||
id: 5, |
||||
name: '科技报告' |
||||
}, |
||||
{ |
||||
id: 6, |
||||
name: '政府出版物' |
||||
}, |
||||
{ |
||||
id: 7, |
||||
name: '学位论文' |
||||
}, |
||||
{ |
||||
id: 8, |
||||
name: '标准文献' |
||||
}, |
||||
{ |
||||
id: 9, |
||||
name: '产品资料和其它' |
||||
} |
||||
], |
||||
// 专利类别
|
||||
patentClasses: [ |
||||
{ |
||||
id: 1, |
||||
name: '发明专利' |
||||
}, |
||||
{ |
||||
id: 2, |
||||
name: '实用外观' |
||||
} |
||||
] |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,44 @@ |
||||
/** |
||||
* 栏目配置 |
||||
* */ |
||||
|
||||
export default { |
||||
// 角色
|
||||
platformSource: [ |
||||
{ |
||||
id: '', |
||||
name: '不限' |
||||
}, |
||||
{ |
||||
id: 7, |
||||
name: '个人' |
||||
}, |
||||
{ |
||||
id: 5, |
||||
name: '幼儿园' |
||||
}, |
||||
{ |
||||
id: 6, |
||||
name: '供应商' |
||||
}, |
||||
], |
||||
// 认证状态
|
||||
auditStatus: [ |
||||
{ |
||||
id: null, |
||||
name: '不限' |
||||
}, |
||||
{ |
||||
id: 0, |
||||
name: '默认待审核' |
||||
}, |
||||
{ |
||||
id: 1, |
||||
name: '通过' |
||||
}, |
||||
{ |
||||
id: 2, |
||||
name: '驳回' |
||||
}, |
||||
], |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -1,521 +0,0 @@ |
||||
<template> |
||||
<div class="flex page"> |
||||
<div style="width: 218px;border-right: 1px solid #EBEDF0"> |
||||
<p class="page-name mb">全部栏目</p> |
||||
<div style="height: calc(100% - 50px);overflow: auto"> |
||||
<el-tree ref="column" |
||||
:data="columns" |
||||
highlight-current |
||||
:expand-on-click-node="false" |
||||
default-expand-all |
||||
:props="defaultProps" |
||||
node-key="id" |
||||
@node-click="initData"> |
||||
<span class="custom-tree-node" |
||||
slot-scope="{ node, data }"> |
||||
<span class="org-name" |
||||
:title="node.label">{{ node.label }}</span> |
||||
</span> |
||||
</el-tree> |
||||
</div> |
||||
</div> |
||||
<div class="p-l-20" |
||||
style="width: calc(100% - 219px);"> |
||||
<div class="tool"> |
||||
<div class="search-wrap"> |
||||
<el-select v-model="field" |
||||
@change="initData"> |
||||
<el-option v-for="(item, i) in keywords" |
||||
:key="i" |
||||
:label="item.name" |
||||
:value="item.id"> |
||||
</el-option> |
||||
</el-select> |
||||
<el-input class="keyword" |
||||
:placeholder="'请输入' + keywords.find(e => e.id === field).name" |
||||
v-model.trim="keyword" |
||||
clearable></el-input> |
||||
</div> |
||||
<div class="actions"> |
||||
<el-dropdown class="setting" |
||||
trigger="click" |
||||
:hide-on-click="false"> |
||||
<img class="icon" |
||||
src="@/assets/images/setting.png" |
||||
alt=""> |
||||
<el-dropdown-menu> |
||||
<el-dropdown-item> |
||||
<el-button @click="resetColumns" |
||||
type="text">列重置</el-button> |
||||
</el-dropdown-item> |
||||
<el-dropdown-item v-for="(column, i) in settings" |
||||
:key="i" |
||||
:divided="i === 0"> |
||||
<el-checkbox v-model="column.show">{{ column.name }}</el-checkbox> |
||||
</el-dropdown-item> |
||||
</el-dropdown-menu> |
||||
</el-dropdown> |
||||
<el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:新增'" |
||||
type="primary" |
||||
@click="add">新增</el-button> |
||||
<el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:删除'" |
||||
@click="batchDel">删除</el-button> |
||||
</div> |
||||
</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"> |
||||
<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 v-if="settings[3].show" |
||||
prop="classificationName" |
||||
label="所属分类" |
||||
align="center" |
||||
min-width="120"></el-table-column> |
||||
<el-table-column v-if="settings[4].show" |
||||
prop="typeId" |
||||
label="栏目类型" |
||||
align="center" |
||||
min-width="100"> |
||||
<template slot-scope="scope"> |
||||
{{ types.find(e => e.id === scope.row.typeId).name }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column v-if="settings[5].show" |
||||
prop="founderName" |
||||
label="录入人" |
||||
align="center" |
||||
min-width="80"></el-table-column> |
||||
<el-table-column v-if="settings[6].show" |
||||
prop="editorName" |
||||
label="修改人" |
||||
align="center" |
||||
min-width="80"></el-table-column> |
||||
<el-table-column v-if="settings[7].show" |
||||
prop="updateTime" |
||||
label="修改日期" |
||||
align="center" |
||||
min-width="150" |
||||
sortable="custom"></el-table-column> |
||||
<el-table-column v-if="settings[8].show" |
||||
prop="releaseTime" |
||||
label="发布日期" |
||||
align="center" |
||||
min-width="100" |
||||
sortable="custom"></el-table-column> |
||||
<el-table-column v-if="settings[9].show" |
||||
prop="totalBrowsing" |
||||
label="总浏览" |
||||
align="center" |
||||
min-width="70"></el-table-column> |
||||
<el-table-column v-if="settings[10].show" |
||||
prop="workNumber" |
||||
label="状态" |
||||
align="center" |
||||
min-width="80"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.isRelease ? '已发布' : '草稿' }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column v-auth="'/site/list:' + siteName + ':内容管理:文章管理:置顶'" |
||||
prop="sequence" |
||||
label="置顶" |
||||
align="center" |
||||
min-width="80" |
||||
sortable="custom"> |
||||
<template slot-scope="scope"> |
||||
<i v-if="scope.row.isRelease" |
||||
:class="['squ-icon', scope.row.isTop ? 'el-icon-check' : 'el-icon-close']" |
||||
@click="sticky(scope.row)"></i> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column v-if="settings[11].show" |
||||
label="操作" |
||||
align="center" |
||||
width="190"> |
||||
<template slot-scope="scope"> |
||||
<el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:预览'" |
||||
type="text" |
||||
@click="preview(scope.row)">预览</el-button> |
||||
<el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:编辑'" |
||||
type="text" |
||||
@click="edit(scope.row)">编辑</el-button> |
||||
<el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:删除'" |
||||
type="text" |
||||
@click="handleDelete(scope.row)">删除</el-button> |
||||
<el-switch v-if="scope.row.isRelease" |
||||
v-auth="'/site/list:' + siteName + ':内容管理:文章管理:禁用'" |
||||
class="m-l-10" |
||||
v-model="scope.row.isDisable" |
||||
:active-value="0" |
||||
:inactive-value="1" |
||||
@change="switchOff($event, scope.row, scope.$index)"> |
||||
</el-switch> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background |
||||
@current-change="currentChange" |
||||
:current-page="page" |
||||
layout="total, prev, pager, next" |
||||
:total="total"></el-pagination> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import Setting from '@/setting' |
||||
import util from '@/libs/util' |
||||
import { mapMutations } from 'vuex' |
||||
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: [], |
||||
defaultProps: { |
||||
value: 'id', |
||||
label: 'columnName' |
||||
}, |
||||
field: 'title', |
||||
keywords: [ |
||||
{ |
||||
id: 'title', |
||||
name: '标题' |
||||
}, |
||||
{ |
||||
id: 'founder', |
||||
name: '录入人' |
||||
}, |
||||
{ |
||||
id: 'column', |
||||
name: '栏目' |
||||
}, |
||||
{ |
||||
id: 'editor', |
||||
name: '修改人' |
||||
} |
||||
], |
||||
keyword: '', |
||||
list: [], |
||||
page: 1, |
||||
pageSize: 10, |
||||
total: 0, |
||||
modifiedTimeSort: '', |
||||
publicationTimeSort: '', |
||||
topSort: '', |
||||
multipleSelection: [], |
||||
originSettings: [], |
||||
settings: [ |
||||
{ |
||||
name: '选择框', |
||||
show: true |
||||
}, |
||||
{ |
||||
name: '标题', |
||||
show: true |
||||
}, |
||||
{ |
||||
name: '栏目', |
||||
show: true |
||||
}, |
||||
{ |
||||
name: '所属分类', |
||||
show: false |
||||
}, |
||||
{ |
||||
name: '栏目类型', |
||||
show: true |
||||
}, |
||||
{ |
||||
name: '录入人', |
||||
show: true |
||||
}, |
||||
{ |
||||
name: '修改人', |
||||
show: true |
||||
}, |
||||
{ |
||||
name: '修改日期', |
||||
show: true |
||||
}, |
||||
{ |
||||
name: '发布日期', |
||||
show: true |
||||
}, |
||||
{ |
||||
name: '总浏览', |
||||
show: true |
||||
}, |
||||
{ |
||||
name: '状态', |
||||
show: true |
||||
}, |
||||
{ |
||||
name: '操作', |
||||
show: true |
||||
} |
||||
], |
||||
originList: [] |
||||
}; |
||||
}, |
||||
watch: { |
||||
keyword: function (val) { |
||||
clearTimeout(this.searchTimer) |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initData() |
||||
}, 500) |
||||
} |
||||
}, |
||||
mounted () { |
||||
this.$store.commit('user/setCrumbs', [ |
||||
{ |
||||
name: '站点管理', |
||||
route: '/site' |
||||
}, |
||||
{ |
||||
name: '内容管理' |
||||
}, |
||||
{ |
||||
name: '文章管理' |
||||
} |
||||
]) |
||||
this.originSettings = JSON.parse(JSON.stringify(this.settings)) |
||||
this.getColumn() |
||||
}, |
||||
methods: { |
||||
...mapMutations('content', [ |
||||
'setColumn' |
||||
]), |
||||
// 栏目树形 |
||||
getColumn () { |
||||
this.$post(this.api.listWithTree, { |
||||
siteId: this.$store.state.content.site.id, |
||||
columnName: '', |
||||
templateId: '', |
||||
typeId: '', |
||||
isSort: 1 |
||||
}).then(({ data }) => { |
||||
this.columns = data |
||||
this.$nextTick(() => { |
||||
this.$refs.column.setCurrentKey(this.$route.query.columnId || data[0].id) |
||||
this.getData() |
||||
}) |
||||
}).catch(e => { }) |
||||
}, |
||||
// 文章列表 |
||||
getData () { |
||||
const id = this.$refs.column.getCurrentKey() |
||||
this.$router.push(`/article?columnId=${id}`).catch(e => { }) |
||||
const { keyword } = this |
||||
const data = { |
||||
siteId: this.$store.state.content.site.id, |
||||
columnIds: [id], |
||||
pageNum: this.page, |
||||
pageSize: this.pageSize, |
||||
topSort: this.topSort, |
||||
title: this.field === 'title' ? keyword : '', |
||||
founder: this.field === 'founder' ? keyword : '', |
||||
column: this.field === 'column' ? keyword : '', |
||||
editor: this.field === 'editor' ? keyword : '' |
||||
} |
||||
if (this.modifiedTimeSort !== '') data.modifiedTimeSort = this.modifiedTimeSort |
||||
if (this.publicationTimeSort !== '') data.publicationTimeSort = this.publicationTimeSort |
||||
this.$post(this.api.queryArticle, data).then(({ data }) => { |
||||
data.records.map(e => { |
||||
e.editing = false |
||||
e.releaseTime = e.releaseTime.split(' ')[0] |
||||
}) |
||||
this.originList = JSON.parse(JSON.stringify(data.records)) |
||||
this.list = data.records |
||||
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 => { }) |
||||
}, |
||||
// 重置栏位筛选 |
||||
resetColumns () { |
||||
this.settings = JSON.parse(JSON.stringify(this.originSettings)) |
||||
}, |
||||
currentChange (val) { |
||||
this.page = val |
||||
this.getData() |
||||
}, |
||||
handleSelectionChange (val) { |
||||
this.multipleSelection = val |
||||
}, |
||||
initData () { |
||||
this.$refs.table.clearSelection() |
||||
this.page = 1 |
||||
this.getData() |
||||
}, |
||||
// 排序提交 |
||||
submitSequence (row) { |
||||
const { sequence } = row |
||||
if (!sequence) return util.errorMsg('请输入排序') |
||||
if (isNaN(sequence)) return util.errorMsg('请输入数字') |
||||
this.$post(`${this.api.modifiedSort}?articleId=${row.id}&sequenceNumber=${sequence > this.total ? this.total : sequence}`).then(res => { |
||||
this.initData() |
||||
}).catch(res => { }) |
||||
}, |
||||
// 编辑排序 |
||||
editSequence (row) { |
||||
this.list.forEach(e => { |
||||
e.editing = false |
||||
}) |
||||
row.editing = true |
||||
}, |
||||
// 批量删除 |
||||
batchDel () { |
||||
const list = this.multipleSelection |
||||
if (list.length) { |
||||
this.$confirm('确定要删除吗?', '提示', { |
||||
type: 'warning' |
||||
}).then(() => { |
||||
const data = [] |
||||
list.map(e => { |
||||
data.push('ids=' + e.id) |
||||
}) |
||||
this.$post(`${this.api.deleteArticle}?${data.join('&')}`).then(res => { |
||||
this.$refs.table.clearSelection() |
||||
util.successMsg("删除成功") |
||||
this.getData() |
||||
}).catch(res => { }) |
||||
}).catch(() => { }) |
||||
} else { |
||||
util.errorMsg('请先选择数据 !') |
||||
} |
||||
}, |
||||
// 删除 |
||||
handleDelete (row) { |
||||
this.$confirm('确定要删除吗?', '提示', { |
||||
type: 'warning' |
||||
}).then(() => { |
||||
this.$post(`${this.api.deleteArticle}?ids=${row.id}`).then(res => { |
||||
util.successMsg('删除成功') |
||||
this.getData() |
||||
}).catch(res => { }) |
||||
}).catch(() => { }) |
||||
}, |
||||
// 禁用启用 |
||||
switchOff (val, row) { |
||||
this.$post(`${this.api.articleEnableOrDisable}?id=${row.id}&isDisable=${val}`).then(res => { }).catch((res) => { }) |
||||
}, |
||||
// 新增 |
||||
add () { |
||||
if (!this.columns.length) return util.errorMsg('请添加栏目') |
||||
this.setColumn(this.$refs.column.getCurrentNode()) |
||||
this.$router.push(`add?columnId=${this.$refs.column.getCurrentKey()}&columnName=${this.$refs.column.getCurrentNode().columnName}`) |
||||
}, |
||||
// 排序回调 |
||||
sortChange (column) { |
||||
const { order } = column |
||||
// 三个排序只能同时传1个,所以点了一个排序的时候要清除掉其余两个 |
||||
// 两个时间0默认倒序 1升序 |
||||
if (column.prop === 'updateTime') { |
||||
this.modifiedTimeSort = order ? order === 'ascending' ? 1 : 0 : '' |
||||
if (order) { |
||||
this.publicationTimeSort = '' |
||||
this.topSort = '' |
||||
} |
||||
} |
||||
if (column.prop === 'releaseTime') { |
||||
this.publicationTimeSort = order ? order === 'ascending' ? 1 : 0 : '' |
||||
if (order) { |
||||
this.modifiedTimeSort = '' |
||||
this.topSort = '' |
||||
} |
||||
} |
||||
// 序号排序 0默认升序 1倒序 |
||||
if (column.prop === 'sequence') { |
||||
this.topSort = order ? order === 'ascending' ? 0 : 1 : '' |
||||
if (order) { |
||||
this.publicationTimeSort = '' |
||||
this.modifiedTimeSort = '' |
||||
} |
||||
} |
||||
this.getData() |
||||
}, |
||||
// 置顶 |
||||
sticky (row) { |
||||
this.$post(`${this.api.articleTopOperation}?articleId=${row.id}&isTop=${row.isTop ? 0 : 1}`).then(res => { |
||||
this.initData() |
||||
}).catch(res => { }) |
||||
}, |
||||
// 预览 |
||||
preview (row) { |
||||
window.open((Setting.isDev ? `http://${location.hostname}:8097` : this.$store.state.content.site.domainName) + `#/article?articleId=${row.id}&siteId=${this.$refs.column.getCurrentNode().siteId}&id=${row.columnId}`) |
||||
}, |
||||
// 编辑 |
||||
edit (row) { |
||||
this.$router.push(`add?id=${row.id}&columnId=${this.$refs.column.getCurrentKey()}&columnName=${this.$refs.column.getCurrentNode().columnName}`) |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.custom-tree-node { |
||||
display: inline-flex; |
||||
align-items: center; |
||||
} |
||||
.name { |
||||
display: inline-block; |
||||
max-width: 160px; |
||||
margin-right: 20px; |
||||
overflow: hidden; |
||||
text-overflow: ellipsis; |
||||
} |
||||
.squ-icon { |
||||
font-size: 16px; |
||||
font-weight: 600; |
||||
cursor: pointer; |
||||
color: #f70000; |
||||
&.el-icon-check { |
||||
color: #05991e; |
||||
} |
||||
} |
||||
/deep/.squ-input { |
||||
width: auto; |
||||
.el-input__inner { |
||||
width: 60px; |
||||
padding: 0 10px; |
||||
} |
||||
} |
||||
</style> |
Loading…
Reference in new issue