ap-dev 1.0.28 → 1.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,136 @@
1
+ <template>
2
+ <ap-container>
3
+ <ap-aside margin="1111" width="45%" style="padding: 0px;">
4
+ <div style="width: 100%;height: 100%;">
5
+ <div style="position: absolute;z-index: 99;right: 55%;">
6
+ <el-button-group>
7
+ <el-button icon="el-icon-video-play" type="primary" @click="runCode()">运行</el-button>
8
+ <el-button icon="el-icon-copy" type="primary" @click="copyCode($event)">复制</el-button>
9
+ <el-button icon="el-icon-trash-o" type="primary" @click="clearCode()">清空</el-button>
10
+ <el-button icon="el-icon-refresh-right" type="primary" @click="resetCode()">重置</el-button>
11
+ <el-button icon="el-icon-s-promotion" type="primary" @click="previewCode()">预览</el-button>
12
+ </el-button-group>
13
+ </div>
14
+ <codemirror class="code-ctn" v-model="codes" :options="cmOptions"></codemirror>
15
+ </div>
16
+ </ap-aside>
17
+ <ap-main margin="1110">
18
+ <vue-render :options.sync="renderCode"></vue-render>
19
+ </ap-main>
20
+ </ap-container>
21
+ </template>
22
+
23
+ <script>
24
+ import {codemirror} from 'vue-codemirror'
25
+ import 'codemirror/lib/codemirror.css'
26
+ // import 'codemirror/keymap/sublime' //sublime编辑器效果
27
+ // import "codemirror/theme/dracula.css"// 配置里面也需要theme设置为monokai
28
+ import "codemirror/mode/vue/vue.js" // 配置里面也需要mode设置为vue
29
+ import 'codemirror/addon/selection/active-line' //光标行背景高亮,配置里面也需要styleActiveLine设置为true
30
+ import VueRender from './../base/VueRender'
31
+ import clipboard from "ap-util/util/ClipboardUtil";
32
+ import {getUserConfig} from "ap-dev/dev/dev/DevUtil";
33
+
34
+ export default {
35
+ name: "OnlineCodePanel",
36
+ components: {
37
+ codemirror, VueRender
38
+ },
39
+ data() {
40
+ let defaultCode = "<template>\n" +
41
+ " <div>\n" +
42
+ " AP\n" +
43
+ " </div>\n" +
44
+ "</template>\n" +
45
+ "<script>\n" +
46
+ "export default {\n" +
47
+ " data () {\n" +
48
+ " return {\n" +
49
+ " }\n" +
50
+ " },\n" +
51
+ " methods: {\n" +
52
+ " \n" +
53
+ " }\n" +
54
+ "}\n" +
55
+ "<" + "/script>\n" +
56
+ "<style scoped>\n" +
57
+ "</style>";
58
+ return {
59
+ userConfig: getUserConfig(),
60
+ // 代码
61
+ defaultCode: defaultCode,
62
+ codes: defaultCode,
63
+ renderCode: "",
64
+ cmOptions: {
65
+ tabSize: 4,// tab的空格个数
66
+ // theme: 'dracula',//主题样式
67
+ lineNumbers: true,//是否显示行数
68
+ lineWrapping: true, //是否自动换行
69
+ styleActiveLine: true,//line选择是是否加亮
70
+ matchBrackets: true,//括号匹配
71
+ mode: "vue", //实现javascript代码高亮
72
+ readOnly: false//只读
73
+ },
74
+
75
+ }
76
+ },
77
+ methods: {
78
+ copyCode(event) {
79
+ clipboard(this.codes, event)
80
+ },
81
+ runCode() {
82
+ if (this.codes.indexOf("import ") > -1) {
83
+ this.$message.error("编译错误,在线测试无法执行'import'命令!建议使用预览查看!");
84
+ return;
85
+ }
86
+
87
+ this.renderCode = this.codes;
88
+ },
89
+ clearCode() {
90
+ this.codes = "";
91
+ this.renderCode = "";
92
+ },
93
+ resetCode() {
94
+ this.codes = this.defaultCode;
95
+ this.renderCode = this.defaultCode;
96
+ },
97
+ previewCode() {
98
+ let list = [
99
+ {
100
+ fileName: "Temp.vue",
101
+ url: this.userConfig.fdVuePath + "\\src\\views\\generator",
102
+ content: this.codes
103
+ }
104
+ ]
105
+ this.$request({
106
+ url: '/apd/dev/DevGenerateCode/createFile',
107
+ method: 'post',
108
+ data: {
109
+ list: JSON.stringify(list),
110
+ projectName: this.userConfig.fdJavaHref
111
+ }
112
+ }).then(response => {
113
+ window.open(this.userConfig.fdVueHref + 'GeneratorPage?comp=Temp');
114
+ })
115
+ },
116
+ }
117
+ }
118
+ </script>
119
+
120
+ <style scoped>
121
+ .code-ctn {
122
+ height: 100%;
123
+ width: 100%;
124
+ }
125
+ </style>
126
+
127
+ <style>
128
+ .code-ctn .CodeMirror {
129
+ height: 100% !important;
130
+ font-size: 14px !important;
131
+ }
132
+
133
+ .code-ctn .CodeMirror-line {
134
+ line-height: 20px !important;
135
+ }
136
+ </style>
@@ -1,135 +1,146 @@
1
1
  <template>
2
2
  <div class="flex flex-pack-justify flex-1 ap-dev-operate-panel">
3
3
  <div class="flex">
4
- <div class="ap-dev-tool-item dev-header-logo" @click="currentDesignPanel('api-panel')">
4
+ <div class="ap-dev-tool-item dev-header-logo" @click="currentDesignPanel('api-panel', $event)">
5
5
  AP | 开发平台
6
6
  </div>
7
- <div class="ap-dev-tool-item flex flex-center" @click="currentDesignPanel('db-design-panel')">
7
+ <div class="ap-dev-tool-item flex flex-center" @click="currentDesignPanel('db-design-panel', $event)">
8
8
  <div class="ap-dev-tool-item-icon1">
9
9
  <i class="el-icon-coin"/>
10
10
  </div>
11
11
  <div class="ap-dev-tool-item-text1">DB设计</div>
12
12
  </div>
13
- <div class="ap-dev-tool-item flex flex-center" @click="currentDesignPanel('custom-panel')">
13
+ <div class="ap-dev-tool-item flex flex-center" @click="currentDesignPanel('custom-panel', $event)">
14
14
  <div class="ap-dev-tool-item-icon1">
15
15
  <i class="el-icon-pic-part"/>
16
16
  </div>
17
17
  <div class="ap-dev-tool-item-text1">自定义</div>
18
18
  </div>
19
- <div class="ap-dev-tool-item flex flex-center" @click="currentDesignPanel('components-panel')">
19
+ <div class="ap-dev-tool-item flex flex-center" @click="currentDesignPanel('components-panel', $event)">
20
20
  <div class="ap-dev-tool-item-icon1">
21
21
  <i class="el-icon-menu"/>
22
22
  </div>
23
23
  <div class="ap-dev-tool-item-text1">组件</div>
24
24
  </div>
25
- <div class="ap-dev-tool-item flex flex-center" @click="currentDesignPanel('template-panel')">
25
+ <div class="ap-dev-tool-item flex flex-center" @click="currentDesignPanel('template-panel', $event)">
26
26
  <div class="ap-dev-tool-item-icon1">
27
27
  <i class="el-icon-model"/>
