添加自定义模型

This commit is contained in:
sgjj 2019-12-02 14:24:25 +08:00
parent f1a1ee7e87
commit 765bfd55e5
5 changed files with 47 additions and 22 deletions

View File

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

View File

@ -89,6 +89,23 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </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-form-item label="栏目管理关键字" prop="categoryKeyword">
<el-input <el-input
type="textarea" :rows="5" type="textarea" :rows="5"
@ -141,17 +158,6 @@
placeholder="请输入自定义链接"> placeholder="请输入自定义链接">
</el-input> </el-input>
</el-form-item> </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-form>
</el-scrollbar> </el-scrollbar>
</el-main> </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) { get(id) {
var that = this; var that = this;
@ -325,6 +340,7 @@
}, },
}, },
created() { created() {
this.getColumnContentModelId();
this.getTree() this.getTree()
this.categoryListUrlOptionsGet(); this.categoryListUrlOptionsGet();
this.categoryUrlOptionsGet(); this.categoryUrlOptionsGet();

View File

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

View File

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

File diff suppressed because one or more lines are too long