clay commit : 第一阶段完成

This commit is contained in:
clay
2022-09-25 16:48:26 +08:00
parent b7e8c3609b
commit f7e2effec6
6 changed files with 320 additions and 142 deletions

View File

@@ -5,5 +5,4 @@ ENV = 'staging'
# EBTS/测试环境 # EBTS/测试环境
#VUE_APP_BASE_API = '/dev-api' #VUE_APP_BASE_API = '/dev-api'
#VUE_APP_BASE_API = 'http://sistapi.hchyun.cn/dev-api'
VUE_APP_BASE_API = 'http://192.168.190.67/dev-api' VUE_APP_BASE_API = 'http://192.168.190.67/dev-api'

View File

@@ -1,4 +1,5 @@
import request from '@/utils/request' import request from '@/utils/request'
import da from 'element-ui/src/locale/lang/da'
// 查询系统文章列表 // 查询系统文章列表
@@ -105,6 +106,16 @@ export function updateArticle(data) {
}) })
} }
// 修改系统文章
export function putIndex(data) {
console.log(data,"data")
return request({
url: '/sist/article/index',
method: 'put',
data: data
})
}
// 删除系统文章 // 删除系统文章
export function delArticle(id) { export function delArticle(id) {
return request({ return request({

View File

@@ -231,9 +231,9 @@ export default {
this.getDicts("article_site_type").then(response => { this.getDicts("article_site_type").then(response => {
this.sitetypeOptions = response.data; this.sitetypeOptions = response.data;
}); });
this.getDicts("article_type").then(response => { // this.getDicts("article_type").then(response => {
this.articleTypeOptions = response.data; // this.articleTypeOptions = response.data;
}); // });
this.getDicts("is_top").then(response => { this.getDicts("is_top").then(response => {
this.isTopOptions = response.data; this.isTopOptions = response.data;
}); });
@@ -246,9 +246,9 @@ export default {
this.getDicts("article_status").then(response => { this.getDicts("article_status").then(response => {
this.statusOptions = response.data; this.statusOptions = response.data;
}); });
getArticleNav().then(res=>{ getArticleNav().then(res=>{
let data = res.data let data = res.data
this.articleTypeOptions = data
for (let item of data) { for (let item of data) {
if (item.sitetype == 1){ if (item.sitetype == 1){
this.sistArticleTypeOption.push(item) this.sistArticleTypeOption.push(item)
@@ -256,11 +256,8 @@ export default {
this.labArticleTypeOption.push(item) this.labArticleTypeOption.push(item)
} }
} }
console.log(res) console.log(res)
}) })
// getArticleType().then(res => { // getArticleType().then(res => {
// let dictCodes = res.data // let dictCodes = res.data
// let articleList = this.articleTypeOptions // let articleList = this.articleTypeOptions
@@ -281,22 +278,23 @@ export default {
mounted() { mounted() {
}, },
methods: { methods: {
getSistApprove(dictCode) { getSistApprove(navId) {
this.judgeThumbnail(dictCode) this.judgeThumbnail(navId)
getArticleApprove(dictCode).then(res => { getArticleApprove(navId).then(res => {
this.sistApproveOption = res.data this.sistApproveOption = res.data
}) })
}, },
getLabApprove(dictCode) { getLabApprove(navId) {
this.judgeThumbnail(dictCode) this.judgeThumbnail(navId)
getArticleApprove(dictCode).then(res => { getArticleApprove(navId).then(res => {
this.labApproveOption = res.data this.labApproveOption = res.data
}) })
}, },
judgeThumbnail(dictCode){ judgeThumbnail(navId){
let articleList = this.articleTypeOptions let articleList = this.articleTypeOptions
for (let article of articleList) { for (let article of articleList) {
if (dictCode === article.dictCode && article.attribute1 == 1){ console.log(article.title)
if (navId === article.id && article.isThumbnail == 1){
this.imgurlShow = true this.imgurlShow = true
return return
} }

View File

@@ -12,16 +12,16 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="文章类型" prop="type"> <el-form-item label="文章类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择文章类型" clearable size="small"> <el-select v-model="queryParams.navId" placeholder="请选择文章类型" clearable size="small">
<el-option <el-option
v-for="dict in articleTypeOptions" v-for="item in articleTypeOptions"
:key="dict.dictCode" :key="item.id"
:label="dict.dictLabel" :label="item.title"
:value="dict.dictCode" :value="item.id"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="是否置顶" prop="isTop"> <el-form-item label="显示类型" prop="isTop">
<el-select v-model="queryParams.isTop" placeholder="请选择是否置顶" clearable size="small"> <el-select v-model="queryParams.isTop" placeholder="请选择是否置顶" clearable size="small">
<el-option <el-option
v-for="dict in isTopOptions" v-for="dict in isTopOptions"
@@ -31,13 +31,13 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="是否显示" prop="isView"> <el-form-item label="首页推送" prop="isView">
<el-select v-model="queryParams.isView" placeholder="请选择是否显示" clearable size="small"> <el-select v-model="queryParams.type" placeholder="请选择是否显示" clearable size="small">
<el-option <el-option
v-for="dict in isViewOptions" v-for="item in putIndexOptions"
:key="dict.dictValue" :key="item.value"
:label="dict.dictLabel" :label="item.label"
:value="dict.dictValue" :value="item.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@@ -118,14 +118,15 @@
<el-table-column label="站点类型" align="center" prop="siteType" :formatter="siteTypeFormat"/> <el-table-column label="站点类型" align="center" prop="siteType" :formatter="siteTypeFormat"/>
<el-table-column label="文章类型" align="center" prop="type" :formatter="articleTypeFormat"/> <el-table-column label="文章类型" align="center" prop="type" :formatter="articleTypeFormat"/>
<el-table-column label="发布人姓名" align="center" prop="publishUserName"/> <el-table-column label="发布人姓名" align="center" prop="publishUserName"/>
<el-table-column label="是否置顶" align="center" prop="isTop" :formatter="isTopFormat"/> <el-table-column label="显示类型" align="center" prop="isTop" :formatter="isTopFormat"/>
<!-- <el-table-column label="是否显示" align="center" prop="isView" :formatter="isViewFormat"/>--> <!-- <el-table-column label="是否显示" align="center" prop="isView" :formatter="isViewFormat"/>-->
<el-table-column label="查看次数" align="center" prop="viewCount"/> <el-table-column label="查看次数" align="center" prop="viewCount"/>
<el-table-column label="缩略图" align="center" prop="imgurl"> <el-table-column label="缩略图" align="center" prop="imgurl">
<template slot-scope="scope"> <template slot-scope="scope">
<img style="width: 100%;" :src="scope.row.imgurl" alt=""> <img style="width: 100%;" :src="scope.row.imgurl" alt="">
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="推送首页" align="center" prop="isEnglish" :formatter="isIndexFormat"/>
<el-table-column label="是否英文" align="center" prop="isEnglish" :formatter="isEnglishFormat"/> <el-table-column label="是否英文" align="center" prop="isEnglish" :formatter="isEnglishFormat"/>
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormat"/> <el-table-column label="状态" align="center" prop="status" :formatter="statusFormat"/>
<!-- <template slot-scope="scope">--> <!-- <template slot-scope="scope">-->
@@ -145,11 +146,11 @@
<!-- disable-transitions>完成--> <!-- disable-transitions>完成-->
<!-- </el-tag>--> <!-- </el-tag>-->
<!-- </template>--> <!-- </template>-->
<el-table-column label="修改时间 " align="center" prop="createTime" width="180"> <!-- <el-table-column label="修改时间 " align="center" prop="createTime" width="180">-->
<template slot-scope="scope"> <!-- <template slot-scope="scope">-->
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span> <!-- <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>-->
</template> <!-- </template>-->
</el-table-column> <!-- </el-table-column>-->
<el-table-column label="发布时间 " align="center" prop="publishTime" width="180"> <el-table-column label="发布时间 " align="center" prop="publishTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.publishTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span> <span>{{ parseTime(scope.row.publishTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
@@ -182,13 +183,22 @@
@click="handleApprova(scope.row)" @click="handleApprova(scope.row)"
>审批 >审批
</el-button> </el-button>
<el-button v-show="scope.row.approvalUserId===userId && scope.row.status === '3'" <span v-show="scope.row.approvalUserId===userId && scope.row.status === '3'">
size="mini" <el-button
type="text" size="mini"
icon="el-icon-edit" type="text"
@click="handleOffline(scope.row)" icon="el-icon-edit"
@click="handlePutIndex(scope.row)"
>推首页
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleOffline(scope.row)"
>下线 >下线
</el-button> </el-button>
</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -200,18 +210,48 @@
:limit.sync="queryParams.pageInfo.pageSize" :limit.sync="queryParams.pageInfo.pageSize"
@pagination="getList" @pagination="getList"
/> />
<el-dialog title="编辑详情" :visible="putIndexShow" width="1100px" :close-on-click-modal="false" @close="detailsClose()"
append-to-body
>
<el-form :model="formData" size="medium" label-width="100px">
<!-- <el-form-item label="详情标题" prop="title">-->
<el-form-item label="文章标题">
<el-input disabled v-model="formData.title" clearable :style="{width: '100%'}">
</el-input>
</el-form-item>
<el-form-item label="文章标题">
<el-select v-model="formData.type" placeholder="推送模块" clearable :style="{width: '100%'}">
<el-option
v-for="item in putIndexOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="doPutIndex"> </el-button>
<el-button @click="detailsClose"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import {listArticle, delArticle, exportArticle, offline} from "@/api/sist/article"; import { listArticle, delArticle, exportArticle, offline, putIndex } from '@/api/sist/article'
import Editor from '@/components/Editor'; import Editor from '@/components/Editor'
import store from "@/store"; import store from '@/store'
import { getArticleNav } from '../../../api/sist/article'
export default { export default {
name: "Article", name: 'Article',
components: { components: {
Editor, Editor
}, },
data() { data() {
return { return {
@@ -226,12 +266,36 @@ export default {
multiple: true, multiple: true,
// 显示搜索条件 // 显示搜索条件
showSearch: true, showSearch: true,
putIndexShow: false,
formData: {},
// 总条数 // 总条数
total: 0, total: 0,
// 文章表格数据 // 文章表格数据
articleList: [], articleList: [],
putIndexOptions: [
{
value: "1",
label: '新闻中心'
},
{
value: "2",
label: '科学研究'
},
{
value: "3",
label: '学术交流'
},
{
value: "4",
label: '党史教育'
},
{
value: "5",
label: '教学工作'
}
],
// 弹出层标题 // 弹出层标题
title: "", title: '',
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
// 站点类型 1 sist 2: lab 3: 双边都发字典 // 站点类型 1 sist 2: lab 3: 双边都发字典
@@ -251,7 +315,7 @@ export default {
queryParams: { queryParams: {
pageInfo: { pageInfo: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10
}, },
params: {}, params: {},
siteType: null, siteType: null,
@@ -265,107 +329,130 @@ export default {
// 表单校验 // 表单校验
rules: { rules: {
siteType: [ siteType: [
{required: true, message: "站点类型", trigger: "change"}, { required: true, message: '站点类型', trigger: 'change' }
], ],
type: [ type: [
{required: true, message: "", trigger: "change"}, { required: true, message: '', trigger: 'change' }
], ],
content: [ content: [
{required: true, message: "文章内容不能为空", trigger: "blur"}, { required: true, message: '文章内容不能为空', trigger: 'blur' }
], ],
title: [ title: [
{required: true, message: "文章标题不能为空", trigger: "blur"}, { required: true, message: '文章标题不能为空', trigger: 'blur' }
], ],
publishTime: [ publishTime: [
{required: true, message: "发布时间", trigger: "blur"}, { required: true, message: '发布时间', trigger: 'blur' }
], ],
publishUserName: [ publishUserName: [
{required: true, message: "发布人姓名不能为空", trigger: "blur"}, { required: true, message: '发布人姓名不能为空', trigger: 'blur' }
], ],
isTop: [ isTop: [
{required: true, message: "是否置顶不能为空", trigger: "change"}, { required: true, message: '是否置顶不能为空', trigger: 'change' }
], ],
isView: [ isView: [
{required: true, message: "是否显示不能为空", trigger: "change"}, { required: true, message: '是否显示不能为空', trigger: 'change' }
], ],
isEnglish: [ isEnglish: [
{required: true, message: "是否英文不能为空", trigger: "blur"}, { required: true, message: '是否英文不能为空', trigger: 'blur' }
], ]
} }
}; }
},
mounted() {
this.getList()
}, },
created() { created() {
this.getList(); getArticleNav().then(res=>{
this.getDicts("article_site_type").then(response => { let data = res.data
this.siteTypeOptions = response.data; this.articleTypeOptions = data
}); })
this.getDicts("article_type").then(response => { this.getDicts('article_site_type').then(response => {
this.articleTypeOptions = response.data; this.siteTypeOptions = response.data
}); })
this.getDicts("is_top").then(response => { // this.getDicts('article_type').then(response => {
this.isTopOptions = response.data; // this.articleTypeOptions = response.data
}); // })
this.getDicts("is_view").then(response => { this.getDicts('is_top').then(response => {
this.isViewOptions = response.data; this.isTopOptions = response.data
}); })
this.getDicts("is_english").then(response => { this.getDicts('is_view').then(response => {
this.isEnglishOptions = response.data; this.isViewOptions = response.data
}); })
this.getDicts("article_status").then(response => { this.getDicts('is_english').then(response => {
this.statusOptions = response.data; this.isEnglishOptions = response.data
}); })
}, this.getDicts('article_status').then(response => {
activated() { this.statusOptions = response.data
this.getList(); })
}, },
// activated() {
// this.getList()
// },
methods: { methods: {
/** 查询文章列表 */ /** 查询文章列表 */
getList() { getList() {
this.loading = true; this.loading = true
listArticle(this.queryParams).then(response => { listArticle(this.queryParams).then(response => {
this.articleList = response.rows; this.articleList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
}); })
}, },
// 站点类型 1 sist 2: lab 3: 双边都发字典翻译 // 站点类型 1 sist 2: lab 3: 双边都发字典翻译
siteTypeFormat(row, column) { siteTypeFormat(row, column) {
return this.selectDictLabel(this.siteTypeOptions, row.siteType); return this.selectDictLabel(this.siteTypeOptions, row.siteType)
}, },
// 1: 2: 3: 根据导航字典翻译 // 1: 2: 3: 根据导航字典翻译
articleTypeFormat(row, column) { articleTypeFormat(row, column) {
return this.selectDictCode(this.articleTypeOptions, row.type); for (let articleTypeOption of this.articleTypeOptions) {
if (row.navId == articleTypeOption.id){
return articleTypeOption.title
}
}
// return this.selectDictCode(this.articleTypeOptions, row.type)
}, },
// 是否置顶字典翻译 // 是否置顶字典翻译
isTopFormat(row, column) { isTopFormat(row, column) {
return this.selectDictLabel(this.isTopOptions, row.isTop); return this.selectDictLabel(this.isTopOptions, row.isTop)
}, },
// 是否显示字典翻译 // 是否显示字典翻译
isViewFormat(row, column) { isViewFormat(row, column) {
return this.selectDictLabel(this.isViewOptions, row.isView); return this.selectDictLabel(this.isViewOptions, row.isView)
}, },
// 是否英文字典翻译 // 是否英文字典翻译
isEnglishFormat(row, column) { isEnglishFormat(row, column) {
return this.selectDictLabel(this.isEnglishOptions, row.isEnglish); return this.selectDictLabel(this.isEnglishOptions, row.isEnglish)
},
// 是否英文字典翻译
isIndexFormat(row, column) {
for (let putIndexOption of this.putIndexOptions) {
if (row.type == putIndexOption.value){
return putIndexOption.label
}
}
}, },
// 状态: 1编辑中 2待审核 3: 审核完成字典翻译 // 状态: 1编辑中 2待审核 3: 审核完成字典翻译
statusFormat(row, column) { statusFormat(row, column) {
return this.selectDictLabel(this.statusOptions, row.status); return this.selectDictLabel(this.statusOptions, row.status)
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
@@ -375,60 +462,82 @@ export default {
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.$router.push("/article/add"); this.$router.push('/article/add')
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.$router.push("/article/edit/" + row.id); this.$router.push('/article/edit/' + row.id)
}, },
/** 审批按钮操作 */ /** 审批按钮操作 */
handleApprova(row) { handleApprova(row) {
this.$router.push("/article/approve/" + row.id); this.$router.push('/article/approve/' + row.id)
},
//推首页
handlePutIndex(row) {
this.formData = {
id: row.id,
type: row.type == "0" ? null : row.type,
title: row.title
}
console.log(this.formData)
this.putIndexShow = true
},
doPutIndex() {
console.log(this.formData)
let data = this.formData
putIndex(data).then(res=>{
console.log(res)
})
this.putIndexShow = false
}, },
handleOffline(row) { handleOffline(row) {
let that_ = this let that_ = this
this.$confirm('是否确认下线标题为:"' + row.title + '"的数据项?', "警告", { this.$confirm('是否确认下线标题为:"' + row.title + '"的数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function() {
that_.loading = true; that_.loading = true
return offline(row.id); return offline(row.id)
}).then(res => { }).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.msgSuccess("下线成功"); this.msgSuccess('下线成功')
this.getList() this.getList()
} }
that_.loading = false; that_.loading = false
}) })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids
this.$confirm('是否确认删除该文章的数据项?', "警告", { this.$confirm('是否确认删除该文章的数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function() {
return delArticle(ids); return delArticle(ids)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}) })
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.queryParams; const queryParams = this.queryParams
this.$confirm('是否确认导出所有文章数据项?', "警告", { this.$confirm('是否确认导出所有文章数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function() {
return exportArticle(queryParams); return exportArticle(queryParams)
}).then(response => { }).then(response => {
this.download(response.msg); this.download(response.msg)
}) })
},
detailsClose() {
this.putIndexShow = false
} }
} }
}; }
</script> </script>

View File

@@ -129,16 +129,25 @@
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="内容类型" prop="refId" v-show="articleSelShow"> <el-form-item label="缩略图" prop="isThumbnail" v-show="articleSelShow">
<el-select v-model="form.refId" placeholder="请选择内容类型" clearable :style="{width: '100%'}"> <el-radio-group v-model="form.isThumbnail">
<el-option <el-radio-button
v-for="dict in articleTypeOptions" v-for="dict in thumbnailOptions"
:key="dict.dictCode" :key="dict.key"
:label="dict.dictLabel" :label="dict.key"
:value="dict.dictCode" >{{dict.label}}</el-radio-button>
/> </el-radio-group>
</el-select>
</el-form-item> </el-form-item>
<!-- <el-form-item label="内容类型" prop="refId" v-show="articleSelShow">-->
<!-- <el-select v-model="form.refId" placeholder="请选择内容类型" clearable :style="{width: '100%'}">-->
<!-- <el-option-->
<!-- v-for="dict in articleTypeOptions"-->
<!-- :key="dict.dictCode"-->
<!-- :label="dict.dictLabel"-->
<!-- :value="dict.dictCode"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="中文层次数据" prop="refId" v-show="empleeSelShow"> <el-form-item label="中文层次数据" prop="refId" v-show="empleeSelShow">
<el-select v-model="form.refId" placeholder="请选择层次数据" clearable :style="{width: '100%'}"> <el-select v-model="form.refId" placeholder="请选择层次数据" clearable :style="{width: '100%'}">
<el-option <el-option
@@ -217,6 +226,7 @@ import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import Editor from "@/components/Editor" import Editor from "@/components/Editor"
import UploadFile from '@/views/utils/uploadFile' import UploadFile from '@/views/utils/uploadFile'
import { getArticleNav } from '../../../api/sist/article'
export default { export default {
name: "Navigation", name: "Navigation",
@@ -241,6 +251,16 @@ export default {
imageShow:false, imageShow:false,
// 导航表格数据 // 导航表格数据
navigationTypeOptions: [], navigationTypeOptions: [],
thumbnailOptions: [
{
key:0,
label:"无",
},
{
key:1,
label:"有",
},
],
// 导航树选项 // 导航树选项
navigationList: [], navigationList: [],
articleTypeOptions: [], articleTypeOptions: [],
@@ -450,6 +470,10 @@ export default {
} }
getNavigation(row.id).then(response => { getNavigation(row.id).then(response => {
this.form = response.data; this.form = response.data;
console.log(this.form,"this.form")
if (this.form.isThumbnail == null){
this.form.isThumbnail = 0
}
console.log(response.data,"data") console.log(response.data,"data")
if (this.form.pid == 0) { if (this.form.pid == 0) {
this.form.ptitle = "顶级节点" this.form.ptitle = "顶级节点"

View File

@@ -365,6 +365,7 @@ import { getToken } from "@/utils/auth";
import { treeselect } from "@/api/system/dept"; import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { getArticleNav } from '../../../api/sist/article'
export default { export default {
name: "User", name: "User",
@@ -540,7 +541,31 @@ export default {
}, },
getSiteTypeTree() { getSiteTypeTree() {
this.getDicts('article_type').then(res => { // this.getDicts('article_type').then(res => {
// let sist = {
// attribute2: 1,
// dictCode: 0,
// dictLabel: "信息网站",
// children: [],
// }
// let lab = {
// attribute2: 2,
// dictCode: 1,
// dictLabel: "lab实验室",
// children: [],
// }
// let data = res.data
// for (let i = 0; i < data.length; i++) {
// if (data[i].attribute2 === 1) {
// sist.children.push(data[i])
// } else {
// lab.children.push(data[i])
// }
// }
// this.siteTypeOptions.push(sist)
// this.siteTypeOptions.push(lab)
// })
getArticleNav().then(res=>{
let sist = { let sist = {
attribute2: 1, attribute2: 1,
dictCode: 0, dictCode: 0,
@@ -554,16 +579,28 @@ export default {
children: [], children: [],
} }
let data = res.data let data = res.data
for (let i = 0; i < data.length; i++) { for (let item of data) {
if (data[i].attribute2 === 1) { if (item.sitetype === "1"){
sist.children.push(data[i]) let node = {
} else { attribute2: 1,
lab.children.push(data[i]) dictCode: item.id,
dictLabel: item.title,
}
sist.children.push(node)
}else {
let node = {
attribute2: 2,
dictCode: item.id,
dictLabel: item.title,
}
lab.children.push(node)
} }
} }
console.log(res)
this.siteTypeOptions.push(sist) this.siteTypeOptions.push(sist)
this.siteTypeOptions.push(lab) this.siteTypeOptions.push(lab)
}) })
}, },
// 树权限(展开/折叠) // 树权限(展开/折叠)