Procházet zdrojové kódy

添加、删除bug解决,遗留input

LiShiwei před 1 rokem
rodič
revize
104258ecae

+ 2 - 1
src/locales/lang/zh-cn.ts

@@ -76,7 +76,8 @@ const locale: LocaleMessages<I18nType.Schema> = {
         role: '角色管理',
         route: '路由管理',
         user: '用户管理',
-				lesson:"班级管理"
+				lesson:"班级管理",
+        curriculum:"课程表管理"
       },
       about: '关于'
     }

+ 13 - 2
src/router/modules/management.ts

@@ -46,7 +46,8 @@ const management: AuthRoute.Route = {
         requiresAuth: true,
         icon: 'material-symbols:route'
       }
-    },{
+    },
+    {
       name: 'management_lesson',
       path: '/management/lesson',
       component: 'self',
@@ -54,7 +55,17 @@ const management: AuthRoute.Route = {
         title: '课程管理',
         i18nTitle: 'message.routes.management.lesson',
         requiresAuth: true,
-        icon: 'material-symbols:route'
+        icon: 'carbon:building'
+      }
+    },{
+      name: 'management_curriculum',
+      path: '/management/curriculum',
+      component: 'self',
+      meta: {
+        title: '课程表管理',
+        i18nTitle: 'message.routes.management.curriculum',
+        requiresAuth: true,
+        icon: 'ic:baseline-apartment'
       }
     }
   ],

+ 2 - 0
src/typings/page-route.d.ts

