|
|
@@ -1,778 +1,728 @@
|
|
|
<template>
|
|
|
- <div class="app-container" style="padding-top: 10px;">
|
|
|
- <div class="content-margin-query" style="">
|
|
|
- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
- #foreach($column in $columns)
|
|
|
- #if($column.query)
|
|
|
- #set($dictType=$column.dictType)
|
|
|
- #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
|
|
- #set($parentheseIndex=$column.columnComment.indexOf("("))
|
|
|
- #if($parentheseIndex != -1)
|
|
|
- #set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
|
- #else
|
|
|
- #set($comment=$column.columnComment)
|
|
|
- #end
|
|
|
- #if($column.htmlType == "input")
|
|
|
- <el-form-item label="${comment}" prop="${column.javaField}">
|
|
|
- <el-input
|
|
|
- v-model="queryParams.${column.javaField}"
|
|
|
- placeholder="请输入${comment}"
|
|
|
- clearable
|
|
|
- @keyup.enter.native="handleQuery"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType)
|
|
|
- <el-form-item label="${comment}" prop="${column.javaField}">
|
|
|
- <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable>
|
|
|
-## <el-option
|
|
|
-## v-for="dict in dict.type.${dictType}"
|
|
|
-## :key="dict.value"
|
|
|
-## :label="dict.label"
|
|
|
-## :value="dict.value"
|
|
|
-## />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType)
|
|
|
- <el-form-item label="${comment}" prop="${column.javaField}">
|
|
|
- <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable>
|
|
|
- <el-option label="请选择字典生成" value="" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN")
|
|
|
- <el-form-item label="${comment}" prop="${column.javaField}">
|
|
|
- <el-date-picker clearable
|
|
|
- v-model="queryParams.${column.javaField}"
|
|
|
+ <cacp-search-layout>
|
|
|
+ <template #search>
|
|
|
+ <cacp-search-panel-layout
|
|
|
+ :model="state.queryData"
|
|
|
+ ref="queryFormRef"
|
|
|
+ label-position="left"
|
|
|
+ label-width="auto"
|
|
|
+ :gutter="30"
|
|
|
+ :colSpan="6"
|
|
|
+ >
|
|
|
+ #foreach($column in $columns)
|
|
|
+ #if($column.query)
|
|
|
+ #set($parentheseIndex=$column.columnComment.indexOf("("))
|
|
|
+ #if($parentheseIndex != -1)
|
|
|
+ #set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
|
+ #else
|
|
|
+ #set($comment=$column.columnComment)
|
|
|
+ #end
|
|
|
+ #set($dictType=$column.dictType)
|
|
|
+ #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
|
|
+ #if($column.htmlType == "input")
|
|
|
+ <el-form-item label="${comment}" prop="${column.javaField}">
|
|
|
+ <el-input v-model="state.queryData.${column.javaField}" placeholder="请输入${comment}" clearable />
|
|
|
+ </el-form-item>
|
|
|
+ #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType)
|
|
|
+ <el-form-item label="${comment}" prop="${column.javaField}">
|
|
|
+ <el-select v-model="state.queryData.${column.javaField}" placeholder="请选择${comment}" clearable>
|
|
|
+ ## <el-option
|
|
|
+ ## v-for="dict in dict.type.${dictType}"
|
|
|
+ ## :key="dict.value"
|
|
|
+ ## :label="dict.label"
|
|
|
+ ## :value="dict.value"
|
|
|
+ ## />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ #elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN")
|
|
|
+ <el-form-item label="${comment}" prop="${column.javaField}">
|
|
|
+ <el-date-picker
|
|
|
+ clearable
|
|
|
+ v-model="state.queryData.${column.javaField}"
|
|
|
+ type="date"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ placeholder="请选择${comment}"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ #elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
|
|
+ <el-form-item label="${comment}">
|
|
|
+ <el-date-picker
|
|
|
+ type="daterange"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ v-model="state.queryData.begin${AttrName}"
|
|
|
+ placeholder="开始时间"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="到">
|
|
|
+ <el-date-picker
|
|
|
+ type="daterange"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ v-model="state.queryData.end${AttrName}"
|
|
|
+ placeholder="结束时间"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ #end
|
|
|
+ #end
|
|
|
+ #end
|
|
|
+ <template #buttonGroup>
|
|
|
+ <el-button type="primary" @click="onSearch">查询</el-button>
|
|
|
+ <el-button type="info" @click="onReset">重置</el-button>
|
|
|
+ </template>
|
|
|
+ </cacp-search-panel-layout>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <cacp-complex-table
|
|
|
+ :actions="actions"
|
|
|
+ :data="tableData"
|
|
|
+ :pagination="tablePagination"
|
|
|
+ :actionsWidth="120"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ @on-page-change="onPageChange"
|
|
|
+ @on-size-change="onSizeChange"
|
|
|
+ :loading="loading"
|
|
|
+ >
|
|
|
+ <el-table-column type="selection" width="36" fixed="left" />
|
|
|
+ #foreach($column in $columns)
|
|
|
+ #set($javaField=$column.javaField)
|
|
|
+ #set($parentheseIndex=$column.columnComment.indexOf("("))
|
|
|
+ #if($parentheseIndex != -1)
|
|
|
+ #set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
|
+ #else
|
|
|
+ #set($comment=$column.columnComment)
|
|
|
+ #end
|
|
|
+ #if($column.pk)
|
|
|
+ <el-table-column property="${javaField}" label="${comment}" width="100" :show-overflow-tooltip="true" />
|
|
|
+ #elseif($column.list && $column.htmlType == "datetime")
|
|
|
+ <el-table-column property="${javaField}" label="${comment}" width="120" sortable>
|
|
|
+ <template #default="scope">
|
|
|
+ {{ scope.row.${javaField} ? dayjs(scope.row.${javaField}).format('YYYY-MM-DD') : '' }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ #elseif($column.list && $column.htmlType == "datetime" && $column.javaField.toLowerCase().contains('time'))
|
|
|
+ <el-table-column property="${javaField}" label="${comment}" width="160" sortable>
|
|
|
+ <template #default="scope">
|
|
|
+ {{ scope.row.${javaField} ? dayjs(scope.row.${javaField}).format('YYYY-MM-DD HH:mm') : '' }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ #elseif($column.list && "" != $column.dictType)
|
|
|
+ <el-table-column property="${javaField}" label="${comment}" width="120">
|
|
|
+ <template #default="scope">
|
|
|
+ ## <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}" />
|
|
|
+ {{ scope.row.${javaField} }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ #elseif($column.list && "" != $javaField)
|
|
|
+ <el-table-column property="${javaField}" label="${comment}" width="120" :show-overflow-tooltip="true" />
|
|
|
+ #end
|
|
|
+ #end
|
|
|
+ </cacp-complex-table>
|
|
|
+ </cacp-search-layout>
|
|
|
+
|
|
|
+ <cacp-dialog
|
|
|
+ v-model="state.dialogVisible"
|
|
|
+ :resizable="false"
|
|
|
+ :title="state.title"
|
|
|
+ width="60%"
|
|
|
+ @closed="onDialogClosed"
|
|
|
+ >
|
|
|
+ <el-form
|
|
|
+ :model="state.formData"
|
|
|
+ ref="dialogFormRef"
|
|
|
+ :rules="infoRules"
|
|
|
+ label-width="auto"
|
|
|
+ label-position="left"
|
|
|
+ :disabled="!state.isEdit"
|
|
|
+ >
|
|
|
+ <el-row :gutter="20">
|
|
|
+ #set($colCount = 0)
|
|
|
+ #foreach($column in $columns)
|
|
|
+ #if($column.insert && !$column.pk)
|
|
|
+ #set($field=$column.javaField)
|
|
|
+ #set($parentheseIndex=$column.columnComment.indexOf("("))
|
|
|
+ #if($parentheseIndex != -1)
|
|
|
+ #set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
|
+ #else
|
|
|
+ #set($comment=$column.columnComment)
|
|
|
+ #end
|
|
|
+ #set($dictType=$column.dictType)
|
|
|
+ #set($colCount = $colCount + 1)
|
|
|
+ #if($colCount % 2 == 1)
|
|
|
+ <el-col :span="12">
|
|
|
+ #else
|
|
|
+ <el-col :span="12">
|
|
|
+ #end
|
|
|
+ #if($column.htmlType == "input")
|
|
|
+ <el-form-item label="${comment}" prop="${field}"#if($column.required) required#end>
|
|
|
+ <el-input v-model="state.formData.${field}" placeholder="请输入${comment}" />
|
|
|
+ </el-form-item>
|
|
|
+ #elseif($column.htmlType == "textarea")
|
|
|
+ <el-form-item label="${comment}" prop="${field}"#if($column.required) required#end>
|
|
|
+ <el-input v-model="state.formData.${field}" type="textarea" placeholder="请输入${comment}" />
|
|
|
+ </el-form-item>
|
|
|
+ #elseif($column.htmlType == "select" && "" != $dictType)
|
|
|
+ <el-form-item label="${comment}" prop="${field}"#if($column.required) required#end>
|
|
|
+ <el-select v-model="state.formData.${field}" placeholder="请选择${comment}" clearable>
|
|
|
+ ## <el-option
|
|
|
+ ## v-for="dict in dict.type.${dictType}"
|
|
|
+ ## :key="dict.value"
|
|
|
+ ## :label="dict.label"
|
|
|
+ ## :value="dict.value"
|
|
|
+ ## />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ #elseif($column.htmlType == "datetime")
|
|
|
+ <el-form-item label="${comment}" prop="${field}"#if($column.required) required#end>
|
|
|
+ <el-date-picker
|
|
|
+ v-model="state.formData.${field}"
|
|
|
type="date"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- placeholder="请选择${comment}">
|
|
|
- </el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
|
|
- <el-form-item label="${comment}">
|
|
|
- <el-date-picker
|
|
|
- v-model="daterange${AttrName}"
|
|
|
- style="width: 240px"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- type="daterange"
|
|
|
- range-separator="-"
|
|
|
- start-placeholder="开始日期"
|
|
|
- end-placeholder="结束日期"
|
|
|
- ></el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- #end
|
|
|
-#end
|
|
|
-#end
|
|
|
- <el-form-item>
|
|
|
- <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-form-item>
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ placeholder="请选择${comment}"
|
|
|
+ style="width: 100%"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ #elseif($column.htmlType == "radio" && "" != $dictType)
|
|
|
+ <el-form-item label="${comment}" prop="${field}"#if($column.required) required#end>
|
|
|
+ <el-radio-group v-model="state.formData.${field}">
|
|
|
+ ## <el-radio
|
|
|
+ ## v-for="dict in dict.type.${dictType}"
|
|
|
+ ## :key="dict.value"
|
|
|
+ ## :label="dict.value"
|
|
|
+ ## >{{ dict.label }}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ #elseif($column.htmlType == "checkbox" && "" != $dictType)
|
|
|
+ <el-form-item label="${comment}" prop="${field}"#if($column.required) required#end>
|
|
|
+ <el-checkbox-group v-model="state.formData.${field}">
|
|
|
+ ## <el-checkbox
|
|
|
+ ## v-for="dict in dict.type.${dictType}"
|
|
|
+ ## :key="dict.value"
|
|
|
+ ## :label="dict.value"
|
|
|
+ ## >{{ dict.label }}</el-checkbox>
|
|
|
+ </el-checkbox-group>
|
|
|
+ </el-form-item>
|
|
|
+ #else
|
|
|
+ <el-form-item label="${comment}" prop="${field}"#if($column.required) required#end>
|
|
|
+ <el-input v-model="state.formData.${field}" placeholder="请输入${comment}" />
|
|
|
+ </el-form-item>
|
|
|
+ #end
|
|
|
+ </el-col>
|
|
|
+ #if($colCount % 2 == 0 && $foreach.hasNext)
|
|
|
+ </el-row><el-row :gutter="20">
|
|
|
+ #end
|
|
|
+ #end
|
|
|
+ #end
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ #if($table.sub)
|
|
|
+ <el-divider content-position="center">${subTable.functionName}信息</el-divider>
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd${subClassName}">添加</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDelete${subClassName}">删除</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-table highlight-selection-row :data="state.${subclassName}List" :row-class-name="row${subClassName}Index" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}">
|
|
|
+ <el-table-column type="selection" width="50" align="center" />
|
|
|
+ <el-table-column label="序号" align="center" prop="index" width="50"/>
|
|
|
+ #foreach($column in $subTable.columns)
|
|
|
+ #set($javaField=$column.javaField)
|
|
|
+ #set($parentheseIndex=$column.columnComment.indexOf("("))
|
|
|
+ #if($parentheseIndex != -1)
|
|
|
+ #set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
|
+ #else
|
|
|
+ #set($comment=$column.columnComment)
|
|
|
+ #end
|
|
|
+ #if($column.pk || $javaField == ${subTableFkclassName})
|
|
|
+ #elseif($column.list && $column.htmlType == "input")
|
|
|
+ <el-table-column label="$comment" prop="${javaField}" width="150">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-input v-model="scope.row.$javaField" placeholder="请输入$comment" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ #elseif($column.list && $column.htmlType == "datetime")
|
|
|
+ <el-table-column label="$comment" prop="${javaField}" width="240">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-date-picker clearable v-model="scope.row.$javaField" type="date" value-format="YYYY-MM-DD" placeholder="请选择$comment" style="width: 100%" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ #elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" != $column.dictType)
|
|
|
+ <el-table-column label="$comment" prop="${javaField}" width="150">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-select v-model="scope.row.$javaField" placeholder="请选择$comment">
|
|
|
+ ## <el-option
|
|
|
+ ## v-for="dict in dict.type.$column.dictType"
|
|
|
+ ## :key="dict.value"
|
|
|
+ ## :label="dict.label"
|
|
|
+ ## :value="dict.value"
|
|
|
+ ## ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ #end
|
|
|
+ #end
|
|
|
+ </el-table>
|
|
|
+ #end
|
|
|
</el-form>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="content-margin-table">
|
|
|
- <el-row :gutter="10" class="mb8">
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- plain
|
|
|
- icon="el-icon-plus"
|
|
|
- size="mini"
|
|
|
- @click="handleAdd"
|
|
|
-## v-hasPermi="['${moduleName}:${businessName}:add']"
|
|
|
- >新增</el-button>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="success"
|
|
|
- plain
|
|
|
- icon="el-icon-edit"
|
|
|
- size="mini"
|
|
|
- :disabled="single"
|
|
|
- @click="handleUpdate"
|
|
|
-## v-hasPermi="['${moduleName}:${businessName}:edit']"
|
|
|
- >修改</el-button>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="danger"
|
|
|
- plain
|
|
|
- icon="el-icon-delete"
|
|
|
- size="mini"
|
|
|
- :disabled="multiple"
|
|
|
- @click="handleDelete"
|
|
|
-## v-hasPermi="['${moduleName}:${businessName}:remove']"
|
|
|
- >删除</el-button>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="warning"
|
|
|
- plain
|
|
|
- icon="el-icon-download"
|
|
|
- size="mini"
|
|
|
- @click="handleExport"
|
|
|
-## v-hasPermi="['${moduleName}:${businessName}:export']"
|
|
|
- >导出</el-button>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="info"
|
|
|
- plain
|
|
|
- icon="el-icon-upload2"
|
|
|
- size="mini"
|
|
|
- @click="handleImport"
|
|
|
- v-hasPermi="['bus:${businessName}:import']"
|
|
|
- >导入</el-button>
|
|
|
- </el-col>
|
|
|
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ <template #footer v-if="state.isEdit">
|
|
|
+ <el-button @click="onDialogClosed">取消</el-button>
|
|
|
+ <el-button type="primary" @click="onSubmit">确定</el-button>
|
|
|
+ </template>
|
|
|
+ </cacp-dialog>
|
|
|
+
|
|
|
+ <cacp-dialog
|
|
|
+ v-model="state.viewDialogVisible"
|
|
|
+ :resizable="false"
|
|
|
+ :title="state.viewTitle"
|
|
|
+ width="50%"
|
|
|
+ >
|
|
|
+ <el-form
|
|
|
+ :model="state.viewForm"
|
|
|
+ label-width="auto"
|
|
|
+ label-position="left"
|
|
|
+ :disabled="true"
|
|
|
+ >
|
|
|
+ <el-row :gutter="20">
|
|
|
+ #set($colCount = 0)
|
|
|
+ #foreach($column in $columns)
|
|
|
+ #if($column.insert && !$column.pk)
|
|
|
+ #set($field=$column.javaField)
|
|
|
+ #set($parentheseIndex=$column.columnComment.indexOf("("))
|
|
|
+ #if($parentheseIndex != -1)
|
|
|
+ #set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
|
+ #else
|
|
|
+ #set($comment=$column.columnComment)
|
|
|
+ #end
|
|
|
+ #set($colCount = $colCount + 1)
|
|
|
+ #if($colCount % 2 == 1)
|
|
|
+ <el-col :span="12">
|
|
|
+ #else
|
|
|
+ <el-col :span="12">
|
|
|
+ #end
|
|
|
+ <el-form-item label="${comment}:" prop="${field}">
|
|
|
+ <span>{{ state.viewForm.${field} || '-' }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ #if($colCount % 2 == 0 && $foreach.hasNext)
|
|
|
+ </el-row><el-row :gutter="20">
|
|
|
+ #end
|
|
|
+ #end
|
|
|
+ #end
|
|
|
</el-row>
|
|
|
+ </el-form>
|
|
|
+ </cacp-dialog>
|
|
|
+</template>
|
|
|
|
|
|
- <el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange">
|
|
|
- <el-table-column type="selection" width="55" align="center" />
|
|
|
-#foreach($column in $columns)
|
|
|
- #set($javaField=$column.javaField)
|
|
|
- #set($parentheseIndex=$column.columnComment.indexOf("("))
|
|
|
- #if($parentheseIndex != -1)
|
|
|
- #set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
|
- #else
|
|
|
- #set($comment=$column.columnComment)
|
|
|
- #end
|
|
|
- #if($column.pk)
|
|
|
- <el-table-column label="${comment}" align="center" prop="${javaField}" />
|
|
|
- #elseif($column.list && $column.htmlType == "datetime")
|
|
|
- <el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
|
|
|
-## <template slot-scope="scope">
|
|
|
-## <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
|
|
|
-## </template>
|
|
|
- </el-table-column>
|
|
|
- #elseif($column.list && $column.htmlType == "imageUpload")
|
|
|
- <el-table-column label="${comment}" align="center" prop="${javaField}" width="100">
|
|
|
-## <template slot-scope="scope">
|
|
|
-## <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/>
|
|
|
-## </template>
|
|
|
- </el-table-column>
|
|
|
- #elseif($column.list && "" != $column.dictType)
|
|
|
- <el-table-column label="${comment}" align="center" prop="${javaField}">
|
|
|
-## <template slot-scope="scope">
|
|
|
-## #if($column.htmlType == "checkbox")
|
|
|
-## <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
|
|
|
-## #else
|
|
|
-## <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/>
|
|
|
-## #end
|
|
|
-## </template>
|
|
|
- </el-table-column>
|
|
|
- #elseif($column.list && "" != $javaField)
|
|
|
- <el-table-column label="${comment}" align="center" prop="${javaField}" />
|
|
|
- #end
|
|
|
-#end
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150px">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-view"
|
|
|
- @click="handleView(scope.row)"
|
|
|
- ## v-hasPermi="['${moduleName}:${businessName}:edit']"
|
|
|
- >查看</el-button>
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-edit"
|
|
|
- @click="handleUpdate(scope.row)"
|
|
|
-## v-hasPermi="['${moduleName}:${businessName}:edit']"
|
|
|
- >修改</el-button>
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-delete"
|
|
|
- @click="handleDelete(scope.row)"
|
|
|
-## v-hasPermi="['${moduleName}:${businessName}:remove']"
|
|
|
- >删除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
-
|
|
|
- <pagination
|
|
|
- v-show="total>0"
|
|
|
- :total="total"
|
|
|
- :page.sync="queryParams.pageNum"
|
|
|
- :limit.sync="queryParams.pageSize"
|
|
|
- @pagination="getList"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <!-- 添加或修改${functionName}对话框 -->
|
|
|
- <el-dialog :title="title" :visible.sync="open" width="50%" append-to-body>
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
- #foreach($column in $columns)
|
|
|
- #set($field=$column.javaField)
|
|
|
-#if($column.insert && !$column.pk)
|
|
|
- #if(($column.usableColumn) || (!$column.superColumn))
|
|
|
- #set($parentheseIndex=$column.columnComment.indexOf("("))
|
|
|
- #if($parentheseIndex != -1)
|
|
|
- #set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
|
- #else
|
|
|
- #set($comment=$column.columnComment)
|
|
|
- #end
|
|
|
- #set($dictType=$column.dictType)
|
|
|
- #if($column.htmlType == "input")
|
|
|
- <el-form-item label="${comment}" prop="${field}">
|
|
|
- <el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "imageUpload")
|
|
|
- <el-form-item label="${comment}" prop="${field}">
|
|
|
- <image-upload v-model="form.${field}"/>
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "fileUpload")
|
|
|
- <el-form-item label="${comment}" prop="${field}">
|
|
|
- <file-upload v-model="form.${field}"/>
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "editor")
|
|
|
- <el-form-item label="${comment}">
|
|
|
- <editor v-model="form.${field}" :min-height="192"/>
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "select" && "" != $dictType)
|
|
|
- <el-form-item label="${comment}" prop="${field}">
|
|
|
- <el-select v-model="form.${field}" placeholder="请选择${comment}">
|
|
|
-## <el-option
|
|
|
-## v-for="dict in dict.type.${dictType}"
|
|
|
-## :key="dict.value"
|
|
|
-## :label="dict.label"
|
|
|
-## #if($column.javaType == "Integer" || $column.javaType == "Long")
|
|
|
-## :value="parseInt(dict.value)"
|
|
|
-## #else
|
|
|
-## :value="dict.value"
|
|
|
-## #end
|
|
|
-## ></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "select" && $dictType)
|
|
|
- <el-form-item label="${comment}" prop="${field}">
|
|
|
- <el-select v-model="form.${field}" placeholder="请选择${comment}">
|
|
|
- <el-option label="请选择字典生成" value="" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "checkbox" && "" != $dictType)
|
|
|
- <el-form-item label="${comment}" prop="${field}">
|
|
|
- <el-checkbox-group v-model="form.${field}">
|
|
|
-## <el-checkbox
|
|
|
-## v-for="dict in dict.type.${dictType}"
|
|
|
-## :key="dict.value"
|
|
|
-## :label="dict.value">
|
|
|
-## {{dict.label}}
|
|
|
-## </el-checkbox>
|
|
|
- </el-checkbox-group>
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "checkbox" && $dictType)
|
|
|
- <el-form-item label="${comment}" prop="${field}">
|
|
|
- <el-checkbox-group v-model="form.${field}">
|
|
|
- <el-checkbox>请选择字典生成</el-checkbox>
|
|
|
- </el-checkbox-group>
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "radio" && "" != $dictType)
|
|
|
- <el-form-item label="${comment}" prop="${field}">
|
|
|
-## <el-radio-group v-model="form.${field}">
|
|
|
-## <el-radio
|
|
|
-## v-for="dict in dict.type.${dictType}"
|
|
|
-## :key="dict.value"
|
|
|
-## #if($column.javaType == "Integer" || $column.javaType == "Long")
|
|
|
-## :label="parseInt(dict.value)"
|
|
|
-## #else
|
|
|
-## :label="dict.value"
|
|
|
-## #end
|
|
|
-## >{{dict.label}}</el-radio>
|
|
|
-## </el-radio-group>
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "radio" && $dictType)
|
|
|
- <el-form-item label="${comment}" prop="${field}">
|
|
|
- <el-radio-group v-model="form.${field}">
|
|
|
- <el-radio label="1">请选择字典生成</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "datetime")
|
|
|
- <el-form-item label="${comment}" prop="${field}">
|
|
|
- <el-date-picker clearable
|
|
|
- v-model="form.${field}"
|
|
|
- type="date"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- placeholder="请选择${comment}">
|
|
|
- </el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "textarea")
|
|
|
- <el-form-item label="${comment}" prop="${field}">
|
|
|
- <el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
|
|
- </el-form-item>
|
|
|
+<script lang="ts" setup>
|
|
|
+ import { onMounted, reactive, ref } from 'vue'
|
|
|
+ import type { FormInstance } from 'element-plus'
|
|
|
+ import { ElMessage, ElMessageBox, type FormRules } from 'element-plus'
|
|
|
+ import config from '@/config'
|
|
|
+ import {
|
|
|
+ SuccessResultCode,
|
|
|
+ useComplexTable,
|
|
|
+ type Result,
|
|
|
+ type SearchPanelLayoutInstance,
|
|
|
+ type TableAction,
|
|
|
+ useLoading
|
|
|
+ } from '@cacp/ui'
|
|
|
+ import type { ${ClassName}, ${ClassName}Query } from '@/types/${moduleName}/${businessName}'
|
|
|
+ import { insert, getList, getDetail, remove, update } from '@/apis/${moduleName}/${businessName}'
|
|
|
+ import { permissionStatus } from '@/utils/globalPermission'
|
|
|
+
|
|
|
+ // 表单引用
|
|
|
+ const queryFormRef = ref<SearchPanelLayoutInstance>()
|
|
|
+ const dialogFormRef = ref<FormInstance>()
|
|
|
+
|
|
|
+ // 加载状态
|
|
|
+ const { loading, setLoading } = useLoading()
|
|
|
+
|
|
|
+ // 表格 Hook
|
|
|
+ const tableHooks = useComplexTable<${ClassName}>(config)
|
|
|
+ const { tableData, tablePagination, setPagination, setPageIndex, setPageSizes } = tableHooks
|
|
|
+
|
|
|
+ // 响应式数据
|
|
|
+ interface State {
|
|
|
+ queryData: ${ClassName}Query
|
|
|
+ formData: ${ClassName}
|
|
|
+ viewForm: ${ClassName}
|
|
|
+ viewTitle: string
|
|
|
+ viewDialogVisible: boolean
|
|
|
+ title: string
|
|
|
+ isEdit: boolean
|
|
|
+ dialogVisible: boolean
|
|
|
+ #if($table.sub)
|
|
|
+ ${subclassName}List: any[]
|
|
|
+ checked${subClassName}: number[]
|
|
|
#end
|
|
|
- #end
|
|
|
-#end
|
|
|
- #end
|
|
|
- #if($table.sub)
|
|
|
- <el-divider content-position="center">${subTable.functionName}信息</el-divider>
|
|
|
- <el-row :gutter="10" class="mb8">
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd${subClassName}">添加</el-button>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDelete${subClassName}">删除</el-button>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-table highlight-selection-row :data="${subclassName}List" :row-class-name="row${subClassName}Index" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}">
|
|
|
- <el-table-column type="selection" width="50" align="center" />
|
|
|
- <el-table-column label="序号" align="center" prop="index" width="50"/>
|
|
|
- #foreach($column in $subTable.columns)
|
|
|
- #set($javaField=$column.javaField)
|
|
|
- #set($parentheseIndex=$column.columnComment.indexOf("("))
|
|
|
- #if($parentheseIndex != -1)
|
|
|
- #set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
|
- #else
|
|
|
- #set($comment=$column.columnComment)
|
|
|
+ }
|
|
|
+
|
|
|
+ const state = reactive<State>({
|
|
|
+ queryData: {
|
|
|
+ #foreach($column in $columns)
|
|
|
+ #if($column.query)
|
|
|
+ $column.javaField: #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")''#else''#end,
|
|
|
+ #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
|
|
+ #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
|
|
+ begin${AttrName}: '',
|
|
|
+ end${AttrName}: '',
|
|
|
+ #end
|
|
|
+ #end
|
|
|
+ #end
|
|
|
+ pageIndex: tablePagination.currentPage,
|
|
|
+ pageSize: tablePagination.pageSize
|
|
|
+ },
|
|
|
+ formData: {
|
|
|
+ #foreach($column in $columns)
|
|
|
+ $column.javaField: #if($column.htmlType == "checkbox")[]#elseif($column.javaType == 'Long' || $column.javaType == 'Integer')null#else''#end,
|
|
|
#end
|
|
|
- #if($column.pk || $javaField == ${subTableFkclassName})
|
|
|
- #elseif($column.list && $column.htmlType == "input")
|
|
|
- <el-table-column label="$comment" prop="${javaField}" width="150">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.$javaField" placeholder="请输入$comment" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- #elseif($column.list && $column.htmlType == "datetime")
|
|
|
- <el-table-column label="$comment" prop="${javaField}" width="240">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-date-picker clearable v-model="scope.row.$javaField" type="date" value-format="yyyy-MM-dd" placeholder="请选择$comment" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- #elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" != $column.dictType)
|
|
|
- <el-table-column label="$comment" prop="${javaField}" width="150">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-select v-model="scope.row.$javaField" placeholder="请选择$comment">
|
|
|
-## <el-option
|
|
|
-## v-for="dict in dict.type.$column.dictType"
|
|
|
-## :key="dict.value"
|
|
|
-## :label="dict.label"
|
|
|
-## :value="dict.value"
|
|
|
-## ></el-option>
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- #elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" == $column.dictType)
|
|
|
- <el-table-column label="$comment" prop="${javaField}" width="150">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-select v-model="scope.row.$javaField" placeholder="请选择$comment">
|
|
|
- <el-option label="请选择字典生成" value="" />
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
+ #if($table.sub)
|
|
|
+ ${subclassName}List: []
|
|
|
#end
|
|
|
- #end
|
|
|
- </el-table>
|
|
|
- #end
|
|
|
- </el-form>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
- <el-button @click="cancel">取 消</el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
- <!-- 查看的对话框 -->
|
|
|
- <el-dialog :title="viewTitle" :visible.sync="viewOpen" width="500px" append-to-body>
|
|
|
- <el-form ref="form" :model="viewForm" :rules="rules" label-width="80px">
|
|
|
- <el-row>
|
|
|
-#foreach($column in $columns)
|
|
|
- #set($field=$column.javaField)
|
|
|
- #if($column.insert && !$column.pk)
|
|
|
- #if(($column.usableColumn) || (!$column.superColumn))
|
|
|
+ } as ${ClassName},
|
|
|
+ viewForm: {} as ${ClassName},
|
|
|
+ viewTitle: '',
|
|
|
+ viewDialogVisible: false,
|
|
|
+ title: '',
|
|
|
+ isEdit: false,
|
|
|
+ dialogVisible: false,
|
|
|
+ #if($table.sub)
|
|
|
+ ${subclassName}List: [],
|
|
|
+ checked${subClassName}: []
|
|
|
+ #end
|
|
|
+ })
|
|
|
+
|
|
|
+ // 表单验证规则
|
|
|
+ const infoRules = reactive<FormRules<${ClassName}>>({
|
|
|
+ #foreach($column in $columns)
|
|
|
+ #if($column.required)
|
|
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
|
|
#if($parentheseIndex != -1)
|
|
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
|
#else
|
|
|
#set($comment=$column.columnComment)
|
|
|
#end
|
|
|
- #set($dictType=$column.dictType)
|
|
|
- <el-col :span="24">
|
|
|
- #if($column.htmlType == "input")
|
|
|
- <el-form-item label="${comment}:" prop="${field}" label-width="120px">
|
|
|
- {{viewForm.${field}}}
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "imageUpload")
|
|
|
- <el-form-item label="${comment}:" prop="${field}" label-width="120px">
|
|
|
- <image-upload v-model="viewForm.${field}"/>
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "fileUpload")
|
|
|
- <el-form-item label="${comment}:" prop="${field}" label-width="120px">
|
|
|
- <file-upload v-model="viewForm.${field}"/>
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "editor")
|
|
|
- <el-form-item label="${comment}:" label-width="120px">
|
|
|
- {{viewForm.${field}}}
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "select" && "" != $dictType)
|
|
|
- <el-form-item label="${comment}:" prop="${field}">
|
|
|
- {{viewForm.${field}}}
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "select" && $dictType)
|
|
|
- <el-form-item label="${comment}:" prop="${field}">
|
|
|
- {{viewForm.${field}}}
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "checkbox" && "" != $dictType)
|
|
|
- <el-form-item label="${comment}:" prop="${field}">
|
|
|
- <el-checkbox-group v-model="viewForm.${field}">
|
|
|
- </el-checkbox-group>
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "checkbox" && $dictType)
|
|
|
- <el-form-item label="${comment}:" prop="${field}">
|
|
|
- <el-checkbox-group v-model="viewForm.${field}">
|
|
|
- <el-checkbox>请选择字典生成</el-checkbox>
|
|
|
- </el-checkbox-group>
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "radio" && "" != $dictType)
|
|
|
- <el-form-item label="${comment}:" prop="${field}">
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "radio" && $dictType)
|
|
|
- <el-form-item label="${comment}:" prop="${field}">
|
|
|
- <el-radio-group v-model="viewForm.${field}">
|
|
|
- <el-radio label="1">请选择字典生成</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "datetime")
|
|
|
- <el-form-item label="${comment}:" prop="${field}">
|
|
|
- {{viewForm.${field}}}
|
|
|
- </el-form-item>
|
|
|
- #elseif($column.htmlType == "textarea")
|
|
|
- <el-form-item label="${comment}:" prop="${field}">
|
|
|
- {{viewForm.${field}}}
|
|
|
- </el-form-item>
|
|
|
+ ${column.javaField}: [
|
|
|
+ { required: true, message: '${comment}不能为空', trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")'change'#else'blur'#end }
|
|
|
+ ],
|
|
|
#end
|
|
|
- </el-col>
|
|
|
- #end
|
|
|
- #end
|
|
|
-#end
|
|
|
- </el-row>
|
|
|
- </el-form>
|
|
|
- </el-dialog>
|
|
|
- <!-- 导入对话框 -->
|
|
|
- <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
|
|
- <el-upload
|
|
|
- ref="upload"
|
|
|
- :limit="1"
|
|
|
- accept=".xlsx, .xls"
|
|
|
- :headers="upload.headers"
|
|
|
- :action="upload.url + '?updateSupport=' + upload.updateSupport"
|
|
|
- :disabled="upload.isUploading"
|
|
|
- :on-progress="handleFileUploadProgress"
|
|
|
- :on-success="handleFileSuccess"
|
|
|
- :auto-upload="false"
|
|
|
- drag
|
|
|
- >
|
|
|
- <i class="el-icon-upload"></i>
|
|
|
- <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
- <div class="el-upload__tip text-center" slot="tip">
|
|
|
- <div class="el-upload__tip" slot="tip">
|
|
|
- <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的数据
|
|
|
- </div>
|
|
|
- <span>仅允许导入xls、xlsx格式文件。</span>
|
|
|
- <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
|
|
|
- </div>
|
|
|
- </el-upload>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitFileForm">确 定</el-button>
|
|
|
- <el-button @click="upload.open = false">取 消</el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
- import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
|
|
- import {getToken} from "@/utils/auth";
|
|
|
- export default {
|
|
|
- name: "${BusinessName}",
|
|
|
- #if(${dicts} != '')
|
|
|
- dicts: [${dicts}],
|
|
|
#end
|
|
|
- data() {
|
|
|
- return {
|
|
|
- viewTitle:"",
|
|
|
- viewOpen:false,
|
|
|
- viewForm:{},
|
|
|
- // 遮罩层
|
|
|
- loading: true,
|
|
|
- // 选中数组
|
|
|
- ids: [],
|
|
|
- #if($table.sub)
|
|
|
- // 子表选中数据
|
|
|
- checked${subClassName}: [],
|
|
|
- #end
|
|
|
- // 非单个禁用
|
|
|
- single: true,
|
|
|
- // 非多个禁用
|
|
|
- multiple: true,
|
|
|
- // 显示搜索条件
|
|
|
- showSearch: true,
|
|
|
- // 总条数
|
|
|
- total: 0,
|
|
|
-// ${functionName}表格数据
|
|
|
- ${businessName}List: [],
|
|
|
- #if($table.sub)
|
|
|
- // ${subTable.functionName}表格数据
|
|
|
- ${subclassName}List: [],
|
|
|
- #end
|
|
|
- // 弹出层标题
|
|
|
- title: "",
|
|
|
- // 是否显示弹出层
|
|
|
- open: false,
|
|
|
- #foreach ($column in $columns)
|
|
|
- #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
|
|
- #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
|
|
- // $comment时间范围
|
|
|
- daterange${AttrName}: [],
|
|
|
- #end
|
|
|
- #end
|
|
|
- // 查询参数
|
|
|
- queryParams: {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- #foreach ($column in $columns)
|
|
|
- #if($column.query)
|
|
|
- $column.javaField: null#if($foreach.count != $columns.size()),#end
|
|
|
- #end
|
|
|
- #end
|
|
|
- },
|
|
|
- // 表单参数
|
|
|
- form: {},
|
|
|
- // 表单校验
|
|
|
- rules: {
|
|
|
- #foreach ($column in $columns)
|
|
|
- #if($column.required)
|
|
|
- #set($parentheseIndex=$column.columnComment.indexOf("("))
|
|
|
- #if($parentheseIndex != -1)
|
|
|
- #set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
|
- #else
|
|
|
- #set($comment=$column.columnComment)
|
|
|
- #end
|
|
|
- $column.javaField: [
|
|
|
- { required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end }
|
|
|
- ]#if($foreach.count != $columns.size()),#end
|
|
|
- #end
|
|
|
-#end
|
|
|
- },
|
|
|
- // ${functionName}导入参数
|
|
|
- upload: {
|
|
|
- // 是否显示弹出层(${functionName}导入)
|
|
|
- open: false,
|
|
|
- // 弹出层标题(${functionName}导入)
|
|
|
- title: "",
|
|
|
- // 是否禁用上传
|
|
|
- isUploading: false,
|
|
|
- // 是否更新已经存在的${functionName}数据
|
|
|
- updateSupport: 0,
|
|
|
- // 设置上传的请求头部
|
|
|
- headers: { Authorization: "Bearer " + getToken() },
|
|
|
- // 上传的地址
|
|
|
- url: process.env.VUE_APP_BASE_API + "/${moduleName}/${businessName}/importData"
|
|
|
- },
|
|
|
- };
|
|
|
+ })
|
|
|
+
|
|
|
+ // 表格操作按钮配置
|
|
|
+ const actions = <Array<TableAction>>[
|
|
|
+ {
|
|
|
+ key: 'create',
|
|
|
+ text: '新增',
|
|
|
+ onclick: onCreate,
|
|
|
+ limit: permissionStatus('none', '${moduleName.toUpperCase()}_${businessName.toUpperCase()}_ADD_BT'),
|
|
|
+ position: 'left',
|
|
|
+ type: 'primary',
|
|
|
},
|
|
|
- created() {
|
|
|
- this.getList();
|
|
|
+ {
|
|
|
+ key: 'view',
|
|
|
+ text: '查看',
|
|
|
+ onclick: onView,
|
|
|
+ limit: permissionStatus('one', '${moduleName.toUpperCase()}_${businessName.toUpperCase()}_VIEW_BT'),
|
|
|
+ type: 'primary'
|
|
|
},
|
|
|
- methods: {
|
|
|
- /** 查询${functionName}列表 */
|
|
|
- getList() {
|
|
|
- this.loading = true;
|
|
|
- #foreach ($column in $columns)
|
|
|
- #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
|
|
- this.queryParams.params = {};
|
|
|
- #break
|
|
|
- #end
|
|
|
- #end
|
|
|
- #foreach ($column in $columns)
|
|
|
- #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
|
|
- #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];
|
|
|
- this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1];
|
|
|
- }
|
|
|
+ {
|
|
|
+ key: 'edit',
|
|
|
+ text: '修改',
|
|
|
+ onclick: onEdit,
|
|
|
+ limit: permissionStatus('one', '${moduleName.toUpperCase()}_${businessName.toUpperCase()}_EDIT_BT'),
|
|
|
+ type: 'primary'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'delete',
|
|
|
+ text: '删除',
|
|
|
+ onclick: onDelete,
|
|
|
+ confirm: true,
|
|
|
+ limit: permissionStatus('none', '${moduleName.toUpperCase()}_${businessName.toUpperCase()}_DELETE_BT'),
|
|
|
+ type: 'primary'
|
|
|
+ },
|
|
|
+ #if($table.genTable.importTable)
|
|
|
+ {
|
|
|
+ key: 'import',
|
|
|
+ type: 'primary',
|
|
|
+ text: '导入',
|
|
|
+ onclick: onImport,
|
|
|
+ limit: permissionStatus('none', '${moduleName.toUpperCase()}_${businessName.toUpperCase()}_IMPORT_BT'),
|
|
|
+ position: 'right',
|
|
|
+ plain: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'export',
|
|
|
+ type: 'primary',
|
|
|
+ text: '导出',
|
|
|
+ onclick: onExport,
|
|
|
+ limit: permissionStatus('none', '${moduleName.toUpperCase()}_${businessName.toUpperCase()}_EXPORT_BT'),
|
|
|
+ position: 'right',
|
|
|
+ plain: true
|
|
|
+ },
|
|
|
#end
|
|
|
- #end
|
|
|
- list${BusinessName}(this.queryParams).then(response => {
|
|
|
- this.${businessName}List = response.rows;
|
|
|
- this.total = response.total;
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
- },
|
|
|
- // 取消按钮
|
|
|
- cancel() {
|
|
|
- this.open = false;
|
|
|
- this.reset();
|
|
|
- },
|
|
|
- // 表单重置
|
|
|
- reset() {
|
|
|
- this.form = {
|
|
|
-#foreach ($column in $columns)
|
|
|
-#if($column.htmlType == "checkbox")
|
|
|
- $column.javaField: []#if($foreach.count != $columns.size()),#end
|
|
|
-#else
|
|
|
- $column.javaField: null#if($foreach.count != $columns.size()),#end
|
|
|
-#end
|
|
|
-#end
|
|
|
- };
|
|
|
- #if($table.sub)
|
|
|
- this.${subclassName}List = [];
|
|
|
- #end
|
|
|
- this.resetForm("form");
|
|
|
- },
|
|
|
- /** 搜索按钮操作 */
|
|
|
- handleQuery() {
|
|
|
- this.queryParams.pageNum = 1;
|
|
|
- this.getList();
|
|
|
- },
|
|
|
- /** 重置按钮操作 */
|
|
|
- resetQuery() {
|
|
|
- #foreach ($column in $columns)
|
|
|
- #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
|
|
- #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
|
|
- this.daterange${AttrName} = [];
|
|
|
- #end
|
|
|
+ {
|
|
|
+ key: 'refresh',
|
|
|
+ type: 'primary',
|
|
|
+ text: '刷新',
|
|
|
+ onclick: onRefresh,
|
|
|
+ limit: 'none',
|
|
|
+ position: 'left',
|
|
|
+ plain: true
|
|
|
+ }
|
|
|
+ ]
|
|
|
+
|
|
|
+ // 选中项的 ID 数组
|
|
|
+ const ids = ref<string[]>([])
|
|
|
+
|
|
|
+ // 多选框选中数据
|
|
|
+ function handleSelectionChange(selection: ${ClassName}[]) {
|
|
|
+ ids.value = selection
|
|
|
+ .map(item => item.${pkColumn.javaField})
|
|
|
+ .filter((id): id is string => id != null && id !== undefined)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 搜索方法
|
|
|
+ const onSearch = () => {
|
|
|
+ setPageIndex(1)
|
|
|
+ onLoadData()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 重置方法
|
|
|
+ const onReset = () => {
|
|
|
+ queryFormRef.value?.resetFields()
|
|
|
+ #foreach($column in $columns)
|
|
|
+ #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
|
|
+ #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
|
|
+ state.queryData.begin${AttrName} = ''
|
|
|
+ state.queryData.end${AttrName} = ''
|
|
|
#end
|
|
|
- this.resetForm("queryForm");
|
|
|
- this.handleQuery();
|
|
|
- },
|
|
|
- // 多选框选中数据
|
|
|
- handleSelectionChange(selection) {
|
|
|
- this.ids = selection.map(item => item.${pkColumn.javaField})
|
|
|
- this.single = selection.length!==1
|
|
|
- this.multiple = !selection.length
|
|
|
- },
|
|
|
- /** 新增按钮操作 */
|
|
|
- handleAdd() {
|
|
|
- this.reset();
|
|
|
- this.open = true;
|
|
|
- this.title = "添加${functionName}";
|
|
|
- },
|
|
|
- /** 修改按钮操作 */
|
|
|
- handleView(row) {
|
|
|
- this.viewForm = row;
|
|
|
- this.viewOpen = true;
|
|
|
- this.viewTitle = "${functionName}详情";
|
|
|
- },
|
|
|
- /** 修改按钮操作 */
|
|
|
- handleUpdate(row) {
|
|
|
- this.reset();
|
|
|
- const ${pkColumn.javaField} = row.${pkColumn.javaField} || this.ids
|
|
|
- get${BusinessName}(${pkColumn.javaField}).then(response => {
|
|
|
- this.form = response.data;
|
|
|
- #foreach ($column in $columns)
|
|
|
- #if($column.htmlType == "checkbox")
|
|
|
- this.form.$column.javaField = this.form.${column.javaField}.split(",");
|
|
|
- #end
|
|
|
- #end
|
|
|
- #if($table.sub)
|
|
|
- this.${subclassName}List = response.data.${subclassName}List;
|
|
|
- #end
|
|
|
- this.open = true;
|
|
|
- this.title = "修改${functionName}";
|
|
|
- });
|
|
|
- },
|
|
|
- /** 提交按钮 */
|
|
|
- submitForm() {
|
|
|
- this.#[[$]]#refs["form"].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- #foreach ($column in $columns)
|
|
|
+ #end
|
|
|
+ onPageChange(1)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 每页显示条数变化
|
|
|
+ const onSizeChange = (size: number) => {
|
|
|
+ setPageSizes(size)
|
|
|
+ onLoadData()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 翻页查询
|
|
|
+ const onPageChange = (currentPage: number) => {
|
|
|
+ setPageIndex(currentPage)
|
|
|
+ onLoadData()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 弹框关闭方法
|
|
|
+ function onDialogClosed() {
|
|
|
+ state.dialogVisible = false
|
|
|
+ resetForm()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 重置表单
|
|
|
+ function resetForm() {
|
|
|
+ state.formData = {
|
|
|
+ #foreach($column in $columns)
|
|
|
+ $column.javaField: #if($column.htmlType == "checkbox")[]#elseif($column.javaType == 'Long' || $column.javaType == 'Integer')null#else''#end,
|
|
|
+ #end
|
|
|
+ #if($table.sub)
|
|
|
+ ${subclassName}List: []
|
|
|
+ #end
|
|
|
+ } as ${ClassName}
|
|
|
+ #if($table.sub)
|
|
|
+ state.${subclassName}List = []
|
|
|
+ #end
|
|
|
+ dialogFormRef.value?.resetFields()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 刷新方法
|
|
|
+ function onRefresh() {
|
|
|
+ onReset()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 新增
|
|
|
+ function onCreate() {
|
|
|
+ resetForm()
|
|
|
+ state.dialogVisible = true
|
|
|
+ state.isEdit = true
|
|
|
+ state.title = '新增${functionName}'
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查看
|
|
|
+ function onView(row: ${ClassName}) {
|
|
|
+ state.viewForm = { ...row }
|
|
|
+ state.viewDialogVisible = true
|
|
|
+ state.viewTitle = '查看${functionName}详情'
|
|
|
+ }
|
|
|
+
|
|
|
+ // 编辑
|
|
|
+ async function onEdit(row: ${ClassName}) {
|
|
|
+ const res = await getDetail(row.${pkColumn.javaField})
|
|
|
+ if (res.code === SuccessResultCode) {
|
|
|
+ state.formData = res.data
|
|
|
+ #foreach($column in $columns)
|
|
|
#if($column.htmlType == "checkbox")
|
|
|
- this.form.$column.javaField = this.form.${column.javaField}.join(",");
|
|
|
- #end
|
|
|
+ if (state.formData.${column.javaField}) {
|
|
|
+ state.formData.${column.javaField} = state.formData.${column.javaField}.split(',')
|
|
|
+ } else {
|
|
|
+ state.formData.${column.javaField} = []
|
|
|
+ }
|
|
|
#end
|
|
|
- #if($table.sub)
|
|
|
- this.form.${subclassName}List = this.${subclassName}List;
|
|
|
- #end
|
|
|
- if (this.form.${pkColumn.javaField} != null) {
|
|
|
- update${BusinessName}(this.form).then(response => {
|
|
|
- this.#[[$modal]]#.msgSuccess("修改成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- });
|
|
|
- } else {
|
|
|
- add${BusinessName}(this.form).then(response => {
|
|
|
- this.#[[$modal]]#.msgSuccess("新增成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- /** 删除按钮操作 */
|
|
|
- handleDelete(row) {
|
|
|
- const ${pkColumn.javaField}s = row.${pkColumn.javaField} || this.ids;
|
|
|
- this.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?').then(function() {
|
|
|
- return del${BusinessName}(${pkColumn.javaField}s);
|
|
|
- }).then(() => {
|
|
|
- this.getList();
|
|
|
- this.#[[$modal]]#.msgSuccess("删除成功");
|
|
|
- }).catch(() => {});
|
|
|
- },
|
|
|
- #if($table.sub)
|
|
|
- /** ${subTable.functionName}序号 */
|
|
|
- row${subClassName}Index({ row, rowIndex }) {
|
|
|
- row.index = rowIndex + 1;
|
|
|
- },
|
|
|
- /** ${subTable.functionName}添加按钮操作 */
|
|
|
- handleAdd${subClassName}() {
|
|
|
- let obj = {};
|
|
|
- #foreach($column in $subTable.columns)
|
|
|
- #if($column.pk || $column.javaField == ${subTableFkclassName})
|
|
|
- #elseif($column.list && "" != $javaField)
|
|
|
- obj.$column.javaField = "";
|
|
|
- #end
|
|
|
- #end
|
|
|
- this.${subclassName}List.push(obj);
|
|
|
- },
|
|
|
- /** ${subTable.functionName}删除按钮操作 */
|
|
|
- handleDelete${subClassName}() {
|
|
|
- if (this.checked${subClassName}.length == 0) {
|
|
|
- this.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据");
|
|
|
+ #end
|
|
|
+ #if($table.sub)
|
|
|
+ state.${subclassName}List = res.data.${subclassName}List || []
|
|
|
+ #end
|
|
|
+ state.dialogVisible = true
|
|
|
+ state.isEdit = true
|
|
|
+ state.title = '修改${functionName}'
|
|
|
} else {
|
|
|
- const ${subclassName}List = this.${subclassName}List;
|
|
|
- const checked${subClassName} = this.checked${subClassName};
|
|
|
- this.${subclassName}List = ${subclassName}List.filter(function(item) {
|
|
|
- return checked${subClassName}.indexOf(item.index) == -1
|
|
|
- });
|
|
|
+ ElMessage.error(res.message || '数据获取异常')
|
|
|
}
|
|
|
- },
|
|
|
- /** 复选框选中数据 */
|
|
|
- handle${subClassName}SelectionChange(selection) {
|
|
|
- this.checked${subClassName} = selection.map(item => item.index)
|
|
|
- },
|
|
|
- #end
|
|
|
- /** 导出按钮操作 */
|
|
|
- handleExport() {
|
|
|
- this.download('${moduleName}/${businessName}/export', {
|
|
|
- ...this.queryParams
|
|
|
- }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
|
|
|
- },
|
|
|
- /** 导入按钮操作 */
|
|
|
- handleImport() {
|
|
|
- this.upload.title = "企业分类信息导入";
|
|
|
- this.upload.open = true;
|
|
|
- },
|
|
|
- /** 下载模板操作 */
|
|
|
- importTemplate() {
|
|
|
- this.download('${moduleName}/${businessName}/importTemplate', {
|
|
|
- }, `${businessName}_template.xlsx`)
|
|
|
- },
|
|
|
- // 文件上传中处理
|
|
|
- handleFileUploadProgress(event, file, fileList) {
|
|
|
- this.upload.isUploading = true;
|
|
|
- },
|
|
|
- // 文件上传成功处理
|
|
|
- handleFileSuccess(response, file, fileList) {
|
|
|
- this.upload.open = false;
|
|
|
- this.upload.isUploading = false;
|
|
|
- this.$refs.upload.clearFiles();
|
|
|
- this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
|
|
|
- this.getList();
|
|
|
- },
|
|
|
- // 提交上传文件
|
|
|
- submitFileForm() {
|
|
|
- this.$refs.upload.submit();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 删除
|
|
|
+ async function onDelete(row: ${ClassName}) {
|
|
|
+ const deleteIds = row.${pkColumn.javaField} || ids.value
|
|
|
+ if (!deleteIds || deleteIds.length === 0) {
|
|
|
+ ElMessage.warning('请选择要删除的数据')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ await ElMessageBox.confirm('确定要删除选中的${functionName}吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+
|
|
|
+ const res = await remove(deleteIds)
|
|
|
+ if (res.code === SuccessResultCode) {
|
|
|
+ ElMessage.success('删除成功')
|
|
|
+ onPageChange(1)
|
|
|
+ } else {
|
|
|
+ ElMessage.error(res.message || '删除失败')
|
|
|
}
|
|
|
+ } catch{
|
|
|
+ // 用户取消删除
|
|
|
+ }
|
|
|
}
|
|
|
- };
|
|
|
+
|
|
|
+ #if($table.genTable.importTable)
|
|
|
+ // 导入
|
|
|
+ function onImport() {
|
|
|
+ // TODO: 实现导入功能
|
|
|
+ ElMessage.info('导入功能待实现')
|
|
|
+ }
|
|
|
+
|
|
|
+ // 导出
|
|
|
+ function onExport() {
|
|
|
+ // TODO: 实现导出功能
|
|
|
+ ElMessage.info('导出功能待实现')
|
|
|
+ }
|
|
|
+ #end
|
|
|
+
|
|
|
+ // 新增/修改提交
|
|
|
+ async function onSubmit() {
|
|
|
+ if (!dialogFormRef.value) return
|
|
|
+
|
|
|
+ const isValid = await dialogFormRef.value.validate()
|
|
|
+ if (!isValid) return
|
|
|
+
|
|
|
+ try {
|
|
|
+ #foreach($column in $columns)
|
|
|
+ #if($column.htmlType == "checkbox")
|
|
|
+ if (Array.isArray(state.formData.${column.javaField})) {
|
|
|
+ state.formData.${column.javaField} = state.formData.${column.javaField}.join(',')
|
|
|
+ }
|
|
|
+ #end
|
|
|
+ #end
|
|
|
+
|
|
|
+ #if($table.sub)
|
|
|
+ state.formData.${subclassName}List = state.${subclassName}List
|
|
|
+ #end
|
|
|
+
|
|
|
+ let res: Result<any>
|
|
|
+ if (state.formData.${pkColumn.javaField}) {
|
|
|
+ res = await update(state.formData)
|
|
|
+ } else {
|
|
|
+ res = await insert(state.formData)
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.code === SuccessResultCode) {
|
|
|
+ ElMessage.success(state.formData.${pkColumn.javaField} ? '修改成功' : '新增成功')
|
|
|
+ state.dialogVisible = false
|
|
|
+ onPageChange(1)
|
|
|
+ } else {
|
|
|
+ ElMessage.error(res.message || '操作失败')
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('提交失败:', error)
|
|
|
+ ElMessage.error('操作失败')
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 数据查询
|
|
|
+ async function onLoadData() {
|
|
|
+ setLoading(true)
|
|
|
+ try {
|
|
|
+ const query = {
|
|
|
+ ...state.queryData,
|
|
|
+ pageIndex: tablePagination.currentPage,
|
|
|
+ pageSize: tablePagination.pageSize
|
|
|
+ }
|
|
|
+ const res = await getList(query)
|
|
|
+ if (res.code === SuccessResultCode) {
|
|
|
+ setPagination(res.data)
|
|
|
+ } else {
|
|
|
+ ElMessage.error(res.message || '查询失败')
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('查询失败:', error)
|
|
|
+ ElMessage.error('查询失败')
|
|
|
+ } finally {
|
|
|
+ setLoading(false)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #if($table.sub)
|
|
|
+ // 子表相关方法
|
|
|
+ function row${subClassName}Index({ row, rowIndex }: any) {
|
|
|
+ row.index = rowIndex + 1
|
|
|
+ }
|
|
|
+
|
|
|
+ function handleAdd${subClassName}() {
|
|
|
+ const obj: any = {}
|
|
|
+ #foreach($column in $subTable.columns)
|
|
|
+ #if(!$column.pk && $column.javaField != ${subTableFkclassName})
|
|
|
+ obj.${column.javaField} = ''
|
|
|
+ #end
|
|
|
+ #end
|
|
|
+ state.${subclassName}List.push(obj)
|
|
|
+ }
|
|
|
+
|
|
|
+ function handleDelete${subClassName}() {
|
|
|
+ if (state.checked${subClassName}.length === 0) {
|
|
|
+ ElMessage.warning('请先选择要删除的数据')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ state.${subclassName}List = state.${subclassName}List.filter(item =>
|
|
|
+ !state.checked${subClassName}.includes(item.index)
|
|
|
+ )
|
|
|
+ state.checked${subClassName} = []
|
|
|
+ }
|
|
|
+
|
|
|
+ function handle${subClassName}SelectionChange(selection: any[]) {
|
|
|
+ state.checked${subClassName} = selection.map(item => item.index)
|
|
|
+ }
|
|
|
+ #end
|
|
|
+
|
|
|
+ // 组件挂载时加载数据
|
|
|
+ onMounted(() => {
|
|
|
+ onLoadData()
|
|
|
+ })
|
|
|
</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+ /* 自定义样式 */
|
|
|
+</style>
|