编辑页的列数由原先1列调整为多(1-4)列
This commit is contained in:
parent
3d7fd649fd
commit
6174ca90e1
@ -78,9 +78,6 @@
|
|||||||
<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 type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['${moduleName}:${businessName}:remove']">删除</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button type="success" plain icon="Top" @click="handleImport()" v-hasPermi="['${moduleName}:${businessName}:import']">导入</el-button>
|
|
||||||
</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 type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['${moduleName}:${businessName}:export']">导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -147,8 +144,9 @@
|
|||||||
/>
|
/>
|
||||||
</el-card>
|
</el-card>
|
||||||
<!-- 添加或修改${functionName}对话框 -->
|
<!-- 添加或修改${functionName}对话框 -->
|
||||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="780px" append-to-body>
|
<el-dialog :title="dialog.title" v-model="dialog.visible" width="1200px" append-to-body>
|
||||||
<el-form ref="${businessName}FormRef" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="${businessName}FormRef" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-row>
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
#set($field=$column.javaField)
|
#set($field=$column.javaField)
|
||||||
#if(($column.insert || $column.edit) && !$column.pk)
|
#if(($column.insert || $column.edit) && !$column.pk)
|
||||||
@ -159,6 +157,18 @@
|
|||||||
#set($comment=$column.columnComment)
|
#set($comment=$column.columnComment)
|
||||||
#end
|
#end
|
||||||
#set($dictType=$column.dictType)
|
#set($dictType=$column.dictType)
|
||||||
|
#if(${editColumns}==1)
|
||||||
|
<el-col :span="24">
|
||||||
|
#end
|
||||||
|
#if(${editColumns}==2)
|
||||||
|
<el-col :span="12">
|
||||||
|
#end
|
||||||
|
#if(${editColumns}==3)
|
||||||
|
<el-col :span="8">
|
||||||
|
#end
|
||||||
|
#if(${editColumns}==4)
|
||||||
|
<el-col :span="6">
|
||||||
|
#end
|
||||||
#if($column.htmlType == "input")
|
#if($column.htmlType == "input")
|
||||||
#if(${field} == "version")
|
#if(${field} == "version")
|
||||||
<el-form-item label="${comment}" prop="${field}" v-show="false">
|
<el-form-item label="${comment}" prop="${field}" v-show="false">
|
||||||
@ -253,8 +263,11 @@
|
|||||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
#end
|
#end
|
||||||
|
</el-col>
|
||||||
#end
|
#end
|
||||||
|
|
||||||
#end
|
#end
|
||||||
|
</el-row>
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
<el-divider content-position="center">${subTable.functionName}信息</el-divider>
|
<el-divider content-position="center">${subTable.functionName}信息</el-divider>
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
@ -335,54 +348,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 导入对话框 -->
|
|
||||||
<el-dialog v-model="upload.open" :title="upload.title" width="400px" append-to-body>
|
|
||||||
<el-upload
|
|
||||||
ref="uploadRef"
|
|
||||||
: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
|
|
||||||
>
|
|
||||||
<el-icon class="el-icon--upload">
|
|
||||||
<i-ep-upload-filled />
|
|
||||||
</el-icon>
|
|
||||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
||||||
<template #tip>
|
|
||||||
<div class="text-center el-upload__tip">
|
|
||||||
<div class="el-upload__tip">
|
|
||||||
<el-checkbox v-model="upload.updateSupport" />
|
|
||||||
是否更新已经存在的${functionName}数据
|
|
||||||
</div>
|
|
||||||
<span>仅允许导入xls、xlsx格式文件。</span>
|
|
||||||
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="importTemplate">下载模板 </el-link>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-upload>
|
|
||||||
<template #footer>
|
|
||||||
<div class="dialog-footer">
|
|
||||||
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
|
||||||
<el-button @click="upload.open = false">取 消</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup name="${BusinessName}" lang="ts">
|
||||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from '@/api/${moduleName}/${businessName}';
|
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from '@/api/${moduleName}/${businessName}';
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
import { ${BusinessName}VO, ${subClassName}VO, ${BusinessName}Query, ${BusinessName}Form } from '@/api/${moduleName}/${businessName}/types';
|
import { ${BusinessName}VO, ${subClassName}VO, ${BusinessName}Query, ${BusinessName}Form } from '@/api/${moduleName}/${businessName}/types';
|
||||||
#else
|
#else
|
||||||
import { ${BusinessName}VO, ${BusinessName}Query, ${BusinessName}Form } from '@/api/${moduleName}/${businessName}/types';
|
import { ${BusinessName}VO, ${BusinessName}Query, ${BusinessName}Form } from '@/api/${moduleName}/${businessName}/types';
|
||||||
#end
|
#end
|
||||||
import { globalHeaders } from '@/utils/request';
|
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
#if(${dicts} != '')
|
#if(${dicts} != '')
|
||||||
@ -420,23 +395,6 @@ const dateRange${AttrName} = ref<[DateModelType, DateModelType]>(['', '']);
|
|||||||
|
|
||||||
const queryFormRef = ref<ElFormInstance>();
|
const queryFormRef = ref<ElFormInstance>();
|
||||||
const ${businessName}FormRef = ref<ElFormInstance>();
|
const ${businessName}FormRef = ref<ElFormInstance>();
|
||||||
const uploadRef = ref<ElUploadInstance>();
|
|
||||||
|
|
||||||
/*** 导入参数 */
|
|
||||||
const upload = reactive<ImportOption>({
|
|
||||||
// 是否显示弹出层(导入)
|
|
||||||
open: false,
|
|
||||||
// 弹出层标题(导入)
|
|
||||||
title: '',
|
|
||||||
// 是否禁用上传
|
|
||||||
isUploading: false,
|
|
||||||
// 是否更新已经存在的用户数据
|
|
||||||
updateSupport: 1,
|
|
||||||
// 设置上传的请求头部
|
|
||||||
headers: globalHeaders(),
|
|
||||||
// 上传的地址
|
|
||||||
url: import.meta.env.VITE_APP_BASE_API + '/${moduleName}/${businessName}/importData'
|
|
||||||
});
|
|
||||||
|
|
||||||
const dialog = reactive<DialogOption>({
|
const dialog = reactive<DialogOption>({
|
||||||
visible: false,
|
visible: false,
|
||||||
@ -669,37 +627,6 @@ const handleExport = () => {
|
|||||||
}, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
|
}, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 导入按钮操作 */
|
|
||||||
const handleImport = () => {
|
|
||||||
upload.title = '${functionName}导入';
|
|
||||||
upload.open = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 下载模板操作 */
|
|
||||||
const importTemplate = () => {
|
|
||||||
proxy?.download('${moduleName}/${businessName}/importTemplate', {}, `${businessName}_template.xlsx`);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**文件上传中处理 */
|
|
||||||
const handleFileUploadProgress = () => {
|
|
||||||
upload.isUploading = true;
|
|
||||||
};
|
|
||||||
/** 文件上传成功处理 */
|
|
||||||
const handleFileSuccess = (response: any, file: UploadFile) => {
|
|
||||||
upload.open = false;
|
|
||||||
upload.isUploading = false;
|
|
||||||
uploadRef.value?.handleRemove(file);
|
|
||||||
ElMessageBox.alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + '</div>', '导入结果', {
|
|
||||||
dangerouslyUseHTMLString: true
|
|
||||||
});
|
|
||||||
getList();
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 提交上传文件 */
|
|
||||||
function submitFileForm() {
|
|
||||||
uploadRef.value?.submit();
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user