From 3f3817a39238b262155cd5ec76fa351bb344602d Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期三, 01 一月 2025 21:33:57 +0800 Subject: [PATCH] 打印工单流程卡 --- src/views/tigerprojects/system/lowcode/normal/mainTable.vue | 278 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 274 insertions(+), 4 deletions(-) diff --git a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue index b2920ca..eaf79b4 100644 --- a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue +++ b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue @@ -1,5 +1,15 @@ <template> <div> + <Loading + :loading="compState.loading" + :absolute="compState.absolute" + :theme="compState.theme" + :background="compState.background" + :tip="compState.tip" + /> + <div v-show="false"> + <printTemplate /> + </div> <BasicTable @register="registerTable"> <template #toolbar> <!-- 鏍规嵁鑿滃崟璁剧疆鐨勬寜閽紝鑷姩鐢熸垚 --> @@ -70,8 +80,15 @@ </div> </template> <script lang="ts" setup> - import { Ref, inject, nextTick, onMounted, ref, unref, watch } from 'vue'; - import { BasicTable, useTable, TableAction, BasicColumn, FormSchema } from '/@/components/Table'; + import { Ref, inject, nextTick, onMounted, reactive, ref, unref, watch } from 'vue'; + import { + BasicTable, + useTable, + TableAction, + BasicColumn, + FormSchema, + ActionItem, + } from '/@/components/Table'; import { BasicForm, useForm } from '/@/components/Form/index'; import { useDrawer } from '/@/components/Drawer'; import GeneralModal from '/@/views/components/GeneralModal.vue'; @@ -94,6 +111,11 @@ import { isFunction } from 'xe-utils'; import { CustModalParams } from '/@/api/tigerapi/model/systemModel'; import { useQueryStore } from '/@/store/modules/queryInpage'; + import printJS, { Configuration } from 'print-js'; + import printTemplate from '/@/views/components/printTemplate.vue'; + import { Loading, useLoading } from '@/components/Loading'; + import { useWoFlowcardStore } from '/@/store/modules/woflowcardprint'; + import { storeToRefs } from 'pinia'; const { t } = useI18n(); const { currentRoute } = useRouter(); @@ -120,6 +142,8 @@ const [registerCust, { openModal: openCustModal }] = useModal(); const [registerCrud, { openModal: openCrudModal }] = useModal(); const [registerImport, { openModal: openImportModal }] = useModal(); + const useWoFlowCard = useWoFlowcardStore(); + const { curPrintInfo } = storeToRefs(useWoFlowCard); const cType = ref(''); const formSchemas = ref({}); //寮瑰嚭妗嗗琛ㄥ崟缁撴瀯 const routeData = ref({ @@ -127,6 +151,142 @@ edges: [], }); const selectVals = ref({}); + const printData = ref<any[]>([]); + const wokerorder = ref(''); + const compState = reactive<{ + absolute?: boolean; + loading?: boolean; + theme?: 'dark' | 'light'; + background?: string; + tip?: string; + }>({ + absolute: false, + loading: false, + theme: 'dark', + background: 'rgba(111,111,111,.7)', + tip: '鍔犺浇涓�...', + }); + const [openFullLoading, closeFullLoading] = useLoading({ + tip: '姝e湪鍔犺浇鎵撳嵃鏁版嵁...', + }); + + printData.value = [ + { + id: '111', + Items: [ + { + ID: 111, + SALES_ORDER: 'YDSO240400482', + ORDER_NO: 'YDRKD241000012', + WORK_ORDER: 'YDMOB241104737', + ITEM_CODE: '20100705.0102.00', + ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + PLAN_QTY: 100, + SCAN_QTY: 50, + STATUS: 'Y', + }, + { + ID: 112, + SALES_ORDER: 'YDSO240400483', + ORDER_NO: 'YDRKD241000013', + WORK_ORDER: 'YDMOB241104737', + ITEM_CODE: '20100705.0102.00', + ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + PLAN_QTY: 100, + SCAN_QTY: 50, + STATUS: 'Y', + }, + { + ID: 113, + SALES_ORDER: 'YDSO240400484', + ORDER_NO: 'YDRKD241000014', + WORK_ORDER: 'YDMOB241104737', + ITEM_CODE: '20100705.0102.00', + ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + PLAN_QTY: 100, + SCAN_QTY: 50, + STATUS: 'Y', + }, + { + ID: 114, + ORDER_NO: 'YDRKD241000015', + SALES_ORDER: 'YDSO240400485', + WORK_ORDER: 'YDMOB241104737', + ITEM_CODE: '20100705.0102.00', + ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + PLAN_QTY: 100, + SCAN_QTY: 50, + STATUS: 'Y', + }, + { + ID: 115, + ORDER_NO: 'YDRKD241000016', + SALES_ORDER: 'YDSO240400486', + WORK_ORDER: 'YDMOB241104737', + ITEM_CODE: '20100705.0102.00', + ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + PLAN_QTY: 100, + SCAN_QTY: 50, + STATUS: 'Y', + }, + { + ID: 116, + ORDER_NO: 'YDRKD241000017', + SALES_ORDER: 'YDSO240400487', + WORK_ORDER: 'YDMOB241104737', + ITEM_CODE: '20100705.0102.00', + ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + PLAN_QTY: 100, + SCAN_QTY: 50, + STATUS: 'Y', + }, + // { + // ID: 116, + // ORDER_NO: 'YDRKD241000018', + // SALES_ORDER: 'YDSO240400488', + // WORK_ORDER: 'YDMOB241104737', + // ITEM_CODE: '20100705.0102.00', + // ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + // PLAN_QTY: 100, + // SCAN_QTY: 50, + // STATUS: 'Y', + // }, + // { + // ID: 116, + // ORDER_NO: 'YDRKD241000019', + // SALES_ORDER: 'YDSO240400489', + // WORK_ORDER: 'YDMOB241104737', + // ITEM_CODE: '20100705.0102.00', + // ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + // PLAN_QTY: 100, + // SCAN_QTY: 50, + // STATUS: 'Y', + // }, + // { + // ID: 116, + // ORDER_NO: 'YDRKD241000020', + // SALES_ORDER: 'YDSO240400490', + // WORK_ORDER: 'YDMOB241104737', + // ITEM_CODE: '20100705.0102.00', + // ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + // PLAN_QTY: 100, + // SCAN_QTY: 50, + // STATUS: 'Y', + // }, + // { + // ID: 116, + // ORDER_NO: 'YDRKD241000021', + // SALES_ORDER: 'YDSO240400491', + // WORK_ORDER: 'YDMOB241104737', + // ITEM_CODE: '20100705.0102.00', + // ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + // PLAN_QTY: 100, + // SCAN_QTY: 50, + // STATUS: 'Y', + // }, + ], + }, + ]; const custImport = ref<any[]>([]); const EntityCustFunction = ref([ { @@ -165,7 +325,7 @@ ? {} : KeyFieldValues(objParams.value['CODE'], objParams.value['ID']); const dtlSlots = ref<any[]>([]); - const ImportTitle = GetTitle && isFunction(GetTitle)? ref(GetTitle().importTitle): ref(''); + const ImportTitle = GetTitle && isFunction(GetTitle) ? ref(GetTitle().importTitle) : ref(''); const useformdata = GetUseForm && isFunction(GetUseForm) ? GetUseForm() : {}; const useFormData = ref<any>(useformdata); /* 鑷畾涔夋ā鎬佺獥鍙d腑琛ㄥ崟涓彃妲芥覆鏌撴寜閽墦寮�妯℃�佹useModal鏂规硶 */ @@ -316,7 +476,17 @@ }; /* 鏍规嵁鑿滃崟璁剧疆鐨勬寜閽嚜鍔ㄧ敓鎴愭搷浣滃垪涓殑鎸夐挳 */ - const actionItem = GenerateActionButton(params, buttons, openDrawer, reload); + const _actionItem: ActionItem[] = []; + const actionItem = GenerateActionButton(params, buttons, openDrawer, reload, _actionItem); + let _btn = buttons.value.filter((q) => q['BUTTON_TYPE'] == 1 && q['DO_METHOD'] == 'ToPrint'); + if (_btn.length > 0) { + _actionItem.push({ + icon: isNullOrEmpty(_btn[0]['ICON_URL']) ? '' : _btn[0]['ICON_URL'], + tooltip: '鎵撳嵃', + onClick: ToPrint.bind(null, params), + name: _btn[0]['DO_METHOD'], + }); + } if (isNullOrUnDef(custImport.value['default'])) { return actionItem; } @@ -391,6 +561,9 @@ break; case 'importModal' /* 鎵撳紑瀵煎叆Excel妯℃�佺獥鍙� */: openImportModal(true, result.params); + break; + case 'ToPrint': + ToPrint({}); break; } } @@ -554,4 +727,101 @@ function RvItemSuccess(d, u) { RvcloseModal(); } + + function ToPrint(params: {}) { + openFullLoading(); + useWoFlowCard.getWoPickList(params['record']['ORDER_NO']).then((res) => { + const _style = ` + #print-area { + position: absolute; + inset: 0; + background-color: #fff; + + .item { + display: flex; + flex-direction: column; + page-break-after: always; + height: 100%; + + + .head { + z-index: 1; + width: 100%; + background-color: azure; + font-size: 22px; + font-weight: bold; + line-height: 100px; + text-align: center; + } + + .main { + display: flex; + flex: 1; + justify-content: center; + padding: 15px; + + table { + border-collapse: collapse; + width: 100%; + } + + table, + th, + td { + border: solid 1px black; + } + + tr > th { + height: 60px; + } + .instore_td { + border: 1px solid #000; + font-size: 12px; + line-height: 20px; + text-align: center; + word-break: break-all; + } + + .material_table_td { + border: 1px solid #000; + font-size: 14px; + line-height: 20px; + text-align: center; + word-break: break-all; + } + } + + .footer { + display: flex; + margin-bottom: 15px; + background-color: #eee; + font-size: 12px; + line-height: 21px; + text-align: center; + } + } + .line { + width: 100px; /* 绾挎潯鐨勯暱搴� */ + height: 0; + margin: 10px; /* 绾挎潯涓庡叾浠栧厓绱犵殑璺濈 */ + border-top: 1px solid black; /* 绾挎潯鐨勯鑹插拰瀹藉害 */ + } + }`; + + printJS({ + // 闇�瑕佹墦鍗板尯鍩熻缃殑Id + printable: 'print-area', + // 鎵撳嵃绫诲瀷 + type: 'html', + // 榛樿鍊间负800锛屾垜浠妸鎶婅缃负100% + maxWidth: '100%', + // *浠h〃搴旂敤鎵�鏈夋牱寮忥紝榛樿鍊间负null锛屽鏋滀笉璁剧疆锛屾墦鍗扮獥鍙e垯浼氬拷鐣ユ墍鏈夋牱寮� + targetStyles: ['*'], + // font_size: '9pt', + scanStyles: false, + style: `@page {size: auto; margin: 0mm;} html, ${_style}`, + } as unknown as Configuration); + closeFullLoading(); + }); + } </script> -- Gitblit v1.9.3