|
@@ -1,8 +1,8 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="p-2">
|
|
<div class="p-2">
|
|
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
|
|
- <div class="search" v-show="showSearch">
|
|
|
|
|
- <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px" class="-mb-15px">
|
|
|
|
|
|
|
+ <div v-show="showSearch" class="search">
|
|
|
|
|
+ <el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="68px" class="-mb-15px">
|
|
|
#foreach($column in $columns)
|
|
#foreach($column in $columns)
|
|
|
#if($column.query)
|
|
#if($column.query)
|
|
|
#set($dictType=$column.dictType)
|
|
#set($dictType=$column.dictType)
|
|
@@ -20,12 +20,7 @@
|
|
|
#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>
|
|
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable>
|
|
|
- <el-option
|
|
|
|
|
- v-for="dict in ${dictType}"
|
|
|
|
|
- :key="dict.value"
|
|
|
|
|
- :label="dict.label"
|
|
|
|
|
- :value="dict.value"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <el-option v-for="dict in ${dictType}" :key="dict.value" :label="dict.label" :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)
|
|
@@ -70,16 +65,16 @@
|
|
|
<template #header>
|
|
<template #header>
|
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-row :gutter="10" class="mb8">
|
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
|
- <el-button type="primary" plain icon="Plus" @click="openForm('create')" v-hasPermi="['${moduleName}:${businessName}:add']">新增</el-button>
|
|
|
|
|
|
|
+ <el-button v-hasPermi="['${moduleName}:${businessName}:add']" type="primary" plain icon="Plus" @click="openForm('create')">新增</el-button>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
|
|
- <el-button type="success" plain icon="Edit" :disabled="single" @click="openForm('update')" v-hasPermi="['system:post:edit']">修改</el-button>
|
|
|
|
|
- </el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
|
- <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['${moduleName}:${businessName}:remove']">删除</el-button>
|
|
|
|
|
|
|
+ <el-button v-hasPermi="['system:post:edit']" type="success" plain icon="Edit" :disabled="single" @click="openForm('update')">修改</el-button>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
|
- <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['${moduleName}:${businessName}:export']">导出</el-button>
|
|
|
|
|
|
|
+ <el-button v-hasPermi="['${moduleName}:${businessName}:remove']" type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()">删除</el-button>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="1.5">
|
|
|
|
|
+ <el-button v-hasPermi="['${moduleName}:${businessName}:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<right-toolbar v-model:showSearch="showSearch" :columns="columns" @queryTable="getList"></right-toolbar>
|
|
<right-toolbar v-model:showSearch="showSearch" :columns="columns" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
</el-row>
|
|
@@ -87,6 +82,7 @@
|
|
|
|
|
|
|
|
<el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange">
|
|
<el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange">
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
|
|
+#set($aIndex = 0)
|
|
|
#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("("))
|
|
@@ -96,21 +92,23 @@
|
|
|
#set($comment=$column.columnComment)
|
|
#set($comment=$column.columnComment)
|
|
|
#end
|
|
#end
|
|
|
#if($column.pk)
|
|
#if($column.pk)
|
|
|
- <el-table-column label="${comment}" align="center" prop="${javaField}" v-if="${column.list}" />
|
|
|
|
|
|
|
+ <el-table-column v-if="${column.list}" label="${comment}" align="center" prop="${javaField}" />
|
|
|
#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 v-if="columns[$aIndex].visible" label="${comment}" align="center" prop="${javaField}" width="180">
|
|
|
<template #default="scope">
|
|
<template #default="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>
|
|
|
|
|
+ #set($aIndex = $aIndex + 1)
|
|
|
#elseif($column.list && $column.htmlType == "imageUpload")
|
|
#elseif($column.list && $column.htmlType == "imageUpload")
|
|
|
- <el-table-column label="${comment}" align="center" prop="${javaField}" width="100">
|
|
|
|
|
|
|
+ <el-table-column v-if="columns[$aIndex].visible" label="${comment}" align="center" prop="${javaField}" width="100">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<image-preview :src="scope.row.${javaField}" :width="50" :height="50"/>
|
|
<image-preview :src="scope.row.${javaField}" :width="50" :height="50"/>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
+ #set($aIndex = $aIndex + 1)
|
|
|
#elseif($column.list && $column.dictType && "" != $column.dictType)
|
|
#elseif($column.list && $column.dictType && "" != $column.dictType)
|
|
|
- <el-table-column label="${comment}" align="center" prop="${javaField}">
|
|
|
|
|
|
|
+ <el-table-column v-if="columns[$aIndex].visible" label="${comment}" align="center" prop="${javaField}">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
#if($column.htmlType == "checkbox")
|
|
#if($column.htmlType == "checkbox")
|
|
|
<dict-tag :options="${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
|
|
<dict-tag :options="${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
|
|
@@ -119,39 +117,35 @@
|
|
|
#end
|
|
#end
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
+ #set($aIndex = $aIndex + 1)
|
|
|
#elseif($column.list && "" != $javaField)
|
|
#elseif($column.list && "" != $javaField)
|
|
|
- <el-table-column label="${comment}" align="center" prop="${javaField}" />
|
|
|
|
|
|
|
+ <el-table-column v-if="columns[$aIndex].visible" label="${comment}" align="center" prop="${javaField}" />
|
|
|
|
|
+ #set($aIndex = $aIndex + 1)
|
|
|
#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 #default="scope">
|
|
<template #default="scope">
|
|
|
<el-tooltip content="修改" placement="top">
|
|
<el-tooltip content="修改" placement="top">
|
|
|
- <el-button link type="primary" icon="Edit" @click="openForm('update',scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']"></el-button>
|
|
|
|
|
|
|
+ <el-button v-hasPermi="['${moduleName}:${businessName}:edit']" link type="primary" icon="Edit" @click="openForm('update',scope.row)"></el-button>
|
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
|
<el-tooltip content="删除" placement="top">
|
|
<el-tooltip content="删除" placement="top">
|
|
|
- <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${moduleName}:${businessName}:remove']"></el-button>
|
|
|
|
|
|
|
+ <el-button v-hasPermi="['${moduleName}:${businessName}:remove']" link type="primary" icon="Delete" @click="handleDelete(scope.row)"></el-button>
|
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
|
- <!-- 翻页组件 -->
|
|
|
|
|
- <pagination
|
|
|
|
|
- v-show="total>0"
|
|
|
|
|
- :total="total"
|
|
|
|
|
- v-model:page="queryParams.pageNum"
|
|
|
|
|
- v-model:limit="queryParams.pageSize"
|
|
|
|
|
- @pagination="getList"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <!-- 翻页组件 -->
|
|
|
|
|
+ <pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" :total="total" @pagination="getList" />
|
|
|
</el-card>
|
|
</el-card>
|
|
|
<!-- 添加或修改${functionName}对话框 -->
|
|
<!-- 添加或修改${functionName}对话框 -->
|
|
|
- <detail-form ref="detailFormRef" @success="getList" apped-to-body/>
|
|
|
|
|
|
|
+ <detail-form ref="detailFormRef" apped-to-body @success="getList" />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup name="${BusinessName}" lang="ts">
|
|
<script setup name="${BusinessName}" lang="ts">
|
|
|
/** 模块导入 */
|
|
/** 模块导入 */
|
|
|
-import { list${BusinessName}, del${BusinessName}} from '@/api/${moduleName}/${businessName}';
|
|
|
|
|
-import { ${BusinessName}VO} from '@/api/${moduleName}/${businessName}/types';
|
|
|
|
|
|
|
+import { list${BusinessName}, del${BusinessName} } from '@/api/${moduleName}/${businessName}';
|
|
|
|
|
+import { ${BusinessName}VO } from '@/api/${moduleName}/${businessName}/types';
|
|
|
import DetailForm from './DetailForm.vue';
|
|
import DetailForm from './DetailForm.vue';
|
|
|
|
|
|
|
|
defineOptions({ name: '${BusinessName}' })
|
|
defineOptions({ name: '${BusinessName}' })
|
|
@@ -197,7 +191,7 @@ const columns = ref<FieldOption[]>([
|
|
|
#set($comment=$column.columnComment)
|
|
#set($comment=$column.columnComment)
|
|
|
#end
|
|
#end
|
|
|
##数组下标$foreach.index
|
|
##数组下标$foreach.index
|
|
|
- { key: $arrayIndex, label: `$comment`, visible: true, children: [] },
|
|
|
|
|
|
|
+ { key: $arrayIndex, label: `$comment`, visible: true, children: [] },
|
|
|
#set($arrayIndex = $arrayIndex + 1)
|
|
#set($arrayIndex = $arrayIndex + 1)
|
|
|
#end
|
|
#end
|
|
|
#end
|
|
#end
|
|
@@ -205,23 +199,23 @@ const columns = ref<FieldOption[]>([
|
|
|
|
|
|
|
|
// 查询参数
|
|
// 查询参数
|
|
|
const queryParams = reactive({
|
|
const queryParams = reactive({
|
|
|
- pageNum: 1,
|
|
|
|
|
- pageSize: 10,
|
|
|
|
|
|
|
+ pageNum: 1,
|
|
|
|
|
+ pageSize: 10,
|
|
|
#foreach ($column in $columns)
|
|
#foreach ($column in $columns)
|
|
|
#if($column.query)
|
|
#if($column.query)
|
|
|
#if($column.htmlType == "checkbox")
|
|
#if($column.htmlType == "checkbox")
|
|
|
- $column.javaField: []#if($foreach.count != $columns.size()),#end
|
|
|
|
|
|
|
+ $column.javaField: []#if($foreach.count != $columns.size()),#end
|
|
|
#elseif($column.javaType == "String")
|
|
#elseif($column.javaType == "String")
|
|
|
- $column.javaField: ''#if($foreach.count != $columns.size()),#end
|
|
|
|
|
|
|
+ $column.javaField: ''#if($foreach.count != $columns.size()),#end
|
|
|
#elseif($column.javaType == "Integer" || $column.javaType == "Long")
|
|
#elseif($column.javaType == "Integer" || $column.javaType == "Long")
|
|
|
- $column.javaField: 0#if($foreach.count != $columns.size()),#end
|
|
|
|
|
|
|
+ $column.javaField: 0#if($foreach.count != $columns.size()),#end
|
|
|
#else
|
|
#else
|
|
|
- $column.javaField: undefined#if($foreach.count != $columns.size()),#end
|
|
|
|
|
|
|
+ $column.javaField: undefined#if($foreach.count != $columns.size()),#end
|
|
|
#end
|
|
#end
|
|
|
#end
|
|
#end
|
|
|
#end
|
|
#end
|
|
|
- params: {}
|
|
|
|
|
-})
|
|
|
|
|
|
|
+ params: {}
|
|
|
|
|
+});
|
|
|
|
|
|
|
|
/** 查询${functionName}列表 */
|
|
/** 查询${functionName}列表 */
|
|
|
const getList = async () => {
|
|
const getList = async () => {
|
|
@@ -242,14 +236,14 @@ const getList = async () => {
|
|
|
${businessName}List.value = res.rows;
|
|
${businessName}List.value = res.rows;
|
|
|
total.value = res.total;
|
|
total.value = res.total;
|
|
|
loading.value = false;
|
|
loading.value = false;
|
|
|
-}
|
|
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 搜索按钮操作 */
|
|
/** 搜索按钮操作 */
|
|
|
const handleQuery = () => {
|
|
const handleQuery = () => {
|
|
|
queryParams.pageNum = 1;
|
|
queryParams.pageNum = 1;
|
|
|
getList();
|
|
getList();
|
|
|
-}
|
|
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
/** 重置按钮操作 */
|
|
|
const resetQuery = () => {
|
|
const resetQuery = () => {
|
|
@@ -261,14 +255,14 @@ const resetQuery = () => {
|
|
|
#end
|
|
#end
|
|
|
queryFormRef.value?.resetFields();
|
|
queryFormRef.value?.resetFields();
|
|
|
handleQuery();
|
|
handleQuery();
|
|
|
-}
|
|
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
/** 多选框选中数据 */
|
|
/** 多选框选中数据 */
|
|
|
const handleSelectionChange = (selection: ${BusinessName}VO[]) => {
|
|
const handleSelectionChange = (selection: ${BusinessName}VO[]) => {
|
|
|
- ids.value = selection.map(item => item.${pkColumn.javaField});
|
|
|
|
|
|
|
+ ids.value = selection.map((item) => item.${pkColumn.javaField});
|
|
|
single.value = selection.length != 1;
|
|
single.value = selection.length != 1;
|
|
|
multiple.value = !selection.length;
|
|
multiple.value = !selection.length;
|
|
|
-}
|
|
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
/** 删除按钮操作 */
|
|
/** 删除按钮操作 */
|
|
|
const handleDelete = async (row?: ${BusinessName}VO) => {
|
|
const handleDelete = async (row?: ${BusinessName}VO) => {
|
|
@@ -276,21 +270,24 @@ const handleDelete = async (row?: ${BusinessName}VO) => {
|
|
|
await proxy?.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + _${pkColumn.javaField}s + '"的数据项?').finally(() => loading.value = false);
|
|
await proxy?.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + _${pkColumn.javaField}s + '"的数据项?').finally(() => loading.value = false);
|
|
|
await del${BusinessName}(_${pkColumn.javaField}s);
|
|
await del${BusinessName}(_${pkColumn.javaField}s);
|
|
|
await getList();
|
|
await getList();
|
|
|
- proxy?.#[[$modal]]#.msgSuccess("删除成功");
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ proxy?.#[[$modal]]#.msgSuccess('删除成功');
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
/** 导出按钮操作 */
|
|
/** 导出按钮操作 */
|
|
|
const handleExport = () => {
|
|
const handleExport = () => {
|
|
|
- proxy?.download('${moduleName}/${businessName}/export', {
|
|
|
|
|
- ...queryParams
|
|
|
|
|
- }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ proxy?.download(
|
|
|
|
|
+ '${moduleName}/${businessName}/export',
|
|
|
|
|
+ {
|
|
|
|
|
+ ...queryParams
|
|
|
|
|
+ },
|
|
|
|
|
+ `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
|
|
|
|
|
+};
|
|
|
/** 弹出框(增加、修改) */
|
|
/** 弹出框(增加、修改) */
|
|
|
const detailFormRef = ref();
|
|
const detailFormRef = ref();
|
|
|
const openForm = (type: string, row?: ${BusinessName}VO) => {
|
|
const openForm = (type: string, row?: ${BusinessName}VO) => {
|
|
|
- const id = row?.${pkColumn.javaField} || ids.value[0];
|
|
|
|
|
- detailFormRef?.value.open(type, id)
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ const id = row?.${pkColumn.javaField} || ids.value[0];
|
|
|
|
|
+ detailFormRef?.value.open(type, id)
|
|
|
|
|
+};
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
getList();
|
|
getList();
|
|
|
});
|
|
});
|