Commit d5e19d1623475da4ee8ed073ffb49205ddcde721
1 parent
baae587b
vue3代码生成器模板优化
Showing
15 changed files
with
269 additions
and
62 deletions
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue3/${entityName}List.vuei
@@ -77,6 +77,9 @@ | @@ -77,6 +77,9 @@ | ||
77 | import { getAuthCache, setAuthCache } from '/@/utils/auth'; | 77 | import { getAuthCache, setAuthCache } from '/@/utils/auth'; |
78 | import { DB_DICT_DATA_KEY } from '/@/enums/cacheEnum'; | 78 | import { DB_DICT_DATA_KEY } from '/@/enums/cacheEnum'; |
79 | </#if> | 79 | </#if> |
80 | + <#if bpm_flag==true> | ||
81 | + import { startProcess } from '/@/api/common/api'; | ||
82 | + </#if> | ||
80 | const checkedKeys = ref<Array<string | number>>([]); | 83 | const checkedKeys = ref<Array<string | number>>([]); |
81 | //注册model | 84 | //注册model |
82 | const [registerModal, {openModal}] = useModal(); | 85 | const [registerModal, {openModal}] = useModal(); |
@@ -196,19 +199,61 @@ | @@ -196,19 +199,61 @@ | ||
196 | * 下拉操作栏 | 199 | * 下拉操作栏 |
197 | */ | 200 | */ |
198 | function getDropDownAction(record){ | 201 | function getDropDownAction(record){ |
199 | - return [ | ||
200 | - { | ||
201 | - label: '详情', | ||
202 | - onClick: handleDetail.bind(null, record), | ||
203 | - }, { | ||
204 | - label: '删除', | ||
205 | - popConfirm: { | ||
206 | - title: '是否确认删除', | ||
207 | - confirm: handleDelete.bind(null, record), | ||
208 | - } | 202 | +<#if bpm_flag==true> |
203 | + let dropDownAction = [ | ||
204 | + { | ||
205 | + label: '详情', | ||
206 | + onClick: handleDetail.bind(null, record), | ||
207 | + }, { | ||
208 | + label: '删除', | ||
209 | + popConfirm: { | ||
210 | + title: '是否确认删除', | ||
211 | + confirm: handleDelete.bind(null, record), | ||
212 | + } | ||
213 | + } | ||
214 | + ]; | ||
215 | + if(record.bpmStatus == '1'){ | ||
216 | + dropDownAction.push({ | ||
217 | + label: '发起流程', | ||
218 | + popConfirm: { | ||
219 | + title: '确认提交流程吗?', | ||
220 | + confirm: handleProcess.bind(null, record), | ||
221 | + } | ||
222 | + }) | ||
223 | + } | ||
224 | + return dropDownAction; | ||
225 | +<#else> | ||
226 | + return [ | ||
227 | + { | ||
228 | + label: '详情', | ||
229 | + onClick: handleDetail.bind(null, record), | ||
230 | + }, { | ||
231 | + label: '删除', | ||
232 | + popConfirm: { | ||
233 | + title: '是否确认删除', | ||
234 | + confirm: handleDelete.bind(null, record), | ||
209 | } | 235 | } |
210 | - ] | 236 | + } |
237 | + ] | ||
238 | +</#if> | ||
211 | } | 239 | } |
240 | + | ||
241 | + <#if bpm_flag==true> | ||
242 | + /** | ||
243 | + * 提交流程 | ||
244 | + */ | ||
245 | + async function handleProcess(record) { | ||
246 | + let params = { | ||
247 | + flowCode: 'dev_${tableName}_001', | ||
248 | + id: record.id, | ||
249 | + formUrl: '${entityPackage}/modules/${entityName}Form', | ||
250 | + formUrlMobile: '' | ||
251 | + } | ||
252 | + await startProcess(params); | ||
253 | + handleSuccess(); | ||
254 | + } | ||
255 | + </#if> | ||
256 | + | ||
212 | <#if list_need_category> | 257 | <#if list_need_category> |
213 | /** | 258 | /** |
214 | * 初始化字典配置 | 259 | * 初始化字典配置 |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue3/${entityName}__api.tsi
1 | import {defHttp} from '/@/utils/http/axios'; | 1 | import {defHttp} from '/@/utils/http/axios'; |
2 | -import {Modal} from 'ant-design-vue'; | 2 | +import { useMessage } from "/@/hooks/web/useMessage"; |
3 | + | ||
4 | +const { createConfirm } = useMessage(); | ||
3 | 5 | ||
4 | enum Api { | 6 | enum Api { |
5 | list = '/${entityPackage}/${entityName?uncap_first}/list', | 7 | list = '/${entityPackage}/${entityName?uncap_first}/list', |
@@ -39,7 +41,8 @@ export const deleteOne = (params,handleSuccess) => { | @@ -39,7 +41,8 @@ export const deleteOne = (params,handleSuccess) => { | ||
39 | * @param params | 41 | * @param params |
40 | */ | 42 | */ |
41 | export const batchDelete = (params, handleSuccess) => { | 43 | export const batchDelete = (params, handleSuccess) => { |
42 | - Modal.confirm({ | 44 | + createConfirm({ |
45 | + iconType: 'warning', | ||
43 | title: '确认删除', | 46 | title: '确认删除', |
44 | content: '是否删除选中数据', | 47 | content: '是否删除选中数据', |
45 | okText: '确认', | 48 | okText: '确认', |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue3/${entityName}__data.tsi
@@ -122,7 +122,8 @@ export const searchFormSchema: FormSchema[] = [ | @@ -122,7 +122,8 @@ export const searchFormSchema: FormSchema[] = [ | ||
122 | <#elseif po.classType=='datetime'> | 122 | <#elseif po.classType=='datetime'> |
123 | component: 'DatePicker', | 123 | component: 'DatePicker', |
124 | componentProps: { | 124 | componentProps: { |
125 | - showTime:true | 125 | + showTime:true, |
126 | + valueFormat: 'YYYY-MM-DD HH:mm:ss' | ||
126 | }, | 127 | }, |
127 | <#elseif po.classType =='time'> | 128 | <#elseif po.classType =='time'> |
128 | component: 'TimePicker', | 129 | component: 'TimePicker', |
@@ -194,6 +195,15 @@ export const formSchema: FormSchema[] = [ | @@ -194,6 +195,15 @@ export const formSchema: FormSchema[] = [ | ||
194 | { | 195 | { |
195 | label: '${po.filedComment}', | 196 | label: '${po.filedComment}', |
196 | field: ${autoStringSuffix(po)}, | 197 | field: ${autoStringSuffix(po)}, |
198 | + <#-- update-begin-author:taoyan date:2022-6-24 for: VUEN-1190【代码生成】默认值未生成 --> | ||
199 | + <#if po.defaultVal??> | ||
200 | + <#if po.fieldDbType=="BigDecimal" || po.fieldDbType=="double" || po.fieldDbType=="int"> | ||
201 | + defaultValue: ${po.defaultVal}, | ||
202 | + <#else> | ||
203 | + defaultValue: "${po.defaultVal}", | ||
204 | + </#if> | ||
205 | + </#if> | ||
206 | + <#-- update-end-author:taoyan date:2022-6-24 for: VUEN-1190【代码生成】默认值未生成 --> | ||
197 | <#if po.classType =='date'> | 207 | <#if po.classType =='date'> |
198 | component: 'DatePicker', | 208 | component: 'DatePicker', |
199 | <#elseif po.classType =='datetime'> | 209 | <#elseif po.classType =='datetime'> |
@@ -324,7 +334,7 @@ export const formSchema: FormSchema[] = [ | @@ -324,7 +334,7 @@ export const formSchema: FormSchema[] = [ | ||
324 | { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, | 334 | { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, |
325 | <#-- 邮政编码 --> | 335 | <#-- 邮政编码 --> |
326 | <#elseif fieldValidType == 'p'> | 336 | <#elseif fieldValidType == 'p'> |
327 | - { pattern: /^[1-9]\d{5}$/, message: '请输入正确的邮政编码!'}, | 337 | + { pattern: /^[0-9]\d{5}$/, message: '请输入正确的邮政编码!'}, |
328 | <#-- 字母 --> | 338 | <#-- 字母 --> |
329 | <#elseif fieldValidType == 's'> | 339 | <#elseif fieldValidType == 's'> |
330 | { pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'}, | 340 | { pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'}, |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue3Native/${entityName}__api.tsi
1 | import { defHttp } from '/@/utils/http/axios'; | 1 | import { defHttp } from '/@/utils/http/axios'; |
2 | -import { Modal } from 'ant-design-vue'; | 2 | +import { useMessage } from "/@/hooks/web/useMessage"; |
3 | + | ||
4 | +const { createConfirm } = useMessage(); | ||
3 | 5 | ||
4 | enum Api { | 6 | enum Api { |
5 | list = '/${entityPackage}/${entityName?uncap_first}/list', | 7 | list = '/${entityPackage}/${entityName?uncap_first}/list', |
@@ -45,7 +47,8 @@ export const deleteOne = (params,handleSuccess) => { | @@ -45,7 +47,8 @@ export const deleteOne = (params,handleSuccess) => { | ||
45 | * @param handleSuccess | 47 | * @param handleSuccess |
46 | */ | 48 | */ |
47 | export const batchDelete = (params, handleSuccess) => { | 49 | export const batchDelete = (params, handleSuccess) => { |
48 | - Modal.confirm({ | 50 | + createConfirm({ |
51 | + iconType: 'warning', | ||
49 | title: '确认删除', | 52 | title: '确认删除', |
50 | content: '是否删除选中数据', | 53 | content: '是否删除选中数据', |
51 | okText: '确认', | 54 | okText: '确认', |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue3Native/${entityName}__data.tsi
@@ -324,7 +324,7 @@ export const formSchema: FormSchema[] = [ | @@ -324,7 +324,7 @@ export const formSchema: FormSchema[] = [ | ||
324 | { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, | 324 | { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, |
325 | <#-- 邮政编码 --> | 325 | <#-- 邮政编码 --> |
326 | <#elseif fieldValidType == 'p'> | 326 | <#elseif fieldValidType == 'p'> |
327 | - { pattern: /^[1-9]\d{5}$/, message: '请输入正确的邮政编码!'}, | 327 | + { pattern: /^[0-9]\d{5}$/, message: '请输入正确的邮政编码!'}, |
328 | <#-- 字母 --> | 328 | <#-- 字母 --> |
329 | <#elseif fieldValidType == 's'> | 329 | <#elseif fieldValidType == 's'> |
330 | { pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'}, | 330 | { pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'}, |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue3Native/components/${entityName}Form.vuei
@@ -64,6 +64,7 @@ | @@ -64,6 +64,7 @@ | ||
64 | const emit = defineEmits(['register', 'ok']); | 64 | const emit = defineEmits(['register', 'ok']); |
65 | const formData = reactive<Record<string, any>>({ | 65 | const formData = reactive<Record<string, any>>({ |
66 | <#list columns as po> | 66 | <#list columns as po> |
67 | + id: '', | ||
67 | <#if po.isShow == 'Y'> | 68 | <#if po.isShow == 'Y'> |
68 | <#if po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'> | 69 | <#if po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'> |
69 | ${po.fieldName}: undefined, | 70 | ${po.fieldName}: undefined, |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/tree/java/${bussiPackage}/${entityPackage}/vue3/${entityName}List.vuei
1 | <#assign pidFieldName = ""> | 1 | <#assign pidFieldName = ""> |
2 | <#assign hasChildrenField = ""> | 2 | <#assign hasChildrenField = ""> |
3 | +<#assign bpm_flag=false> | ||
3 | <#list originalColumns as po> | 4 | <#list originalColumns as po> |
4 | <#if po.fieldDbName == tableVo.extendParams.pidField> | 5 | <#if po.fieldDbName == tableVo.extendParams.pidField> |
5 | <#assign pidFieldName = po.fieldName> | 6 | <#assign pidFieldName = po.fieldName> |
@@ -11,6 +12,9 @@ | @@ -11,6 +12,9 @@ | ||
11 | <#assign list_need_pca=false> | 12 | <#assign list_need_pca=false> |
12 | <#-- 开始循环 --> | 13 | <#-- 开始循环 --> |
13 | <#list columns as po> | 14 | <#list columns as po> |
15 | + <#if po.fieldDbName=='bpm_status'> | ||
16 | + <#assign bpm_flag=true> | ||
17 | + </#if> | ||
14 | <#if po.classType=='pca'> | 18 | <#if po.classType=='pca'> |
15 | <#assign list_need_pca=true> | 19 | <#assign list_need_pca=true> |
16 | </#if> | 20 | </#if> |
@@ -74,6 +78,9 @@ | @@ -74,6 +78,9 @@ | ||
74 | <#if list_need_pca> | 78 | <#if list_need_pca> |
75 | import { getAreaTextByCode } from '/@/components/Form/src/utils/Area'; | 79 | import { getAreaTextByCode } from '/@/components/Form/src/utils/Area'; |
76 | </#if> | 80 | </#if> |
81 | + <#if bpm_flag==true> | ||
82 | + import { startProcess } from '/@/api/common/api'; | ||
83 | + </#if> | ||
77 | const expandedRowKeys = ref([]); | 84 | const expandedRowKeys = ref([]); |
78 | //字典model | 85 | //字典model |
79 | const [registerModal, {openModal}] = useModal(); | 86 | const [registerModal, {openModal}] = useModal(); |
@@ -116,6 +123,7 @@ | @@ -116,6 +123,7 @@ | ||
116 | }, | 123 | }, |
117 | actionColumn: { | 124 | actionColumn: { |
118 | width: 240, | 125 | width: 240, |
126 | + fixed:'right' | ||
119 | }, | 127 | }, |
120 | }, | 128 | }, |
121 | exportConfig: { | 129 | exportConfig: { |
@@ -329,19 +337,61 @@ | @@ -329,19 +337,61 @@ | ||
329 | * 下拉操作栏 | 337 | * 下拉操作栏 |
330 | */ | 338 | */ |
331 | function getDropDownAction(record){ | 339 | function getDropDownAction(record){ |
332 | - return [ | ||
333 | - { | ||
334 | - label: '详情', | ||
335 | - onClick: handleDetail.bind(null, record), | ||
336 | - }, { | ||
337 | - label: '删除', | ||
338 | - popConfirm: { | ||
339 | - title: '确定删除吗?', | ||
340 | - confirm: handleDelete.bind(null, record), | ||
341 | - } | ||
342 | - } | ||
343 | - ] | 340 | + <#if bpm_flag==true> |
341 | + let dropDownAction = [ | ||
342 | + { | ||
343 | + label: '详情', | ||
344 | + onClick: handleDetail.bind(null, record), | ||
345 | + }, { | ||
346 | + label: '删除', | ||
347 | + popConfirm: { | ||
348 | + title: '是否确认删除', | ||
349 | + confirm: handleDelete.bind(null, record) | ||
350 | + } | ||
351 | + } | ||
352 | + ]; | ||
353 | + if(record.bpmStatus == '1'){ | ||
354 | + dropDownAction.push({ | ||
355 | + label: '发起流程', | ||
356 | + popConfirm: { | ||
357 | + title: '确认提交流程吗?', | ||
358 | + confirm: handleProcess.bind(null, record), | ||
359 | + } | ||
360 | + }) | ||
361 | + } | ||
362 | + return dropDownAction; | ||
363 | + <#else> | ||
364 | + return [ | ||
365 | + { | ||
366 | + label: '详情', | ||
367 | + onClick: handleDetail.bind(null, record), | ||
368 | + }, { | ||
369 | + label: '删除', | ||
370 | + popConfirm: { | ||
371 | + title: '确定删除吗?', | ||
372 | + confirm: handleDelete.bind(null, record), | ||
373 | + } | ||
374 | + } | ||
375 | + ] | ||
376 | + </#if> | ||
344 | } | 377 | } |
378 | + | ||
379 | + <#if bpm_flag==true> | ||
380 | + /** | ||
381 | + * 提交流程 | ||
382 | + */ | ||
383 | + async function handleProcess(record) { | ||
384 | + let params = { | ||
385 | + flowCode: 'dev_${tableName}_001', | ||
386 | + id: record.id, | ||
387 | + formUrl: '${entityPackage}/modules/${entityName}Form', | ||
388 | + formUrlMobile: '' | ||
389 | + } | ||
390 | + await startProcess(params); | ||
391 | + await reload(); | ||
392 | + } | ||
393 | + </#if> | ||
394 | + | ||
345 | </script> | 395 | </script> |
346 | 396 | ||
347 | <style scoped> | 397 | <style scoped> |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/tree/java/${bussiPackage}/${entityPackage}/vue3/${entityName}__api.tsi
1 | import {defHttp} from "/@/utils/http/axios"; | 1 | import {defHttp} from "/@/utils/http/axios"; |
2 | -import {Modal} from 'ant-design-vue'; | 2 | +import { useMessage } from "/@/hooks/web/useMessage"; |
3 | + | ||
4 | +const { createConfirm } = useMessage(); | ||
3 | 5 | ||
4 | enum Api { | 6 | enum Api { |
5 | list = '/${entityPackage}/${entityName?uncap_first}/rootList', | 7 | list = '/${entityPackage}/${entityName?uncap_first}/rootList', |
@@ -42,7 +44,8 @@ export const delete${entityName} = (params,handleSuccess) => { | @@ -42,7 +44,8 @@ export const delete${entityName} = (params,handleSuccess) => { | ||
42 | * @param params | 44 | * @param params |
43 | */ | 45 | */ |
44 | export const batchDelete${entityName} = (params, handleSuccess) => { | 46 | export const batchDelete${entityName} = (params, handleSuccess) => { |
45 | - Modal.confirm({ | 47 | + createConfirm({ |
48 | + iconType: 'warning', | ||
46 | title: '确认删除', | 49 | title: '确认删除', |
47 | content: '是否删除选中数据', | 50 | content: '是否删除选中数据', |
48 | okText: '确认', | 51 | okText: '确认', |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/tree/java/${bussiPackage}/${entityPackage}/vue3/${entityName}__data.tsi
@@ -213,6 +213,15 @@ export const formSchema: FormSchema[] = [ | @@ -213,6 +213,15 @@ export const formSchema: FormSchema[] = [ | ||
213 | { | 213 | { |
214 | label: '${po.filedComment}', | 214 | label: '${po.filedComment}', |
215 | field: ${autoStringSuffix(po)}, | 215 | field: ${autoStringSuffix(po)}, |
216 | +<#-- update-begin-author:taoyan date:2022-6-24 for: VUEN-1190【代码生成】默认值未生成 --> | ||
217 | + <#if po.defaultVal??> | ||
218 | + <#if po.fieldDbType=="BigDecimal" || po.fieldDbType=="double" || po.fieldDbType=="int"> | ||
219 | + defaultValue: ${po.defaultVal}, | ||
220 | + <#else> | ||
221 | + defaultValue: "${po.defaultVal}", | ||
222 | + </#if> | ||
223 | + </#if> | ||
224 | +<#-- update-end-author:taoyan date:2022-6-24 for: VUEN-1190【代码生成】默认值未生成 --> | ||
216 | <#if po.fieldDbName == tableVo.extendParams.pidField> | 225 | <#if po.fieldDbName == tableVo.extendParams.pidField> |
217 | component: 'JTreeSelect', | 226 | component: 'JTreeSelect', |
218 | componentProps: { | 227 | componentProps: { |
@@ -354,7 +363,7 @@ export const formSchema: FormSchema[] = [ | @@ -354,7 +363,7 @@ export const formSchema: FormSchema[] = [ | ||
354 | { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, | 363 | { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, |
355 | <#-- 邮政编码 --> | 364 | <#-- 邮政编码 --> |
356 | <#elseif fieldValidType == 'p'> | 365 | <#elseif fieldValidType == 'p'> |
357 | - { pattern: /^[1-9]\d{5}$/, message: '请输入正确的邮政编码!'}, | 366 | + { pattern: /^[0-9]\d{5}$/, message: '请输入正确的邮政编码!'}, |
358 | <#-- 字母 --> | 367 | <#-- 字母 --> |
359 | <#elseif fieldValidType == 's'> | 368 | <#elseif fieldValidType == 's'> |
360 | { pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'}, | 369 | { pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'}, |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/tree/java/${bussiPackage}/${entityPackage}/vue3Native/${entityName}__api.tsi
1 | import { defHttp } from "/@/utils/http/axios"; | 1 | import { defHttp } from "/@/utils/http/axios"; |
2 | -import { Modal } from 'ant-design-vue'; | 2 | +import { useMessage } from "/@/hooks/web/useMessage"; |
3 | + | ||
4 | +const { createConfirm } = useMessage(); | ||
3 | 5 | ||
4 | enum Api { | 6 | enum Api { |
5 | list = '/${entityPackage}/${entityName?uncap_first}/rootList', | 7 | list = '/${entityPackage}/${entityName?uncap_first}/rootList', |
@@ -48,7 +50,8 @@ export const delete${entityName} = (params,handleSuccess) => { | @@ -48,7 +50,8 @@ export const delete${entityName} = (params,handleSuccess) => { | ||
48 | * @param handleSuccess | 50 | * @param handleSuccess |
49 | */ | 51 | */ |
50 | export const batchDelete${entityName} = (params, handleSuccess) => { | 52 | export const batchDelete${entityName} = (params, handleSuccess) => { |
51 | - Modal.confirm({ | 53 | + createConfirm({ |
54 | + iconType: 'warning', | ||
52 | title: '确认删除', | 55 | title: '确认删除', |
53 | content: '是否删除选中数据', | 56 | content: '是否删除选中数据', |
54 | okText: '确认', | 57 | okText: '确认', |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/tree/java/${bussiPackage}/${entityPackage}/vue3Native/${entityName}__data.tsi
@@ -351,13 +351,13 @@ export const formSchema: FormSchema[] = [ | @@ -351,13 +351,13 @@ export const formSchema: FormSchema[] = [ | ||
351 | { pattern: /^((ht|f)tps?):\/\/[\w\-]+(\.[\w\-]+)+([\w\-.,@?^=%&:\/~+#]*[\w\-@?^=%&\/~+#])?$/, message: '请输入正确的网址!' }, | 351 | { pattern: /^((ht|f)tps?):\/\/[\w\-]+(\.[\w\-]+)+([\w\-.,@?^=%&:\/~+#]*[\w\-@?^=%&\/~+#])?$/, message: '请输入正确的网址!' }, |
352 | <#-- 电子邮件 --> | 352 | <#-- 电子邮件 --> |
353 | <#elseif fieldValidType == 'e'> | 353 | <#elseif fieldValidType == 'e'> |
354 | - { pattern: /^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/, message: '请输入正确的电子邮件! }, | 354 | + { pattern: /^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/, message: '请输入正确的电子邮件!' }, |
355 | <#-- 手机号码 --> | 355 | <#-- 手机号码 --> |
356 | <#elseif fieldValidType == 'm'> | 356 | <#elseif fieldValidType == 'm'> |
357 | { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!' }, | 357 | { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!' }, |
358 | <#-- 邮政编码 --> | 358 | <#-- 邮政编码 --> |
359 | <#elseif fieldValidType == 'p'> | 359 | <#elseif fieldValidType == 'p'> |
360 | - { pattern: /^[1-9]\d{5}$/, message: '请输入正确的邮政编码!' }, | 360 | + { pattern: /^[0-9]\d{5}$/, message: '请输入正确的邮政编码!' }, |
361 | <#-- 字母 --> | 361 | <#-- 字母 --> |
362 | <#elseif fieldValidType == 's'> | 362 | <#elseif fieldValidType == 's'> |
363 | { pattern: /^[A-Z|a-z]+$/, message: '请输入字母!' }, | 363 | { pattern: /^[A-Z|a-z]+$/, message: '请输入字母!' }, |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/tree/java/${bussiPackage}/${entityPackage}/vue3Native/components/${entityName}Form.vuei
@@ -39,6 +39,7 @@ | @@ -39,6 +39,7 @@ | ||
39 | </#if> | 39 | </#if> |
40 | <#if po.fieldDbName == tableVo.extendParams.pidField> | 40 | <#if po.fieldDbName == tableVo.extendParams.pidField> |
41 | <#assign pidFieldName = po.fieldName> | 41 | <#assign pidFieldName = po.fieldName> |
42 | + <#assign need_select_tree = true> | ||
42 | <a-col :span="${form_span}"> | 43 | <a-col :span="${form_span}"> |
43 | <a-form-item label="父级节点" v-bind="validateInfos.${autoStringSuffixForModel(po)}"> | 44 | <a-form-item label="父级节点" v-bind="validateInfos.${autoStringSuffixForModel(po)}"> |
44 | <j-tree-select | 45 | <j-tree-select |
@@ -67,7 +68,6 @@ | @@ -67,7 +68,6 @@ | ||
67 | import moment from 'moment'; | 68 | import moment from 'moment'; |
68 | <#include "/common/form/native/vue3NativeImport.ftl"> | 69 | <#include "/common/form/native/vue3NativeImport.ftl"> |
69 | import { getValueType } from '/@/utils'; | 70 | import { getValueType } from '/@/utils'; |
70 | - import { validateDuplicateValue } from '/@/utils/helper/validator'; | ||
71 | import {loadTreeData, saveOrUpdateDict} from '../${entityName}.api'; | 71 | import {loadTreeData, saveOrUpdateDict} from '../${entityName}.api'; |
72 | import { Form } from 'ant-design-vue'; | 72 | import { Form } from 'ant-design-vue'; |
73 | <#if hasOnlyValidate == true> | 73 | <#if hasOnlyValidate == true> |
@@ -84,6 +84,7 @@ | @@ -84,6 +84,7 @@ | ||
84 | let model: Nullable<Recordable> = null; | 84 | let model: Nullable<Recordable> = null; |
85 | const formData = reactive<Record<string, any>>({ | 85 | const formData = reactive<Record<string, any>>({ |
86 | <#list columns as po> | 86 | <#list columns as po> |
87 | + id: '', | ||
87 | <#if po.isShow == 'Y'> | 88 | <#if po.isShow == 'Y'> |
88 | <#if po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'> | 89 | <#if po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'> |
89 | ${po.fieldName}: undefined, | 90 | ${po.fieldName}: undefined, |
@@ -125,6 +126,7 @@ | @@ -125,6 +126,7 @@ | ||
125 | treeData.value = await loadTreeData({ async: false, pcode: '' }); | 126 | treeData.value = await loadTreeData({ async: false, pcode: '' }); |
126 | //赋值 | 127 | //赋值 |
127 | Object.assign(formData, record); | 128 | Object.assign(formData, record); |
129 | + model = record | ||
128 | }); | 130 | }); |
129 | } | 131 | } |
130 | 132 |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/vue3/${entityName}List.vuei
@@ -90,6 +90,9 @@ | @@ -90,6 +90,9 @@ | ||
90 | import { getAuthCache, setAuthCache } from '/@/utils/auth'; | 90 | import { getAuthCache, setAuthCache } from '/@/utils/auth'; |
91 | import { DB_DICT_DATA_KEY } from '/@/enums/cacheEnum'; | 91 | import { DB_DICT_DATA_KEY } from '/@/enums/cacheEnum'; |
92 | </#if> | 92 | </#if> |
93 | + <#if bpm_flag==true> | ||
94 | + import { startProcess } from '/@/api/common/api'; | ||
95 | + </#if> | ||
93 | //注册model | 96 | //注册model |
94 | const [registerModal, {openModal}] = useModal(); | 97 | const [registerModal, {openModal}] = useModal(); |
95 | //注册table数据 | 98 | //注册table数据 |
@@ -210,23 +213,66 @@ | @@ -210,23 +213,66 @@ | ||
210 | } | 213 | } |
211 | ] | 214 | ] |
212 | } | 215 | } |
213 | - /** | ||
214 | - * 下拉操作栏 | ||
215 | - */ | 216 | + |
217 | + <#if bpm_flag==true> | ||
218 | + /** | ||
219 | + * 提交流程 | ||
220 | + */ | ||
221 | + async function handleProcess(record) { | ||
222 | + let params = { | ||
223 | + flowCode: 'dev_${tableName}_001', | ||
224 | + id: record.id, | ||
225 | + formUrl: '${entityPackage}/modules/${entityName}Form', | ||
226 | + formUrlMobile: '' | ||
227 | + } | ||
228 | + await startProcess(params); | ||
229 | + handleSuccess(); | ||
230 | + } | ||
231 | + </#if> | ||
232 | + | ||
233 | + /** | ||
234 | + * 下拉操作栏 | ||
235 | + */ | ||
216 | function getDropDownAction(record){ | 236 | function getDropDownAction(record){ |
217 | - return [ | ||
218 | - { | ||
219 | - label: '详情', | ||
220 | - onClick: handleDetail.bind(null, record), | ||
221 | - }, { | ||
222 | - label: '删除', | ||
223 | - popConfirm: { | ||
224 | - title: '是否确认删除', | ||
225 | - confirm: handleDelete.bind(null, record), | ||
226 | - } | ||
227 | - } | ||
228 | - ] | ||
229 | - } | 237 | + <#if bpm_flag==true> |
238 | + let dropDownAction = [ | ||
239 | + { | ||
240 | + label: '详情', | ||
241 | + onClick: handleDetail.bind(null, record), | ||
242 | + }, { | ||
243 | + label: '删除', | ||
244 | + popConfirm: { | ||
245 | + title: '是否确认删除', | ||
246 | + confirm: handleDelete.bind(null, record), | ||
247 | + } | ||
248 | + } | ||
249 | + ]; | ||
250 | + if(record.bpmStatus == '1'){ | ||
251 | + dropDownAction.push({ | ||
252 | + label: '发起流程', | ||
253 | + popConfirm: { | ||
254 | + title: '确认提交流程吗?', | ||
255 | + confirm: handleProcess.bind(null, record), | ||
256 | + } | ||
257 | + }) | ||
258 | + } | ||
259 | + return dropDownAction; | ||
260 | + <#else> | ||
261 | + return [ | ||
262 | + { | ||
263 | + label: '详情', | ||
264 | + onClick: handleDetail.bind(null, record), | ||
265 | + }, { | ||
266 | + label: '删除', | ||
267 | + popConfirm: { | ||
268 | + title: '是否确认删除', | ||
269 | + confirm: handleDelete.bind(null, record), | ||
270 | + } | ||
271 | + } | ||
272 | + ] | ||
273 | + </#if> | ||
274 | + } | ||
275 | + | ||
230 | <#if list_need_category> | 276 | <#if list_need_category> |
231 | /** | 277 | /** |
232 | * 初始化字典配置 | 278 | * 初始化字典配置 |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/vue3/${entityName}__api.tsi
1 | import {defHttp} from '/@/utils/http/axios'; | 1 | import {defHttp} from '/@/utils/http/axios'; |
2 | -import {Modal} from 'ant-design-vue'; | 2 | +import { useMessage } from "/@/hooks/web/useMessage"; |
3 | + | ||
4 | +const { createConfirm } = useMessage(); | ||
3 | 5 | ||
4 | enum Api { | 6 | enum Api { |
5 | list = '/${entityPackage}/${entityName?uncap_first}/list', | 7 | list = '/${entityPackage}/${entityName?uncap_first}/list', |
@@ -47,7 +49,8 @@ export const deleteOne = (params,handleSuccess) => { | @@ -47,7 +49,8 @@ export const deleteOne = (params,handleSuccess) => { | ||
47 | * @param params | 49 | * @param params |
48 | */ | 50 | */ |
49 | export const batchDelete = (params, handleSuccess) => { | 51 | export const batchDelete = (params, handleSuccess) => { |
50 | - Modal.confirm({ | 52 | + createConfirm({ |
53 | + iconType: 'warning', | ||
51 | title: '确认删除', | 54 | title: '确认删除', |
52 | content: '是否删除选中数据', | 55 | content: '是否删除选中数据', |
53 | okText: '确认', | 56 | okText: '确认', |
@@ -68,12 +71,21 @@ export const saveOrUpdate = (params, isUpdate) => { | @@ -68,12 +71,21 @@ export const saveOrUpdate = (params, isUpdate) => { | ||
68 | return defHttp.post({url: url, params}); | 71 | return defHttp.post({url: url, params}); |
69 | } | 72 | } |
70 | <#list subTables as sub><#rt/> | 73 | <#list subTables as sub><#rt/> |
74 | + <#assign myForeignKeys=''> | ||
75 | + <#list sub.foreignKeys as key> | ||
76 | + <#assign myForeignKeys='${key?uncap_first}'> | ||
77 | + </#list> | ||
71 | /** | 78 | /** |
72 | * 列表接口 | 79 | * 列表接口 |
73 | * @param params | 80 | * @param params |
74 | */ | 81 | */ |
75 | -export const ${sub.entityName?uncap_first}List = (params) => | ||
76 | - defHttp.get({url: Api.${sub.entityName?uncap_first}List, params}); | 82 | +export const ${sub.entityName?uncap_first}List = (params) => { |
83 | + if(params['${myForeignKeys}']){ | ||
84 | + return defHttp.get({url: Api.${sub.entityName?uncap_first}List, params}); | ||
85 | + } | ||
86 | + return Promise.resolve({}); | ||
87 | +} | ||
88 | + | ||
77 | 89 | ||
78 | /** | 90 | /** |
79 | * 删除单个 | 91 | * 删除单个 |
@@ -88,7 +100,8 @@ export const ${sub.entityName?uncap_first}Delete = (params,handleSuccess) => { | @@ -88,7 +100,8 @@ export const ${sub.entityName?uncap_first}Delete = (params,handleSuccess) => { | ||
88 | * @param params | 100 | * @param params |
89 | */ | 101 | */ |
90 | export const ${sub.entityName?uncap_first}DeleteBatch = (params, handleSuccess) => { | 102 | export const ${sub.entityName?uncap_first}DeleteBatch = (params, handleSuccess) => { |
91 | - Modal.confirm({ | 103 | + createConfirm({ |
104 | + iconType: 'warning', | ||
92 | title: '确认删除', | 105 | title: '确认删除', |
93 | content: '是否删除选中数据', | 106 | content: '是否删除选中数据', |
94 | okText: '确认', | 107 | okText: '确认', |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/vue3/${entityName}__data.tsi
@@ -119,7 +119,8 @@ export const searchFormSchema: FormSchema[] = [ | @@ -119,7 +119,8 @@ export const searchFormSchema: FormSchema[] = [ | ||
119 | <#elseif po.classType=='datetime'> | 119 | <#elseif po.classType=='datetime'> |
120 | component: 'DatePicker', | 120 | component: 'DatePicker', |
121 | componentProps: { | 121 | componentProps: { |
122 | - showTime:true | 122 | + showTime:true, |
123 | + valueFormat: 'YYYY-MM-DD HH:mm:ss' | ||
123 | }, | 124 | }, |
124 | <#elseif po.classType=='pca'> | 125 | <#elseif po.classType=='pca'> |
125 | component: 'JAreaLinkage', | 126 | component: 'JAreaLinkage', |
@@ -187,6 +188,15 @@ export const formSchema: FormSchema[] = [ | @@ -187,6 +188,15 @@ export const formSchema: FormSchema[] = [ | ||
187 | { | 188 | { |
188 | label: '${po.filedComment}', | 189 | label: '${po.filedComment}', |
189 | field: ${autoStringSuffix(po)}, | 190 | field: ${autoStringSuffix(po)}, |
191 | +<#-- update-begin-author:taoyan date:2022-6-24 for: VUEN-1190【代码生成】默认值未生成 --> | ||
192 | + <#if po.defaultVal??> | ||
193 | + <#if po.fieldDbType=="BigDecimal" || po.fieldDbType=="double" || po.fieldDbType=="int"> | ||
194 | + defaultValue: ${po.defaultVal}, | ||
195 | + <#else> | ||
196 | + defaultValue: "${po.defaultVal}", | ||
197 | + </#if> | ||
198 | + </#if> | ||
199 | +<#-- update-end-author:taoyan date:2022-6-24 for: VUEN-1190【代码生成】默认值未生成 --> | ||
190 | <#if po.classType =='date'> | 200 | <#if po.classType =='date'> |
191 | component: 'DatePicker', | 201 | component: 'DatePicker', |
192 | <#elseif po.classType =='datetime'> | 202 | <#elseif po.classType =='datetime'> |
@@ -318,7 +328,7 @@ export const formSchema: FormSchema[] = [ | @@ -318,7 +328,7 @@ export const formSchema: FormSchema[] = [ | ||
318 | { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, | 328 | { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, |
319 | <#-- 邮政编码 --> | 329 | <#-- 邮政编码 --> |
320 | <#elseif fieldValidType == 'p'> | 330 | <#elseif fieldValidType == 'p'> |
321 | - { pattern: /^[1-9]\d{5}$/, message: '请输入正确的邮政编码!'}, | 331 | + { pattern: /^[0-9]\d{5}$/, message: '请输入正确的邮政编码!'}, |
322 | <#-- 字母 --> | 332 | <#-- 字母 --> |
323 | <#elseif fieldValidType == 's'> | 333 | <#elseif fieldValidType == 's'> |
324 | { pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'}, | 334 | { pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'}, |
@@ -448,6 +458,15 @@ export const ${sub.entityName?uncap_first}FormSchema: FormSchema[] = [ | @@ -448,6 +458,15 @@ export const ${sub.entityName?uncap_first}FormSchema: FormSchema[] = [ | ||
448 | { | 458 | { |
449 | label: '${po.filedComment}', | 459 | label: '${po.filedComment}', |
450 | field: ${autoStringSuffix(po)}, | 460 | field: ${autoStringSuffix(po)}, |
461 | +<#-- update-begin-author:taoyan date:2022-6-24 for: VUEN-1190【代码生成】默认值未生成 --> | ||
462 | + <#if po.defaultVal??> | ||
463 | + <#if po.fieldDbType=="BigDecimal" || po.fieldDbType=="double" || po.fieldDbType=="int"> | ||
464 | + defaultValue: ${po.defaultVal}, | ||
465 | + <#else> | ||
466 | + defaultValue: "${po.defaultVal}", | ||
467 | + </#if> | ||
468 | + </#if> | ||
469 | +<#-- update-end-author:taoyan date:2022-6-24 for: VUEN-1190【代码生成】默认值未生成 --> | ||
451 | <#if po.classType =='date'> | 470 | <#if po.classType =='date'> |
452 | component: 'DatePicker', | 471 | component: 'DatePicker', |
453 | <#elseif po.classType =='datetime'> | 472 | <#elseif po.classType =='datetime'> |
@@ -579,7 +598,7 @@ export const ${sub.entityName?uncap_first}FormSchema: FormSchema[] = [ | @@ -579,7 +598,7 @@ export const ${sub.entityName?uncap_first}FormSchema: FormSchema[] = [ | ||
579 | { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, | 598 | { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, |
580 | <#-- 邮政编码 --> | 599 | <#-- 邮政编码 --> |
581 | <#elseif fieldValidType == 'p'> | 600 | <#elseif fieldValidType == 'p'> |
582 | - { pattern: /^[1-9]\d{5}$/, message: '请输入正确的邮政编码!'}, | 601 | + { pattern: /^[0-9]\d{5}$/, message: '请输入正确的邮政编码!'}, |
583 | <#-- 字母 --> | 602 | <#-- 字母 --> |
584 | <#elseif fieldValidType == 's'> | 603 | <#elseif fieldValidType == 's'> |
585 | { pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'}, | 604 | { pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'}, |