Browse Source

规范主键和删除appid后的问题

xierz 5 năm trước cách đây
mục cha
commit
1e6a055a29

+ 38 - 10
src/main/webapp/WEB-INF/manager/cms/category/form.ftl

@@ -180,7 +180,7 @@
                                     :readonly="false"
                                     :style="{width:  '100%'}"
                                     :clearable="true"
-                                    placeholder="默认拼音根据名称生成">
+                                    placeholder="默认拼音根据名称生成,含有特殊字符请手动输入">
                             </el-input>
                         </el-form-item>
                     </el-col>
@@ -325,19 +325,17 @@
                     categoryTitle: [{
                         "required": true,
                         "message": "请选择栏目管理名称"
-                    }, {
-                        "pattern": /^[^[!@#$%^&*()_+-/~?!@#¥%…&*()——+—?》《:“‘’]+$/,
-                        "message": "栏目管理名称格式不匹配"
                     }],
                     categoryListUrl: [{
                         "required": true,
                         "message": "请选择列表模板"
                     }],
-                        categoryPinyin:[
-                            {
-                                validator: validatorCategoryPinyin, trigger: 'blur'
-                            }
-                            ],
+                    categoryPinyin:[{
+                        validator: validatorCategoryPinyin, trigger: 'blur'
+                    }, {
+                        "pattern": /^[^[!@#$"'%^&*()_+-/~?!@#¥%…&*()——+—?》《:“‘’]+$/,
+                        "message": "栏目管理名称格式不匹配"
+                    }],
                     // 内容模板
                     categoryUrl: [{
                         "required": true,
@@ -374,10 +372,40 @@
                         }
                     }
                 });
-            }
+            },
+            'form.categoryTitle': function (n) {
+                var regu = "[[!@'\"#$%^&*()_+-/~?!@#¥%…&*()——+—?》《:“‘’]";
+                if (this.regularCheck(regu, n)) {
+                    this.rules.categoryPinyin = [{
+                        "validator": this.validatorCategoryPinyin, trigger: 'blur'
+                    },{
+                        "required": true,
+                        "message": "请输入栏目拼音名称"
+                    }, {
+                        "pattern": /^[^[!@#$"'%^&*()_+-/~?!@#¥%…&*()——+—?》《:“‘’]+$/,
+                        "message": "栏目管理名称格式不匹配"
+                    }];
+                }else {
+                    this.rules.categoryPinyin = [{
+                        "validator": this.validatorCategoryPinyin, trigger: 'blur'
+                    }, {
+                        "pattern": /^[^[!@#$"'%^&*()_+-/~?!@#¥%…&*()——+—?》《:“‘’]+$/,
+                        "message": "栏目管理名称格式不匹配"
+                    }];
+                }
+            },
         },
         computed: {},
         methods: {
+            //正则校验regu 正则表达式,str被校验的字段,符合返回true否则false
+            regularCheck: function(regu, str) {
+                var re = new RegExp(regu);
+                if (re.test(str)) {
+                    return true;
+                }else{
+                    return false;
+                }
+            },
             getTree: function () {
                 var that = this;
                 ms.http.get(ms.manager + "/cms/category/list.do", {

+ 48 - 4
src/main/webapp/WEB-INF/manager/cms/category/index.ftl

@@ -31,13 +31,16 @@
 					{{emptyText}}
 				</template>
 				<el-table-column type="selection" width="40"></el-table-column>
-				<el-table-column label="编号" width="220" prop="id">
+				<el-table-column label="编号" width="220" prop="id" show-overflow-tooltip>
 					<template slot='header'>编号
 						<el-popover placement="top-start" title="提示" trigger="hover" >
 							<a href="http://doc.mingsoft.net/plugs-cms/biao-qian/lan-mu-lie-biao-ms-channel.html" target="_blank">${'$'}{field.id}</a>
 							<i class="el-icon-question" slot="reference"></i>
 						</el-popover>
 					</template>
+					<template slot-scope="scope">
+						<span style="cursor: pointer" class="copyBtn" :data-clipboard-text="scope.row.id" @click="copyContent(true)">{{scope.row.id}}</span>
+					</template>
 				</el-table-column>
                  <el-table-column label="标题" align="left" prop="categoryTitle">
                  </el-table-column>
@@ -47,7 +50,7 @@
 			</el-table-column>
 			<el-table-column label="链接地址" align="left" prop="categoryPath" show-overflow-tooltip>
 				<template slot-scope="scope">
-					<span style="cursor: pointer" class="copyBtn" :data-clipboard-text="'${'$'}{ms:global.url}'+scope.row.categoryPath+'/index.html'" @click="copyUrl">{{"{ms:global.url/}"+scope.row.categoryPath+"/index.html"}}</span>
+					<span 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>
 				</template>
 			</el-table-column>
             <el-table-column label="列表地址" align="left" prop="categoryListUrl" show-overflow-tooltip>
@@ -62,6 +65,11 @@
 					{{scope.row.categoryType == '2'?scope.row.categoryUrl:''}}
 				</template>
             </el-table-column>
+            <el-table-column label="栏目属性" align="left" prop="categoryFlag" show-overflow-tooltip>
+				<template slot-scope="scope">
+					{{getDictLabel(scope.row.categoryFlag)}}
+				</template>
+            </el-table-column>
 					<el-table-column label="操作" width="150" align="center">
 					<template slot-scope="scope">
 						<@shiro.hasPermission name="cms:category:save">
@@ -95,6 +103,7 @@
 			//加载状态
 			emptyText: '',
 			//提示文字
+			categoryFlagOptions: [],
 			manager: ms.manager,
 			loadState: false,
 			categoryTypeOptions: [{
@@ -134,6 +143,21 @@
 			}
 		},
 		methods: {
+			//根据字典数据值获取字典标签名
+			getDictLabel: function (v) {
+				var that = this;
+				v = v.split(",");
+				var labels = [];
+				v.forEach(function (item) {
+					for (var key in that.categoryFlagOptions) {
+						if (item == that.categoryFlagOptions[key].dictValue) {
+							labels.push(that.categoryFlagOptions[key].dictLabel);
+							break;
+						}
+					}
+				});
+				return labels.toString();
+			},
 			//查询列表
 			list: function () {
 				var that = this;
@@ -166,13 +190,17 @@
 					}
 				}, 500);
 			},
-			copyUrl: function () {
+			copyContent: function (id) {
+				var msg = "链接地址已保存到剪切板";
+				if (id == true) {
+					msg = "编号已保存到剪切板";
+				}
 				var clipboard = new ClipboardJS('.copyBtn');
 				var self = this;
 				clipboard.on('success', function (e) {
 					self.$notify({
 						title: '提示',
-						message: "链接地址已保存到剪切板",
+						message: msg,
 						type: 'success'
 					});
 					clipboard.destroy();
@@ -217,6 +245,21 @@
 					});
 				});
 			},
+			//获取categoryFlag数据源
+			categoryFlagOptionsGet: function () {
+				var that = this;
+				ms.http.get(ms.base + '/mdiy/dict/list.do', {
+					dictType: '栏目属性',
+					pageSize: 99999
+				}).then(function (res) {
+					if(res.result){
+						res = res.data;
+						that.categoryFlagOptions = res.rows;
+					}
+				}).catch(function (err) {
+					console.log(err);
+				});
+			},
 			//表格数据转换
 			categoryTypeFormat: function (row, column, cellValue, index) {
 				var value = "";
@@ -249,6 +292,7 @@
 		created: function () {
 			/* this.categoryListUrlOptionsGet();
              this.categoryUrlOptionsGet();*/
+			this.categoryFlagOptionsGet();
 			this.list();
 		}
 	});

+ 5 - 4
src/main/webapp/WEB-INF/manager/cms/content/form.ftl

@@ -91,6 +91,7 @@
                                             start-placeholder=""
                                             end-placeholder=""
                                             :readonly="false"
+
                                             :disabled="false"
                                             :editable="true"
                                             :clearable="true"
@@ -303,7 +304,9 @@
                     // 关键字
                     contentKeyword: '',
                     // 文章内容
-                    contentDetails: ''
+                    contentDetails: '',
+
+                    contentDatetime: ms.util.date.fmt(Date.now(),"yyyy-MM-dd hh:mm:ss"),
                 },
                 contentTypeOptions: [],
                 categoryIdOptions: [],
@@ -607,6 +610,7 @@
         created: function () {
             this.contentCategoryIdOptionsGet();
             this.contentTypeOptionsGet();
+
             this.form.id = ms.util.getParameter("id");
             if (ms.util.getParameter("categoryId") != 'undefined' && ms.util.getParameter("categoryId") != 'null') {
                 this.form.contentCategoryId = ms.util.getParameter("categoryId");
@@ -615,9 +619,6 @@
 
             if (this.form.id) {
                 this.get(this.form.id);
-            }else{
-                //当前时间
-                this.form.contentDatetime = ms.util.date.fmt(Date.now(),"yyyy-MM-dd hh:mm:ss")
             }
 
             if (this.type) {