From 6cfcb6fd0aec6cacf29b2c24359cd6d1c1da4106 Mon Sep 17 00:00:00 2001 From: tianbj <1309855586@qq.com> Date: Tue, 17 Dec 2019 19:19:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WEB-INF/manager/cms/category/form.ftl | 24 +++++++++++++++++-- .../WEB-INF/manager/cms/content/form.ftl | 9 +++++-- .../WEB-INF/manager/cms/content/index.ftl | 2 +- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/main/webapp/WEB-INF/manager/cms/category/form.ftl b/src/main/webapp/WEB-INF/manager/cms/category/form.ftl index 6cc15956..1d949484 100644 --- a/src/main/webapp/WEB-INF/manager/cms/category/form.ftl +++ b/src/main/webapp/WEB-INF/manager/cms/category/form.ftl @@ -41,13 +41,13 @@ + :disabled="categoryTypeDisabled"> {{true? item.label : item.value}} @@ -191,6 +191,7 @@ children:[], }], saveDisabled: false, + categoryTypeDisabled:true, //表单数据 form: { // 栏目管理名称 @@ -251,6 +252,7 @@ } this.$refs.form.validate((valid) => { if (valid) { + //栏目属性为封面则不需要列表模板 if(that.form.categoryType == '2'){ that.form.categoryListUrl = ''; @@ -319,6 +321,22 @@ res.data.categoryId = '0'; } that.form = res.data; + //判断该分类是否存在文章,存在则不能修改栏目属性 + that.contentList(that.form.id); + } + }).catch(function (err) { + console.log(err); + }); + }, + contentList: function(id){ + var that = this; + ms.http.post(ms.manager+"/cms/content/list.do",{ + contentCategoryId: id, + }).then(function (data) { + if(data.data.total>0){ + that.categoryTypeDisabled = true; + } else { + that.categoryTypeDisabled = false; } }).catch(function (err) { console.log(err); @@ -377,6 +395,8 @@ this.form.id = ms.util.getParameter("id"); if (this.form.id) { this.get(this.form.id); + } else { + this.categoryTypeDisabled = false; } } }); diff --git a/src/main/webapp/WEB-INF/manager/cms/content/form.ftl b/src/main/webapp/WEB-INF/manager/cms/content/form.ftl index 388afd52..0d2705b5 100644 --- a/src/main/webapp/WEB-INF/manager/cms/content/form.ftl +++ b/src/main/webapp/WEB-INF/manager/cms/content/form.ftl @@ -247,6 +247,7 @@ contentTitle: [{"required": true, "message": "请选择文章标题"}], // 发布时间 contentDatetime: [{"required": true, "message": "发布时间不能为空"}], + contentCategoryId: [{"required": true, "message": "所属栏目不能为空"}], }, } @@ -302,7 +303,9 @@ message: '保存成功', type: 'success' }); - location.href = ms.manager + "/cms/content/main.do"; + if(that.returnIsShow){ + javascript:history.go(-1); + } } else { that.$notify({ title: '失败', @@ -488,7 +491,9 @@ this.contentCategoryIdOptionsGet(); this.contentTypeOptionsGet(); this.form.id = ms.util.getParameter("id"); - this.form.contentCategoryId = ms.util.getParameter("categoryId"); + if(ms.util.getParameter("categoryId") != 'undefined' && ms.util.getParameter("categoryId") != 'null'){ + this.form.contentCategoryId = ms.util.getParameter("categoryId"); + } this.type = ms.util.getParameter("type"); if (this.form.id) { this.get(this.form.id); diff --git a/src/main/webapp/WEB-INF/manager/cms/content/index.ftl b/src/main/webapp/WEB-INF/manager/cms/content/index.ftl index 0ec2c0f9..be88ee6e 100644 --- a/src/main/webapp/WEB-INF/manager/cms/content/index.ftl +++ b/src/main/webapp/WEB-INF/manager/cms/content/index.ftl @@ -11,7 +11,7 @@
- +