fix bug 修改生成的模板不符合ESLint的问题

This commit is contained in:
zhaoxiao
2023-03-15 14:35:12 +08:00
parent 1054dee742
commit 6570916f48
11 changed files with 594 additions and 611 deletions
@@ -110,24 +110,24 @@
<#assign superQuery_dictText="${po.dictText}">
</#if>
<#if po.classType=="popup">
<#return "{type:'${po.classType}',value:'${po.fieldName}',text:'${po.filedComment}', popup:{code:'${po.dictTable}',field:'${po.dictField?split(',')[0]}',orgFields:'${po.dictField?split(',')[0]}',destFields:'${po.dictText?split(',')[0]}'}}">
<#return "{ type: '${po.classType}', value: '${po.fieldName}', text: '${po.filedComment}', popup: {code: '${po.dictTable}', field: '${po.dictField?split(',')[0]}', orgFields: '${po.dictField?split(',')[0]}', destFields: '${po.dictText?split(',')[0]}'} }">
<#elseif po.classType=="sel_user" || po.classType=="sel_depart" || po.classType=="datetime" || po.classType=="date" || po.classType=="pca" || po.classType=="switch">
<#return "{type:'${po.classType}',value:'${po.fieldName}',text:'${po.filedComment}'}">
<#return "{ type: '${po.classType}', value: '${po.fieldName}', text: '${po.filedComment}' }">
<#else>
<#if po.classType=="sel_search" || po.classType=="list_multi">
<#return "{type:'${po.classType}',value:'${po.fieldName}',text:'${po.filedComment}',dictTable:'${superQuery_dictTable}', dictText:'${superQuery_dictText}', dictCode:'${po.dictField}'}">
<#return "{ type: '${po.classType}', value: '${po.fieldName}', text: '${po.filedComment}', dictTable: '${superQuery_dictTable}', dictText: '${superQuery_dictText}', dictCode: '${po.dictField}' }">
<#elseif po.dictTable?? && po.dictTable!="" && po.classType!="sel_tree" && po.classType!="cat_tree" && po.classType!="link_down">
<#return "{type:'${po.fieldDbType}',value:'${po.fieldName}',text:'${po.filedComment}',dictCode:'${po.dictTable},${po.dictText},${po.dictField}'}">
<#return "{ type: '${po.fieldDbType}', value: '${po.fieldName}', text: '${po.filedComment}', dictCode: '${po.dictTable}, ${po.dictText}, ${po.dictField}' }">
<#elseif po.dictField?? && po.classType!="sel_tree" && po.classType!="cat_tree" && po.classType!="link_down">
<#return "{type:'${po.fieldDbType}',value:'${po.fieldName}',text:'${po.filedComment}',dictCode:'${po.dictField}'}">
<#return "{ type: '${po.fieldDbType}', value: '${po.fieldName}', text: '${po.filedComment}', dictCode: '${po.dictField}' }">
<#elseif po.fieldDbType=="Text">
<#return "{type:'string',value:'${po.fieldName}',text:'${po.filedComment}'}">
<#return "{ type: 'string', value: '${po.fieldName}', text: '${po.filedComment}' }">
<#elseif po.fieldDbType=="Blob">
<#return "{type:'byte',value:'${po.fieldName}',text:'${po.filedComment}'}">
<#return "{ type: 'byte', value: '${po.fieldName}', text: '${po.filedComment}' }">
<#elseif po.fieldDbType=="BigDecimal" || po.fieldDbType=="double">
<#return "{type:'number',value:'${po.fieldName}',text:'${po.filedComment}'}">
<#return "{ type: 'number', value: '${po.fieldName}', text: '${po.filedComment}' }">
<#else>
<#return "{type:'${po.fieldDbType}',value:'${po.fieldName}',text:'${po.filedComment}'}">
<#return "{ type: '${po.fieldDbType}', value: '${po.fieldName}', text: '${po.filedComment}' }">
</#if>
</#if>
</#function>
@@ -50,7 +50,7 @@
{ pattern: '${fieldValidType}', message: '不符合校验规则!'},
<#-- 无校验 -->
<#else>
<#t>
<#t>
</#if>
],
</#if>
@@ -1,5 +1,5 @@
validatorRules: {
<#list columns as po>
<#include "core.ftl">
</#list>
},
validatorRules: {
<#list columns as po>
<#include "core.ftl">
</#list>
},
@@ -215,125 +215,125 @@
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import ${entityName}Modal from './modules/${entityName}Modal'
<#if bpm_flag>
import { postAction } from '@/api/manage'
</#if>
<#if list_need_category>
import { loadCategoryData } from '@/api/api'
</#if>
<#if list_need_dict>
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
</#if>
<#if list_need_pca>
import Area from '@/components/_util/Area'
</#if>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import ${entityName}Modal from './modules/${entityName}Modal'
<#if bpm_flag>
import { postAction } from '@/api/manage'
</#if>
<#if list_need_category>
import { loadCategoryData } from '@/api/api'
</#if>
<#if list_need_dict>
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
</#if>
<#if list_need_pca>
import Area from '@/components/_util/Area'
</#if>
export default {
name: '${entityName}List',
mixins:[JeroListMixin, mixinDevice],
components: {
${entityName}Modal
},
data () {
return {
description: '${tableVo.ftlDescription}管理页面',
// 表头
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
<#assign showColNum=0>
<#list columns as po>
<#if po.isShowList =='Y' && po.fieldName !='id'>
<#assign showColNum=showColNum+1>
{
title:'${po.filedComment}',
align:"center",
<#if po.sort=='Y'>
sorter: true,
</#if>
<#if po.classType=='date'>
dataIndex: '${po.fieldName}',
customRender:function (text) {
return !text?"":(text.length>10?text.substr(0,10):text)
}
<#elseif po.fieldDbType=='Blob'>
dataIndex: '${po.fieldName}String'
<#elseif po.classType=='umeditor'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'htmlSlot'}
<#elseif po.classType=='pca'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'pcaSlot'}
<#elseif po.classType=='file'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'fileSlot'}
<#elseif po.classType=='image'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'imgSlot'}
<#elseif po.classType=='switch'>
dataIndex: '${po.fieldName}',
customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : ''),
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
<#if list_need_category>
dataIndex: '${po.fieldName}',
customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : '')
<#else>
dataIndex: '${po.fieldName}',
customRender: (text, record) => (text ? record['${po.dictText}'] : '')
</#if>
<#else>
dataIndex: '${po.fieldName}'
</#if>
},
</#if>
</#list>
{
title: '操作',
dataIndex: 'action',
align:"center",
<#if tableVo.extendParams.scroll=='1'>
fixed:"right",
width:147,
</#if>
scopedSlots: { customRender: 'action' }
export default {
name: '${entityName}List',
mixins: [JeroListMixin, mixinDevice],
components: {
${entityName}Modal
},
data () {
return {
description: '${tableVo.ftlDescription}管理页面',
// 表头
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
],
url: {
list: "/${entityPackage}/${entityName?uncap_first}/page",
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
<#if bpm_flag>startProcess: '/act/process/extActProcess/startMutilProcess'</#if>
},
<#if bpm_flag>
//代码生成后需手动设置流程编码
flowCode: 'dev_${tableName}_001',
<#assign showColNum=0>
<#list columns as po>
<#if po.isShowList =='Y' && po.fieldName !='id'>
<#assign showColNum=showColNum+1>
{
title: '${po.filedComment}',
align: 'center',
<#if po.sort=='Y'>
sorter: true,
</#if>
<#if po.classType=='date'>
dataIndex: '${po.fieldName}',
customRender: function (text) {
return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
}
<#elseif po.fieldDbType=='Blob'>
dataIndex: '${po.fieldName}String'
<#elseif po.classType=='umeditor'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'htmlSlot'}
<#elseif po.classType=='pca'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'pcaSlot'}
<#elseif po.classType=='file'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'fileSlot'}
<#elseif po.classType=='image'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'imgSlot'}
<#elseif po.classType=='switch'>
dataIndex: '${po.fieldName}',
customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : ''),
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
<#if list_need_category>
dataIndex: '${po.fieldName}',
customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : '')
<#else>
dataIndex: '${po.fieldName}',
customRender: (text, record) => (text ? record['${po.dictText}'] : '')
</#if>
<#else>
dataIndex: '${po.fieldName}'
</#if>
},
</#if>
dictOptions:{},
<#if list_need_pca>
pcaData:'',
</#if>
superFieldList:[],
}
},
created() {
</#list>
{
title: '操作',
dataIndex: 'action',
align: 'center',
<#if tableVo.extendParams.scroll=='1'>
fixed: 'right',
width: 147,
</#if>
scopedSlots: { customRender: 'action' }
}
],
url: {
list: '/${entityPackage}/${entityName?uncap_first}/page',
delete: '/${entityPackage}/${entityName?uncap_first}/delete',
deleteBatch: '/${entityPackage}/${entityName?uncap_first}/deleteBatch',
exportXlsUrl: '/${entityPackage}/${entityName?uncap_first}/exportXls',
importExcelUrl: '${entityPackage}/${entityName?uncap_first}/importExcel'<#if bpm_flag>,
startProcess: '/act/process/extActProcess/startMutilProcess'</#if>
},
<#if bpm_flag>
//代码生成后需手动设置流程编码
flowCode: 'dev_${tableName}_001',
</#if>
dictOptions: {},
<#if list_need_pca>
pcaData: '',
</#if>
superFieldList: []
}
},
created () {
<#if list_need_pca>
this.pcaData = new Area()
this.pcaData = new Area()
</#if>
<#if list_need_switch>
<#list columns as po>
@@ -349,74 +349,74 @@
<#assign switch_extend_arr2=a>
</#if>
</#list>
this.$set(this.dictOptions, '${po.fieldName}', [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
this.$set(this.dictOptions, '${po.fieldName}', [{ text: '是', value: '${switch_extend_arr1}' }, { text: '否', value: '${switch_extend_arr2}' }])
</#if>
</#list>
</#if>
this.getSuperFieldList();
},
computed: {
importExcelUrl: function(){
<#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
},
},
methods: {
this.getSuperFieldList()
},
computed: {
importExcelUrl: function () {
<#noparse>return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}`</#noparse>
}
},
methods: {
<#if list_need_pca>
getPcaText(code){
return this.pcaData.getText(code);
},
getPcaText (code) {
return this.pcaData.getText(code)
},
</#if>
<#if bpm_flag>
startProcess(record){
this.$confirm({
title:'提示',
content:'确认提交流程吗?',
onOk:()=>{
let params = {
flowCode: this.flowCode,
id: record.id,
formUrl: '${entityPackage}/modules/${entityName}Form',
formUrlMobile: ''
}
postAction(this.url.startProcess, params).then(res=>{
if(res.success){
this.$message.success(res.message);
this.loadData();
this.onClearSelected();
}else{
this.$message.warning(res.message);
}
}).catch((e)=>{
this.$message.warning('不识别的请求!');
})
startProcess (record) {
this.$confirm({
title:'提示',
content:'确认提交流程吗?',
onOk: () => {
let params = {
flowCode: this.flowCode,
id: record.id,
formUrl: '${entityPackage}/modules/${entityName}Form',
formUrlMobile: ''
}
})
},
postAction(this.url.startProcess, params).then(res=>{
if (res.success) {
this.$message.success(res.message)
this.loadData()
this.onClearSelected()
} else {
this.$message.warning(res.message)
}
}).catch((e)=>{
this.$message.warning('不识别的请求!')
})
}
})
},
</#if>
initDictConfig(){
initDictConfig () {
<#list columns as po>
<#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
<#if po.classType=='cat_tree' && list_need_category==true>
loadCategoryData({code:'${po.dictField?default("")}'}).then((res) => {
if (res.success) {
this.$set(this.dictOptions, '${po.fieldName}', res.result)
}
})
loadCategoryData({ code: '${po.dictField?default("")}' }).then((res) => {
if (res.success) {
this.$set(this.dictOptions, '${po.fieldName}', res.result)
}
})
</#if>
</#if>
</#list>
},
getSuperFieldList(){
<#include "/common/utils.ftl">
let fieldList=[];
<#list columns as po>
fieldList.push(${superQueryFieldList(po)})
</#list>
this.superFieldList = fieldList
}
},
getSuperFieldList () {
<#include "/common/utils.ftl">
const fieldList = []
<#list columns as po>
fieldList.push(${superQueryFieldList(po)})
</#list>
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
@import '~@assets/less/common.less';
</style>
@@ -119,148 +119,134 @@
<script>
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
import { postAction <#if bpm_flag>, getAction </#if>} from '@/api/manage'
export default {
name: '${entityName}Form',
components: {
export default {
name: '${entityName}Form',
components: {},
props: {
<#if bpm_flag>
// 流程表单data
formData: {
type: Object,
default: ()=>{},
required: false
},
props: {
<#if bpm_flag>
//流程表单data
formData: {
type: Object,
default: ()=>{},
required: false
// 表单模式:true流程表单 false普通表单
formBpm: {
type: Boolean,
default: false,
required: false
},
</#if>
// 表单禁用
disabled: {
type: Boolean,
default: false,
required: false
}
},
data () {
return {
model: {<#include "/common/init/initValue.ftl">},
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
//表单模式:true流程表单 false普通表单
formBpm: {
type: Boolean,
default: false,
required: false
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
</#if>
//表单禁用
disabled: {
type: Boolean,
default: false,
required: false
confirmLoading: false,
<#include "/common/validatorRulesTemplate/main.ftl">
url: {
add: '/${entityPackage}/${entityName?uncap_first}/add',
edit: '/${entityPackage}/${entityName?uncap_first}/edit',
queryById: '/${entityPackage}/${entityName?uncap_first}/queryById'
}
},
data () {
return {
model:{
<#include "/common/init/initValue.ftl">
},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
<#include "/common/validatorRulesTemplate/main.ftl">
url: {
add: "/${entityPackage}/${entityName?uncap_first}/add",
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
queryById: "/${entityPackage}/${entityName?uncap_first}/queryById"
}
},
computed: {
formDisabled () {
<#if bpm_flag>
if (this.formBpm === true) {
if (this.formData.disabled === false) {
return false
}
return true
}
},
computed: {
formDisabled(){
<#if bpm_flag>
if(this.formBpm===true){
if(this.formData.disabled===false){
return false
}
</#if>
return this.disabled
}<#if bpm_flag>,
showFlowSubmitButton () {
if (this.formBpm === true) {
if (this.formData.disabled === false) {
return true
}
</#if>
return this.disabled
},
<#if bpm_flag>
showFlowSubmitButton(){
if(this.formBpm===true){
if(this.formData.disabled===false){
return true
}
}
return false
}
</#if>
return false
}</#if>
},
created () {
// 备份model原始值
this.modelDefault = JSON.parse(JSON.stringify(this.model))
<#if bpm_flag>
// 如果是流程中表单,则需要加载流程表单data
this.showFlowData()
</#if>
},
methods: {
add () {
this.edit(this.modelDefault)
},
created () {
//备份model原始值
this.modelDefault = JSON.parse(JSON.stringify(this.model));
<#if bpm_flag>
//如果是流程中表单,则需要加载流程表单data
this.showFlowData();
</#if>
edit (record) {
this.model = Object.assign({}, record)
this.visible = true
},
methods: {
add () {
this.edit(this.modelDefault);
},
edit (record) {
this.model = Object.assign({}, record);
this.visible = true;
},
<#if bpm_flag>
//渲染流程表单数据
showFlowData(){
if(this.formBpm === true){
let params = {id:this.formData.dataId};
getAction(this.url.queryById,params).then((res)=>{
if(res.success){
this.edit (res.result);
}
});
}
},
</#if>
submitForm () {
const that = this;
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
<#if bpm_flag>
//渲染流程表单数据
showFlowData () {
if (this.formBpm === true) {
let params = {id:this.formData.dataId}
getAction(this.url.queryById,params).then((res) => {
if(res.success){
this.edit(res.result)
}
})
},
<#if form_popup>
popupCallback(value,row){
this.model = Object.assign(this.model, row);
},
</#if>
<#if form_cat_tree>
handleCategoryChange(value,backObj){
this.model = Object.assign(this.model, backObj);
}
</#if>
}
},
</#if>
submitForm () {
const that = this
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
let httpurl
if (!this.model.id) {
httpurl = this.url.add
} else {
httpurl = this.url.edit
}
postAction(httpurl, this.model).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
})
}
})
}<#if form_popup>,
popupCallback (value,row) {
this.model = Object.assign(this.model, row)
}</#if><#if form_cat_tree>,
handleCategoryChange (value, backObj) {
this.model = Object.assign(this.model, backObj)
}</#if>
}
}
</script>
@@ -23,48 +23,48 @@
</template>
<script>
import ${entityName}Form from './${entityName}Form'
import ${entityName}Form from './${entityName}Form'
export default {
name: '${entityName}Modal',
components: {
${entityName}Form
export default {
name: '${entityName}Modal',
components: {
${entityName}Form
},
data () {
return {
title: '',
width: ${modal_width},
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible = true
this.$nextTick(() => {
this.$refs.realForm.add()
})
},
data () {
return {
title:'',
width:${modal_width},
visible: false,
disableSubmit: false
}
edit (record) {
this.visible = true
this.$nextTick(() => {
this.$refs.realForm.edit(record)
})
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleCancel () {
this.close()
}
close () {
this.$emit('close')
this.visible = false
},
handleOk () {
this.$refs.realForm.submitForm()
},
submitCallback () {
this.$emit('ok')
this.visible = false
},
handleCancel () {
this.close()
}
}
</script>
}
</script>
@@ -26,68 +26,68 @@
<script>
import ${entityName}Form from './${entityName}Form'
import ${entityName}Form from './${entityName}Form'
export default {
name: '${entityName}Modal',
components: {
${entityName}Form
export default {
name: '${entityName}Modal',
components: {
${entityName}Form
},
data () {
return {
title: '操作',
width: ${modal_width},
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible = true
this.$nextTick(() => {
this.$refs.realForm.add()
})
},
data () {
return {
title:"操作",
width:${modal_width},
visible: false,
disableSubmit: false
}
edit (record) {
this.visible = true
this.$nextTick(() => {
this.$refs.realForm.edit(record)
})
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
});
},
close () {
this.$emit('close');
this.visible = false;
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
handleCancel () {
this.close()
}
close () {
this.$emit('close')
this.visible = false
},
submitCallback () {
this.$emit('ok')
this.visible = false
},
handleOk () {
this.$refs.realForm.submitForm()
},
handleCancel () {
this.close()
}
}
}
</script>
<style lang="less" scoped>
/** Button按钮间距 */
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
.drawer-footer{
position: absolute;
bottom: -8px;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
.drawer-footer{
position: absolute;
bottom: -8px;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>
@@ -104,66 +104,67 @@
</template>
<script>
import '@/assets/less/TableExpand.less'
import ${entityName}Modal from './modules/${entityName}Modal'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import '@/assets/less/TableExpand.less'
import ${entityName}Modal from './modules/${entityName}Modal'
import { JeroListMixin } from '@/mixins/JeroListMixin'
export default {
name: "${entityName}List",
mixins:[JeroListMixin],
components: {
${entityName}Modal
},
data () {
return {
description: '${tableVo.ftlDescription}管理页面',
// 表头
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
<#list columns as po>
export default {
name: '${entityName}List',
mixins: [JeroListMixin],
components: {
${entityName}Modal
},
data () {
return {
description: '${tableVo.ftlDescription}管理页面',
// 表头
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
<#list columns as po>
<#if po.fieldName !='id'>
{
title: '${po.filedComment}',
align:"center",
dataIndex: '${po.fieldName}'
},
{
title: '${po.filedComment}',
align: 'center',
dataIndex: '${po.fieldName}'
},
</#if>
</#list>
{
title: '操作',
dataIndex: 'action',
align:"center",
scopedSlots: { customRender: 'action' },
}
],
url: {
list: "/${entityPackage}/${entityName?uncap_first}/list",
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
exportXlsUrl: "${entityPackage}/${entityName?uncap_first}/exportXls",
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' }
}
],
url: {
list: '/${entityPackage}/${entityName?uncap_first}/list',
delete: '/${entityPackage}/${entityName?uncap_first}/delete',
deleteBatch: '/${entityPackage}/${entityName?uncap_first}/deleteBatch',
exportXlsUrl: '${entityPackage}/${entityName?uncap_first}/exportXls',
importExcelUrl: '${entityPackage}/${entityName?uncap_first}/importExcel',
},
}
},
computed: {
importExcelUrl: function(){
<#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
importExcelUrl: function () {
<#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`</#noparse>
}
},
methods: {
methods: {
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
@import '~@assets/less/common.less';
</style>
@@ -34,97 +34,92 @@
</template>
<script>
import { httpAction } from '@/api/manage'
import moment from "moment"
import { httpAction } from '@/api/manage'
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,
validatorRules:{
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,
validatorRules: {
<#list columns as po>
<#if po.fieldName !='id'>
<#if po.nullable =='N'>
${po.fieldName}:[{ required: true, message: '请输入${po.filedComment}!' }],
${po.fieldName}: [{ 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.model = Object.assign({}, record);
this.visible = true;
url: {
add: '/${entityPackage}/${entityName?uncap_first}/add',
edit: '/${entityPackage}/${entityName?uncap_first}/edit'
},
close () {
this.$emit('close');
this.visible = false;
this.$refs.form.clearValidate();
},
handleOk () {
const that = this;
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
httpAction(httpurl,this.model,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();
})
}else{
return false;
}
})
},
handleCancel () {
this.close()
},
}
},
created () {
},
methods: {
add () {
// 初始化默认值
this.edit({})
},
edit (record) {
this.model = Object.assign({}, record)
this.visible = true
},
close () {
this.$emit('close')
this.visible = false
this.$refs.form.clearValidate()
},
handleOk () {
const that = this
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
let httpurl = ''
const method = 'post'
if (!this.model.id) {
httpurl = this.url.add
} else {
httpurl = this.url.edit
}
httpAction(httpurl, this.model, 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()
})
} else {
return false
}
})
},
handleCancel () {
this.close()
},
}
}
</script>
<style lang="less" scoped>
</style>
</style>
@@ -37,95 +37,90 @@
</template>
<script>
import { httpAction } from '@/api/manage'
import moment from "moment"
import { httpAction } from '@/api/manage'
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,
validatorRules:{
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,
validatorRules: {
<#list columns as po>
<#if po.fieldName !='id'>
<#if po.nullable =='N'>
${po.fieldName}:[{ required: true, message: '请输入${po.filedComment}!' }],
${po.fieldName}: [{ 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.model = Object.assign({}, record);
this.visible = true;
url: {
add: '/${entityPackage}/${entityName?uncap_first}/add',
edit: '/${entityPackage}/${entityName?uncap_first}/edit',
},
close () {
this.$emit('close');
this.visible = false;
this.$refs.form.clearValidate();
},
handleOk () {
const that = this;
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
httpAction(httpurl,this.model,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();
})
}else{
return false;
}
})
},
handleCancel () {
this.close()
},
}
},
created () {
},
methods: {
add () {
// 初始化默认值
this.edit({})
},
edit (record) {
this.model = Object.assign({}, record)
this.visible = true
},
close () {
this.$emit('close')
this.visible = false
this.$refs.form.clearValidate()
},
handleOk () {
const that = this
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
let httpurl = ''
const method = 'post'
if (!this.model.id) {
httpurl = this.url.add
} else {
httpurl = this.url.edit
}
httpAction(httpurl, this.model, 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()
})
} else {
return false
}
})
},
handleCancel () {
this.close()
},
}
}
</script>
<style lang="less" scoped>
+6
View File
@@ -157,3 +157,9 @@ export default {
}
}
</script>
<style scoped>
.ant-calendar-picker {
min-width: 195px;
}
</style>