(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[7491],{50727:function(xe,fe,a){"use strict";var _e=a(9715),he=a(55843),s=a(57663),T=a(71577),be=a(96156),Ze=a(28481),ye=a(81253),p=a(55507),w=a(92137),g=a(28991),C=a(85893),b=a(49101),Ee=a(97462),Ce=a(952),Pe=a(78775),Re=a(26369),pe=a(22270),De=a(48171),Ie=a(60249),Te=a(21770),Se=a(88306),ie=a(8880),I=a(67294),H=a(77153),Oe=["onTableChange","maxLength","formItemProps","recordCreatorProps","rowKey","controlled","defaultValue","onChange","editableFormRef"],h=["record","position","creatorButtonText","newRecordType","parentKey","style"],me=I.createContext(void 0);function ge(e){var S=e.children,z=e.record,Q=e.position,ue=e.newRecordType,F=e.parentKey,X=(0,I.useContext)(me);return I.cloneElement(S,(0,g.Z)((0,g.Z)({},S.props),{},{onClick:function(){var V=(0,w.Z)((0,p.Z)().mark(function k(oe){var U,N,G,Y;return(0,p.Z)().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:return P.next=2,(U=(N=S.props).onClick)===null||U===void 0?void 0:U.call(N,oe);case 2:if(Y=P.sent,Y!==!1){P.next=5;break}return P.abrupt("return");case 5:X==null||(G=X.current)===null||G===void 0||G.addEditRecord(z,{position:Q,newRecordType:ue,parentKey:F});case 6:case"end":return P.stop()}},k)}));function L(k){return V.apply(this,arguments)}return L}()}))}function K(e){var S,z,Q=(0,Pe.YB)(),ue=e.onTableChange,F=e.maxLength,X=e.formItemProps,V=e.recordCreatorProps,L=e.rowKey,k=e.controlled,oe=e.defaultValue,U=e.onChange,N=e.editableFormRef,G=(0,ye.Z)(e,Oe),Y=(0,Re.Z)(e.value),te=(0,I.useRef)(),P=(0,I.useRef)();(0,I.useImperativeHandle)(G.actionRef,function(){return te.current});var R=(0,Te.Z)(function(){return e.value||oe||[]},{value:e.value,onChange:e.onChange}),d=(0,Ze.Z)(R,2),i=d[0],m=d[1],D=I.useMemo(function(){return typeof L=="function"?L:function(Z,l){return Z[L]||l}},[L]),j=function(l){if(typeof l=="number"&&!e.name){if(l>=i.length)return l;var r=i&&i[l];return D==null?void 0:D(r,l)}if((typeof l=="string"||l>=i.length)&&e.name){var n=i.findIndex(function(t,u){var v;return(D==null||(v=D(t,u))===null||v===void 0?void 0:v.toString())===(l==null?void 0:l.toString())});return n}return l};(0,I.useImperativeHandle)(N,function(){var Z=function(n){var t,u;if(n==null)throw new Error("rowIndex is required");var v=j(n),O=[e.name,(t=v==null?void 0:v.toString())!==null&&t!==void 0?t:""].flat(1).filter(Boolean);return(u=P.current)===null||u===void 0?void 0:u.getFieldValue(O)},l=function(){var n,t=[e.name].flat(1).filter(Boolean);if(Array.isArray(t)&&t.length===0){var u,v=(u=P.current)===null||u===void 0?void 0:u.getFieldsValue();return Array.isArray(v)?v:Object.keys(v).map(function(O){return v[O]})}return(n=P.current)===null||n===void 0?void 0:n.getFieldValue(t)};return(0,g.Z)((0,g.Z)({},P.current),{},{getRowData:Z,getRowsData:l,setRowData:function(n,t){var u,v,O,ce;if(n==null)throw new Error("rowIndex is required");var ve=j(n),Me=[e.name,(u=ve==null?void 0:ve.toString())!==null&&u!==void 0?u:""].flat(1).filter(Boolean),y=((v=P.current)===null||v===void 0||(O=v.getFieldsValue)===null||O===void 0?void 0:O.call(v))||{},c=(0,ie.Z)(y,Me,(0,g.Z)((0,g.Z)({},Z(n)),t||{}));return(ce=P.current)===null||ce===void 0?void 0:ce.setFieldsValue(c)}})}),(0,I.useEffect)(function(){!e.controlled||i.forEach(function(Z,l){var r;(r=P.current)===null||r===void 0||r.setFieldsValue((0,be.Z)({},D(Z,l),Z))},{})},[i,e.controlled]),(0,I.useEffect)(function(){if(e.name){var Z;P.current=e==null||(Z=e.editable)===null||Z===void 0?void 0:Z.form}},[(S=e.editable)===null||S===void 0?void 0:S.form,e.name]);var x=V||{},J=x.record,A=x.position,ae=x.creatorButtonText,ne=x.newRecordType,re=x.parentKey,_=x.style,le=(0,ye.Z)(x,h),q=A==="top",B=(0,I.useMemo)(function(){return F&&F<=(i==null?void 0:i.length)?!1:V!==!1&&(0,C.jsx)(ge,{record:(0,pe.h)(J,i==null?void 0:i.length,i)||{},position:A,parentKey:(0,pe.h)(re,i==null?void 0:i.length,i),newRecordType:ne,children:(0,C.jsx)(T.Z,(0,g.Z)((0,g.Z)({type:"dashed",style:(0,g.Z)({display:"block",margin:"10px 0",width:"100%"},_),icon:(0,C.jsx)(b.Z,{})},le),{},{children:ae||Q.getMessage("editableTable.action.add","\u6DFB\u52A0\u4E00\u884C\u6570\u636E")}))})},[V,F,i==null?void 0:i.length]),de=(0,I.useMemo)(function(){return B?q?{components:{header:{wrapper:function(l){var r,n=l.className,t=l.children;return(0,C.jsxs)("thead",{className:n,children:[t,(0,C.jsxs)("tr",{style:{position:"relative"},children:[(0,C.jsx)("td",{colSpan:0,style:{visibility:"hidden"},children:B}),(0,C.jsx)("td",{style:{position:"absolute",left:0,width:"100%"},colSpan:(r=G.columns)===null||r===void 0?void 0:r.length,children:B})]})]})}}}}:{tableViewRender:function(l,r){var n,t;return(0,C.jsxs)(C.Fragment,{children:[(n=(t=e.tableViewRender)===null||t===void 0?void 0:t.call(e,l,r))!==null&&n!==void 0?n:r,B]})}}:{}},[q,B]),ee=(0,g.Z)({},e.editable),se=(0,De.J)(function(Z,l){var r,n,t;if((r=e.editable)===null||r===void 0||(n=r.onValuesChange)===null||n===void 0||n.call(r,Z,l),(t=e.onValuesChange)===null||t===void 0||t.call(e,l,Z),e.controlled){var u;e==null||(u=e.onChange)===null||u===void 0||u.call(e,l)}});return((e==null?void 0:e.onValuesChange)||((z=e.editable)===null||z===void 0?void 0:z.onValuesChange)||e.controlled&&(e==null?void 0:e.onChange))&&(ee.onValuesChange=se),(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(me.Provider,{value:te,children:(0,C.jsx)(H.Z,(0,g.Z)((0,g.Z)((0,g.Z)({search:!1,options:!1,pagination:!1,rowKey:L,revalidateOnFocus:!1},G),de),{},{tableLayout:"fixed",actionRef:te,onChange:ue,editable:(0,g.Z)((0,g.Z)({},ee),{},{formProps:(0,g.Z)({formRef:P},ee.formProps)}),dataSource:i,onDataSourceChange:function(l){if(m(l),e.name&&A==="top"){var r,n=(0,ie.Z)({},[e.name].flat(1).filter(Boolean),l);(r=P.current)===null||r===void 0||r.setFieldsValue(n)}}}))}),e.name?(0,C.jsx)(Ee.Z,{name:[e.name],children:function(l){var r,n,t=(0,Se.Z)(l,[e.name].flat(1)),u=t==null?void 0:t.find(function(v,O){return!(0,Ie.Z)(v,Y==null?void 0:Y[O])});return u&&Y&&(e==null||(r=e.editable)===null||r===void 0||(n=r.onValuesChange)===null||n===void 0||n.call(r,u,t)),null}}):null]})}function $(e){var S=Ce.ZP.useFormInstance();return e.name?(0,C.jsx)(he.Z.Item,(0,g.Z)((0,g.Z)({style:{maxWidth:"100%"}},e==null?void 0:e.formItemProps),{},{name:e.name,children:(0,C.jsx)(K,(0,g.Z)((0,g.Z)({},e),{},{editable:(0,g.Z)((0,g.Z)({},e.editable),{},{form:S})}))})):(0,C.jsx)(K,(0,g.Z)({},e))}$.RecordCreator=ge,fe.Z=$},44598:function(xe,fe,a){"use strict";a.r(fe),a.d(fe,{default:function(){return P}});var _e=a(57663),he=a(71577),s=a(39428),T=a(3182),be=a(62350),Ze=a(24565),ye=a(34792),p=a(48086),w=a(2824),g=a(402),C=a(56256),b=a(67294),Ee=a(28790),Ce=a(85224),Pe=a(49101),Re=a(16894),pe=a(71194),De=a(50146),Ie=a(43358),Te=a(34041),Se=a(47673),ie=a(4107),I=a(9715),H=a(55843),Oe=a(50727),h=a(85893),me=function(d){var i=H.Z.useForm(),m=(0,w.Z)(i,1),D=m[0],j=(0,b.useState)([]),x=(0,w.Z)(j,2),J=x[0],A=x[1],ae=(0,b.useState)([]),ne=(0,w.Z)(ae,2),re=ne[0],_=ne[1],le=(0,b.useState)([]),q=(0,w.Z)(le,2),B=q[0],de=q[1];(0,b.useEffect)(function(){var l;if(console.log("props.values",d.values),d.values.id){D.setFieldsValue({id:d.values.id,templateName:d.values.templateName,deviceId:d.values.deviceId});var r=d.values.warehousePostion.map(function(t){return{id:t.id,code:t.code,batchingId:t.batchingId}});_(r.map(function(t){return t.id})),A(r)}var n=(l=d.devicedata)===null||l===void 0?void 0:l.map(function(t,u){return{value:t.id,label:t.name}});de(n)},[d]);var ee=[{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",formItemProps:function(r,n){var t=n.rowIndex;return{rules:t>1?[{required:!0,message:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879"}]:[]}},valueType:"select",fieldProps:{showSearch:!0,options:d.matedata.map(function(l,r){return{label:l.name,value:l.id}})},width:"45%"}],se=function(r){var n=d.devicedata.find(function(v){return v.id==r});if(console.log("device",n),n){for(var t=[],u=0;u0&&(0,h.jsx)(Ce.Z,{extra:(0,h.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,h.jsx)("a",{style:{fontWeight:600},children:_.length})," ","\u9879 \xA0\xA0"]}),children:(0,h.jsx)(he.Z,{onClick:(0,T.Z)((0,s.Z)().mark(function y(){var c,f;return(0,s.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,Me(_);case 2:le([]),(c=j.current)===null||c===void 0||(f=c.reloadAndRest)===null||f===void 0||f.call(c);case 4:case"end":return o.stop()}},y)})),children:"\u5220\u9664"})}),(0,h.jsx)(ge,{handleAdd:function(){var y=(0,T.Z)((0,s.Z)().mark(function c(f){var M;return(0,s.Z)().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:M=!1,f.id?ve(f):ce(f);case 2:case"end":return E.stop()}},c)}));return function(c){return y.apply(this,arguments)}}(),onCancel:function(){D(!1),ae(void 0)},createModalVisible:m,values:A||{},devicedata:de,matedata:u})]})},P=te}}]);