😎1、增加国家地名库同步 2、增加根据区划生成组织架构 3、调整组织架构种子 4、默认不发异常邮件 5、修复在线用户连接异常 6、其他优化

This commit is contained in:
zuohuaijun 2024-08-15 13:56:57 +08:00
parent 79c5ddcb89
commit e614e11b76
22 changed files with 459 additions and 105 deletions

View File

@ -18,9 +18,9 @@
<PackageReference Include="AspectCore.Extensions.Reflection" Version="2.4.0" />
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.15.1" />
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.5.3" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.5.3" />
<PackageReference Include="Furion.Pure" Version="4.9.5.3" />
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.5.4" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.5.4" />
<PackageReference Include="Furion.Pure" Version="4.9.5.4" />
<PackageReference Include="Hardware.Info" Version="100.1.0.1" />
<PackageReference Include="IPTools.China" Version="1.6.0" />
<PackageReference Include="IPTools.International" Version="1.6.0" />
@ -34,12 +34,12 @@
<PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.2" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.8" />
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.4.0" />
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.5.0" />
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.7.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.166" />
<PackageReference Include="SSH.NET" Version="2024.1.0" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.4" />
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1067" />
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1069" />
<PackageReference Include="UAParser" Version="3.1.47" />
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
</ItemGroup>

View File

@ -77,7 +77,6 @@ public class SysWechatRefund : EntityBase
[SugarColumn(ColumnDescription = "关联的商户订单状态", Length = 32)]
public string OrderStatus { get; set; }
/// <summary>
/// 关联的商户商品编码
/// </summary>

View File

