Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jeecg
jeecg-boot
提交
89f85fb6
J
jeecg-boot
项目概览
jeecg
/
jeecg-boot
上一次同步 3 年多
通知
865
Star
24375
Fork
84
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jeecg-boot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
89f85fb6
编写于
4月 16, 2019
作者:
JEECG低代码平台
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
单表代码生成器生成,报错bug处理
上级
b765e455
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
324 addition
and
0 deletion
+324
-0
jeecg-boot/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/vue/modules/${entityName}Modal__Style#Drawer.vuei
...ackage}/vue/modules/${entityName}Modal__Style#Drawer.vuei
+162
-0
jeecg-boot/src/main/resources/jeecg/code-template/one2/java/${bussiPackage}/vue/${entityPackage}/modules/${entityName}Modal__Style#Drawer.vuei
...ityPackage}/modules/${entityName}Modal__Style#Drawer.vuei
+162
-0
未找到文件。
jeecg-boot/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/vue/modules/${entityName}Modal__Style#Drawer.vuei
0 → 100644
浏览文件 @
89f85fb6
<template>
<a-drawer
:title="title"
:width="800"
placement="right"
:closable="false"
@close="close"
:visible="visible"
>
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<#list columns as po><#rt/>
<#if po.fieldName !='id'><#rt/>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="${po.filedComment}">
<#if po.fieldType =='date'>
<a-date-picker v-decorator="[ '${po.fieldName}', <#if po.nullable =='N'>validatorRules.${po.fieldName} <#else>{}</#if>]" />
<#elseif po.fieldType =='datetime'>
<a-date-picker showTime format='YYYY-MM-DD HH:mm:ss' v-decorator="[ '${po.fieldName}', <#if po.nullable =='N'>validatorRules.${po.fieldName} <#else>{}</#if>]" />
<#elseif "int,decimal,double,"?contains(po.fieldType)>
<a-input-number v-decorator="[ '${po.fieldName}', <#if po.nullable =='N'>validatorRules.${po.fieldName} <#else>{}</#if>]" />
<#else>
<a-input placeholder="请输入${po.filedComment}" v-decorator="['${po.fieldName}', <#if po.nullable =='N'>validatorRules.${po.fieldName} <#else>{}</#if>]" />
</#if>
</a-form-item>
</#if>
</#list>
</a-form>
</a-spin>
<a-button type="primary" @click="handleOk">确定</a-button>
<a-button type="primary" @click="handleCancel">取消</a-button>
</a-drawer>
</template>
<script>
import { httpAction } from '@/api/manage'
import pick from 'lodash.pick'
import moment from "moment"
export default {
name: "${entityName}Modal",
data () {
return {
title:"操作",
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules:{
<#list columns as po>
<#if po.fieldName !='id'>
<#if po.nullable =='N'>
${po.fieldName}:{rules: [{ required: true, message: '请输入${po.filedComment}!' }]},
</#if>
</#if>
</#list>
},
url: {
add: "/${entityPackage}/${entityName?uncap_first}/add",
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
},
}
},
created () {
},
methods: {
add () {
this.edit({});
},
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model<#list columns as po><#if po.fieldName !='id' && po.fieldType?index_of("date")==-1>,'${po.fieldName}'</#if></#list>))
//时间格式化
<#list columns as po>
<#if po.fieldName !='id' && po.fieldType?index_of("date")!=-1>
this.form.setFieldsValue({${po.fieldName}:this.model.${po.fieldName}?moment(this.model.${po.fieldName}):null})
</#if>
</#list>
});
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
let formData = Object.assign(this.model, values);
//时间格式化
<#list columns as po>
<#if po.fieldName !='id' && po.fieldType =='date'>
formData.${po.fieldName} = formData.${po.fieldName}?formData.${po.fieldName}.format():null;
<#elseif po.fieldName !='id' && po.fieldType =='datetime'>
formData.${po.fieldName} = formData.${po.fieldName}?formData.${po.fieldName}.format('YYYY-MM-DD HH:mm:ss'):null;
</#if>
</#list>
console.log(formData)
httpAction(httpurl,formData,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
})
}
})
},
handleCancel () {
this.close()
},
}
}
</script>
<style lang="less" scoped>
/** Button按钮间距 */
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
</style>
\ 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
0 → 100644
浏览文件 @
89f85fb6
<template>
<a-drawer
:title="title"
:width="800"
placement="right"
:closable="false"
@close="close"
:visible="visible"
>
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<#list columns as po><#rt/>
<#if po.fieldName !='id'><#rt/>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="${po.filedComment}">
<#if po.fieldType =='date'>
<a-date-picker v-decorator="[ '${po.fieldName}', <#if po.nullable =='N'>validatorRules.${po.fieldName} <#else>{}</#if>]" />
<#elseif po.fieldType =='datetime'>
<a-date-picker showTime format='YYYY-MM-DD HH:mm:ss' v-decorator="[ '${po.fieldName}', <#if po.nullable =='N'>validatorRules.${po.fieldName} <#else>{}</#if>]" />
<#elseif "int,decimal,double,"?contains(po.fieldType)>
<a-input-number v-decorator="[ '${po.fieldName}', <#if po.nullable =='N'>validatorRules.${po.fieldName} <#else>{}</#if>]" />
<#else>
<a-input placeholder="请输入${po.filedComment}" v-decorator="['${po.fieldName}', <#if po.nullable =='N'>validatorRules.${po.fieldName} <#else>{}</#if>]" />
</#if>
</a-form-item>
</#if>
</#list>
</a-form>
</a-spin>
<a-button type="primary" @click="handleOk">确定</a-button>
<a-button type="primary" @click="handleCancel">取消</a-button>
</a-drawer>
</template>
<script>
import { httpAction } from '@/api/manage'
import pick from 'lodash.pick'
import moment from "moment"
export default {
name: "${entityName}Modal",
data () {
return {
title:"操作",
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules:{
<#list columns as po>
<#if po.fieldName !='id'>
<#if po.nullable =='N'>
${po.fieldName}:{rules: [{ required: true, message: '请输入${po.filedComment}!' }]},
</#if>
</#if>
</#list>
},
url: {
add: "/${entityPackage}/${entityName?uncap_first}/add",
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
},
}
},
created () {
},
methods: {
add () {
this.edit({});
},
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model<#list columns as po><#if po.fieldName !='id' && po.fieldType?index_of("date")==-1>,'${po.fieldName}'</#if></#list>))
//时间格式化
<#list columns as po>
<#if po.fieldName !='id' && po.fieldType?index_of("date")!=-1>
this.form.setFieldsValue({${po.fieldName}:this.model.${po.fieldName}?moment(this.model.${po.fieldName}):null})
</#if>
</#list>
});
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
let formData = Object.assign(this.model, values);
//时间格式化
<#list columns as po>
<#if po.fieldName !='id' && po.fieldType =='date'>
formData.${po.fieldName} = formData.${po.fieldName}?formData.${po.fieldName}.format():null;
<#elseif po.fieldName !='id' && po.fieldType =='datetime'>
formData.${po.fieldName} = formData.${po.fieldName}?formData.${po.fieldName}.format('YYYY-MM-DD HH:mm:ss'):null;
</#if>
</#list>
console.log(formData)
httpAction(httpurl,formData,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
})
}
})
},
handleCancel () {
this.close()
},
}
}
</script>
<style lang="less" scoped>
/** Button按钮间距 */
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
</style>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录