2 lines
13 KiB
Java
2 lines
13 KiB
Java
var Dt=Object.defineProperty,St=Object.defineProperties;var kt=Object.getOwnPropertyDescriptors;var G=Object.getOwnPropertySymbols;var Mt=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable;var Z=(u,o,n)=>o in u?Dt(u,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):u[o]=n,tt=(u,o)=>{for(var n in o||(o={}))Mt.call(o,n)&&Z(u,n,o[n]);if(G)for(var n of G(o))Rt.call(o,n)&&Z(u,n,o[n]);return u},et=(u,o)=>St(u,kt(o));var h=(u,o,n)=>new Promise((p,C)=>{var B=f=>{try{S(n.next(f))}catch(k){C(k)}},$=f=>{try{S(n.throw(f))}catch(k){C(k)}},S=f=>f.done?p(f.value):Promise.resolve(f.value).then(B,$);S((n=n.apply(u,o)).next())});import{s as Et,av as It,x as Y,aR as Nt,aS as Tt,au as Ot}from"./index-X7Y8jykP.js";import At from"./BasicTable-C6eG0bgK.js";import Bt from"./TableAction-BiXnWkvt.js";import"./TableImg.vue_vue_type_style_index_0_lang-65ZOQtFn.js";import"./index-BDvqZ5j4.js";import{u as $t}from"./useListPage-CK9oQ-1O.js";import{initDictOptions as Lt}from"./index-Cq6YxX27.js";import{J as Ut}from"./index-C69VKHba.js";import{M as Xt,s as zt,c as Jt,a as Vt}from"./MesXslRawMaterialCardModal-BSer_Rsc.js";import Wt from"./RawMaterialCardPrintPreviewModal-DoeTSdbs.js";import{g as Yt,a as Ft,l as jt,b as Ht,u as Kt,p as qt,c as Qt,d as Gt}from"./MesXslRawMaterialCard.api-vGuaxFmq.js";import{g as Zt,s as A,P as F,f as te,p as ee}from"./printNativeViaPrintDot-hFBchMti.js";import{n as oe}from"./nativeSchemaNormalize-WzV7gGZh.js";import{u as re}from"./useModal-DaJ3Bflg.js";import"./index-CfNJyBRj.js";import{D as ie}from"./dropdown-jkliuVyN.js";import{e as rt,h as ae,o as ne,r as v,C as se,f as m,A as l,u as c,b as ot,K as j,X as le,z as w,y as P,H,O as E,E as b}from"./vue-vendor-DNhG1Cve.js";import pe from"./index-DsixALRt.js";import"./emoji-mart-vue-fast-R0uJEDq-.js";import"./BasicTable.vue_vue_type_style_index_0_lang-B9DxrWas.js";import"./BasicForm-ClUSoD_-.js";import"./helper-DcLcf4v6.js";import"./index-BzChaRPg.js";import"./useAppInject-DPZGPcR3.js";import"./BasicForm.vue_vue_type_style_index_0_lang-B29PWQy0.js";import"./index-DO7ZhK45.js";import"./index-ByCwbQDV.js";import"./index-Upeu4GGa.js";import"./index-C4wWpZeQ.js";import"./useTimeout-D5AmIBZw.js";import"./index-M9QP6cvf.js";import"./Skeleton-CimgOdM7.js";import"./useScrollTo-0FPEw5-K.js";import"./useIntersectionObserver-BGOgyKyu.js";import"./index-saD4h7VJ.js";import"./useBreakpoint-DXhPW7nV.js";import"./useEventListener-BRXjwk7A.js";import"./breakpointEnum-BhAg6bcX.js";import"./uniqBy--vsL0WVB.js";import"./BasicModal-xH56XuRZ.js";import"./ModalHeader-Sr8KwhJJ.js";import"./useWindowSizeFn-C-0M9_Ul.js";import"./index-CuWaQdlK.js";import"./useForm-D61zovon.js";import"./injectionKey-DPVn4AgL.js";import"./index-DSsDi_fL.js";import"./Group-UHkub2tu.js";import"./Checkbox-Dbxs4we4.js";import"./index-BuONesFs.js";import"./FormOutlined-Y84itqS0.js";import"./useTableContext-CncNVXgp.js";import"./index-DTjkSGYl.js";import"./eagerComputed-BTlOruLW.js";import"./fromPairs-Dx9PT-t0.js";import"./useMaxLevel-DE205ncc.js";import"./index-DfHu-LAS.js";import"./Group-DBzJABA_.js";import"./RadioButton-DRBix2Fq.js";import"./index-C7ckZv9Z.js";import"./DirectoryTree-nk_YTTIy.js";import"./FolderOpenOutlined-SzIPA7z0.js";import"./index-Cl-8Hzo4.js";import"./scrollTo-D49dA-9c.js";import"./operationUnit-vCu2co3e.js";import"./index-DklMb9Qc.js";import"./UpOutlined-B1UMbtrP.js";import"./dayjs-jnKD3YGS.js";import"./index-aCD42OrZ.js";import"./quarterOfYear-BU2sPnff.js";import"./index-J2mOtM3w.js";import"./dayjs-ALi1pEeb.js";import"./clickOutside-DHfwTU6R.js";import"./onMountedOrActivated-DhSdLlqP.js";import"./throttle-De_jAmBh.js";import"./uuid-CODpppBC.js";import"./sortable.esm-DJNoJSdJ.js";import"./RedoOutlined-Cq2g4Slp.js";import"./index-CeNCCWzL.js";import"./TableAction.vue_vue_type_style_index_0_lang-BIWZ0bGo.js";import"./index-fAAIzD3j.js";import"./index-DfX9t4DO.js";import"./isNumeric-DjvBa-1E.js";import"./useTable-DbHE4FHE.js";import"./useMethods-D3efiSSd.js";import"./useApprovalSelection-D4wlWO_T.js";import"./renderUtils-BiIzV8ua.js";import"./index-Cmtq_YLa.js";import"./Editor-DbH9VuAv.js";import"./JDictSelectUtil-DwVTEDM5.js";import"./index-B4gPlWQt.js";import"./MesXslWarehouseArea.api-CcWpXqxD.js";import"./browser-D2DxMZOB.js";import"./tableMerge-CpKVscEF.js";import"./tableBuilder-lOY0L2dW.js";import"./freeTableGrid-BXWKfNhh.js";import"./freeTableBorders-i5ck0FPH.js";import"./freeTableTracks--U1Y5u-V.js";import"./barcodeRenderer-cjxjmb-t.js";const me=rt({name:"xslmes-mesXslRawMaterialCard"}),ce=rt(et(tt({},me),{setup(u){const{createMessage:o}=Et(),n="xslmes_print_dot_ws",p=v(""),C=v(!1);function B(){A(String(p.value||"").trim(),""),W(!1)}function $(){C.value=!1,B()}function S(){const r=`${"/".endsWith("/")?"/":"//"}print-plugin/XSL-PrintDot.exe`,a=document.createElement("a");a.href=r,a.setAttribute("download","XSL-PrintDot.exe"),a.rel="noopener",document.body.appendChild(a),a.click(),document.body.removeChild(a)}const f=ot({}),[k,{openModal:L}]=re(),{prefixCls:ue,tableContext:it,onExportXls:at,onImportXls:nt}=$t({tableProps:{title:"原材料卡片",api:jt,columns:Jt,canResize:!0,formConfig:{schemas:zt,autoSubmitOnEnter:!0,showAdvancedButton:!0,fieldMapToTime:[["entryDate",["entryDate_begin","entryDate_end"],"YYYY-MM-DD"]]},actionColumn:{width:248,fixed:"right",title:"操作",dataIndex:"action",slots:{customRender:"action"}},beforeFetch:t=>Object.assign(t,f)},exportConfig:{name:"原材料卡片",url:Ft,params:f},importConfig:{url:Yt,success:N}}),[st,{reload:U},{rowSelection:lt,selectedRowKeys:I,selectedRows:pt}]=it,mt=ot(Vt),X=v(!1),K=v(null),q=v(void 0);function ct(t){K.value=t.id,q.value=t.barcode,X.value=!0}const z=v([]),M=v("__system_default__"),R=v(!1),J="mesXslRawMaterialCard-print-row",V="mesXslRawMaterialCard-print-batch",ut="选择打印机(PrintDot 桥接)";ae(M,t=>{t&&localStorage.setItem(F,t)});function W(t=!0){return h(this,null,function*(){const e=new Map;e.set("__system_default__",{label:"系统默认打印机",value:"__system_default__"});try{const r=yield te();C.value=!0,r.forEach(a=>{const i=String(a.name||"").trim();if(!i)return;const d=a.isDefault?"(默认)":"";e.set(i,{label:`${i}${d}`,value:i})}),z.value=Array.from(e.values()),t&&(r.length?o.success(`已从 PrintDot 桥接识别 ${r.length} 台打印机`):o.warning("PrintDot 已连接但未返回打印机列表"))}catch(r){C.value=!1,z.value=Array.from(e.values()),t&&o.warning(`PrintDot:${r instanceof Error?r.message:String(r)}`)}})}function Q(t,e){return h(this,null,function*(){var r,a;try{const i=yield qt(t.id),d=i.templateJson,x=i.printData,_=Number((r=i.paperWidthMm)!=null?r:0),g=Number((a=i.paperHeightMm)!=null?a:0),T=String(i.paperOrientation||"").toLowerCase();if(!d)throw new Error("模板 JSON 为空");let y;try{y=typeof d=="string"?JSON.parse(d):d}catch(D){throw new Error("模板 JSON 格式错误")}const s=oe(y);if(_>0&&g>0){const D=T==="landscape"?"landscape":T==="portrait"?"portrait":"",O=D==="landscape"?{width:Math.max(_,g),height:Math.min(_,g)}:D==="portrait"?{width:Math.min(_,g),height:Math.max(_,g)}:{width:_,height:g};s.page.width=O.width,s.page.height=O.height}yield ee({schema:s,data:x,jobName:`原材料卡片-${t.barcode||t.id}.pdf`,printerSelection:M.value||localStorage.getItem(F)||"__system_default__"}),e!=null&&e.silentSuccess||o.success("已通过 PrintDot 提交打印")}catch(i){throw new Error(i instanceof Error?i.message:String(i))}})}function dt(){const t=pt.value||[];if(!t.length){o.warning("请至少勾选一条记录后再点击「打印选中」");return}R.value=!0,o.destroy(V),o.loading({content:`正在打印 ${t.length} 条记录,请稍候…`,key:V,duration:0}),h(null,null,function*(){try{let e=0,r="";for(const a of t)try{yield Q(a,{silentSuccess:!0}),e+=1}catch(i){r||(r=i instanceof Error?i.message:String(i))}e===t.length?o.success(`已通过 PrintDot 提交 ${e} 条打印任务`):o.warning(`打印完成:成功 ${e},失败 ${t.length-e}${r?`。首条错误:${r}`:""}`)}finally{o.destroy(V),R.value=!1}})}function ft(t){return h(this,null,function*(){R.value=!0,o.destroy(J),o.loading({content:"正在生成 PDF 并提交打印,版面复杂时可能需数十秒,请稍候…",key:J,duration:0});try{yield Q(t,{silentSuccess:!0}),o.success("已通过 PrintDot 提交打印")}catch(e){o.error(e instanceof Error?e.message:String(e))}finally{o.destroy(J),R.value=!1}})}ne(()=>h(null,null,function*(){const t=Zt();A(t.wsUrl,""),p.value=t.wsUrl;try{const r=yield Lt(n),i=(Array.isArray(r)?r:[]).map(x=>{var _,g;return String((g=(_=x.value)!=null?_:x.itemValue)!=null?g:"").trim()}).filter(Boolean),d=new Set(i);d.size&&p.value&&!d.has(String(p.value).trim())?(p.value=i[0],A(p.value,"")):d.size&&!p.value.trim()&&(p.value=i[0],A(p.value,""))}catch(r){}const e=localStorage.getItem(F);e&&(M.value=e),yield W(!1)}));function _t(t){Object.keys(t).map(e=>{f[e]=t[e]}),U()}function gt(){L(!0,{isUpdate:!1,showFooter:!0})}function ht(t){L(!0,{record:t,isUpdate:!0,showFooter:!0})}function wt(t){L(!0,{record:t,isUpdate:!0,showFooter:!1})}function yt(t){return h(this,null,function*(){yield Gt({id:t.id},N)})}function vt(){return h(this,null,function*(){yield Ht({ids:I.value},N)})}function Pt(t,e){return h(this,null,function*(){const r=e?"1":"0",a=t.priorityPickup;t.priorityPickup=r;try{yield Kt(t.id,r)}catch(i){t.priorityPickup=a,o.error("优先出库更新失败,请重试")}})}function bt(t){return h(this,null,function*(){yield Qt(t.id),t.testResult="0",t.hasPendingInspect=!0,o.success("已生成送检记录"),U()})}function N(){(I.value=[])&&U()}function Ct(t){return[{label:"编辑",onClick:ht.bind(null,t),auth:"xslmes:mes_xsl_raw_material_card:edit"},{label:"打印预览",onClick:ct.bind(null,t),auth:"xslmes:mes_xsl_raw_material_card:edit"},{label:"打印",onClick:ft.bind(null,t),auth:"xslmes:mes_xsl_raw_material_card:edit"},{label:"送检",onClick:bt.bind(null,t),auth:"xslmes:mes_xsl_raw_material_card:edit",ifShow:()=>(!t.testResult||t.testResult==="0")&&!t.hasPendingInspect}]}function xt(t){return[{label:"详情",onClick:wt.bind(null,t)},{label:"删除",popConfirm:{title:"是否确认删除",confirm:yt.bind(null,t),placement:"topLeft"},auth:"xslmes:mes_xsl_raw_material_card:delete"}]}return(t,e)=>{const r=j("a-button"),a=j("j-upload-button"),i=It,d=Tt,x=Nt,_=ie,g=j("super-query"),T=pe,y=le("auth");return w(),se("div",null,[m(c(At),{onRegister:c(st),rowSelection:c(lt)},{tableTitle:l(()=>[E((w(),P(r,{type:"primary",onClick:gt,preIcon:"ant-design:plus-outlined"},{default:l(()=>[...e[4]||(e[4]=[b(" 新增",-1)])]),_:1})),[[y,"xslmes:mes_xsl_raw_material_card:add"]]),E((w(),P(r,{type:"primary",preIcon:"ant-design:export-outlined",onClick:c(at)},{default:l(()=>[...e[5]||(e[5]=[b(" 导出",-1)])]),_:1},8,["onClick"])),[[y,"xslmes:mes_xsl_raw_material_card:exportXls"]]),E((w(),P(a,{type:"primary",preIcon:"ant-design:import-outlined",onClick:c(nt)},{default:l(()=>[...e[6]||(e[6]=[b("导入",-1)])]),_:1},8,["onClick"])),[[y,"xslmes:mes_xsl_raw_material_card:importExcel"]]),m(c(Ut),{value:p.value,"onUpdate:value":e[0]||(e[0]=s=>p.value=s),dictCode:"xslmes_print_dot_ws",showChooseOption:!1,style:{width:"280px","margin-left":"8px"},placeholder:"选择 PrintDot 地址",onChange:$},null,8,["value"]),C.value?H("",!0):(w(),P(r,{key:0,style:{"margin-left":"8px"},onClick:S},{default:l(()=>[...e[7]||(e[7]=[b("下载打印插件",-1)])]),_:1})),m(i,{value:M.value,"onUpdate:value":e[1]||(e[1]=s=>M.value=s),options:z.value,style:{width:"220px","margin-left":"8px"},"allow-clear":"","show-search":"","option-filter-prop":"label",placeholder:ut},null,8,["value","options"]),m(r,{style:{"margin-left":"8px"},onClick:e[2]||(e[2]=()=>W(!0))},{default:l(()=>[...e[8]||(e[8]=[b("刷新打印机",-1)])]),_:1}),E((w(),P(r,{type:"primary",ghost:"",loading:R.value,disabled:c(I).length===0,onClick:dt},{default:l(()=>[m(c(Y),{icon:"ant-design:printer-outlined"}),e[9]||(e[9]=b(" 打印选中 ",-1))]),_:1},8,["loading","disabled"])),[[y,"xslmes:mes_xsl_raw_material_card:edit"]]),c(I).length>0?(w(),P(_,{key:1},{overlay:l(()=>[m(x,null,{default:l(()=>[m(d,{key:"1",onClick:vt},{default:l(()=>[m(c(Y),{icon:"ant-design:delete-outlined"}),e[10]||(e[10]=b(" 删除 ",-1))]),_:1})]),_:1})]),default:l(()=>[E((w(),P(r,null,{default:l(()=>[e[11]||(e[11]=b("批量操作 ",-1)),m(c(Y),{icon:"mdi:chevron-down"})]),_:1})),[[y,"xslmes:mes_xsl_raw_material_card:deleteBatch"]])]),_:1})):H("",!0),m(g,{config:mt,onSearch:_t},null,8,["config"])]),action:l(({record:s})=>[m(c(Bt),{actions:Ct(s),dropDownActions:xt(s)},null,8,["actions","dropDownActions"])]),bodyCell:l(({column:s,record:D})=>[s.dataIndex==="priorityPickup"?(w(),P(T,{key:0,checked:D.priorityPickup==="1","checked-children":"是","un-checked-children":"否",onChange:O=>Pt(D,O)},null,8,["checked","onChange"])):H("",!0)]),_:1},8,["onRegister","rowSelection"]),m(Xt,{onRegister:c(k),onSuccess:N},null,8,["onRegister"]),m(Wt,{open:X.value,"onUpdate:open":e[3]||(e[3]=s=>X.value=s),"card-id":K.value,barcode:q.value},null,8,["open","card-id","barcode"])])}}})),ar=Ot(ce,[["__scopeId","data-v-6ec253f2"]]);export{ar as default};
|