代码生成功能优化
This commit is contained in:
parent
e14b5c7a1e
commit
945d8db170
@ -7,7 +7,7 @@ namespace Infrastructure
|
||||
public class OptionsSetting
|
||||
{
|
||||
public static string ConnAdmin = "conn_zrAdmin";
|
||||
public static string ConnDbType = "dbType";
|
||||
public static string ConnDbType = "conn_zrAdmin_Type";
|
||||
public static string DbKey = "DbKey";
|
||||
|
||||
public string Redis { get; set; }
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
<!--${basedir}表示当前应用程序域所在的根目录-->
|
||||
<target name="allfile" xsi:type="File"
|
||||
fileName="${basedir}/adminlogs/nlog-all-${shortdate}.log"
|
||||
archiveFileName="${basedir}/adminlogs/all/all.{###}.txt"
|
||||
archiveAboveSize="20000000"
|
||||
maxArchiveFiles="30"
|
||||
keepFileOpen="false"
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
"ConnectionStrings": {
|
||||
"conn_zrAdmin": "server=127.0.0.1;user=zr;pwd=abc;database=admin"
|
||||
},
|
||||
"conn_zrAdmin_Type": 0, //MySql = 0, SqlServer = 1
|
||||
"urls": "http://localhost:8888", //项目启动url
|
||||
"sysConfig": {
|
||||
"DBCommandTimeout": 10,
|
||||
@ -16,7 +17,6 @@
|
||||
},
|
||||
"DemoMode": false, //是否演示模式
|
||||
"DbKey": "", //数据库加密key
|
||||
"DbType": 0, //MySql = 0, SqlServer = 1
|
||||
"Upload": {
|
||||
"UploadDirectory": "/",
|
||||
"UploadUrl": "http://localhost:8888"
|
||||
|
||||
@ -30,14 +30,14 @@
|
||||
{VueViewListContent}
|
||||
<el-table-column label="操作" align="center" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" v-hasPermi="['{Permission}:update']" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||
<el-button v-hasPermi="['{Permission}:update']" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="handleDelete(scope.row)" style="margin-left:10px">
|
||||
<el-button slot="reference" v-hasPermi="['{Permission}:delete']" size="mini" type="text" icon="el-icon-delete">删除</el-button>
|
||||
<el-button slot="reference" v-hasPermi="['{Permission}:delete']" type="text" icon="el-icon-delete">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination class="mt10" background :total="total" :current-page.sync="queryParams.pageNum" :page-size="queryParams.pageSize" :page-sizes="[20, 30, 50, 100]" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" @current-change="getList" />
|
||||
<pagination class="mt10" background :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<!-- 添加或修改菜单对话框 -->
|
||||
<el-dialog :title="title" :lock-scroll="false" :visible.sync="open" >
|
||||
@ -67,7 +67,7 @@ export default {
|
||||
return {
|
||||
labelWidth: "100px",
|
||||
formLabelWidth:"100px",
|
||||
// 选中数组
|
||||
// 选中{primaryKey}数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
@ -129,7 +129,7 @@ export default {
|
||||
reset() {
|
||||
this.form = {
|
||||
{VueViewEditFormContent}
|
||||
//需个性化处理内容
|
||||
//TODO 根据实际内容调整
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
@ -142,8 +142,9 @@ export default {
|
||||
pageSize: 20,
|
||||
//TODO 重置字段
|
||||
};
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.{primaryKey});
|
||||
this.single = selection.length!=1
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 测试分页查询
|
||||
* 代码生成测试表分页查询
|
||||
* @param {查询条件} data
|
||||
*/
|
||||
export function listGendemo(query) {
|
||||
@ -13,7 +13,7 @@ export function listGendemo(query) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增测试
|
||||
* 新增代码生成测试表
|
||||
* @param data
|
||||
*/
|
||||
export function addGendemo(data) {
|
||||
@ -25,7 +25,7 @@ export function addGendemo(data) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改测试
|
||||
* 修改代码生成测试表
|
||||
* @param data
|
||||
*/
|
||||
export function updateGendemo(data) {
|
||||
@ -37,8 +37,8 @@ export function updateGendemo(data) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取测试详情
|
||||
* @param {Id} 测试Id
|
||||
* 获取代码生成测试表详情
|
||||
* @param {Id} 代码生成测试表Id
|
||||
*/
|
||||
export function getGendemo(id) {
|
||||
return request({
|
||||
|
||||
@ -44,7 +44,7 @@ export const constantRoutes = [
|
||||
},
|
||||
{
|
||||
path: '/demo',
|
||||
component: (resolve) => require(['@/views/userInfo/index'], resolve),
|
||||
component: (resolve) => require(['@/views/gendemo/index'], resolve),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
|
||||
@ -1,271 +1,278 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- :model属性用于表单验证使用 比如下面的el-form-item 的 prop属性用于对表单值进行验证操作 -->
|
||||
<el-form :model="queryParams" label-position="left" inline ref="queryForm" :label-width="labelWidth" v-show="showSearch" @submit.native.prevent>
|
||||
<el-form-item label="名称" :label-width="labelWidth">
|
||||
<el-input v-model="queryParams.name"/>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-row class="mb8" style="text-align:center">
|
||||
<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-row>
|
||||
</el-form>
|
||||
|
||||
<!-- 工具区域 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" v-hasPermi="['gendemo:add']" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" :disabled="single" v-hasPermi="['gendemo:update']" plain icon="el-icon-edit" size="mini" @click="handleUpdate">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" v-hasPermi="['gendemo:delete']" plain icon="el-icon-delete" size="mini" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 数据区域 -->
|
||||
<el-table :data="dataList" ref="table" border @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="50" />
|
||||
<el-table-column prop="id" label="自增id" align="center" width="100" />
|
||||
<el-table-column prop="name" label="名称" align="center" width="100" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="icon" label="图片">
|
||||
<template slot-scope="scope">
|
||||
<el-image class="table-td-thumb" :src="scope.row.icon" :preview-src-list="[scope.row.icon]"></el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="showStatus" label="显示状态" align="center" width="100" />
|
||||
<el-table-column prop="addTime" label="添加时间" align="center" width="100" />
|
||||
<el-table-column prop="sex" label="用户性别" align="center" width="100" />
|
||||
<el-table-column prop="sort" label="排序" align="center" width="100" />
|
||||
|
||||
<el-table-column label="操作" align="center" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" v-hasPermi="['gendemo:update']" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="handleDelete(scope.row)" style="margin-left:10px">
|
||||
<el-button slot="reference" v-hasPermi="['gendemo:delete']" size="mini" type="text" icon="el-icon-delete">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination class="mt10" background :total="total" :current-page.sync="queryParams.pageNum" :page-size="queryParams.pageSize" :page-sizes="[20, 30, 50, 100]" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" @current-change="getList" />
|
||||
|
||||
<!-- 添加或修改菜单对话框 -->
|
||||
<el-dialog :title="title" :lock-scroll="false" :visible.sync="open" >
|
||||
<el-form ref="form" :model="form" :rules="rules" :label-width="formLabelWidth">
|
||||
<el-form-item label="名称" :label-width="labelWidth" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="图片" :label-width="labelWidth" prop="icon">
|
||||
<el-upload class="avatar-uploader" name="file" action="/api/upload/saveFile/" :show-file-list="false" :on-success="handleUploadiconSuccess" :before-upload="beforeFileUpload">
|
||||
<img v-if="form.icon" :src="form.icon" class="icon">
|
||||
<i v-else class="el-icon-plus uploader-icon"></i>
|
||||
</el-upload>
|
||||
<el-input v-model="form.icon" placeholder="请上传文件或手动输入文件地址"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="显示状态" :label-width="labelWidth" prop="showStatus">
|
||||
<el-input v-model.number="form.showStatus" placeholder="请输入显示状态" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户性别" :label-width="labelWidth" prop="sex">
|
||||
<el-select v-model="form.sex" > <el-option v-for="item in sexOptions" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" :label-width="labelWidth" prop="sort">
|
||||
<el-input v-model.number="form.sort" placeholder="请输入排序" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer" v-if="btnSubmitVisible">
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
listGendemo,
|
||||
addGendemo,
|
||||
delGendemo,
|
||||
updateGendemo,
|
||||
getGendemo
|
||||
} from '@/api/gendemo.js'
|
||||
|
||||
export default {
|
||||
name: 'Gendemo',
|
||||
data() {
|
||||
return {
|
||||
labelWidth: "100px",
|
||||
formLabelWidth:"100px",
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 查询参数
|
||||
queryParams: {},
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 时间范围数组
|
||||
timeRange: [],
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- :model属性用于表单验证使用 比如下面的el-form-item 的 prop属性用于对表单值进行验证操作 -->
|
||||
<el-form :model="queryParams" label-position="left" inline ref="queryForm" :label-width="labelWidth" v-show="showSearch" @submit.native.prevent>
|
||||
|
||||
<el-row class="mb8" style="text-align:center">
|
||||
<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-row>
|
||||
</el-form>
|
||||
|
||||
<!-- 工具区域 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" v-hasPermi="['gendemo:add']" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" :disabled="single" v-hasPermi="['gendemo:update']" plain icon="el-icon-edit" size="mini" @click="handleUpdate">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" v-hasPermi="['gendemo:delete']" plain icon="el-icon-delete" size="mini" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 数据区域 -->
|
||||
<el-table :data="dataList" ref="table" border @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="50" />
|
||||
<el-table-column prop="id" label="自增id" align="center" />
|
||||
<el-table-column prop="name" label="名称" align="center" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="icon" label="图片">
|
||||
<template slot-scope="scope">
|
||||
<el-image class="table-td-thumb" :src="scope.row.icon" :preview-src-list="[scope.row.icon]"></el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="showStatus" label="显示状态" align="center" />
|
||||
<el-table-column prop="addTime" label="添加时间" align="center" />
|
||||
<el-table-column prop="sex" label="用户性别" align="center" :formatter="sexFormat" />
|
||||
<el-table-column prop="sort" label="排序" align="center" />
|
||||
|
||||
<el-table-column label="操作" align="center" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-hasPermi="['gendemo:update']" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="handleDelete(scope.row)" style="margin-left:10px">
|
||||
<el-button slot="reference" v-hasPermi="['gendemo:delete']" type="text" icon="el-icon-delete">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination class="mt10" background :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<!-- 添加或修改菜单对话框 -->
|
||||
<el-dialog :title="title" :lock-scroll="false" :visible.sync="open">
|
||||
<el-form ref="form" :model="form" :rules="rules" :label-width="formLabelWidth">
|
||||
<el-form-item label="名称" :label-width="labelWidth" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="图片" :label-width="labelWidth" prop="icon">
|
||||
<el-upload class="avatar-uploader" name="file" action="/api/upload/saveFile/" :show-file-list="false" :on-success="handleUploadIconSuccess" :before-upload="beforeFileUpload">
|
||||
<img v-if="form.icon" :src="form.icon" class="icon">
|
||||
<i v-else class="el-icon-plus uploader-icon"></i>
|
||||
</el-upload>
|
||||
<el-input v-model="form.icon" placeholder="请上传文件或手动输入文件地址"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="显示状态" :label-width="labelWidth" prop="showStatus">
|
||||
<el-radio-group v-model="form.showStatus">
|
||||
<el-radio :key="1" :label="1">是</el-radio>
|
||||
<el-radio :key="0" :label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户性别" :label-width="labelWidth" prop="sex">
|
||||
<el-select v-model="form.sex">
|
||||
<el-option v-for="item in sexOptions" :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" :label-width="labelWidth" prop="sort">
|
||||
<el-input v-model.number="form.sort" placeholder="请输入排序" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer" v-if="btnSubmitVisible">
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
listGendemo,
|
||||
addGendemo,
|
||||
delGendemo,
|
||||
updateGendemo,
|
||||
getGendemo,
|
||||
} from "@/api/gendemo.js";
|
||||
|
||||
export default {
|
||||
name: "Gendemo",
|
||||
data() {
|
||||
return {
|
||||
labelWidth: "100px",
|
||||
formLabelWidth: "100px",
|
||||
// 选中id数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 查询参数
|
||||
queryParams: {},
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 时间范围数组
|
||||
timeRange: [],
|
||||
// 用户性别选项列表
|
||||
sexOptions: [],
|
||||
// 数据列表
|
||||
dataList: [],
|
||||
// 总记录数
|
||||
total: 0,
|
||||
// 提交按钮是否显示
|
||||
btnSubmitVisible: true,
|
||||
// 表单校验
|
||||
rules: {
|
||||
id: [
|
||||
{ type: 'number', message: 'id必须为数字值', trigger: "blur"},
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: '请输入名称', trigger: "blur"},
|
||||
],
|
||||
showStatus: [
|
||||
{ required: true, message: '请输入显示状态', trigger: "blur"},
|
||||
],
|
||||
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// 列表数据查询
|
||||
this.getList();
|
||||
// 下拉框绑定
|
||||
// this.getDicts("sys_normal_disable").then((response) => {
|
||||
// this.statusOptions = response.data;
|
||||
// });
|
||||
},
|
||||
methods: {
|
||||
// 查询数据
|
||||
getList() {
|
||||
console.log(JSON.stringify(this.queryParams));
|
||||
listGendemo(this.addDateRange(this.queryParams, this.timeRange)).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.dataList = res.data.result;
|
||||
this.total = res.data.totalCount;
|
||||
}
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 重置数据表单
|
||||
reset() {
|
||||
this.form = {
|
||||
name: undefined,
|
||||
icon: undefined,
|
||||
showStatus: undefined,
|
||||
addTime: undefined,
|
||||
sex: undefined,
|
||||
sort: undefined,
|
||||
|
||||
//需个性化处理内容
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 重置查询操作 */
|
||||
resetQuery() {
|
||||
this.timeRange = [];
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
//TODO 重置字段
|
||||
};
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.id);
|
||||
this.single = selection.length!=1
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 选择每页显示数量*/
|
||||
handleSizeChange(val) {
|
||||
this.queryParams.pageSize = val;
|
||||
this.queryParams.pageNum = 1;
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.getList();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加";
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
delGendemo(row.id).then((res) => {
|
||||
this.msgSuccess("删除成功");
|
||||
this.handleQuery();
|
||||
});
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids;
|
||||
getGendemo(id).then((res) => {
|
||||
if(res.code == 200){
|
||||
this.form = res.data;
|
||||
this.open = true;
|
||||
this.title = "修改数据";
|
||||
}
|
||||
});
|
||||
},
|
||||
beforeFileUpload(file) { },
|
||||
//文件上传成功方法
|
||||
handleUploadiconSuccess(res, file) {
|
||||
this.form.icon = URL.createObjectURL(file.raw);
|
||||
// this.$refs.upload.clearFiles();
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
console.log(JSON.stringify(this.form));
|
||||
|
||||
if (this.form.id != undefined || this.title === '修改数据') {
|
||||
updateGendemo(this.form).then((res) => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addGendemo(this.form).then((res) => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.table-td-thumb {
|
||||
width: 80px;
|
||||
}
|
||||
</style>
|
||||
sexOptions: [],
|
||||
// 数据列表
|
||||
dataList: [],
|
||||
// 总记录数
|
||||
total: 0,
|
||||
// 提交按钮是否显示
|
||||
btnSubmitVisible: true,
|
||||
// 表单校验
|
||||
rules: {
|
||||
id: [{ type: "number", message: "id必须为数字值", trigger: "blur" }],
|
||||
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
|
||||
showStatus: [
|
||||
{ required: true, message: "请输入显示状态", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// 列表数据查询
|
||||
this.getList();
|
||||
// 下拉框绑定
|
||||
// this.getDicts("sys_normal_disable").then((response) => {
|
||||
// this.statusOptions = response.data;
|
||||
// });
|
||||
this.getDicts("sys_user_sex").then((response) => {
|
||||
this.sexOptions = response.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
// 查询数据
|
||||
getList() {
|
||||
console.log(JSON.stringify(this.queryParams));
|
||||
listGendemo(this.addDateRange(this.queryParams, this.timeRange)).then(
|
||||
(res) => {
|
||||
if (res.code == 200) {
|
||||
this.dataList = res.data.result;
|
||||
this.total = res.data.totalCount;
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 重置数据表单
|
||||
reset() {
|
||||
this.form = {
|
||||
name: undefined,
|
||||
icon: undefined,
|
||||
showStatus: undefined,
|
||||
addTime: undefined,
|
||||
sex: undefined,
|
||||
sort: undefined,
|
||||
|
||||
//TODO 根据实际内容调整
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 重置查询操作 */
|
||||
resetQuery() {
|
||||
this.timeRange = [];
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
//TODO 重置字段
|
||||
};
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.id);
|
||||
this.single = selection.length != 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 选择每页显示数量*/
|
||||
handleSizeChange(val) {
|
||||
this.queryParams.pageSize = val;
|
||||
this.queryParams.pageNum = 1;
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.getList();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加";
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
delGendemo(ids.toString()).then((res) => {
|
||||
this.msgSuccess("删除成功");
|
||||
this.handleQuery();
|
||||
});
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids;
|
||||
getGendemo(id).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.form = res.data;
|
||||
this.open = true;
|
||||
this.title = "修改数据";
|
||||
}
|
||||
});
|
||||
},
|
||||
beforeFileUpload(file) {},
|
||||
//文件上传成功方法
|
||||
handleUploadIconSuccess(res, file) {
|
||||
this.form.icon = URL.createObjectURL(file.raw);
|
||||
// this.$refs.upload.clearFiles();
|
||||
},
|
||||
// 用户性别字典翻译
|
||||
sexFormat(row, column) {
|
||||
return this.selectDictLabel(this.sexOptions, row.sex);
|
||||
},
|
||||
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
console.log(JSON.stringify(this.form));
|
||||
|
||||
if (this.form.id != undefined || this.title === "修改数据") {
|
||||
updateGendemo(this.form).then((res) => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addGendemo(this.form).then((res) => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.table-td-thumb {
|
||||
width: 80px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -35,11 +35,7 @@
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" icon="el-icon-view" @click="handlePreview()">预览</el-button>
|
||||
<el-button type="text" icon="el-icon-edit" @click="handleEditTable(scope.row)">编辑</el-button>
|
||||
|
||||
<el-popconfirm title="确定删除吗?" @confirm="handleDelete(scope.row)" style="margin-left:10px">
|
||||
<el-button slot="reference" v-hasPermi="['tool:gen:delete']" size="mini" type="text" icon="el-icon-delete">删除</el-button>
|
||||
</el-popconfirm>
|
||||
|
||||
<el-button type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['tool:gen:delete']">删除</el-button>
|
||||
<el-button type="text" icon="el-icon-download" @click="handleShowDialog(scope.row)" v-hasPermi="['tool:gen:code']">生成代码</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -120,7 +116,7 @@ export default {
|
||||
// 选中的表
|
||||
tableIds: [],
|
||||
// 非多个禁用
|
||||
multiple: true
|
||||
multiple: true,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@ -206,21 +202,6 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 选择每页显示数量
|
||||
*/
|
||||
// handleSizeChange(val) {
|
||||
// this.pagination.pagesize = val;
|
||||
// this.pagination.pageNum = 1;
|
||||
// this.loadTableData();
|
||||
// },
|
||||
/**
|
||||
* 选择当页面
|
||||
*/
|
||||
// handleCurrentChange(val) {
|
||||
// this.pagination.pageNum = val;
|
||||
// this.loadTableData();
|
||||
// },
|
||||
cancel() {
|
||||
this.showGenerate = false;
|
||||
this.currentSelected = {};
|
||||
@ -231,18 +212,31 @@ export default {
|
||||
},
|
||||
handleDelete(row) {
|
||||
const tableIds = row.tableId || this.tableIds;
|
||||
delTable(tableIds.toString()).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.msgSuccess('删除成功')
|
||||
|
||||
this.handleSearch();
|
||||
}
|
||||
this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
delTable(tableIds.toString()).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.msgSuccess("删除成功");
|
||||
|
||||
this.handleSearch();
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: "info",
|
||||
message: "已取消删除",
|
||||
});
|
||||
});
|
||||
},
|
||||
handleSelectionChange(section) {
|
||||
this.tableIds = section.map((item) => item.tableId);
|
||||
this.multiple = !section.length;
|
||||
console.log(this.tableIds)
|
||||
console.log(this.tableIds);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
28
ZRAdmin.xml
28
ZRAdmin.xml
@ -27,44 +27,44 @@
|
||||
<param name="data"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:ZR.Admin.WebApi.Controllers.UserInfoController">
|
||||
<member name="T:ZR.Admin.WebApi.Controllers.GendemoController">
|
||||
<summary>
|
||||
代码自动生成
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:ZR.Admin.WebApi.Controllers.UserInfoController._UserInfoService">
|
||||
<member name="F:ZR.Admin.WebApi.Controllers.GendemoController._GendemoService">
|
||||
<summary>
|
||||
用户信息接口
|
||||
代码生成测试表接口
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.UserInfoController.QueryUserInfo(ZR.Model.Dto.UserInfoQueryDto)">
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.GendemoController.QueryGendemo(ZR.Model.Dto.GendemoQueryDto)">
|
||||
<summary>
|
||||
查询用户信息列表
|
||||
查询代码生成测试表列表
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.UserInfoController.GetUserInfo(System.Int32)">
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.GendemoController.GetGendemo(System.Int32)">
|
||||
<summary>
|
||||
查询用户信息详情
|
||||
查询代码生成测试表详情
|
||||
</summary>
|
||||
<param name="Luid"></param>
|
||||
<param name="Id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.UserInfoController.AddUserInfo(ZR.Model.Dto.UserInfoDto)">
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.GendemoController.AddGendemo(ZR.Model.Dto.GendemoDto)">
|
||||
<summary>
|
||||
添加用户信息
|
||||
添加代码生成测试表
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.UserInfoController.UpdateUserInfo(ZR.Model.Dto.UserInfoDto)">
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.GendemoController.UpdateGendemo(ZR.Model.Dto.GendemoDto)">
|
||||
<summary>
|
||||
更新用户信息
|
||||
更新代码生成测试表
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.UserInfoController.DeleteUserInfo(System.String)">
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.GendemoController.DeleteGendemo(System.String)">
|
||||
<summary>
|
||||
删除用户信息
|
||||
删除代码生成测试表
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user