20260723225202
This commit is contained in:
1 parent
5f73b54802
commit
4d118a0037
22 files changed
+1403
-259
No files matched your search
@@ -3,7 +3,6 @@ import { computed, ref, watch } from "vue";
|
||||
import FmsTable from "@/components/fms-table/FmsTable.vue";
|
||||
import { createTempId } from "@/utils/tempId";
|
||||
import FieldGroupManager from "./FieldGroupManager.vue";
|
||||
import { createDeleteCell, createSelectCell, createToggleCell } from "./cellRenderers";
|
||||
|
||||
const props = defineProps({
|
||||
moduleId: { type: String, required: true },
|
||||
@@ -17,6 +16,7 @@ const emit = defineEmits(["update", "updateGroups"]);
|
||||
|
||||
const localEdit = ref([]);
|
||||
const groupManagerVisible = ref(false);
|
||||
const activeKey = ref(null);
|
||||
|
||||
watch(
|
||||
() => props.editConfig,
|
||||
@@ -30,11 +30,6 @@ function emitUpdate() {
|
||||
emit("update", localEdit.value.map((r) => ({ ...r })));
|
||||
}
|
||||
|
||||
function setField(row, field, value) {
|
||||
row[field] = value === undefined || value === null ? null : value;
|
||||
emitUpdate();
|
||||
}
|
||||
|
||||
const availableFields = computed(() =>
|
||||
(props.fields || [])
|
||||
.filter((f) => f.b_canuse === 1)
|
||||
@@ -72,7 +67,7 @@ function makeSwitchCol(field, title, width) {
|
||||
title,
|
||||
width: width || 60,
|
||||
align: "center",
|
||||
customCell: createToggleCell(field, (row) => setField(row, field, row[field] === 1 ? 0 : 1)),
|
||||
editor: { type: "checkbox", onChange: () => emitUpdate() },
|
||||
};
|
||||
}
|
||||
|
||||
@@ -81,12 +76,11 @@ const columns = [
|
||||
dataIndex: "b_field_id",
|
||||
title: "字段",
|
||||
width: 160,
|
||||
customCell: createSelectCell({
|
||||
value: "b_field_id",
|
||||
getOptions: () => availableFields.value,
|
||||
onChange: (row, v) => setField(row, "b_field_id", v),
|
||||
placeholder: "选择字段",
|
||||
}),
|
||||
editor: {
|
||||
type: "select",
|
||||
options: () => availableFields.value,
|
||||
onChange: () => emitUpdate(),
|
||||
},
|
||||
},
|
||||
makeSwitchCol("b_required", "必填"),
|
||||
makeSwitchCol("b_readonly", "只读"),
|
||||
@@ -95,12 +89,11 @@ const columns = [
|
||||
dataIndex: "b_group_id",
|
||||
title: "编辑分组",
|
||||
width: 160,
|
||||
customCell: createSelectCell({
|
||||
value: "b_group_id",
|
||||
getOptions: () => groupOptions.value,
|
||||
onChange: (row, v) => setField(row, "b_group_id", v),
|
||||
placeholder: "选择分组",
|
||||
}),
|
||||
editor: {
|
||||
type: "select",
|
||||
options: () => groupOptions.value,
|
||||
onChange: () => emitUpdate(),
|
||||
},
|
||||
},
|
||||
{ dataIndex: "b_xh", title: "排序号", width: 80 },
|
||||
{
|
||||
@@ -108,7 +101,7 @@ const columns = [
|
||||
title: "操作",
|
||||
width: 60,
|
||||
align: "center",
|
||||
customCell: createDeleteCell((row) => deleteRow(row)),
|
||||
actions: [{ type: "danger", label: "删除", confirm: { title: "确定删除该记录?", okText: "删除" }, onClick: (row) => deleteRow(row) }],
|
||||
},
|
||||
];
|
||||
</script>
|
||||
@@ -122,7 +115,13 @@ const columns = [
|
||||
</a-space>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<FmsTable :columns="columns" :data-source="localEdit" row-key="b_id" />
|
||||
<FmsTable
|
||||
:columns="columns"
|
||||
:data-source="localEdit"
|
||||
row-key="b_id"
|
||||
:active-row-key="activeKey"
|
||||
@row-click="(ev, row) => (activeKey = row.b_id)"
|
||||
/>
|
||||
</div>
|
||||
<FieldGroupManager
|
||||
v-model:visible="groupManagerVisible"
|
||||
@@ -144,13 +143,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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user