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

1

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