From 934625771bb7ba786288d1cad45f5945c8ced4b7 Mon Sep 17 00:00:00 2001
From: Alidada233 <805483097@qq.com>
Date: Fri, 24 Jun 2022 13:46:37 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 2 +-
src/api/platform/system/controller/area.ts | 30 +++
src/api/platform/system/entity/area.ts | 30 +++
src/views/system/area/AreaModal.vue | 84 ++++++++
src/views/system/area/area.data.ts | 191 +++++++++++++++++++
src/views/system/area/index.vue | 112 +++++++++++
src/views/system/dept/index.vue | 211 ++++++++++-----------
7 files changed, 552 insertions(+), 108 deletions(-)
create mode 100644 src/api/platform/system/controller/area.ts
create mode 100644 src/api/platform/system/entity/area.ts
create mode 100644 src/views/system/area/AreaModal.vue
create mode 100644 src/views/system/area/area.data.ts
create mode 100644 src/views/system/area/index.vue
diff --git a/.env.development b/.env.development
index 5be9756..09279ca 100644
--- a/.env.development
+++ b/.env.development
@@ -4,7 +4,7 @@ VITE_PUBLIC_PATH = /
# 本地开发代理,可以解决跨域及多地址代理
# 如果接口地址匹配到,则会转发到http://localhost:3000,防止本地出现跨域问题
# 可以有多个,注意多个不能换行,否则代理将会失效
-VITE_PROXY = [["/api","http://localhost:9999"],["/upload","http://localhost:9999/system_proxy/system/file/upload"]]
+VITE_PROXY = [["/api","http://192.168.3.10:9999"],["/upload","http://192.168.3.10:9999/system_proxy/system/file/upload"]]
# 是否删除console.log
VITE_DROP_CONSOLE = false
diff --git a/src/api/platform/system/controller/area.ts b/src/api/platform/system/controller/area.ts
new file mode 100644
index 0000000..a8d4536
--- /dev/null
+++ b/src/api/platform/system/controller/area.ts
@@ -0,0 +1,30 @@
+/**
+ * 提供api模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致
+ * Copyright © 2020-2022 entfrm All rights reserved.
+ * author entfrm开发团队-王翔
+ */
+import type { AreaParams, Area } from '/@/api/platform/system/entity/area';
+import { defHttp } from '/@/utils/http/axios';
+
+enum Api {
+ list = '/system_proxy/system/address/queryByParentId',
+ add = '/system_proxy/system/address/save',
+ get = '/system_proxy/system/address/query',
+ edit = '/system_proxy/system/address/update',
+ del = '/system_proxy/system/address/remove',
+}
+
+/** 查询区域列表 */
+export const listArea = (params?: Partial) => defHttp.get({ url: Api.list, params });
+
+/** 新增区域 */
+export const addArea = (params: Partial) => defHttp.post({ url: Api.add, data: params });
+
+/** 修改区域 */
+export const editArea = (params: Partial) => defHttp.put({ url: Api.edit, data: params });
+
+/** 查询区域详细 */
+export const getArea = (id: string) => defHttp.get({ url: `${Api.get}/${id}` });
+
+/** 删除区域 */
+export const delArea = (id: string) => defHttp.delete({ url: `${Api.del}/${id}` });
diff --git a/src/api/platform/system/entity/area.ts b/src/api/platform/system/entity/area.ts
new file mode 100644
index 0000000..773a276
--- /dev/null
+++ b/src/api/platform/system/entity/area.ts
@@ -0,0 +1,30 @@
+/**
+ * @program: kicc-ui
+ * @description: 区域实体类
+ * 类型定义
+ * @author: entfrm开发团队-王翔
+ * @create: 2022/4/8
+ */
+import type { R } from '/#/axios';
+import type { CommonEntity, Page } from '/@/api/common/data/entity';
+
+/** 区域查询参数 */
+export type AreaParams = Page & Area;
+
+/** 区域对象 */
+export interface Area extends CommonEntity {
+ areaId: string;
+ code: string;
+ name: string;
+ parentId: string;
+ sort: number;
+ contacts: string;
+ phone: string;
+ address: string;
+ email: string;
+ status: string;
+ [key: string]: any;
+}
+
+/** 区域响应对象 */
+export type AreaResult = R;
diff --git a/src/views/system/area/AreaModal.vue b/src/views/system/area/AreaModal.vue
new file mode 100644
index 0000000..d7ab948
--- /dev/null
+++ b/src/views/system/area/AreaModal.vue
@@ -0,0 +1,84 @@
+
+
+
+
+
+
diff --git a/src/views/system/area/area.data.ts b/src/views/system/area/area.data.ts
new file mode 100644
index 0000000..7332c61
--- /dev/null
+++ b/src/views/system/area/area.data.ts
@@ -0,0 +1,191 @@
+/**
+ * @program: kicc-ui
+ * @description: 区域模块动态渲染配置
+ * @author: entfrm开发团队-王翔
+ * @create: 2022/4/21
+ */
+
+import { BasicColumn } from '/@/components/Table';
+import { FormSchema } from '/@/components/Table';
+import { h } from 'vue';
+import { Tag } from 'ant-design-vue';
+
+/** 表格列配置 */
+export const columns: BasicColumn[] = [
+ {
+ title: '区域名称',
+ dataIndex: 'name',
+ align: 'left'
+ },
+ {
+ title: '区域编码',
+ dataIndex: 'code'
+ },
+ {
+ title: '排序',
+ dataIndex: 'sort'
+ },
+ {
+ title: '状态',
+ dataIndex: 'status',
+ width: 80,
+ customRender: ({record}) => {
+ const status = record.status;
+ // 采用二进制~~取反,只要为null或者0等等一些其他的空元素都会转为0
+ // 第一次取反会运算为-1,在后一次取反会运算为0
+ const enable = ~~status === 0;
+ const color = enable ? 'green' : 'red';
+ const text = enable ? '正常' : '停用';
+ return h(Tag, { color: color }, () => text);
+ }
+ },
+ {
+ title: '创建时间',
+ dataIndex: 'createTime'
+ }
+];
+
+/** 搜索表单配置 */
+export const searchFormSchema: FormSchema[] = [
+ {
+ field: 'name',
+ label: '区域名称',
+ component: 'Input',
+ componentProps: {
+ placeholder: '请输入区域名称'
+ },
+ colProps: {span: 8}
+ },
+ {
+ field: 'status',
+ label: '状态',
+ component: 'Select',
+ componentProps: {
+ options: [
+ { label: '正常', value: '0' },
+ { label: '停用', value: '1' }
+ ]
+ },
+ colProps: { span: 7 }
+ },
+ {
+ field: 'dateRange',
+ label: '创建时间',
+ component: 'RangePicker',
+ componentProps: {
+ style: { width:'100%' },
+ valueFormat: 'YYYY-MM-DD',
+ placeholder: ['开始日期','结束日期']
+ },
+ colProps: { span: 8 }
+ }
+];
+
+/** 表单配置 */
+export const formSchema: FormSchema[] = [
+ {
+ field: 'areaId',
+ label: 'ID',
+ component: 'Input',
+ show: false
+ },
+ {
+ field: 'parentId',
+ label: '上级区域',
+ component: 'TreeSelect',
+ defaultValue: '0',
+ componentProps: {
+ replaceFields: {
+ title: 'name',
+ key: 'areaId',
+ value: 'areaId',
+ },
+ getPopupContainer: () => document.body,
+ }
+ },
+ {
+ field: 'name',
+ label: '区域名称',
+ component: 'Input',
+ required: true,
+ colProps: {
+ span: 12
+ }
+ },
+ {
+ field: 'code',
+ label: '区域代码',
+ component: 'Input',
+ required: true,
+ colProps: {
+ span: 12
+ }
+ },
+ {
+ field: 'contacts',
+ label: '联系人',
+ component: 'Input',
+ colProps: {
+ span: 12
+ }
+ },
+ {
+ field: 'phone',
+ label: '联系人电话',
+ component: 'Input',
+ rules: [
+ {
+ pattern: new RegExp('^1[3|4|5|6|7|8|9][0-9]\\d{8}$'),
+ message: '请输入正确的手机号码!',
+ validateTrigger: 'change'
+ }
+ ],
+ colProps: {
+ span: 12
+ }
+ },
+ {
+ field: 'sort',
+ label: '区域排序',
+ component: 'InputNumber',
+ componentProps: {
+ style: { width:'100%' },
+ min: 0
+ },
+ required: true,
+ colProps: {
+ span: 12
+ }
+ },
+ {
+ field: 'email',
+ label: '邮箱',
+ component: 'Input',
+ rules: [
+ {
+ type: 'email',
+ message: '请输入正确的邮箱地址!',
+ validateTrigger: 'change'
+ }
+ ],
+ colProps: {
+ span: 12
+ }
+ },
+ {
+ field: 'status',
+ label: '状态',
+ component: 'RadioGroup',
+ defaultValue: '0',
+ componentProps: {
+ options: [
+ { label: '正常', value: '0' },
+ { label: '停用', value: '1' }
+ ]
+ },
+ required: true,
+ colProps: {
+ span: 12
+ }
+ }
+];
diff --git a/src/views/system/area/index.vue b/src/views/system/area/index.vue
new file mode 100644
index 0000000..a65f8ea
--- /dev/null
+++ b/src/views/system/area/index.vue
@@ -0,0 +1,112 @@
+
+
+
+
+ 新增区域
+ 展开全部
+ 折叠全部
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue
index 8ea3b54..26542a2 100644
--- a/src/views/system/dept/index.vue
+++ b/src/views/system/dept/index.vue
@@ -1,115 +1,112 @@
-
-
-
- 新增部门
- 展开全部
- 折叠全部
-
-
-
-
-
-
-
+
+
+
+ 新增部门
+ 展开全部
+ 折叠全部
+
+
+
+
+
+
+