diff --git a/public/platform-config.json b/public/platform-config.json index f05c523..3cfc1c8 100644 --- a/public/platform-config.json +++ b/public/platform-config.json @@ -5,7 +5,7 @@ "HiddenSideBar": false, "MultiTagsCache": true, "KeepAlive": true, - "Locale": "zh", + "Locale": "en", "Layout": "vertical", "Theme": "light", "DarkMode": false, diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts index b7d8fab..93d14c7 100644 --- a/src/plugins/i18n.ts +++ b/src/plugins/i18n.ts @@ -60,7 +60,7 @@ function getObjectKeys(obj) { /** 将展开的key缓存 */ const keysCache: Map> = new Map(); -const flatI18n = (prefix = "zh-CN") => { +const flatI18n = (prefix = "en") => { let cache = keysCache.get(prefix); if (!cache) { cache = getObjectKeys(siphonI18n(prefix)); @@ -88,9 +88,9 @@ export function transformI18n(message: any = "") { const key = message.match(/(\S*)\./)?.input; - if (key && flatI18n("zh-CN").has(key)) { + if (key && flatI18n("en").has(key)) { return i18n.global.t.call(i18n.global.locale, message); - } else if (!key && Object.hasOwn(siphonI18n("zh-CN"), message)) { + } else if (!key && Object.hasOwn(siphonI18n("en"), message)) { // 兼容非嵌套形式的国际化写法 return i18n.global.t.call(i18n.global.locale, message); } else { @@ -107,7 +107,7 @@ export const i18n: I18n = createI18n({ storageLocal().getItem( `${responsiveStorageNameSpace()}locale` )?.locale ?? "en", - fallbackLocale: "zh", + fallbackLocale: "en", messages: localesConfigs }); diff --git a/src/views/codes/index/index.vue b/src/views/codes/index/index.vue index 480f050..732b373 100644 --- a/src/views/codes/index/index.vue +++ b/src/views/codes/index/index.vue @@ -273,7 +273,7 @@ {{ item.id }} {{ item.description }} {{ t("buttons.Feedback") }}{{ t("buttons.ErrorRecovery") }} {{ item.id }} {{ item.description }} {{ t("buttons.Feedback") }}{{ t("buttons.ErrorRecovery") }} { }, { label: transformI18n($t("review.tag.feedbackHtsCode")), - prop: "feedback_code" + prop: "feedback_code", + formatter: ({ feedback_code }) => + feedback_code + ? feedback_code.replace(/(\d{2})/g, "$1.").slice(0, -1) + : "" }, { label: transformI18n($t("review.tag.feedbackDescription")), @@ -158,9 +162,9 @@ export const useCode = (tableRef: Ref) => { const res = await getCodeFeedbackListAPI({ page: pagination.currentPage, pageSize: pagination.pageSize, - feedback_code: form.feedback_code, + feedback_code: form.feedback_code.replace(/\D/g, ""), feedback_description: form.feedback_description, - code: form.code, + code: form.code.replace(/\D/g, ""), status: form.status, username: form.username, department_id: form.department_id, @@ -209,9 +213,9 @@ export const useCode = (tableRef: Ref) => { const res = await getCodeFeedbackListAPI({ page: pagination.currentPage, pageSize: val, - feedback_code: form.feedback_code, + feedback_code: form.feedback_code.replace(/\D/g, ""), feedback_description: form.feedback_description, - code: form.code, + code: form.code.replace(/\D/g, ""), status: form.status, username: form.username, department_id: form.department_id, @@ -238,9 +242,9 @@ export const useCode = (tableRef: Ref) => { const res = await getCodeFeedbackListAPI({ page: val, pageSize: pagination.pageSize, - feedback_code: form.feedback_code, + feedback_code: form.feedback_code.replace(/\D/g, ""), feedback_description: form.feedback_description, - code: form.code, + code: form.code.replace(/\D/g, ""), status: form.status, username: form.username, department_id: form.department_id, @@ -341,7 +345,7 @@ export const useCode = (tableRef: Ref) => { const FormData = formRef.value.newFormInline; let form = { feedback_description: FormData.feedback_description ?? "", - feedback_code: FormData.feedback_code ?? "", + feedback_code: FormData.feedback_code.replace(/\D/g, "") ?? "", code_id: FormData.code_id ?? "" }; if (title === "Add") { diff --git a/src/views/data/import/utils/hook.tsx b/src/views/data/import/utils/hook.tsx index d10391f..41cdb3d 100644 --- a/src/views/data/import/utils/hook.tsx +++ b/src/views/data/import/utils/hook.tsx @@ -161,7 +161,7 @@ export const useCode = (tableRef: Ref) => { page: pagination.currentPage, pageSize: pagination.pageSize, description: form.description, - code: form.code, + code: form.code.replace(/\D/g, ""), status: form.status, username: form.username, department_id: form.department_id, @@ -211,7 +211,7 @@ export const useCode = (tableRef: Ref) => { page: pagination.currentPage, pageSize: val, description: form.description, - code: form.code, + code: form.code.replace(/\D/g, ""), status: form.status, username: form.username, department_id: form.department_id, @@ -239,7 +239,7 @@ export const useCode = (tableRef: Ref) => { page: val, pageSize: pagination.pageSize, description: form.description, - code: form.code, + code: form.code.replace(/\D/g, ""), status: form.status, username: form.username, department_id: form.department_id, @@ -334,7 +334,7 @@ export const useCode = (tableRef: Ref) => { const FormData = formRef.value.newFormInline; let form = { description: FormData.description ?? "", - code: FormData.code ?? "" + code: FormData.code.replace(/\D/g, "") ?? "" }; if (title === "Add") { const res = await postAddCodeAPI(form); diff --git a/src/views/data/maintain/utils/hook.tsx b/src/views/data/maintain/utils/hook.tsx index 2e6c5cc..6a54f22 100644 --- a/src/views/data/maintain/utils/hook.tsx +++ b/src/views/data/maintain/utils/hook.tsx @@ -122,7 +122,7 @@ export const useCode = (tableRef: Ref) => { page: pagination.currentPage, pageSize: pagination.pageSize, description: form.description, - code: form.code, + code: form.code.replace(/\D/g, ""), department_id: form.department_id, nickname: form.nickname, username: form.username, @@ -171,7 +171,7 @@ export const useCode = (tableRef: Ref) => { page: pagination.currentPage, pageSize: val, description: form.description, - code: form.code, + code: form.code.replace(/\D/g, ""), department_id: form.department_id, nickname: form.nickname, username: form.username, @@ -198,7 +198,7 @@ export const useCode = (tableRef: Ref) => { page: val, pageSize: pagination.pageSize, description: form.description, - code: form.code, + code: form.code.replace(/\D/g, ""), department_id: form.department_id, nickname: form.nickname, username: form.username, @@ -265,7 +265,7 @@ export const useCode = (tableRef: Ref) => { h(editForm, { formInline: { description: row?.description ?? "", - code: row?.code ?? "" + code: row?.code.replace(/\D/g, "") ?? "" }, ref: formRef }), @@ -273,7 +273,7 @@ export const useCode = (tableRef: Ref) => { const FormData = formRef.value.newFormInline; let form = { description: FormData.name ?? "", - code: FormData.code ?? "" + code: FormData.code.replace(/\D/g, "") ?? "" }; if (title === "Add") { const res = await postAddCodeAPI(form); diff --git a/src/views/hts/item/utils/hook.tsx b/src/views/hts/item/utils/hook.tsx index 2a514da..f7e52a4 100644 --- a/src/views/hts/item/utils/hook.tsx +++ b/src/views/hts/item/utils/hook.tsx @@ -223,7 +223,8 @@ export const useHtsItem = (tableRef: Ref) => { const res = await getHtsItemListAPI({ page: pagination.currentPage, pageSize: pagination.pageSize, - ...toRaw(form) + ...toRaw(form), + htsno: form.htsno.replace(/\D/g, "") || "" }); if (res.success) { dataList.value = res.data.result; @@ -267,7 +268,8 @@ export const useHtsItem = (tableRef: Ref) => { const res = await getHtsItemListAPI({ page: pagination.currentPage, pageSize: val, - ...toRaw(form) + ...toRaw(form), + htsno: form.htsno.replace(/\D/g, "") || "" }); if (res.success) { dataList.value = res.data.result; @@ -290,7 +292,8 @@ export const useHtsItem = (tableRef: Ref) => { const res = await getHtsItemListAPI({ page: val, pageSize: pagination.pageSize, - ...toRaw(form) + ...toRaw(form), + htsno: form.htsno.replace(/\D/g, "") || "" }); if (res.success) { dataList.value = res.data.result; @@ -568,7 +571,7 @@ export const useHtsItem = (tableRef: Ref) => { parent_id: FormData.parent_id ?? "", /** 编码 */ - htsno: FormData.htsno ?? "", + htsno: FormData.htsno.replace(/\D/g, "") ?? "", /** 层级 */ indent: FormData.indent ?? "", @@ -615,7 +618,7 @@ export const useHtsItem = (tableRef: Ref) => { parent_id: FormData.parent_id ?? "", /** 编码 */ - htsno: FormData.htsno ?? "", + htsno: FormData.htsno.replace(/\D/g, "") ?? "", /** 层级 */ indent: FormData.indent ?? "", diff --git a/vite.config.ts b/vite.config.ts index 7120278..f3fd123 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -27,7 +27,7 @@ export default ({ mode }: ConfigEnv): UserConfigExport => { proxy: { "/api": { // 这里填写后端地址 - target: "http://localhost:9090", + target: "http://localhost:8082", changeOrigin: true, rewrite: path => path.replace(/^\/api/, "") }