(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[7491],{50727:function(Ae,fe,t){"use strict";var Ke=t(9715),he=t(55843),f=t(57663),w=t(71577),Me=t(96156),me=t(28481),Pe=t(81253),S=t(55507),K=t(92137),m=t(28991),p=t(85893),b=t(49101),Re=t(97462),pe=t(952),De=t(78775),xe=t(26369),ge=t(22270),be=t(48171),Te=t(60249),Ie=t(21770),Oe=t(88306),Se=t(8880),j=t(67294),_e=t(77153),Ze=["onTableChange","maxLength","formItemProps","recordCreatorProps","rowKey","controlled","defaultValue","onChange","editableFormRef"],we=["record","position","creatorButtonText","newRecordType","parentKey","style"],L=j.createContext(void 0);function ye(e){var M=e.children,W=e.record,ce=e.position,k=e.newRecordType,q=e.parentKey,J=(0,j.useContext)(L);return j.cloneElement(M,(0,m.Z)((0,m.Z)({},M.props),{},{onClick:function(){var ee=(0,K.Z)((0,S.Z)().mark(function ne(te){var re,H,N,V;return(0,S.Z)().wrap(function(T){for(;;)switch(T.prev=T.next){case 0:return T.next=2,(re=(H=M.props).onClick)===null||re===void 0?void 0:re.call(H,te);case 2:if(V=T.sent,V!==!1){T.next=5;break}return T.abrupt("return");case 5:J==null||(N=J.current)===null||N===void 0||N.addEditRecord(W,{position:ce,newRecordType:k,parentKey:q});case 6:case"end":return T.stop()}},ne)}));function F(ne){return ee.apply(this,arguments)}return F}()}))}function o(e){var M,W,ce=(0,De.YB)(),k=e.onTableChange,q=e.maxLength,J=e.formItemProps,ee=e.recordCreatorProps,F=e.rowKey,ne=e.controlled,te=e.defaultValue,re=e.onChange,H=e.editableFormRef,N=(0,Pe.Z)(e,Ze),V=(0,xe.Z)(e.value),z=(0,j.useRef)(),T=(0,j.useRef)();(0,j.useImperativeHandle)(N.actionRef,function(){return z.current});var je=(0,Ie.Z)(function(){return e.value||te||[]},{value:e.value,onChange:e.onChange}),Ce=(0,me.Z)(je,2),g=Ce[0],O=Ce[1],a=j.useMemo(function(){return typeof F=="function"?F:function(E,n){return E[F]||n}},[F]),P=function(n){if(typeof n=="number"&&!e.name){if(n>=g.length)return n;var r=g&&g[n];return a==null?void 0:a(r,n)}if((typeof n=="string"||n>=g.length)&&e.name){var l=g.findIndex(function(i,Z){var C;return(a==null||(C=a(i,Z))===null||C===void 0?void 0:C.toString())===(n==null?void 0:n.toString())});return l}return n};(0,j.useImperativeHandle)(H,function(){var E=function(l){var i,Z;if(l==null)throw new Error("rowIndex is required");var C=P(l),B=[e.name,(i=C==null?void 0:C.toString())!==null&&i!==void 0?i:""].flat(1).filter(Boolean);return(Z=T.current)===null||Z===void 0?void 0:Z.getFieldValue(B)},n=function(){var l,i=[e.name].flat(1).filter(Boolean);if(Array.isArray(i)&&i.length===0){var Z,C=(Z=T.current)===null||Z===void 0?void 0:Z.getFieldsValue();return Array.isArray(C)?C:Object.keys(C).map(function(B){return C[B]})}return(l=T.current)===null||l===void 0?void 0:l.getFieldValue(i)};return(0,m.Z)((0,m.Z)({},T.current),{},{getRowData:E,getRowsData:n,setRowData:function(l,i){var Z,C,B,R;if(l==null)throw new Error("rowIndex is required");var y=P(l),c=[e.name,(Z=y==null?void 0:y.toString())!==null&&Z!==void 0?Z:""].flat(1).filter(Boolean),d=((C=T.current)===null||C===void 0||(B=C.getFieldsValue)===null||B===void 0?void 0:B.call(C))||{},_=(0,Se.Z)(d,c,(0,m.Z)((0,m.Z)({},E(l)),i||{}));return(R=T.current)===null||R===void 0?void 0:R.setFieldsValue(_)}})}),(0,j.useEffect)(function(){!e.controlled||g.forEach(function(E,n){var r;(r=T.current)===null||r===void 0||r.setFieldsValue((0,Me.Z)({},a(E,n),E))},{})},[g,e.controlled]),(0,j.useEffect)(function(){if(e.name){var E;T.current=e==null||(E=e.editable)===null||E===void 0?void 0:E.form}},[(M=e.editable)===null||M===void 0?void 0:M.form,e.name]);var u=ee||{},U=u.record,$=u.position,le=u.creatorButtonText,Q=u.newRecordType,G=u.parentKey,ie=u.style,ue=(0,Pe.Z)(u,we),ae=$==="top",I=(0,j.useMemo)(function(){return q&&q<=(g==null?void 0:g.length)?!1:ee!==!1&&(0,p.jsx)(ye,{record:(0,ge.h)(U,g==null?void 0:g.length,g)||{},position:$,parentKey:(0,ge.h)(G,g==null?void 0:g.length,g),newRecordType:Q,children:(0,p.jsx)(w.Z,(0,m.Z)((0,m.Z)({type:"dashed",style:(0,m.Z)({display:"block",margin:"10px 0",width:"100%"},ie),icon:(0,p.jsx)(b.Z,{})},ue),{},{children:le||ce.getMessage("editableTable.action.add","\u6DFB\u52A0\u4E00\u884C\u6570\u636E")}))})},[ee,q,g==null?void 0:g.length]),oe=(0,j.useMemo)(function(){return I?ae?{components:{header:{wrapper:function(n){var r,l=n.className,i=n.children;return(0,p.jsxs)("thead",{className:l,children:[i,(0,p.jsxs)("tr",{style:{position:"relative"},children:[(0,p.jsx)("td",{colSpan:0,style:{visibility:"hidden"},children:I}),(0,p.jsx)("td",{style:{position:"absolute",left:0,width:"100%"},colSpan:(r=N.columns)===null||r===void 0?void 0:r.length,children:I})]})]})}}}}:{tableViewRender:function(n,r){var l,i;return(0,p.jsxs)(p.Fragment,{children:[(l=(i=e.tableViewRender)===null||i===void 0?void 0:i.call(e,n,r))!==null&&l!==void 0?l:r,I]})}}:{}},[ae,I]),X=(0,m.Z)({},e.editable),de=(0,be.J)(function(E,n){var r,l,i;if((r=e.editable)===null||r===void 0||(l=r.onValuesChange)===null||l===void 0||l.call(r,E,n),(i=e.onValuesChange)===null||i===void 0||i.call(e,n,E),e.controlled){var Z;e==null||(Z=e.onChange)===null||Z===void 0||Z.call(e,n)}});return((e==null?void 0:e.onValuesChange)||((W=e.editable)===null||W===void 0?void 0:W.onValuesChange)||e.controlled&&(e==null?void 0:e.onChange))&&(X.onValuesChange=de),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(L.Provider,{value:z,children:(0,p.jsx)(_e.Z,(0,m.Z)((0,m.Z)((0,m.Z)({search:!1,options:!1,pagination:!1,rowKey:F,revalidateOnFocus:!1},N),oe),{},{tableLayout:"fixed",actionRef:z,onChange:k,editable:(0,m.Z)((0,m.Z)({},X),{},{formProps:(0,m.Z)({formRef:T},X.formProps)}),dataSource:g,onDataSourceChange:function(n){if(O(n),e.name&&$==="top"){var r,l=(0,Se.Z)({},[e.name].flat(1).filter(Boolean),n);(r=T.current)===null||r===void 0||r.setFieldsValue(l)}}}))}),e.name?(0,p.jsx)(Re.Z,{name:[e.name],children:function(n){var r,l,i=(0,Oe.Z)(n,[e.name].flat(1)),Z=i==null?void 0:i.find(function(C,B){return!(0,Te.Z)(C,V==null?void 0:V[B])});return Z&&V&&(e==null||(r=e.editable)===null||r===void 0||(l=r.onValuesChange)===null||l===void 0||l.call(r,Z,i)),null}}):null]})}function Ee(e){var M=pe.ZP.useFormInstance();return e.name?(0,p.jsx)(he.Z.Item,(0,m.Z)((0,m.Z)({style:{maxWidth:"100%"}},e==null?void 0:e.formItemProps),{},{name:e.name,children:(0,p.jsx)(o,(0,m.Z)((0,m.Z)({},e),{},{editable:(0,m.Z)((0,m.Z)({},e.editable),{},{form:M})}))})):(0,p.jsx)(o,(0,m.Z)({},e))}Ee.RecordCreator=ye,fe.Z=Ee},44598:function(Ae,fe,t){"use strict";t.r(fe),t.d(fe,{default:function(){return g}});var Ke=t(57663),he=t(71577),f=t(39428),w=t(3182),Me=t(62350),me=t(24565),Pe=t(34792),S=t(48086),K=t(2824),m=t(402),p=t(56256),b=t(67294),Re=t(28790),pe=t(49101),De=t(16894),xe=t(71194),ge=t(50146),be=t(12968),Te=t(6122),Ie=t(77883),Oe=t(85986),Se=t(43358),j=t(34041),_e=t(47673),Ze=t(4107),we=t(9715),L=t(55843),ye=t(50727),o=t(85893),Ee=function(a){var P=L.Z.useForm(),u=(0,K.Z)(P,1),U=u[0],$=(0,b.useState)([]),le=(0,K.Z)($,2),Q=le[0],G=le[1],ie=(0,b.useState)([]),ue=(0,K.Z)(ie,2),ae=ue[0],I=ue[1],oe=(0,b.useState)([]),X=(0,K.Z)(oe,2),de=X[0],E=X[1],n=(0,b.useState)(""),r=(0,K.Z)(n,2),l=r[0],i=r[1];(0,b.useEffect)(function(){var R;if(a.values.id){U.setFieldsValue({id:a.values.id,templateName:a.values.templateName,sort:a.values.sort,deviceId:a.values.deviceId});var y=a.values.warehousePostion.map(function(d){return{id:d.id,code:d.code,batchingId:d.batchingId}});I(y.map(function(d){return d.id})),G(y)}var c=(R=a.devicedata)===null||R===void 0?void 0:R.map(function(d,_){return{value:d.id,label:d.name}});E(c),i(a.values.productUrl)},[a]);var Z=[{title:"\u4E3B\u952E",dataIndex:"id",hideInSearch:!0,hideInTable:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key"},{title:"\u4ED3\u4F4D\u7F16\u7801",dataIndex:"code"},{title:"\u7269\u6599",dataIndex:"batchingId",valueType:"select",fieldProps:{showSearch:!0,options:a.matedata.map(function(R,y){return{label:R.name,value:R.id}})},width:"45%"}],C=function(y){var c=a.devicedata.find(function(se){return se.id==y});if(console.log("device",c),c){for(var d=[],_=0;_0&&(0,o.jsx)(me.Z,{title:"\u786E\u8BA4\u5220\u9664\u5417?",onConfirm:ve,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",children:(0,o.jsx)(he.Z,{type:"primary",children:"\u6279\u91CF\u5220\u9664"})})},ve=function(){var h,v;We(I),oe([]),(h=$.current)===null||h===void 0||(v=h.reloadAndRest)===null||v===void 0||v.call(h)},We=function(){var D=(0,w.Z)((0,f.Z)().mark(function h(v){var A;return(0,f.Z)().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:return A=[],v.forEach(function(Y){A.push(Y.id)}),x.next=4,ne(A).then(function(Y){Y.data?(S.default.success("\u5220\u9664\u6210\u529F"),$.current.reload()):S.default.error("\u5220\u9664\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")});case 4:return x.abrupt("return",!0);case 5:case"end":return x.stop()}},h)}));return function(v){return D.apply(this,arguments)}}();return(0,o.jsxs)(Re.ZP,{host:!0,header:{title:"",breadcrumb:{}},children:[(0,o.jsx)(De.ZP,{actionRef:$,rowKey:"id",pagination:{defaultPageSize:10},search:{labelWidth:120},toolBarRender:function(){return[(0,o.jsxs)(he.Z,{type:"primary",onClick:function(){U(!0)},children:[(0,o.jsx)(pe.Z,{})," \u65B0\u5EFA"]},"primary"),(0,o.jsx)(se,{})]},request:function(){var D=(0,w.Z)((0,f.Z)().mark(function h(v){var A,s;return(0,f.Z)().wrap(function(Y){for(;;)switch(Y.prev=Y.next){case 0:return A=[],s=0,Y.next=4,ce(v).then(function(Be){A=Be.data.data,s=Be.data.total});case 4:return Y.abrupt("return",{data:A,success:!0,total:s});case 5:case"end":return Y.stop()}},h)}));return function(h){return D.apply(this,arguments)}}(),columns:c,rowSelection:{onChange:function(h,v){oe(v)}}}),(0,o.jsx)(e,{handleAdd:function(){var D=(0,w.Z)((0,f.Z)().mark(function h(v){var A;return(0,f.Z)().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:A=!1,v.id?_(v):d(v);case 2:case"end":return x.stop()}},h)}));return function(h){return D.apply(this,arguments)}}(),onCancel:function(){U(!1),ie(void 0)},createModalVisible:u,values:G||{},devicedata:E,matedata:R})]})},g=Ce}}]);