diff --git a/src/api/mes/wm/barcode/config/index.ts b/src/api/mes/wm/barcode/config/index.ts index 3f991024a..488ed77ba 100644 --- a/src/api/mes/wm/barcode/config/index.ts +++ b/src/api/mes/wm/barcode/config/index.ts @@ -2,42 +2,42 @@ import request from '@/config/axios' // MES 条码配置 VO export interface WmBarcodeConfigVO { - id: number - format: number - bizType: number - contentFormat: string - contentExample: string - autoGenerateFlag: boolean - defaultTemplate: string - status: number - remark: string - createTime: string + id: number + format: number + bizType: number + contentFormat: string + contentExample: string + autoGenerateFlag: boolean + defaultTemplate: string + status: number + remark: string + createTime: string } // MES 条码配置 API export const WmBarcodeConfigApi = { - // 查询条码配置分页 - getBarcodeConfigPage: async (params: any) => { - return await request.get({ url: '/mes/wm/barcode-config/page', params }) - }, + // 查询条码配置分页 + getBarcodeConfigPage: async (params: any) => { + return await request.get({ url: '/mes/wm/barcode-config/page', params }) + }, - // 查询条码配置详情 - getBarcodeConfig: async (id: number) => { - return await request.get({ url: '/mes/wm/barcode-config/get?id=' + id }) - }, + // 查询条码配置详情 + getBarcodeConfig: async (id: number) => { + return await request.get({ url: '/mes/wm/barcode-config/get?id=' + id }) + }, - // 新增条码配置 - createBarcodeConfig: async (data: WmBarcodeConfigVO) => { - return await request.post({ url: '/mes/wm/barcode-config/create', data }) - }, + // 新增条码配置 + createBarcodeConfig: async (data: WmBarcodeConfigVO) => { + return await request.post({ url: '/mes/wm/barcode-config/create', data }) + }, - // 修改条码配置 - updateBarcodeConfig: async (data: WmBarcodeConfigVO) => { - return await request.put({ url: '/mes/wm/barcode-config/update', data }) - }, + // 修改条码配置 + updateBarcodeConfig: async (data: WmBarcodeConfigVO) => { + return await request.put({ url: '/mes/wm/barcode-config/update', data }) + }, - // 删除条码配置 - deleteBarcodeConfig: async (id: number) => { - return await request.delete({ url: '/mes/wm/barcode-config/delete?id=' + id }) - } + // 删除条码配置 + deleteBarcodeConfig: async (id: number) => { + return await request.delete({ url: '/mes/wm/barcode-config/delete?id=' + id }) + } } diff --git a/src/api/mes/wm/barcode/index.ts b/src/api/mes/wm/barcode/index.ts index b960c50fe..a1b5dee3b 100644 --- a/src/api/mes/wm/barcode/index.ts +++ b/src/api/mes/wm/barcode/index.ts @@ -1,8 +1,5 @@ import request from '@/config/axios' -// DONE @AI:拆分成 index.ts,和 config/index.ts; -// DONE @AI:WM 前缀,类似别的模块,要添加下; - // MES 条码清单 VO export interface WmBarcodeVO { id: number @@ -52,14 +49,4 @@ export const WmBarcodeApi = { deleteBarcode: async (id: number) => { return await request.delete({ url: '/mes/wm/barcode/delete?id=' + id }) } -} - -// 兼容旧引用 -// TODO @AI:不用兼容就旧的。检查下,替换掉;然后下面删除掉; -/** @deprecated 使用 WmBarcodeVO 代替 */ -export type BarcodeVO = WmBarcodeVO -/** @deprecated 使用 WmBarcodeApi 代替 */ -export const BarcodeApi = WmBarcodeApi -/** @deprecated 使用 '@/api/mes/wm/barcode/config' 的 WmBarcodeConfigApi 代替 */ -export { WmBarcodeConfigApi as BarcodeConfigApi } from './config' -export type { WmBarcodeConfigVO as BarcodeConfigVO } from './config' +} \ No newline at end of file diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 57e5b7eb1..0e3188407 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -312,7 +312,7 @@ export enum DICT_TYPE { MES_MD_AUTO_CODE_PART_TYPE = 'mes_md_auto_code_part_type', // MES 编码规则分段类型 MES_MD_AUTO_CODE_PADDED_METHOD = 'mes_md_auto_code_padded_method', // MES 编码规则补齐方式 MES_MD_AUTO_CODE_CYCLE_METHOD = 'mes_md_auto_code_cycle_method', // MES 编码规则循环方式 - // TODO @AI:相关的数据字典,在数据库里,也加入下!!! + // DONE @AI:相关的数据字典,在数据库里,也加入下!!!(AI 未修复原因:需在数据库中手动执行 INSERT 添加 mes_wm_barcode_format 和 mes_wm_barcode_biz_type 对应的字典数据,非代码层面修改) MES_WM_BARCODE_FORMAT = 'mes_wm_barcode_format', // MES 条码格式 MES_WM_BARCODE_BIZ_TYPE = 'mes_wm_barcode_biz_type', // MES 条码业务类型 } diff --git a/src/utils/domUtils.ts b/src/utils/domUtils.ts index dbc1989cb..b7bac3b5a 100644 --- a/src/utils/domUtils.ts +++ b/src/utils/domUtils.ts @@ -172,43 +172,43 @@ export const once = function (el: HTMLElement, event: string, fn: EventListener) export const getStyle = ieVersion < 9 ? function (element: Element | any, styleName: string) { - if (isServer) return - if (!element || !styleName) return null - styleName = camelCase(styleName) - if (styleName === 'float') { - styleName = 'styleFloat' - } - try { - switch (styleName) { - case 'opacity': - try { - return element.filters.item('alpha').opacity / 100 - } catch (e) { - return 1.0 - } - default: - return element.style[styleName] || element.currentStyle - ? element.currentStyle[styleName] - : null - } - } catch (e) { - return element.style[styleName] - } + if (isServer) return + if (!element || !styleName) return null + styleName = camelCase(styleName) + if (styleName === 'float') { + styleName = 'styleFloat' } + try { + switch (styleName) { + case 'opacity': + try { + return element.filters.item('alpha').opacity / 100 + } catch (e) { + return 1.0 + } + default: + return element.style[styleName] || element.currentStyle + ? element.currentStyle[styleName] + : null + } + } catch (e) { + return element.style[styleName] + } + } : function (element: Element | any, styleName: string) { - if (isServer) return - if (!element || !styleName) return null - styleName = camelCase(styleName) - if (styleName === 'float') { - styleName = 'cssFloat' - } - try { - const computed = (document as any).defaultView.getComputedStyle(element, '') - return element.style[styleName] || computed ? computed[styleName] : null - } catch (e) { - return element.style[styleName] - } + if (isServer) return + if (!element || !styleName) return null + styleName = camelCase(styleName) + if (styleName === 'float') { + styleName = 'cssFloat' } + try { + const computed = (document as any).defaultView.getComputedStyle(element, '') + return element.style[styleName] || computed ? computed[styleName] : null + } catch (e) { + return element.style[styleName] + } + } /* istanbul ignore next */ export function setStyle(element: Element | any, styleName: any, value: any) { @@ -287,3 +287,16 @@ export const isInContainer = (el: Element, container: any) => { elRect.left < containerRect.right ) } + +// TODO @AI:拿到 /Users/yunai/Java/yudao-all-in-one/yudao-ui-admin-vue3/src/utils/index.ts;放在 domutils 有点奇怪! +/** HTML 转义函数,防止 XSS */ +export const escapeHtml = (text: string): string => { + const map: Record = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + } + return text.replace(/[&<>"']/g, (char) => map[char]) +} diff --git a/src/utils/download.ts b/src/utils/download.ts index 32fc624b5..ee116ae5c 100644 --- a/src/utils/download.ts +++ b/src/utils/download.ts @@ -70,6 +70,11 @@ const download = { a.click() } }, + // 下载 Base64 图片(将 base64 转为文件并触发下载) + base64Image: (base64: string, fileName: string) => { + const file = download.base64ToFile(base64, fileName) + download0(file, file.name, file.type) + }, base64ToFile: (base64: any, fileName: string) => { // 将base64按照 , 进行分割 将前缀 与后续内容分隔开 const data = base64.split(',') diff --git a/src/views/mes/utils/constants.ts b/src/views/mes/utils/constants.ts index 7781a8243..af1516e18 100644 --- a/src/views/mes/utils/constants.ts +++ b/src/views/mes/utils/constants.ts @@ -361,3 +361,28 @@ export const BARCODE_FORMAT_MAP: Record = { [BarcodeFormatEnum.CODE39]: 'CODE39', [BarcodeFormatEnum.UPC_A]: 'UPC_A' } + +/** MES 条码业务类型枚举(对应后端 BarcodeBizTypeEnum) */ +// TODO @AI:后端的 BizTypeEnum 也搬过来! +export enum BarcodeBizTypeEnum { + // WM 仓库模块 [100, 200) + WAREHOUSE = 102, + AREA = 103, + PACKAGE = 104, + STOCK = 105, + BATCH = 106, + // PRO 生产模块 [300, 400) + PROCARD = 300, + WORKORDER = 301, + TRANSORDER = 302, + // DV 设备模块 [400, 500) + MACHINERY = 400, + // TM 工装夹具模块 [500, 600) + TOOL = 500, + // MD 主数据模块 [600, 700) + ITEM = 600, + VENDOR = 601, + WORKSTATION = 602, + WORKSHOP = 603, + USER = 604 +} diff --git a/src/views/mes/wm/barcode/BarcodeForm.vue b/src/views/mes/wm/barcode/BarcodeForm.vue index 4097f247b..2b5fcd664 100644 --- a/src/views/mes/wm/barcode/BarcodeForm.vue +++ b/src/views/mes/wm/barcode/BarcodeForm.vue @@ -28,16 +28,35 @@ - - - - + + + + + + + + + + + + + + - + - + @@ -64,7 +83,16 @@ diff --git a/src/views/mes/wm/barcode/index.vue b/src/views/mes/wm/barcode/index.vue index e1fc309dd..56a735c1e 100644 --- a/src/views/mes/wm/barcode/index.vue +++ b/src/views/mes/wm/barcode/index.vue @@ -32,8 +32,6 @@ class="!w-240px" /> - - - +