Commit e4846413452b3464d145b309bc56699ae53e55f8

Authored by zhangdaiscott
1 parent e2934211

解决代码生成器模板几个问题:

1.主键换成IdType.ASSIGN_ID
2.生成代码,自定义实体名代码报错问题
3.新模式表单,流程参数个性化定义
Showing 15 changed files with 42 additions and 41 deletions
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/entity/${entityName}.javai
... ... @@ -48,7 +48,7 @@ public class ${entityName} implements Serializable {
48 48 </#if>
49 49 /**${po.filedComment}*/
50 50 <#if po.fieldName == primaryKeyField>
51   - @TableId(type = IdType.ID_WORKER_STR)
  51 + @TableId(type = IdType.ASSIGN_ID)
52 52 <#else>
53 53 <#if po.fieldDbType =='Date'>
54 54 <#if po.classType=='date'>
... ...
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue/${entityName}List.vuei
... ... @@ -143,7 +143,7 @@
143 143 </a-form>
144 144 </div>
145 145 <!-- 查询区域-END -->
146   -
  146 +
147 147 <!-- 操作按钮区域 -->
148 148 <div class="table-operator">
149 149 <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
... ... @@ -234,7 +234,7 @@
234 234 </a-table>
235 235 </div>
236 236  
237   - <${tableName?replace("_","-")}-modal ref="modalForm" @ok="modalFormOk"></${tableName?replace("_","-")}-modal>
  237 + <${Format.humpToShortbar(entityName)}-modal ref="modalForm" @ok="modalFormOk"></${Format.humpToShortbar(entityName)}-modal>
238 238 </a-card>
239 239 </template>
240 240  
... ... @@ -247,7 +247,6 @@
247 247 <#if bpm_flag>
248 248 import { postAction } from '@/api/manage'
249 249 </#if>
250   -
251 250 <#if query_field_select>
252 251 import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'
253 252 </#if>
... ... @@ -289,7 +288,7 @@
289 288 </#if>
290 289  
291 290 export default {
292   - name: "${entityName}List",
  291 + name: '${entityName}List',
293 292 mixins:[JeecgListMixin, mixinDevice],
294 293 components: {
295 294 <#if query_field_select>
... ...
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue/modules/${entityName}Form.vuei
... ... @@ -168,7 +168,7 @@
168 168 </#if>
169 169  
170 170 export default {
171   - name: "${entityName}Form",
  171 + name: '${entityName}Form',
172 172 components: {
173 173 JFormContainer,
174 174 <#if form_date>
... ... @@ -218,8 +218,8 @@
218 218 default: ()=>{},
219 219 required: false
220 220 },
221   - //表单模式:false流程表单 true普通表单
222   - normal: {
  221 + //表单模式:true流程表单 false普通表单
  222 + formBpm: {
223 223 type: Boolean,
224 224 default: false,
225 225 required: false
... ... @@ -254,25 +254,21 @@
254 254 },
255 255 computed: {
256 256 formDisabled(){
257   - if(this.normal===false){
  257 + if(this.formBpm===true){
258 258 if(this.formData.disabled===false){
259 259 return false
260   - }else{
261   - return true
262 260 }
  261 + return true
263 262 }
264 263 return this.disabled
265 264 },
266 265 showFlowSubmitButton(){
267   - if(this.normal===false){
  266 + if(this.formBpm===true){
268 267 if(this.formData.disabled===false){
269 268 return true
270   - }else{
271   - return false
272 269 }
273   - }else{
274   - return false
275 270 }
  271 + return false
276 272 }
277 273 },
278 274 created () {
... ... @@ -293,7 +289,7 @@
293 289 },
294 290 //渲染流程表单数据
295 291 showFlowData(){
296   - if(this.normal === false){
  292 + if(this.formBpm === true){
297 293 let params = {id:this.formData.dataId};
298 294 getAction(this.url.queryById,params).then((res)=>{
299 295 if(res.success){
... ...
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue/modules/${entityName}Modal.vuei
... ... @@ -15,10 +15,10 @@
15 15 :visible="visible"
16 16 switchFullscreen
17 17 @ok="handleOk"
18   - :okButtonProps="{ class:{'jee-hidden': disablesubmit} }"
  18 + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
19 19 @cancel="handleCancel"
20 20 cancelText="关闭">
21   - <${tableName?replace("_","-")}-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></${tableName?replace("_","-")}-form>
  21 + <${Format.humpToShortbar(entityName)}-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></${Format.humpToShortbar(entityName)}-form>
22 22 </j-modal>
23 23 </template>
24 24  
... ... @@ -26,7 +26,7 @@
26 26  
27 27 import ${entityName}Form from './${entityName}Form'
28 28 export default {
29   - name: "${entityName}Modal",
  29 + name: '${entityName}Modal',
30 30 components: {
31 31 ${entityName}Form
32 32 },
... ...
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue/modules/${entityName}Modal__Style#Drawer.vuei
... ... @@ -15,7 +15,7 @@
15 15 :closable="false"
16 16 @close="close"
17 17 :visible="visible">
18   - <${tableName?replace("_","-")}-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></${tableName?replace("_","-")}-form>
  18 + <${Format.humpToShortbar(entityName)}-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></${Format.humpToShortbar(entityName)}-form>
19 19 <div class="drawer-footer">
20 20 <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
21 21 <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
... ... @@ -28,7 +28,7 @@
28 28 import ${entityName}Form from './${entityName}Form'
29 29  
30 30 export default {
31   - name: "${entityName}Modal",
  31 + name: '${entityName}Modal',
32 32 components: {
33 33 ${entityName}Form
34 34 },
... ...
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/onetomany/java/${bussiPackage}/${entityPackage}/entity/${entityName}.javai
... ... @@ -42,7 +42,7 @@ public class ${entityName} implements Serializable {
42 42 </#if>
43 43 /**${po.filedComment}*/
44 44 <#if po.fieldName == primaryKeyField>
45   - @TableId(type = IdType.ID_WORKER_STR)
  45 + @TableId(type = IdType.ASSIGN_ID)
46 46 <#else>
47 47 <#if po.fieldDbType =='Date'>
48 48 <#if po.classType=='date'>
... ...
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/onetomany/java/${bussiPackage}/${entityPackage}/entity/[1-n]Entity.javai
... ... @@ -43,7 +43,7 @@ public class ${subTab.entityName} implements Serializable {
43 43 </#if>
44 44 /**${po.filedComment}*/
45 45 <#if po.fieldName == primaryKeyField>
46   - @TableId(type = IdType.ID_WORKER_STR)
  46 + @TableId(type = IdType.ASSIGN_ID)
47 47 <#else>
48 48 <#if po.fieldDbType =='Date'>
49 49 <#if po.classType=='date'>
... ...
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/onetomany/java/${bussiPackage}/${entityPackage}/vue/${entityName}List.vuei
... ... @@ -224,7 +224,7 @@
224 224 </a-table>
225 225 </div>
226 226  
227   - <${tableName?replace("_","-")}-modal ref="modalForm" @ok="modalFormOk"/>
  227 + <${Format.humpToShortbar(entityName)}-modal ref="modalForm" @ok="modalFormOk"/>
228 228 </a-card>
229 229 </template>
230 230  
... ...
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/onetomany/java/${bussiPackage}/${entityPackage}/vue/modules/${entityName}Form.vuei
... ... @@ -416,7 +416,7 @@
416 416 required: false
417 417 },
418 418 //表单模式:false流程表单 true普通表单
419   - normal: {
  419 + formBpm: {
420 420 type: Boolean,
421 421 default: false,
422 422 required: false
... ... @@ -430,25 +430,21 @@
430 430 },
431 431 computed: {
432 432 formDisabled(){
433   - if(this.normal===false){
  433 + if(this.formBpm===true){
434 434 if(this.formData.disabled===false){
435 435 return false
436   - }else{
437   - return true
438 436 }
  437 + return true
439 438 }
440 439 return this.disabled
441 440 },
442 441 showFlowSubmitButton(){
443   - if(this.normal===false){
  442 + if(this.formBpm===true){
444 443 if(this.formData.disabled===false){
445 444 return true
446   - }else{
447   - return false
448 445 }
449   - }else{
450   - return false
451 446 }
  447 + return false
452 448 }
453 449 },
454 450 created () {
... ... @@ -456,6 +452,16 @@
456 452 this.showFlowData();
457 453 },
458 454 methods: {
  455 + addBefore(){
  456 + this.form.resetFields()
  457 +<#list subTables as sub><#rt/>
  458 + <#if sub.foreignRelationType =='1'>
  459 + this.$refs.${sub.entityName?uncap_first}Form.clearFormData()
  460 + <#else>
  461 + this.${sub.entityName?uncap_first}Table.dataSource=[]
  462 + </#if>
  463 +</#list>
  464 + },
459 465 getAllTable() {
460 466 <#if hasOne2Many==true>
461 467 let values = this.tableKeys.map(key => getRefPromise(this, key))
... ... @@ -505,7 +511,7 @@
505 511 },
506 512 //渲染流程表单数据
507 513 showFlowData(){
508   - if(this.normal === false){
  514 + if(this.formBpm === true){
509 515 let params = {id:this.formData.dataId};
510 516 getAction(this.url.queryById,params).then((res)=>{
511 517 if(res.success){
... ...
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/onetomany/java/${bussiPackage}/${entityPackage}/vue/modules/${entityName}Modal.vuei
... ... @@ -9,7 +9,7 @@
9 9 @ok="handleOk"
10 10 :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
11 11 @cancel="handleCancel">
12   - <${tableName?replace("_","-")}-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal/>
  12 + <${Format.humpToShortbar(entityName)}-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"/>
13 13 </j-modal>
14 14 </template>
15 15  
... ...
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/tree/java/${bussiPackage}/${entityPackage}/entity/${entityName}.javai
... ... @@ -43,7 +43,7 @@ public class ${entityName} implements Serializable {
43 43 </#if>
44 44 /**${po.filedComment}*/
45 45 <#if po.fieldName == primaryKeyField>
46   - @TableId(type = IdType.ID_WORKER_STR)
  46 + @TableId(type = IdType.ASSIGN_ID)
47 47 <#else>
48 48 <#if po.fieldDbType =='Date'>
49 49 <#if po.classType=='date'>
... ...
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/entity/${entityName}.javai
... ... @@ -42,7 +42,7 @@ public class ${entityName} implements Serializable {
42 42 </#if>
43 43 /**${po.filedComment}*/
44 44 <#if po.fieldName == primaryKeyField>
45   - @TableId(type = IdType.ID_WORKER_STR)
  45 + @TableId(type = IdType.ASSIGN_ID)
46 46 <#else>
47 47 <#if po.fieldDbType =='Date'>
48 48 <#if po.classType=='date'>
... ...
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/entity/[1-n]Entity.javai
... ... @@ -31,7 +31,7 @@ public class ${subTab.entityName} implements Serializable {
31 31 <#list subTab.originalColumns as po>
32 32 /**${po.filedComment}*/
33 33 <#if po.fieldName == primaryKeyField>
34   - @TableId(type = IdType.ID_WORKER_STR)
  34 + @TableId(type = IdType.ASSIGN_ID)
35 35 <#else>
36 36 <#if po.fieldDbType =='Date'>
37 37 <#if po.classType=='date'>
... ...
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/entity/${entityName}.javai
... ... @@ -42,7 +42,7 @@ public class ${entityName} implements Serializable {
42 42 </#if>
43 43 /**${po.filedComment}*/
44 44 <#if po.fieldName == primaryKeyField>
45   - @TableId(type = IdType.ID_WORKER_STR)
  45 + @TableId(type = IdType.ASSIGN_ID)
46 46 <#else>
47 47 <#if po.fieldDbType =='Date'>
48 48 <#if po.classType=='date'>
... ...
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/entity/[1-n]Entity.javai
... ... @@ -44,7 +44,7 @@ public class ${subTab.entityName} implements Serializable {
44 44 </#if>
45 45 /**${po.filedComment}*/
46 46 <#if po.fieldName == primaryKeyField>
47   - @TableId(type = IdType.ID_WORKER_STR)
  47 + @TableId(type = IdType.ASSIGN_ID)
48 48 <#else>
49 49 <#if po.fieldDbType =='Date'>
50 50 <#if po.classType=='date'>
... ...