This commit is contained in:
tianbj 2019-11-29 09:57:55 +08:00
parent 2a4ab99b06
commit b3ffa311ed
3 changed files with 54 additions and 39 deletions

View File

@ -253,13 +253,13 @@ public class CategoryAction extends BaseAction{
if(!StringUtil.checkLength(category.getCategoryTitle()+"", 1, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.title"), "1", "100"));
}
if(!StringUtil.checkLength(category.getCategoryFlag()+"", 1, 100)){
if(!StringUtil.checkLength(category.getCategoryFlag()+"", 0, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.flag"), "1", "100"));
}
if(!StringUtil.checkLength(category.getCategoryPath()+"", 1, 100)){
if(!StringUtil.checkLength(category.getCategoryPath()+"", 0, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.path"), "1", "100"));
}
if(!StringUtil.checkLength(category.getCategoryParentId()+"", 1, 100)){
if(!StringUtil.checkLength(category.getCategoryParentId()+"", 0, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.parent.id"), "1", "100"));
}
categoryBiz.updateEntity(category);

View File

@ -62,30 +62,30 @@
gutter="0"
justify="start" align="top">
<el-col span="12">
<el-form-item label="列表模板" prop="categoryListUrl">
<el-select v-model="form.categoryListUrl"
:style="{width: '100%'}"
:filterable="false"
:disabled="false"
:multiple="false" :clearable="true"
placeholder="请选择列表模板">
<el-option v-for='item in categoryListUrlOptions' :key="item.id" :value="item.id"
:label="false?item.name:item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="form.categoryType =='1'? '内容模板' : '封面模板'" prop="categoryUrl">
<el-select v-model="form.categoryUrl"
:style="{width: '100%'}"
:filterable="false"
:disabled="false"
:multiple="false" :clearable="true"
placeholder="请选择内容模板">
<el-option v-for='item in categoryUrlOptions' :key="item" :value="item"
:label="item"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col span="12">
<el-form-item label="内容模板" prop="categoryUrl">
<el-select v-model="form.categoryUrl"
:style="{width: '100%'}"
:filterable="false"
:disabled="false"
:multiple="false" :clearable="true"
placeholder="请选择内容模板">
<el-option v-for='item in categoryUrlOptions' :key="item.id" :value="item.id"
:label="false?item.name:item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="列表模板" prop="categoryListUrl" v-if="form.categoryType == '1'">
<el-select v-model="form.categoryListUrl"
:style="{width: '100%'}"
:filterable="false"
:disabled="false"
:multiple="false" :clearable="true"
placeholder="请选择列表模板">
<el-option v-for='item in categoryListUrlOptions' :key="item" :value="item"
:label="item"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="栏目管理关键字" prop="categoryKeyword">
@ -170,7 +170,7 @@
// 所属栏目
categoryId:'',
// 栏目管理属性
categoryType:'2',
categoryType:'1',
// 自定义顺序
categorySort:0,
// 列表模板
@ -222,6 +222,10 @@
}
this.$refs.form.validate((valid) => {
if (valid) {
//栏目属性为封面则不需要列表模板
if(that.form.categoryType == '2'){
that.form.categoryListUrl = '';
}
that.saveDisabled = true;
var data = JSON.parse(JSON.stringify(that.form));
if(data.id&&data.id==data.categoryId){
@ -276,7 +280,7 @@
categoryListUrlOptionsGet() {
var that = this;
ms.http.get(ms.manager+"/template/queryTemplateFileForColumn.do", {}).then(function (data) {
that.categoryListUrlOptions = data.rows;
that.categoryListUrlOptions = data;
}).catch(function (err) {
console.log(err);
});
@ -285,7 +289,7 @@
categoryUrlOptionsGet() {
var that = this;
ms.http.get(ms.manager+"/template/queryTemplateFileForColumn.do", {}).then(function (data) {
that.categoryUrlOptions = data.rows;
that.categoryUrlOptions = data;
}).catch(function (err) {
console.log(err);
});
@ -328,3 +332,8 @@
}
});
</script>
<style>
.el-select{
width: 100%;
}
</style>

View File

@ -30,19 +30,25 @@
{{emptyText}}
</template>
<el-table-column type="selection" width="40"></el-table-column>
<el-table-column label="栏目管理名称" align="left" prop="categoryTitle">
<el-table-column label="标题" align="left" prop="categoryTitle">
</el-table-column>
<el-table-column label="栏目管理属性" align="left" prop="categoryType" :formatter="categoryTypeFormat">
<el-table-column label="属性" align="center" prop="categoryType" :formatter="categoryTypeFormat" width="65">
</el-table-column>
<el-table-column label="栏目路径" align="left" prop="categoryPath">
<el-table-column label="链接地址" align="left" prop="categoryPath" show-overflow-tooltip>
</el-table-column>
<el-table-column label="自定义顺序" width="100" align="right" prop="categorySort">
</el-table-column>
<el-table-column label="列表模板" align="left" prop="categoryListUrl">
<el-table-column label="列表地址" align="left" prop="categoryListUrl" show-overflow-tooltip>
</el-table-column>
<el-table-column label="内容模板" align="left" prop="categoryUrl">
<el-table-column label="内容地址" align="left" prop="categoryUrl" show-overflow-tooltip>
<template slot-scope="scope">
{{scope.row.categoryType == '1'?scope.row.categoryUrl:''}}
</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center">
<el-table-column label="封面地址" align="left" prop="categoryUrl" show-overflow-tooltip>
<template slot-scope="scope">
{{scope.row.categoryType == '2'?scope.row.categoryUrl:''}}
</template>
</el-table-column>
<el-table-column label="操作" width="120" align="center">
<template slot-scope="scope">
<@shiro.hasPermission name="cms:category:update">
<el-link type="primary" :underline="false" @click="save(scope.row.id)">编辑</el-link>
@ -101,7 +107,7 @@ var indexVue = new Vue({
var that = this;
this.loadState = false;
this.loading = true;
ms.http.get(ms.manager+"/cms/category/list.do",that.form).then(
ms.http.get(ms.manager+"/cms/category/list.do").then(
function(res) {
if(that.loadState){
that.loading = false;
@ -113,7 +119,7 @@ var indexVue = new Vue({
that.dataList = [];
} else {
that.emptyText = '';
that.dataList = ms.util.treeData(res.data.rows,'id','mdiyModelId','children');
that.dataList = ms.util.treeData(res.data.rows,'id','categoryId','children');
}
}).catch(function(err) {
console.log(err);