fix:待发布版本

master
msgroup 3 years ago committed by mingsoft
parent bb7b7a5277
commit 3dfe9c6901
  1. 644
      src/main/webapp/WEB-INF/manager/cms/category/index.ftl

@ -1,339 +1,353 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>分类</title> <title>分类</title>
<#include "../../include/head-file.ftl"> <#include "../../include/head-file.ftl">
<script src="${base}/static/plugins/clipboard/clipboard.js"></script> <script src="${base}/static/plugins/clipboard/clipboard.js"></script>
</head> </head>
<body> <body>
<div id="index" class="ms-index" v-cloak> <div id="index" class="ms-index" v-cloak>
<el-header class="ms-header" height="50px"> <el-header class="ms-header" height="50px">
<el-col :span="12"> <el-col :span="12">
<@shiro.hasPermission name="cms:category:save"> <@shiro.hasPermission name="cms:category:save">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="save()">新增</el-button> <el-button type="primary" icon="el-icon-plus" size="mini" @click="save()">新增</el-button>
</@shiro.hasPermission> </@shiro.hasPermission>
<@shiro.hasPermission name="cms:category:del"> <@shiro.hasPermission name="cms:category:del">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="del(selectionList)" :disabled="!selectionList.length">删除</el-button> <el-button type="danger" icon="el-icon-delete" size="mini" @click="del(selectionList)"
</@shiro.hasPermission> :disabled="!selectionList.length">删除
</el-col> </el-button>
</el-header> </@shiro.hasPermission>
<el-main class="ms-container"> </el-col>
<el-table ref="multipleTable" :indent="6" </el-header>
height="calc(100vh - 20px)" <el-main class="ms-container">
border :data="dataList" <el-table ref="multipleTable" :indent="6"
row-key="id" height="calc(100vh - 20px)"
v-loading="loading" border :data="dataList"
default-expand-all='true' row-key="id"
:tree-props="{children: 'children'}" v-loading="loading"
tooltip-effect="dark" default-expand-all='true'
@selection-change="handleSelectionChange"> :tree-props="{children: 'children'}"
<template slot="empty"> tooltip-effect="dark"
{{emptyText}} @selection-change="handleSelectionChange">
</template> <template slot="empty">
<el-table-column type="selection" width="40"></el-table-column> {{emptyText}}
<el-table-column label="编号" width="100" prop="id" show-overflow-tooltip> </template>
<template slot='header'>编号 <el-table-column type="selection" width="40"></el-table-column>
<el-popover placement="top-start" title="提示" trigger="hover" > <el-table-column label="编号" width="100" prop="id" show-overflow-tooltip>
标签:<a href="http://doc.mingsoft.net/mcms/biao-qian/lan-mu-lie-biao-ms-channel.html" target="_blank">${'$'}{field.id}</a> <template slot='header'>编号
<i class="el-icon-question" slot="reference"></i> <el-popover placement="top-start" title="提示" trigger="hover">
</el-popover> 标签:<a href="http://doc.mingsoft.net/mcms/biao-qian/lan-mu-lie-biao-ms-channel.html"
</template> target="_blank">${'$'}{field.id}</a>
<template slot-scope="scope"> <i class="el-icon-question" slot="reference"></i>
<span style="cursor: pointer" class="copyBtn" :data-clipboard-text="scope.row.id" @click="copyContent(true)">{{scope.row.id}}</span> </el-popover>
</template> </template>
</el-table-column> <template slot-scope="scope">
<el-table-column label="标题" align="left" prop="categoryTitle"> <span style="cursor: pointer" class="copyBtn" :data-clipboard-text="scope.row.id"
</el-table-column> @click="copyContent(true)">{{scope.row.id}}</span>
</template>
</el-table-column>
<el-table-column label="标题" align="left" prop="categoryTitle">
</el-table-column>
<el-table-column label="类型" align="center" prop="categoryType" :formatter="categoryTypeFormat" width="70"> <el-table-column label="类型" align="center" prop="categoryType" :formatter="categoryTypeFormat" width="70">
</el-table-column> </el-table-column>
<el-table-column label="排序" align="center" prop="categorySort" width="70"> <el-table-column label="排序" align="center" prop="categorySort" width="70">
</el-table-column> </el-table-column>
<el-table-column label="链接地址" align="left" prop="categoryPath" min-width="200" show-overflow-tooltip> <el-table-column label="链接地址" align="left" prop="categoryPath" min-width="200" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.categoryType == '1' || scope.row.categoryType == '2'" style="cursor: pointer" class="copyBtn" :data-clipboard-text="'{ms:global.url/}'+scope.row.categoryPath+'/index.html'" @click="copyContent">{{"{ms:global.url/}"+scope.row.categoryPath+"/index.html"}}</span> <span v-if="scope.row.categoryType == '1' || scope.row.categoryType == '2'" style="cursor: pointer"
<span v-if="scope.row.categoryType == '3'" style="cursor: pointer" class="copyBtn" :data-clipboard-text="scope.row.categoryDiyUrl" @click="copyContent">{{scope.row.categoryDiyUrl}}</span> class="copyBtn" :data-clipboard-text="'{ms:global.url/}'+scope.row.url"
</template> @click="copyContent">{{"{ms:global.url/}"+scope.row.url}}</span>
</el-table-column> <span v-if="scope.row.categoryType == '3'" style="cursor: pointer" class="copyBtn"
:data-clipboard-text="scope.row.categoryDiyUrl" @click="copyContent">{{scope.row.categoryDiyUrl}}</span>
</template>
</el-table-column>
<el-table-column label="列表地址" align="left" prop="categoryListUrl" width="100" show-overflow-tooltip> <el-table-column label="列表地址" align="left" prop="categoryListUrl" width="100" show-overflow-tooltip>
</el-table-column> </el-table-column>
<el-table-column label="内容地址" align="left" prop="categoryUrl" width="100" show-overflow-tooltip> <el-table-column label="内容地址" align="left" prop="categoryUrl" width="100" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.categoryType == '1'?scope.row.categoryUrl:''}} {{scope.row.categoryType == '1'?scope.row.categoryUrl:''}}
{{scope.row.categoryType == '2'?scope.row.categoryUrl:''}} {{scope.row.categoryType == '2'?scope.row.categoryUrl:''}}
</template> </template>
</el-table-column>
<el-table-column label="栏目属性" align="left" prop="categoryFlag" width="80" show-overflow-tooltip>
<template slot-scope="scope">
{{getDictLabel(scope.row.categoryFlag)}}
</template>
</el-table-column> </el-table-column>
<el-table-column label="栏目属性" align="left" prop="categoryFlag" width="100" show-overflow-tooltip> <el-table-column label="操作" width="240" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{getDictLabel(scope.row.categoryFlag)}} <el-link type="primary" :underline="false" v-if="scope.row.categoryType != '3'" @click="preview(scope.row)">预览</el-link>
</template> <@shiro.hasPermission name="cms:category:save">
<el-link type="primary" :underline="false" @click="save(scope.row.id, scope.row.id)"><i
class="el-icon-plus"></i>子栏目
</el-link>
</@shiro.hasPermission>
<@shiro.hasPermission name="cms:category:save">
<el-link type="primary" :underline="false" @click="copyCategory(scope.row.id)">克隆</el-link>
</@shiro.hasPermission>
<#-- <@shiro.hasPermission name="cms:category:update">-->
<#-- <el-link type="primary" :underline="false" v-if="scope.row.categoryType == '1' || scope.row.categoryType == '2'" @click="updateTemplate(scope.row.id)">应用子栏目</el-link>-->
<#-- </@shiro.hasPermission>-->
<@shiro.hasPermission name="cms:category:update">
<el-link type="primary" :underline="false" @click="save(scope.row.id)">编辑</el-link>
</@shiro.hasPermission>
<@shiro.hasPermission name="cms:category:del">
<el-link type="primary" :underline="false" @click="del([scope.row])">删除</el-link>
</@shiro.hasPermission>
</template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="180" align="center"> </el-table>
<template slot-scope="scope"> </el-main>
<@shiro.hasPermission name="cms:category:save"> </div>
<el-link type="primary" :underline="false" @click="save(scope.row.id, scope.row.id)"><i class="el-icon-plus"></i>子栏目</el-link>
</@shiro.hasPermission>
<@shiro.hasPermission name="cms:category:save">
<el-link type="primary" :underline="false" @click="copyCategory(scope.row.id)">克隆</el-link>
</@shiro.hasPermission>
<#-- <@shiro.hasPermission name="cms:category:update">-->
<#-- <el-link type="primary" :underline="false" v-if="scope.row.categoryType == '1' || scope.row.categoryType == '2'" @click="updateTemplate(scope.row.id)">应用子栏目</el-link>-->
<#-- </@shiro.hasPermission>-->
<@shiro.hasPermission name="cms:category:update">
<el-link type="primary" :underline="false" @click="save(scope.row.id)">编辑</el-link>
</@shiro.hasPermission>
<@shiro.hasPermission name="cms:category:del">
<el-link type="primary" :underline="false" @click="del([scope.row])">删除</el-link>
</@shiro.hasPermission>
</template>
</el-table-column>
</el-table>
</el-main>
</div>
</body> </body>
</html> </html>
<script> <script>
"use strict"; "use strict";
var indexVue = new Vue({ var indexVue = new Vue({
el: '#index', el: '#index',
data: { data: {
//分类列表 //分类列表
dataList: [], dataList: [],
//分类列表选中 //分类列表选中
selectionList: [], selectionList: [],
//加载状态 //加载状态
loading: true, loading: true,
//提示文字 //提示文字
emptyText: '', emptyText: '',
categoryFlagOptions: [], categoryFlagOptions: [],
manager: ms.manager, manager: ms.manager,
loadState: false, loadState: false,
categoryTypeOptions: [{ categoryTypeOptions: [{
"value": "1", "value": "1",
"label": "列表" "label": "列表"
}, { }, {
"value": "2", "value": "2",
"label": "封面" "label": "封面"
},{ }, {
"value": "3", "value": "3",
"label": "链接" "label": "链接"
}], }],
//搜索表单 //搜索表单
form: { form: {
// 栏目管理名称 // 栏目管理名称
categoryTitle: '', categoryTitle: '',
// 所属栏目 // 所属栏目
categoryId: '', categoryId: '',
// 栏目管理属性 // 栏目管理属性
categoryType: '2', categoryType: '2',
// 自定义顺序 // 自定义顺序
categorySort: 0, categorySort: 0,
// 列表模板 // 列表模板
categoryListUrl: '', categoryListUrl: '',
// 内容模板 // 内容模板
categoryUrl: '', categoryUrl: '',
// 栏目管理关键字 // 栏目管理关键字
categoryKeyword: '', categoryKeyword: '',
// 栏目管理描述 // 栏目管理描述
categoryDescrip: '', categoryDescrip: '',
// 缩略图 // 缩略图
categoryImg: [], categoryImg: [],
// 自定义链接 // 自定义链接
categoryDiyUrl: '', categoryDiyUrl: '',
// 栏目管理的内容模型id // 栏目管理的内容模型id
mdiyModelId: '' mdiyModelId: ''
} }
}, },
methods: { methods: {
//复制栏目 //复制栏目
copyCategory: function(id) { copyCategory: function (id) {
var that = this; var that = this;
ms.http.get(ms.manager + "/cms/category/copyCategory.do", { ms.http.get(ms.manager + "/cms/category/copyCategory.do", {
id: id id: id
}).then(function (res) { }).then(function (res) {
if (res.result) { if (res.result) {
that.$notify({ that.$notify({
title: '成功', title: '成功',
message: '复制成功', message: '复制成功',
type: 'success' type: 'success'
}); });
that.list(); that.list();
} else { } else {
that.$notify({ that.$notify({
title: '失败', title: '失败',
message: res.msg, message: res.msg,
type: 'warning' type: 'warning'
}); });
} }
}); });
}, },
//应用子栏目模板 //应用子栏目模板
updateTemplate: function(id) { updateTemplate: function (id) {
var that = this; var that = this;
ms.http.get(ms.manager + "/cms/category/updateTemplate.do", { ms.http.get(ms.manager + "/cms/category/updateTemplate.do", {
id: id id: id
}).then(function (res) { }).then(function (res) {
if (res.result) { if (res.result) {
that.$notify({ that.$notify({
title: '成功', title: '成功',
message: '应用成功', message: '应用成功',
type: 'success' type: 'success'
}); });
that.list(); that.list();
} else { } else {
that.$notify({ that.$notify({
title: '失败', title: '失败',
message: res.msg, message: res.msg,
type: 'warning' type: 'warning'
}); });
} }
}); });
}, },
//根据字典数据值获取字典标签名 //根据字典数据值获取字典标签名
getDictLabel: function (v) { getDictLabel: function (v) {
var that = this; var that = this;
var labels = []; var labels = [];
if(v){ if (v) {
v.split(",").forEach(function (item) { v.split(",").forEach(function (item) {
for (var key in that.categoryFlagOptions) { for (var key in that.categoryFlagOptions) {
if (item == that.categoryFlagOptions[key].dictValue) { if (item == that.categoryFlagOptions[key].dictValue) {
labels.push(that.categoryFlagOptions[key].dictLabel); labels.push(that.categoryFlagOptions[key].dictLabel);
break; break;
} }
} }
}); });
} }
return labels.toString(); return labels.toString();
}, },
//查询列表 //查询列表
list: function () { list: function () {
var that = this; var that = this;
this.loadState = false; this.loadState = false;
this.loading = true; this.loading = true;
ms.http.get(ms.manager + "/cms/category/list.do", { ms.http.get(ms.manager + "/cms/category/list.do", {
pageSize: 999 pageSize: 999
}).then(function (res) { }).then(function (res) {
if (that.loadState) { if (that.loadState) {
that.loading = false; that.loading = false;
} else { } else {
that.loadState = true; that.loadState = true;
} }
if (!res.result || res.data.total <= 0) { if (!res.result || res.data.total <= 0) {
that.emptyText = '暂无数据'; that.emptyText = '暂无数据';
that.dataList = []; that.dataList = [];
} else { } else {
that.emptyText = ''; that.emptyText = '';
that.dataList = ms.util.treeData(res.data.rows, 'id', 'categoryId', 'children'); that.dataList = ms.util.treeData(res.data.rows, 'id', 'categoryId', 'children');
} }
}); });
setTimeout(function () { setTimeout(function () {
if (that.loadState) { if (that.loadState) {
that.loading = false; that.loading = false;
} else { } else {
that.loadState = true; that.loadState = true;
} }
}, 500); }, 500);
}, },
copyContent: function (id) { copyContent: function (id) {
var msg = "链接地址已保存到剪切板"; var msg = "链接地址已保存到剪切板";
if (id == true) { if (id == true) {
msg = "编号已保存到剪切板"; msg = "编号已保存到剪切板";
} }
var clipboard = new ClipboardJS('.copyBtn'); var clipboard = new ClipboardJS('.copyBtn');
var self = this; var self = this;
clipboard.on('success', function (e) { clipboard.on('success', function (e) {
self.$notify({ self.$notify({
title: '提示', title: '提示',
message: msg, message: msg,
type: 'success' type: 'success'
}); });
clipboard.destroy(); clipboard.destroy();
}); });
}, },
//分类列表选中 //分类列表选中
handleSelectionChange: function (val) { handleSelectionChange: function (val) {
this.selectionList = val; this.selectionList = val;
}, },
//删除 //删除
del: function (row) { del: function (row) {
var that = this; var that = this;
that.$confirm('此操作将永久删除分类和分类下的文章, 是否继续?', '提示', { that.$confirm('此操作将永久删除分类和分类下的文章, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(function () { }).then(function () {
ms.http.post(ms.manager + "/cms/category/delete.do", row.length ? row : [row], { ms.http.post(ms.manager + "/cms/category/delete.do", row.length ? row : [row], {
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
}).then(function (res) { }).then(function (res) {
if (res.result) { if (res.result) {
that.$notify({ that.$notify({
title: '成功 ', title: '成功 ',
type: 'success', type: 'success',
message: '删除成功!' message: '删除成功!'
}); //删除成功,刷新列表 }); //删除成功,刷新列表
that.list(); that.list();
} else { } else {
that.$notify({ that.$notify({
title: '失败', title: '失败',
message: res.msg, message: res.msg,
type: 'warning' type: 'warning'
}); });
} }
}); });
}) })
}, },
//获取categoryFlag数据源 //预览栏目
categoryFlagOptionsGet: function () { preview: function (row) {
var that = this; window.open(row["url"]);
ms.http.get(ms.base + '/mdiy/dict/list.do', { },
dictType: '栏目属性', //获取categoryFlag数据源
pageSize: 99999 categoryFlagOptionsGet: function () {
}).then(function (res) { var that = this;
if(res.result){ ms.http.get(ms.base + '/mdiy/dict/list.do', {
res = res.data; dictType: '栏目属性',
that.categoryFlagOptions = res.rows; pageSize: 99999
} }).then(function (res) {
}); if (res.result) {
}, res = res.data;
//表格数据转换 that.categoryFlagOptions = res.rows;
categoryTypeFormat: function (row, column, cellValue, index) { }
var value = ""; });
},
//表格数据转换
categoryTypeFormat: function (row, column, cellValue, index) {
var value = "";
if (cellValue) { if (cellValue) {
var data = this.categoryTypeOptions.find(function (value) { var data = this.categoryTypeOptions.find(function (value) {
return value.value == cellValue; return value.value == cellValue;
}); });
if (data && data.label) { if (data && data.label) {
value = data.label; value = data.label;
} }
} }
return value; return value;
}, },
//新增 //新增
save: function (id, childId) { save: function (id, childId) {
if (id) { if (id) {
location.href = this.manager + "/cms/category/form.do?id=" + id + "&childId=" + childId; location.href = this.manager + "/cms/category/form.do?id=" + id + "&childId=" + childId;
} else { } else {
location.href = this.manager + "/cms/category/form.do"; location.href = this.manager + "/cms/category/form.do";
} }
}, },
//重置表单 //重置表单
rest: function () { rest: function () {
this.$refs.searchForm.resetFields(); this.$refs.searchForm.resetFields();
} }
}, },
created: function () { created: function () {
/* this.categoryListUrlOptionsGet(); /* this.categoryListUrlOptionsGet();
this.categoryUrlOptionsGet();*/ this.categoryUrlOptionsGet();*/
this.categoryFlagOptionsGet(); this.categoryFlagOptionsGet();
this.list(); this.list();
} }
}); });
</script> </script>

Loading…
Cancel
Save