ap-dev 1.2.28 → 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.
|
@@ -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()
|