Pre Merge pull request !75 from abbfun/N/A

This commit is contained in:
abbfun 2020-08-20 10:08:12 +08:00 committed by Gitee
commit 51e63d5514

View File

@ -95,10 +95,10 @@
v-hasPermi="['${moduleName}:${businessName}:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange">
<el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="sortChange">
<el-table-column type="selection" width="55" align="center" />
#foreach($column in $columns)
#set($javaField=$column.javaField)
@ -109,17 +109,17 @@
#set($comment=$column.columnComment)
#end
#if($column.pk)
<el-table-column label="${comment}" align="center" prop="${javaField}" />
<el-table-column label="${comment}" align="center" prop="${javaField}" #if($velocityCount == 1)sortable="custom" #end/>
#elseif($column.list && $column.htmlType == "datetime")
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180" #if($velocityCount == 1)sortable="custom" #end>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
#elseif($column.list && "" != $column.dictType)
<el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" />
<el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" #if($velocityCount == 1)sortable="custom" #end/>
#elseif($column.list && "" != $javaField)
<el-table-column label="${comment}" align="center" prop="${javaField}" />
<el-table-column label="${comment}" align="center" prop="${javaField}" #if($velocityCount == 1)sortable="custom" #end/>
#end
#end
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@ -288,12 +288,23 @@ export default {
pageNum: 1,
pageSize: 10,
#foreach ($column in $columns)
#if($velocityCount == 1)
#set($javaField=$column.javaField)
orderByColumn: '${javaField}',
isAsc: 'asc',
#end
#if($column.query)
$column.javaField: null#if($velocityCount != $columns.size()),#end
#end
#end
},
#foreach ($column in $columns)
#set($javaField=$column.javaField)
// 默认排序
defaultSort: { prop: '${javaField}', order: 'descending' },
#break
#end
// 表单参数
form: {},
// 表单校验
@ -306,8 +317,9 @@ export default {
#else
#set($comment=$column.columnComment)
#end
#set($comment=$column.columnComment)
$column.javaField: [
{ required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end }
{ required: true, message: "$comment不能为空", trigger: "#if($column.htmlType == "select")"change"#else"blur"#end" }
]#if($velocityCount != $columns.size()),#end
#end
@ -326,6 +338,21 @@ export default {
#end
},
methods: {
/** 自定义排序 */
sortChange(column, prop, order) {
var sortingType = column.order;
if (sortingType == 'ascending') {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = 'asc';
} else if (sortingType == 'descending') {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = 'desc';
} else {
this.queryParams.orderByColumn = this.defaultSort.prop;
this.queryParams.isAsc = this.defaultSort.order == 'descending'?'desc':'asc';
}
this.getList();
},
/** 查询${functionName}列表 */
getList() {
this.loading = true;
@ -467,4 +494,4 @@ export default {
}
}
};
</script>
</script>