Pre Merge pull request !329 from youge/master

This commit is contained in:
youge 2021-09-24 02:08:18 +00:00 committed by Gitee
commit c3e19d9a32
2 changed files with 1078 additions and 1052 deletions

View File

@ -1,476 +1,489 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
#foreach($column in $columns) #foreach($column in $columns)
#if($column.query) #if($column.query)
#set($dictType=$column.dictType) #set($dictType=$column.dictType)
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#set($parentheseIndex=$column.columnComment.indexOf("")) #set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1) #if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) #set($comment=$column.columnComment.substring(0, $parentheseIndex))
#else #else
#set($comment=$column.columnComment) #set($comment=$column.columnComment)
#end #end
#if($column.htmlType == "input") #if($column.htmlType == "input")
<el-form-item label="${comment}" prop="${column.javaField}"> <el-form-item label="${comment}" prop="${column.javaField}">
<el-input <el-input
v-model="queryParams.${column.javaField}" v-model="queryParams.${column.javaField}"
placeholder="请输入${comment}" placeholder="请输入${comment}"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType) #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType)
<el-form-item label="${comment}" prop="${column.javaField}"> <el-form-item label="${comment}" prop="${column.javaField}">
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small"> <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small">
<el-option <el-option
v-for="dict in dict.type.${dictType}" v-for="dict in dict.type.${dictType}"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType) #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType)
<el-form-item label="${comment}" prop="${column.javaField}"> <el-form-item label="${comment}" prop="${column.javaField}">
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small"> <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small">
<el-option label="请选择字典生成" value="" /> <el-option label="请选择字典生成" value="" />
</el-select> </el-select>
</el-form-item> </el-form-item>
#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN") #elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN")
<el-form-item label="${comment}" prop="${column.javaField}"> <el-form-item label="${comment}" prop="${column.javaField}">
<el-date-picker clearable size="small" <el-date-picker clearable size="small"
v-model="queryParams.${column.javaField}" v-model="queryParams.${column.javaField}"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="选择${comment}"> placeholder="选择${comment}">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
<el-form-item label="${comment}"> <el-form-item label="${comment}">
<el-date-picker <el-date-picker
v-model="daterange${AttrName}" v-model="daterange${AttrName}"
size="small" size="small"
style="width: 240px" style="width: 240px"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
type="daterange" type="daterange"
range-separator="-" range-separator="-"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
></el-date-picker> ></el-date-picker>
</el-form-item> </el-form-item>
#end #end
#end #end
#end #end
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['${moduleName}:${businessName}:add']" v-hasPermi="['${moduleName}:${businessName}:add']"
>新增</el-button> >新增</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table <el-table
v-loading="loading" v-loading="loading"
:data="${businessName}List" :data="${businessName}List"
row-key="${treeCode}" row-key="${treeCode}"
default-expand-all default-expand-all
:tree-props="{children: 'children', hasChildren: 'hasChildren'}" :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
> >
#foreach($column in $columns) #foreach($column in $columns)
#set($javaField=$column.javaField) #set($javaField=$column.javaField)
#set($parentheseIndex=$column.columnComment.indexOf("")) #set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1) #if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) #set($comment=$column.columnComment.substring(0, $parentheseIndex))
#else #else
#set($comment=$column.columnComment) #set($comment=$column.columnComment)
#end #end
#if($column.pk) #if($column.pk)
#elseif($column.list && $column.htmlType == "datetime") #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">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
#elseif($column.list && "" != $column.dictType) #elseif($column.list && "" != $column.dictType)
<el-table-column label="${comment}" align="center" prop="${javaField}"> <el-table-column label="${comment}" align="center" prop="${javaField}">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/> <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/>
</template> </template>
</el-table-column> </el-table-column>
#elseif($column.list && "" != $javaField) #elseif($column.list && "" != $javaField)
#if(${foreach.index} == 1) #if(${foreach.index} == 1)
<el-table-column label="${comment}" prop="${javaField}" /> <el-table-column label="${comment}" prop="${javaField}" />
#else #else
<el-table-column label="${comment}" align="center" prop="${javaField}" /> <el-table-column label="${comment}" align="center" prop="${javaField}" />
#end #end
#end #end
#end #end
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['${moduleName}:${businessName}:edit']" v-hasPermi="['${moduleName}:${businessName}:edit']"
>修改</el-button> >修改</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-plus" icon="el-icon-plus"
@click="handleAdd(scope.row)" @click="handleAdd(scope.row)"
v-hasPermi="['${moduleName}:${businessName}:add']" v-hasPermi="['${moduleName}:${businessName}:add']"
>新增</el-button> >新增</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['${moduleName}:${businessName}:remove']" v-hasPermi="['${moduleName}:${businessName}:remove']"
>删除</el-button> >删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 添加或修改${functionName}对话框 --> <!-- 添加或修改${functionName}对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :fullscreen="fullscreen" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <span slot="title">
#foreach($column in $columns) {{ title }}
#set($field=$column.javaField) <button style="margin-right: 25px" type="button" class="el-dialog__headerbtn" @click="toggleFullScreen">
#if($column.insert && !$column.pk) <i v-show="!fullscreen" class="el-dialog__close el-icon"><svg class="icon" width="16px" height="16.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#2c2c2c" d="M245.76 409.6H204.8V266.24A61.44 61.44 0 0 1 266.24 204.8H409.6v40.96H266.24a20.48 20.48 0 0 0-20.48 20.48zM409.6 819.2H266.24A61.44 61.44 0 0 1 204.8 757.76V614.4h40.96v143.36a20.48 20.48 0 0 0 20.48 20.48H409.6zM757.76 819.2H614.4v-40.96h143.36a20.48 20.48 0 0 0 20.48-20.48V614.4h40.96v143.36a61.44 61.44 0 0 1-61.44 61.44zM819.2 409.6h-40.96V266.24a20.48 20.48 0 0 0-20.48-20.48H614.4V204.8h143.36A61.44 61.44 0 0 1 819.2 266.24z"/></svg></i>
#if(($column.usableColumn) || (!$column.superColumn)) <i v-show="fullscreen" class="el-dialog__close el-icon"><svg class="icon" width="16px" height="16.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#2c2c2c" d="M348.16 409.6H204.8V368.64h143.36a20.48 20.48 0 0 0 20.48-20.48V204.8h40.96v143.36A61.44 61.44 0 0 1 348.16 409.6zM409.6 819.2H368.64v-143.36a20.48 20.48 0 0 0-20.48-20.48H204.8v-40.96h143.36a61.44 61.44 0 0 1 61.44 61.44zM655.36 819.2h-40.96v-143.36a61.44 61.44 0 0 1 61.44-61.44H819.2v40.96h-143.36a20.48 20.48 0 0 0-20.48 20.48zM819.2 409.6h-143.36A61.44 61.44 0 0 1 614.4 348.16V204.8h40.96v143.36a20.48 20.48 0 0 0 20.48 20.48H819.2z"/></svg></i>
#set($parentheseIndex=$column.columnComment.indexOf("")) </button>
#if($parentheseIndex != -1) </span>
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) <el-form ref="form" :model="form" :rules="rules" label-width="80px">
#else #foreach($column in $columns)
#set($comment=$column.columnComment) #set($field=$column.javaField)
#end #if($column.insert && !$column.pk)
#set($dictType=$column.dictType) #if(($column.usableColumn) || (!$column.superColumn))
#if("" != $treeParentCode && $column.javaField == $treeParentCode) #set($parentheseIndex=$column.columnComment.indexOf(""))
<el-form-item label="${comment}" prop="${treeParentCode}"> #if($parentheseIndex != -1)
<treeselect v-model="form.${treeParentCode}" :options="${businessName}Options" :normalizer="normalizer" placeholder="请选择${comment}" /> #set($comment=$column.columnComment.substring(0, $parentheseIndex))
</el-form-item> #else
#elseif($column.htmlType == "input") #set($comment=$column.columnComment)
<el-form-item label="${comment}" prop="${field}"> #end
<el-input v-model="form.${field}" placeholder="请输入${comment}" /> #set($dictType=$column.dictType)
</el-form-item> #if("" != $treeParentCode && $column.javaField == $treeParentCode)
#elseif($column.htmlType == "imageUpload") <el-form-item label="${comment}" prop="${treeParentCode}">
<el-form-item label="${comment}"> <treeselect v-model="form.${treeParentCode}" :options="${businessName}Options" :normalizer="normalizer" placeholder="请选择${comment}" />
<imageUpload v-model="form.${field}"/> </el-form-item>
</el-form-item> #elseif($column.htmlType == "input")
#elseif($column.htmlType == "fileUpload") <el-form-item label="${comment}" prop="${field}">
<el-form-item label="${comment}"> <el-input v-model="form.${field}" placeholder="请输入${comment}" />
<fileUpload v-model="form.${field}"/> </el-form-item>
</el-form-item> #elseif($column.htmlType == "imageUpload")
#elseif($column.htmlType == "editor") <el-form-item label="${comment}">
<el-form-item label="${comment}"> <imageUpload v-model="form.${field}"/>
<editor v-model="form.${field}" :min-height="192"/> </el-form-item>
</el-form-item> #elseif($column.htmlType == "fileUpload")
#elseif($column.htmlType == "select" && "" != $dictType) <el-form-item label="${comment}">
<el-form-item label="${comment}" prop="${field}"> <fileUpload v-model="form.${field}"/>
<el-select v-model="form.${field}" placeholder="请选择${comment}"> </el-form-item>
<el-option #elseif($column.htmlType == "editor")
v-for="dict in dict.type.${dictType}" <el-form-item label="${comment}">
:key="dict.value" <editor v-model="form.${field}" :min-height="192"/>
:label="dict.label" </el-form-item>
#if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.value)"#else:value="dict.value"#end #elseif($column.htmlType == "select" && "" != $dictType)
<el-form-item label="${comment}" prop="${field}">
></el-option> <el-select v-model="form.${field}" placeholder="请选择${comment}">
</el-select> <el-option
</el-form-item> v-for="dict in dict.type.${dictType}"
#elseif($column.htmlType == "select" && $dictType) :key="dict.value"
<el-form-item label="${comment}" prop="${field}"> :label="dict.label"
<el-select v-model="form.${field}" placeholder="请选择${comment}"> #if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.value)"#else:value="dict.value"#end
<el-option label="请选择字典生成" value="" />
</el-select> ></el-option>
</el-form-item> </el-select>
#elseif($column.htmlType == "checkbox" && "" != $dictType) </el-form-item>
<el-form-item label="${comment}"> #elseif($column.htmlType == "select" && $dictType)
<el-checkbox-group v-model="form.${field}"> <el-form-item label="${comment}" prop="${field}">
<el-checkbox <el-select v-model="form.${field}" placeholder="请选择${comment}">
v-for="dict in dict.type.${dictType}" <el-option label="请选择字典生成" value="" />
:key="dict.value" </el-select>
:label="dict.value"> </el-form-item>
{{dict.label}} #elseif($column.htmlType == "checkbox" && "" != $dictType)
</el-checkbox> <el-form-item label="${comment}">
</el-checkbox-group> <el-checkbox-group v-model="form.${field}">
</el-form-item> <el-checkbox
#elseif($column.htmlType == "checkbox" && $dictType) v-for="dict in dict.type.${dictType}"
<el-form-item label="${comment}"> :key="dict.value"
<el-checkbox-group v-model="form.${field}"> :label="dict.value">
<el-checkbox>请选择字典生成</el-checkbox> {{dict.label}}
</el-checkbox-group> </el-checkbox>
</el-form-item> </el-checkbox-group>
#elseif($column.htmlType == "radio" && "" != $dictType) </el-form-item>
<el-form-item label="${comment}"> #elseif($column.htmlType == "checkbox" && $dictType)
<el-radio-group v-model="form.${field}"> <el-form-item label="${comment}">
<el-radio <el-checkbox-group v-model="form.${field}">
v-for="dict in dict.type.${dictType}" <el-checkbox>请选择字典生成</el-checkbox>
:key="dict.value" </el-checkbox-group>
#if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.value)"#else:label="dict.value"#end </el-form-item>
#elseif($column.htmlType == "radio" && "" != $dictType)
>{{dict.label}}</el-radio> <el-form-item label="${comment}">
</el-radio-group> <el-radio-group v-model="form.${field}">
</el-form-item> <el-radio
#elseif($column.htmlType == "radio" && $dictType) v-for="dict in dict.type.${dictType}"
<el-form-item label="${comment}"> :key="dict.value"
<el-radio-group v-model="form.${field}"> #if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.value)"#else:label="dict.value"#end
<el-radio label="1">请选择字典生成</el-radio>
</el-radio-group> >{{dict.label}}</el-radio>
</el-form-item> </el-radio-group>
#elseif($column.htmlType == "datetime") </el-form-item>
<el-form-item label="${comment}" prop="${field}"> #elseif($column.htmlType == "radio" && $dictType)
<el-date-picker clearable size="small" <el-form-item label="${comment}">
v-model="form.${field}" <el-radio-group v-model="form.${field}">
type="date" <el-radio label="1">请选择字典生成</el-radio>
value-format="yyyy-MM-dd" </el-radio-group>
placeholder="选择${comment}"> </el-form-item>
</el-date-picker> #elseif($column.htmlType == "datetime")
</el-form-item> <el-form-item label="${comment}" prop="${field}">
#elseif($column.htmlType == "textarea") <el-date-picker clearable size="small"
<el-form-item label="${comment}" prop="${field}"> v-model="form.${field}"
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" /> type="date"
</el-form-item> value-format="yyyy-MM-dd"
#end placeholder="选择${comment}">
#end </el-date-picker>
#end </el-form-item>
#end #elseif($column.htmlType == "textarea")
</el-form> <el-form-item label="${comment}" prop="${field}">
<div slot="footer" class="dialog-footer"> <el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
<el-button type="primary" @click="submitForm">确 定</el-button> </el-form-item>
<el-button @click="cancel">取 消</el-button> #end
</div> #end
</el-dialog> #end
</div> #end
</template> </el-form>
<div slot="footer" class="dialog-footer">
<script> <el-button type="primary" @click="submitForm">确 定</el-button>
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}"; <el-button @click="cancel">取 消</el-button>
import Treeselect from "@riophae/vue-treeselect"; </div>
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; </el-dialog>
</div>
export default { </template>
name: "${BusinessName}",
#if(${dicts} != '') <script>
dicts: [${dicts}], import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}";
#end import Treeselect from "@riophae/vue-treeselect";
components: { import "@riophae/vue-treeselect/dist/vue-treeselect.css";
Treeselect
}, export default {
data() { name: "${BusinessName}",
return { #if(${dicts} != '')
// 遮罩层 dicts: [${dicts}],
loading: true, #end
// 显示搜索条件 components: {
showSearch: true, Treeselect
// ${functionName}表格数据 },
${businessName}List: [], data() {
// ${functionName}树选项 return {
${businessName}Options: [], // 遮罩层
// 弹出层标题 loading: true,
title: "", // 显示搜索条件
// 是否显示弹出层 showSearch: true,
open: false, // ${functionName}表格数据
#foreach ($column in $columns) ${businessName}List: [],
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") // ${functionName}树选项
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) ${businessName}Options: [],
// $comment时间范围 // 弹出层标题
daterange${AttrName}: [], title: "",
#end // 是否显示弹出层
#end open: false,
// 查询参数 #foreach ($column in $columns)
queryParams: { #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
#foreach ($column in $columns) #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#if($column.query) // $comment时间范围
$column.javaField: null#if($velocityCount != $columns.size()),#end daterange${AttrName}: [],
#end
#end #end
#end // 查询参数
}, queryParams: {
// 表单参数 #foreach ($column in $columns)
form: {}, #if($column.query)
// 表单校验 $column.javaField: null#if($velocityCount != $columns.size()),#end
rules: {
#foreach ($column in $columns) #end
#if($column.required) #end
#set($parentheseIndex=$column.columnComment.indexOf("")) },
#if($parentheseIndex != -1) // 表单参数
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) form: {},
#else // 表单校验
#set($comment=$column.columnComment) rules: {
#end #foreach ($column in $columns)
$column.javaField: [ #if($column.required)
{ required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end } #set($parentheseIndex=$column.columnComment.indexOf(""))
]#if($velocityCount != $columns.size()),#end #if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
#end #else
#end #set($comment=$column.columnComment)
} #end
}; $column.javaField: [
}, { required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end }
created() { ]#if($velocityCount != $columns.size()),#end
this.getList();
}, #end
methods: { #end
/** 查询${functionName}列表 */ },
getList() { // dialog全屏
this.loading = true; fullscreen: false
#foreach ($column in $columns) };
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") },
this.queryParams.params = {}; created() {
#break this.getList();
#end },
#end methods: {
#foreach ($column in $columns) /** 查询${functionName}列表 */
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") getList() {
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) this.loading = true;
if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) { #foreach ($column in $columns)
this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0]; #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1]; this.queryParams.params = {};
} #break
#end #end
#end #end
list${BusinessName}(this.queryParams).then(response => { #foreach ($column in $columns)
this.${businessName}List = this.handleTree(response.data, "${treeCode}", "${treeParentCode}"); #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
this.loading = false; #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
}); if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) {
}, this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0];
/** 转换${functionName}数据结构 */ this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1];
normalizer(node) { }
if (node.children && !node.children.length) { #end
delete node.children; #end
} list${BusinessName}(this.queryParams).then(response => {
return { this.${businessName}List = this.handleTree(response.data, "${treeCode}", "${treeParentCode}");
id: node.${treeCode}, this.loading = false;
label: node.${treeName}, });
children: node.children },
}; /** 转换${functionName}数据结构 */
}, normalizer(node) {
/** 查询${functionName}下拉树结构 */ if (node.children && !node.children.length) {
getTreeselect() { delete node.children;
list${BusinessName}().then(response => { }
this.${businessName}Options = []; return {
const data = { ${treeCode}: 0, ${treeName}: '顶级节点', children: [] }; id: node.${treeCode},
data.children = this.handleTree(response.data, "${treeCode}", "${treeParentCode}"); label: node.${treeName},
this.${businessName}Options.push(data); children: node.children
}); };
}, },
// 取消按钮 /** 查询${functionName}下拉树结构 */
cancel() { getTreeselect() {
this.open = false; list${BusinessName}().then(response => {
this.reset(); this.${businessName}Options = [];
}, const data = { ${treeCode}: 0, ${treeName}: '顶级节点', children: [] };
// 表单重置 data.children = this.handleTree(response.data, "${treeCode}", "${treeParentCode}");
reset() { this.${businessName}Options.push(data);
this.form = { });
#foreach ($column in $columns) },
#if($column.htmlType == "radio") // 取消按钮
$column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($velocityCount != $columns.size()),#end cancel() {
this.open = false;
#elseif($column.htmlType == "checkbox") this.reset();
$column.javaField: []#if($velocityCount != $columns.size()),#end },
// 表单重置
#else reset() {
$column.javaField: null#if($velocityCount != $columns.size()),#end this.form = {
#foreach ($column in $columns)
#end #if($column.htmlType == "radio")
#end $column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($velocityCount != $columns.size()),#end
};
this.resetForm("form"); #elseif($column.htmlType == "checkbox")
}, $column.javaField: []#if($velocityCount != $columns.size()),#end
/** 搜索按钮操作 */
handleQuery() { #else
this.getList(); $column.javaField: null#if($velocityCount != $columns.size()),#end
},
/** 重置按钮操作 */ #end
resetQuery() { #end
#foreach ($column in $columns) };
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") this.resetForm("form");
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) },
this.daterange${AttrName} = []; /** 搜索按钮操作 */
#end handleQuery() {
#end this.getList();
this.resetForm("queryForm"); },
this.handleQuery(); /** 重置按钮操作 */
}, resetQuery() {
/** 新增按钮操作 */ #foreach ($column in $columns)
handleAdd(row) { #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
this.reset(); #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
this.getTreeselect(); this.daterange${AttrName} = [];
if (row != null && row.${treeCode}) { #end
this.form.${treeParentCode} = row.${treeCode}; #end
} else { this.resetForm("queryForm");
this.form.${treeParentCode} = 0; this.handleQuery();
} },
this.open = true; /** 新增按钮操作 */
this.title = "添加${functionName}"; handleAdd(row) {
}, this.reset();
/** 修改按钮操作 */ this.getTreeselect();
handleUpdate(row) { if (row != null && row.${treeCode}) {
this.reset(); this.form.${treeParentCode} = row.${treeCode};
this.getTreeselect(); } else {
if (row != null) { this.form.${treeParentCode} = 0;
this.form.${treeParentCode} = row.${treeCode}; }
} this.open = true;
get${BusinessName}(row.${pkColumn.javaField}).then(response => { this.title = "添加${functionName}";
this.form = response.data; },
#foreach ($column in $columns) /** 修改按钮操作 */
#if($column.htmlType == "checkbox") handleUpdate(row) {
this.form.$column.javaField = this.form.${column.javaField}.split(","); this.reset();
#end this.getTreeselect();
#end if (row != null) {
this.open = true; this.form.${treeParentCode} = row.${treeCode};
this.title = "修改${functionName}"; }
}); get${BusinessName}(row.${pkColumn.javaField}).then(response => {
}, this.form = response.data;
/** 提交按钮 */ #foreach ($column in $columns)
submitForm() { #if($column.htmlType == "checkbox")
this.#[[$]]#refs["form"].validate(valid => { this.form.$column.javaField = this.form.${column.javaField}.split(",");
if (valid) { #end
#foreach ($column in $columns) #end
#if($column.htmlType == "checkbox") this.open = true;
this.form.$column.javaField = this.form.${column.javaField}.join(","); this.title = "修改${functionName}";
#end });
#end },
if (this.form.${pkColumn.javaField} != null) { /** 提交按钮 */
update${BusinessName}(this.form).then(response => { submitForm() {
this.#[[$modal]]#.msgSuccess("修改成功"); this.#[[$]]#refs["form"].validate(valid => {
this.open = false; if (valid) {
this.getList(); #foreach ($column in $columns)
}); #if($column.htmlType == "checkbox")
} else { this.form.$column.javaField = this.form.${column.javaField}.join(",");
add${BusinessName}(this.form).then(response => { #end
this.#[[$modal]]#.msgSuccess("新增成功"); #end
this.open = false; if (this.form.${pkColumn.javaField} != null) {
this.getList(); update${BusinessName}(this.form).then(response => {
}); this.#[[$modal]]#.msgSuccess("修改成功");
} this.open = false;
} this.getList();
}); });
}, } else {
/** 删除按钮操作 */ add${BusinessName}(this.form).then(response => {
handleDelete(row) { this.#[[$modal]]#.msgSuccess("新增成功");
this.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?').then(function() { this.open = false;
return del${BusinessName}(row.${pkColumn.javaField}); this.getList();
}).then(() => { });
this.getList(); }
this.#[[$modal]]#.msgSuccess("删除成功"); }
}).catch(() => {}); });
} },
} /** 删除按钮操作 */
}; handleDelete(row) {
</script> this.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?').then(function() {
return del${BusinessName}(row.${pkColumn.javaField});
}).then(() => {
this.getList();
this.#[[$modal]]#.msgSuccess("删除成功");
}).catch(() => {});
},
/** dialog全屏切换 */
toggleFullScreen() {
this.fullscreen = !this.fullscreen
}
}
};
</script>

File diff suppressed because it is too large Load Diff