From e1fdca95b818d3efa58eb226401dadba11a524bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com> Date: Wed, 13 Aug 2025 18:38:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E6=9E=9A=E4=B8=BE?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E6=96=B9=E5=BC=8F=20=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/enum.ts | 4 +-- src/components/hTable/hTableEdit.vue | 20 +++++++++--- src/components/hTable/index.vue | 11 +++---- src/views/class/index.vue | 49 ++++++++++++++++++++++++---- 4 files changed, 65 insertions(+), 19 deletions(-) diff --git a/src/api/enum.ts b/src/api/enum.ts index 21e3c72..055735b 100644 --- a/src/api/enum.ts +++ b/src/api/enum.ts @@ -7,7 +7,7 @@ import type { Res } from "@/utils/http/types"; * @return {object} */ export function getenum(type) { - return http.request>("get", `public/enum/${type}`); + return http.request>("get", `Public/enum/${type}`); } /** * @description 获取枚举对象 @@ -15,5 +15,5 @@ export function getenum(type) { * @return {object} */ export function getenumDic(type) { - return http.request>("get", `public/enum/${type}/Dic`); + return http.request>("get", `Public/enum/${type}/Dic`); } diff --git a/src/components/hTable/hTableEdit.vue b/src/components/hTable/hTableEdit.vue index 3a9bb75..cd24367 100644 --- a/src/components/hTable/hTableEdit.vue +++ b/src/components/hTable/hTableEdit.vue @@ -158,7 +158,7 @@ function fetchFormData() { format="YYYY-MM-DD" value-format="YYYY-MM-DD" :placeholder="o.label" - style="width: 100%" + class="elWidth" @change="o.change" /> @@ -169,12 +169,12 @@ function fetchFormData() { clearable filterable :placeholder="o.label" - style="width: 100%" + class="elWidth" @change="o.change" > @@ -195,11 +196,16 @@ function fetchFormData() { v-model="o.valueE as boolean" active-text="启用" inactive-text="禁用" + class="elWidth" @change="o.change" />
- +
@@ -215,3 +221,9 @@ function fetchFormData() { + diff --git a/src/components/hTable/index.vue b/src/components/hTable/index.vue index 7057044..57b9236 100644 --- a/src/components/hTable/index.vue +++ b/src/components/hTable/index.vue @@ -281,7 +281,7 @@ function handleReloadPaged(reload = true) { data.ConditionalType = "Like"; } data.FieldName = name.charAt(0).toUpperCase() + name.slice(1); - data.FieldValue = table.value.column[name].value; + data.FieldValue = table.value.column[name].value.toString(); if (table.value.column[name].searchType != undefined) { data.ConditionalType = table.value.column[name].searchType || 0; @@ -303,11 +303,10 @@ async function fetchInitData() { const element = table.value.column[key]; if (element.type === "dropdown") { if (!element.setting.datasource) { - // 存在值就不处理 - - let rdata = await eval(element.setting.datasourceStr); - element.setting.datasource = rdata.data; - console.log(key + " " + element.setting.datasourceStr, rdata); + // 不安全取消 存在值就不处理 + // let rdata = await eval(element.setting.datasourceStr); + // element.setting.datasource = rdata.data; + // console.log(key + " " + element.setting.datasourceStr, rdata); } } if ( diff --git a/src/views/class/index.vue b/src/views/class/index.vue index 2aab196..78a25b4 100644 --- a/src/views/class/index.vue +++ b/src/views/class/index.vue @@ -4,12 +4,14 @@ import { TableConfig } from "@/components/hTable/hTable"; import { onMounted, ref } from "vue"; import { fa } from "element-plus/es/locales.mjs"; import { hTableAPI } from "@/api/hTable"; +import { getenum } from "@/api/enum"; const ControllerName = "Class"; defineOptions({ name: ControllerName }); +const SchoolApi = new hTableAPI("School"); function searchCallback(data) {} const table = ref<{ initTable: (config: TableConfig) => void }>(); @@ -59,24 +61,46 @@ const tableData: TableConfig = { edit: false, // 字段允许修改 width: "150px" }, + schoolId: { + label: "学校", + width: "180px", + search: true, + type: "dropdown", + add: true, // 字段允许添加 + edit: true, // 字段允许修改 + setting: {} + }, name: { - label: "角色名称", + label: "名称", width: "180px", search: true, searchType: "Like", add: true, // 字段允许添加 edit: true // 字段允许修改 }, - enable: { - label: "启用", - type: "switch", - search: false, - add: false, // 字段允许添加 + Grade: { + label: "年级", + width: "180px", + type: "dropdown", + custom: row => `${row.grade ?? ""}`, + // `${row.grade ?? ""} ${row.gradeLevel + row.graduationYear}`, + search: true, + setting: {}, + add: true, // 字段允许添加 + edit: false // 字段允许修改 + }, + type: { + label: "类型", + width: "150px", + type: "dropdown", + search: true, + add: true, // 字段允许添加 edit: true, // 字段允许修改 - valueE: true // 编辑时的默认值 + setting: {} }, createTime: { label: "创建时间", + width: "180px", type: "datetime", search: true, add: false, // 字段允许添加 @@ -84,6 +108,8 @@ const tableData: TableConfig = { }, remark: { label: "备注", + type: "textarea", + editRows: 3, search: false, add: true, // 字段允许添加 edit: true // 字段允许修改 @@ -100,6 +126,15 @@ const showTable = ref(false); onMounted(async () => { //初始化数据原 + tableData.column.Grade.setting.datasource = (await getenum("GradeEnum")).data; + + tableData.column.type.setting.datasource = ( + await getenum("ClassTypeEnum") + ).data; + tableData.column.schoolId.setting.datasource = ( + await SchoolApi.querycombo({ TextName: "Name", ValueName: "Id" }) + ).data; + showTable.value = true; });