dialog窗口全屏切换

This commit is contained in:
fukedi 2021-09-21 23:53:23 +08:00
parent 26f0737c60
commit 1973e0a1b0
2 changed files with 1098 additions and 1064 deletions

View File

@ -1,480 +1,497 @@
<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 :visible.sync="open" :fullscreen="fullscreen" 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">
#if(($column.usableColumn) || (!$column.superColumn)) <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>
#set($parentheseIndex=$column.columnComment.indexOf("")) </i>
#if($parentheseIndex != -1) <i v-show="fullscreen" class="el-dialog__close el-icon">
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) <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>
#else </i>
#set($comment=$column.columnComment) </button>
#end </span>
#set($dictType=$column.dictType) <el-form ref="form" :model="form" :rules="rules" label-width="80px">
#if("" != $treeParentCode && $column.javaField == $treeParentCode) #foreach($column in $columns)
<el-form-item label="${comment}" prop="${treeParentCode}"> #set($field=$column.javaField)
<treeselect v-model="form.${treeParentCode}" :options="${businessName}Options" :normalizer="normalizer" placeholder="请选择${comment}" /> #if($column.insert && !$column.pk)
</el-form-item> #if(($column.usableColumn) || (!$column.superColumn))
#elseif($column.htmlType == "input") #set($parentheseIndex=$column.columnComment.indexOf(""))
<el-form-item label="${comment}" prop="${field}"> #if($parentheseIndex != -1)
<el-input v-model="form.${field}" placeholder="请输入${comment}" /> #set($comment=$column.columnComment.substring(0, $parentheseIndex))
</el-form-item> #else
#elseif($column.htmlType == "imageUpload") #set($comment=$column.columnComment)
<el-form-item label="${comment}"> #end
<imageUpload v-model="form.${field}"/> #set($dictType=$column.dictType)
</el-form-item> #if("" != $treeParentCode && $column.javaField == $treeParentCode)
#elseif($column.htmlType == "fileUpload") <el-form-item label="${comment}" prop="${treeParentCode}">
<el-form-item label="${comment}"> <treeselect v-model="form.${treeParentCode}" :options="${businessName}Options" :normalizer="normalizer" placeholder="请选择${comment}" />
<fileUpload v-model="form.${field}"/> </el-form-item>
</el-form-item> #elseif($column.htmlType == "input")
#elseif($column.htmlType == "editor") <el-form-item label="${comment}" prop="${field}">
<el-form-item label="${comment}"> <el-input v-model="form.${field}" placeholder="请输入${comment}" />
<editor v-model="form.${field}" :min-height="192"/> </el-form-item>
</el-form-item> #elseif($column.htmlType == "imageUpload")
#elseif($column.htmlType == "select" && "" != $dictType) <el-form-item label="${comment}">
<el-form-item label="${comment}" prop="${field}"> <imageUpload v-model="form.${field}"/>
<el-select v-model="form.${field}" placeholder="请选择${comment}"> </el-form-item>
<el-option #elseif($column.htmlType == "fileUpload")
v-for="dict in dict.type.${dictType}" <el-form-item label="${comment}">
:key="dict.value" <fileUpload v-model="form.${field}"/>
: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 == "editor")
<el-form-item label="${comment}">
></el-option> <editor v-model="form.${field}" :min-height="192"/>
</el-select> </el-form-item>
</el-form-item> #elseif($column.htmlType == "select" && "" != $dictType)
#elseif($column.htmlType == "select" && $dictType) <el-form-item label="${comment}" prop="${field}">
<el-form-item label="${comment}" prop="${field}"> <el-select v-model="form.${field}" placeholder="请选择${comment}">
<el-select v-model="form.${field}" placeholder="请选择${comment}"> <el-option
<el-option label="请选择字典生成" value="" /> v-for="dict in dict.type.${dictType}"
</el-select> :key="dict.value"
</el-form-item> :label="dict.label"
#elseif($column.htmlType == "checkbox" && "" != $dictType) #if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.value)"#else:value="dict.value"#end
<el-form-item label="${comment}">
<el-checkbox-group v-model="form.${field}"> ></el-option>
<el-checkbox </el-select>
v-for="dict in dict.type.${dictType}" </el-form-item>
:key="dict.value" #elseif($column.htmlType == "select" && $dictType)
:label="dict.value"> <el-form-item label="${comment}" prop="${field}">
{{dict.label}} <el-select v-model="form.${field}" placeholder="请选择${comment}">
</el-checkbox> <el-option label="请选择字典生成" value="" />
</el-checkbox-group> </el-select>
</el-form-item> </el-form-item>
#elseif($column.htmlType == "checkbox" && $dictType) #elseif($column.htmlType == "checkbox" && "" != $dictType)
<el-form-item label="${comment}"> <el-form-item label="${comment}">
<el-checkbox-group v-model="form.${field}"> <el-checkbox-group v-model="form.${field}">
<el-checkbox>请选择字典生成</el-checkbox> <el-checkbox
</el-checkbox-group> v-for="dict in dict.type.${dictType}"
</el-form-item> :key="dict.value"
#elseif($column.htmlType == "radio" && "" != $dictType) :label="dict.value">
<el-form-item label="${comment}"> {{dict.label}}
<el-radio-group v-model="form.${field}"> </el-checkbox>
<el-radio </el-checkbox-group>
v-for="dict in dict.type.${dictType}" </el-form-item>
:key="dict.value" #elseif($column.htmlType == "checkbox" && $dictType)
#if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.value)"#else:label="dict.value"#end <el-form-item label="${comment}">
<el-checkbox-group v-model="form.${field}">
>{{dict.label}}</el-radio> <el-checkbox>请选择字典生成</el-checkbox>
</el-radio-group> </el-checkbox-group>
</el-form-item> </el-form-item>
#elseif($column.htmlType == "radio" && $dictType) #elseif($column.htmlType == "radio" && "" != $dictType)
<el-form-item label="${comment}"> <el-form-item label="${comment}">
<el-radio-group v-model="form.${field}"> <el-radio-group v-model="form.${field}">
<el-radio label="1">请选择字典生成</el-radio> <el-radio
</el-radio-group> v-for="dict in dict.type.${dictType}"
</el-form-item> :key="dict.value"
#elseif($column.htmlType == "datetime") #if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.value)"#else:label="dict.value"#end
<el-form-item label="${comment}" prop="${field}">
<el-date-picker clearable size="small" >{{dict.label}}</el-radio>
v-model="form.${field}" </el-radio-group>
type="date" </el-form-item>
value-format="yyyy-MM-dd" #elseif($column.htmlType == "radio" && $dictType)
placeholder="选择${comment}"> <el-form-item label="${comment}">
</el-date-picker> <el-radio-group v-model="form.${field}">
</el-form-item> <el-radio label="1">请选择字典生成</el-radio>
#elseif($column.htmlType == "textarea") </el-radio-group>
<el-form-item label="${comment}" prop="${field}"> </el-form-item>
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" /> #elseif($column.htmlType == "datetime")
</el-form-item> <el-form-item label="${comment}" prop="${field}">
#end <el-date-picker clearable size="small"
#end v-model="form.${field}"
#end type="date"
#end value-format="yyyy-MM-dd"
</el-form> placeholder="选择${comment}">
<div slot="footer" class="dialog-footer"> </el-date-picker>
<el-button type="primary" @click="submitForm">确 定</el-button> </el-form-item>
<el-button @click="cancel">取 消</el-button> #elseif($column.htmlType == "textarea")
</div> <el-form-item label="${comment}" prop="${field}">
</el-dialog> <el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
</div> </el-form-item>
</template> #end
#end
<script> #end
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}"; #end
import Treeselect from "@riophae/vue-treeselect"; </el-form>
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
export default { <el-button @click="cancel">取 消</el-button>
name: "${BusinessName}", </div>
#if(${dicts} != '') </el-dialog>
dicts: [${dicts}], </div>
#end </template>
components: {
Treeselect <script>
}, import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}";
data() { import Treeselect from "@riophae/vue-treeselect";
return { import "@riophae/vue-treeselect/dist/vue-treeselect.css";
// 遮罩层
loading: true, export default {
// 显示搜索条件 name: "${BusinessName}",
showSearch: true, #if(${dicts} != '')
// ${functionName}表格数据 dicts: [${dicts}],
${businessName}List: [], #end
// ${functionName}树选项 components: {
${businessName}Options: [], Treeselect
// 弹出层标题 },
title: "", data() {
// 是否显示弹出层 return {
open: false, // 遮罩层
#foreach ($column in $columns) loading: true,
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") // 显示搜索条件
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) showSearch: true,
// $comment时间范围 // ${functionName}表格数据
daterange${AttrName}: [], ${businessName}List: [],
#end // ${functionName}树选项
#end ${businessName}Options: [],
// 查询参数 // 弹出层标题
queryParams: { title: "",
#foreach ($column in $columns) // 是否显示弹出层
#if($column.query) open: false,
$column.javaField: null#if($velocityCount != $columns.size()),#end #foreach ($column in $columns)
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
#end #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#end // $comment时间范围
}, daterange${AttrName}: [],
// 表单参数 #end
form: {}, #end
// 表单校验 // 查询参数
rules: { queryParams: {
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.required) #if($column.query)
#set($parentheseIndex=$column.columnComment.indexOf("")) $column.javaField: null#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: [ form: {},
{ required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end } // 表单校验
]#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))
}, #else
created() { #set($comment=$column.columnComment)
this.getList(); #end
}, $column.javaField: [
methods: { { required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end }
/** 查询${functionName}列表 */ ]#if($velocityCount != $columns.size()),#end
getList() {
this.loading = true; #end
#foreach ($column in $columns) #end
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") },
this.queryParams.params = {}; // dialog全屏
#break fullscreen: false
#end };
#end },
#foreach ($column in $columns) created() {
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") this.getList();
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) },
if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) { methods: {
this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0]; /** 查询${functionName}列表 */
this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1]; getList() {
} this.loading = true;
#end #foreach ($column in $columns)
#end #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
list${BusinessName}(this.queryParams).then(response => { this.queryParams.params = {};
this.${businessName}List = this.handleTree(response.data, "${treeCode}", "${treeParentCode}"); #break
this.loading = false; #end
}); #end
}, #foreach ($column in $columns)
/** 转换${functionName}数据结构 */ #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
normalizer(node) { #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
if (node.children && !node.children.length) { if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) {
delete node.children; this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0];
} this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1];
return { }
id: node.${treeCode}, #end
label: node.${treeName}, #end
children: node.children list${BusinessName}(this.queryParams).then(response => {
}; this.${businessName}List = this.handleTree(response.data, "${treeCode}", "${treeParentCode}");
}, this.loading = false;
/** 查询${functionName}下拉树结构 */ });
getTreeselect() { },
list${BusinessName}().then(response => { /** 转换${functionName}数据结构 */
this.${businessName}Options = []; normalizer(node) {
const data = { ${treeCode}: 0, ${treeName}: '顶级节点', children: [] }; if (node.children && !node.children.length) {
data.children = this.handleTree(response.data, "${treeCode}", "${treeParentCode}"); delete node.children;
this.${businessName}Options.push(data); }
}); return {
}, id: node.${treeCode},
// 取消按钮 label: node.${treeName},
cancel() { children: node.children
this.open = false; };
this.reset(); },
}, /** 查询${functionName}下拉树结构 */
// 表单重置 getTreeselect() {
reset() { list${BusinessName}().then(response => {
this.form = { this.${businessName}Options = [];
#foreach ($column in $columns) const data = { ${treeCode}: 0, ${treeName}: '顶级节点', children: [] };
#if($column.htmlType == "radio") data.children = this.handleTree(response.data, "${treeCode}", "${treeParentCode}");
$column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($velocityCount != $columns.size()),#end this.${businessName}Options.push(data);
});
#elseif($column.htmlType == "checkbox") },
$column.javaField: []#if($velocityCount != $columns.size()),#end // 取消按钮
cancel() {
#else this.open = false;
$column.javaField: null#if($velocityCount != $columns.size()),#end this.reset();
},
#end // 表单重置
#end reset() {
}; this.form = {
this.resetForm("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
handleQuery() {
this.getList(); #elseif($column.htmlType == "checkbox")
}, $column.javaField: []#if($velocityCount != $columns.size()),#end
/** 重置按钮操作 */
resetQuery() { #else
#foreach ($column in $columns) $column.javaField: null#if($velocityCount != $columns.size()),#end
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #end
this.daterange${AttrName} = []; #end
#end };
#end this.resetForm("form");
this.resetForm("queryForm"); },
this.handleQuery(); /** 搜索按钮操作 */
}, handleQuery() {
/** 新增按钮操作 */ this.getList();
handleAdd(row) { },
this.reset(); /** 重置按钮操作 */
this.getTreeselect(); resetQuery() {
if (row != null && row.${treeCode}) { #foreach ($column in $columns)
this.form.${treeParentCode} = row.${treeCode}; #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
} else { #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
this.form.${treeParentCode} = 0; this.daterange${AttrName} = [];
} #end
this.open = true; #end
this.title = "添加${functionName}"; this.resetForm("queryForm");
}, this.handleQuery();
/** 修改按钮操作 */ },
handleUpdate(row) { /** 新增按钮操作 */
this.reset(); handleAdd(row) {
this.getTreeselect(); this.reset();
if (row != null) { this.getTreeselect();
this.form.${treeParentCode} = row.${treeCode}; if (row != null && row.${treeCode}) {
} this.form.${treeParentCode} = row.${treeCode};
get${BusinessName}(row.${pkColumn.javaField}).then(response => { } else {
this.form = response.data; this.form.${treeParentCode} = 0;
#foreach ($column in $columns) }
#if($column.htmlType == "checkbox") this.open = true;
this.form.$column.javaField = this.form.${column.javaField}.split(","); this.title = "添加${functionName}";
#end },
#end /** 修改按钮操作 */
this.open = true; handleUpdate(row) {
this.title = "修改${functionName}"; this.reset();
}); this.getTreeselect();
}, if (row != null) {
/** 提交按钮 */ this.form.${treeParentCode} = row.${treeCode};
submitForm() { }
this.#[[$]]#refs["form"].validate(valid => { get${BusinessName}(row.${pkColumn.javaField}).then(response => {
if (valid) { this.form = response.data;
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
this.form.$column.javaField = this.form.${column.javaField}.join(","); this.form.$column.javaField = this.form.${column.javaField}.split(",");
#end #end
#end #end
if (this.form.${pkColumn.javaField} != null) { this.open = true;
update${BusinessName}(this.form).then(response => { this.title = "修改${functionName}";
this.msgSuccess("修改成功"); });
this.open = false; },
this.getList(); /** 提交按钮 */
}); submitForm() {
} else { this.#[[$]]#refs["form"].validate(valid => {
add${BusinessName}(this.form).then(response => { if (valid) {
this.msgSuccess("新增成功"); #foreach ($column in $columns)
this.open = false; #if($column.htmlType == "checkbox")
this.getList(); this.form.$column.javaField = this.form.${column.javaField}.join(",");
}); #end
} #end
} if (this.form.${pkColumn.javaField} != null) {
}); update${BusinessName}(this.form).then(response => {
}, this.msgSuccess("修改成功");
/** 删除按钮操作 */ this.open = false;
handleDelete(row) { this.getList();
this.$confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?', "警告", { });
confirmButtonText: "确定", } else {
cancelButtonText: "取消", add${BusinessName}(this.form).then(response => {
type: "warning" this.msgSuccess("新增成功");
}).then(function() { this.open = false;
return del${BusinessName}(row.${pkColumn.javaField}); this.getList();
}).then(() => { });
this.getList(); }
this.msgSuccess("删除成功"); }
}).catch(() => {}); });
} },
} /** 删除按钮操作 */
}; handleDelete(row) {
</script> this.$confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return del${BusinessName}(row.${pkColumn.javaField});
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
/** dialog全屏切换 */
toggleFullScreen() {
this.fullscreen = !this.fullscreen
}
}
};
</script>

File diff suppressed because it is too large Load Diff