20260723225202

This commit is contained in:
oneao committed 2026-07-23 22:52:02 +08:00
1 parent 5f73b54802
commit 4d118a0037
22 files changed
+1403 -259

No files matched your search

@@ -1,7 +1,6 @@
<script setup>
import { ref, watch } from "vue";
import FmsTable from "@/components/fms-table/FmsTable.vue";
import { createSelectCell, createToggleCell } from "./cellRenderers";
const FIELD_TYPES = [
{ label: "输入框", value: "input" },
@@ -24,6 +23,7 @@ const props = defineProps({
const emit = defineEmits(["update", "sync"]);
const localFields = ref([]);
const activeKey = ref(null);
watch(
() => props.fields,
@@ -37,11 +37,6 @@ function emitUpdate() {
emit("update", localFields.value.map((r) => ({ ...r })));
}
function setField(row, field, value) {
row[field] = value === "" ? null : value;
emitUpdate();
}
const columns = [
{ dataIndex: "b_field", title: "字段名", width: 140 },
{ dataIndex: "b_name", title: "字段名称", width: 140 },
@@ -49,11 +44,11 @@ const columns = [
dataIndex: "b_type",
title: "控件类型",
width: 130,
customCell: createSelectCell({
value: "b_type",
getOptions: () => FIELD_TYPES,
onChange: (row, v) => setField(row, "b_type", v),
}),
editor: {
type: "select",
options: FIELD_TYPES,
onChange: () => emitUpdate(),
},
},
{ dataIndex: "b_default_value", title: "默认值", width: 120 },
{ dataIndex: "b_i18n", title: "多语言键", width: 140 },
@@ -62,7 +57,7 @@ const columns = [
title: "启用",
width: 70,
align: "center",
customCell: createToggleCell("b_canuse", (row) => setField(row, "b_canuse", row.b_canuse === 1 ? 0 : 1)),
editor: { type: "checkbox", onChange: () => emitUpdate() },
},
];
</script>
@@ -81,7 +76,13 @@ const columns = [
</a-space>
</div>
<div class="panel-body">
<FmsTable :columns="columns" :data-source="localFields" row-key="b_id" />
<FmsTable
:columns="columns"
:data-source="localFields"
row-key="b_id"
:active-row-key="activeKey"
@row-click="(ev, row) => (activeKey = row.b_id)"
/>
</div>
</div>
</template>
@@ -97,13 +98,13 @@ const columns = [
display: flex;
flex: none;
gap: 8px;
padding: 12px 20px;
padding: 12px 20px 0;
}
.panel-body {
flex: 1;
min-height: 0;
padding: 16px 20px;
padding: 12px 20px 16px;
display: flex;
flex-direction: column;
}