提交 4d2802e6 编写于 作者: S shenjizhe

1

上级 002dc8a8
......@@ -4,15 +4,33 @@
<view class="main-box">
<view ref="componentView" class="component-view">
<view class="title-bar">组件信息</view>
<thirdlucky-data-view style="height: 97%;" :columns="component.columns" :datas="component.datas" :tableNames="component.tableNames"></thirdlucky-data-view>
<thirdlucky-data-view
style="height: 97%;"
:columns="component.columns"
:datas="component.datas"
:tableNames="component.tableNames"
@selected="componentSelected"
></thirdlucky-data-view>
</view>
<view ref="moduleView" class="module-view">
<view class="title-bar">模型信息</view>
<thirdlucky-data-view style="height: 97%;" :columns="model.columns" :datas="model.datas" :tableNames="model.tableNames"></thirdlucky-data-view>
<thirdlucky-data-view
style="height: 97%;"
:columns="model.columns"
:datas="model.datas"
:tableNames="model.tableNames"
@selected="modelSelected"
></thirdlucky-data-view>
</view>
<view ref="templateView" class="template-view">
<view class="title-bar">模板信息</view>
<thirdlucky-data-view style="height: 97%;" :columns="template.columns" :datas="template.datas" :tableNames="template.tableNames"></thirdlucky-data-view>
<thirdlucky-data-view
style="height: 97%;"
:columns="template.columns"
:datas="template.datas"
:tableNames="template.tableNames"
@selected="templateSelected"
></thirdlucky-data-view>
</view>
</view>
</view>
......@@ -22,8 +40,9 @@
export default {
data() {
return {
componentIndex: -1,
menuContent: [{ text: '加载' }, { text: '保存' }],
component:{
component: {
columns: [
{
name: 'name',
......@@ -37,6 +56,18 @@ export default {
type: 'text',
tips: '描述'
},
{
name: 'modelId',
info: '模型ID',
type: 'text',
tips: ''
},
{
name: 'templateId',
info: '模板ID',
type: 'text',
tips: ''
},
{
name: 'domainName',
info: '域名',
......@@ -99,9 +130,9 @@ export default {
}
],
datas: [],
tableNames: ['name', 'comment'],
tableNames: ['name', 'comment']
},
model:{
model: {
columns: [
{
name: 'name',
......@@ -150,13 +181,12 @@ export default {
info: '领域ID',
type: 'text',
tips: '领域ID'
},
}
],
datas: [],
tableNames: ['name', 'comment'],
tableNames: ['name', 'comment']
},
template:{
template: {
columns: [
{
name: 'name',
......@@ -175,14 +205,28 @@ export default {
info: '启用',
type: 'switch',
tips: ''
},
}
],
datas: [],
tableNames: ['name', 'comment'],
},
tableNames: ['name', 'comment']
}
};
},
methods: {
componentSelected(index, action, data) {
this.componentIndex = index;
},
modelSelected(index, action, data) {
if (index >= 0 && this.componentIndex >= 0) {
this.component.datas[this.componentIndex].modelId = data.id;
}
},
templateSelected(index, action, data) {
console.log('选择:', data);
if (index >= 0 && this.componentIndex >= 0) {
this.component.datas[this.componentIndex].templateId = data.id;
}
},
menuClick(e) {
switch (e.index) {
case 0:
......@@ -195,19 +239,19 @@ export default {
break;
}
},
loadDatas(data,name,func){
loadDatas(data, name, func) {
func(
res => {
data.datas = res.data.data;
uni.showToast({
title: '加载'+name+'成功',
title: '加载' + name + '成功',
icon: 'success',
duration: 2000
});
},
res => {
uni.showToast({
title: '加载'+name+'失败:' + res.errMsg,
title: '加载' + name + '失败:' + res.errMsg,
icon: 'error',
duration: 2000
});
......@@ -216,13 +260,13 @@ export default {
},
loadComponents() {
this.loadDatas(this.component,'组件',this.api.getComponents);
this.loadDatas(this.component, '组件', this.api.getComponents);
},
loadDataSources() {
this.loadDatas(this.model,'模型',this.api.getDataSources);
this.loadDatas(this.model, '模型', this.api.getDataSources);
},
loadTemplates() {
this.loadDatas(this.template,'模板',this.api.getTemplates);
this.loadDatas(this.template, '模板', this.api.getTemplates);
},
saveComponents() {
this.api.saveComponents(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册