commit
7cf08fcf14
|
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue