staging #23

Merged
hy merged 38 commits from staging into master 2025-10-14 11:13:16 +08:00
2 changed files with 48 additions and 18 deletions
Showing only changes of commit b56c9f819a - Show all commits

View File

@ -1,3 +1,5 @@
import { array } from "vue-types";
export interface Dialog { export interface Dialog {
/** 对话框是否可见 */ /** 对话框是否可见 */
visible: boolean; visible: boolean;
@ -380,25 +382,33 @@ export function intTableData(tValue: TableConfig): TableConfig {
element.search = { ...new TableColumnSearch(), ...element.search }; element.search = { ...new TableColumnSearch(), ...element.search };
element.setting = { ...new FieldSetting(), ...element.setting }; element.setting = { ...new FieldSetting(), ...element.setting };
if ( //已有的情况下以 传入为主
element.custom == undefined && if (element.custom != undefined) continue;
(element.type === "switch" || switch (element.type) {
element.type === "dropdown" || case "switch":
element.type === "string" || case "dropdown": {
element.type === undefined)
) {
if (element.type === "string" || element.type === undefined)
element.custom = row => row[key];
else {
element.custom = row => { element.custom = row => {
let sc = element.setting.datasource.find( const value = Array.isArray(row[key]) ? row[key] : [row[key]];
s => s[element.setting.mapValue] + "" == row[key] + "" const res = value.map(item => {
const sc = element.setting.datasource.find(
s => s[element.setting.mapValue] + "" == item + ""
); );
return !sc ? row[key] : sc[element.setting.maplabel]; return !sc ? item : sc[element.setting.maplabel];
});
return res.join(",");
}; };
break;
} }
} else if (element.custom == undefined) {
case "string":
case undefined: {
element.custom = row => row[key]; element.custom = row => row[key];
break;
}
default: {
element.custom = row => row[key];
break;
}
} }
} }

View File

@ -8,11 +8,11 @@ import {
} from "@/components/hTable/hTable"; } from "@/components/hTable/hTable";
import { onMounted, ref } from "vue"; import { onMounted, ref } from "vue";
import { fa } from "element-plus/es/locales.mjs"; import { fa } from "element-plus/es/locales.mjs";
import { getenum } from "@/api/enum";
defineOptions({ defineOptions({
name: "School", name: "School",
}); });
onMounted(() => {});
function searchCallback(data) { function searchCallback(data) {
//let c = data.Conditions.find((s) => s.FieldName == "Pname"); //let c = data.Conditions.find((s) => s.FieldName == "Pname");
} }
@ -22,6 +22,7 @@ const tableData: TableConfig = intTableData({
selectColumn: false, // selectColumn: false, //
border: false, // border: false, //
searchCallback: searchCallback, searchCallback: searchCallback,
editCallback: function (from) {},
search: { search: {
// //
show: true, show: true,
@ -74,6 +75,17 @@ const tableData: TableConfig = intTableData({
width: "300px", width: "300px",
custom: (row) => `${row.pname}-${row.cname}-${row.rname}`, custom: (row) => `${row.pname}-${row.cname}-${row.rname}`,
}, },
projectType: {
label: "学校项目",
width: "200px",
type: "dropdown",
search: new TableColumnSearch(true),
edit: {
multiple: true,
edit: true,
},
},
enable: { enable: {
label: "启用", label: "启用",
type: "switch", type: "switch",
@ -91,10 +103,18 @@ const tableData: TableConfig = intTableData({
}, },
selectRows: [], selectRows: [],
}); });
const showTable = ref(false);
onMounted(async () => {
let res = await getenum("SchoolProjectEnum");
tableData.column.projectType.setting.datasource = res.data;
//
showTable.value = true;
});
</script> </script>
<template> <template>
<div> <div>
<ahTable ref="table" :tableConfig="tableData" /> <ahTable v-if="showTable" ref="table" :tableConfig="tableData" />
</div> </div>
</template> </template>