|
- (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;_<c.productNumber;_++)d.push({id:_,code:"LC"+String(_+1).padStart(4,"0"),batchingId:""});console.log("ary",d),I(d.map(function(se){return se.id})),G(d),i(c.productUrl)}},B=function(){U.validateFields().then(function(y){var c=!0;Q.length==0&&(c=!1,message.error("\u8BF7\u9009\u62E9\u7269\u6599")),c&&(y.warehousePostionData=Q,a.handleAdd(y))})};return(0,o.jsxs)(ge.Z,{title:a.values.id?"\u7F16\u8F91":"\u65B0\u5EFA",width:640,visible:a.createModalVisible,bodyStyle:{padding:"32px 40px 48px"},okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:B,onCancel:function(){a.onCancel(),G([]),I([]),i("")},maskClosable:!1,destroyOnClose:!0,children:[(0,o.jsxs)(L.Z,{layout:"vertical",preserve:!1,form:U,children:[(0,o.jsx)(L.Z.Item,{name:"id",hidden:!0,children:(0,o.jsx)(Ze.Z,{})}),(0,o.jsx)(L.Z.Item,{label:"\u6A21\u677F\u540D\u79F0",name:"templateName",rules:[{required:!0,max:50}],children:(0,o.jsx)(Ze.Z,{})}),(0,o.jsx)(L.Z.Item,{label:"\u9009\u62E9\u8BBE\u5907",name:"deviceId",rules:[{required:!0,max:50}],children:(0,o.jsx)(j.Z,{style:{width:"100%"},allowClear:!0,showSearch:!0,optionFilterProp:"children",filterOption:function(y,c){var d;return((d=c==null?void 0:c.label)!==null&&d!==void 0?d:"").includes(y)},filterSort:function(y,c){var d,_;return((d=y==null?void 0:y.label)!==null&&d!==void 0?d:"").toLowerCase().localeCompare(((_=c==null?void 0:c.label)!==null&&_!==void 0?_:"").toLowerCase())},onChange:C,options:de})}),(0,o.jsx)(L.Z.Item,{label:"\u5E8F\u53F7",name:"sort",children:(0,o.jsx)(Oe.Z,{style:{width:"100%"}})}),(0,o.jsx)(L.Z.Item,{label:"\u8BBE\u5907\u4ED3\u4F4D\u56FE",name:"productUrl",rules:[{required:!1,max:50}],children:(0,o.jsx)(Te.Z,{width:120,src:l})})]}),(0,o.jsx)(ye.Z,{headerTitle:(0,o.jsxs)("span",{children:[(0,o.jsx)("span",{style:{color:"red",marginRight:3},children:"*"}),"\u4ED3\u4F4D\u8BE6\u60C5"]}),columns:Z,rowKey:"id",value:Q,onChange:G,recordCreatorProps:!1,editable:{type:"multiple",editableKeys:ae,actionRender:function(y,c,d){return[]},onValuesChange:function(y,c){G(c)},onDelete:function(){var R=(0,w.Z)((0,f.Z)().mark(function c(d,_){return(0,f.Z)().wrap(function(ve){for(;;)switch(ve.prev=ve.next){case 0:console.log(d),console.log(_);case 2:case"end":return ve.stop()}},c)}));function y(c,d){return R.apply(this,arguments)}return y}(),onChange:I}})]})},e=Ee,M=t(48971),W=t(96690);function ce(O){return k.apply(this,arguments)}function k(){return k=(0,w.Z)((0,f.Z)().mark(function O(a){return(0,f.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,M.WY)((0,W.w)()+"/api/warehousetemplate/page",{method:"POST",data:a}));case 1:case"end":return u.stop()}},O)})),k.apply(this,arguments)}function q(O){return J.apply(this,arguments)}function J(){return J=(0,w.Z)((0,f.Z)().mark(function O(a){return(0,f.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,M.WY)((0,W.w)()+"/api/warehousetemplate/add",{method:"POST",data:a}));case 1:case"end":return u.stop()}},O)})),J.apply(this,arguments)}function ee(O){return F.apply(this,arguments)}function F(){return F=(0,w.Z)((0,f.Z)().mark(function O(a){return(0,f.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,M.WY)((0,W.w)()+"/api/warehousetemplate/update",{method:"POST",data:a}));case 1:case"end":return u.stop()}},O)})),F.apply(this,arguments)}function ne(O){return te.apply(this,arguments)}function te(){return te=(0,w.Z)((0,f.Z)().mark(function O(a){return(0,f.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,M.WY)((0,W.w)()+"/api/warehousetemplate/del",{method:"POST",data:a}));case 1:case"end":return u.stop()}},O)})),te.apply(this,arguments)}function re(){return H.apply(this,arguments)}function H(){return H=(0,w.Z)((0,f.Z)().mark(function O(){return(0,f.Z)().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:return P.abrupt("return",(0,M.WY)((0,W.w)()+"/api/device/list",{method:"Get"}));case 1:case"end":return P.stop()}},O)})),H.apply(this,arguments)}function N(){return V.apply(this,arguments)}function V(){return V=(0,w.Z)((0,f.Z)().mark(function O(){return(0,f.Z)().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:return P.abrupt("return",(0,M.WY)((0,W.w)()+"/api/batching/getbatchingselectlist",{method:"Get"}));case 1:case"end":return P.stop()}},O)})),V.apply(this,arguments)}var z="message",T=p.Z.Paragraph,je=p.Z.Text,Ce=function(){var a=(0,b.useState)(!1),P=(0,K.Z)(a,2),u=P[0],U=P[1],$=(0,b.useRef)(),le=(0,b.useState)(),Q=(0,K.Z)(le,2),G=Q[0],ie=Q[1],ue=(0,b.useState)([]),ae=(0,K.Z)(ue,2),I=ae[0],oe=ae[1],X=(0,b.useState)([]),de=(0,K.Z)(X,2),E=de[0],n=de[1],r=(0,b.useState)([]),l=(0,K.Z)(r,2),i=l[0],Z=l[1],C=(0,b.useState)([]),B=(0,K.Z)(C,2),R=B[0],y=B[1];(0,b.useEffect)(function(){re().then(function(D){var h={};D.data.forEach(function(v){h[v.id]={text:v.name}}),Z(h),n(D.data)}),N().then(function(D){y(D.data)})},[]);var c=[{title:"\u4E3B\u952E",dataIndex:"id",hideInSearch:!0,hideInTable:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key"},{title:"\u6A21\u677F\u540D\u79F0",dataIndex:"templateName",valueType:"textarea"},{title:"\u8BBE\u5907\u540D\u79F0",dataIndex:"deviceName",valueEnum:i},{title:"\u4ED3\u4F4D\u6570",dataIndex:"productNumber",valueType:"textarea",hideInSearch:!0},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",fixed:"right",width:450,render:function(h,v){return[(0,o.jsx)("a",{onClick:function(){U(!0),ie(v)},children:" \u66F4\u65B0"},"config"),(0,o.jsx)(me.Z,{type:"primary",title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:function(){ne([v.id]).then(function(s){s.data?(S.default.success("\u5220\u9664\u6210\u529F"),$.current.reload()):S.default.error(s.errors)})},onCancel:function(){},children:(0,o.jsx)("a",{href:"#",children:"\u5220\u9664"})},"primary")]}}],d=function(){var D=(0,w.Z)((0,f.Z)().mark(function h(v){return(0,f.Z)().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,s.next=3,q(JSON.stringify(v)).then(function(x){x.succeeded?(S.default.success("\u6DFB\u52A0\u6210\u529F"),$.current.reload(),U(!1)):S.default.error(x.errors)});case 3:s.next=8;break;case 5:s.prev=5,s.t0=s.catch(0),S.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01");case 8:case"end":return s.stop()}},h,null,[[0,5]])}));return function(v){return D.apply(this,arguments)}}(),_=function(){var D=(0,w.Z)((0,f.Z)().mark(function h(v){return(0,f.Z)().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,S.default.loading("\u6B63\u5728\u4FEE\u6539",z),S.default.destroy(z),s.next=5,ee(JSON.stringify(v)).then(function(x){S.default.destroy(z),x.succeeded?(S.default.success("\u4FEE\u6539\u6210\u529F"),$.current.reload(),U(!1)):S.default.error(x.errors)});case 5:s.next=10;break;case 7:s.prev=7,s.t0=s.catch(0),S.default.error("\u4FEE\u6539\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01");case 10:case"end":return s.stop()}},h,null,[[0,7]])}));return function(v){return D.apply(this,arguments)}}(),se=function(){return(I==null?void 0:I.length)>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}}]);
|