28
28
  </div>
29
29
  <div class="ap-dev-tool-item-text1">模版</div>
30
30
  </div>
31
- <div class="ap-dev-tool-item flex flex-center" @click="currentDesignPanel('background-panel')">
31
+ <div class="ap-dev-tool-item flex flex-center" @click="currentDesignPanel('background-panel', $event)">
32
32
  <div class="ap-dev-tool-item-icon1">
33
33
  <i class="el-icon-receiving"/>
34
34
  </div>
35
35
  <div class="ap-dev-tool-item-text1">后台</div>
36
36
  </div>
37
+ <div class="ap-dev-tool-item flex flex-center" @click="currentDesignPanel('online-code-panel', $event)">
38
+ <div class="ap-dev-tool-item-icon1">
39
+ <i class="el-icon-edit" />
40
+ </div>
41
+ <div class="ap-dev-tool-item-text1">在线开发</div>
42
+ </div>
43
+ <div class="ap-dev-tool-item flex flex-center">
44
+ <div class="ap-dev-tool-item-icon1">
45
+ <i class="el-icon-vue"/>
46
+ </div>
47
+ <el-dropdown>
48
+ <span class="el-dropdown-link ap-dev-tool-item-text1">
49
+ 文档
50
+ </span>
51
+ <el-dropdown-menu slot="dropdown">
52
+ <el-dropdown-item>
53
+ <a href="https://cn.vuejs.org/v2/guide/" target="_blank">vue 官网</a>
54
+ </el-dropdown-item>
55
+ <el-dropdown-item>
56
+ <a href="https://element.faas.ele.me/#/zh-CN/component/layout" target="_blank">element 官网</a>
57
+ </el-dropdown-item>
58
+ </el-dropdown-menu>
59
+ </el-dropdown>
60
+
61
+ </div>
37
62
  </div>
38
63
  <div class="flex">
39
- <div class="ap-dev-tool-item flex flex-center" @click="currentDesignPanel('config-panel')">
64
+ <div class="ap-dev-tool-item flex flex-center" @click="currentDesignPanel('config-panel', $event)">
40
65
  <div class="ap-dev-tool-item-icon">
41
66
  <i class="el-icon-setting"/>
42
67
  </div>
43
68
  <div class="ap-dev-tool-item-text">配置</div>
44
69
  </div>
45
-
46
- <!--<div class="ap-dev-tool-item flex flex-center" @click="saveOperate">-->
47
- <!--<div class="ap-dev-tool-item-icon">-->
48
- <!--<i class="el-icon-floppy-o" />-->
49
- <!--</div>-->
50
- <!--<div class="ap-dev-tool-item-text">保存</div>-->
51
- <!--</div>-->
52
70
  </div>
53
71
  </div>
54
72
  </template>
55
73
 
56
74
  <script>
57
- import ApDevBase from './../CustomPanel/items/base/ApDevBase'
58
- import {getLocalData, setLocalData} from './../dev/DevUtil'
75
+ import ApDevBase from './../CustomPanel/items/base/ApDevBase'
76
+ import {addClass, removeClass} from 'ap-util/util/StyleUtil'
59
77
 
