zhengyiming
9 天以前 650a84730f4418ebbcdc58bbadd4d56f5dd3c8fd
src/views/DictionaryManage/components/AddOrEditDictionaryDialog.vue
@@ -1,6 +1,6 @@
<template>
  <ProDialog
    :title="`${title}字典`"
    :title="form.title"
    v-model="visible"
    @close="onDialogClose"
    destroy-on-close
@@ -36,7 +36,7 @@
        ></ProFormInputNumber>
      </ProFormItemV2>
      <ProFormItemV2 label="编号:" prop="code" :check-rules="[{ message: '请输入编号' }]">
        <ProFormText v-model.trim="form.code"></ProFormText>
        <ProFormText v-model.trim="form.code" :disabled="!!form.id"></ProFormText>
      </ProFormItemV2>
      <ProFormItemV2
        label="图片:"
@@ -85,6 +85,7 @@
});
type Form = {
  title?: string;
  id?: string;
  categoryId: string;
  content: string;
@@ -98,29 +99,15 @@
const form = defineModel<Form>('form');
const visible = defineModel<boolean>('modelValue');
const title = computed(() => (form.value.id ? '编辑' : '新增'));
const { getDictionaryCategoryById } = useGetDictionaryCategorySelect();
const { dictionaryDataList, refetch, getDictionaryDataNameById } = useDictionaryDataSelect({
const { dictionaryDataList } = useDictionaryDataSelect({
  categoryCode: computed(() => CategoryCode.IndustryCategory),
});
const category = computed(() => {
  return getDictionaryCategoryById(form.value.categoryId);
});
watch(
  () => visible.value,
  (value) => {
    if (value) {
      refetch();
    }
  },
  {
    immediate: true,
  }
);
const emit = defineEmits<{
  (e: 'onConfirm'): void;