ap-dev 1.2.27 → 1.3.0
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.
- package/dev/BackgroundPanel/BackgroundBase.vue +115 -0
- package/dev/BackgroundPanel/index.vue +3 -94
- package/dev/ConfigPanel/DevCpt.vue +0 -1
- package/dev/DbDesignPanel/DevDbField.vue +11 -1
- package/dev/DbDesignPanel/DevDbTable.vue +14 -2
- package/dev/DbDesignPanel/DevDbTableDialog.vue +11 -1
- package/dev/DbDesignPanel/DevDbWord.vue +606 -596
- package/dev/TemplatePanel/index.vue +513 -434
- package/package.json +1 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
</template>
|
|
3
|
+
|
|
4
|
+
<script>
|
|
5
|
+
import {convertToTreeData} from 'ap-util/util/DataUtil'
|
|
6
|
+
import {getUserConfig} from './../dev/DevUtil'
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
name: 'BackgroundBase',
|
|
10
|
+
data() {
|
|
11
|
+
return {
|
|
12
|
+
selectedTables: [],
|
|
13
|
+
createEntity: 1,
|
|
14
|
+
createEntityFD: 1,
|
|
15
|
+
createEntityTF: 1,
|
|
16
|
+
createController: 1,
|
|
17
|
+
createService: 1,
|
|
18
|
+
createDao: 1,
|
|
19
|
+
createXml: 0,
|
|
20
|
+
backgroundMsg: '',
|
|
21
|
+
userConfig: getUserConfig(),
|
|
22
|
+
backgroundOtherParam: {}, // 前端传给后台的额外参数
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
methods: {
|
|
26
|
+
|
|
27
|
+
createFile(projectName, list) {
|
|
28
|
+
this.$request({
|
|
29
|
+
url: '/apd/dev/DevGenerateCode/createFile',
|
|
30
|
+
method: 'post',
|
|
31
|
+
data: {
|
|
32
|
+
list: JSON.stringify(list),
|
|
33
|
+
projectName: projectName
|
|
34
|
+
}
|
|
35
|
+
}).then(response => {
|
|
36
|
+
this.backgroundMsg = response.data
|
|
37
|
+
this.$message.success('后台代码,生成完成!')
|
|
38
|
+
})
|
|
39
|
+
},
|
|
40
|
+
generateCode() {
|
|
41
|
+
if (this.selectedTables.length < 1) {
|
|
42
|
+
this.$message.error('请选择表!')
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const javaUrl = this.userConfig.fdJavaPath
|
|
47
|
+
if (javaUrl == null || javaUrl == '') {
|
|
48
|
+
this.$message.error('请先配置共通参数。【顶栏】->【配置】')
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
this.$confirm(`确定在【${javaUrl}】下生成文件?`, '提示', {
|
|
53
|
+
confirmButtonText: '确定',
|
|
54
|
+
type: 'warning'
|
|
55
|
+
}).then(() => {
|
|
56
|
+
this.doGenerateCode()
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
doGenerateCode() {
|
|
60
|
+
const tableList = []
|
|
61
|
+
for (let i = 0; i < this.selectedTables.length; i++) {
|
|
62
|
+
const selectedTable = this.selectedTables[i]
|
|
63
|
+
tableList.push({
|
|
64
|
+
tableName: selectedTable.tableName,
|
|
65
|
+
tableSchema: selectedTable.tableSchema
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
let tableSchema = tableList[0].tableSchema;
|
|
70
|
+
let javaPath = this.userConfig.fdJavaPath;
|
|
71
|
+
let projectName = javaPath.substring(javaPath.lastIndexOf('\\') + 1);
|
|
72
|
+
// 项目名和数据库不一致,警告
|
|
73
|
+
if (projectName.indexOf(tableSchema) > -1) {
|
|
74
|
+
this.getBackgroundCode(tableList);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
this.$confirm(`警告:项目【${projectName}】和数据库【${tableSchema}】不匹配!`, '提示', {
|
|
78
|
+
confirmButtonText: '确认生成',
|
|
79
|
+
cancelButtonText: '取消',
|
|
80
|
+
type: 'error'
|
|
81
|
+
}).then(() => {
|
|
82
|
+
this.getBackgroundCode(tableList);
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
getBackgroundCode(tableList) {
|
|
86
|
+
let backgroundParam = {
|
|
87
|
+
tableList: JSON.stringify(tableList),
|
|
88
|
+
createEntity: this.createEntity,
|
|
89
|
+
createEntityFD: this.createEntityFD,
|
|
90
|
+
createEntityTF: this.createEntityTF,
|
|
91
|
+
createController: this.createController,
|
|
92
|
+
createService: this.createService,
|
|
93
|
+
createDao: this.createDao,
|
|
94
|
+
createXml: this.createXml,
|
|
95
|
+
javaUrl: this.userConfig.fdJavaPath,
|
|
96
|
+
sourceId: this.userConfig.fdSourceId
|
|
97
|
+
};
|
|
98
|
+
let mergedParam = {...backgroundParam, ...this.backgroundOtherParam};
|
|
99
|
+
|
|
100
|
+
this.$request({
|
|
101
|
+
url: '/apd/dev/DevGenerateCode/getBackgroundCode',
|
|
102
|
+
method: 'post',
|
|
103
|
+
data: mergedParam
|
|
104
|
+
}).then(response => {
|
|
105
|
+
// 生成文件
|
|
106
|
+
this.createFile(this.userConfig.fdJavaHref, response.data)
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
</script>
|
|
113
|
+
|
|
114
|
+
<style scoped>
|
|
115
|
+
</style>
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
@click="generateCode"
|
|
109
109
|
/>
|
|
110
110
|
</div>
|
|
111
|
-
<div class="msg" v-html="
|
|
111
|
+
<div class="msg" v-html="backgroundMsg"/>
|
|
112
112
|
</ap-main>
|
|
113
113
|
|
|
114
114
|
</ap-container>
|
|
@@ -117,9 +117,10 @@
|
|
|
117
117
|
<script>
|
|
118
118
|
import {convertToTreeData} from 'ap-util/util/DataUtil'
|
|
119
119
|
import {getUserConfig} from './../dev/DevUtil'
|
|
120
|
-
|
|
120
|
+
import BackgroundBase from './BackgroundBase'
|
|
121
121
|
export default {
|
|
122
122
|
name: 'BackgroundPanel',
|
|
123
|
+
extends: BackgroundBase,
|
|
123
124
|
data() {
|
|
124
125
|
return {
|
|
125
126
|
// ----- 左侧树 -----
|
|
@@ -131,18 +132,6 @@ export default {
|
|
|
131
132
|
children: 'children',
|
|
132
133
|
label: 'tableName'
|
|
133
134
|
},
|
|
134
|
-
// ----- dialog -----
|
|
135
|
-
selectedTables: [],
|
|
136
|
-
createEntity: 1,
|
|
137
|
-
createEntityFD: 1,
|
|
138
|
-
createEntityTF: 1,
|
|
139
|
-
createController: 1,
|
|
140
|
-
createService: 1,
|
|
141
|
-
createDao: 1,
|
|
142
|
-
createXml: 0,
|
|
143
|
-
msg: '',
|
|
144
|
-
// ----- 右侧内容 -----
|
|
145
|
-
userConfig: getUserConfig()
|
|
146
135
|
}
|
|
147
136
|
},
|
|
148
137
|
watch: {
|
|
@@ -232,86 +221,6 @@ export default {
|
|
|
232
221
|
}
|
|
233
222
|
return newList
|
|
234
223
|
},
|
|
235
|
-
createFile(projectName, list) {
|
|
236
|
-
this.$request({
|
|
237
|
-
url: '/apd/dev/DevGenerateCode/createFile',
|
|
238
|
-
method: 'post',
|
|
239
|
-
data: {
|
|
240
|
-
list: JSON.stringify(list),
|
|
241
|
-
projectName: projectName
|
|
242
|
-
}
|
|
243
|
-
}).then(response => {
|
|
244
|
-
this.msg = response.data
|
|
245
|
-
this.$message.success('操作成功!')
|
|
246
|
-
})
|
|
247
|
-
},
|
|
248
|
-
generateCode() {
|
|
249
|
-
if (this.selectedTables.length < 1) {
|
|
250
|
-
this.$message.error('请选择表!')
|
|
251
|
-
return
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
const javaUrl = this.userConfig.fdJavaPath
|
|
255
|
-
if (javaUrl == null || javaUrl == '') {
|
|
256
|
-
this.$message.error('请先配置共通参数。【顶栏】->【配置】')
|
|
257
|
-
return
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
this.$confirm(`确定在【${javaUrl}】下生成文件?`, '提示', {
|
|
261
|
-
confirmButtonText: '确定',
|
|
262
|
-
type: 'warning'
|
|
263
|
-
}).then(() => {
|
|
264
|
-
this.doGenerateCode()
|
|
265
|
-
});
|
|
266
|
-
},
|
|
267
|
-
doGenerateCode() {
|
|
268
|
-
const tableList = []
|
|
269
|
-
for (let i = 0; i < this.selectedTables.length; i++) {
|
|
270
|
-
const selectedTable = this.selectedTables[i]
|
|
271
|
-
tableList.push({
|
|
272
|
-
tableName: selectedTable.tableName,
|
|
273
|
-
tableSchema: selectedTable.tableSchema
|
|
274
|
-
})
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
let tableSchema = tableList[0].tableSchema;
|
|
278
|
-
let javaPath = this.userConfig.fdJavaPath;
|
|
279
|
-
let projectName = javaPath.substring(javaPath.lastIndexOf('\\') + 1);
|
|
280
|
-
// 项目名和数据库不一致,警告
|
|
281
|
-
if (projectName.indexOf(tableSchema) > -1) {
|
|
282
|
-
this.getBackgroundCode(tableList);
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
this.$confirm(`警告:项目【${projectName}】和数据库【${tableSchema}】不匹配!`, '提示', {
|
|
286
|
-
confirmButtonText: '确认生成',
|
|
287
|
-
cancelButtonText: '取消',
|
|
288
|
-
type: 'error'
|
|
289
|
-
}).then(() => {
|
|
290
|
-
this.getBackgroundCode(tableList);
|
|
291
|
-
});
|
|
292
|
-
},
|
|
293
|
-
getBackgroundCode(tableList) {
|
|
294
|
-
this.$request({
|
|
295
|
-
url: '/apd/dev/DevGenerateCode/getBackgroundCode',
|
|
296
|
-
method: 'post',
|
|
297
|
-
data: {
|
|
298
|
-
tableList: JSON.stringify(tableList),
|
|
299
|
-
createEntity: this.createEntity,
|
|
300
|
-
createEntityFD: this.createEntityFD,
|
|
301
|
-
createEntityTF: this.createEntityTF,
|
|
302
|
-
createController: this.createController,
|
|
303
|
-
createService: this.createService,
|
|
304
|
-
createDao: this.createDao,
|
|
305
|
-
createXml: this.createXml,
|
|
306
|
-
javaUrl: this.userConfig.fdJavaPath,
|
|
307
|
-
sourceId: this.userConfig.fdSourceId
|
|
308
|
-
}
|
|
309
|
-
}).then(response => {
|
|
310
|
-
// 生成文件
|
|
311
|
-
this.createFile(this.userConfig.fdJavaHref, response.data)
|
|
312
|
-
})
|
|
313
|
-
}
|
|
314
|
-
|
|
315
224
|
}
|
|
316
225
|
}
|
|
317
226
|
</script>
|
|
@@ -697,7 +697,6 @@ export default {
|
|
|
697
697
|
editPk: "fdId", //默认fdId
|
|
698
698
|
deletePk: "fdId", // 默认fdId
|
|
699
699
|
deleteUrl: "/apd/TDevCptParamTemplate/deleteTDevCptParamTemplateGridData",
|
|
700
|
-
sortUrl: "/apd/TDevCptParamTemplate/updateTDevCptParamTemplateSortList",
|
|
701
700
|
toolbarBtn: [{
|
|
702
701
|
btnType: "primary", text: "复制", icon: "el-icon-copy", onClick: () => {
|
|
703
702
|
this.doCopyParamTemplate()
|
|
@@ -96,7 +96,9 @@ export default {
|
|
|
96
96
|
options: [
|
|
97
97
|
{label: 'char(255)', value: 'char'},
|
|
98
98
|
{label: 'varchar(6.5万)', value: 'varchar'},
|
|
99
|
-
{label: 'text(
|
|
99
|
+
{label: 'text(6.5万)', value: 'text'},
|
|
100
|
+
{label: 'mediumtext(1600万)', value: 'mediumtext'},
|
|
101
|
+
{label: 'longtext(极长)', value: 'longtext'},
|
|
100
102
|
]
|
|
101
103
|
},
|
|
102
104
|
{
|
|
@@ -126,6 +128,14 @@ export default {
|
|
|
126
128
|
{label: 'datetime(年月日时分秒)', value: 'datetime'},
|
|
127
129
|
{label: 'timestamp(时间戳)', value: 'timestamp'}
|
|
128
130
|
]
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
label: '二进制:图片/文件',
|
|
134
|
+
options: [
|
|
135
|
+
{label: 'blob(6.5万)', value: 'blob'},
|
|
136
|
+
{label: 'mediumblob(1600万)', value: 'mediumblob'},
|
|
137
|
+
{label: 'longblob(极长)', value: 'longblob'},
|
|
138
|
+
]
|
|
129
139
|
}
|
|
130
140
|
],
|
|
131
141
|
selectFilterable: true,
|
|
@@ -109,7 +109,10 @@ export default {
|
|
|
109
109
|
options: [
|
|
110
110
|
{label: 'char', value: 'char'},
|
|
111
111
|
{label: 'varchar', value: 'varchar'},
|
|
112
|
-
{label: 'text', value: 'text'}
|
|
112
|
+
{label: 'text', value: 'text'},
|
|
113
|
+
{label: 'mediumtext', value: 'mediumtext'},
|
|
114
|
+
{label: 'longtext', value: 'longtext'},
|
|
115
|
+
|
|
113
116
|
]
|
|
114
117
|
},
|
|
115
118
|
{
|
|
@@ -139,6 +142,14 @@ export default {
|
|
|
139
142
|
{label: 'datetime', value: 'datetime'},
|
|
140
143
|
{label: 'timestamp', value: 'timestamp'}
|
|
141
144
|
]
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
label: '二进制:图片/文件',
|
|
148
|
+
options: [
|
|
149
|
+
{label: 'blob', value: 'blob'},
|
|
150
|
+
{label: 'mediumblob', value: 'mediumblob'},
|
|
151
|
+
{label: 'longblob', value: 'longblob'},
|
|
152
|
+
]
|
|
142
153
|
}
|
|
143
154
|
],
|
|
144
155
|
selectFilterable: true,
|
|
@@ -154,7 +165,8 @@ export default {
|
|
|
154
165
|
width: '80',
|
|
155
166
|
edit: (rowData) => {
|
|
156
167
|
// 不允许编辑长度的类型
|
|
157
|
-
const arr = ['tinyint', 'smallint', 'mediumint', 'int', 'bigint', 'date', 'time', 'year', 'datetime', 'timestamp',
|
|
168
|
+
const arr = ['tinyint', 'smallint', 'mediumint', 'int', 'bigint', 'date', 'time', 'year', 'datetime', 'timestamp',
|
|
169
|
+
'text', 'mediumtext', 'longtext', 'blob', 'mediumblob', 'longblob']
|
|
158
170
|
|
|
159
171
|
return arr.indexOf(rowData.dataType) < 0
|
|
160
172
|
}
|
|
@@ -95,7 +95,9 @@ export default {
|
|
|
95
95
|
options: [
|
|
96
96
|
{label: 'char(255)', value: 'char'},
|
|
97
97
|
{label: 'varchar(6.5万)', value: 'varchar'},
|
|
98
|
-
{label: 'text(
|
|
98
|
+
{label: 'text(6.5万)', value: 'text'},
|
|
99
|
+
{label: 'mediumtext(1600万)', value: 'mediumtext'},
|
|
100
|
+
{label: 'longtext(极长)', value: 'longtext'},
|
|
99
101
|
]
|
|
100
102
|
},
|
|
101
103
|
{
|
|
@@ -125,6 +127,14 @@ export default {
|
|
|
125
127
|
{label: 'datetime(年月日时分秒)', value: 'datetime'},
|
|
126
128
|
{label: 'timestamp(时间戳)', value: 'timestamp'}
|
|
127
129
|
]
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
label: '二进制:图片/文件',
|
|
133
|
+
options: [
|
|
134
|
+
{label: 'blob(6.5万)', value: 'blob'},
|
|
135
|
+
{label: 'mediumblob(1600万)', value: 'mediumblob'},
|
|
136
|
+
{label: 'longblob(极长)', value: 'longblob'},
|
|
137
|
+
]
|
|
128
138
|
}
|
|
129
139
|
],
|
|
130
140
|
selectFilterable: true,
|