刘冰洁 1 vuosi sitten
vanhempi
commit
4a8c0b0a3d

+ 1 - 1
.vscode/settings.json

@@ -43,7 +43,7 @@
   "terminal.integrated.fontWeight": 500,
   "terminal.integrated.tabs.enabled": true,
   "workbench.iconTheme": "material-icon-theme",
-  "workbench.colorTheme": "One Dark Pro",
+  "workbench.colorTheme": "蓝色空间——浅色🌷",
   "[html]": {
     "editor.defaultFormatter": "esbenp.prettier-vscode"
   },

+ 0 - 1
package.json

@@ -46,7 +46,6 @@
     "typecheck": "vue-tsc --noEmit --skipLibCheck",
     "lint": "eslint . --fix --ext .js,.jsx,.mjs,.json,.ts,.tsx,.vue",
     "format": "soy prettier-format",
-    "commit": "soy git-commit",
     "cleanup": "soy cleanup",
     "update-pkg": "soy update-pkg",
     "tsx": "tsx",

+ 0 - 0
src/service/api/man.ts


+ 47 - 5
src/service/api/user.ts

@@ -38,12 +38,12 @@ export function update(params: UpdateParams) {
 export interface QueryParams {
   id?: number;
   name?: string;
-  isActive?: Record<string, unknown>;
-  createTime?: Record<string, unknown>;
-  modifyTime?: Record<string, unknown>;
+  description?: string;
+  isActive?: string;
+  createTime?: string;
+  modifyTime?:string;
   createUid?: number;
   disabled?: string;
-  description?: string;
 }
 
 // 响应接口
@@ -67,6 +67,48 @@ export interface QueryRes {
  * @param {string} params.description 权限描述
  * @returns
  */
-export function query(pageNum: number, pageSize: number, params: QueryParams) {
+export function query(pageNum: number, pageSize: number, params: QueryParams){
   return request.post(`/permission/query?pageNum=${pageNum}&pageSize=${pageSize}`, params);
 }
+// 参数接口
+export interface Query_1Params {
+  id?: number;
+  depname?: string;
+  address?: string;
+  phone?: string;
+  email?: string;
+  manager?: string;
+  createTime?: string;
+  modifyTime?: string;
+  createUid?: number;
+  disabled?: string;
+}
+
+// 响应接口
+export interface Query_1Res {
+  status: boolean;
+  msg: string;
+  data: Record<string, unknown>;
+  total: number;
+}
+
+/**
+ * 查询部门
+ * @param {string} pageNum
+  * @param {string} pageSize
+  * @param {object} params EasSysDepartment
+ * @param {number} params.id
+ * @param {string} params.depname 部门名称
+ * @param {string} params.address 部门地址
+ * @param {string} params.phone 部门电话
+ * @param {string} params.email 部门电子邮箱
+ * @param {string} params.manager 部门负责人
+ * @param {object} params.createTime 创建时间
+ * @param {object} params.modifyTime 修改时间
+ * @param {number} params.createUid 创建用户ID
+ * @param {string} params.disabled 状态
+ * @returns
+ */
+export function query_1(pageNum: number, pageSize: number, params: Query_1Params){
+  return request.post(`/department/query?pageNum=${pageNum}&pageSize=${pageSize}`, params);
+}

+ 2 - 1
src/service/request/instance.ts

@@ -63,9 +63,10 @@ export default class CustomAxiosInstance {
         const { status } = response;
         if (status === 200 || status < 300 || status === 304) {
           const backend = response.data;
+					console.log(response);
           const { codeKey, dataKey, successCode } = this.backendConfig;
           // 请求成功
-          if (backend[codeKey] === successCode) {
+          if (backend.msg === "操作成功") {
             return handleServiceResult(null, backend[dataKey]);
           }
 

+ 29 - 0
src/typings/api.copy.ts

@@ -0,0 +1,29 @@
+
+declare namespace ApiUserMa {
+  interface User {
+    /** 用户id */
+		id?: number;
+    /** 用户名 */
+    userName: string | null;
+    /** 用户年龄 */
+    age: number | null;
+    /**
+     * 用户性别
+     * - 0: 女
+     * - 1: 男
+     */
+    gender: '0' | '1' | null;
+    /** 用户手机号码 */
+    phone: string;
+    /** 用户邮箱 */
+    email: string | null;
+    /**
+     * 用户状态
+     * - 1: 启用
+     * - 2: 禁用
+     * - 3: 冻结
+     * - 4: 软删除
+     */
+    userStatus: '1' | '2' | '3' | '4' | null;
+  }
+}

+ 3 - 1
src/views/management/auth/index.vue

@@ -2,6 +2,8 @@
   <div>权限管理</div>
 </template>
 
-<script setup lang="tsx"></script>
+<script setup lang="tsx">
+
+</script>
 
 <style scoped></style>

+ 95 - 15
src/views/management/role/index.vue

@@ -1,21 +1,101 @@
 <template>
-  <div>角色管理</div>
+  <div class="h-full overflow-hidden">
+    <n-card title="权限管理" :bordered="false" class="rounded-16px shadow-sm">
+      <n-data-table :columns="columns" :data="tableData" :pagination="pagination" />
+    </n-card>
+  </div>
 </template>
 
 <script setup lang="ts">
-import type { QueryParams } from '~/src/service/api/user';
+import { ref } from 'vue';
+import type { Ref } from 'vue';
+import type { DataTableColumns, PaginationProps } from 'naive-ui';
 import { query } from '~/src/service/api/user';
-const queryData: QueryParams = {};
-
-query(1, 20, queryData).then(r => {
-  console.log(r);
-});
-// import type { QueryParams } from '~/src/service/api/user';
-// import { query } from '~/src/service/api/user';
-// const queryData: QueryParams = {};
-// query(1, 20, queryData).then(r => {
-//   console.log(r);
-// });
-</script>
+import type { QueryParams } from '~/src/service/api/user';
+
+const tableData = ref<QueryParams[]>([]);
+const pagination: PaginationProps = ref({
+  page: 1,
+  pageSize: 10,
+  showSizePicker: true,
+  pageSizes: [10, 20, 50]
+  // onChange: (page: number) => {
+  //   // 处理页码变化
+  // },
+  // onUpdatePageSize: (pageSize: number) => {
+  //   // 处理每页显示数量变化
+  // }
+}).value;
+
+async function getTableData() {
+  const pageNum = pagination.page as number;
+  const pageSize = pagination.pageSize as number;
 
-<style scoped></style>
+  const params: QueryParams = {
+    name: '',
+    description: '',
+    isActive: '',
+    createTime: '',
+    modifyTime: '',
+    createUid: 0,
+    disabled: ''
+  };
+
+  query(pageNum, pageSize, params).then(res => {
+    console.log(res);
+    tableData.value = res.data as [];
+  });
+}
+
+const columns: Ref<DataTableColumns<QueryParams>> = ref([
+  {
+    type: 'selection',
+    align: 'center'
+  },
+  {
+    key: 'name',
+    title: '部门名称',
+    align: 'center'
+  },
+  {
+    key: 'description',
+    title: '部门地址',
+    align: 'center'
+  },
+  {
+    key: 'isActive',
+    title: '是否激活',
+    align: 'center',
+    render: (row: QueryParams) => {
+      return row.isActive ? '是' : '否';
+    }
+  },
+  {
+    key: 'createTime',
+    title: '创建时间',
+    align: 'center'
+  },
+  {
+    key: 'modifyTime',
+    title: '修改时间',
+    align: 'center'
+  },
+  {
+    key: 'createUid',
+    title: '创建用户ID',
+    align: 'center'
+  },
+  {
+    key: 'disabled',
+    title: '状态',
+    align: 'center'
+  }
+]) as Ref<DataTableColumns<QueryParams>>;
+
+function init() {
+  getTableData();
+}
+
+// 初始化
+init();
+</script>

+ 113 - 0
src/views/management/role/queryUser.vue

@@ -0,0 +1,113 @@
+<template>
+	<div class="h-full overflow-hidden">
+		<n-card title="权限管理" :bordered="false" class="rounded-16px shadow-sm">
+			<n-data-table :columns="columns" :data="tableData" :pagination="pagination" />
+		</n-card>
+	</div>
+</template>
+
+<script setup lang="ts">
+import { ref } from 'vue';
+import type { Ref } from 'vue';
+
+import type { DataTableColumns, PaginationProps } from 'naive-ui';
+
+import { query } from '~/src/service/api/user';
+import type { QueryParams } from '~/src/service/api/user';
+
+const tableData = ref<QueryParams[]>([]);
+
+
+async function getTableData() {
+	const pageNum = pagination.page as number;
+	const pageSize = pagination.pageSize as number;
+
+	const params: QueryParams = {
+		name: '',
+		description: '',
+		isActive: '',
+		createTime: "",
+		modifyTime: "" ,
+		createUid: 0,
+		disabled: '',
+	};
+
+	query(pageNum, pageSize, params).then((res) => {
+			console.log(res);
+			tableData.value =  res.data as[]
+		})
+}
+
+const columns: Ref<DataTableColumns<QueryParams>> = ref([
+	{
+		type: 'selection',
+		align: 'center'
+	},
+	{
+		key: 'depname',
+		title: '部门名称',
+		align: 'center'
+	},
+	{
+		key: 'address',
+		title: '部门地址',
+		align: 'center'
+	},
+	{
+		key: 'phone',
+		title: '部门电话',
+		align: 'center'
+	},
+	{
+		key: 'email',
+		title: '部门电子邮箱',
+		align: 'center',
+	},
+	{
+		key: 'manager',
+		title: '部门负责人',
+		align: 'center'
+	},
+	{
+		key: 'createTime',
+		title: '创建时间',
+		align: 'center'
+	},
+	{
+		key: 'modifyTime',
+		title: '修改时间',
+		align: 'center'
+	},
+	{
+		key: 'createUid',
+		title: '创建用户ID',
+		align: 'center'
+	},
+	{
+		key: 'disabled',
+		title: '状态',
+		align: 'center'
+	},
+
+]) as Ref<DataTableColumns<QueryParams>>;
+
+const pagination: PaginationProps = ref({
+	page: 1,
+	pageSize: 10,
+	showSizePicker: true,
+	pageSizes: [10, 20, 50],
+	onChange: (page: number) => {
+		// 处理页码变化
+	},
+	onUpdatePageSize: (pageSize: number) => {
+		// 处理每页显示数量变化
+	}
+}).value;
+
+function init() {
+	getTableData();
+}
+
+// 初始化
+init();
+</script>

+ 40 - 0
src/views/management/role/userPa.vue

@@ -0,0 +1,40 @@
+<template>
+  <n-space vertical>
+    <n-pagination v-model:page="pageNum" :page-count="pageSize" />
+  </n-space>
+</template>
+
+<script lang="ts">
+import { reactive } from 'vue';
+import { defineComponent, ref } from 'vue';
+import type { QueryParams } from '~/src/service/api/user';
+import { query } from '~/src/service/api/user';
+
+export default defineComponent({
+  setup() {
+		const pageNum = ref(2)
+		const pageSize = ref<any>(10)
+		const queryData = reactive<QueryParams>({})
+		function queryList (){
+			console.log(1);
+
+			// query(1, 10, queryData).then(r => {
+			// 	console.log(r);
+			// });
+		}
+
+    return {
+			// 每页条数, 可自定义 page-size
+      pageNum,
+			//page-count
+      pageSize,
+			queryList,
+			queryData,
+			// page: ref(2),
+      // pageSize: ref(20),
+      // queryData:reactive({})
+    };
+
+  }
+});
+</script>

+ 97 - 185
src/views/management/user/index.vue

@@ -1,203 +1,115 @@
 <template>
-  <div class="h-full overflow-hidden">
-    <n-card title="用户管理" :bordered="false" class="rounded-16px shadow-sm">
-      <n-space class="pb-12px" justify="space-between">
-        <n-space>
-          <n-button type="primary" @click="handleAddTable">
-            <icon-ic-round-plus class="mr-4px text-20px" />
-            新增
-          </n-button>
-          <n-button type="error">
-            <icon-ic-round-delete class="mr-4px text-20px" />
-            删除
-          </n-button>
-          <n-button type="success">
-            <icon-uil:export class="mr-4px text-20px" />
-            导出Excel
-          </n-button>
-        </n-space>
-        <n-space align="center" :size="18">
-          <n-button size="small" type="primary" @click="getTableData">
-            <icon-mdi-refresh class="mr-4px text-16px" :class="{ 'animate-spin': loading }" />
-            刷新表格
-          </n-button>
-          <column-setting v-model:columns="columns" />
-        </n-space>
-      </n-space>
-      <n-data-table :columns="columns" :data="tableData" :loading="loading" :pagination="pagination" />
-      <table-action-modal v-model:visible="visible" :type="modalType" :edit-data="editData" />
-    </n-card>
-  </div>
+	<div class="h-full overflow-hidden">
+		<n-card title="权限管理" :bordered="false" class="rounded-16px shadow-sm">
+			<n-data-table :columns="columns" :data="tableData" :pagination="pagination" />
+		</n-card>
+	</div>
 </template>
 
-<script setup lang="tsx">
-import { reactive, ref } from 'vue';
+<script setup lang="ts">
+import { ref } from 'vue';
 import type { Ref } from 'vue';
-import { NButton, NPopconfirm, NSpace, NTag } from 'naive-ui';
-import type { DataTableColumns, PaginationProps } from 'naive-ui';
-import { genderLabels, userStatusLabels } from '@/constants';
-import { fetchUserList } from '@/service';
-import { useBoolean, useLoading } from '@/hooks';
-import TableActionModal from './components/table-action-modal.vue';
-import type { ModalType } from './components/table-action-modal.vue';
-import ColumnSetting from './components/column-setting.vue';
-
-const { loading, startLoading, endLoading } = useLoading(false);
-const { bool: visible, setTrue: openModal } = useBoolean();
-
-const tableData = ref<UserManagement.User[]>([]);
-function setTableData(data: UserManagement.User[]) {
-  tableData.value = data;
-}
-
-async function getTableData() {
-  startLoading();
-  const { data } = await fetchUserList();
-  if (data) {
-    setTimeout(() => {
-      setTableData(data);
-      endLoading();
-    }, 1000);
-  }
-}
-
-const columns: Ref<DataTableColumns<UserManagement.User>> = ref([
-  {
-    type: 'selection',
-    align: 'center'
-  },
-  {
-    key: 'index',
-    title: '序号',
-    align: 'center'
-  },
-  {
-    key: 'userName',
-    title: '用户名',
-    align: 'center'
-  },
-  {
-    key: 'age',
-    title: '用户年龄',
-    align: 'center'
-  },
-  {
-    key: 'gender',
-    title: '性别',
-    align: 'center',
-    render: row => {
-      if (row.gender) {
-        const tagTypes: Record<UserManagement.GenderKey, NaiveUI.ThemeColor> = {
-          '0': 'success',
-          '1': 'warning'
-        };
-
-        return <NTag type={tagTypes[row.gender]}>{genderLabels[row.gender]}</NTag>;
-      }
-
-      return <span></span>;
-    }
-  },
-  {
-    key: 'phone',
-    title: '手机号码',
-    align: 'center'
-  },
-  {
-    key: 'email',
-    title: '邮箱',
-    align: 'center'
-  },
-  {
-    key: 'userStatus',
-    title: '状态',
-    align: 'center',
-    render: row => {
-      if (row.userStatus) {
-        const tagTypes: Record<UserManagement.UserStatusKey, NaiveUI.ThemeColor> = {
-          '1': 'success',
-          '2': 'error',
-          '3': 'warning',
-          '4': 'default'
-        };
 
-        return <NTag type={tagTypes[row.userStatus]}>{userStatusLabels[row.userStatus]}</NTag>;
-      }
-      return <span></span>;
-    }
-  },
-  {
-    key: 'actions',
-    title: '操作',
-    align: 'center',
-    render: row => {
-      return (
-        <NSpace justify={'center'}>
-          <NButton size={'small'} onClick={() => handleEditTable(row.id)}>
-            编辑
-          </NButton>
-          <NPopconfirm onPositiveClick={() => handleDeleteTable(row.id)}>
-            {{
-              default: () => '确认删除',
-              trigger: () => <NButton size={'small'}>删除</NButton>
-            }}
-          </NPopconfirm>
-        </NSpace>
-      );
-    }
-  }
-]) as Ref<DataTableColumns<UserManagement.User>>;
-
-const modalType = ref<ModalType>('add');
-
-function setModalType(type: ModalType) {
-  modalType.value = type;
-}
-
-const editData = ref<UserManagement.User | null>(null);
+import type { DataTableColumns, PaginationProps } from 'naive-ui';
 
-function setEditData(data: UserManagement.User | null) {
-  editData.value = data;
-}
+import { query_1 } from '~/src/service/api/user';
+import type { Query_1Params } from '~/src/service/api/user';
 
-function handleAddTable() {
-  openModal();
-  setModalType('add');
-}
+const tableData = ref<Query_1Params[]>([]);
 
-function handleEditTable(rowId: string) {
-  const findItem = tableData.value.find(item => item.id === rowId);
-  if (findItem) {
-    setEditData(findItem);
-  }
-  setModalType('edit');
-  openModal();
-}
 
-function handleDeleteTable(rowId: string) {
-  window.$message?.info(`点击了删除,rowId为${rowId}`);
+async function getTableData() {
+	const pageNum = pagination.page as number;
+	const pageSize = pagination.pageSize as number;
+
+	const params: Query_1Params = {
+		depname: '',
+		address: '',
+		phone: '',
+		email: '',
+		manager: '',
+		createTime: "",
+		modifyTime: "" ,
+		createUid: 0,
+		disabled: '',
+	};
+
+	query_1(pageNum, pageSize, params).then((res) => {
+			console.log(res);
+			tableData.value =  res.data as[]
+		})
 }
 
-const pagination: PaginationProps = reactive({
-  page: 1,
-  pageSize: 10,
-  showSizePicker: true,
-  pageSizes: [10, 15, 20, 25, 30],
-  onChange: (page: number) => {
-    pagination.page = page;
-  },
-  onUpdatePageSize: (pageSize: number) => {
-    pagination.pageSize = pageSize;
-    pagination.page = 1;
-  }
-});
+const columns: Ref<DataTableColumns<Query_1Params>> = ref([
+	{
+		type: 'selection',
+		align: 'center'
+	},
+	{
+		key: 'depname',
+		title: '部门名称',
+		align: 'center'
+	},
+	{
+		key: 'address',
+		title: '部门地址',
+		align: 'center'
+	},
+	{
+		key: 'phone',
+		title: '部门电话',
+		align: 'center'
+	},
+	{
+		key: 'email',
+		title: '部门电子邮箱',
+		align: 'center',
+	},
+	{
+		key: 'manager',
+		title: '部门负责人',
+		align: 'center'
+	},
+	{
+		key: 'createTime',
+		title: '创建时间',
+		align: 'center'
+	},
+	{
+		key: 'modifyTime',
+		title: '修改时间',
+		align: 'center'
+	},
+	{
+		key: 'createUid',
+		title: '创建用户ID',
+		align: 'center'
+	},
+	{
+		key: 'disabled',
+		title: '状态',
+		align: 'center'
+	},
+
+]) as Ref<DataTableColumns<Query_1Params>>;
+
+const pagination: PaginationProps = ref({
+	page: 1,
+	pageSize: 10,
+	showSizePicker: true,
+	pageSizes: [10, 20, 50],
+	onChange: (page: number) => {
+		// 处理页码变化
+	},
+	onUpdatePageSize: (pageSize: number) => {
+		// 处理每页显示数量变化
+	}
+}).value;
 
 function init() {
-  getTableData();
+	getTableData();
 }
 
 // 初始化
 init();
 </script>
-
-<style scoped></style>

+ 127 - 0
src/views/management/user/indexCopy.vue

@@ -0,0 +1,127 @@
+<template>
+	<div class="h-full overflow-hidden">
+		<n-card title="权限管理" :bordered="false" class="rounded-16px shadow-sm">
+			<n-data-table :columns="columns" :data="tableData" :pagination="pagination" />
+		</n-card>
+	</div>
+</template>
+
+<script setup lang="tsx">
+import { ref } from 'vue';
+import type { Ref } from 'vue';
+
+import type { DataTableColumns, PaginationProps } from 'naive-ui';
+
+import { query_1 } from '~/src/service/api/user';
+import type { Query_1Params } from '~/src/service/api/user';
+
+const tableData = ref<Query_1Params[]>([]);
+
+function setTableData(data: Query_1Params[]) {
+	tableData.value = data;
+}
+
+async function getTableData() {
+	const pageNum = pagination.page as number;
+	const pageSize = pagination.pageSize as number;
+
+	const params: Query_1Params = {
+		depname: '',
+		address: '',
+		phone: '',
+		email: '',
+		manager: '',
+		createTime: "",
+		modifyTime: "" ,
+		createUid: 0,
+		disabled: '',
+	};
+
+	query_1(pageNum, pageSize, params)
+		.then(response => {
+			console.log(response);
+
+			const data: Query_1Params[] = response.data as Query_1Params[]; // 使用类型断言
+			setTimeout(() => {
+				setTableData(data);
+			}, 1000);
+		})
+		.catch(error => {
+			// 处理错误情况
+		});
+
+}
+
+const columns: Ref<DataTableColumns<Query_1Params>> = ref([
+	{
+		type: 'selection',
+		align: 'center'
+	},
+	{
+		key: 'depname',
+		title: '部门名称',
+		align: 'center'
+	},
+	{
+		key: 'address',
+		title: '部门地址',
+		align: 'center'
+	},
+	{
+		key: 'phone',
+		title: '部门电话',
+		align: 'center'
+	},
+	{
+		key: 'email',
+		title: '部门电子邮箱',
+		align: 'center',
+	},
+	{
+		key: 'manager',
+		title: '部门负责人',
+		align: 'center'
+	},
+	{
+		key: 'createTime',
+		title: '创建时间',
+		align: 'center'
+	},
+	{
+		key: 'modifyTime',
+		title: '修改时间',
+		align: 'center'
+	},
+	{
+		key: 'createUid',
+		title: '创建用户ID',
+		align: 'center'
+	},
+	{
+		key: 'disabled',
+		title: '状态',
+		align: 'center'
+	},
+
+]) as Ref<DataTableColumns<Query_1Params>>;
+
+const pagination: PaginationProps = ref({
+	page: 1,
+	pageSize: 10,
+	showSizePicker: true,
+	pageSizes: [10, 20, 50],
+	onChange: (page: number) => {
+		// 处理页码变化
+	},
+	onUpdatePageSize: (pageSize: number) => {
+		// 处理每页显示数量变化
+	}
+}).value;
+
+function init() {
+	getTableData();
+}
+
+// 初始化
+init();
+</script>