chore: group dict刷新

This commit is contained in:
xiaojunnuo
2025-11-30 02:16:04 +08:00
parent 6be7591332
commit 52ebeab90b
4 changed files with 17 additions and 12 deletions
@@ -15,8 +15,9 @@ import GroupSelector from "/@/views/certd/pipeline/group/group-selector.vue";
import { useCertViewer } from "/@/views/certd/pipeline/use"; import { useCertViewer } from "/@/views/certd/pipeline/use";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { GetDetail, GetObj } from "./api"; import { GetDetail, GetObj } from "./api";
import { groupDictRef } from "./group/dicts";
export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys } }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context: { selectedRowKeys } }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const router = useRouter(); const router = useRouter();
const lastResRef = ref(); const lastResRef = ref();
@@ -495,6 +496,11 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys
component: { component: {
name: GroupSelector, name: GroupSelector,
vModel: "modelValue", vModel: "modelValue",
on: {
refresh: async () => {
await groupDictRef.reloadDict();
},
},
}, },
}, },
column: { column: {
@@ -0,0 +1,7 @@
import { dict } from "@fast-crud/fast-crud";
export const groupDictRef = dict({
url: "/pi/pipeline/group/all",
value: "id",
label: "name",
});
@@ -35,6 +35,7 @@
<script setup lang="ts"> <script setup lang="ts">
import createCrudOptions from "./crud"; import createCrudOptions from "./crud";
import { dict, FsDictSelect } from "@fast-crud/fast-crud"; import { dict, FsDictSelect } from "@fast-crud/fast-crud";
import { groupDictRef } from "./dicts";
const props = defineProps<{ const props = defineProps<{
modelValue?: number; modelValue?: number;
@@ -43,11 +44,7 @@ const props = defineProps<{
defineOptions({ defineOptions({
name: "GroupSelector", name: "GroupSelector",
}); });
const groupDictRef = dict({
url: "/pi/pipeline/group/all",
value: "id",
label: "name",
});
const emit = defineEmits(["refresh", "update:modelValue"]); const emit = defineEmits(["refresh", "update:modelValue"]);
function doRefresh() { function doRefresh() {
emit("refresh"); emit("refresh");
@@ -35,19 +35,14 @@ import { useI18n } from "/src/locales";
const { t } = useI18n(); const { t } = useI18n();
import ChangeNotification from "/@/views/certd/pipeline/components/change-notification.vue"; import ChangeNotification from "/@/views/certd/pipeline/components/change-notification.vue";
import { useSettingStore } from "/@/store/settings"; import { useSettingStore } from "/@/store/settings";
import { groupDictRef } from "./group/dicts";
defineOptions({ defineOptions({
name: "PipelineManager", name: "PipelineManager",
}); });
const groupDictRef = dict({
url: "/pi/pipeline/group/all",
value: "id",
label: "name",
});
const selectedRowKeys = ref([]); const selectedRowKeys = ref([]);
const context: any = { const context: any = {
groupDictRef,
selectedRowKeys, selectedRowKeys,
}; };
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context }); const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context });