20260726225220
This commit is contained in:
1 parent
e3c7c6f8da
commit
a8478d60ed
170 files changed
+6786
-1678
No files matched your search
@@ -1,7 +1,6 @@
|
||||
<script setup>
|
||||
import { computed, ref, shallowRef, watch } from "vue";
|
||||
import FmsTable from "@/components/fms-table/FmsTable.vue";
|
||||
import { createTempId } from "@/utils/tempId";
|
||||
import FieldGroupManager from "./FieldGroupManager.vue";
|
||||
|
||||
const props = defineProps({
|
||||
@@ -21,16 +20,22 @@ const activeKey = ref(null);
|
||||
watch(
|
||||
() => props.editConfig,
|
||||
(val) => {
|
||||
if (val === localEdit.value) return;
|
||||
localEdit.value = val?.map((r) => ({ ...r })) || [];
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
function emitUpdate() {
|
||||
emit(
|
||||
"update",
|
||||
localEdit.value.map((r) => ({ ...r })),
|
||||
);
|
||||
emit("update", localEdit.value);
|
||||
}
|
||||
|
||||
function onRowOrderChange(rows) {
|
||||
localEdit.value = rows.map((row, index) => ({
|
||||
...row,
|
||||
b_xh: (index + 1) * 10,
|
||||
}));
|
||||
emitUpdate();
|
||||
}
|
||||
|
||||
const availableFields = computed(() =>
|
||||
@@ -45,21 +50,8 @@ const groupOptions = computed(() =>
|
||||
.map((g) => ({ label: g.b_title || `分组-${g.b_id}`, value: String(g.b_id) })),
|
||||
);
|
||||
|
||||
function addRow() {
|
||||
localEdit.value.push({
|
||||
b_id: createTempId(),
|
||||
b_module_id: props.moduleId,
|
||||
b_field_id: null,
|
||||
b_required: 0,
|
||||
b_readonly: 0,
|
||||
b_disabled: 0,
|
||||
b_group_id: null,
|
||||
b_xh: localEdit.value.length * 10,
|
||||
});
|
||||
emitUpdate();
|
||||
}
|
||||
|
||||
function deleteRow(record) {
|
||||
if (props.loading) return;
|
||||
localEdit.value = localEdit.value.filter((r) => r.b_id !== record.b_id);
|
||||
emitUpdate();
|
||||
}
|
||||
@@ -120,17 +112,19 @@ const columns = shallowRef([
|
||||
<div class="edit-config-panel">
|
||||
<div class="panel-toolbar">
|
||||
<a-space>
|
||||
<a-button type="primary" @click="addRow">新增行</a-button>
|
||||
<a-button @click="groupManagerVisible = true">分组管理</a-button>
|
||||
<a-button :disabled="loading" @click="groupManagerVisible = true">分组管理</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<FmsTable
|
||||
v-model:columns="columns"
|
||||
:data-source="localEdit"
|
||||
:editable="!loading"
|
||||
:row-draggable="!loading"
|
||||
row-key="b_id"
|
||||
:active-row-key="activeKey"
|
||||
@row-click="(ev, row) => (activeKey = row.b_id)"
|
||||
@row-order-change="onRowOrderChange"
|
||||
/>
|
||||
</div>
|
||||
<FieldGroupManager
|
||||
|
||||
Reference in new issue
Block a user