diff --git a/src/main/webapp/app/orders/style/style-edit.component.ts b/src/main/webapp/app/orders/style/style-edit.component.ts index 9cff813..ec4eae3 100644 --- a/src/main/webapp/app/orders/style/style-edit.component.ts +++ b/src/main/webapp/app/orders/style/style-edit.component.ts @@ -9,7 +9,6 @@ import type { VxeTableInstance } from 'vxe-table'; import JhiCamera from '@/shared/components/jhi_camera.vue'; export default defineComponent({ - compatConfig: { MODE: 3 }, name: 'StyleUpdate', setup() { const { t: $t } = useI18n(); diff --git a/src/main/webapp/app/orders/style/style-print.component.ts b/src/main/webapp/app/orders/style/style-print.component.ts index 6deb8f4..680d985 100644 --- a/src/main/webapp/app/orders/style/style-print.component.ts +++ b/src/main/webapp/app/orders/style/style-print.component.ts @@ -11,7 +11,6 @@ import buildPaginationQuery from '@/shared/sort/sorts'; import { property } from 'xe-utils'; export default defineComponent({ - compatConfig: { MODE: 3 }, name: 'StylePrint', components: { QrcodeVue, @@ -33,6 +32,7 @@ export default defineComponent({ const settingTypes = ref([]); const styleGroupTitle = ref([]); // 新增:存储 StyleGroup 标题 const styleGroupPrefix = 'styleGroup'; // 新增:StyleGroup 前缀 + const styleGroupDicts = ref(Array(6).fill([])); // 新增:存储每个 StyleGroup 的字典项 const style = ref({ id: null, number: '', @@ -131,6 +131,7 @@ export default defineComponent({ // 保存 StyleGroup 标题 styleGroupTitle.value = styleGroupTitleRes.data; + await loadStyleGroupDicts(); // 加载款式明细 await loadStyleDtls(); } @@ -194,9 +195,34 @@ export default defineComponent({ } }; - onMounted(() => { - loadStyle(); - }); + // 加载 StyleGroup 字典项 + const loadStyleGroupDicts = async () => { + for (let i = 0; i < styleGroupTitle.value.length; i++) { + const groupKey = `${styleGroupPrefix}${i.toString().padStart(2, '0')}`; + const groupValue = style.value[groupKey]; + if (!groupValue) continue; + try { + const res = await axios.get('api/dicts', { + params: { + parentNumber: { op: '=', value: groupKey }, + status: { op: '=', value: '1' }, + }, + }); + styleGroupDicts.value[i] = res.data; + } catch (e) { + styleGroupDicts.value[i] = []; + } + } + }; + // 获取分组名称 + const getStyleGroupName = (groupNumber, value) => { + if (!groupNumber) return '-'; + const idx = styleGroupTitle.value.findIndex(item => item.number === groupNumber); + if (idx === -1) return '-'; + const dictArr = styleGroupDicts.value[idx] || []; + const found = dictArr.find(item => item.number === value); + return found ? found.name : '-'; + }; const getProductTypeName = computed(() => { const productType = productTypes.value.find(item => item.number === style.value.productType); @@ -220,6 +246,10 @@ export default defineComponent({ return titleEntry ? titleEntry.name : $t(`jewpmsApp.style.${fieldName}`); // 回退到 i18n }; + onMounted(() => { + loadStyle(); + }); + const downloadPdf = async () => { try { const element = document.getElementById('stylePrintContent'); @@ -272,11 +302,13 @@ export default defineComponent({ getProductTypeName, getProcessTypeName, getSettingTypeName, - getStyleGroupTitle, // 新增:导出方法 + getStyleGroupTitle, pdfBlob, downloadPdf, pdfPreviewRef, - styleGroupTitle, // 确保暴露给模板 + styleGroupTitle, + styleGroupDicts, + getStyleGroupName, }; }, }); diff --git a/src/main/webapp/app/orders/style/style-print.vue b/src/main/webapp/app/orders/style/style-print.vue index 500b1ec..8a54b48 100644 --- a/src/main/webapp/app/orders/style/style-print.vue +++ b/src/main/webapp/app/orders/style/style-print.vue @@ -65,7 +65,7 @@ diff --git a/src/main/webapp/app/orders/style/style.component.ts b/src/main/webapp/app/orders/style/style.component.ts index 4b98950..fb7a357 100644 --- a/src/main/webapp/app/orders/style/style.component.ts +++ b/src/main/webapp/app/orders/style/style.component.ts @@ -9,7 +9,6 @@ import type { VxeToolbarInstance, VxeTableInstance, VxePagerEvents } from 'vxe-t import debounce from 'lodash/debounce'; export default defineComponent({ - compatConfig: { MODE: 3 }, name: 'Style', components: { StreamBarcodeReader,