Pārlūkot izejas kodu

添加自定义模型

sgjj 6 gadi atpakaļ
vecāks
revīzija
765bfd55e5

+ 5 - 0
pom.xml

@@ -42,6 +42,11 @@
 		</dependency>
 		<dependency>
 			<groupId>net.mingsoft</groupId>
+			<artifactId>ms-mdiy</artifactId>
+			<version>1.0.12-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>net.mingsoft</groupId>
 			<artifactId>ms-mpeople</artifactId>
 			<version>1.0.11</version>
 		</dependency>

+ 28 - 12
src/main/webapp/WEB-INF/manager/cms/category/form.ftl

@@ -89,6 +89,23 @@
                                     </el-form-item>
                                 </el-col>
                         </el-row>
+                    <el-row
+                            gutter="0"
+                            justify="start" align="top">
+                        <el-col span="12">
+                            <el-form-item  label="自定义模型" prop="mdiyModelId">
+                                <el-select v-model="form.mdiyModelId"
+                                           :style="{width: '100%'}"
+                                           :filterable="false"
+                                           :disabled="false"
+                                           :multiple="false" :clearable="true"
+                                           placeholder="请选择栏目的自定义模型">
+                                    <el-option v-for='item in mdiyModelIdOptions' :key="item.id" :value="item.id"
+                                               :label="item.modelName"></el-option>
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
+                    </el-row>
             <el-form-item  label="栏目管理关键字" prop="categoryKeyword">
                 <el-input
                         type="textarea" :rows="5"
@@ -141,17 +158,6 @@
                         placeholder="请输入自定义链接">
                 </el-input>
             </el-form-item>
-            <el-form-item  label="栏目管理的内容模型id" prop="mdiyModelId">
-                    <el-select v-model="form.mdiyModelId"
-                               :style="{width: '100%'}"
-                               :filterable="false"
-                               :disabled="false"
-                               :multiple="false" :clearable="true"
-                               placeholder="请选择栏目管理的内容模型id">
-                        <el-option v-for='item in mdiyModelIdOptions' :key="item.value" :value="item.value"
-                                   :label="false?item.label:item.value"></el-option>
-                    </el-select>
-            </el-form-item>
             </el-form>
             </el-scrollbar>
 		</el-main>
@@ -259,7 +265,16 @@
                     }
                 })
             },
-
+            //获取分类内容模型
+            getColumnContentModelId: function () {
+                var that = this;
+                ms.http.get(ms.manager + "/mdiy/model/list.do",{modelType:'zdymx_wz'}).then(
+                    function (data) {
+                        that.mdiyModelIdOptions = data.rows;
+                    }).catch(function (err) {
+                    console.log(err);
+                });
+            },
             //获取当前分类
             get(id) {
                 var that = this;
@@ -325,6 +340,7 @@
             },
         },
         created() {
+            this.getColumnContentModelId();
             this.getTree()
             this.categoryListUrlOptionsGet();
             this.categoryUrlOptionsGet();

+ 11 - 8
src/main/webapp/WEB-INF/manager/cms/content/form.ftl

@@ -20,7 +20,7 @@
                          :label="item.title"
                          :name="item.name">
         <el-scrollbar class="ms-scrollbar" style="height: 100%;">
-            <el-form ref="form" :model="form" :rules="rules" label-width="120px" size="mini">
+            <el-form v-if="item.title=='文章编辑'" ref="form" :model="form" :rules="rules" label-width="120px" size="mini">
                 <el-row
                         gutter="0"
                         justify="start" align="top">
@@ -240,6 +240,7 @@
                     contentDetails: '',
                 },
                 contentTypeOptions: [],
+                categoryIdOptions: [],
                 contentDisplayOptions: [{"value": "0", "label": "是"}, {"value": "1", "label": "否"}],
                 rules: {
                     // 文章标题
@@ -254,7 +255,7 @@
         computed:{
             currCategory(){
                 var that = this;
-                return this.contentCategoryIdOptions.find(function(value){
+                return this.categoryIdOptions.find(function(value){
                     return value.id===that.form.contentCategoryId
                 })
             },
@@ -271,7 +272,7 @@
                 if (that.form.id > 0) {
                     url = ms.manager + "/cms/content/update.do";
                 }
-                this.$refs.form.validate((valid) => {
+                this.$refs.form[0].validate((valid) => {
                     if (valid) {
                         that.saveDisabled = true;
                         var data = JSON.parse(JSON.stringify(that.form));
@@ -281,7 +282,7 @@
                             if (data.result) {
                                 //保存时需要赋值关联ID
                                 if(that.model){
-                                    that.model.form.linkId = data.id;
+                                    that.model.form.linkId = data.data.id;
                                     that.model.save()
                                 }
                                 that.$notify({
@@ -322,9 +323,9 @@
                 that.editableTabs = [that.editableTabs[0]];
                 this.removeModel();
                 if(this.currCategory){
-                    if(this.currCategory.categoryCmId){
+                    if(this.currCategory.mdiyModelId){
                         ms.http.get(ms.manager + "/mdiy/model/get.do",{
-                            id:this.currCategory.categoryCmId
+                            id:this.currCategory.mdiyModelId
                         }).then(function (data) {
                             if(data.id){
                                 that.rederModel(data,JSON.parse(data.modelJson))
@@ -359,7 +360,7 @@
                                 title:modelEntity.modelName,
                                 modelId:modelEntity.id,
                                 form:{
-                                    linkId:that.id
+                                    linkId:that.form.id
                                 },
                             }
                         })
@@ -385,8 +386,8 @@
                         } else {
                             res.data.contentImg = []
                         }
-                        that.changeModel();
                         that.form = res.data;
+                        that.changeModel();
                     }
                 }).catch(function (err) {
                     console.log(err);
@@ -398,6 +399,8 @@
                 ms.http.get(ms.manager + "/cms/category/list.do", {pageSize: 9999}).then(function (res) {
                     if (res.result) {
                         that.contentCategoryIdOptions = ms.util.treeData(res.data.rows, 'id', 'categoryId', 'children');
+                        that.categoryIdOptions = res.data.rows
+                        that.changeModel();
                     }
                 }).catch(function (err) {
                     console.log(err);

+ 2 - 1
src/main/webapp/WEB-INF/manager/cms/content/main.ftl

@@ -103,7 +103,7 @@
 
 </html>
 <script>
-    var mainVue = new Vue({
+    var indexVue = new Vue({
         el: '#main',
         data:{
             conditionList:[
@@ -124,6 +124,7 @@
                 {action:'and', field: 'update_date', el: 'eq', model: 'updateDate', name: '修改时间', type: 'date'},
             ],
             conditions:[],
+            contentCategoryIdOptions:[],
             dataList: [], //文章列表
             selectionList:[],//文章列表选中
             total: 0, //总记录数量

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
src/main/webapp/static/plugins/tree-select/tree.js


Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels