Merge pull request 'dev' (#18) from dev into staging

Reviewed-on: #18
This commit is contained in:
hy 2025-09-25 15:48:08 +08:00
commit 7cf08fcf14
4 changed files with 53 additions and 19 deletions

View File

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

View File

@ -44,7 +44,7 @@ const props = defineProps({
default: () => ({}),
},
});
const expands = ref<any[]>();
const table = ref<TableConfig>(props.tableConfig);
const tableShowColumn = ref<Record<string, TableColumn>>();
onBeforeMount(() => {
@ -338,6 +338,8 @@ function handleReloadPaged(reload = true) {
if (table.value.searchCallback) {
table.value.searchCallback(table.value.search);
}
//
if (table.value.expandColumn) expands.value = [];
fetchPagedData();
}
//
@ -459,6 +461,7 @@ function fetchPagedData() {
@selection-change="handleSelectionChange"
@sort-change="sortChange"
@expand-change="table.expandChange"
:expand-row-keys="expands"
>
<el-table-column v-if="table.selectColumn" type="selection" width="40" />
<el-table-column

View File

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

View File

@ -448,6 +448,7 @@ async function onSubmit() {
gradeYear: form.baseInfo.gradeYear,
schoolBusinessUser: form.baseInfo.people,
startTime: form.baseInfo.date,
endTime: form.baseInfo.endTime,
isDiscussion: form.work.talk,
discussion: form.work.talkDetail,
isClassMeeting: form.work.classMeeting,