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,7 +48,7 @@ public class ${entityName} implements Serializable {
48 </#if> 48 </#if>
49 /**${po.filedComment}*/ 49 /**${po.filedComment}*/
50 <#if po.fieldName == primaryKeyField> 50 <#if po.fieldName == primaryKeyField>
51 - @TableId(type = IdType.ID_WORKER_STR) 51 + @TableId(type = IdType.ASSIGN_ID)
52 <#else> 52 <#else>
53 <#if po.fieldDbType =='Date'> 53 <#if po.fieldDbType =='Date'>
54 <#if po.classType=='date'> 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,7 +143,7 @@
143 </a-form> 143 </a-form>
144 </div> 144 </div>
145 <!-- 查询区域-END --> 145 <!-- 查询区域-END -->
146 - 146 +
147 <!-- 操作按钮区域 --> 147 <!-- 操作按钮区域 -->
148 <div class="table-operator"> 148 <div class="table-operator">
149 <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> 149 <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
@@ -234,7 +234,7 @@ @@ -234,7 +234,7 @@
234 </a-table> 234 </a-table>
235 </div> 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 </a-card> 238 </a-card>
239 </template> 239 </template>
240 240
@@ -247,7 +247,6 @@ @@ -247,7 +247,6 @@
247 <#if bpm_flag> 247 <#if bpm_flag>
248 import { postAction } from '@/api/manage' 248 import { postAction } from '@/api/manage'
249 </#if> 249 </#if>
250 -  
251 <#if query_field_select> 250 <#if query_field_select>
252 import JDictSelectTag from '@/components/dict/JDictSelectTag.vue' 251 import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'
253 </#if> 252 </#if>
@@ -289,7 +288,7 @@ @@ -289,7 +288,7 @@
289 </#if> 288 </#if>
290 289
291 export default { 290 export default {
292 - name: "${entityName}List", 291 + name: '${entityName}List',
293 mixins:[JeecgListMixin, mixinDevice], 292 mixins:[JeecgListMixin, mixinDevice],
294 components: { 293 components: {
295 <#if query_field_select> 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,7 +168,7 @@
168 </#if> 168 </#if>
169 169
170 export default { 170 export default {
171 - name: "${entityName}Form", 171 + name: '${entityName}Form',
172 components: { 172 components: {
173 JFormContainer, 173 JFormContainer,
174 <#if form_date> 174 <#if form_date>
@@ -218,8 +218,8 @@ @@ -218,8 +218,8 @@
218 default: ()=>{}, 218 default: ()=>{},
219 required: false 219 required: false
220 }, 220 },
221 - //表单模式:false流程表单 true普通表单  
222 - normal: { 221 + //表单模式:true流程表单 false普通表单
  222 + formBpm: {
223 type: Boolean, 223 type: Boolean,
224 default: false, 224 default: false,
225 required: false 225 required: false
@@ -254,25 +254,21 @@ @@ -254,25 +254,21 @@
254 }, 254 },
255 computed: { 255 computed: {
256 formDisabled(){ 256 formDisabled(){
257 - if(this.normal===false){ 257 + if(this.formBpm===true){
258 if(this.formData.disabled===false){ 258 if(this.formData.disabled===false){
259 return false 259 return false
260 - }else{  
261 - return true  
262 } 260 }
  261 + return true
263 } 262 }
264 return this.disabled 263 return this.disabled
265 }, 264 },
266 showFlowSubmitButton(){ 265 showFlowSubmitButton(){
267 - if(this.normal===false){ 266 + if(this.formBpm===true){
268 if(this.formData.disabled===false){ 267 if(this.formData.disabled===false){
269 return true 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 created () { 274 created () {
@@ -293,7 +289,7 @@ @@ -293,7 +289,7 @@
293 }, 289 },
294 //渲染流程表单数据 290 //渲染流程表单数据
295 showFlowData(){ 291 showFlowData(){
296 - if(this.normal === false){ 292 + if(this.formBpm === true){
297 let params = {id:this.formData.dataId}; 293 let params = {id:this.formData.dataId};
298 getAction(this.url.queryById,params).then((res)=>{ 294 getAction(this.url.queryById,params).then((res)=>{
299 if(res.success){ 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,10 +15,10 @@
15 :visible="visible" 15 :visible="visible"
16 switchFullscreen 16 switchFullscreen
17 @ok="handleOk" 17 @ok="handleOk"
18 - :okButtonProps="{ class:{'jee-hidden': disablesubmit} }" 18 + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
19 @cancel="handleCancel" 19 @cancel="handleCancel"
20 cancelText="关闭"> 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 </j-modal> 22 </j-modal>
23 </template> 23 </template>
24 24
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 26
27 import ${entityName}Form from './${entityName}Form' 27 import ${entityName}Form from './${entityName}Form'
28 export default { 28 export default {
29 - name: "${entityName}Modal", 29 + name: '${entityName}Modal',
30 components: { 30 components: {
31 ${entityName}Form 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,7 +15,7 @@
15 :closable="false" 15 :closable="false"
16 @close="close" 16 @close="close"
17 :visible="visible"> 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 <div class="drawer-footer"> 19 <div class="drawer-footer">
20 <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> 20 <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
21 <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> 21 <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 import ${entityName}Form from './${entityName}Form' 28 import ${entityName}Form from './${entityName}Form'
29 29
30 export default { 30 export default {
31 - name: "${entityName}Modal", 31 + name: '${entityName}Modal',
32 components: { 32 components: {
33 ${entityName}Form 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,7 +42,7 @@ public class ${entityName} implements Serializable {
42 </#if> 42 </#if>
43 /**${po.filedComment}*/ 43 /**${po.filedComment}*/
44 <#if po.fieldName == primaryKeyField> 44 <#if po.fieldName == primaryKeyField>
45 - @TableId(type = IdType.ID_WORKER_STR) 45 + @TableId(type = IdType.ASSIGN_ID)
46 <#else> 46 <#else>
47 <#if po.fieldDbType =='Date'> 47 <#if po.fieldDbType =='Date'>
48 <#if po.classType=='date'> 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,7 +43,7 @@ public class ${subTab.entityName} implements Serializable {
43 </#if> 43 </#if>
44 /**${po.filedComment}*/ 44 /**${po.filedComment}*/
45 <#if po.fieldName == primaryKeyField> 45 <#if po.fieldName == primaryKeyField>
46 - @TableId(type = IdType.ID_WORKER_STR) 46 + @TableId(type = IdType.ASSIGN_ID)
47 <#else> 47 <#else>
48 <#if po.fieldDbType =='Date'> 48 <#if po.fieldDbType =='Date'>
49 <#if po.classType=='date'> 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,7 +224,7 @@
224 </a-table> 224 </a-table>
225 </div> 225 </div>
226 226
227 - <${tableName?replace("_","-")}-modal ref="modalForm" @ok="modalFormOk"/> 227 + <${Format.humpToShortbar(entityName)}-modal ref="modalForm" @ok="modalFormOk"/>
228 </a-card> 228 </a-card>
229 </template> 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,7 +416,7 @@
416 required: false 416 required: false
417 }, 417 },
418 //表单模式:false流程表单 true普通表单 418 //表单模式:false流程表单 true普通表单
419 - normal: { 419 + formBpm: {
420 type: Boolean, 420 type: Boolean,
421 default: false, 421 default: false,
422 required: false 422 required: false
@@ -430,25 +430,21 @@ @@ -430,25 +430,21 @@
430 }, 430 },
431 computed: { 431 computed: {
432 formDisabled(){ 432 formDisabled(){
433 - if(this.normal===false){ 433 + if(this.formBpm===true){
434 if(this.formData.disabled===false){ 434 if(this.formData.disabled===false){
435 return false 435 return false
436 - }else{  
437 - return true  
438 } 436 }
  437 + return true
439 } 438 }
440 return this.disabled 439 return this.disabled
441 }, 440 },
442 showFlowSubmitButton(){ 441 showFlowSubmitButton(){
443 - if(this.normal===false){ 442 + if(this.formBpm===true){
444 if(this.formData.disabled===false){ 443 if(this.formData.disabled===false){
445 return true 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 created () { 450 created () {
@@ -456,6 +452,16 @@ @@ -456,6 +452,16 @@
456 this.showFlowData(); 452 this.showFlowData();
457 }, 453 },
458 methods: { 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 getAllTable() { 465 getAllTable() {
460 <#if hasOne2Many==true> 466 <#if hasOne2Many==true>
461 let values = this.tableKeys.map(key => getRefPromise(this, key)) 467 let values = this.tableKeys.map(key => getRefPromise(this, key))
@@ -505,7 +511,7 @@ @@ -505,7 +511,7 @@
505 }, 511 },
506 //渲染流程表单数据 512 //渲染流程表单数据
507 showFlowData(){ 513 showFlowData(){
508 - if(this.normal === false){ 514 + if(this.formBpm === true){
509 let params = {id:this.formData.dataId}; 515 let params = {id:this.formData.dataId};
510 getAction(this.url.queryById,params).then((res)=>{ 516 getAction(this.url.queryById,params).then((res)=>{
511 if(res.success){ 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,7 +9,7 @@
9 @ok="handleOk" 9 @ok="handleOk"
10 :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" 10 :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
11 @cancel="handleCancel"> 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 </j-modal> 13 </j-modal>
14 </template> 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,7 +43,7 @@ public class ${entityName} implements Serializable {
43 </#if> 43 </#if>
44 /**${po.filedComment}*/ 44 /**${po.filedComment}*/
45 <#if po.fieldName == primaryKeyField> 45 <#if po.fieldName == primaryKeyField>
46 - @TableId(type = IdType.ID_WORKER_STR) 46 + @TableId(type = IdType.ASSIGN_ID)
47 <#else> 47 <#else>
48 <#if po.fieldDbType =='Date'> 48 <#if po.fieldDbType =='Date'>
49 <#if po.classType=='date'> 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,7 +42,7 @@ public class ${entityName} implements Serializable {
42 </#if> 42 </#if>
43 /**${po.filedComment}*/ 43 /**${po.filedComment}*/
44 <#if po.fieldName == primaryKeyField> 44 <#if po.fieldName == primaryKeyField>
45 - @TableId(type = IdType.ID_WORKER_STR) 45 + @TableId(type = IdType.ASSIGN_ID)
46 <#else> 46 <#else>
47 <#if po.fieldDbType =='Date'> 47 <#if po.fieldDbType =='Date'>
48 <#if po.classType=='date'> 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,7 +31,7 @@ public class ${subTab.entityName} implements Serializable {
31 <#list subTab.originalColumns as po> 31 <#list subTab.originalColumns as po>
32 /**${po.filedComment}*/ 32 /**${po.filedComment}*/
33 <#if po.fieldName == primaryKeyField> 33 <#if po.fieldName == primaryKeyField>
34 - @TableId(type = IdType.ID_WORKER_STR) 34 + @TableId(type = IdType.ASSIGN_ID)
35 <#else> 35 <#else>
36 <#if po.fieldDbType =='Date'> 36 <#if po.fieldDbType =='Date'>
37 <#if po.classType=='date'> 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,7 +42,7 @@ public class ${entityName} implements Serializable {
42 </#if> 42 </#if>
43 /**${po.filedComment}*/ 43 /**${po.filedComment}*/
44 <#if po.fieldName == primaryKeyField> 44 <#if po.fieldName == primaryKeyField>
45 - @TableId(type = IdType.ID_WORKER_STR) 45 + @TableId(type = IdType.ASSIGN_ID)
46 <#else> 46 <#else>
47 <#if po.fieldDbType =='Date'> 47 <#if po.fieldDbType =='Date'>
48 <#if po.classType=='date'> 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,7 +44,7 @@ public class ${subTab.entityName} implements Serializable {
44 </#if> 44 </#if>
45 /**${po.filedComment}*/ 45 /**${po.filedComment}*/
46 <#if po.fieldName == primaryKeyField> 46 <#if po.fieldName == primaryKeyField>
47 - @TableId(type = IdType.ID_WORKER_STR) 47 + @TableId(type = IdType.ASSIGN_ID)
48 <#else> 48 <#else>
49 <#if po.fieldDbType =='Date'> 49 <#if po.fieldDbType =='Date'>
50 <#if po.classType=='date'> 50 <#if po.classType=='date'>