Commit d6dd111e28e71dcefff7abe982fe9e7d9e79cd8d

Authored by zhangdaihao
1 parent 57a4c642

代码生成器单表生成报错处理

jeecg-boot/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/vue/modules/${entityName}Modal__Style@Drawer.vuei deleted
1   -<template>
2   - <a-drawer
3   - :title="title"
4   - :width="800"
5   - placement="right"
6   - :closable="false"
7   - @close="close"
8   - :visible="visible"
9   - >
10   -
11   - <a-spin :spinning="confirmLoading">
12   - <a-form :form="form">
13   -
14   -<#list columns as po><#rt/>
15   -<#if po.fieldName !='id'><#rt/>
16   - <a-form-item
17   - :labelCol="labelCol"
18   - :wrapperCol="wrapperCol"
19   - label="${po.filedComment}">
20   - <#if po.fieldType =='date'>
21   - <a-date-picker v-decorator="[ '${po.fieldName}', <#if po.nullable =='N'>validatorRules.${po.fieldName} <#else>{}</#if>]" />
22   - <#elseif po.fieldType =='datetime'>
23   - <a-date-picker showTime format='YYYY-MM-DD HH:mm:ss' v-decorator="[ '${po.fieldName}', <#if po.nullable =='N'>validatorRules.${po.fieldName} <#else>{}</#if>]" />
24   - <#elseif "int,decimal,double,"?contains(po.fieldType)>
25   - <a-input-number v-decorator="[ '${po.fieldName}', <#if po.nullable =='N'>validatorRules.${po.fieldName} <#else>{}</#if>]" />
26   - <#else>
27   - <a-input placeholder="请输入${po.filedComment}" v-decorator="['${po.fieldName}', <#if po.nullable =='N'>validatorRules.${po.fieldName} <#else>{}</#if>]" />
28   - </#if>
29   - </a-form-item>
30   -</#if>
31   -</#list>
32   -
33   - </a-form>
34   - </a-spin>
35   - <a-button type="primary" @click="handleOk">确定</a-button>
36   - <a-button type="primary" @click="handleCancel">取消</a-button>
37   - </a-drawer>
38   -</template>
39   -
40   -<script>
41   - import { httpAction } from '@/api/manage'
42   - import pick from 'lodash.pick'
43   - import moment from "moment"
44   -
45   - export default {
46   - name: "${entityName}Modal",
47   - data () {
48   - return {
49   - title:"操作",
50   - visible: false,
51   - model: {},
52   - labelCol: {
53   - xs: { span: 24 },
54   - sm: { span: 5 },
55   - },
56   - wrapperCol: {
57   - xs: { span: 24 },
58   - sm: { span: 16 },
59   - },
60   -
61   - confirmLoading: false,
62   - form: this.$form.createForm(this),
63   - validatorRules:{
64   - <#list columns as po>
65   - <#if po.fieldName !='id'>
66   - <#if po.nullable =='N'>
67   - ${po.fieldName}:{rules: [{ required: true, message: '请输入${po.filedComment}!' }]},
68   - </#if>
69   - </#if>
70   - </#list>
71   - },
72   - url: {
73   - add: "/${entityPackage}/${entityName?uncap_first}/add",
74   - edit: "/${entityPackage}/${entityName?uncap_first}/edit",
75   - },
76   - }
77   - },
78   - created () {
79   - },
80   - methods: {
81   - add () {
82   - this.edit({});
83   - },
84   - edit (record) {
85   - this.form.resetFields();
86   - this.model = Object.assign({}, record);
87   - this.visible = true;
88   - this.$nextTick(() => {
89   - this.form.setFieldsValue(pick(this.model<#list columns as po><#if po.fieldName !='id' && po.fieldType?index_of("date")==-1>,'${po.fieldName}'</#if></#list>))
90   - //时间格式化
91   - <#list columns as po>
92   - <#if po.fieldName !='id' && po.fieldType?index_of("date")!=-1>
93   - this.form.setFieldsValue({${po.fieldName}:this.model.${po.fieldName}?moment(this.model.${po.fieldName}):null})
94   - </#if>
95   - </#list>
96   - });
97   -
98   - },
99   - close () {
100   - this.$emit('close');
101   - this.visible = false;
102   - },
103   - handleOk () {
104   - const that = this;
105   - // 触发表单验证
106   - this.form.validateFields((err, values) => {
107   - if (!err) {
108   - that.confirmLoading = true;
109   - let httpurl = '';
110   - let method = '';
111   - if(!this.model.id){
112   - httpurl+=this.url.add;
113   - method = 'post';
114   - }else{
115   - httpurl+=this.url.edit;
116   - method = 'put';
117   - }
118   - let formData = Object.assign(this.model, values);
119   - //时间格式化
120   - <#list columns as po>
121   - <#if po.fieldName !='id' && po.fieldType =='date'>
122   - formData.${po.fieldName} = formData.${po.fieldName}?formData.${po.fieldName}.format():null;
123   - <#elseif po.fieldName !='id' && po.fieldType =='datetime'>
124   - formData.${po.fieldName} = formData.${po.fieldName}?formData.${po.fieldName}.format('YYYY-MM-DD HH:mm:ss'):null;
125   - </#if>
126   - </#list>
127   -
128   - console.log(formData)
129   - httpAction(httpurl,formData,method).then((res)=>{
130   - if(res.success){
131   - that.$message.success(res.message);
132   - that.$emit('ok');
133   - }else{
134   - that.$message.warning(res.message);
135   - }
136   - }).finally(() => {
137   - that.confirmLoading = false;
138   - that.close();
139   - })
140   -
141   -
142   -
143   - }
144   - })
145   - },
146   - handleCancel () {
147   - this.close()
148   - },
149   -
150   -
151   - }
152   - }
153   -</script>
154   -
155   -<style lang="less" scoped>
156   -/** Button按钮间距 */
157   - .ant-btn {
158   - margin-left: 30px;
159   - margin-bottom: 30px;
160   - float: right;
161   - }
162   -</style>
163 0 \ No newline at end of file
jeecg-boot/src/main/resources/jeecg/code-template/one2/java/${bussiPackage}/vue/${entityPackage}/modules/${entityName}Modal__Style@Drawer.vuei deleted
1   -<template>
2   - <a-drawer
3   - :title="title"
4   - :width="800"
5   - placement="right"
6   - :closable="false"
7   - @close="close"
8   - :visible="visible"
9   - >
10   -
11   - <a-spin :spinning="confirmLoading">
12   - <a-form :form="form">
13   -
14   -<#list columns as po><#rt/>
15   -<#if po.fieldName !='id'><#rt/>
16   - <a-form-item
17   - :labelCol="labelCol"
18   - :wrapperCol="wrapperCol"
19   - label="${po.filedComment}">
20   - <#if po.fieldType =='date'>
21   - <a-date-picker v-decorator="[ '${po.fieldName}', <#if po.nullable =='N'>validatorRules.${po.fieldName} <#else>{}</#if>]" />
22   - <#elseif po.fieldType =='datetime'>
23   - <a-date-picker showTime format='YYYY-MM-DD HH:mm:ss' v-decorator="[ '${po.fieldName}', <#if po.nullable =='N'>validatorRules.${po.fieldName} <#else>{}</#if>]" />
24   - <#elseif "int,decimal,double,"?contains(po.fieldType)>
25   - <a-input-number v-decorator="[ '${po.fieldName}', <#if po.nullable =='N'>validatorRules.${po.fieldName} <#else>{}</#if>]" />
26   - <#else>
27   - <a-input placeholder="请输入${po.filedComment}" v-decorator="['${po.fieldName}', <#if po.nullable =='N'>validatorRules.${po.fieldName} <#else>{}</#if>]" />
28   - </#if>
29   - </a-form-item>
30   -</#if>
31   -</#list>
32   -
33   - </a-form>
34   - </a-spin>
35   - <a-button type="primary" @click="handleOk">确定</a-button>
36   - <a-button type="primary" @click="handleCancel">取消</a-button>
37   - </a-drawer>
38   -</template>
39   -
40   -<script>
41   - import { httpAction } from '@/api/manage'
42   - import pick from 'lodash.pick'
43   - import moment from "moment"
44   -
45   - export default {
46   - name: "${entityName}Modal",
47   - data () {
48   - return {
49   - title:"操作",
50   - visible: false,
51   - model: {},
52   - labelCol: {
53   - xs: { span: 24 },
54   - sm: { span: 5 },
55   - },
56   - wrapperCol: {
57   - xs: { span: 24 },
58   - sm: { span: 16 },
59   - },
60   -
61   - confirmLoading: false,
62   - form: this.$form.createForm(this),
63   - validatorRules:{
64   - <#list columns as po>
65   - <#if po.fieldName !='id'>
66   - <#if po.nullable =='N'>
67   - ${po.fieldName}:{rules: [{ required: true, message: '请输入${po.filedComment}!' }]},
68   - </#if>
69   - </#if>
70   - </#list>
71   - },
72   - url: {
73   - add: "/${entityPackage}/${entityName?uncap_first}/add",
74   - edit: "/${entityPackage}/${entityName?uncap_first}/edit",
75   - },
76   - }
77   - },
78   - created () {
79   - },
80   - methods: {
81   - add () {
82   - this.edit({});
83   - },
84   - edit (record) {
85   - this.form.resetFields();
86   - this.model = Object.assign({}, record);
87   - this.visible = true;
88   - this.$nextTick(() => {
89   - this.form.setFieldsValue(pick(this.model<#list columns as po><#if po.fieldName !='id' && po.fieldType?index_of("date")==-1>,'${po.fieldName}'</#if></#list>))
90   - //时间格式化
91   - <#list columns as po>
92   - <#if po.fieldName !='id' && po.fieldType?index_of("date")!=-1>
93   - this.form.setFieldsValue({${po.fieldName}:this.model.${po.fieldName}?moment(this.model.${po.fieldName}):null})
94   - </#if>
95   - </#list>
96   - });
97   -
98   - },
99   - close () {
100   - this.$emit('close');
101   - this.visible = false;
102   - },
103   - handleOk () {
104   - const that = this;
105   - // 触发表单验证
106   - this.form.validateFields((err, values) => {
107   - if (!err) {
108   - that.confirmLoading = true;
109   - let httpurl = '';
110   - let method = '';
111   - if(!this.model.id){
112   - httpurl+=this.url.add;
113   - method = 'post';
114   - }else{
115   - httpurl+=this.url.edit;
116   - method = 'put';
117   - }
118   - let formData = Object.assign(this.model, values);
119   - //时间格式化
120   - <#list columns as po>
121   - <#if po.fieldName !='id' && po.fieldType =='date'>
122   - formData.${po.fieldName} = formData.${po.fieldName}?formData.${po.fieldName}.format():null;
123   - <#elseif po.fieldName !='id' && po.fieldType =='datetime'>
124   - formData.${po.fieldName} = formData.${po.fieldName}?formData.${po.fieldName}.format('YYYY-MM-DD HH:mm:ss'):null;
125   - </#if>
126   - </#list>
127   -
128   - console.log(formData)
129   - httpAction(httpurl,formData,method).then((res)=>{
130   - if(res.success){
131   - that.$message.success(res.message);
132   - that.$emit('ok');
133   - }else{
134   - that.$message.warning(res.message);
135   - }
136   - }).finally(() => {
137   - that.confirmLoading = false;
138   - that.close();
139   - })
140   -
141   -
142   -
143   - }
144   - })
145   - },
146   - handleCancel () {
147   - this.close()
148   - },
149   -
150   -
151   - }
152   - }
153   -</script>
154   -
155   -<style lang="less" scoped>
156   -/** Button按钮间距 */
157   - .ant-btn {
158   - margin-left: 30px;
159   - margin-bottom: 30px;
160   - float: right;
161   - }
162   -</style>
163 0 \ No newline at end of file