feat: 完成webfirst 数据表管理前端模块
This commit is contained in:
@@ -1,14 +1,20 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using EasyTool;
|
||||||
using Furion.DependencyInjection;
|
using Furion.DependencyInjection;
|
||||||
using Furion.DynamicApiController;
|
using Furion.DynamicApiController;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SqlSugar;
|
||||||
|
using Yi.Framework.Infrastructure.Ddd.Dtos;
|
||||||
using Yi.Framework.Infrastructure.Ddd.Services;
|
using Yi.Framework.Infrastructure.Ddd.Services;
|
||||||
|
using Yi.Framework.Module.DictionaryManager.Dtos.DictionaryType;
|
||||||
using Yi.Framework.Module.WebFirstManager.Dtos.Field;
|
using Yi.Framework.Module.WebFirstManager.Dtos.Field;
|
||||||
using Yi.Framework.Module.WebFirstManager.Entities;
|
using Yi.Framework.Module.WebFirstManager.Entities;
|
||||||
|
using Yi.Framework.Module.WebFirstManager.Enums;
|
||||||
|
|
||||||
namespace Yi.Framework.Module.WebFirstManager.Impl
|
namespace Yi.Framework.Module.WebFirstManager.Impl
|
||||||
{
|
{
|
||||||
@@ -16,7 +22,31 @@ namespace Yi.Framework.Module.WebFirstManager.Impl
|
|||||||
/// 字段管理
|
/// 字段管理
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiDescriptionSettings("WebFirstManager")]
|
[ApiDescriptionSettings("WebFirstManager")]
|
||||||
public class FieldService:CrudAppService<FieldEntity, FieldDto,long, FieldGetListInput> ,IFieldService,ITransient,IDynamicApiController
|
public class FieldService : CrudAppService<FieldEntity, FieldDto, long, FieldGetListInput>, IFieldService, ITransient, IDynamicApiController
|
||||||
{
|
{
|
||||||
|
public async override Task<PagedResultDto<FieldDto>> GetListAsync([FromQuery] FieldGetListInput input)
|
||||||
|
{
|
||||||
|
RefAsync<int> total = 0;
|
||||||
|
var entities = await _DbQueryable.WhereIF(input.TableId is not null, x => x.TableId.Equals(input.TableId!))
|
||||||
|
.WhereIF(input.Name is not null, x => x.Name!.Contains(input.Name!))
|
||||||
|
|
||||||
|
.ToPageListAsync(input.PageNum, input.PageSize, total);
|
||||||
|
|
||||||
|
return new PagedResultDto<FieldDto>
|
||||||
|
{
|
||||||
|
Total = total,
|
||||||
|
Items = await MapToGetListOutputDtosAsync(entities)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取类型枚举
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Route("type")]
|
||||||
|
public object GetFieldTypeEnum()
|
||||||
|
{
|
||||||
|
return typeof(FieldTypeEnum).GetFields(BindingFlags.Static | BindingFlags.Public).Select(x => new { lable = x.Name, value = (int)EnumUtil.GetValueByName<FieldTypeEnum>(x.Name) }).ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -523,6 +523,12 @@
|
|||||||
字段管理
|
字段管理
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Yi.Framework.Module.WebFirstManager.Impl.FieldService.GetFieldTypeEnum">
|
||||||
|
<summary>
|
||||||
|
获取类型枚举
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:Yi.Framework.Module.WebFirstManager.Impl.WebFirstService.PostWebBuildCodeAsync">
|
<member name="M:Yi.Framework.Module.WebFirstManager.Impl.WebFirstService.PostWebBuildCodeAsync">
|
||||||
<summary>
|
<summary>
|
||||||
Web To Code
|
Web To Code
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public class Startup : AppStartup
|
|||||||
{
|
{
|
||||||
// 注册作业,并配置作业触发器
|
// 注册作业,并配置作业触发器
|
||||||
//options.AddJob<TestJob>(Triggers.Period(10000));
|
//options.AddJob<TestJob>(Triggers.Period(10000));
|
||||||
|
//options.AddJob<SystemDataJob>(Triggers.Period(10000));
|
||||||
options.AddJob<SystemDataJob>(Triggers.Cron("0 0 0,12 ? * ?", CronStringFormat.WithSeconds)); // 表示每天凌晨与12点
|
options.AddJob<SystemDataJob>(Triggers.Cron("0 0 0,12 ? * ?", CronStringFormat.WithSeconds)); // 表示每天凌晨与12点
|
||||||
});
|
});
|
||||||
services.AddFileLogging("log/application-{0:yyyy}-{0:MM}-{0:dd}.log", options =>
|
services.AddFileLogging("log/application-{0:yyyy}-{0:MM}-{0:dd}.log", options =>
|
||||||
|
|||||||
54
Yi.RuoYi.Vue3/src/api/webfirst/fieldApi.js
Normal file
54
Yi.RuoYi.Vue3/src/api/webfirst/fieldApi.js
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 分页查询
|
||||||
|
export function listData(query) {
|
||||||
|
return request({
|
||||||
|
url: '/field',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// type查询
|
||||||
|
export function getType(query) {
|
||||||
|
return request({
|
||||||
|
url: '/field/type',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// id查询
|
||||||
|
export function getData(id) {
|
||||||
|
return request({
|
||||||
|
url: `/field/${id}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
export function addData(data) {
|
||||||
|
return request({
|
||||||
|
url: '/field',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改
|
||||||
|
export function updateData(data) {
|
||||||
|
return request({
|
||||||
|
url: `/field/${data.id}`,
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
export function delData(ids) {
|
||||||
|
return request({
|
||||||
|
url: `/field/${ids}`,
|
||||||
|
method: 'delete',
|
||||||
|
})
|
||||||
|
}
|
||||||
44
Yi.RuoYi.Vue3/src/api/webfirst/tableApi.js
Normal file
44
Yi.RuoYi.Vue3/src/api/webfirst/tableApi.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 分页查询
|
||||||
|
export function listData(query) {
|
||||||
|
return request({
|
||||||
|
url: '/table',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// id查询
|
||||||
|
export function getData(id) {
|
||||||
|
return request({
|
||||||
|
url: `/table/${id}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
export function addData(data) {
|
||||||
|
return request({
|
||||||
|
url: '/table',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改
|
||||||
|
export function updateData(data) {
|
||||||
|
return request({
|
||||||
|
url: `/table/${data.id}`,
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
export function delData(ids) {
|
||||||
|
return request({
|
||||||
|
url: `/table/${ids}`,
|
||||||
|
method: 'delete',
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -1,190 +1,234 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form
|
||||||
<el-form-item label="参数名称" prop="configName">
|
:model="queryParams"
|
||||||
<el-input
|
ref="queryRef"
|
||||||
v-model="queryParams.configName"
|
:inline="true"
|
||||||
placeholder="请输入参数名称"
|
v-show="showSearch"
|
||||||
clearable
|
label-width="68px"
|
||||||
style="width: 240px"
|
>
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="参数键名" prop="configKey">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.configKey"
|
|
||||||
placeholder="请输入参数键名"
|
|
||||||
clearable
|
|
||||||
style="width: 240px"
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="系统内置" prop="configType">
|
|
||||||
<el-select v-model="queryParams.configType" placeholder="系统内置" clearable>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in sys_yes_no"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="创建时间" style="width: 308px;">
|
|
||||||
<el-date-picker
|
|
||||||
v-model="dateRange"
|
|
||||||
value-format="YYYY-MM-DD"
|
|
||||||
type="daterange"
|
|
||||||
range-separator="-"
|
|
||||||
start-placeholder="开始日期"
|
|
||||||
end-placeholder="结束日期"
|
|
||||||
></el-date-picker>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-form-item label="当前选择表:" label-width="120px" >
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
<el-input v-if="props.table.name!=null" v-model="props.table.name" disabled />
|
||||||
type="primary"
|
<span v-else>无</span>
|
||||||
plain
|
</el-form-item>
|
||||||
icon="Plus"
|
|
||||||
@click="handleAdd"
|
|
||||||
v-hasPermi="['system:config:add']"
|
|
||||||
>新增</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="success"
|
|
||||||
plain
|
|
||||||
icon="Edit"
|
|
||||||
:disabled="single"
|
|
||||||
@click="handleUpdate"
|
|
||||||
v-hasPermi="['system:config:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
plain
|
|
||||||
icon="Delete"
|
|
||||||
:disabled="multiple"
|
|
||||||
@click="handleDelete"
|
|
||||||
v-hasPermi="['system:config:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
icon="Download"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['system:config:export']"
|
|
||||||
>导出</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
plain
|
|
||||||
icon="Refresh"
|
|
||||||
@click="handleRefreshCache"
|
|
||||||
v-hasPermi="['system:config:remove']"
|
|
||||||
>刷新缓存</el-button>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange">
|
<el-form-item label="字段名称" prop="name">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-input
|
||||||
<el-table-column label="参数主键" align="center" prop="id" />
|
v-model="queryParams.name"
|
||||||
<el-table-column label="参数名称" align="center" prop="configName" :show-overflow-tooltip="true" />
|
placeholder="请输入字段名称"
|
||||||
<el-table-column label="参数键名" align="center" prop="configKey" :show-overflow-tooltip="true" />
|
clearable
|
||||||
<el-table-column label="参数键值" align="center" prop="configValue" />
|
style="width: 240px"
|
||||||
<el-table-column label="系统内置" align="center" prop="configType">
|
@keyup.enter="handleQuery"
|
||||||
<template #default="scope">
|
/>
|
||||||
<dict-tag :options="sys_yes_no" :value="scope.row.configType" />
|
</el-form-item>
|
||||||
</template>
|
<el-form-item>
|
||||||
</el-table-column>
|
<el-button type="primary" icon="Search" @click="handleQuery"
|
||||||
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
>搜索</el-button
|
||||||
<el-table-column label="创建时间" align="center" prop="creationTime" width="180">
|
>
|
||||||
<template #default="scope">
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
<span>{{ parseTime(scope.row.creationTime) }}</span>
|
</el-form-item>
|
||||||
</template>
|
</el-form>
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-button
|
|
||||||
type="text"
|
|
||||||
icon="Edit"
|
|
||||||
@click="handleUpdate(scope.row)"
|
|
||||||
v-hasPermi="['system:config:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
<el-button
|
|
||||||
type="text"
|
|
||||||
icon="Delete"
|
|
||||||
@click="handleDelete(scope.row)"
|
|
||||||
v-hasPermi="['system:config:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
|
|
||||||
<pagination
|
<el-row :gutter="10" class="mb8">
|
||||||
v-show="total > 0"
|
<el-col :span="1.5">
|
||||||
:total="Number(total)"
|
<el-button
|
||||||
v-model:page="queryParams.pageNum"
|
type="primary"
|
||||||
v-model:limit="queryParams.pageSize"
|
plain
|
||||||
@pagination="getList"
|
icon="Plus"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['system:config:add']"
|
||||||
|
>新增</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="Edit"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['system:config:edit']"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="Delete"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['system:config:remove']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="Download"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['system:config:export']"
|
||||||
|
>导出</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<right-toolbar
|
||||||
|
v-model:showSearch="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="dataList"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="名称" align="center" prop="name" />
|
||||||
|
<el-table-column label="类型" align="center" prop="fieldType" >
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag>{{getFieldTypeEnum(scope.row.fieldType)}}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="长度" align="center" prop="length" />
|
||||||
|
|
||||||
|
<el-table-column label="是否必填" align="center" prop="isRequired" >
|
||||||
|
<template #default="scope">
|
||||||
|
<el-switch disabled v-model="scope.row.isRequired" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="是否主键" align="center" prop="isKey" >
|
||||||
|
<template #default="scope">
|
||||||
|
<el-switch disabled v-model="scope.row.isKey" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="是否自增" align="center" prop="isAutoAdd" >
|
||||||
|
<template #default="scope">
|
||||||
|
<el-switch disabled v-model="scope.row.isAutoAdd" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
label="描述"
|
||||||
|
align="center"
|
||||||
|
prop="Description"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
/>
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
width="150"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
>
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
icon="Edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:config:edit']"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
icon="Delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:config:remove']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
<!-- 添加或修改参数配置对话框 -->
|
<pagination
|
||||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
v-show="total > 0"
|
||||||
<el-form ref="configRef" :model="form" :rules="rules" label-width="80px">
|
:total="Number(total)"
|
||||||
<el-form-item label="参数名称" prop="configName">
|
v-model:page="queryParams.pageNum"
|
||||||
<el-input v-model="form.configName" placeholder="请输入参数名称" />
|
v-model:limit="queryParams.pageSize"
|
||||||
</el-form-item>
|
@pagination="getList"
|
||||||
<el-form-item label="参数键名" prop="configKey">
|
/>
|
||||||
<el-input v-model="form.configKey" placeholder="请输入参数键名" />
|
|
||||||
</el-form-item>
|
<!-- 添加或修改字段配置对话框 -->
|
||||||
<el-form-item label="参数键值" prop="configValue">
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||||
<el-input v-model="form.configValue" placeholder="请输入参数键值" />
|
<el-form ref="dataRef" :model="form" :rules="rules" label-width="80px">
|
||||||
</el-form-item>
|
<el-form-item label="名称" prop="name">
|
||||||
<el-form-item label="系统内置" prop="configType">
|
<el-input v-model="form.name" placeholder="请输入字段名称" />
|
||||||
<el-radio-group v-model="form.configType">
|
</el-form-item>
|
||||||
<el-radio
|
<el-form-item label="类型" prop="fieldType">
|
||||||
v-for="dict in sys_yes_no"
|
<el-select
|
||||||
:key="dict.value"
|
v-model="form.fieldType"
|
||||||
:label="dict.value"
|
class="m-2"
|
||||||
>{{ dict.label }}</el-radio>
|
placeholder="请选择一个类型"
|
||||||
</el-radio-group>
|
size="large"
|
||||||
</el-form-item>
|
>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-option
|
||||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
v-for="item in fieldList"
|
||||||
</el-form-item>
|
:key="item.value"
|
||||||
</el-form>
|
:label="item.lable"
|
||||||
<template #footer>
|
:value="item.value"
|
||||||
<div class="dialog-footer">
|
/>
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
</el-select>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
</el-form-item>
|
||||||
</div>
|
<el-form-item label="长度" prop="length">
|
||||||
</template>
|
<el-input v-model="form.length" placeholder="请输入字段长度" />
|
||||||
</el-dialog>
|
</el-form-item>
|
||||||
</div>
|
<el-form-item label="是否必须" prop="isRequired">
|
||||||
|
<el-switch v-model="form.isRequired" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="是否主键" prop="isKey">
|
||||||
|
<el-switch v-model="form.isKey" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="是否自增" prop="isAutoAdd">
|
||||||
|
<el-switch v-model="form.isAutoAdd" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="字段排序" prop="orderNum">
|
||||||
|
<el-input-number v-model="form.orderNum" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
|
||||||
|
<el-form-item label="字段描述" prop="description">
|
||||||
|
<el-input
|
||||||
|
v-model="form.description"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入字段描述"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Config">
|
<script setup>
|
||||||
|
import {
|
||||||
import useField from '../hooks/useField'
|
listData,
|
||||||
const {field}=useField();
|
getData,
|
||||||
import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config";
|
addData,
|
||||||
|
updateData,
|
||||||
|
delData,
|
||||||
|
getType
|
||||||
|
} from "@/api/webfirst/fieldApi";
|
||||||
|
import { computed, onMounted, defineProps, ref } from "vue";
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { sys_yes_no } = proxy.useDict("sys_yes_no");
|
const { sys_yes_no } = proxy.useDict("sys_yes_no");
|
||||||
|
const props = defineProps(["table"]);
|
||||||
|
|
||||||
const configList = ref([]);
|
const tableOptions = computed(() => props.table);
|
||||||
|
|
||||||
|
const dataList = ref([]);
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const showSearch = ref(true);
|
const showSearch = ref(true);
|
||||||
@@ -194,30 +238,56 @@ const multiple = ref(true);
|
|||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
const title = ref("");
|
const title = ref("");
|
||||||
const dateRange = ref([]);
|
const dateRange = ref([]);
|
||||||
|
const fieldList=ref([]);
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: {},
|
form: {
|
||||||
|
tableId: props.table.id,
|
||||||
|
orderNum:0
|
||||||
|
},
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
configName: undefined,
|
name: undefined,
|
||||||
configKey: undefined,
|
// props.table.id
|
||||||
configType: undefined
|
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
configName: [{ required: true, message: "参数名称不能为空", trigger: "blur" }],
|
name: [{ required: true, message: "字段名称不能为空", trigger: "blur" }],
|
||||||
configKey: [{ required: true, message: "参数键名不能为空", trigger: "blur" }],
|
fieldType: [
|
||||||
configValue: [{ required: true, message: "参数键值不能为空", trigger: "blur" }]
|
{ required: true, message: "字段类型不能为空", trigger: "blur" },
|
||||||
}
|
],
|
||||||
|
// configValue: [{ required: true, message: "字段键值不能为空", trigger: "blur" }]
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data);
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
/** 查询参数列表 */
|
const getFieldTypeEnum=(field)=>{
|
||||||
|
return fieldList.value.filter(x=>x.value==field)[0].lable;
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props,
|
||||||
|
(val) => {
|
||||||
|
getList();
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
);
|
||||||
|
|
||||||
|
function getTypeList()
|
||||||
|
{
|
||||||
|
getType().then((response)=>{
|
||||||
|
fieldList.value=response.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 查询字段列表 */
|
||||||
function getList() {
|
function getList() {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
listConfig(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
|
listData({
|
||||||
configList.value = response.data.items;
|
...proxy.addDateRange(queryParams.value, dateRange.value),
|
||||||
|
tableId: props.table.id,
|
||||||
|
}).then((response) => {
|
||||||
|
dataList.value = response.data.items;
|
||||||
total.value = response.data.total;
|
total.value = response.data.total;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
@@ -230,15 +300,19 @@ function cancel() {
|
|||||||
/** 表单重置 */
|
/** 表单重置 */
|
||||||
function reset() {
|
function reset() {
|
||||||
form.value = {
|
form.value = {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
configName: undefined,
|
name: undefined,
|
||||||
configKey: undefined,
|
description: undefined,
|
||||||
configValue: undefined,
|
orderNum: undefined,
|
||||||
configType: "Y",
|
length: undefined,
|
||||||
remark: undefined,
|
fieldType: undefined,
|
||||||
state: true
|
isRequired: false,
|
||||||
|
isKey: false,
|
||||||
|
isAutoAdd: false,
|
||||||
|
tableId: props.table.id,
|
||||||
|
orderNum:0
|
||||||
};
|
};
|
||||||
proxy.resetForm("configRef");
|
proxy.resetForm("dataRef");
|
||||||
}
|
}
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
function handleQuery() {
|
function handleQuery() {
|
||||||
@@ -253,38 +327,43 @@ function resetQuery() {
|
|||||||
}
|
}
|
||||||
/** 多选框选中数据 */
|
/** 多选框选中数据 */
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
ids.value = selection.map(item => item.id);
|
ids.value = selection.map((item) => item.id);
|
||||||
single.value = selection.length != 1;
|
single.value = selection.length != 1;
|
||||||
multiple.value = !selection.length;
|
multiple.value = !selection.length;
|
||||||
}
|
}
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
|
if(props.table.id==undefined)
|
||||||
|
{
|
||||||
|
proxy.$modal.msgWarning('请先选择一张表后再添加字段');
|
||||||
|
return;
|
||||||
|
}
|
||||||
reset();
|
reset();
|
||||||
open.value = true;
|
open.value = true;
|
||||||
title.value = "添加参数";
|
title.value = "添加字段";
|
||||||
}
|
}
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
function handleUpdate(row) {
|
function handleUpdate(row) {
|
||||||
reset();
|
reset();
|
||||||
const configId = row.id || ids.value;
|
const configId = row.id || ids.value;
|
||||||
getConfig(configId).then(response => {
|
getData(configId).then((response) => {
|
||||||
form.value = response.data;
|
form.value = response.data;
|
||||||
open.value = true;
|
open.value = true;
|
||||||
title.value = "修改参数";
|
title.value = "修改字段";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
function submitForm() {
|
function submitForm() {
|
||||||
proxy.$refs["configRef"].validate(valid => {
|
proxy.$refs["dataRef"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (form.value.id != undefined) {
|
if (form.value.id != undefined) {
|
||||||
updateConfig(form.value).then(response => {
|
updateData(form.value).then((response) => {
|
||||||
proxy.$modal.msgSuccess("修改成功");
|
proxy.$modal.msgSuccess("修改成功");
|
||||||
open.value = false;
|
open.value = false;
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addConfig(form.value).then(response => {
|
addData(form.value).then((response) => {
|
||||||
proxy.$modal.msgSuccess("新增成功");
|
proxy.$modal.msgSuccess("新增成功");
|
||||||
open.value = false;
|
open.value = false;
|
||||||
getList();
|
getList();
|
||||||
@@ -296,18 +375,26 @@ function submitForm() {
|
|||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const configIds = row.id || ids.value;
|
const configIds = row.id || ids.value;
|
||||||
proxy.$modal.confirm('是否确认删除参数编号为"' + configIds + '"的数据项?').then(function () {
|
proxy.$modal
|
||||||
return delConfig(configIds);
|
.confirm('是否确认删除字段编号为"' + configIds + '"的数据项?')
|
||||||
}).then(() => {
|
.then(function () {
|
||||||
getList();
|
return delData(configIds);
|
||||||
proxy.$modal.msgSuccess("删除成功");
|
})
|
||||||
}).catch(() => {});
|
.then(() => {
|
||||||
|
getList();
|
||||||
|
proxy.$modal.msgSuccess("删除成功");
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
function handleExport() {
|
function handleExport() {
|
||||||
proxy.download("system/config/export", {
|
proxy.download(
|
||||||
...queryParams.value
|
"system/config/export",
|
||||||
}, `config_${new Date().getTime()}.xlsx`);
|
{
|
||||||
|
...queryParams.value,
|
||||||
|
},
|
||||||
|
`config_${new Date().getTime()}.xlsx`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
/** 刷新缓存按钮操作 */
|
/** 刷新缓存按钮操作 */
|
||||||
function handleRefreshCache() {
|
function handleRefreshCache() {
|
||||||
@@ -315,6 +402,6 @@ function handleRefreshCache() {
|
|||||||
proxy.$modal.msgSuccess("刷新缓存成功");
|
proxy.$modal.msgSuccess("刷新缓存成功");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
getTypeList();
|
||||||
getList();
|
getList();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,46 +1,32 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<h3 class="title">数据表选择</h3>
|
||||||
<h5 class="mb-2"> {{table}}</h5>
|
|
||||||
<el-menu
|
<el-menu
|
||||||
default-active="2"
|
default-active="2"
|
||||||
class="el-menu-vertical-demo"
|
class="el-menu-vertical-demo"
|
||||||
@open="handleOpen"
|
|
||||||
@close="handleClose"
|
|
||||||
>
|
>
|
||||||
|
<el-menu-item v-for="(item,i) in dataList" :index="'data-'+i" :key="i" @click="menuClick(item)">
|
||||||
<el-menu-item index="1">
|
|
||||||
<el-icon><setting /></el-icon>
|
<el-icon><setting /></el-icon>
|
||||||
<span>Navigator Four</span>
|
<span>{{item.name}}</span>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-menu-item index="2">
|
</el-menu>
|
||||||
<el-icon><setting /></el-icon>
|
|
||||||
<span>Navigator Four</span>
|
|
||||||
</el-menu-item>
|
|
||||||
<el-menu-item index="3">
|
|
||||||
<el-icon><setting /></el-icon>
|
|
||||||
<span>Navigator Four</span>
|
|
||||||
</el-menu-item>
|
|
||||||
<el-menu-item index="4">
|
|
||||||
<el-icon><setting /></el-icon>
|
|
||||||
<span>Navigator Four</span>
|
|
||||||
</el-menu-item>
|
|
||||||
<el-menu-item index="5">
|
|
||||||
<el-icon><setting /></el-icon>
|
|
||||||
<span>Navigator Four</span>
|
|
||||||
</el-menu-item>
|
|
||||||
</el-menu>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
|
||||||
|
|
||||||
import useTable from '../hooks/useTable'
|
import useTable from '../hooks/useTable'
|
||||||
const {table}=useTable();
|
const emit = defineEmits(['selectTable'])
|
||||||
|
|
||||||
const handleOpen = (key, keyPath) => {
|
function menuClick(item) {
|
||||||
console.log(key, keyPath)
|
emit('selectTable',item)
|
||||||
}
|
|
||||||
const handleClose = (key, keyPath) => {
|
|
||||||
console.log(key, keyPath)
|
|
||||||
}
|
}
|
||||||
|
const {dataList}=useTable();
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.el-menu-item{
|
||||||
|
justify-content: center;
|
||||||
|
max-height: 1000px;
|
||||||
|
}
|
||||||
|
.title
|
||||||
|
{
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
|
|
||||||
const useField=()=>{
|
|
||||||
const field=ref("zd")
|
|
||||||
onMounted(() => {
|
|
||||||
console.log(`the component is now mounted. field`)
|
|
||||||
});
|
|
||||||
return {field};
|
|
||||||
}
|
|
||||||
export default useField;
|
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
|
import {listData} from "@/api/webfirst/tableApi.js"
|
||||||
|
|
||||||
const useTable=()=>{
|
const useTable=()=>{
|
||||||
const table=ref("数据表选择")
|
const dataList=ref([]);
|
||||||
onMounted(() => {
|
onMounted( async() => {
|
||||||
console.log(`the component is now mounted. table`)
|
const response= await listData();
|
||||||
|
dataList.value=response.data.items;
|
||||||
});
|
});
|
||||||
return {table};
|
return {dataList};
|
||||||
}
|
}
|
||||||
export default useTable;
|
export default useTable;
|
||||||
@@ -1,12 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="4"> <TableList></TableList></el-col>
|
<el-col :span="4"> <TableList @selectTable="selectTable"></TableList></el-col>
|
||||||
<el-col :span="20"> <FieldList class="fileList"></FieldList></el-col>
|
<el-col :span="20"> <FieldList class="fileList" :table="table"></FieldList></el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { ref ,watch} from 'vue'
|
||||||
import FieldList from './components/FieldList.vue'
|
import FieldList from './components/FieldList.vue'
|
||||||
import TableList from './components/TableList.vue'
|
import TableList from './components/TableList.vue'
|
||||||
|
const table=ref({});
|
||||||
|
const options = ref({})
|
||||||
|
const selectTable=(table)=>{
|
||||||
|
options.value = table
|
||||||
|
}
|
||||||
|
watch(() => options.value,val => {
|
||||||
|
table.value = val
|
||||||
|
},{deep:true})
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.fileList{
|
.fileList{
|
||||||
|
|||||||
Reference in New Issue
Block a user