@ -49,6 +49,8 @@ public class OnlineUserHub : Hub<IOnlineUserHub>
var tenantId = (httpContext.User.FindFirst(ClaimConst.TenantId)?.Value).ToLong();
var loginMode = (LoginModeEnum)(httpContext.User.FindFirst(ClaimConst.LoginMode)?.Value).ToInt();
var device = httpContext.GetClientDeviceInfo().Trim();
if (userId < 0 || string.IsNullOrWhiteSpace(account)) return;
var user = new SysOnlineUser
{
ConnectionId = Context.ConnectionId,

View File

@ -29,7 +29,7 @@ public class SysConfigSeedData : ISqlSugarEntitySeedData<SysConfig>
new SysConfig{ Id=1300000000171, Name="图形验证码", Code=ConfigConst.SysCaptcha, Value="True", SysFlag=YesNoEnum.Y, Remark="是否开启图形验证码", OrderNo=80, GroupCode="WebConfig", CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
new SysConfig{ Id=1300000000181, Name="Token过期时间", Code=ConfigConst.SysTokenExpire, Value="10080", SysFlag=YesNoEnum.Y, Remark="Token过期时间分钟", OrderNo=90, GroupCode="Default", CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
new SysConfig{ Id=1300000000191, Name="RefreshToken过期时间", Code=ConfigConst.SysRefreshTokenExpire, Value="20160", SysFlag=YesNoEnum.Y, Remark="刷新Token过期时间分钟一般 refresh_token 的有效时间 > 2 * access_token 的有效时间)", OrderNo=100, GroupCode="Default", CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
new SysConfig{ Id=1300000000201, Name="发送异常日志邮件", Code=ConfigConst.SysErrorMail, Value="True", SysFlag=YesNoEnum.Y, Remark="是否发送异常日志邮件", OrderNo=110, GroupCode="Default", CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
new SysConfig{ Id=1300000000201, Name="发送异常日志邮件", Code=ConfigConst.SysErrorMail, Value="False", SysFlag=YesNoEnum.Y, Remark="是否发送异常日志邮件", OrderNo=110, GroupCode="Default", CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
new SysConfig{ Id=1300000000211, Name="域登录验证", Code=ConfigConst.SysDomainLogin, Value="False", SysFlag=YesNoEnum.Y, Remark="是否开启域登录验证", OrderNo=120, GroupCode="Default", CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
new SysConfig{ Id=1300000000221, Name="数据校验日志", Code=ConfigConst.SysValidationLog, Value="True", SysFlag=YesNoEnum.Y, Remark="是否数据校验日志", OrderNo=130, GroupCode="Default", CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
new SysConfig{ Id=1300000000231, Name="行政区域同步层级", Code=ConfigConst.SysRegionSyncLevel, Value="3", SysFlag=YesNoEnum.Y, Remark="行政区域同步层级 1-省级,2-市级,3-区县级,4-街道级,5-村级", OrderNo=140, GroupCode="Default", CreateTime=DateTime.Parse("2022-02-10 00:00:00") },

View File

@ -20,22 +20,11 @@ public class SysOrgSeedData : ISqlSugarEntitySeedData<SysOrg>
{
return new[]
{
new SysOrg{ Id=SqlSugarConst.DefaultTenantId, Pid=0, Name="XXX公司", Code="1001", Type="101", Level=1, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="XXX公司", TenantId=SqlSugarConst.DefaultTenantId },
new SysOrg{ Id=SqlSugarConst.DefaultTenantId, Pid=0, Name="系统默认", Code="1001", Type="101", Level=1, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="系统默认", TenantId=SqlSugarConst.DefaultTenantId },
new SysOrg{ Id=SqlSugarConst.DefaultTenantId + 1, Pid=SqlSugarConst.DefaultTenantId, Name="市场部", Code="100101", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="市场部", TenantId=SqlSugarConst.DefaultTenantId },
new SysOrg{ Id=SqlSugarConst.DefaultTenantId + 2, Pid=SqlSugarConst.DefaultTenantId, Name="研发部", Code="100102", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="研发部", TenantId=SqlSugarConst.DefaultTenantId },
new SysOrg{ Id=SqlSugarConst.DefaultTenantId + 3, Pid=SqlSugarConst.DefaultTenantId, Name="财务部", Code="100103", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="财务部", TenantId=SqlSugarConst.DefaultTenantId },
new SysOrg{ Id=SqlSugarConst.DefaultTenantId + 4, Pid=SqlSugarConst.DefaultTenantId, Name="财务部1", Code="10010301", Level=3, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="财务部1", TenantId=SqlSugarConst.DefaultTenantId },
new SysOrg{ Id=SqlSugarConst.DefaultTenantId + 5, Pid=SqlSugarConst.DefaultTenantId, Name="财务部2", Code="10010302", Level=3, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="财务部2", TenantId=SqlSugarConst.DefaultTenantId },
new SysOrg{ Id=1300000000201, Pid=0, Name="分公司1", Code="1002", Type="201", Level=1, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="分公司1", TenantId=SqlSugarConst.DefaultTenantId },
new SysOrg{ Id=1300000000202, Pid=1300000000201, Name="市场部", Code="100201", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="市场部", TenantId=SqlSugarConst.DefaultTenantId },
new SysOrg{ Id=1300000000203, Pid=1300000000201, Name="研发部", Code="100202", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="研发部", TenantId=SqlSugarConst.DefaultTenantId },
new SysOrg{ Id=1300000000204, Pid=1300000000201, Name="财务部", Code="100203", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="财务部", TenantId=SqlSugarConst.DefaultTenantId },
new SysOrg{ Id=1300000000301, Pid=0, Name="分公司2", Code="1003", Type="201", Level=1, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="分公司2", TenantId=SqlSugarConst.DefaultTenantId },
new SysOrg{ Id=1300000000302, Pid=1300000000301, Name="市场部", Code="100301", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="市场部", TenantId=SqlSugarConst.DefaultTenantId },
new SysOrg{ Id=1300000000303, Pid=1300000000301, Name="研发部", Code="100302", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="市场部", TenantId=SqlSugarConst.DefaultTenantId },
new SysOrg{ Id=1300000000304, Pid=1300000000301, Name="财务部", Code="100303", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="市场部", TenantId=SqlSugarConst.DefaultTenantId },
new SysOrg{ Id=SqlSugarConst.DefaultTenantId + 2, Pid=SqlSugarConst.DefaultTenantId, Name="开发部", Code="100102", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="开发部", TenantId=SqlSugarConst.DefaultTenantId },
new SysOrg{ Id=SqlSugarConst.DefaultTenantId + 3, Pid=SqlSugarConst.DefaultTenantId, Name="售后部", Code="100103", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="售后部", TenantId=SqlSugarConst.DefaultTenantId },
new SysOrg{ Id=SqlSugarConst.DefaultTenantId + 4, Pid=SqlSugarConst.DefaultTenantId, Name="其他", Code="10010301", Level=3, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="其他", TenantId=SqlSugarConst.DefaultTenantId },
};
}
}

View File

@ -56,4 +56,17 @@ public class SyncInput
/// 指定市
/// </summary>
public string City { get; set; }
}
public class GenOrgInput
{
/// <summary>
/// 区域Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 生成层级
/// </summary>
public int Level { get; set; }
}

View File

@ -335,11 +335,60 @@ public class SysRegionService : IDynamicApiController, ITransient
/// <summary>
/// 生成组织架构
/// </summary>
/// <param name="Id"></param>
/// <param name="input"></param>
/// <returns></returns>
[DisplayName("生成组织架构")]
public async Task GenOrg(long Id)
public async Task GenOrg(GenOrgInput input)
{
await Task.CompletedTask;
var region = await _sysRegionRep.GetByIdAsync(input.Id);
var orgRep = _sysRegionRep.ChangeRepository<SqlSugarRepository<SysOrg>>();
if (!await orgRep.IsAnyAsync(u => u.Id == region.Pid))
region.Pid = 0;
var regionList = await GetRegionListByLevel(region, input.Level);
var orgList = regionList.Adapt<List<SysOrg>>();
await orgRep.InsertOrUpdateAsync(orgList);
}
/// <summary>
/// 根据层级获取行政区域数据
/// </summary>
/// <param name="region"></param>
/// <param name="level"></param>
/// <returns></returns>
private async Task<List<SysRegion>> GetRegionListByLevel(SysRegion region, int level)
{
var regionList = new List<SysRegion>();
if (level > 5) level = 5;
regionList.Add(region);
if (level == 1) return regionList;
var regionList2 = await GetList(new RegionInput { Id = region.Id });
regionList.AddRange(regionList2);
if (level == 2) return regionList;
foreach (var item in regionList2)
{
var regionList3 = await GetList(new RegionInput { Id = item.Id });
if (regionList3 == null) continue;
regionList.AddRange(regionList3);
if (level == 3) continue;
foreach (var item3 in regionList3)
{
var regionList4 = await GetList(new RegionInput { Id = item3.Id });
if (regionList4 == null) continue;
regionList.AddRange(regionList4);
if (level == 4) continue;
foreach (var item4 in regionList4)
{
var regionList5 = await GetList(new RegionInput { Id = item4.Id });
if (regionList5 == null) continue;
regionList.AddRange(regionList5);
}
}
}
return regionList;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@ -87,7 +87,7 @@
"@typescript-eslint/eslint-plugin": "^8.1.0",
"@typescript-eslint/parser": "^8.1.0",
"@vitejs/plugin-vue": "^5.1.2",
"@vitejs/plugin-vue-jsx": "^4.0.0",
"@vitejs/plugin-vue-jsx": "^4.0.1",
"@vue/compiler-sfc": "^3.4.37",
"code-inspector-plugin": "^0.15.2",
"eslint": "^9.9.0",

View File

@ -23,6 +23,7 @@ import { AdminResultInt64 } from '../models';
import { AdminResultListSysRegion } from '../models';
import { AdminResultSqlSugarPagedListSysRegion } from '../models';
import { DeleteRegionInput } from '../models';
import { GenOrgInput } from '../models';
import { PageRegionInput } from '../models';
import { SyncInput } from '../models';
import { UpdateRegionInput } from '../models';
@ -131,17 +132,12 @@ export const SysRegionApiAxiosParamCreator = function (configuration?: Configura
/**
*
* @summary
* @param {number} id
* @param {GenOrgInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiSysRegionGenOrgIdPost: async (id: number, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new RequiredError('id','Required parameter id was null or undefined when calling apiSysRegionGenOrgIdPost.');
}
const localVarPath = `/api/sysRegion/genOrg/{id}`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
apiSysRegionGenOrgPost: async (body?: GenOrgInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/api/sysRegion/genOrg`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
let baseOptions;
@ -161,6 +157,8 @@ export const SysRegionApiAxiosParamCreator = function (configuration?: Configura
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
}
localVarHeaderParameter['Content-Type'] = 'application/json-patch+json';
const query = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) {
query.set(key, localVarQueryParameter[key]);
@ -171,6 +169,8 @@ export const SysRegionApiAxiosParamCreator = function (configuration?: Configura
localVarUrlObj.search = (new URLSearchParams(query)).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
@ -462,12 +462,12 @@ export const SysRegionApiFp = function(configuration?: Configuration) {
/**
*
* @summary
* @param {number} id
* @param {GenOrgInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async apiSysRegionGenOrgIdPost(id: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
const localVarAxiosArgs = await SysRegionApiAxiosParamCreator(configuration).apiSysRegionGenOrgIdPost(id, options);
async apiSysRegionGenOrgPost(body?: GenOrgInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
const localVarAxiosArgs = await SysRegionApiAxiosParamCreator(configuration).apiSysRegionGenOrgPost(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
@ -575,12 +575,12 @@ export const SysRegionApiFactory = function (configuration?: Configuration, base
/**
*
* @summary
* @param {number} id
* @param {GenOrgInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async apiSysRegionGenOrgIdPost(id: number, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
return SysRegionApiFp(configuration).apiSysRegionGenOrgIdPost(id, options).then((request) => request(axios, basePath));
async apiSysRegionGenOrgPost(body?: GenOrgInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
return SysRegionApiFp(configuration).apiSysRegionGenOrgPost(body, options).then((request) => request(axios, basePath));
},
/**
*
@ -667,13 +667,13 @@ export class SysRegionApi extends BaseAPI {
/**
*
* @summary
* @param {number} id
* @param {GenOrgInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SysRegionApi
*/
public async apiSysRegionGenOrgIdPost(id: number, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
return SysRegionApiFp(this.configuration).apiSysRegionGenOrgIdPost(id, options).then((request) => request(this.axios, this.basePath));
public async apiSysRegionGenOrgPost(body?: GenOrgInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
return SysRegionApiFp(this.configuration).apiSysRegionGenOrgPost(body, options).then((request) => request(this.axios, this.basePath));
}
/**
*

View File

@ -0,0 +1,38 @@
/* tslint:disable */
/* eslint-disable */
/**
* Admin.NET
* .NET <br/><u><b><font color='FF0000'> 👮</font></b></u>
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/**
*
*
* @export
* @interface GenOrgInput
*/
export interface GenOrgInput {
/**
* Id
*
* @type {number}
* @memberof GenOrgInput
*/
id?: number;
/**
*
*
* @type {number}
* @memberof GenOrgInput
*/
level?: number;
}

View File

@ -196,6 +196,7 @@ export * from './filter-operator-enum';
export * from './finish-status-enum';
export * from './from';
export * from './gen-auth-url-input';
export * from './gen-org-input';
export * from './gender-enum';
export * from './generate-qrimage-input';
export * from './generate-qrimage-output';

View File

@ -85,18 +85,18 @@ export interface PageSysWechatPayInput {
/**
* order_id
*
* @type {number}
* @type {string}
* @memberof PageSysWechatPayInput
*/
orderId?: number | null;
orderId?: string | null;
/**
* order_status
*
* @type {number}
* @type {string}
* @memberof PageSysWechatPayInput
*/
orderStatus?: number | null;
orderStatus?: string | null;
/**
* out_trade_number

View File

@ -55,18 +55,18 @@ export interface RefundRequestInput {
/**
*
*
* @type {number}
* @type {string}
* @memberof RefundRequestInput
*/
orderId?: number;
orderId?: string | null;
/**
* ()
*
* @type {number}
* @type {string}
* @memberof RefundRequestInput
*/
orderStatus?: number;
orderStatus?: string | null;
/**
*

View File

@ -87,18 +87,18 @@ export interface SysWechatPay {
/**
*
*
* @type {number}
* @type {string}
* @memberof SysWechatPay
*/
orderId?: number;
orderId?: string | null;
/**
* ()
*
* @type {number}
* @type {string}
* @memberof SysWechatPay
*/
orderStatus?: number;
orderStatus?: string | null;
/**
*

View File

@ -63,16 +63,16 @@ export interface WechatPayTransactionInput {
/**
*
*
* @type {number}
* @type {string}
* @memberof WechatPayTransactionInput
*/
orderId?: number;
orderId?: string | null;
/**
* ()
*
* @type {number}
* @type {string}
* @memberof WechatPayTransactionInput
*/
orderStatus?: number;
orderStatus?: string | null;
}

View File

@ -7,7 +7,7 @@
<span> {{ props.title }} </span>
</div>
</template>
<div style="color: red; padding: 15px 15px; background: #faecd8; margin-bottom: 10px">
<div style="color: red; padding: 10px 10px; background: #faecd8; margin-bottom: 10px">
<el-icon style="transform: translateY(2px)"><ele-Bell /></el-icon>
<span> 如果是在前端生成的实体/在生成表选择项里面找不到请重启后台服务后再进行代码生成 </span>
</div>
@ -62,7 +62,7 @@
<div>
生成表
<el-tooltip raw-content content="如果是在前端生成的实体/表(在生成表选择项里面找不到),请重启后台服务后再进行代码生成。" placement="top">
<SvgIcon name="fa fa-question-circle-o" :size="16" />
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"><ele-QuestionFilled /></el-icon>
</el-tooltip>
</div>
</template>
@ -135,6 +135,14 @@
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="接口模式" prop="isApiService">
<template v-slot:label>
<div>
接口模式
<el-tooltip raw-content content="API Service 模式是自动生成前端接口请求文件,推荐此模式。不使用则是指自定义前端接口请求。" placement="top">
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"><ele-QuestionFilled /></el-icon>
</el-tooltip>
</div>
</template>
<el-radio-group v-model="state.ruleForm.isApiService">
<el-radio :value="true">使用API Service</el-radio>
<el-radio :value="false">不使用</el-radio>

View File

@ -45,7 +45,7 @@
>
<template #default="{ node }">
<el-icon v-if="node.level == 1" size="16" style="margin-right: 3px; display: inline; vertical-align: middle"><ele-School /></el-icon>
<el-icon v-else-if="node.level == 2" size="16" style="margin-right: 3px; display: inline; vertical-align: middle"><ele-PriceTag /></el-icon>
<el-icon v-else-if="node.level == 2" size="16" style="margin-right: 3px; display: inline; vertical-align: middle"><ele-Refrigerator /></el-icon>
<el-icon v-else size="16" style="margin-right: 3px; display: inline; vertical-align: middle"><ele-CollectionTag /></el-icon>
{{ node.label }}
</template>

View File

@ -0,0 +1,97 @@
<template>
<div class="sys-region-container">
<el-dialog v-model="state.isShowDialog" draggable overflow destroy-on-close width="500px">
<template #header>
<div style="color: #fff">
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>
<span> {{ props.title }} </span>
</div>
</template>
<div style="color: red; padding: 10px 10px; background: #faecd8; margin-bottom: 10px">
<el-icon style="transform: translateY(2px)"><ele-Bell /></el-icon>
<span> 只会更新和新增组织架构不会删除已有的组织架构数据 </span>
</div>
<el-form :model="state.ruleForm" ref="ruleFormRef" label-width="auto" label-position="top">
<el-row :gutter="10">
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
<el-form-item label="选择层级" prop="level" :rules="[{ required: true, message: '请选择层级', trigger: 'blur' }]">
<el-select v-model="state.ruleForm.level" filterable clearable class="w100">
<el-option :label="1" :value="1" />
<el-option :label="2" :value="2" />
<el-option :label="3" :value="3" />
<el-option :label="4" :value="4" />
<el-option :label="5" :value="5" />
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="cancel"> </el-button>
<el-button type="primary" v-loading="state.loading" @click="submit"> </el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<script lang="ts" setup>
import { reactive, ref } from 'vue';
import { ElMessage, ElNotification } from 'element-plus';
import { getAPI } from '/@/utils/axios-utils';
import { SysRegionApi } from '/@/api-services/api';
const props = defineProps({
title: String,
});
const emits = defineEmits(['handleQuery']);
const ruleFormRef = ref();
const state = reactive({
loading: false,
ruleForm: { level: 3 } as any,
isShowDialog: false,
});
//
const openDialog = (id: any) => {
if (!id) ElMessage.error('行政区域数据错误!');
state.ruleForm.id = id;
ruleFormRef.value?.resetFields();
state.isShowDialog = true;
};
//
const closeDialog = () => {
emits('handleQuery');
state.isShowDialog = false;
};
//
const cancel = () => {
state.isShowDialog = false;
};
//
const submit = () => {
ruleFormRef.value.validate(async (valid: boolean) => {
if (!valid) return;
ElNotification({
title: '提示',
message: '努力生成中...',
type: 'success',
position: 'bottom-right',
});
state.loading = true;
await getAPI(SysRegionApi).apiSysRegionGenOrgPost(state.ruleForm);
closeDialog();
ElMessage.success('生成成功');
});
};
//
defineExpose({ openDialog });
</script>

View File

@ -0,0 +1,87 @@
<template>
<div class="sys-region-container">
<el-dialog v-model="state.isShowDialog" draggable overflow destroy-on-close width="500px">
<template #header>
<div style="color: #fff">
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>
<span> {{ props.title }} </span>
</div>
</template>
<el-form :model="state.ruleForm" ref="ruleFormRef" label-width="auto" label-position="top">
<el-row :gutter="10">
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
<el-form-item label="指定区划代码" prop="code" :rules="[{ required: true, message: '区划代码不能为空', trigger: 'blur' }]">
<el-input v-model="state.ruleForm.code" placeholder="指定区划代码" clearable />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<span class="dialog-footer">
<a href="https://www.stats.gov.cn/sj/tjbz/tjyqhdmhcxhfdm/2023/index.html" target="_blank" style="float: left">查看区划代码国家统计局</a>
<el-button @click="cancel"> </el-button>
<el-button type="primary" v-loading="state.loading" @click="submit"> </el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<script lang="ts" setup>
import { reactive, ref } from 'vue';
import { ElMessage, ElNotification } from 'element-plus';
import { getAPI } from '/@/utils/axios-utils';
import { SysRegionApi } from '/@/api-services/api';
const props = defineProps({
title: String,
});
const emits = defineEmits(['handleQuery']);
const ruleFormRef = ref();
const state = reactive({
loading: false,
ruleForm: {} as any,
isShowDialog: false,
});
//
const openDialog = () => {
state.ruleForm.code = '';
ruleFormRef.value?.resetFields();
state.isShowDialog = true;
};
//
const closeDialog = () => {
emits('handleQuery');
state.isShowDialog = false;
};
//
const cancel = () => {
state.isShowDialog = false;
};
//
const submit = () => {
ruleFormRef.value.validate(async (valid: boolean) => {
if (!valid) return;
ElNotification({
title: '提示',
message: '努力同步中...',
type: 'success',
position: 'bottom-right',
});
state.loading = true;
await getAPI(SysRegionApi).apiSysRegionSyncRegionMcaCodePost(state.ruleForm.code);
closeDialog();
ElMessage.success('生成成功');
});
};
//
defineExpose({ openDialog });
</script>

View File

@ -0,0 +1,99 @@
<template>
<div class="sys-region-container">
<el-dialog v-model="state.isShowDialog" draggable overflow destroy-on-close width="500px">
<template #header>
<div style="color: #fff">
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>
<span> {{ props.title }} </span>
</div>
</template>
<div style="color: red; padding: 10px 10px; background: #faecd8; margin-bottom: 10px">
<el-icon style="transform: translateY(2px)"><ele-Bell /></el-icon>
<span> 不建议不指定任何省市名称直接生成全国区划数据数据超大 </span>
</div>
<el-form :model="state.ruleForm" ref="ruleFormRef" label-width="auto" label-position="top">
<el-row :gutter="10">
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
<el-form-item label="省级名称">
<el-input v-model="state.ruleForm.province" placeholder="指定省级名称" clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
<el-form-item label="市级名称">
<el-input v-model="state.ruleForm.city" placeholder="指定市级名称" clearable />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<span class="dialog-footer">
<a href="https://www.stats.gov.cn/sj/tjbz/tjyqhdmhcxhfdm/2023/index.html" target="_blank" style="float: left">查看区划名称国家统计局</a>
<el-button @click="cancel"> </el-button>
<el-button type="primary" v-loading="state.loading" @click="submit"> </el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<script lang="ts" setup>
import { reactive, ref } from 'vue';
import { ElMessage, ElNotification } from 'element-plus';
import { getAPI } from '/@/utils/axios-utils';
import { SysRegionApi } from '/@/api-services/api';
const props = defineProps({
title: String,
});
const emits = defineEmits(['handleQuery']);
const ruleFormRef = ref();
const state = reactive({
loading: false,
ruleForm: {} as any,
isShowDialog: false,
});
//
const openDialog = () => {
ruleFormRef.value?.resetFields();
state.isShowDialog = true;
};
//
const closeDialog = () => {
emits('handleQuery');
state.isShowDialog = false;
};
//
const cancel = () => {
state.isShowDialog = false;
};
//
const submit = () => {
ruleFormRef.value.validate(async (valid: boolean) => {
if (!valid) return;
if (!state.ruleForm.city || !state.ruleForm.province) {
ElMessage.error('不能单独指定市级!');
return;
}
ElNotification({
title: '提示',
message: '努力同步中...',
type: 'success',
position: 'bottom-right',
});
state.loading = true;
await getAPI(SysRegionApi).apiSysRegionSyncRegionStatsPost(state.ruleForm);
closeDialog();
ElMessage.success('生成成功');
});
};
//
defineExpose({ openDialog });
</script>

View File

@ -64,6 +64,9 @@
</splitpanes>
<EditRegion ref="editRegionRef" :title="state.title" @handleQuery="handleQuery" />
<SyncStatsParam ref="syncStatsParamRef" :title="state.title" @handleQuery="handleQuery" />
<SyncMcaParam ref="syncMcaParamRef" :title="state.title" @handleQuery="handleQuery" />
<GenOrgLevel ref="genOrgLevelRef" :title="state.title" @handleQuery="handleQuery" />
</div>
</template>
@ -78,6 +81,9 @@ import 'splitpanes/dist/splitpanes.css';
import RegionTree from '/@/views/system/region/component/regionTree.vue';
import EditRegion from '/@/views/system/region/component/editRegion.vue';
import SyncStatsParam from '/@/views/system/region/component/syncStatsParam.vue';
import SyncMcaParam from '/@/views/system/region/component/syncMcaParam.vue';
import GenOrgLevel from '/@/views/system/region/component/genOrgLevel.vue';
import { getAPI } from '/@/utils/axios-utils';
import { SysRegionApi } from '/@/api-services/api';
@ -85,6 +91,9 @@ import { SysRegion, PageRegionInput } from '/@/api-services/models';
const xGrid = ref<VxeGridInstance>();
const editRegionRef = ref<InstanceType<typeof EditRegion>>();
const syncStatsParamRef = ref<InstanceType<typeof SyncStatsParam>>();
const syncMcaParamRef = ref<InstanceType<typeof SyncMcaParam>>();
const genOrgLevelRef = ref<InstanceType<typeof GenOrgLevel>>();
const regionTreeRef = ref<InstanceType<typeof RegionTree>>();
const state = reactive({
queryParams: {
@ -223,57 +232,20 @@ const handleNodeChange = async (node: any) => {
//
const syncRegionStats = async () => {
ElMessageBox.confirm('确认同步国家统计局行政区域数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
ElNotification({
title: '提示',
message: '努力同步中...',
type: 'success',
position: 'bottom-right',
});
await getAPI(SysRegionApi).apiSysRegionSyncRegionStatsPost(); // { timeout: 1000 * 60 * 30 }
await handleQuery();
ElMessage.success('同步成功');
})
.catch(() => {});
state.title = '同步国家统计局行政区域数据';
syncStatsParamRef.value?.openDialog();
};
//
const syncRegionMca = async () => {
ElMessageBox.confirm('确认同步国家地名信息库行政区域数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
ElNotification({
title: '提示',
message: '努力同步中...',
type: 'success',
position: 'bottom-right',
});
await getAPI(SysRegionApi).apiSysRegionSyncRegionMcaCodePost(110100000000);
await handleQuery();
ElMessage.success('同步成功');
})
.catch(() => {});
state.title = '同步国家地名信息库行政区域数据';
syncMcaParamRef.value?.openDialog();
};
//
const genOrg = (row: any) => {
ElMessageBox.confirm('确认生成/更新系统组织架构?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
await getAPI(SysRegionApi).apiSysRegionGenOrgIdPost(row.id);
})
.catch(() => {});
state.title = '生成/更新系统组织架构';
genOrgLevelRef.value?.openDialog(row.id);
};
//