From eebfca8790162a4068e09aaf87c52edaf3aa791d Mon Sep 17 00:00:00 2001 From: my_ong <429426262@qq.com> Date: Tue, 10 Dec 2024 11:19:19 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E6=94=B9=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=91=BD=E5=90=8D=E8=A7=84=E5=88=99,=E5=8E=BB=E6=8E=89pontCore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- eslint.config.js | 1 + src/api/pontCore.ts | 73 ------------------- .../{applyConfirm.vue => apply-confirm.vue} | 0 .../{applyForm.vue => apply-form.vue} | 0 .../{applyModal.vue => apply-modal.vue} | 8 +- src/views/stock/component/apply-page.vue | 2 +- .../{Stocktaking.vue => atocktaking.vue} | 0 .../component/{scanForm.vue => scan-form.vue} | 0 .../{successResul.vue => success-resul.vue} | 0 src/views/stock/inboud/inboud-page.vue | 2 +- src/views/stock/outboud/outbound-page.vue | 2 +- .../{resultForm.vue => result-form.vue} | 0 .../stock/stocktaking/stocktaking-page.vue | 4 +- 13 files changed, 10 insertions(+), 82 deletions(-) delete mode 100644 src/api/pontCore.ts rename src/views/stock/component/{applyConfirm.vue => apply-confirm.vue} (100%) rename src/views/stock/component/{applyForm.vue => apply-form.vue} (100%) rename src/views/stock/component/{applyModal.vue => apply-modal.vue} (94%) rename src/views/stock/component/{Stocktaking.vue => atocktaking.vue} (100%) rename src/views/stock/component/{scanForm.vue => scan-form.vue} (100%) rename src/views/stock/component/{successResul.vue => success-resul.vue} (100%) rename src/views/stock/stocktaking/{resultForm.vue => result-form.vue} (100%) diff --git a/eslint.config.js b/eslint.config.js index 3b1cb57..1f45368 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -29,6 +29,7 @@ export default [ dictionary: true, sensor: true, station: true, + material: true, }, ecmaVersion: 2020, parser: parserVue, diff --git a/src/api/pontCore.ts b/src/api/pontCore.ts deleted file mode 100644 index fa183ba..0000000 --- a/src/api/pontCore.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @description pont内置请求单例 - */ - -class PontCoreManager { - // static singleInstance = undefined as PontCoreManager; - private static singleInstance: PontCoreManager | null = null; - - static getSignleInstance() { - if (!PontCoreManager.singleInstance) { - PontCoreManager.singleInstance = new PontCoreManager(); - return PontCoreManager.singleInstance; - } - return PontCoreManager.singleInstance; - } - - /** - * fetch请求 - * @param url 请求url - * @param options fetch 请求配置 - */ - fetch(url: string, options = {}) { - return fetch(url, options).then((res) => { - return res.json(); - }); - } - - /** - * 使用外部传入的请求方法替换默认的fetch请求 - */ - useFetch(fetch: (url: string, options?: any) => Promise) { - if (typeof fetch !== 'function') { - console.error('fetch should be a function '); - return; - } - - this.fetch = fetch; - } - - getUrl(path: string, queryParams: any) { - const params = { - ...(queryParams || ({} as any)), - }; - - const url = path.replace(/\{([^\\}]*(?:\\.[^\\}]*)*)\}/gm, ( key) => { - // eslint-disable-next-line no-param-reassign - key = key.trim(); - - if (params[key] !== undefined) { - const value = params[key]; - delete params[key]; - return value; - } - console.warn('Please set value for template key: ', key); - return ''; - }); - - const paramStr = Object.keys(params) - .map((key) => { - return params[key] === undefined ? '' : `${key}=${params[key]}`; - }) - .filter((id) => id) - .join('&'); - - if (paramStr) { - return `${url}?${paramStr}`; - } - - return url; - } -} - -export const PontCore = PontCoreManager.getSignleInstance(); diff --git a/src/views/stock/component/applyConfirm.vue b/src/views/stock/component/apply-confirm.vue similarity index 100% rename from src/views/stock/component/applyConfirm.vue rename to src/views/stock/component/apply-confirm.vue diff --git a/src/views/stock/component/applyForm.vue b/src/views/stock/component/apply-form.vue similarity index 100% rename from src/views/stock/component/applyForm.vue rename to src/views/stock/component/apply-form.vue diff --git a/src/views/stock/component/applyModal.vue b/src/views/stock/component/apply-modal.vue similarity index 94% rename from src/views/stock/component/applyModal.vue rename to src/views/stock/component/apply-modal.vue index 0940be0..081bd5a 100644 --- a/src/views/stock/component/applyModal.vue +++ b/src/views/stock/component/apply-modal.vue @@ -30,10 +30,10 @@ diff --git a/src/views/stock/outboud/outbound-page.vue b/src/views/stock/outboud/outbound-page.vue index 2390e61..e82b72f 100644 --- a/src/views/stock/outboud/outbound-page.vue +++ b/src/views/stock/outboud/outbound-page.vue @@ -3,6 +3,6 @@ diff --git a/src/views/stock/stocktaking/resultForm.vue b/src/views/stock/stocktaking/result-form.vue similarity index 100% rename from src/views/stock/stocktaking/resultForm.vue rename to src/views/stock/stocktaking/result-form.vue diff --git a/src/views/stock/stocktaking/stocktaking-page.vue b/src/views/stock/stocktaking/stocktaking-page.vue index 84baaae..a3f2f10 100644 --- a/src/views/stock/stocktaking/stocktaking-page.vue +++ b/src/views/stock/stocktaking/stocktaking-page.vue @@ -86,8 +86,8 @@ import { config, formItems } from './form' import { notification } from 'ant-design-vue' import dayjs from 'dayjs'; import { useUserStore } from '@/stores/user' -import scanForm from '../component/scanForm.vue' -import resultForm from '../stocktaking/resultForm.vue' +import scanForm from '../component/scan-form.vue' +import resultForm from './result-form.vue' const searchKey = ref('')