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/测试环境
#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'

View File

@@ -1,4 +1,5 @@
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) {
return request({

View File

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

View File

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

View File

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

View File

@@ -365,6 +365,7 @@ import { getToken } from "@/utils/auth";
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { getArticleNav } from '../../../api/sist/article'
export default {
name: "User",
@@ -540,7 +541,31 @@ export default {
},
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 = {
attribute2: 1,
dictCode: 0,
@@ -554,16 +579,28 @@ export default {
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])
for (let item of data) {
if (item.sitetype === "1"){
let node = {
attribute2: 1,
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(lab)
})
},
// 树权限(展开/折叠)