2 lines
14 KiB
Java
2 lines
14 KiB
Java
var Pt=Object.defineProperty,Mt=Object.defineProperties;var Tt=Object.getOwnPropertyDescriptors;var Q=Object.getOwnPropertySymbols;var Et=Object.prototype.hasOwnProperty,$t=Object.prototype.propertyIsEnumerable;var G=(f,i,r)=>i in f?Pt(f,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):f[i]=r,Z=(f,i)=>{for(var r in i||(i={}))Et.call(i,r)&&G(f,r,i[r]);if(Q)for(var r of Q(i))$t.call(i,r)&&G(f,r,i[r]);return f},tt=(f,i)=>Mt(f,Tt(i));var h=(f,i,r)=>new Promise((O,s)=>{var M=v=>{try{$(r.next(v))}catch(P){s(P)}},N=v=>{try{$(r.throw(v))}catch(P){s(P)}},$=v=>v.done?O(v.value):Promise.resolve(v.value).then(M,N);$((r=r.apply(f,i)).next())});import{s as It,av as Rt,x as H,aR as Ot,aS as Nt,au as At}from"./index-X7Y8jykP.js";import Bt from"./BasicTable-C6eG0bgK.js";import Lt from"./TableAction-BiXnWkvt.js";import"./TableImg.vue_vue_type_style_index_0_lang-65ZOQtFn.js";import"./index-BDvqZ5j4.js";import{u as Ut}from"./useListPage-CK9oQ-1O.js";import{initDictOptions as zt}from"./index-Cq6YxX27.js";import{J as Xt}from"./index-C69VKHba.js";import{M as Ht,s as jt,c as Jt,a as Wt}from"./MesXslRawMaterialEntryModal-D3NY3l5J.js";import Ft from"./RawMaterialEntryPrintPreviewModal-C9m41_Iq.js";import{g as Yt,a as Vt,l as qt,b as et,c as Kt,d as Qt,p as Gt,e as nt}from"./MesXslRawMaterialEntry.api-B6SjsYRW.js";import{g as Zt,s as R,P as j,f as te,p as ee}from"./printNativeViaPrintDot-hFBchMti.js";import{n as ne}from"./nativeSchemaNormalize-WzV7gGZh.js";import{u as re}from"./useModal-DaJ3Bflg.js";import"./index-CfNJyBRj.js";import{D as ae}from"./dropdown-jkliuVyN.js";import{e as ot,h as oe,o as ie,r as k,C as le,f as u,A as c,u as d,b as rt,K as J,X as se,z as x,O as E,y as D,H as at,E as S,i as w}from"./vue-vendor-DNhG1Cve.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"./index-DsixALRt.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"./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=ot({name:"xslmes-mesXslRawMaterialEntry"}),pe=ot(tt(Z({},me),{setup(f){const{createConfirm:i,createMessage:r}=It(),O="xslmes_print_dot_ws",s=k(""),M=k(!1);function N(){R(String(s.value||"").trim(),""),U(!1)}function $(){M.value=!1,N()}function v(){const n=`${"/".endsWith("/")?"/":"//"}print-plugin/XSL-PrintDot.exe`,a=document.createElement("a");a.href=n,a.setAttribute("download","XSL-PrintDot.exe"),a.rel="noopener",document.body.appendChild(a),a.click(),document.body.removeChild(a)}const P=rt({}),[it,{openModal:A}]=re(),{tableContext:lt,onExportXls:st,onImportXls:mt}=Ut({tableProps:{title:"原料入场记录",api:qt,columns:Jt,canResize:!0,formConfig:{schemas:jt,autoSubmitOnEnter:!0,showAdvancedButton:!0,fieldMapToTime:[["entryTime",["entryTime_begin","entryTime_end"],"YYYY-MM-DD HH:mm:ss"]]},actionColumn:{width:320,fixed:"right",title:"操作",dataIndex:"action",slots:{customRender:"action"}},beforeFetch:e=>Object.assign(e,P)},exportConfig:{name:"原料入场记录",url:Vt,params:P},importConfig:{url:Yt,success:T}}),[pt,{reload:W},{rowSelection:ct,selectedRowKeys:C,selectedRows:ut}]=lt,dt=rt(Wt),B=k(!1),F=k(null),Y=k(void 0);function ft(e){F.value=e.id,Y.value=e.barcode,B.value=!0}const L=k([]),m=k("__system_default__"),I=k(!1),gt="选择打印机(PrintDot 桥接)";oe(m,e=>{e&&localStorage.setItem(j,e)});function U(e=!0){return h(this,null,function*(){const t=new Map;t.set("__system_default__",{label:"系统默认打印机",value:"__system_default__"});try{const n=yield te();M.value=!0,n.forEach(a=>{const o=String(a.name||"").trim();if(!o)return;const l=a.isDefault?"(默认)":"";t.set(o,{label:`${o}${l}`,value:o})}),m.value&&!t.has(m.value)&&t.set(m.value,{label:`${m.value}(手动)`,value:m.value}),L.value=Array.from(t.values()),e&&(n.length?r.success(`已从 PrintDot 桥接识别 ${n.length} 台打印机`):r.warning("PrintDot 已连接但未返回打印机列表"))}catch(n){M.value=!1,m.value&&!t.has(m.value)&&t.set(m.value,{label:`${m.value}(手动)`,value:m.value}),L.value=Array.from(t.values()),e&&r.warning(`PrintDot:${n instanceof Error?n.message:String(n)}`)}})}function V(e,t){return h(this,null,function*(){var n,a;try{const o=yield Gt(e.id),l=o.templateJson,y=o.printData,p=Number((n=o.paperWidthMm)!=null?n:0),g=Number((a=o.paperHeightMm)!=null?a:0),b=String(o.paperOrientation||"").toLowerCase();if(!l)throw new Error("模板 JSON 为空");let _;try{_=typeof l=="string"?JSON.parse(l):l}catch(X){throw new Error("模板 JSON 格式错误")}const z=ne(_);if(p>0&&g>0){const X=b==="landscape"?"landscape":b==="portrait"?"portrait":"",K=X==="landscape"?{width:Math.max(p,g),height:Math.min(p,g)}:X==="portrait"?{width:Math.min(p,g),height:Math.max(p,g)}:{width:p,height:g};z.page.width=K.width,z.page.height=K.height}yield ee({schema:z,data:y,jobName:`原料入场记录-${e.barcode||e.id}.pdf`,printerSelection:m.value||localStorage.getItem(j)||"__system_default__"}),t!=null&&t.silentSuccess||r.success("已通过 PrintDot 提交打印")}catch(o){throw new Error(o instanceof Error?o.message:String(o))}})}function _t(){if(!String(s.value||"").trim()){r.warning("请先选择打印桥接(PrintDot 地址)");return}const e=ut.value||[];if(!e.length){r.warning("请至少勾选一条记录后再点击「打印选中」");return}I.value=!0;const t=r.loading(`正在打印 ${e.length} 条记录,请稍候…`,0);h(null,null,function*(){let n=0,a="";for(const o of e)try{yield V(o,{silentSuccess:!0}),n+=1}catch(l){a||(a=l instanceof Error?l.message:String(l))}n===e.length?r.success(`已通过 PrintDot 提交 ${n} 条打印任务`):r.warning(`打印完成:成功 ${n},失败 ${e.length-n}${a?`。首条错误:${a}`:""}`),t(),I.value=!1})}function ht(e){if(!String(s.value||"").trim()){r.warning("请先选择打印桥接(PrintDot 地址)");return}I.value=!0;const t=r.loading("正在生成 PDF 并提交打印,版面复杂时可能需数十秒,请稍候…",0);V(e).then(()=>{r.success("已通过 PrintDot 提交打印")}).catch(n=>{r.error(n instanceof Error?n.message:String(n))}).finally(()=>{t(),I.value=!1})}ie(()=>h(null,null,function*(){const e=Zt();R(e.wsUrl,""),s.value=e.wsUrl;try{const n=yield zt(O),o=(Array.isArray(n)?n:[]).map(y=>{var p,g;return String((g=(p=y.value)!=null?p:y.itemValue)!=null?g:"").trim()}).filter(Boolean),l=new Set(o);l.size&&s.value&&!l.has(String(s.value).trim())?(s.value=o[0],R(s.value,"")):l.size&&!String(s.value||"").trim()&&(s.value=o[0],R(s.value,""))}catch(n){}const t=localStorage.getItem(j);t&&(m.value=t),yield U(!1)}));function wt(e){Object.keys(e).map(t=>{P[t]=e[t]}),W()}function vt(){A(!0,{isUpdate:!1,showFooter:!0})}function yt(e){A(!0,{record:e,isUpdate:!0,showFooter:!0})}function bt(e){A(!0,{record:e,isUpdate:!0,showFooter:!1})}function q(e,t){const n={color:"rgba(0,0,0,0.45)",display:"inline-block",minWidth:"40px"};return w("div",{class:"linked-raw-material-cards-confirm"},[w("p",{style:{margin:"0 0 12px",color:"rgba(0,0,0,0.88)"}},t),w("ul",{style:{listStyle:"none",padding:0,margin:0,maxHeight:"360px",overflowY:"auto",border:"1px solid #f0f0f0",borderRadius:"6px",background:"#fafafa"}},e.map((a,o)=>{var l,y,p;return w("li",{key:(p=a.id)!=null?p:`${(l=a.barcode)!=null?l:""}-${(y=a.batchNo)!=null?y:""}-${o}`,style:{padding:"10px 12px",borderBottom:o<e.length-1?"1px solid #f0f0f0":"none",background:"#fff"}},[w("div",{style:{fontSize:"13px",lineHeight:"22px",color:"rgba(0,0,0,0.88)",wordBreak:"break-all"}},[w("div",null,[w("span",{style:n},"条码"),":",a.barcode||"-"]),w("div",null,[w("span",{style:n},"批次"),":",a.batchNo||"-"]),w("div",null,[w("span",{style:n},"物料"),":",a.materialName||"-"])])])}))])}function xt(e){return h(this,null,function*(){try{const t=yield et(e.id);t&&t.length>0?i({iconType:"warning",title:"已生成原材料卡片",width:600,content:q(t,`以下 ${t.length} 张卡片将随入场记录一并删除:`),okText:"仍要删除",cancelText:"取消",onOk:()=>h(null,null,function*(){yield nt({id:e.id,cascadeDeleteCards:!0},T)})}):i({iconType:"warning",title:"确认删除",content:"是否确认删除该条原料入场记录?",okText:"确认",cancelText:"取消",onOk:()=>h(null,null,function*(){yield nt({id:e.id,cascadeDeleteCards:!1},T)})})}catch(t){r.error(t instanceof Error?t.message:String(t))}})}function St(){return h(this,null,function*(){const e=(C.value||[]).join(",");if(!e){r.warning("请先勾选要删除的记录");return}try{const t=yield et(e),n=t&&t.length>0?t:[],a=n.length>0;i({iconType:"warning",title:a?"已生成原材料卡片":"确认删除",width:a?600:416,content:a?q(n,`以下 ${n.length} 张卡片将随选中入场记录一并删除:`):`是否删除选中的 ${C.value.length} 条数据?`,okText:"确认删除",cancelText:"取消",onOk:()=>h(null,null,function*(){yield Kt({ids:e,cascadeDeleteCards:!!a},T)})})}catch(t){r.error(t instanceof Error?t.message:String(t))}})}function Ct(){if(!C.value.length){r.warning("请先勾选要结存入库的记录");return}i({iconType:"warning",title:"结存入库",content:`是否将选中的 ${C.value.length} 条记录结存入库`,okText:"确认",cancelText:"取消",onOk:()=>h(null,null,function*(){yield Qt(C.value.join(",")),r.success("结存入库成功!"),T()})})}function T(){(C.value=[])&&W()}function kt(e){return[{label:"编辑",onClick:yt.bind(null,e),auth:"xslmes:mes_xsl_raw_material_entry:edit"},{label:"打印预览",onClick:ft.bind(null,e),auth:"xslmes:mes_xsl_raw_material_entry:edit"},{label:"打印",onClick:ht.bind(null,e),auth:"xslmes:mes_xsl_raw_material_entry:edit"}]}function Dt(e){return[{label:"详情",onClick:bt.bind(null,e)},{label:"删除",onClick:xt.bind(null,e),auth:"xslmes:mes_xsl_raw_material_entry:delete"}]}return(e,t)=>{const n=J("a-button"),a=J("j-upload-button"),o=Rt,l=Nt,y=Ot,p=ae,g=J("super-query"),b=se("auth");return x(),le("div",null,[u(d(Bt),{onRegister:d(pt),rowSelection:d(ct)},{tableTitle:c(()=>[E((x(),D(n,{type:"primary",onClick:vt,preIcon:"ant-design:plus-outlined"},{default:c(()=>[...t[4]||(t[4]=[S(" 新增",-1)])]),_:1})),[[b,"xslmes:mes_xsl_raw_material_entry:add"]]),E((x(),D(n,{type:"primary",preIcon:"ant-design:export-outlined",onClick:d(st)},{default:c(()=>[...t[5]||(t[5]=[S(" 导出",-1)])]),_:1},8,["onClick"])),[[b,"xslmes:mes_xsl_raw_material_entry:exportXls"]]),E((x(),D(a,{type:"primary",preIcon:"ant-design:import-outlined",onClick:d(mt)},{default:c(()=>[...t[6]||(t[6]=[S("导入",-1)])]),_:1},8,["onClick"])),[[b,"xslmes:mes_xsl_raw_material_entry:importExcel"]]),E((x(),D(n,{type:"primary",preIcon:"ant-design:check-circle-outlined",onClick:Ct},{default:c(()=>[...t[7]||(t[7]=[S(" 结存入库",-1)])]),_:1})),[[b,"xslmes:mes_xsl_raw_material_entry:stockIn"]]),u(d(Xt),{value:s.value,"onUpdate:value":t[0]||(t[0]=_=>s.value=_),dictCode:"xslmes_print_dot_ws",showChooseOption:!1,style:{width:"280px","margin-left":"8px"},placeholder:"选择打印桥接",onChange:$},null,8,["value"]),M.value?at("",!0):(x(),D(n,{key:0,style:{"margin-left":"8px"},onClick:v},{default:c(()=>[...t[8]||(t[8]=[S("下载打印插件",-1)])]),_:1})),u(o,{value:m.value,"onUpdate:value":t[1]||(t[1]=_=>m.value=_),options:L.value,style:{width:"220px","margin-left":"8px"},"allow-clear":"","show-search":"","option-filter-prop":"label",placeholder:gt},null,8,["value","options"]),u(n,{style:{"margin-left":"8px"},onClick:t[2]||(t[2]=()=>U(!0))},{default:c(()=>[...t[9]||(t[9]=[S("刷新打印机",-1)])]),_:1}),E((x(),D(n,{type:"primary",ghost:"",loading:I.value,disabled:d(C).length===0,onClick:_t},{default:c(()=>[u(d(H),{icon:"ant-design:printer-outlined"}),t[10]||(t[10]=S(" 打印选中 ",-1))]),_:1},8,["loading","disabled"])),[[b,"xslmes:mes_xsl_raw_material_entry:edit"]]),d(C).length>0?(x(),D(p,{key:1},{overlay:c(()=>[u(y,null,{default:c(()=>[u(l,{key:"1",onClick:St},{default:c(()=>[u(d(H),{icon:"ant-design:delete-outlined"}),t[11]||(t[11]=S(" 删除 ",-1))]),_:1})]),_:1})]),default:c(()=>[E((x(),D(n,null,{default:c(()=>[t[12]||(t[12]=S("批量操作 ",-1)),u(d(H),{icon:"mdi:chevron-down"})]),_:1})),[[b,"xslmes:mes_xsl_raw_material_entry:deleteBatch"]])]),_:1})):at("",!0),u(g,{config:dt,onSearch:wt},null,8,["config"])]),action:c(({record:_})=>[u(d(Lt),{actions:kt(_),dropDownActions:Dt(_)},null,8,["actions","dropDownActions"])]),_:1},8,["onRegister","rowSelection"]),u(Ht,{onRegister:d(it),onSuccess:T},null,8,["onRegister"]),u(Ft,{open:B.value,"onUpdate:open":t[3]||(t[3]=_=>B.value=_),"entry-id":F.value,barcode:Y.value},null,8,["open","entry-id","barcode"])])}}})),Qn=At(pe,[["__scopeId","data-v-b79cfebf"]]);export{Qn as default};
|