|
@@ -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}成功`)
|