@@ -55,6 +55,7 @@ declare namespace PageRoute {
     | 'function_tab'
     | 'management'
     | 'management_auth'
+    | 'management_curriculum'
     | 'management_lesson'
     | 'management_role'
     | 'management_route'
@@ -114,6 +115,7 @@ declare namespace PageRoute {
     | 'function_tab-multi-detail'
     | 'function_tab'
     | 'management_auth'
+    | 'management_curriculum'
     | 'management_lesson'
     | 'management_role'
     | 'management_route'

+ 1 - 0
src/typings/system.d.ts

@@ -380,6 +380,7 @@ declare namespace I18nType {
         route: string;
         user: string;
 				lesson: string;
+        curriculum: string;
       };
       about: string;
     };

+ 1 - 0
src/views/index.ts

@@ -34,6 +34,7 @@ export const views: Record<
   'function_tab-multi-detail': () => import('./function/tab-multi-detail/index.vue'),
   function_tab: () => import('./function/tab/index.vue'),
   management_auth: () => import('./management/auth/index.vue'),
+  management_curriculum: () => import('./management/curriculum/index.vue'),
   management_lesson: () => import('./management/lesson/index.vue'),
   management_role: () => import('./management/role/index.vue'),
   management_route: () => import('./management/route/index.vue'),

+ 73 - 0
src/views/management/curriculum/index.vue

@@ -0,0 +1,73 @@
+<template>
+  <n-data-table :columns="columns" :data="data" :render-cell="renderCell" />
+</template>
+
+<script lang="ts">
+import { defineComponent, h } from 'vue'
+import { NText } from 'naive-ui'
+import type { DataTableColumns } from 'naive-ui'
+
+type Song = {
+  no: number
+  note: string
+}
+
+const createColumns = (): DataTableColumns<Song> => {
+  return [
+    {
+      title: '星期',
+      key: 'no',
+      width: 120,
+      render: (_, index) => {
+        return `星期 ${index + 1}`
+      }
+    },
+    {
+      title: '起始时间',
+      key: 'note'
+    }, {
+      title: '结束时间',
+      key: 'ad'
+    }, {
+      title: '授课类别',
+      key: 'note'
+    }, {
+      title: '授课内容',
+      key: 'note'
+    }, {
+      title: '创建时间',
+      key: 'note'
+    }, {
+      title: '修改时间',
+      key: 'note'
+    }, {
+      title: '状态',
+      key: 'note'
+    }
+  ]
+}
+
+const data: Song[] = [
+  { no: 3, note: '23' },
+  { no: 4, note: '' },
+  { no: 12, note: '' },
+  { no: 10, note: '' },
+  { no: 19, note: '' }
+]
+
+export default defineComponent({
+  setup() {
+    return {
+      data,
+      columns: createColumns(),
+      pagination: false as const,
+      renderCell: (value: string | number) => {
+        if (!value) {
+          return h(NText, { depth: 3 }, { default: () => '未填写' })
+        }
+        return value
+      }
+    }
+  }
+})
+</script>

+ 26 - 28
src/views/management/lesson/index.vue

@@ -39,7 +39,7 @@
   </n-modal>
   <n-grid x-gap="300" :cols="2">
     <n-gi>
-      <n-input placeholder="搜索" autofocus clearable round show-count   @change="changeInput">
+      <n-input placeholder="搜索" autofocus clearable round show-count @change="changeInput">
         <template #prefix>
           <n-icon :component="FlashOutline" />
         </template>
@@ -54,7 +54,7 @@
 
   <!-- 表格 -->
   <div>
-    <n-data-table :bordered="false" :single-line="false" :columns="columns" :data="data" :pagination="pagination" />
+    <n-data-table :bordered="false" :single-line="false" :columns="columns" :data="tableData" :pagination="pagination" />
   </div>
 
   <!-- 删除弹出确定 -->
@@ -78,8 +78,10 @@ import {
 import { FlashOutline } from '@vicons/ionicons5'
 import { h, defineComponent, ref, onMounted } from 'vue'
 import { NButton, useMessage } from 'naive-ui'
+import { useLoading } from '@/hooks';
 import type { DataTableColumns } from 'naive-ui'
 import { selectTotal, addClass, deleteClass, updateClass, selectCondition } from '~/src/service/api/lesson'
+// const { loading, startLoading, endLoading } = useLoading(false);
 //获取所有班级类
 type RowData = {
   id: number
@@ -94,10 +96,11 @@ type RowData = {
 }
 const tableData = ref([]);
 async function getTableData() {
-  console.log("再次调用");
-  
+  // console.log("再次调用");
+  // startLoading();
   selectTotal().then(r => {
     tableData.value = r.data;
+    // endLoading();
     // console.log(tableData.value);
 
     //由于不能自定义添加标签,所以我们给数据添加一个tags来进行遍历按钮数据
@@ -110,7 +113,6 @@ async function getTableData() {
 
   })
 
-
 }
 let showModalUpdate = ref(false);
 const createColumns = ({
@@ -198,10 +200,11 @@ let params: easEduClass = {
   createUid: 0,
   disabled: null
 }
-async function AddClassInter(params:any) {
+async function AddClassInter(params: any) {
   if (params != "") {
     addClass(params).then(r => {
       console.log(r);
+      getTableData();
     })
 
   }
@@ -210,9 +213,10 @@ async function AddClassInter(params:any) {
 
 //|
 //删除班级
-function deleteData(id: number) {
+async function deleteData(id: number) {
   deleteClass(id).then(r => {
-    console.log(r);
+    // console.log(r);
+    getTableData();
   })
 }
 
@@ -253,27 +257,21 @@ let SelectConditionParams = {
   createUid: "",
   disabled: "",
 }
-
 async function changeInput(e: any) {
-  // console.log(e);
-  
-  
-  SelectConditionParams.name = e;
-  selectCondition(1, 10000, SelectConditionParams).then(r => {
-    // console.log(r);
-    if(r.data.length==0)
-    {
-      getTableData();
-    }
-    else 
-    {
-      tableData.value=r.data;
-      console.log(tableData.value);
+      // console.log(e);
+      SelectConditionParams.name = e;
+      selectCondition(1, 10, SelectConditionParams).then(r => {
+        console.log(r.data);
+
+        tableData.value = r.data;
+        console.log(tableData.value);
+
+        // getTableData();
+
+      })
+
     }
-   
-  })
 
-}
 export default defineComponent({
 
   setup() {
@@ -293,7 +291,7 @@ export default defineComponent({
     const modelRef = ref({
       name: null,
     })
-
+    
     const rules: FormRules = {
       name: [
         {
@@ -355,7 +353,7 @@ export default defineComponent({
       },
       showModal,
       FlashOutline,
-      data: tableData,
+      tableData,
       columns: createColumns({
         sendMail(rowData) {
           message.success(`${rowData}成功`)