Browse Source

删除不必要的文件

刘冰洁 1 year ago
parent
commit
eca56b6741

+ 1 - 1
mock/api/route.ts

@@ -10,7 +10,7 @@ const apis: MockMethod[] = [
 
       const routeHomeName: AuthRoute.LastDegreeRouteKey = 'dashboard_analysis';
 
-      const role = userModel.find(item => item.userId === userId)?.userRole || 'user';
+      const role = userModel.find(item => item.id === userId)?.userRole || 'user';
 
       const filterRoutes = routeModel[role];
 

+ 1 - 1
src/config/service.ts

@@ -42,5 +42,5 @@ export const ERROR_STATUS = {
 /** 不弹出错误信息的code */
 export const NO_ERROR_MSG_CODE: (string | number)[] = [];
 
-/** token失效需要刷新token的code(这里的66666只是个例子,需要将后端表示token过期的code填进来) */
+/** token失效需要刷新token的code(需要将后端表示token过期的code填进来) */
 export const REFRESH_TOKEN_CODE: (string | number)[] = ['token'];

+ 1 - 1
src/service/api/auth.ts

@@ -41,7 +41,7 @@ export interface AdminLoginRes {
  */
 export function fetchLogin(params: AdminLoginParams) {
   let res = request.post('/adminLogin',params);
-  return  res;
+  return  res;	
 }
 
 /** 获取用户信息 */

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

@@ -45,6 +45,7 @@ export default class CustomAxiosInstance {
     this.instance.interceptors.request.use(
       async config => {
         const handleConfig = { ...config };
+				console.log(handleConfig.headers);
         if (handleConfig.headers) {
           // 数据转换
           const contentType = handleConfig.headers['Content-Type'] as UnionKey.ContentType;

+ 1 - 4
src/service/request/request.ts

@@ -19,9 +19,7 @@ interface RequestParam {
  * @param backendConfig - 后端接口字段配置
  */
 export function createRequest(axiosConfig: AxiosRequestConfig, backendConfig?: Service.BackendResultConfig) {
-	console.log( "axiosConfig",  axiosConfig )
   const customInstance = new CustomAxiosInstance(axiosConfig, backendConfig);
-
   /**
    * 异步promise请求
    * @param param - 请求参数
@@ -39,7 +37,6 @@ export function createRequest(axiosConfig: AxiosRequestConfig, backendConfig?: S
       instance,
       method,
       url,
-			
       data: param.data,
       config: param.axiosConfig
     })) as Service.RequestResult<T>;
@@ -128,7 +125,7 @@ export function createHookRequest(axiosConfig: AxiosRequestConfig, backendConfig
       const res = response as Service.RequestResult<T>;
       data.value = res.data;
       error.value = res.error;
-			total.value=res.total as number
+			total.value= Number (res.total)
       endLoading();
       setNetwork(window.navigator.onLine);
     }

+ 3 - 3
src/store/modules/auth/index.ts

@@ -3,7 +3,7 @@ import { defineStore } from 'pinia';
 import { router } from '@/router';
 import { fetchLogin, fetchUserInfo,AdminLoginParams } from '@/service';
 import { useRouterPush } from '@/composables';
-import { localStg } from '@/utils';
+// import { localStg } from '@/utils';
 import { useTabStore } from '../tab';
 import { useRouteStore } from '../route';
 import { getToken, getUserInfo, clearAuthStorage } from './helpers';
@@ -20,7 +20,7 @@ interface AuthState {
 export const useAuthStore = defineStore('auth-store', {
   state: (): AuthState => ({
     userInfo: getUserInfo(),
-    token: getToken(),
+    token: getToken() as string,
     loginLoading: false
   }),
   getters: {
@@ -93,7 +93,7 @@ export const useAuthStore = defineStore('auth-store', {
       localStorage.setItem('refreshToken', refreshToken);
 			const params=	localStorage.getItem('token');
       // 获取用户信息
-      const { data } = await fetchUserInfo(params);
+      const { data } = await fetchUserInfo(params as string);
 			console.log(data);
       if (data) {
         // 成功后把用户信息存储到缓存中

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

@@ -1,29 +0,0 @@
-declare namespace ApiUserMa {
-	interface User {
-		/** 用户id */
-		id?: number;
-		name: number;
-		/** 用户名 */
-		description: string | null;
-		/** 用户年龄 */
-		createTime: number | null;
-		modifyTime: string | null;
-		createUid: number;
-		// /**
-		//  * 用户性别
-		//  * - 0: 女
-		//  * - 1: 男
-		//  */
-		// gender: '0' | '1' | null;
-		// /** 用户手机号码 */
-		// phone: string;
-		// /** 用户邮箱 */
-		// email: string | null;
-		/**
-		 * 用户状态
-		 * - N: 启用
-		 * - Y: 禁用
-		 */
-		disabled: "N" | "Y" | null;
-	}
-}

+ 1 - 1
src/typings/api.d.ts

@@ -34,7 +34,7 @@ declare namespace ApiUserManagement {
     /** 用户手机号码 */
     modifyTime: string;
     /** 用户邮箱 */
-    createUid: string|null;
+    createUid: number|null;
     /**
      * 用户状态
      * - Y: 启用

+ 0 - 22
src/typings/sort.ts

@@ -1,22 +0,0 @@
-declare namespace CourseSort {
-  interface User extends ApiUserMa.User {
-    /** 序号 */
-    index: number;
-    /** 表格的key(id) */
-    key: string;
-  }
-
-  /**
-   * 用户性别
-   * - 0: 女
-   * - 1: 男
-   */
-  // type GenderKey = NonNullable<User['gender']>;
-
-  /**
-   * 用户状态
-   * - 1: 启用
-   * - 2: 禁用
-   */
-  type UserStatusKey = NonNullable<User['disabled']>;
-}

+ 0 - 69
src/views/_builtin/login/components/pwd-login/indexCp.vue

@@ -1,69 +0,0 @@
-<template>
-  <div class="captcha-container">
-    <div class="captcha-wrapper" ref="wrapperRef">
-      <div class="slider" ref="sliderRef" :style="{ left: sliderLeft + 'px' }" @mousedown="startDrag"></div>
-      <div class="background">请拖动滑块完成验证</div>
-    </div>
-    <button class="verify-btn" @click="verify">验证</button>
-  </div>
-</template>
-
-<script setup lang="ts">
-import { ref, onMounted, onUnmounted } from 'vue';
-
-const sliderLeft = ref(0);
-const isDragging = ref(false);
-let dragStartX = 0;
-const wrapperRef = ref<HTMLDivElement | null>(null); // 创建一个引用
-const sliderRef = ref<HTMLDivElement | null>(null); // 创建另一个引用
-
-const startDrag = (event: MouseEvent) => {
-  isDragging.value = true;
-  dragStartX = event.clientX;
-};
-
-const handleDrag = (event: MouseEvent) => {
-  if (!isDragging.value) return;
-
-  const sliderWidth = sliderRef.value?.offsetWidth ?? 0; // 使用引用获取宽度
-  const wrapperWidth = wrapperRef.value?.clientWidth ?? 0;
-  const maxSliderLeft = wrapperWidth - sliderWidth;
-
-  let newSliderLeft = event.clientX - dragStartX;
-  if (newSliderLeft < 0) newSliderLeft = 0;
-  if (newSliderLeft > maxSliderLeft) newSliderLeft = maxSliderLeft;
-
-  sliderLeft.value = newSliderLeft;
-};
-
-const endDrag = () => {
-  isDragging.value = false;
-};
-
-const verify = () => {
-  if (!wrapperRef.value || !sliderRef.value) return; // 检查引用是否存在
-
-  const maxSliderLeft = wrapperRef.value.clientWidth - sliderRef.value.clientWidth; // 计算最大滑块左侧位置
-  if (sliderLeft.value === maxSliderLeft) {
-    // 验证成功
-    console.log('验证成功');
-  } else {
-    // 验证失败
-    console.log('验证失败');
-  }
-};
-
-onMounted(() => {
-  window.addEventListener('mousemove', handleDrag);
-  window.addEventListener('mouseup', endDrag);
-});
-
-onUnmounted(() => {
-  window.removeEventListener('mousemove', handleDrag);
-  window.removeEventListener('mouseup', endDrag);
-});
-</script>
-
-<style scoped>
-/* 样式内容 */
-</style>

File diff suppressed because it is too large
+ 0 - 224
src/views/_builtin/login/components/pwd-login/indexppp.vue


+ 3 - 3
src/views/management/sort/index.vue

@@ -49,7 +49,7 @@
 				</n-space>
 				<n-data-table :columns="columns" :data="tableData" :loading="loading" :row-key="rowKey"
 					@update:checked-row-keys="handleCheck" />
-				<n-pagination v-model:page="pagination.page" v-model:page-size="pagination.pageSize" :item-count="pagination.itemCount"    show-size-picker :page-sizes="[10, 20, 30, 40]" @change="onChange" @page-size-change="onUpdatePageSize"/>
+				<n-pagination  class="flex-justify-end"  v-model:page="pagination.page"  v-model:page-size="pagination.pageSize" :item-count="pagination.itemCount"    show-size-picker :page-sizes="[10, 20, 30, 40]" @change="onChange" @page-size-change="onUpdatePageSize"/>
 				<table-action-add v-model:visible="visible" :type="modalType" @searchCondition="searchCondition"
 					:pagination="pagination" :edit-data="(editData as SelectByCondition_1Params)" />
 			</n-card>
@@ -72,13 +72,13 @@ import { selectByCondition_1 } from '~/src/service/api/sort';
 import type { SelectByCondition_1Params } from '~/src/service/api/sort';
 
 type RowData = {
-	key: string
+	key: number
 	id: number
 	name: string
 	description: string
 	createTime: string
 	modifyTime: string
-	createUid: string
+	createUid: number
 	disabled: string
 }
 const conditionParams: SelectByCondition_1Params = reactive({

+ 0 - 126
src/views/management/sort/index.vuebak

@@ -1,126 +0,0 @@
-<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" :pagination="pagination"  />
-
-			<!-- <table-action-modal v-model:visible="visible" :type="modalType" :edit-data="editData" /> -->
-		</n-card>
-	</div>
-</template>
-
-<script setup lang="ts">
-import { ref } from 'vue';
-import type { Ref } from 'vue';
-// import type { SelectAll_1Res } from './api';
-import type { DataTableColumns, PaginationProps } from 'naive-ui';
-// import { query } from '~/src/service/api/user';
-// import type { QueryParams } from '~/src/service/api/user';
-import { selectAll_1 } from '~/src/service/api/user';
-const tableData = ref<any[]>([]);
-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;
-	// const params: any = {};
-
-	selectAll_1().then(res => {
-		// console.log(res);
-		tableData.value = res.data as [];
-	});
-}
-
-type RowData = {
-	key: number
-	id: number
-	name: string
-	description: string
-	createTime: string
-	modifyTime: string
-	createUid: number
-	disabled: string
-}
-
-const columns: Ref<DataTableColumns<RowData>> = ref([
-	{
-		type: 'selection',
-		align: 'center',
-	},
-	{
-		key: 'id',
-		title: "ID",
-		align: 'center'
-	},
-	{
-		key: 'name',
-		title: '部门名称',
-		align: 'center'
-	},
-	{
-		key: 'description',
-		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<any>>;
-
-function init() {
-	getTableData();
-}
-
-// 初始化
-init();
-</script>

+ 0 - 333
src/views/management/sort/indexsss.vue

@@ -1,333 +0,0 @@
-<template>
-	<div class="h-full overflow-hidden">
-
-			<n-card title="课程分类" :bordered="false" class="rounded-16px shadow-sm">
-				<n-space class="pb-14px" justify="space-between">
-					<!-- 加入查询组件 -->
-					<n-space>
-						<n-button type="primary" @click="addTableData">
-							<icon-ic-round-plus class="mr-4px text-20px" />
-							新增
-						</n-button>
-						<n-button type="error" @click="deleteTableData" @update:checked-row-keys="handleCheck">
-							<icon-ic-round-delete class="mr-4px text-20px" />
-							删除
-						</n-button>
-						<!-- 添加查询按钮 -->
-						<n-button type="primary" @click="handleOpenSearch">
-							<icon-simple-line-icons:magnifier class="mr-4px text-16px" />
-							查询
-						</n-button>
-						<div class="mr-5px"></div>
-						<n-input-group>
-							<n-input :style="{ width: '50%',marginRight:'2%'}" :value="conditionParams.id"
-							@input="event => conditionParams.id = event" placeholder="请输入ID..." />
-							<n-input :style="{ width: '50%',marginRight:'2%'}" :value="conditionParams.name"
-								@input="event => conditionParams.name = event" placeholder="请输入学科名称..." />
-							<n-input :style="{ width: '50%',marginRight:'2%' }" :value="conditionParams.description"
-								@input="event => conditionParams.description = event" placeholder="请输入学科描述..." />
-							<n-input :style="{ width: '50%',marginRight:'2%' }" :value="conditionParams.createUid"
-								@input="event => conditionParams.createUid = event" placeholder="请输入创建用户ID..." />
-							<n-input :style="{ width: '50%',marginRight:'2%' }" :value="conditionParams.createTime"
-								@input="event => conditionParams.createTime = event" placeholder="请输入创建时间..." />
-							<n-input :style="{ width: '50%',marginRight:'2%' }" :value="conditionParams.modifyTime"
-								@input="event => conditionParams.modifyTime = event" placeholder="请输入修改时间..." />
-							<n-select :style="{ width: '50%' }" :value="conditionParams.disabled"
-								@input="event => conditionParams.disabled = event" placeholder="输入查询状态..." />
-							<n-button type="primary" ghost @click="searchCondition()">
-								搜索
-							</n-button>
-						</n-input-group>
-					</n-space>
-					<n-space align="center" :size="18">
-						<n-button size="small" type="primary" @click="searchCondition">
-							<icon-mdi-refresh class="mr-4px text-16px" :class="{ 'animate-spin': loading }" />
-							刷新表格
-						</n-button>
-					</n-space>
-				</n-space>
-				<n-scrollbar>
-				<!-- <n-data-table  :columns="columns" :data="searchForm" :loading="loading"
-					:pagination="pagination" :row-key="rowKey" @update:checked-row-keys="handleCheck" /> -->
-				<n-data-table  :columns="columns" :data="tableData" :loading="loading"
-					:pagination="pagination" :row-key="rowKey"  />
-				<table-action-add v-model:visible="visible" :type="modalType" :edit-data="(editData as SelectByCondition_1Params)" @update:checked-row-keys="handleCheck"/>
-				<div style="width: 100%; height: 300px;"></div>
-			</n-scrollbar>
-			</n-card>
-
-	</div>
-</template>
-
-<script setup lang="tsx" >
-import { ref, Ref, reactive } from 'vue'
-import { NButton, NSpace, NTag, NPopconfirm } from 'naive-ui';
-import type { DataTableColumns, PaginationProps } from 'naive-ui';
-import { useBoolean, useLoading } from '@/hooks';
-import type { DataTableRowKey } from 'naive-ui'
-import TableActionAdd from './components/table-action-add.vue'
-import type { ModalType } from './components/table-action-add.vue';
-import { userStatusLabels } from '@/constants';
-import {  deleteById } from '~/src/service/api/sort';
-import { selectByCondition_1 } from '~/src/service/api/sort';
-import type { SelectByCondition_1Params } from '~/src/service/api/sort';
-type RowData = {
-	key: number
-	id: number
-	name: string
-	description: string
-	createTime: string
-	modifyTime: string
-	createUid: number
-	disabled: string
-}
-const conditionParams: SelectByCondition_1Params = reactive({
-	id: null,
-	name: null,
-	description: null,
-	createUid:null,
-	createTime: null,
-	modifyTime: null,
-	disabled: null
-});
-
-const { loading, startLoading, endLoading } = useLoading(false);
-const { bool: visible, setTrue: openModal } = useBoolean();
-const tableData = ref<any[]>([]);
-const pagination: PaginationProps = ref({
-	page: 1,
-	pageSize: 10,
-	showSizePicker: true,
-	pageCount: 12,
-	pageSizes: [10, 20, 30,40,50],
-	onChange: (page: number) => {
-		// 处理页码变化
-		pagination.page = page;
-	},
-	onUpdatePageSize: (pageSize: number) => {
-		// 处理每页显示数量变化
-		pagination.pageSize = pageSize;
-		pagination.page = 1;
-	}
-}).value;
-
-// function searchCondition() {
-// 	const pageNum = searchpagedata.value as number;
-// 	const pageSize = searchpagesize.value as number;
-// 	const params: SelectByCondition_1Params = {};
-// 	if (pageNum && pageSize) {
-// 		selectByCondition_1(pageNum, pageSize, params).then(res => {
-// 			searchConData.value = res.data as [];
-// 			pagination.page = searchpagedata.value
-// 			pagination.pageSize = searchpagesize.value
-// 			window.$message?.success('查询成功');
-// 		})
-// 	}
-// 	else if (!pageNum && !pageSize) {
-// 		searchpagedata.value = 0;
-// 		searchpagesize.value = 0;
-// 		window.$message?.warning('请输入页码和条数进行查询');
-// 	}
-// }
-// function getTableData() {
-// 	startLoading();
-// 	selectAll_1().then(res => {
-// 		setTimeout(() => {
-// 			tableData.value = res.data as [];
-// 			endLoading();
-// 		}, 1000);
-// 	});
-
-// }
-function init() {
-	searchCondition();
-}
-// 初始化
-init();
-
-// function searchConClear() {
-// 	searchConData.value.length = 0
-// 	searchpagedata.value = 0;
-// 	searchpagesize.value = 0;
-// 	getTableData();
-// }
-
-const showSearch = ref(false)
-function handleOpenSearch() {
-	// 点击查询时显示搜索框
-	showSearch.value = !showSearch.value;
-}
-// 输入数据
-// function handleChange(v: string) {
-// 	searchId.value = Number(v)
-// }
-// 根据id查询数据
-// async function handleSearch() {
-// 	if (searchId.value) {
-// 		await selectById_1(searchId.value)
-// 			.then(res => {
-// 				// 更新数据
-// 				searchInput.value = res.data as [];
-// 				const filteredItems = tableData.value.filter(item => item.id === searchInput.value.id)
-// 				searchForm.value = filteredItems;
-// 				window.$message?.success('查询成功');
-// 			})
-// 	}
-// 	else {
-// 		searchForm.value.length = 0
-// 		window.$message?.warning('请输入有效的ID进行查询');
-// 	}
-// }
-
-// function searchClear() {
-// 	searchForm.value.length = 0
-// 	getTableData();
-// }
-
-const checkedRowKeysRef = ref<DataTableRowKey[]>([])
-const s = ref<DataTableRowKey[]>([])
-// 根据id进行删除
-async function deleteTableData() {
-	const ids = checkedRowKeysRef.value.filter((item) => !s.value?.includes(item));
-	s.value = checkedRowKeysRef.value
-	if (ids.length !== 0) {
-		console.log(ids);
-		for (const id of ids) {
-			// 调用删除接口
-			await deleteById(id as number)
-				.then((res) => {
-					window.$message?.success('删除成功!');
-				})
-		}
-		searchCondition(); // 删除完成后刷新表格数据
-	} else {
-		// 没有选择任何行时的操作
-		window.$message?.error('未选择要删除的行');
-	}
-}
-
-const modalType = ref<ModalType>('add' || 'edit');
-
-function setModalType(type: ModalType) {
-	modalType.value = type;
-}
-// 添加
-function addTableData() {
-	openModal();
-	setModalType('add');
-}
-
-const editData = ref<SelectByCondition_1Params | null>(null);
-function setEditData(data:SelectByCondition_1Params | null) {
-	editData.value = data;
-}
-function handleEditTable(findItem: SelectByCondition_1Params) {
-	//  findItem = tableData.value.find(item => item.id === rowId);
-	setModalType('edit');
-	openModal();
-	if (findItem) {
-		setEditData(findItem);
-	}
-	searchCondition(); // 编辑完成后刷新表格数据
-}
-
-function handleDeleteTable(rowId: string) {
-	// const findItem = tableData.value.find(item => item.id === rowId);
-	const rowIdNumber = Number(rowId);
-		deleteById(rowIdNumber)
-		init()
-}
-function deleteSubjectsList() {
-	const difference = checkedRowKeysRef.value.filter(item => !s.value.includes(item));
-	s.value = checkedRowKeysRef.value
-	for (let i = 0; i < difference.length; i++) {
-		deleteById(Number(difference[i]));
-	}
-	init();
-}
-function searchCondition() {
-	selectByCondition_1(pagination.page, pagination.pageSize, conditionParams).then(r => {
-		tableData.value = r.data as [];
-	}).catch(() => {
-		console.log('jdias')
-	})
-}
-
-const columns: Ref<DataTableColumns<SelectByCondition_1Params>> = ref([
-	{
-		type: 'selection',
-		align: 'center',
-	},
-	{
-		key: 'id',
-		title: "ID",
-		align: 'center',
-
-	},
-	{
-		key: 'name',
-		title: '学科名称',
-		align: 'center'
-	},
-	{
-		key: 'description',
-		title: '学科描述',
-		align: 'center'
-	},
-	{
-		key: 'createTime',
-		title: '创建时间',
-		align: 'center'
-	},
-	{
-		key: 'modifyTime',
-		title: '修改时间',
-		align: 'center'
-	},
-	{
-		key: 'createUid',
-		title: '创建用户ID',
-		align: 'center'
-	},
-	{
-		key: 'disabled',
-		title: '状态',
-		align: 'center',
-
-		render: row => {
-			if (row.disabled) {
-				const tagTypes: Record<UserManagement.UserStatusKey, NaiveUI.ThemeColor> = {
-					'N': 'error',
-					'Y': 'success',
-				};
-				return <NTag type={tagTypes[row.disabled]}>{userStatusLabels[row.disabled]}</NTag>;
-			}
-		}
-	},
-	{
-		key: 'actions',
-		title: '操作',
-		align: 'center',
-		render: row => {
-			return (
-				<NSpace justify={'center'}>
-					<NButton size={'small'} onClick={() => handleEditTable(row)} >
-						编辑
-					</NButton>
-					<NPopconfirm onPositiveClick={() => handleDeleteTable(row.id.toString())}>
-						{{
-							default: () => '确认删除',
-							trigger: () => <NButton size={'small'}>删除</NButton>
-						}}
-					</NPopconfirm>
-				</NSpace>
-			);
-		}
-
-	},
-])as Ref<DataTableColumns<SelectByCondition_1Params>>
-const rowKey = (row: RowData) => row.id
-function handleCheck(rowKeys: DataTableRowKey[]) {
-	checkedRowKeysRef.value = rowKeys
-}
-</script>

+ 0 - 39
src/views/management/user/components/table-action-modal.vue

@@ -2,26 +2,12 @@
 	<n-modal v-model:show="modalVisible" preset="card" :title="title" class="w-700px">
 		<n-form ref="formRef" label-placement="left" :label-width="100" :model="formModel" :rules="rules">
 			<n-grid :cols="24" :x-gap="18">
-				<!-- <n-form-item-grid-item :span="12" label="ID" path="id">
-					<n-input-number v-model:value="formModel.id" />
-				</n-form-item-grid-item> -->
 				<n-form-item-grid-item :span="12" label="学科名称" path="name">
 					<n-input v-model:value="formModel.name" clearable />
 				</n-form-item-grid-item>
-				<!-- <n-form-item-grid-item :span="12" label="创建时间" path="createTime">
-					  <n-date-picker v-model:value="timestamp" type="datetime" clearable />
-					<n-input v-model:value="formModel.createTime" />
-				</n-form-item-grid-item> -->
 				<n-form-item-grid-item :span="12" label="学科描述" path="description">
 					<n-input v-model:value="formModel.description" clearable />
-					<!-- <n-radio-group v-model:value="formModel.description">
-						<n-radio v-for="item in genderOptions" :key="item.value" :value="item.value">{{ item.label }}</n-radio>
-					</n-radio-group> -->
 				</n-form-item-grid-item>
-
-				<!-- <n-form-item-grid-item :span="12" label="修改时间" path="email">
-					<n-input />
-				</n-form-item-grid-item> -->
 				<n-form-item-grid-item :span="12" label="创建用户ID" path="createUid">
 					<n-input-number v-model:value="formModel.createUid" />
 				</n-form-item-grid-item>
@@ -43,9 +29,6 @@ import type { FormInst, FormItemRule } from 'naive-ui';
 import { userStatusOptions } from '@/constants';
 import {createRequiredFormRule } from '@/utils';
 import { addEasEduCategory, AddEasEduCategoryParams } from '~/src/service/api/sort';
-// import {getTableData} from '../index.vue'
-// const timestamp = ref(1483135260000)
-
 
 export interface Props {
 	/** 弹窗可见性 */
@@ -54,7 +37,6 @@ export interface Props {
 	 * 弹窗类型
 	 * add: 新增
 	 * edit: 编辑
-	 * delete : 删除
 	 */
 	type?: 'add' | 'edit' ;
 	/** 编辑的表格行数据 */
@@ -73,7 +55,6 @@ const props = withDefaults(defineProps<Props>(), {
 interface Emits {
 	(e: 'update:visible', visible: boolean): void;
 }
-
 const emit = defineEmits<Emits>();
 
 const modalVisible = computed({
@@ -103,27 +84,21 @@ type FormModel = Pick<UserManagement.User,  | 'name' | 'description' |  'createU
 const formModel = reactive<FormModel>(createDefaultFormModel());
 
 const rules: Record<keyof FormModel, FormItemRule | FormItemRule[]> = {
-	// id: createRequiredFormRule('请输入用户名'),
 	name: createRequiredFormRule('请输入学科名称'),
 	description: createRequiredFormRule('请进行部门描述'),
-	// createTime:formRules.createTime,
 	createUid: createRequiredFormRule('请输入创建用户ID'),
 	disabled: createRequiredFormRule('请选择用户状态')
 
 };
-
 function createDefaultFormModel(): FormModel {
 	return {
-		// id: null,
 		name: '',
 		description: '',
-		// createTime: '',
 		createUid:null,
 		disabled: null,
 	};
 }
 
-
 function handleUpdateFormModel(model: Partial<FormModel>) {
 	Object.assign(formModel, model);
 }
@@ -140,24 +115,14 @@ function handleUpdateFormModelByModalType() {
 			}
 		},
 	};
-
 	handlers[props.type]();
 }
 
-// async function handleSubmit() {
-// 	await formRef.value?.validate();
-// 	window.$message?.success('新增成功!');
-// 	closeModal();
-// }
-
-
 async function handleSubmit() {
   await formRef.value?.validate();
   const params: AddEasEduCategoryParams = {
-    // id: formModel.id,
     name: formModel.name,
     description: formModel.description,
-    // createTime: formModel.createTime,
     createUid: formModel.createUid,
     disabled: formModel.disabled
   };
@@ -165,15 +130,12 @@ async function handleSubmit() {
     .then(res => {
       window.$message?.success('新增成功!');
       closeModal();
-			// getTableData();
     })
     .catch(error => {
       console.error(error);
       window.$message?.error('新增失败!');
     });
-
 }
-
 watch(
 	() => props.visible,
 	newValue => {
@@ -183,5 +145,4 @@ watch(
 	}
 );
 </script>
-
 <style scoped></style>

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

@@ -1,127 +0,0 @@
-<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>

Some files were not shown because too many files changed in this diff