From 5049c02ccf05665fee547ff3df4bf63b01f804dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com> Date: Tue, 26 Aug 2025 13:53:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=A4=A7=E9=83=A8?= =?UTF-8?q?=E5=88=86ui=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/hTable/hTableEdit.vue | 35 ++++------ src/components/hTable/index.vue | 15 ++++ src/utils/rules.ts | 8 +++ src/views/exam/classDetails.vue | 10 +-- src/views/exam/classExamRecord.vue | 11 +-- src/views/exam/index.vue | 14 ++-- src/views/school/SchoolEdit.vue | 80 ++++++++++------------ src/views/school/index.vue | 8 ++- src/views/student/index.vue | 7 ++ src/views/teacher/index.vue | 11 ++- src/views/toschoolinfomanage/editModal.vue | 17 ++++- 11 files changed, 122 insertions(+), 94 deletions(-) diff --git a/src/components/hTable/hTableEdit.vue b/src/components/hTable/hTableEdit.vue index 19dce09..3e84f98 100644 --- a/src/components/hTable/hTableEdit.vue +++ b/src/components/hTable/hTableEdit.vue @@ -8,20 +8,20 @@ const props = defineProps({ //** 传入的表单数据 */ id: { type: Number, - default: -1 + default: -1, }, tableData: { type: Object as PropType, - default: null + default: null, }, row: { type: Object, - default: null + default: null, }, tagData: { type: Object, - default: () => {} - } + default: () => {}, + }, }); const emit = defineEmits(["handlePagedCallback"]); const editFormRef = ref(); @@ -34,12 +34,12 @@ const editData = ref({ { required: true, message: "不能为空", - trigger: "blur" - } + trigger: "blur", + }, ], formLabelWidth: "120px", size: "small", - loading: false + loading: false, }); const Api = new hTableAPI(editData.value.table.apiUrl); onMounted(() => { @@ -69,7 +69,7 @@ function handlePagedCallback() { emit("handlePagedCallback"); // 传参给父组件 } function handleSubmitForm() { - editFormRef.value.validate(valid => { + editFormRef.value.validate((valid) => { if (!valid) { return; } @@ -88,7 +88,7 @@ function handleSubmitForm() { if (editData.value.table.editCallback) { editData.value.table.editCallback(form); } - Api.edit(form).then(res => { + Api.edit(form).then((res) => { editData.value.loading = false; if (res.code === 200) { ElMessage.success("操作成功"); @@ -105,7 +105,7 @@ function handleResetForm() { if (Array.isArray(item.valueE)) { item.valueE = []; } else if (typeof item.valueE === "number") { - item.valueE = 0; + item.valueE = ""; } else if (typeof item.valueE === "boolean") { item.valueE = false; } else { @@ -118,7 +118,7 @@ function fetchFormData() { editData.value.loading = false; if (editData.value.isedit) { handleResetForm(); - Api.Info(props.id).then(res => { + Api.Info(props.id).then((res) => { if (res.code === 200) { editData.value.frorm = res.data; for (const key in column.value) { @@ -201,19 +201,12 @@ function fetchFormData() { />
- +
- 立即提交 重置 diff --git a/src/components/hTable/index.vue b/src/components/hTable/index.vue index 7e391ad..a481e43 100644 --- a/src/components/hTable/index.vue +++ b/src/components/hTable/index.vue @@ -265,6 +265,19 @@ function handleSelectionChange(selection) { table.value.selectRows = selection; } +function searchReload() { + for (let name in table.value.column) { + if ( + !table.value.column[name].search || + table.value.column[name].value === undefined || + table.value.column[name].value === null || + table.value.column[name].value === "" + ) { + continue; + } + table.value.column[name].value = ""; + } +} // 查询 function handleReloadPaged(reload = true) { if (table.value.search === undefined || table.value.search.PageIndex === undefined) { @@ -429,6 +442,8 @@ function fetchPagedData() { 查询 + + 重置 diff --git a/src/utils/rules.ts b/src/utils/rules.ts index 89b8638..745a37f 100644 --- a/src/utils/rules.ts +++ b/src/utils/rules.ts @@ -21,6 +21,14 @@ export const ruleRequiredI = (max: number = 20, min: number = 0): Rule[] => { res.push({ min: min, message: `长度不能小于${min}`, trigger: "blur" }); return res; }; + +export const ruleNumber = [ + { + pattern: /^\d*\.?\d+$/, + message: "请输入正确数字", + trigger: "blur" + } +]; export const ruleRequiredNumber = [ { required: true, message: "不能为空", trigger: "blur" }, { diff --git a/src/views/exam/classDetails.vue b/src/views/exam/classDetails.vue index b520ef6..9f8ec28 100644 --- a/src/views/exam/classDetails.vue +++ b/src/views/exam/classDetails.vue @@ -43,13 +43,6 @@ const tableData: TableConfig = { }, operationColumn: true, // 显示操作按钮 operationColumnData: [ - { - // 操作按钮 - topBtn: true, // 是头部按钮 - label: "添加", - btnStyle: "success", - btnType: "custom", - }, { topBtn: false, // 头部按钮 show: true, @@ -91,7 +84,6 @@ const tableData: TableConfig = { grade: { label: "年级", width: "100px", - custom: (s) => `${s.gradeYear}${s.gradeLevel}`, search: true, add: false, // 字段允许添加 edit: false, // 字段允许修改 @@ -121,7 +113,7 @@ const tableData: TableConfig = { createTime: { label: "录入时间", width: "200px", - search: true, + search: false, add: false, // 字段允许添加 edit: false, // 字段允许修改 }, diff --git a/src/views/exam/classExamRecord.vue b/src/views/exam/classExamRecord.vue index 5adea3d..297186b 100644 --- a/src/views/exam/classExamRecord.vue +++ b/src/views/exam/classExamRecord.vue @@ -83,8 +83,8 @@ const tableData: TableConfig = { grade: { label: "年级", search: true, - type: "dropdown", - setting: {}, + // type: "dropdown", + // setting: {}, width: "60px", }, @@ -148,8 +148,11 @@ const tableData: TableConfig = { const showTable = ref(false); onMounted(async () => { //初始化数据原 - - tableData.column.grade.setting.datasource = (await getenum("GradeEnum")).data; + // tableData.column.grade.setting.datasource = (await getenum("GradeEnum")).data.map( + // (x) => { + // return { text: x.text, value: x.text }; + // } + // ); tableData.column.testPaperType.setting.datasource = ( await getenum("TestPaperTypeEnum") diff --git a/src/views/exam/index.vue b/src/views/exam/index.vue index 7d968b2..4afaff5 100644 --- a/src/views/exam/index.vue +++ b/src/views/exam/index.vue @@ -5,7 +5,7 @@ import { onMounted, ref } from "vue"; import { fa } from "element-plus/es/locales.mjs"; import { hTableAPI } from "@/api/hTable"; import { getenum } from "@/api/enum"; -import { ruleRequired, ruleRequiredNumber } from "@/utils/rules"; +import { ruleNumber, ruleRequired, ruleRequiredNumber } from "@/utils/rules"; import { ImportExamInfo } from "@/api/exam"; import { ElMessage } from "element-plus"; import { entryExamInfo } from "./examFun"; @@ -133,19 +133,17 @@ const tableData: TableConfig = { }, scoreLine: { label: "划线分数", - rules: ruleRequiredNumber, - search: true, + rules: ruleNumber, + search: false, width: "100px", - setting: {}, add: true, // 字段允许添加 edit: true, // 字段允许修改 }, baseSchoolScore: { label: "资源校平均分", - // rules: ruleRequiredNumber, - search: true, + rules: ruleNumber, + search: false, width: "150px", - setting: {}, add: true, // 字段允许添加 edit: true, // 字段允许修改 }, @@ -162,7 +160,7 @@ const tableData: TableConfig = { createTime: { label: "创建时间", type: "datetime", - search: true, + search: false, add: false, // 字段允许添加 edit: false, // 字段允许修改 }, diff --git a/src/views/school/SchoolEdit.vue b/src/views/school/SchoolEdit.vue index 5e48c40..cc4d593 100644 --- a/src/views/school/SchoolEdit.vue +++ b/src/views/school/SchoolEdit.vue @@ -6,11 +6,7 @@ :label-width="eData.formLabelWidth" clearable > - + - +

- 立即提交 重置 @@ -113,12 +102,12 @@ import { onMounted, ref } from "vue"; const props = defineProps({ id: { type: Number, - default: -1 + default: -1, }, row: { type: Object as PropType, - default: null - } + default: null, + }, }); const eData = ref({ @@ -129,8 +118,8 @@ const eData = ref({ Required: { required: true, message: "必填项", - trigger: "blur" - } + trigger: "blur", + }, }, formLabelWidth: "120px", size: "small", @@ -144,8 +133,8 @@ const eData = ref({ pname: "", cname: "", rname: "", - Enable: true - } + Enable: true, + }, }); onMounted(() => { fetchInitData(); @@ -159,7 +148,7 @@ async function selectChange(value, index) { let loc = eData.value.LocaArr2; if (index == 1) { eData.value.form.pname = - value == "" ? "" : eData.value.LocaArr1.find(s => s.Value == value).Text; + value == "" ? "" : eData.value.LocaArr1.find((s) => s.Value == value).Text; eData.value.form.cname = ""; eData.value.form.rname = ""; eData.value.form.cid = ""; @@ -168,40 +157,34 @@ async function selectChange(value, index) { loc = eData.value.LocaArr3; GetInfo = getregion; eData.value.form.cname = - value == "" ? "" : eData.value.LocaArr2.find(s => s.Value == value).Text; + value == "" ? "" : eData.value.LocaArr2.find((s) => s.Value == value).Text; eData.value.form.rname = ""; eData.value.form.rid = ""; } else { eData.value.form.rname = - value == "" ? "" : eData.value.LocaArr3.find(s => s.Value == value).Text; + value == "" ? "" : eData.value.LocaArr3.find((s) => s.Value == value).Text; } if (value == "" && index == 3) return; - let nodes = (await GetInfo(nid)).data.map(item => ({ + let nodes = (await GetInfo(nid)).data.map((item) => ({ Value: item.rid || item.cid || item.pid, - Text: item.rname || item.cname || item.pname + Text: item.rname || item.cname || item.pname, })); loc.splice(0, loc.length); loc.push(...nodes); } async function inputChange() { if (eData.value.form.pname == "") { - let p = eData.value.LocaArr1.find(s => - eData.value.form.Name.includes(s.Text) - ); + let p = eData.value.LocaArr1.find((s) => eData.value.form.Name.includes(s.Text)); if (!p) return; eData.value.form.pid = p.Value; await selectChange(eData.value.form.pid, 1); - let p1 = eData.value.LocaArr2.find(s => - eData.value.form.Name.includes(s.Text) - ); + let p1 = eData.value.LocaArr2.find((s) => eData.value.form.Name.includes(s.Text)); if (!p1) return; eData.value.form.cid = p1.Value; await selectChange(eData.value.form.cid, 2); - let p2 = eData.value.LocaArr3.find(s => - eData.value.form.Name.includes(s.Text) - ); + let p2 = eData.value.LocaArr3.find((s) => eData.value.form.Name.includes(s.Text)); if (!p2) return; eData.value.form.rid = p2.Value; await selectChange(eData.value.form.rid, 3); @@ -214,18 +197,17 @@ function handlePagedCallback() { } const schoolAddForm = ref(); function handleSubmitForm() { - schoolAddForm.value.validate(valid => { + schoolAddForm.value.validate((valid) => { if (valid) { eData.value.loading = true; let ids = ["pid", "cid", "rid"]; for (const key of ids) { - eData.value.form[key] = - eData.value.form[key] == "" ? 0 : eData.value.form[key]; + eData.value.form[key] = eData.value.form[key] == "" ? 0 : eData.value.form[key]; } if (!(props.id !== -1)) { eData.value.form.id = 0; } - EditSchool(eData.value.form).then(res => { + EditSchool(eData.value.form).then((res) => { eData.value.loading = false; if (res.code === 200) { ElMessage.success("操作成功"); @@ -237,11 +219,19 @@ function handleSubmitForm() { } }); } -function handleResetForm() {} +function handleResetForm() { + schoolAddForm.value.resetFields(); + eData.value.form.pid = ""; + eData.value.form.cid = ""; + eData.value.form.rid = ""; + eData.value.form.pname = ""; + eData.value.form.cname = ""; + eData.value.form.rname = ""; +} async function fetchInitData() { - eData.value.LocaArr1 = (await getProvince()).data.map(item => ({ + eData.value.LocaArr1 = (await getProvince()).data.map((item) => ({ Value: item.rid || item.cid || item.pid, - Text: item.rname || item.cname || item.pname + Text: item.rname || item.cname || item.pname, })); } diff --git a/src/views/school/index.vue b/src/views/school/index.vue index 0cc2547..092b7b6 100644 --- a/src/views/school/index.vue +++ b/src/views/school/index.vue @@ -8,7 +8,9 @@ defineOptions({ }); onMounted(() => {}); -function searchCallback(data) {} +function searchCallback(data) { + //let c = data.Conditions.find((s) => s.FieldName == "Pname"); +} const table = ref<{ initTable: (config: TableConfig) => void }>(null); const tableData: TableConfig = { apiUrl: "usercenter/back/schools", @@ -63,10 +65,10 @@ const tableData: TableConfig = { add: true, // 字段允许添加 edit: true, // 字段允许修改 }, - loc: { + pname: { label: "地区", width: "300px", - search: true, + search: false, custom: (row) => `${row.pname}-${row.cname}-${row.rname}`, add: false, // 字段允许添加 edit: false, // 字段允许修改 diff --git a/src/views/student/index.vue b/src/views/student/index.vue index a6147fe..a1d4b72 100644 --- a/src/views/student/index.vue +++ b/src/views/student/index.vue @@ -88,6 +88,8 @@ 查询 + + 重置 @@ -549,6 +551,11 @@ const handleSelectionChange = (selection: UserDetail[]) => { table.selectRows = selection; }; +function searchReload() { + for (const key in search) { + search[key] = ""; + } +} const handleDelete = () => { // if (table.selectRows.length === 0) { // ElMessage.warning("未勾选记录"); diff --git a/src/views/teacher/index.vue b/src/views/teacher/index.vue index a6db895..ca92c82 100644 --- a/src/views/teacher/index.vue +++ b/src/views/teacher/index.vue @@ -2,7 +2,7 @@
- + @@ -100,6 +100,7 @@ 查询 + 重置 import { ref, reactive, onMounted } from "vue"; import { ElMessage, ElMessageBox } from "element-plus"; -import type { UploadProps } from "element-plus"; +import type { FormInstance, UploadProps } from "element-plus"; import UserForm from "./edit.vue"; import { @@ -347,6 +348,7 @@ const baseUrl = import.meta.env.VITE_API_USERCENTER_URL; const excelImportUsersUrl = `${baseUrl}/back/users/downloadimportusersexceltemplate`; const excelImportMeetingUrl = `${baseUrl}/back/users/downloadimportmeetingexceltemplate`; const excelImportOrdersUrl = `${baseUrl}/back/users/downloadimportordersexceltemplate`; +const searchForm = ref(); const editId = ref(0); const showAllPosition = ref([]); @@ -618,6 +620,11 @@ const PositionsSort = (arr: Position[]) => { return arr; }; +function searchReload() { + for (const key in search) { + search[key] = ""; + } +} const handleReloadPaged = (event?: any, searchUnUse?: boolean) => { pagination.index = 1; table.selectRows = []; diff --git a/src/views/toschoolinfomanage/editModal.vue b/src/views/toschoolinfomanage/editModal.vue index 647f431..0ff8e35 100644 --- a/src/views/toschoolinfomanage/editModal.vue +++ b/src/views/toschoolinfomanage/editModal.vue @@ -157,7 +157,7 @@ " >
- 执行记录{{ index + 1 }}:{{ record.time }} + 执行记录{{ index + 1 }}:{{ record.operator }} {{ record.time }}
{{ record.content }} @@ -209,6 +209,8 @@ v-model="operationForm.operationContent" type="textarea" :rows="4" + maxlength="300" + show-word-limit :placeholder="`请输入${operationContentLabel}`" /> @@ -230,6 +232,8 @@ import { ElMessage } from "element-plus"; import { getSchoolData } from "@/api/userCenter"; import { getSchoolBusinessPeopleListApi, addOrEditApi } from "@/api/toschoolinfomanage"; import { setFips } from "crypto"; +import { useUserStoreHook } from "@/store/modules/user"; +import { isAllEmpty } from "@pureadmin/utils"; const activeName = ref(0); @@ -258,7 +262,9 @@ const operationForm = reactive({ const operationFormRef = ref(); // 执行记录和完结情况数据 -const executionRecords = ref>([]); +const executionRecords = ref>( + [] +); const finishRecord = ref<{ time: string; content: string } | null>(null); // 从父级 detailData.solutionRecord 回显本地显示数据 @@ -271,6 +277,7 @@ watch( executionRecords.value = recs.map((r: any) => ({ time: r?.executionTimeStr || r?.executionTime || "", content: r?.executionRecords || "", + operator: r?.operator || "", })); // 完结情况回显 if (sr?.endRecordTime || sr?.endRecord) { @@ -443,9 +450,15 @@ const confirmOperation = async () => { if (!props.detailData.solutionRecord) props.detailData.solutionRecord = {} as any; if (!Array.isArray(props.detailData.solutionRecord.record)) props.detailData.solutionRecord.record = []; + const userName = computed(() => { + return isAllEmpty(useUserStoreHook()?.nickName) + ? useUserStoreHook()?.userName + : useUserStoreHook()?.nickName; + }); props.detailData.solutionRecord.record.push({ executionTime: operationTime, executionRecords: operationContent, + operator: userName.value, }); break; case "addFinish":