wupengfei
2025-08-06 9f70a1ee5cdffaef3a96e4042c8eea251df2fa0d
feat: 字典
4个文件已修改
29 ■■■■ 已修改文件
src/hooks/dic.ts 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/DictionaryManage/DataDictionary.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/DictionaryManage/DictionaryCategoryManage.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/DictionaryManage/components/AddOrEditDictionaryDialog.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/hooks/dic.ts
@@ -25,6 +25,12 @@
    });
  }
  function updateDictionaryCategorySelect() {
    queryClient.invalidateQueries({
      queryKey: ['dictionaryServices/getDictionaryCategorySelect'],
    });
  }
  function getDictionaryCategoryById(id: string) {
    return dictionaryCategoryList.value.find((x) => x.value === id);
  }
@@ -43,6 +49,7 @@
    getDictionaryCategoryById,
    getDictionaryCategoryNameByCode,
    getDictionaryCategoryByCode,
    updateDictionaryCategorySelect,
  };
}
@@ -96,6 +103,12 @@
    });
  }
  function updateDictionaryDataSelect() {
    queryClient.invalidateQueries({
      queryKey: ['dictionaryServices/getDictionaryDataSelect'],
    });
  }
  return {
    dictionaryDataList,
    ensureQueryData,
@@ -103,5 +116,6 @@
    getDictionaryDataNameById,
    getDictionaryDataNameByCode,
    getDictionaryDataByCode,
    updateDictionaryDataSelect,
  };
}
src/views/DictionaryManage/DataDictionary.vue
@@ -86,10 +86,9 @@
  operationBtnMap,
});
const { dictionaryCategoryList, ensureQueryData, getDictionaryCategoryNameByCode } =
  useGetDictionaryCategorySelect();
const { dictionaryCategoryList, ensureQueryData } = useGetDictionaryCategorySelect();
const { getDictionaryDataNameByCode } = useDictionaryDataSelect({
const { getDictionaryDataNameByCode, updateDictionaryDataSelect } = useDictionaryDataSelect({
  categoryCode: CategoryCode.IndustryCategory,
});
@@ -202,6 +201,7 @@
    let res = await dictionaryServices.saveDictionaryData(params);
    if (res) {
      Message.successMessage('操作成功');
      updateDictionaryDataSelect();
      getList(paginationState.pageIndex);
      dialogState.dialogVisible = false;
    }
src/views/DictionaryManage/DictionaryCategoryManage.vue
@@ -62,6 +62,7 @@
  operationBtnMap,
});
const { updateDictionaryCategorySelect } = useGetDictionaryCategorySelect();
const BaseState = {
  loading: true,
};
@@ -121,7 +122,7 @@
  }
}
const { dialogProps, handleAdd, handleEdit, editForm } = useFormDialog({
const { dialogProps, handleAdd, handleEdit, editForm, dialogState } = useFormDialog({
  onConfirm: handleAddOrEdit,
  defaultFormParams: {
    id: '',
@@ -146,7 +147,9 @@
    let res = await dictionaryServices.saveDictionaryCategory(params);
    if (res) {
      Message.successMessage('操作成功');
      updateDictionaryCategorySelect();
      getList(paginationState.pageIndex);
      dialogState.dialogVisible = false;
    }
  } catch (error) {}
}
src/views/DictionaryManage/components/AddOrEditDictionaryDialog.vue
@@ -10,7 +10,7 @@
      <ProFormItemV2
        label="行业类型:"
        prop="field1"
        v-if="category?.data?.code === '30'"
        v-if="category?.data?.code === CategoryCode.Position"
        :check-rules="[{ message: '请选择行业类型' }]"
      >
        <ProFormSelect
@@ -37,7 +37,7 @@
      <ProFormItemV2 label="编号:" prop="code">
        <ProFormText v-model.trim="form.code"></ProFormText>
      </ProFormItemV2>
      <ProFormItemV2 label="图片:" prop="src" v-if="category?.data?.code === '50'">
      <ProFormItemV2 label="图片:" prop="src" v-if="category?.data?.code === CategoryCode.Welfare">
        <ProFormImageUpload v-model:file-url="form.field2" :limitFileCount="1"></ProFormImageUpload>
      </ProFormItemV2>
      <ProFormItemV2 label="状态:" prop="status">