| | |
| | | <template> |
| | | <ProDialog |
| | | :title="`${title}字典`" |
| | | :title="form.title" |
| | | v-model="visible" |
| | | @close="onDialogClose" |
| | | destroy-on-close |
| | |
| | | ></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="图片:" |
| | |
| | | }); |
| | | |
| | | type Form = { |
| | | title?: string; |
| | | id?: string; |
| | | categoryId: string; |
| | | content: string; |
| | |
| | | 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; |