|
@@ -1,6 +1,5 @@
|
|
<template>
|
|
<template>
|
|
-
|
|
|
|
-<!-- 上层状态 -->
|
|
|
|
|
|
+ <!-- 上层状态 -->
|
|
|
|
|
|
<!-- 模态框 -->
|
|
<!-- 模态框 -->
|
|
<n-modal v-model:show="showModal" block-scroll close-on-esc trap-focus>
|
|
<n-modal v-model:show="showModal" block-scroll close-on-esc trap-focus>
|
|
@@ -56,6 +55,14 @@ import { NButton } from 'naive-ui'
|
|
import type { DataTableColumns } from 'naive-ui'
|
|
import type { DataTableColumns } from 'naive-ui'
|
|
import { selectTotal, addClass } from '~/src/service/api/lesson'
|
|
import { selectTotal, addClass } from '~/src/service/api/lesson'
|
|
import { ref } from 'vue'
|
|
import { ref } from 'vue'
|
|
|
|
+import {
|
|
|
|
+ onBeforeMount,
|
|
|
|
+ onMounted,
|
|
|
|
+ onBeforeUpdate,
|
|
|
|
+ onUpdated,
|
|
|
|
+ onBeforeUnmount,
|
|
|
|
+ onUnmounted,
|
|
|
|
+} from 'vue'
|
|
//获取所有班级类
|
|
//获取所有班级类
|
|
type RowData = {
|
|
type RowData = {
|
|
id: number
|
|
id: number
|
|
@@ -117,23 +124,47 @@ const createColumns = ({
|
|
|
|
|
|
|
|
|
|
//增加班级类
|
|
//增加班级类
|
|
-type easEduClass={
|
|
|
|
- id:number,
|
|
|
|
- name:string,
|
|
|
|
- manageId:number,
|
|
|
|
- assistantId:number,
|
|
|
|
- createTime:string,
|
|
|
|
- modifyTime:string,
|
|
|
|
- createUid:string,
|
|
|
|
- disabled:string
|
|
|
|
|
|
+type easEduClass = {
|
|
|
|
+ id: number,
|
|
|
|
+ name: string,
|
|
|
|
+ manageId: number,
|
|
|
|
+ assistantId: number,
|
|
|
|
+ createTime: string,
|
|
|
|
+ modifyTime: string,
|
|
|
|
+ createUid: number,
|
|
|
|
+ disabled: string
|
|
}
|
|
}
|
|
-addClass().then(r=>{
|
|
|
|
- console.log(r);
|
|
|
|
-
|
|
|
|
-})
|
|
|
|
|
|
+//添加班级的函数
|
|
|
|
+let params: easEduClass = {
|
|
|
|
+ id: 0,
|
|
|
|
+ name: "",
|
|
|
|
+ manageId: 0,
|
|
|
|
+ assistantId: 0,
|
|
|
|
+ createTime: "",
|
|
|
|
+ modifyTime: "",
|
|
|
|
+ createUid: 0,
|
|
|
|
+ disabled: null
|
|
|
|
+}
|
|
|
|
+function AddClassInter(params): void {
|
|
|
|
+ if (params != "") {
|
|
|
|
+ addClass(params).then(r => {
|
|
|
|
+ console.log(r);
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+}
|
|
|
|
+
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
|
|
|
|
setup() {
|
|
setup() {
|
|
|
|
+ onMounted(() => {
|
|
|
|
+ // AddClassInter(params);
|
|
|
|
+ console.log(111);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ });
|
|
const showModal = ref(false);
|
|
const showModal = ref(false);
|
|
const formRef = ref<FormInst | null>(null)
|
|
const formRef = ref<FormInst | null>(null)
|
|
const rPasswordFormItemRef = ref<FormItemInst | null>(null)
|
|
const rPasswordFormItemRef = ref<FormItemInst | null>(null)
|
|
@@ -156,16 +187,23 @@ export default defineComponent({
|
|
],
|
|
],
|
|
}
|
|
}
|
|
return {
|
|
return {
|
|
|
|
+ onMounted,
|
|
formRef,
|
|
formRef,
|
|
rPasswordFormItemRef,
|
|
rPasswordFormItemRef,
|
|
model: modelRef,
|
|
model: modelRef,
|
|
rules,
|
|
rules,
|
|
- handleValidateButtonClick() {
|
|
|
|
|
|
+ async handleValidateButtonClick() {
|
|
//点击添加
|
|
//点击添加
|
|
|
|
+ if (modelRef.value.name == "") {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ params.name = modelRef.value.name;
|
|
|
|
+ // console.log(params);
|
|
|
|
+ AddClassInter(params);
|
|
|
|
+ getTableData();
|
|
showModal.value = false;
|
|
showModal.value = false;
|
|
message.success("添加成功");
|
|
message.success("添加成功");
|
|
modelRef.value.name = null;//清空表单值
|
|
modelRef.value.name = null;//清空表单值
|
|
-
|
|
|
|
},
|
|
},
|
|
showModal,
|
|
showModal,
|
|
FlashOutline,
|
|
FlashOutline,
|
|
@@ -182,10 +220,4 @@ export default defineComponent({
|
|
}
|
|
}
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|
|
-<style scoped>
|
|
|
|
-.n-grid{
|
|
|
|
- /* display: flex;
|
|
|
|
- justify-content: center;
|
|
|
|
- align-items: center; */
|
|
|
|
-}
|
|
|
|
-</style>
|
|
|
|
|
|
+<style scoped></style>
|