zhengyiming
9 天以前 27d44236653ecdb3bcaa4d03976ea8d163002f65
src/views/DictionaryManage/DataDictionary.vue
@@ -1,7 +1,7 @@
<template>
  <LoadingLayout :loading="state.loading">
    <AppContainer>
      <ProTableQueryFilterBar @on-reset="reset">
      <ProTableQueryFilterBar @on-reset="handleReset">
        <template #query>
          <QueryFilterItem>
            <FieldSelect
@@ -43,9 +43,6 @@
            :before-change="() => setCategoryVis(row)"
          />
        </template>
        <template #category="{ row }">
          {{ row.category?.name }}
        </template>
      </ProTableV2>
    </AppContainer>
    <AddOrEditDictionaryDialog v-bind="dialogProps" />
@@ -86,10 +83,9 @@
  operationBtnMap,
});
const { dictionaryCategoryList, ensureQueryData, getDictionaryCategoryNameByCode } =
  useGetDictionaryCategorySelect();
const { dictionaryCategoryList, ensureQueryData } = useGetDictionaryCategorySelect();
const { getDictionaryDataNameByCode } = useDictionaryDataSelect({
const { getDictionaryDataNameByCode, updateDictionaryDataSelect } = useDictionaryDataSelect({
  categoryCode: CategoryCode.IndustryCategory,
});
@@ -182,7 +178,9 @@
    isDisabled: false,
    field1: '',
    field2: [] as UploadUserFile[],
    title: '新增字典',
  },
  editTitle: '编辑字典',
});
async function handleAddOrEdit() {
@@ -202,6 +200,7 @@
    let res = await dictionaryServices.saveDictionaryData(params);
    if (res) {
      Message.successMessage('操作成功');
      updateDictionaryDataSelect(editForm.categoryId);
      getList(paginationState.pageIndex);
      dialogState.dialogVisible = false;
    }
@@ -216,8 +215,16 @@
      isDisabled: !row.isDisabled,
    };
    let res = await dictionaryServices.setDictionaryDataIsDisabled(params);
    updateDictionaryDataSelect(row.categoryId);
    getList(paginationState.pageIndex);
    return !!res;
  } catch (error) {}
}
async function handleReset() {
  try {
    const dictionaryCategoryList = await ensureQueryData();
    reset({ categoryId: dictionaryCategoryList[0].value });
  } catch (error) {}
}
</script>