60
- export default {
61
- name: 'OperatePanel',
62
- extends: ApDevBase,
63
- data() {
64
- const htmlStr = '<span></span>'
65
- const localConfigForm = getLocalData('configForm')
66
- return {
67
- configDialogVisible: false,
68
- configForm: {
69
- vueUrl: localConfigForm.vueUrl,
70
- javaUrl: localConfigForm.javaUrl,
71
- projectName: localConfigForm.projectName
72
- },
73
- previewDialogVisible: false,
74
- htmlStr: htmlStr
75
- }
76
- },
77
- methods: {
78
- configOperate() {
79
- this.configDialogVisible = true
80
- },
81
- saveConfigForm() {
82
- setLocalData('configForm', this.configForm)
83
- this.configDialogVisible = false
84
- },
85
- currentDesignPanel(type) {
86
- this.$store.commit('updateCurrentDesignPanel', type)
78
+ export default {
79
+ name: 'OperatePanel',
80
+ extends: ApDevBase,
81
+ data() {
82
+ return {}
83
+ },
84
+ methods: {
85
+ currentDesignPanel(type, event) {
86
+ console.log(event);
87
+ let items = document.getElementsByClassName("ap-dev-tool-item-active");
88
+ for (let i = 0; i < items.length; i++) {
89
+ removeClass(items[i],"ap-dev-tool-item-active")
87
90
  }
91
+ addClass( event.currentTarget,"ap-dev-tool-item-active");
92
+ this.$store.commit('updateCurrentDesignPanel', type);
88
93
  }
89
94
  }
95
+ }
90
96
  </script>
91
97
 
92
98
  <style scoped>
93
- .dev-header-logo {
94
- width: 315px;
95
- height: 100%;
96
- text-align: center;
97
- background-color: #497fd5;
98
- line-height: 40px;
99
- font-size: 18px !important;
100
- }
99
+ .dev-header-logo {
100
+ width: 315px;
101
+ height: 100%;
102
+ text-align: center;
103
+ background-color: #497fd5;
104
+ line-height: 40px;
105
+ font-size: 18px !important;
106
+ }
101
107
 
102
- .ap-dev-operate-panel {
103
- height: 100%;
104
- padding: 0 10px 0 0;
105
- }
108
+ .ap-dev-operate-panel {
109
+ height: 100%;
110
+ padding: 0 10px 0 0;
111
+ }
106
112
 
107
- .ap-dev-tool-item {
108
- padding: 2px 14px;
109
- font-size: 13px;
110
- text-align: center;
111
- }
113
+ .ap-dev-tool-item {
114
+ padding: 2px 14px;
115
+ font-size: 13px;
116
+ text-align: center;
117
+ }
112
118
 
113
- .ap-dev-tool-item:hover {
114
- background-color: #80A9EA;
115
- cursor: pointer
116
- }
119
+ .ap-dev-tool-item:hover {
120
+ background-color: #80A9EA;
121
+ cursor: pointer
122
+ }
117
123
 
118
- .ap-dev-tool-item-text {
119
- font-size: 10px;
120
- margin-left: 3px;
121
- }
124
+ .ap-dev-tool-item-active {
125
+ background-color: #6699ea;
126
+ }
122
127
 
123
- .ap-dev-tool-item-icon {
124
- font-size: 16px;
125
- }
128
+ .ap-dev-tool-item-text {
129
+ font-size: 10px;
130
+ margin-left: 3px;
131
+ }
126
132
 
127
- .ap-dev-tool-item-icon1 {
128
- font-size: 18px;
129
- }
133
+ .ap-dev-tool-item-icon {
134
+ font-size: 16px;
135
+ }
130
136
 
131
- .ap-dev-tool-item-text1 {
132
- font-size: 15px;
133
- margin-left: 3px;
134
- }
137
+ .ap-dev-tool-item-icon1 {
138
+ font-size: 18px;
139
+ }
140
+
141
+ .ap-dev-tool-item-text1 {
142
+ font-size: 15px;
143
+ margin-left: 3px;
144
+ color: white;
145
+ }
135
146
  </style>
@@ -5,72 +5,72 @@
5
5
  <el-tabs v-model="pageType" :stretch="true">
6
6
  <el-tab-pane label="单表" name="singleTable">
7
7
  <el-form
8
- ref="singleTableRef"
9
- :model="singleTableForm"
10
- :rules="singleTableFormRules"
11
- label-position="left"
12
- label-width="80px"
8
+ ref="singleTableRef"
9
+ :model="singleTableForm"
10
+ :rules="singleTableFormRules"
11
+ label-position="left"
12
+ label-width="80px"
13
13
  >
14
14
  <el-form-item label="表名" prop="tableName">
15
15
  <el-select
16
- v-model="singleTableForm.tableName"
17
- placeholder="请选择表"
18
- filterable
19
- class="template-select"
16
+ v-model="singleTableForm.tableName"
17
+ placeholder="请选择表"
18
+ filterable
19
+ class="template-select"
20
20
  >
21
21
  <el-option
22
- v-for="item in singleTableList"
23
- :key="item.tableSchema + '.' + item.fdName"
24
- :label="item.fdName + ' ' + item.comment"
25
- :value="item.tableSchema + '.' + item.fdName"
22
+ v-for="item in singleTableList"
23
+ :key="item.tableSchema + '.' + item.fdName"
24
+ :label="item.fdName + ' ' + item.comment"
25
+ :value="item.tableSchema + '.' + item.fdName"
26
26
  />
27
27
  </el-select>
28
28
  </el-form-item>
29
29
  <el-form-item label="显示列" prop="showColumns">
30
30
  <el-select
31
- v-model="singleTableForm.showColumns"
32
- placeholder="请选择显示列"
33
- class="template-select"
34
- filterable
35
- multiple
36
- collapse-tags
31
+ v-model="singleTableForm.showColumns"
32
+ placeholder="请选择显示列"
33
+ class="template-select"
34
+ filterable
35
+ multiple
36
+ collapse-tags
37
37
  >
38
38
  <el-option
39
- v-for="item in singleTableColumnList"
40
- :key="item.columnName"
41
- :label="item.columnName + ' ' + item.columnComment"
42
- :value="item.columnName"
39
+ v-for="item in singleTableColumnList"
40
+ :key="item.columnName"
41
+ :label="item.columnName + ' ' + item.columnComment"
42
+ :value="item.columnName"
43
43
  />
44
44
  </el-select>
45
45
  </el-form-item>
46
46
  <el-form-item label="顶部栏">
47
47
  <el-switch
48
- v-model="singleTableForm.showHeader"
49
- :active-value="1"
50
- :inactive-value="0"
48
+ v-model="singleTableForm.showHeader"
49
+ :active-value="1"
50
+ :inactive-value="0"
51
51
  />
52
52
  </el-form-item>
53
53
  <el-form-item label="表单编辑" prop="isForm">
54
54
  <el-switch
55
- v-model="singleTableForm.isForm"
56
- :active-value="1"
57
- :inactive-value="0"
55
+ v-model="singleTableForm.isForm"
56
+ :active-value="1"
57
+ :inactive-value="0"
58
58
  />
59
59
  </el-form-item>
60
60
  <el-form-item label="表单字段" prop="formItems">
61
61
  <el-select
62
- v-model="singleTableForm.formItems"
63
- placeholder="请选择表单内容"
64
- class="template-select"
65
- filterable
66
- multiple
67
- collapse-tags
62
+ v-model="singleTableForm.formItems"
63
+ placeholder="请选择表单内容"
64
+ class="template-select"
65
+ filterable
66
+ multiple
67
+ collapse-tags
68
68
  >
69
69
  <el-option
70
- v-for="item in singleTableColumnList"
71
- :key="item.columnName"
72
- :label="item.columnName + ' ' + item.columnComment"
73
- :value="item.columnName"
70
+ v-for="item in singleTableColumnList"
71
+ :key="item.columnName"
72
+ :label="item.columnName + ' ' + item.columnComment"
73
+ :value="item.columnName"
74
74
  />
75
75
  </el-select>
76
76
  </el-form-item>
@@ -79,12 +79,12 @@
79
79
  </el-tab-pane>
80
80
  <el-tab-pane label="多表" name="multiTable">
81
81
  <el-form
82
- ref="multiTableRef"
83
- :model="multiTableForm"
84
- :rules="multiTableFormRules"
85
- :inline-message="true"
86
- label-position="left"
87
- label-width="90px"
82
+ ref="multiTableRef"
83
+ :model="multiTableForm"
84
+ :rules="multiTableFormRules"
85
+ :inline-message="true"
86
+ label-position="left"
87
+ label-width="90px"
88
88
  >
89
89
  <el-form-item label="布局">
90
90
  <el-radio-group v-model="multiTableForm.layoutType">
@@ -97,132 +97,132 @@
97
97
  <template v-if="multiTableForm.layoutType == 't3'">
98
98
  <el-form-item label="左侧树表" prop="tableNameA">
99
99
  <el-select
100
- v-model="multiTableForm.tableNameA"
101
- placeholder="请选择表"
102
- class="template-select"
103
- filterable
100
+ v-model="multiTableForm.tableNameA"
101
+ placeholder="请选择表"
102
+ class="template-select"
103
+ filterable
104
104
  >
105
105
  <el-option
106
- v-for="item in multiTableListA"
107
- :key="item.tableSchema + '.' + item.fdName"
108
- :label="item.fdName + ' ' + item.comment"
109
- :value="item.tableSchema + '.' + item.fdName"
106
+ v-for="item in multiTableListA"
107
+ :key="item.tableSchema + '.' + item.fdName"
108
+ :label="item.fdName + ' ' + item.comment"
109
+ :value="item.tableSchema + '.' + item.fdName"
110
110
  />
111
111
  </el-select>
112
112
  </el-form-item>
113
113
  <el-form-item label="树-id" prop="treeIdKeyA">
114
114
  <el-input
115
- v-model="multiTableForm.treeIdKeyA"
116
- placeholder="树id(唯一)"
117
- class="template-input"
115
+ v-model="multiTableForm.treeIdKeyA"
116
+ placeholder="树id(唯一)"
117
+ class="template-input"
118
118
  />
119
119
  </el-form-item>
120
120
  <el-form-item label="树-父id" prop="treeParentKeyA">
121
121
  <el-input
122
- v-model="multiTableForm.treeParentKeyA"
123
- placeholder="树父id"
124
- class="template-input"
122
+ v-model="multiTableForm.treeParentKeyA"
123
+ placeholder="树父id"
124
+ class="template-input"
125
125
  />
126
126
  </el-form-item>
127
127
  <el-form-item label="树-显示值" prop="treeLabelA">
128
128
  <el-input
129
- v-model="multiTableForm.treeLabelA"
130
- placeholder="树显示属性"
131
- class="template-input"
129
+ v-model="multiTableForm.treeLabelA"
130
+ placeholder="树显示属性"
131
+ class="template-input"
132
132
  />
133
133
  </el-form-item>
134
134
  <el-form-item label="多选">
135
135
  <el-switch
136
- v-model="multiTableForm.isMultiSelectA"
137
- :active-value="1"
138
- :inactive-value="0"
136
+ v-model="multiTableForm.isMultiSelectA"
137
+ :active-value="1"
138
+ :inactive-value="0"
139
139
  />
140
140
  </el-form-item>
141
141
  <el-form-item label="可编辑">
142
142
  <el-switch
143
- v-model="multiTableForm.isEditA"
144
- :active-value="1"
145
- :inactive-value="0"
143
+ v-model="multiTableForm.isEditA"
144
+ :active-value="1"
145
+ :inactive-value="0"
146
146
  />
147
147
  </el-form-item>
148
148
  <el-form-item label="编辑列" prop="showColumnsA">
149
149
  <el-select
150
- v-model="multiTableForm.showColumnsA"
151
- placeholder="请选择显示列"
152
- class="template-select"
153
- filterable
154
- multiple
155
- collapse-tags
150
+ v-model="multiTableForm.showColumnsA"
151
+ placeholder="请选择显示列"
152
+ class="template-select"
153
+ filterable
154
+ multiple
155
+ collapse-tags
156
156
  >
157
157
  <el-option
158
- v-for="item in multiTableColumnListA"
159
- :key="item.columnName"
160
- :label="item.columnName + ' ' + item.columnComment"
161
- :value="item.columnName"
158
+ v-for="item in multiTableColumnListA"
159
+ :key="item.columnName"
160
+ :label="item.columnName + ' ' + item.columnComment"
161
+ :value="item.columnName"
162
162
  />
163
163
  </el-select>
164
164
  </el-form-item>
165
165
  <div class="ap-split-line"/>
166
166
  <el-form-item label="右侧表" prop="tableNameB">
167
167
  <el-select
168
- v-model="multiTableForm.tableNameB"
169
- placeholder="请选择表"
170
- class="template-select"
171
- filterable
168
+ v-model="multiTableForm.tableNameB"
169
+ placeholder="请选择表"
170
+ class="template-select"
171
+ filterable
172
172
  >
173
173
  <el-option
174
- v-for="item in multiTableListB"
175
- :key="item.tableSchema + '.' + item.fdName"
176
- :label="item.fdName + ' ' + item.comment"
177
- :value="item.tableSchema + '.' + item.fdName"
174
+ v-for="item in multiTableListB"
175
+ :key="item.tableSchema + '.' + item.fdName"
176
+ :label="item.fdName + ' ' + item.comment"
177
+ :value="item.tableSchema + '.' + item.fdName"
178
178
  />
179
179
  </el-select>
180
180
  </el-form-item>
181
181
  <el-form-item label="显示列" prop="showColumnsB">
182
182
  <el-select
183
- v-model="multiTableForm.showColumnsB"
184
- placeholder="请选择显示列"
185
- class="template-select"
186
- filterable
187
- multiple
188
- collapse-tags
183
+ v-model="multiTableForm.showColumnsB"
184
+ placeholder="请选择显示列"
185
+ class="template-select"
186
+ filterable
187
+ multiple
188
+ collapse-tags
189
189
  >
190
190
  <el-option
191
- v-for="item in multiTableColumnListB"
192
- :key="item.columnName"
193
- :label="item.columnName + ' ' + item.columnComment"
194
- :value="item.columnName"
191
+ v-for="item in multiTableColumnListB"
192
+ :key="item.columnName"
193
+ :label="item.columnName + ' ' + item.columnComment"
194
+ :value="item.columnName"
195
195
  />
196
196
  </el-select>
197
197
  </el-form-item>
198
198
  <el-form-item label="顶部栏">
199
199
  <el-switch
200
- v-model="multiTableForm.showHeaderB"
201
- :active-value="1"
202
- :inactive-value="0"
200
+ v-model="multiTableForm.showHeaderB"
201
+ :active-value="1"
202
+ :inactive-value="0"
203
203
  />
204
204
  </el-form-item>
205
205
  <el-form-item label="表单编辑">
206
206
  <el-switch
207
- v-model="multiTableForm.isFormB"
208
- :active-value="1"
209
- :inactive-value="0"
207
+ v-model="multiTableForm.isFormB"
208
+ :active-value="1"
209
+ :inactive-value="0"
210
210
  />
211
211
  </el-form-item>
212
212
  <el-form-item label="表单字段" prop="formItemsB">
213
213
  <el-select
214
- v-model="multiTableForm.formItemsB"
215
- placeholder="请选择表单内容"
216
- class="template-select"
217
- filterable
218
- multiple
219
- collapse-tags
214
+ v-model="multiTableForm.formItemsB"
215
+ placeholder="请选择表单内容"
216
+ class="template-select"
217
+ filterable
218
+ multiple
219
+ collapse-tags
220
220
  >
221
221
  <el-option
222
- v-for="item in multiTableColumnListB"
223
- :key="item.columnName"
224
- :label="item.columnName + ' ' + item.columnComment"
225
- :value="item.columnName"
222
+ v-for="item in multiTableColumnListB"
223
+ :key="item.columnName"
224
+ :label="item.columnName + ' ' + item.columnComment"
225
+ :value="item.columnName"
226
226
  />
227
227
  </el-select>
228
228
  </el-form-item>
@@ -230,122 +230,122 @@
230
230
  <template v-if="multiTableForm.layoutType == 't4'|| multiTableForm.layoutType == 't5'">
231
231
  <el-form-item label="顶部栏">
232
232
  <el-switch
233
- v-model="multiTableForm.showHeaderA"
234
- :active-value="1"
235
- :inactive-value="0"
233
+ v-model="multiTableForm.showHeaderA"
234
+ :active-value="1"
235
+ :inactive-value="0"
236
236
  />
237
237
  </el-form-item>
238
238
  <div class="ap-split-line"/>
239
239
  <el-form-item label="左侧表" prop="tableNameA">
240
240
  <el-select
241
- v-model="multiTableForm.tableNameA"
242
- placeholder="请选择表"
243
- class="template-select"
244
- filterable
241
+ v-model="multiTableForm.tableNameA"
242
+ placeholder="请选择表"
243
+ class="template-select"
244
+ filterable
245
245
  >
246
246
  <el-option
247
- v-for="item in multiTableListA"
248
- :key="item.tableSchema + '.' + item.fdName"
249
- :label="item.tableSchema + '.' + item.fdName + ' ' + item.comment"
250
- :value="item.tableSchema + '.' + item.fdName"
247
+ v-for="item in multiTableListA"
248
+ :key="item.tableSchema + '.' + item.fdName"
249
+ :label="item.tableSchema + '.' + item.fdName + ' ' + item.comment"
250
+ :value="item.tableSchema + '.' + item.fdName"
251
251
  />
252
252
  </el-select>
253
253
  </el-form-item>
254
254
  <el-form-item label="显示列" prop="showColumnsA">
255
255
  <el-select
256
- v-model="multiTableForm.showColumnsA"
257
- placeholder="请选择显示列"
258
- class="template-select"
259
- filterable
260
- multiple
261
- collapse-tags
256
+ v-model="multiTableForm.showColumnsA"
257
+ placeholder="请选择显示列"
258
+ class="template-select"
259
+ filterable
260
+ multiple
261
+ collapse-tags
262
262
  >
263
263
  <el-option
264
- v-for="item in multiTableColumnListA"
265
- :key="item.columnName"
266
- :label="item.columnName + ' ' + item.columnComment"
267
- :value="item.columnName"
264
+ v-for="item in multiTableColumnListA"
265
+ :key="item.columnName"
266
+ :label="item.columnName + ' ' + item.columnComment"
267
+ :value="item.columnName"
268
268
  />
269
269
  </el-select>
270
270
  </el-form-item>
271
271
  <el-form-item label="表单编辑" prop="isFormA">
272
272
  <el-switch
273
- v-model="multiTableForm.isFormA"
274
- :active-value="1"
275
- :inactive-value="0"
273
+ v-model="multiTableForm.isFormA"
274
+ :active-value="1"
275
+ :inactive-value="0"
276
276
  />
277
277
  </el-form-item>
278
278
  <el-form-item label="表单字段" prop="formItemsA">
279
279
  <el-select
280
- v-model="multiTableForm.formItemsA"
281
- placeholder="请选择表单内容"
282
- class="template-select"
283
- filterable
284
- multiple
285
- collapse-tags
280
+ v-model="multiTableForm.formItemsA"
281
+ placeholder="请选择表单内容"
282
+ class="template-select"
283
+ filterable
284
+ multiple
285
+ collapse-tags
286
286
  >
287
287
  <el-option
288
- v-for="item in multiTableColumnListA"
289
- :key="item.columnName"
290
- :label="item.columnName + ' ' + item.columnComment"
291
- :value="item.columnName"
288
+ v-for="item in multiTableColumnListA"
289
+ :key="item.columnName"
290
+ :label="item.columnName + ' ' + item.columnComment"
291
+ :value="item.columnName"
292
292
  />
293
293
  </el-select>
294
294
  </el-form-item>
295
295
  <div class="ap-split-line"/>
296
296
  <el-form-item label="右侧表" prop="tableNameB">
297
297
  <el-select
298
- v-model="multiTableForm.tableNameB"
299
- placeholder="请选择表"
300
- class="template-select"
301
- filterable
298
+ v-model="multiTableForm.tableNameB"
299
+ placeholder="请选择表"
300
+ class="template-select"
301
+ filterable
302
302
  >
303
303
  <el-option
304
- v-for="item in multiTableListB"
305
- :key="item.tableSchema + '.' + item.fdName"
306
- :label="item.tableSchema + '.' + item.fdName + ' ' + item.comment"
307
- :value="item.tableSchema + '.' + item.fdName"
304
+ v-for="item in multiTableListB"
305
+ :key="item.tableSchema + '.' + item.fdName"
306
+ :label="item.tableSchema + '.' + item.fdName + ' ' + item.comment"
307
+ :value="item.tableSchema + '.' + item.fdName"
308
308
  />
309
309
  </el-select>
310
310
  </el-form-item>
311
311
  <el-form-item label="显示列" prop="showColumnsB">
312
312
  <el-select
313
- v-model="multiTableForm.showColumnsB"
314
- placeholder="请选择显示列"
315
- class="template-select"
316
- filterable
317
- multiple
318
- collapse-tags
313
+ v-model="multiTableForm.showColumnsB"
314
+ placeholder="请选择显示列"
315
+ class="template-select"
316
+ filterable
317
+ multiple
318
+ collapse-tags
319
319
  >
320
320
  <el-option
321
- v-for="item in multiTableColumnListB"
322
- :key="item.columnName"
323
- :label="item.columnName + ' ' + item.columnComment"
324
- :value="item.columnName"
321
+ v-for="item in multiTableColumnListB"
322
+ :key="item.columnName"
323
+ :label="item.columnName + ' ' + item.columnComment"
324
+ :value="item.columnName"
325
325
  />
326
326
  </el-select>
327
327
  </el-form-item>
328
328
  <el-form-item label="表单编辑">
329
329
  <el-switch
330
- v-model="multiTableForm.isFormB"
331
- :active-value="1"
332
- :inactive-value="0"
330
+ v-model="multiTableForm.isFormB"
331
+ :active-value="1"
332
+ :inactive-value="0"
333
333
  />
334
334
  </el-form-item>
335
335
  <el-form-item label="表单字段" prop="formItemsB">
336
336
  <el-select
337
- v-model="multiTableForm.formItemsB"
338
- placeholder="请选择表单内容"
339
- class="template-select"
340
- filterable
341
- multiple
342
- collapse-tags
337
+ v-model="multiTableForm.formItemsB"
338
+ placeholder="请选择表单内容"
339
+ class="template-select"
340
+ filterable
341
+ multiple
342
+ collapse-tags
343
343
  >
344
344
  <el-option
345
- v-for="item in multiTableColumnListB"
346
- :key="item.columnName"
347
- :label="item.columnName + ' ' + item.columnComment"
348
- :value="item.columnName"
345
+ v-for="item in multiTableColumnListB"
346
+ :key="item.columnName"
347
+ :label="item.columnName + ' ' + item.columnComment"
348
+ :value="item.columnName"
349
349
  />
350
350
  </el-select>
351
351
  </el-form-item>
@@ -367,333 +367,354 @@
367
367
 
368
368
  <div class="flex flex-center" style="margin-bottom: 5px;">
369
369
  <el-button
370
- type="primary"
371
- icon="el-icon-magic-stick"
372
- circle
373
- style="padding: 15px;font-size: 30px;"
374
- @click="generateVueCode"
370
+ type="primary"
371
+ icon="el-icon-magic-stick"
372
+ circle
373
+ style="padding: 15px;font-size: 30px;"
374
+ @click="generateVueCode"
375
375
  />
376
376
  </div>
377
377
  </div>
378
378
 
379
379
  </ap-aside>
380
- <ap-main margin="1110" class="template-content">
381
- <comment :is="currentVueComp"/>
380
+ <ap-main margin="1110" class="template-content" v-loading="iframeLoading">
381
+ <iframe v-if="showIframe" id="iframeId" :src="userConfig.fdVueHref + 'GeneratorPage?comp=' + currentVueComp"
382
+ style="width: 100%;height: 100%;border: 0px;vertical-align: top;">
383
+ </iframe>
382
384
  </ap-main>
383
385
  </ap-container>
384
386
  </template>
385
387
 
386
388
  <script>
387
- import {getLocalData, getSourceId, setLocalData} from './../dev/DevUtil'
389
+ import {getLocalData, getUserConfig, setLocalData} from './../dev/DevUtil'
388
390
 
389
- // 批量导入组件
390
- const allComponents = require.context('@/views/generator', false, /\.vue$/)
391
- const generatorVueComp = {}
392
- allComponents.keys().forEach(fileName => {
393
- const comp = allComponents(fileName)
394
- generatorVueComp[fileName.replace(/^\.\/(.*)\.\w+$/, '$1')] = comp.default
395
- })
396
- export default {
397
- name: 'TemplatePanel',
398
- components: generatorVueComp,
399
- data() {
400
- return {
401
- // -------- 通用 --------
402
- pageType: 'singleTable',
403
- currentVueComp: getLocalData('currentComp').name,
404
- isTableNameFirstLoad: true,
405
- isTableNameAFirstLoad: true,
406
- isTableNameBFirstLoad: true,
407
- // -------- 单表 --------
408
- singleTableList: [],
409
- singleTableColumnList: [],
410
- singleTableForm: {
411
- layoutType: 't1',
412
- tableName: '',
413
- showColumns: '',
414
- formItems: '',
415
- isForm: 0,
416
- showHeader: 1
417
- },
418
- singleTableFormRules: {
419
- tableName: [{required: true, message: '请选择表', trigger: 'blur'}],
420
- showColumns: [{required: true, message: '请选择需要显示的列', trigger: 'blur'}]
421
- },
422
- // -------- 多表 --------
423
- multiTableListA: [],
424
- multiTableColumnListA: [],
425
- multiTableListB: [],
426
- multiTableColumnListB: [],
427
- multiTableForm: {
428
- layoutType: 't3',
429
- tableNameA: '',
430
- showColumnsA: '',
431
- treeIdKeyA: 'fdId',
432
- treeLabelA: 'fdName',
433
- treeParentKeyA: 'fdParentId',
434
- isMultiSelectA: 1,
435
- isEditA: 1,
436
- showHeaderA: 1,
437
- isFormA: 0,
391
+ export default {
392
+ name: 'TemplatePanel',
393
+ data() {
394
+ return {
395
+ iframeLoading: true,
396
+ showIframe: true,
397
+ // -------- 通用 --------
398
+ pageType: 'singleTable',
399
+ currentVueComp: getLocalData('currentComp').name,
400
+ isTableNameFirstLoad: true,
401
+ isTableNameAFirstLoad: true,
402
+ isTableNameBFirstLoad: true,
403
+ // -------- 单表 --------
404
+ singleTableList: [],
405
+ singleTableColumnList: [],
406
+ singleTableForm: {
407
+ layoutType: 't1',
408
+ tableName: '',
409
+ showColumns: '',
410
+ formItems: '',
411
+ isForm: 0,
412
+ showHeader: 1
413
+ },
414
+ singleTableFormRules: {
415
+ tableName: [{required: true, message: '请选择表', trigger: 'blur'}],
416
+ showColumns: [{required: true, message: '请选择需要显示的列', trigger: 'blur'}]
417
+ },
418
+ // -------- 多表 --------
419
+ multiTableListA: [],
420
+ multiTableColumnListA: [],
421
+ multiTableListB: [],
422
+ multiTableColumnListB: [],
423
+ multiTableForm: {
424
+ layoutType: 't3',
425
+ tableNameA: '',
426
+ showColumnsA: '',
427
+ treeIdKeyA: 'fdId',
428
+ treeLabelA: 'fdName',
429
+ treeParentKeyA: 'fdParentId',
430
+ isMultiSelectA: 1,
431
+ isEditA: 1,
432
+ showHeaderA: 1,
433
+ isFormA: 0,
438
434
 
439
- tableNameB: '',
440
- showColumnsB: '',
441
- formItemsB: '',
442
- showHeaderB: 1,
443
- isFormB: 0
444
- },
445
- multiTableFormRules: {
446
- tableNameA: [{required: true, message: '必填', trigger: 'blur'}],
447
- treeLabelA: [{required: true, message: '必填', trigger: 'blur'}],
448
- treeParentKeyA: [{required: true, message: '必填', trigger: 'blur'}],
449
- treeIdKeyA: [{required: true, message: '必填', trigger: 'blur'}],
450
- tableNameB: [{required: true, message: '必填', trigger: 'blur'}],
451
- showColumnsB: [{required: true, message: '必填', trigger: 'blur'}]
452
- }
453
- }
454
- },
455
- watch: {
456
- 'singleTableForm.tableName'(value) {
457
- this.initTableColumnList(this.singleTableForm.tableName, 'singleTableColumnList')
458
- if (!this.isTableNameFirstLoad) {
459
- this.singleTableForm.showColumns = ''
460
- this.singleTableForm.formItems = ''
461
- }
462
- this.isTableNameFirstLoad = false
435
+ tableNameB: '',
436
+ showColumnsB: '',
437
+ formItemsB: '',
438
+ showHeaderB: 1,
439
+ isFormB: 0
463
440
  },
464
- 'multiTableForm.tableNameA'(value) {
465
- this.initTableColumnList(this.multiTableForm.tableNameA, 'multiTableColumnListA')
466
- if (!this.isTableNameAFirstLoad) {
467
- this.multiTableForm.showColumnsA = ''
468
- }
469
- this.isTableNameAFirstLoad = false
441
+ multiTableFormRules: {
442
+ tableNameA: [{required: true, message: '必填', trigger: 'blur'}],
443
+ treeLabelA: [{required: true, message: '必填', trigger: 'blur'}],
444
+ treeParentKeyA: [{required: true, message: '必填', trigger: 'blur'}],
445
+ treeIdKeyA: [{required: true, message: '必填', trigger: 'blur'}],
446
+ tableNameB: [{required: true, message: '必填', trigger: 'blur'}],
447
+ showColumnsB: [{required: true, message: '必填', trigger: 'blur'}]
470
448
  },
471
- 'multiTableForm.tableNameB'(value) {
472
- this.initTableColumnList(this.multiTableForm.tableNameB, 'multiTableColumnListB')
473
- if (!this.isTableNameBFirstLoad) {
474
- this.multiTableForm.showColumnsB = ''
475
- this.multiTableForm.formItemsB = ''
476
- }
477
- this.isTableNameBFirstLoad = false
449
+
450
+ userConfig: getUserConfig()
451
+ }
452
+ },
453
+ watch: {
454
+ 'singleTableForm.tableName'(value) {
455
+ this.initTableColumnList(this.singleTableForm.tableName, 'singleTableColumnList')
456
+ if (!this.isTableNameFirstLoad) {
457
+ this.singleTableForm.showColumns = ''
458
+ this.singleTableForm.formItems = ''
478
459
  }
460
+ this.isTableNameFirstLoad = false
479
461
  },
480
- created() {
481
- this.initTableList()
482
- this.currentVueComp = this.initDefaultData('currentComp', getLocalData('currentComp').name)
483
- this.singleTableForm = this.initDefaultData('singleTableForm', getLocalData('singleTableForm'))
484
- this.multiTableForm = this.initDefaultData('multiTableForm', getLocalData('multiTableForm'))
462
+ 'multiTableForm.tableNameA'(value) {
463
+ this.initTableColumnList(this.multiTableForm.tableNameA, 'multiTableColumnListA')
464
+ if (!this.isTableNameAFirstLoad) {
465
+ this.multiTableForm.showColumnsA = ''
466
+ }
467
+ this.isTableNameAFirstLoad = false
485
468
  },
486
- methods: {
487
- // 设定默认参数
488
- initDefaultData(formName, localData) {
489
- if (localData == null || localData == '') {
490
- return this[formName]
469
+ 'multiTableForm.tableNameB'(value) {
470
+ this.initTableColumnList(this.multiTableForm.tableNameB, 'multiTableColumnListB')
471
+ if (!this.isTableNameBFirstLoad) {
472
+ this.multiTableForm.showColumnsB = ''
473
+ this.multiTableForm.formItemsB = ''
474
+ }
475
+ this.isTableNameBFirstLoad = false
476
+ }
477
+ },
478
+ created() {
479
+ this.initTableList()
480
+ this.currentVueComp = this.initDefaultData('currentComp', getLocalData('currentComp').name)
481
+ this.singleTableForm = this.initDefaultData('singleTableForm', getLocalData('singleTableForm'))
482
+ this.multiTableForm = this.initDefaultData('multiTableForm', getLocalData('multiTableForm'))
483
+ },
484
+ mounted() {
485
+ this.addIframeOnload();
486
+ },
487
+ methods: {
488
+ addIframeOnload(){
489
+ const iframe = document.querySelector('#iframeId')
490
+ // 处理兼容行问题
491
+ if (iframe.attachEvent) {
492
+ iframe.attachEvent('onload', () => {
493
+ this.iframeLoading = false;
494
+ console.log("模版加载完成");
495
+ })
496
+ } else {
497
+ iframe.onload = () => {
498
+ this.iframeLoading = false;
499
+ console.log("模版加载完成");
491
500
  }
492
- for (const key in this[formName]) {
493
- let hasKey = false
494
- for (const oldKey in localData) {
495
- if (oldKey == key) {
496
- if (localData[key] == null) {
497
- localData[key] = this[formName][key]
498
- }
499
- hasKey = true
500
- break
501
+ }
502
+ },
503
+ // 设定默认参数
504
+ initDefaultData(formName, localData) {
505
+ if (localData == null || localData == '') {
506
+ return this[formName]
507
+ }
508
+ for (const key in this[formName]) {
509
+ let hasKey = false
510
+ for (const oldKey in localData) {
511
+ if (oldKey == key) {
512
+ if (localData[key] == null) {
513
+ localData[key] = this[formName][key]
501
514
  }
515
+ hasKey = true
516
+ break
502
517
  }
503
- if (!hasKey) {
504
- localData[key] = this[formName][key]
505
- }
506
518
  }
519
+ if (!hasKey) {
520
+ localData[key] = this[formName][key]
521
+ }
522
+ }
507
523
 
508
- return localData
509
- },
510
- splitTableStr(tableInfo) {
511
- if (tableInfo == null || tableInfo.length < 1) {
512
- return {}
524
+ return localData
525
+ },
526
+ splitTableStr(tableInfo) {
527
+ if (tableInfo == null || tableInfo.length < 1) {
528
+ return {}
529
+ }
530
+ const arr = tableInfo.split('.')
531
+ return {
532
+ tableSchema: arr[0],
533
+ tableName: arr[1]
534
+ }
535
+ },
536
+ // 表格下拉列表
537
+ initTableList() {
538
+ this.$request({
539
+ url: '/apd/db/DevDbTable/getTableSelect',
540
+ method: 'post',
541
+ data: {
542
+ sourceId: this.userConfig.fdSourceId
513
543
  }
514
- const arr = tableInfo.split('.')
515
- return {
516
- tableSchema: arr[0],
517
- tableName: arr[1]
544
+ }).then(response => {
545
+ this.singleTableList = response.data;
546
+ this.multiTableListA = response.data;
547
+ this.multiTableListB = response.data;
548
+ })
549
+ },
550
+ // 表格列下拉列表
551
+ initTableColumnList(tableInfo, prop) {
552
+ const tableObj = this.splitTableStr(tableInfo)
553
+ this.$request({
554
+ url: '/apd/db/DevDbTable/getTableColumns',
555
+ method: 'post',
556
+ data: {
557
+ tableSchema: tableObj.tableSchema,
558
+ tableName: tableObj.tableName,
559
+ sourceId: this.userConfig.fdSourceId
518
560
  }
519
- },
520
- // 表格下拉列表
521
- initTableList() {
522
- this.$request({
523
- url: '/apd/db/DevDbTable/getTableSelect',
524
- method: 'post',
525
- data: {
526
- sourceId: getSourceId()
561
+ }).then(response => {
562
+ this[prop] = response.data
563
+ })
564
+ },
565
+ // 代码生成入口
566
+ generateVueCode() {
567
+ const vueUrl = this.userConfig.fdVuePath
568
+ const projectName = this.userConfig.fdJavaHref
569
+ if (vueUrl == null || vueUrl == '' || projectName == null || projectName == '') {
570
+ this.$message.error('请先配置共通参数。【顶栏】->【配置】')
571
+ return
572
+ }
573
+ if (this.pageType == 'singleTable') {
574
+ this.$refs.singleTableRef.validate((valid) => {
575
+ if (!valid) {
576
+ return false
527
577
  }
528
- }).then(response => {
529
- this.singleTableList = response.data;
530
- this.multiTableListA = response.data;
531
- this.multiTableListB = response.data;
578
+ this.generateSingleTable()
532
579
  })
533
- },
534
- // 表格列下拉列表
535
- initTableColumnList(tableInfo, prop) {
536
- const tableObj = this.splitTableStr(tableInfo)
537
- this.$request({
538
- url: '/apd/db/DevDbTable/getTableColumns',
539
- method: 'post',
540
- data: {
541
- tableSchema: tableObj.tableSchema,
542
- tableName: tableObj.tableName,
543
- sourceId:getSourceId()
580
+ } else {
581
+ this.$refs.multiTableRef.validate((valid) => {
582
+ if (!valid) {
583
+ return false
544
584
  }
545
- }).then(response => {
546
- this[prop] = response.data
585
+ this.generateMultiTable()
547
586
  })
548
- },
549
- // 代码生成入口
550
- generateVueCode() {
551
- const vueUrl = getLocalData('configForm').vueUrl
552
- const projectName = getLocalData('configForm').projectName
553
- if (vueUrl == null || vueUrl == '' || projectName == null || projectName == '') {
554
- this.$message.error('请先配置共通参数。【顶栏】->【配置】')
555
- return
556
- }
557
- if (this.pageType == 'singleTable') {
558
- this.$refs.singleTableRef.validate((valid) => {
559
- if (!valid) {
560
- return false
561
- }
562
- this.generateSingleTable()
563
- })
564
- } else {
565
- this.$refs.multiTableRef.validate((valid) => {
566
- if (!valid) {
567
- return false
568
- }
569
- this.generateMultiTable()
570
- })
587
+ }
588
+ },
589
+ createFile(projectName, list) {
590
+ this.showIframe = false;
591
+ this.iframeLoading = true;
592
+ this.$request({
593
+ url: '/apd/dev/DevGenerateCode/createFile',
594
+ method: 'post',
595
+ data: {
596
+ list: JSON.stringify(list),
597
+ projectName: projectName
571
598
  }
572
- },
573
- createFile(projectName, list) {
574
- this.$request({
575
- url: '/apd/dev/DevGenerateCode/createFile',
576
- method: 'post',
577
- data: {
578
- list: JSON.stringify(list),
579
- projectName: projectName
580
- }
581
- }).then(response => {
582
- const msg = response.data
583
- // 重置
584
- this.currentVueComp = ''
585
- this.currentVueComp = msg.split('.vue')[0]
586
- setLocalData('currentComp', {name: this.currentVueComp})
587
- console.log('当前组件:' + this.currentVueComp)
588
- this.$message.success(msg)
599
+ }).then(response => {
600
+ const msg = response.data
601
+ // 重置
602
+ this.currentVueComp = msg.split('.vue')[0]
603
+ setLocalData('currentComp', {name: this.currentVueComp})
604
+ console.log('当前组件:' + this.currentVueComp)
605
+ this.showIframe = true;
606
+ this.$nextTick(()=>{
607
+ this.addIframeOnload(iframeId);
589
608
  })
590
- },
591
- // 生成请求
592
- doCreateVueCode(params) {
593
- // 共通参数
594
- params.vueUrl = getLocalData('configForm').vueUrl
595
- params.projectName = getLocalData('configForm').projectName
609
+ this.$message.success(msg)
610
+ })
611
+ },
612
+ // 生成请求
613
+ doCreateVueCode(params) {
614
+ // 共通参数
615
+ params.vueUrl = this.userConfig.fdVuePath
616
+ params.projectName = this.userConfig.fdJavaHref
596
617
 
597
- const tableObj = this.splitTableStr(params.tableName)
598
- params.tableSchema = tableObj.tableSchema
599
- params.tableName = tableObj.tableName
600
- const tableObjA = this.splitTableStr(params.tableNameA)
601
- params.tableSchemaA = tableObjA.tableSchema
602
- params.tableNameA = tableObjA.tableName
603
- const tableObjB = this.splitTableStr(params.tableNameB)
604
- params.tableSchemaB = tableObjB.tableSchema
605
- params.tableNameB = tableObjB.tableName
606
- params.sourceId = getSourceId();
618
+ const tableObj = this.splitTableStr(params.tableName)
619
+ params.tableSchema = tableObj.tableSchema
620
+ params.tableName = tableObj.tableName
621
+ const tableObjA = this.splitTableStr(params.tableNameA)
622
+ params.tableSchemaA = tableObjA.tableSchema
623
+ params.tableNameA = tableObjA.tableName
624
+ const tableObjB = this.splitTableStr(params.tableNameB)
625
+ params.tableSchemaB = tableObjB.tableSchema
626
+ params.tableNameB = tableObjB.tableName
627
+ params.sourceId = this.userConfig.fdSourceId;
607
628
 
608
- this.$request({
609
- url: '/apd/dev/DevGenerateCode/getVueCode',
610
- method: 'post',
611
- data: params
612
- }).then(response => {
613
- // 生成文件
614
- this.createFile(params.projectName, response.data)
615
- })
616
- },
617
- // 单表生成
618
- generateSingleTable() {
619
- setLocalData('singleTableForm', this.singleTableForm)
629
+ this.$request({
630
+ url: '/apd/dev/DevGenerateCode/getVueCode',
631
+ method: 'post',
632
+ data: params
633
+ }).then(response => {
634
+ // 生成文件
635
+ this.createFile(params.projectName, response.data)
636
+ })
637
+ },
638
+ // 单表生成
639
+ generateSingleTable() {
640
+ setLocalData('singleTableForm', this.singleTableForm)
620
641
 
621
- // 默认表单一致
622
- const params = JSON.parse(JSON.stringify(this.singleTableForm))
623
- const showColumns = this.singleTableForm.showColumns
624
- params.showColumns = showColumns != '' ? showColumns.join() : ''
625
- const formItems = this.singleTableForm.formItems
626
- params.formItems = formItems != '' ? formItems.join() : ''
627
- if (params.layoutType == 't1' && params.isForm == 0) {
628
- params.createVueType = 'vueA'
629
- }
630
- if (params.layoutType == 't1' && params.isForm == 1) {
631
- params.createVueType = 'vueA1'
632
- }
633
- this.doCreateVueCode(params)
634
- },
635
- // 多表生成
636
- generateMultiTable() {
637
- setLocalData('multiTableForm', this.multiTableForm)
642
+ // 默认表单一致
643
+ const params = JSON.parse(JSON.stringify(this.singleTableForm))
644
+ const showColumns = this.singleTableForm.showColumns
645
+ params.showColumns = showColumns != '' ? showColumns.join() : ''
646
+ const formItems = this.singleTableForm.formItems
647
+ params.formItems = formItems != '' ? formItems.join() : ''
648
+ if (params.layoutType == 't1' && params.isForm == 0) {
649
+ params.createVueType = 'vueA'
650
+ }
651
+ if (params.layoutType == 't1' && params.isForm == 1) {
652
+ params.createVueType = 'vueA1'
653
+ }
654
+ this.doCreateVueCode(params)
655
+ },
656
+ // 多表生成
657
+ generateMultiTable() {
658
+ setLocalData('multiTableForm', this.multiTableForm)
638
659
 
639
- // 默认表单一致
640
- const params = JSON.parse(JSON.stringify(this.multiTableForm))
641
- const showColumnsA = this.multiTableForm.showColumnsA
642
- params.showColumnsA = showColumnsA != '' ? showColumnsA.join() : ''
643
- const formItemsA = this.multiTableForm.formItemsA
644
- params.formItemsA = formItemsA != null ? formItemsA.join() : ''
660
+ // 默认表单一致
661
+ const params = JSON.parse(JSON.stringify(this.multiTableForm))
662
+ const showColumnsA = this.multiTableForm.showColumnsA
663
+ params.showColumnsA = showColumnsA != '' ? showColumnsA.join() : ''
664
+ const formItemsA = this.multiTableForm.formItemsA
665
+ params.formItemsA = formItemsA != null ? formItemsA.join() : ''
645
666
 
646
- params.showColumnsB = this.multiTableForm.showColumnsB.join()
647
- const formItemsB = this.multiTableForm.formItemsB
648
- params.formItemsB = formItemsB != '' ? formItemsB.join() : ''
667
+ params.showColumnsB = this.multiTableForm.showColumnsB.join()
668
+ const formItemsB = this.multiTableForm.formItemsB
669
+ params.formItemsB = formItemsB != '' ? formItemsB.join() : ''
649
670
 
650
- if (params.layoutType == 't3' && params.isFormB == 0) {
651
- params.createVueType = 'vueB'
652
- }
653
- if (params.layoutType == 't3' && params.isFormB == 1) {
654
- params.createVueType = 'vueB1'
655
- }
656
- if ((params.layoutType == 't4' || params.layoutType == 't5') && params.isFormA != 1 && params.isFormB != 1) {
657
- params.createVueType = 'vueC'
658
- }
659
- if ((params.layoutType == 't4' || params.layoutType == 't5') && (params.isFormA == 1 || params.isFormB == 1)) {
660
- params.createVueType = 'vueC1'
661
- }
662
- params.isVertical = params.layoutType == 't5' ? 1 : 0
663
- this.doCreateVueCode(params)
671
+ if (params.layoutType == 't3' && params.isFormB == 0) {
672
+ params.createVueType = 'vueB'
664
673
  }
674
+ if (params.layoutType == 't3' && params.isFormB == 1) {
675
+ params.createVueType = 'vueB1'
676
+ }
677
+ if ((params.layoutType == 't4' || params.layoutType == 't5') && params.isFormA != 1 && params.isFormB != 1) {
678
+ params.createVueType = 'vueC'
679
+ }
680
+ if ((params.layoutType == 't4' || params.layoutType == 't5') && (params.isFormA == 1 || params.isFormB == 1)) {
681
+ params.createVueType = 'vueC1'
682
+ }
683
+ params.isVertical = params.layoutType == 't5' ? 1 : 0
684
+ this.doCreateVueCode(params)
665
685
  }
666
-
667
686
  }
687
+
688
+ }
668
689
  </script>
669
690
 
670
691
  <style scoped>
671
- .template-content {
672
- border: 2px solid #3d76d3;
673
- background-color: #e9ecf1;
674
- padding: 0px;
675
- }
692
+ .template-content {
693
+ border: 2px solid #3d76d3;
694
+ background-color: #e9ecf1;
695
+ padding: 0px;
696
+ }
676
697
 
677
- .template-aside {
678
- margin: 0px;
679
- width: 270px;
680
- padding: 0px 5px;
681
- }
698
+ .template-aside {
699
+ margin: 0px;
700
+ width: 270px;
701
+ padding: 0px 5px;
702
+ }
682
703
 
683
- .template-aside .el-form-item {
684
- margin-bottom: 5px;
685
- }
704
+ .template-aside .el-form-item {
705
+ margin-bottom: 5px;
706
+ }
686
707
 
687
- .template-input {
688
- width: 140px;
689
- }
708
+ .template-input {
709
+ width: 140px;
710
+ }
690
711
 
691
- .template-select {
692
- width: 200px;
693
- }
712
+ .template-select {
713
+ width: 200px;
714
+ }
694
715
 
695
- .ap-split-line {
696
- background-color: #f0f1f2;
697
- }
716
+ .ap-split-line {
717
+ background-color: #f0f1f2;
718
+ }
698
719
 
699
720
  </style>