From 9e972b2ae4dcf29191fc6065e502d0570c4cca94 Mon Sep 17 00:00:00 2001 From: yuping <82253452@qq.com> Date: Tue, 31 Jan 2023 17:27:58 +0800 Subject: [PATCH] =?UTF-8?q?--fix=20=E6=B7=BB=E5=8A=A0=E5=BD=92=E5=B1=9E?= =?UTF-8?q?=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 ++- src/api/request.js | 14 +++++----- .../student/OwnerTableModelStudent.vue | 2 +- src/components/student/TableModelStudent.vue | 27 +++++++++++-------- src/views/projectcenter/ProjectAdd.vue | 1 + src/views/projectcenter/ProjectManage.vue | 2 +- 6 files changed, 28 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 50050c3a..2b265fab 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,8 @@ "eslintConfig": { "root": true, "env": { - "node": true + "node": true, + "vue/setup-compiler-macros": true }, "extends": [ "plugin:vue/vue3-essential", diff --git a/src/api/request.js b/src/api/request.js index 707aba9f..54e2361d 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -121,11 +121,17 @@ export function usePage(_url, params, init = true) { }) if (isRef(params)) { - watch(params, () => { + watch(params.value, () => { fetch() }) } + if (isRef(_url)) { + watchEffect(fetch) + } else { + init && fetch() + } + function reset(){ state.data = [] state.loading = false @@ -142,12 +148,6 @@ export function usePage(_url, params, init = true) { }) } - if (isRef(_url)) { - watchEffect(fetch) - } else { - init && fetch() - } - return { ...toRefs(state), fetch, diff --git a/src/components/student/OwnerTableModelStudent.vue b/src/components/student/OwnerTableModelStudent.vue index 24e7d901..6785a73a 100644 --- a/src/components/student/OwnerTableModelStudent.vue +++ b/src/components/student/OwnerTableModelStudent.vue @@ -13,7 +13,7 @@ import {defineProps, ref} from "vue"; import TableModelStudent from "@/components/student/TableModelStudent"; import CommonStudent from "@/components/student/CommonStudent"; -const props = defineProps({ +defineProps({ id: String, type: Number, types: { diff --git a/src/components/student/TableModelStudent.vue b/src/components/student/TableModelStudent.vue index fb7aaa1d..acbf6d72 100644 --- a/src/components/student/TableModelStudent.vue +++ b/src/components/student/TableModelStudent.vue @@ -27,7 +27,7 @@ @@ -36,7 +36,7 @@ @@ -104,7 +104,7 @@ const visiable = ref(false); const initParams = { studentName: "", - page: 1, + pageNo: 1, pageSize: 10, type: props.type || '', types: props.types, @@ -112,6 +112,7 @@ const initParams = { } const searchParams = ref(initParams) +const searchName = ref('') const columns = ref([ { @@ -144,7 +145,7 @@ const columns = ref([ key: "type", width: 30, align: "center", - customRender: ({record: {type}}) => ({4: "查看权", 5: "管理权", 6: "归属权"}[type]), + customRender: ({record: {type}}) => ({4: "查看权", 5: "管理权", 6: "归属权",7: "查看权", 8: "管理权", 9: "归属权",10: "查看权", 11: "管理权", 12: "归属权"}[type]) }, { title: "操作", @@ -156,24 +157,28 @@ const columns = ref([ }, ]) -const {data: studentList, fetch: searchStu, total, loading} = usePage(STUDENT_LIST, searchParams.value) +const {data: studentList, fetch: searchStu, total, loading} = usePage(STUDENT_LIST, searchParams) const stuPagination = computed(() => ({ - total: total, + total:total.value, showSizeChanger: false, - current: searchParams.value.page, + current: searchParams.value.pageNo, pageSize: searchParams.value.pageSize, - onChange: changePagination, + onChange: changePagination })); + const openDrawer = () => { visiable.value = true; }; const changePagination = (page) => { - searchParams.value.page = page; - searchStu(); + searchParams.value.pageNo = page; }; +function search(){ + searchParams.value.studentName = searchName.value + searchParams.value.pageNo = 1 +} function del(id) { Modal.confirm({ title: () => '确定删除?', @@ -194,7 +199,7 @@ const closeDrawer = () => { function reset(){ searchParams.value = initParams - searchStu() + searchName.value='' } watch(visiable, () => { diff --git a/src/views/projectcenter/ProjectAdd.vue b/src/views/projectcenter/ProjectAdd.vue index 3aa6448b..a4c463c9 100644 --- a/src/views/projectcenter/ProjectAdd.vue +++ b/src/views/projectcenter/ProjectAdd.vue @@ -305,6 +305,7 @@ import {storage} from "../../api/storage"; import * as api2 from "../../api/indexAudit"; import {validateName} from "@/api/index1"; import dayjs from "dayjs"; +import {scrollLoad} from "@/api/method"; export default { name: "projectAdd", diff --git a/src/views/projectcenter/ProjectManage.vue b/src/views/projectcenter/ProjectManage.vue index c1e8a74a..74935a36 100644 --- a/src/views/projectcenter/ProjectManage.vue +++ b/src/views/projectcenter/ProjectManage.vue @@ -991,7 +991,7 @@ export default { message.destroy(); return message.warning("项目名称重复,请重新填写"); } - api.createProject(state.projectInfo).then((res) => { + api.createProject(state.projectInfo).then(() => { state.doublepro = false; message.destroy(); message.success("创建成功");