文章模型

This commit is contained in:
wujj 2021-04-02 19:48:23 +08:00
parent 7b6f43308f
commit 5d5aca22b9
1 changed files with 9 additions and 34 deletions

View File

@ -1,8 +1,9 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>文章</title> <title>文章1</title>
<#include "../../include/head-file.ftl"> <#include "../../include/head-file.ftl">
<script src="${base}/static/mdiy/index.js"></script>
</head> </head>
<body> <body>
<div id="form" v-cloak> <div id="form" v-cloak>
@ -440,50 +441,24 @@
changeModel: function () { changeModel: function () {
var that = this; var that = this;
that.editableTabs = [that.editableTabs[0]]; that.editableTabs = [that.editableTabs[0]];
this.removeModel();
if (this.currCategory) { if (this.currCategory) {
if (this.currCategory.mdiyModelId) { if (this.currCategory.mdiyModelId) {
ms.http.get(ms.manager + "/mdiy/model/get.do", { that.rederModel(this.currCategory.mdiyModelId)
id: this.currCategory.mdiyModelId
}).then(function (data) {
if (data.data && data.data.id) {
that.rederModel(data.data, JSON.parse(data.data.modelJson));
}
});
} }
} }
}, },
rederModel: function (modelEntity, data) { rederModel: function (modelId) {
var that = this; var that = this;
that.editableTabs.push({ that.editableTabs.push({
title: modelEntity.modelName, title: '',
name: 'custom-name' name: 'custom-name'
}); });
this.removeModel(); ms.mdiy.model.model("model1", {id:modelId},{ linkId: that.form.id }).then(function(obj) {
that.$nextTick(function () { that.model = obj;
var div = document.createElement('div'); that.editableTabs[1].title = obj.modelName
div.id = 'c_model'; });
var model = document.getElementById('model1');
model.appendChild(div);
var s = document.createElement('script');
s.innerHTML = data.script;
var con = document.createElement('div');
con.id = 'custom-model';
con.innerHTML = data.html;
div.appendChild(s);
div.appendChild(con); //初始化自定义模型并传入关联参数
that.model = new custom_model({
data: {
title: modelEntity.modelName,
modelId: modelEntity.id,
form: {
linkId: that.form.id
}
}
});
});
}, },
getValue: function (data) { getValue: function (data) {
this.form.categoryId = data.id; this.form.categoryId = data.id;