|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[3611],{50727:function(Ye,ye,t){"use strict";var ke=t(9715),se=t(55843),ze=t(57663),Te=t(71577),s=t(96156),Ve=t(28481),x=t(81253),P=t(55507),Le=t(92137),y=t(28991),w=t(85893),Ie=t(49101),$e=t(97462),L=t(952),R=t(78775),ce=t(26369),D=t(22270),Re=t(48171),Pe=t(60249),U=t(21770),W=t(88306),Ze=t(8880),j=t(67294),we=t(77153),fe=["onTableChange","maxLength","formItemProps","recordCreatorProps","rowKey","controlled","defaultValue","onChange","editableFormRef"],Be=["record","position","creatorButtonText","newRecordType","parentKey","style"],ie=j.createContext(void 0);function Ce(e){var G=e.children,J=e.record,ve=e.position,ne=e.newRecordType,ae=e.parentKey,ee=(0,j.useContext)(ie);return j.cloneElement(G,(0,y.Z)((0,y.Z)({},G.props),{},{onClick:function(){var re=(0,Le.Z)((0,P.Z)().mark(function be(oe){var he,Y,te,z;return(0,P.Z)().wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return B.next=2,(he=(Y=G.props).onClick)===null||he===void 0?void 0:he.call(Y,oe);case 2:if(z=B.sent,z!==!1){B.next=5;break}return B.abrupt("return");case 5:ee==null||(te=ee.current)===null||te===void 0||te.addEditRecord(J,{position:ve,newRecordType:ne,parentKey:ae});case 6:case"end":return B.stop()}},be)}));function N(be){return re.apply(this,arguments)}return N}()}))}function ue(e){var G,J,ve=(0,R.YB)(),ne=e.onTableChange,ae=e.maxLength,ee=e.formItemProps,re=e.recordCreatorProps,N=e.rowKey,be=e.controlled,oe=e.defaultValue,he=e.onChange,Y=e.editableFormRef,te=(0,x.Z)(e,fe),z=(0,ce.Z)(e.value),ge=(0,j.useRef)(),B=(0,j.useRef)();(0,j.useImperativeHandle)(te.actionRef,function(){return ge.current});var De=(0,U.Z)(function(){return e.value||oe||[]},{value:e.value,onChange:e.onChange}),n=(0,Ve.Z)(De,2),C=n[0],Se=n[1],Q=j.useMemo(function(){return typeof N=="function"?N:function(f,o){return f[N]||o}},[N]),Ee=function(o){if(typeof o=="number"&&!e.name){if(o>=C.length)return o;var l=C&&C[o];return Q==null?void 0:Q(l,o)}if((typeof o=="string"||o>=C.length)&&e.name){var i=C.findIndex(function(u,v){var m;return(Q==null||(m=Q(u,v))===null||m===void 0?void 0:m.toString())===(o==null?void 0:o.toString())});return i}return o};(0,j.useImperativeHandle)(Y,function(){var f=function(i){var u,v;if(i==null)throw new Error("rowIndex is required");var m=Ee(i),M=[e.name,(u=m==null?void 0:m.toString())!==null&&u!==void 0?u:""].flat(1).filter(Boolean);return(v=B.current)===null||v===void 0?void 0:v.getFieldValue(M)},o=function(){var i,u=[e.name].flat(1).filter(Boolean);if(Array.isArray(u)&&u.length===0){var v,m=(v=B.current)===null||v===void 0?void 0:v.getFieldsValue();return Array.isArray(m)?m:Object.keys(m).map(function(M){return m[M]})}return(i=B.current)===null||i===void 0?void 0:i.getFieldValue(u)};return(0,y.Z)((0,y.Z)({},B.current),{},{getRowData:f,getRowsData:o,setRowData:function(i,u){var v,m,M,h;if(i==null)throw new Error("rowIndex is required");var K=Ee(i),g=[e.name,(v=K==null?void 0:K.toString())!==null&&v!==void 0?v:""].flat(1).filter(Boolean),d=((m=B.current)===null||m===void 0||(M=m.getFieldsValue)===null||M===void 0?void 0:M.call(m))||{},I=(0,Ze.Z)(d,g,(0,y.Z)((0,y.Z)({},f(i)),u||{}));return(h=B.current)===null||h===void 0?void 0:h.setFieldsValue(I)}})}),(0,j.useEffect)(function(){!e.controlled||C.forEach(function(f,o){var l;(l=B.current)===null||l===void 0||l.setFieldsValue((0,s.Z)({},Q(f,o),f))},{})},[C,e.controlled]),(0,j.useEffect)(function(){if(e.name){var f;B.current=e==null||(f=e.editable)===null||f===void 0?void 0:f.form}},[(G=e.editable)===null||G===void 0?void 0:G.form,e.name]);var X=re||{},Oe=X.record,pe=X.position,Fe=X.creatorButtonText,c=X.newRecordType,r=X.parentKey,T=X.style,a=(0,x.Z)(X,Be),$=pe==="top",F=(0,j.useMemo)(function(){return ae&&ae<=(C==null?void 0:C.length)?!1:re!==!1&&(0,w.jsx)(Ce,{record:(0,D.h)(Oe,C==null?void 0:C.length,C)||{},position:pe,parentKey:(0,D.h)(r,C==null?void 0:C.length,C),newRecordType:c,children:(0,w.jsx)(Te.Z,(0,y.Z)((0,y.Z)({type:"dashed",style:(0,y.Z)({display:"block",margin:"10px 0",width:"100%"},T),icon:(0,w.jsx)(Ie.Z,{})},a),{},{children:Fe||ve.getMessage("editableTable.action.add","\u6DFB\u52A0\u4E00\u884C\u6570\u636E")}))})},[re,ae,C==null?void 0:C.length]),_=(0,j.useMemo)(function(){return F?$?{components:{header:{wrapper:function(o){var l,i=o.className,u=o.children;return(0,w.jsxs)("thead",{className:i,children:[u,(0,w.jsxs)("tr",{style:{position:"relative"},children:[(0,w.jsx)("td",{colSpan:0,style:{visibility:"hidden"},children:F}),(0,w.jsx)("td",{style:{position:"absolute",left:0,width:"100%"},colSpan:(l=te.columns)===null||l===void 0?void 0:l.length,children:F})]})]})}}}}:{tableViewRender:function(o,l){var i,u;return(0,w.jsxs)(w.Fragment,{children:[(i=(u=e.tableViewRender)===null||u===void 0?void 0:u.call(e,o,l))!==null&&i!==void 0?i:l,F]})}}:{}},[$,F]),A=(0,y.Z)({},e.editable),k=(0,Re.J)(function(f,o){var l,i,u;if((l=e.editable)===null||l===void 0||(i=l.onValuesChange)===null||i===void 0||i.call(l,f,o),(u=e.onValuesChange)===null||u===void 0||u.call(e,o,f),e.controlled){var v;e==null||(v=e.onChange)===null||v===void 0||v.call(e,o)}});return((e==null?void 0:e.onValuesChange)||((J=e.editable)===null||J===void 0?void 0:J.onValuesChange)||e.controlled&&(e==null?void 0:e.onChange))&&(A.onValuesChange=k),(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(ie.Provider,{value:ge,children:(0,w.jsx)(we.Z,(0,y.Z)((0,y.Z)((0,y.Z)({search:!1,options:!1,pagination:!1,rowKey:N,revalidateOnFocus:!1},te),_),{},{tableLayout:"fixed",actionRef:ge,onChange:ne,editable:(0,y.Z)((0,y.Z)({},A),{},{formProps:(0,y.Z)({formRef:B},A.formProps)}),dataSource:C,onDataSourceChange:function(o){if(Se(o),e.name&&pe==="top"){var l,i=(0,Ze.Z)({},[e.name].flat(1).filter(Boolean),o);(l=B.current)===null||l===void 0||l.setFieldsValue(i)}}}))}),e.name?(0,w.jsx)($e.Z,{name:[e.name],children:function(o){var l,i,u=(0,W.Z)(o,[e.name].flat(1)),v=u==null?void 0:u.find(function(m,M){return!(0,Pe.Z)(m,z==null?void 0:z[M])});return v&&z&&(e==null||(l=e.editable)===null||l===void 0||(i=l.onValuesChange)===null||i===void 0||i.call(l,v,u)),null}}):null]})}function me(e){var G=L.ZP.useFormInstance();return e.name?(0,w.jsx)(se.Z.Item,(0,y.Z)((0,y.Z)({style:{maxWidth:"100%"}},e==null?void 0:e.formItemProps),{},{name:e.name,children:(0,w.jsx)(ue,(0,y.Z)((0,y.Z)({},e),{},{editable:(0,y.Z)((0,y.Z)({},e.editable),{},{form:G})}))})):(0,w.jsx)(ue,(0,y.Z)({},e))}me.RecordCreator=Ce,ye.Z=me},38374:function(Ye,ye,t){"use strict";t.r(ye),t.d(ye,{default:function(){return Fe}});var ke=t(57663),se=t(71577),ze=t(62350),Te=t(24565),s=t(39428),Ve=t(34792),x=t(48086),P=t(3182),Le=t(49111),y=t(19650),w=t(71153),Ie=t(60331),$e=t(9715),L=t(55843),R=t(2824),ce=t(49101),D=t(67294),Re=t(28790),Pe=t(16894),U=t(48971),W=t(96690);function Ze(c){return j.apply(this,arguments)}function j(){return j=(0,P.Z)((0,s.Z)().mark(function c(r){return(0,s.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,U.WY)((0,W.w)()+"/api/bom/BomPage",{method:"POST",data:r}));case 1:case"end":return a.stop()}},c)})),j.apply(this,arguments)}function we(c){return fe.apply(this,arguments)}function fe(){return fe=(0,P.Z)((0,s.Z)().mark(function c(r){return(0,s.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,U.WY)((0,W.w)()+"/api/bom/AddBom",{method:"POST",data:r}));case 1:case"end":return a.stop()}},c)})),fe.apply(this,arguments)}function Be(c){return ie.apply(this,arguments)}function ie(){return ie=(0,P.Z)((0,s.Z)().mark(function c(r){return(0,s.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,U.WY)((0,W.w)()+"/api/bom/addbomtype",{method:"Post",data:r}));case 1:case"end":return a.stop()}},c)})),ie.apply(this,arguments)}function Ce(c){return ue.apply(this,arguments)}function ue(){return ue=(0,P.Z)((0,s.Z)().mark(function c(r){return(0,s.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,U.WY)((0,W.w)()+"/api/batching/getbatchingselectlist",{method:"Get"}));case 1:case"end":return a.stop()}},c)})),ue.apply(this,arguments)}function me(c){return e.apply(this,arguments)}function e(){return e=(0,P.Z)((0,s.Z)().mark(function c(r){return(0,s.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,U.WY)((0,W.w)()+"/api/bom/getbomtypelist",{method:"Get"}));case 1:case"end":return a.stop()}},c)})),e.apply(this,arguments)}function G(c){return J.apply(this,arguments)}function J(){return J=(0,P.Z)((0,s.Z)().mark(function c(r){return(0,s.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,U.WY)((0,W.w)()+"/api/bom/getbyidbomlist?bomId="+r,{method:"Get"}));case 1:case"end":return a.stop()}},c)})),J.apply(this,arguments)}function ve(c){return ne.apply(this,arguments)}function ne(){return ne=(0,P.Z)((0,s.Z)().mark(function c(r){return(0,s.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,U.WY)((0,W.w)()+"/api/bom/update",{method:"Post",data:r}));case 1:case"end":return a.stop()}},c)})),ne.apply(this,arguments)}function ae(c){return ee.apply(this,arguments)}function ee(){return ee=(0,P.Z)((0,s.Z)().mark(function c(r){return(0,s.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,U.WY)((0,W.w)()+"/api/bom/updatebombatcing",{method:"Post",data:r}));case 1:case"end":return a.stop()}},c)})),ee.apply(this,arguments)}function re(c){return N.apply(this,arguments)}function N(){return N=(0,P.Z)((0,s.Z)().mark(function c(r){return(0,s.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,U.WY)((0,W.w)()+"/api/bom/DelBom?id=".concat(r),{method:"post"}));case 1:case"end":return a.stop()}},c)})),N.apply(this,arguments)}var be=t(71194),oe=t(50146),he=t(43358),Y=t(34041),te=t(48736),z=t(27049),ge=t(47673),B=t(4107),De=t(50727),n=t(85893),C=function(r){var T=(0,D.useRef)(null),a=(0,D.useState)(""),$=(0,R.Z)(a,2),F=$[0],_=$[1],A=(0,D.useState)([]),k=(0,R.Z)(A,2),f=k[0],o=k[1],l=(0,D.useState)([]),i=(0,R.Z)(l,2),u=i[0],v=i[1],m=function(d){_(d.target.value)},M=[{title:"\u7269\u6599\u540D\u79F0",dataIndex:"batchingId",formItemProps:function(d,I){var S=I.rowIndex;return{rules:S>1?[{required:!0,message:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879"}]:[]}},valueType:"select",fieldProps:{showSearch:!0,options:r.matedata.map(function(g,d){return{label:g.name,value:g.id}})},width:"25%"},{title:"\u7528\u91CF",dataIndex:"dosage",valueType:"digit",width:"15%"},{title:"\u64CD\u4F5C",valueType:"option",width:"15%",render:function(){return null}}],h=function(d){if(d.preventDefault(),F.length==0)x.default.error("\u8BF7\u8F93\u5165\u540D\u79F0");else{var I={name:F};Be(I).then(function(S){S.succeeded?(x.default.success("\u6DFB\u52A0\u6210\u529F"),r.initTypeList(),_("")):x.default.error(S.errors)})}},K=function(){r.form.validateFields().then(function(d){var I=!0,S=d;debugger;f.length==0?(I=!1,x.default.error("\u8BF7\u9009\u62E9\u7269\u6599")):S.mate=f.map(function(H){return{batchingId:H.batchingId,dosage:H.dosage}}),I&&(r.form.resetFields(),r.onFinish(S),o([]))}).catch(function(d){x.default.error("\u8BF7\u586B\u5199\u5FC5\u586B\u4FE1\u606F")})};return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(oe.Z,{title:"\u65B0\u589E\u914D\u65B9",width:600,maskClosable:!1,onCancel:r.onCancel,open:r.modalVisible,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:K,children:[(0,n.jsxs)(L.Z,{layout:"horizontal",preserve:!1,form:r.form,children:[(0,n.jsx)(L.Z.Item,{name:"bomName",label:"\u914D\u65B9\u540D\u79F0",rules:[{required:!0,message:"\u914D\u65B9\u540D\u79F0"}],children:(0,n.jsx)(B.Z,{placeholder:"\u8BF7\u8F93\u5165\u914D\u65B9\u540D\u79F0"})}),(0,n.jsx)(L.Z.Item,{name:"bomTypeList",rules:[{required:!0,message:"\u914D\u65B9\u5206\u7C7B"}],label:"\u914D\u65B9\u5206\u7C7B",children:(0,n.jsx)(Y.Z,{style:{width:"100%"},mode:"tags",placeholder:"\u8BF7\u9009\u914D\u65B9\u5206\u7C7B",options:r.bomTypeData,dropdownRender:function(d){return(0,n.jsxs)(n.Fragment,{children:[d,(0,n.jsx)(z.Z,{style:{margin:"8px 0"}}),(0,n.jsxs)(y.Z,{style:{padding:"0 8px 4px"},children:[(0,n.jsx)(B.Z,{placeholder:"\u8BF7\u8F93\u5165\u914D\u65B9\u5206\u7C7B",ref:T,value:F,onChange:m,onKeyDown:function(S){return S.stopPropagation()}}),(0,n.jsx)(se.Z,{type:"text",icon:(0,n.jsx)(ce.Z,{}),onClick:h,children:"\u65B0\u589E"})]})]})}})})]}),(0,n.jsx)(De.Z,{headerTitle:(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{style:{color:"red",marginRight:3},children:"*"}),"\u914D\u65B9\u8BE6\u60C5"]}),columns:M,rowKey:"id",value:f,onChange:o,recordCreatorProps:{newRecordType:"dataSource",record:function(){return{id:Date.now()}}},editable:{type:"multiple",editableKeys:u,actionRender:function(d,I,S){return[S.delete,S.Button]},onValuesChange:function(d,I){o(I)},onDelete:function(){var g=(0,P.Z)((0,s.Z)().mark(function I(S,H){return(0,s.Z)().wrap(function(le){for(;;)switch(le.prev=le.next){case 0:console.log(S),console.log(H);case 2:case"end":return le.stop()}},I)}));function d(I,S){return g.apply(this,arguments)}return d}(),onChange:v}})]})})},Se=C,Q=function(r){var T=Y.Z.Option,a=Y.Z.OptGroup,$=(0,D.useState)(""),F=(0,R.Z)($,2),_=F[0],A=F[1],k=(0,D.useRef)(null),f=function(u){A(u.target.value)},o=function(u){if(u.preventDefault(),_.length==0)x.default.error("\u8BF7\u8F93\u5165\u540D\u79F0");else{var v={name:_};Be(v).then(function(m){m.succeeded?(x.default.success("\u6DFB\u52A0\u6210\u529F"),r.initTypeList(),A("")):x.default.error(m.errors)})}},l=function(){r.onUpdateBomSave()};return(0,n.jsx)(oe.Z,{title:"\u7F16\u8F91\u914D\u65B9",width:640,maskClosable:!1,visible:r.updateModalVisible,bodyStyle:{padding:"32px 40px 48px"},onCancel:function(){r.onCancel()},onOk:l,destroyOnClose:!0,children:(0,n.jsxs)(L.Z,{layout:"vertical",preserve:!1,form:r.form,onFinish:r.onFinish,children:[(0,n.jsx)(L.Z.Item,{name:"id",hidden:!0,children:(0,n.jsx)(B.Z,{})}),(0,n.jsx)(L.Z.Item,{name:"name",label:"\u914D\u65B9\u540D\u79F0",children:(0,n.jsx)(B.Z,{placeholder:"\u914D\u65B9\u540D\u79F0"})}),(0,n.jsx)(L.Z.Item,{name:"bomTypeList",label:"\u914D\u65B9\u5206\u7C7B",children:(0,n.jsx)(Y.Z,{style:{width:"100%"},mode:"tags",placeholder:"\u8BF7\u9009\u914D\u65B9\u5206\u7C7B",options:r.bomTypeData,dropdownRender:function(u){return(0,n.jsxs)(n.Fragment,{children:[u,(0,n.jsx)(z.Z,{style:{margin:"8px 0"}}),(0,n.jsxs)(y.Z,{style:{padding:"0 8px 4px"},children:[(0,n.jsx)(B.Z,{placeholder:"\u8BF7\u8F93\u5165\u914D\u65B9\u5206\u7C7B",ref:k,value:_,onChange:f,onKeyDown:function(m){return m.stopPropagation()}}),(0,n.jsx)(se.Z,{type:"text",icon:(0,n.jsx)(ce.Z,{}),onClick:o,children:"\u65B0\u589E"})]})]})}})})]})})},Ee=Q,X=function(r){var T=Y.Z.Option,a=Y.Z.OptGroup,$=(0,D.useState)([]),F=(0,R.Z)($,2),_=F[0],A=F[1],k=(0,D.useState)([]),f=(0,R.Z)(k,2),o=f[0],l=f[1],i=L.Z.useForm(),u=(0,R.Z)(i,1),v=u[0];(0,D.useEffect)(function(){var h=[];r.BomId&&G(r.BomId).then(function(K){var g=K.data;g.bomEntry.length>0&&g.bomEntry.map(function(d){var I={id:d.id,bomId:d.bomId,batchingId:d.batchingId,dosage:d.bomQty};console.log("item",I),h.push(I)}),console.log("soredata",h),h.length>0&&(l(h.map(function(d){return d.id})),A(h))})},[r]);var m=[{title:"\u4E3B\u952E",dataIndex:"id",key:"id",hideInTable:!0,hideInSearch:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key"},{title:"\u914D\u65B9",dataIndex:"bomId",hideInTable:!0,hideInSearch:!0},{title:"\u7269\u6599\u540D\u79F0",dataIndex:"batchingId",formItemProps:function(K,g){var d=g.rowIndex;return{rules:d>1?[{required:!0,message:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879"}]:[]}},valueType:"select",fieldProps:{showSearch:!0,options:r.matedata.map(function(h,K){return{label:h.name,value:h.id}})},width:"25%"},{title:"\u7528\u91CF",dataIndex:"dosage",valueType:"digit",width:"15%"},{title:"\u64CD\u4F5C",valueType:"option",width:"15%",render:function(){return null}}],M=function(){_.length==0?(check=!1,x.default.error("\u8BF7\u9009\u62E9\u7269\u6599")):r.onBomBatchingFinish(_)};return(0,n.jsx)(oe.Z,{title:"\u914D\u65B9\u8BE6\u60C5",width:1040,maskClosable:!1,visible:r.BomBatchingVisible,bodyStyle:{padding:"32px 40px 1px 48px"},okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:M,onCancel:function(){r.onBomBatchingCancel()},destroyOnClose:!0,children:(0,n.jsx)(De.Z,{columns:m,rowKey:"id",value:_,onChange:A,recordCreatorProps:{newRecordType:"dataSource",record:function(){return{id:Date.now(),bomId:r.BomId}}},editable:{type:"multiple",editableKeys:o,actionRender:function(K,g,d){return[d.delete,d.Button]},onValuesChange:function(K,g){A(g)},onDelete:function(){var h=(0,P.Z)((0,s.Z)().mark(function g(d,I){return(0,s.Z)().wrap(function(H){for(;;)switch(H.prev=H.next){case 0:console.log(d),console.log(I);case 2:case"end":return H.stop()}},g)}));function K(g,d){return h.apply(this,arguments)}return K}(),onChange:l}})})},Oe=X,pe=function(r){var T=(0,D.useRef)(),a=(0,D.useState)(!1),$=(0,R.Z)(a,2),F=$[0],_=$[1],A=(0,D.useState)(!1),k=(0,R.Z)(A,2),f=k[0],o=k[1],l=(0,D.useState)([]),i=(0,R.Z)(l,2),u=i[0],v=i[1],m=(0,D.useState)([]),M=(0,R.Z)(m,2),h=M[0],K=M[1],g=(0,D.useState)([]),d=(0,R.Z)(g,2),I=d[0],S=d[1],H=(0,D.useState)(),je=(0,R.Z)(H,2),le=je[0],xe=je[1],He=L.Z.useForm(),Je=(0,R.Z)(He,1),Ue=Je[0],Qe=L.Z.useForm(),Xe=(0,R.Z)(Qe,1),_e=Xe[0],qe=(0,D.useState)(),We=(0,R.Z)(qe,2),et=We[0],Me=We[1],tt=(0,D.useState)(!1),Ge=(0,R.Z)(tt,2),nt=Ge[0],Ke=Ge[1];(0,D.useEffect)(function(){Ae(),at()},[]);function at(){Ce().then(function(b){v(b.data)})}function Ne(){Ae()}function Ae(){me().then(function(b){var p=[];b.data.length>0&&b.data.forEach(function(Z){p.push({text:Z.name,value:Z.id,label:Z.name})}),K(p)})}function Ae(){me().then(function(b){var p=[];b.data.length>0&&b.data.forEach(function(Z){p.push({text:Z.name,value:Z.id,label:Z.name})}),K(p)})}var rt=[{title:"\u4E3B\u952E",dataIndex:"id",hideInTable:!0,hideInSearch:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",render:function(p,Z){return(0,n.jsx)("a",{onClick:function(){Me(Z),setShowDetail(!0)},children:p})}},{title:"\u914D\u65B9\u540D\u79F0",dataIndex:"name",width:300,hideInForm:!0,hideInSearch:!1},{title:"\u914D\u65B9\u5206\u7C7B",dataIndex:"bomTypeList",search:!1,render:function(p,Z){return(0,n.jsx)(y.Z,{children:h.filter(function(E){var O=Z.bomTypeList.find(function(V){return V===E.value}),q=h.find(function(V){return V.value===O});return q!=null||void 0}).map(function(E){return(0,n.jsx)(Ie.Z,{color:"#87d068",children:E.text},E.value)})})}},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",width:250,render:function(p,Z){return[(0,n.jsx)("a",{type:"primary",onClick:function(){Me(Z),_e.setFieldsValue(Z),o(!0)},children:"\u66F4\u65B0"},"primary3"),(0,n.jsx)("a",{type:"primary",onClick:function(){Ke(!0),xe(Z.id)},children:"\u914D\u65B9\u8BE6\u60C5"},"primary1"),(0,n.jsx)(Te.Z,{type:"primary",title:"\u5220\u9664\u540E\u53EF\u80FD\u5F71\u54CD\u5546\u54C1\u914D\u65B9,\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:(0,P.Z)((0,s.Z)().mark(function E(){var O;return(0,s.Z)().wrap(function(V){for(;;)switch(V.prev=V.next){case 0:return O=x.default.loading("\u6B63\u5728\u5220\u9664"),V.prev=1,re(Z.id),O(),x.default.success("\u5220\u9664\u6210\u529F\uFF0C\u5373\u5C06\u5237\u65B0"),T.current.reloadAndRest(),V.abrupt("return",!0);case 9:return V.prev=9,V.t0=V.catch(1),O(),x.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),T.current.reloadAndRest(),V.abrupt("return",!1);case 15:case"end":return V.stop()}},E,null,[[1,9]])})),onCancel:function(){},children:(0,n.jsx)("a",{href:"#",children:"\u5220\u9664"})},"primary")]}}],ot=function(){_e.validateFields().then(function(p){var Z={id:p.id,name:p.name,IsMain:p.bomType=="1",bomTypeIds:p.bomTypeList};ve(Z).then(function(E){E.data?(x.default.success("\u4FEE\u6539\u6210\u529F"),o(!1),T.current.reload(),xe("")):x.default.error(E.errors||"\u4FEE\u6539\u5931\u8D25")})})},it=function(){Ke(!1),xe("")},ut=function(p){console.log("form",p);var Z={bomId:le,bomEntry:p};ae(Z).then(function(E){E.succeeded?(x.default.success("\u4FEE\u6539\u6210\u529F"),Ke(!1),T.current.reload(),xe("")):x.default.error(E.errors)})};return(0,n.jsxs)(Re.ZP,{header:{title:"",breadcrumb:{}},children:[(0,n.jsx)(Pe.ZP,{columns:rt,actionRef:T,rowKey:"id",pagination:{defaultPageSize:10},toolBarRender:function(){return[(0,n.jsxs)(se.Z,{type:"primary",onClick:function(){_(!0)},children:[(0,n.jsx)(ce.Z,{})," \u65B0\u5EFA"]},"primary")]},request:function(){var b=(0,P.Z)((0,s.Z)().mark(function p(Z){var E,O,q;return(0,s.Z)().wrap(function(de){for(;;)switch(de.prev=de.next){case 0:return E=0,O=[],de.next=4,Ze(Z);case 4:return q=de.sent,q.statusCode==200&&(O=q.data.data,E=q.data.total),de.abrupt("return",{data:O,success:!0,total:E});case 7:case"end":return de.stop()}},p)}));return function(p){return b.apply(this,arguments)}}(),rowSelection:{onChange:function(p,Z){return S(Z)}}}),(0,n.jsx)(Se,{modalVisible:F,matedata:u,form:Ue,bomTypeData:h,initTypeList:Ne,onFinish:function(){var b=(0,P.Z)((0,s.Z)().mark(function p(Z){return(0,s.Z)().wrap(function(O){for(;;)switch(O.prev=O.next){case 0:return O.next=2,we(Z).then(function(q){q.data?(x.default.success("\u6DFB\u52A0\u6210\u529F"),_(!1)):x.default.error("\u6DFB\u52A0\u5931\u8D25"),T.current.reloadAndRest()});case 2:case"end":return O.stop()}},p)}));return function(p){return b.apply(this,arguments)}}(),onCancel:function(){_(!1),Ue.resetFields()}}),(0,n.jsx)(Ee,{updateModalVisible:f,onUpdateBomSave:ot,values:et||{},form:_e,initTypeList:Ne,bomTypeData:h,onFinish:function(){var b=(0,P.Z)((0,s.Z)().mark(function p(Z){return(0,s.Z)().wrap(function(O){for(;;)switch(O.prev=O.next){case 0:case"end":return O.stop()}},p)}));return function(p){return b.apply(this,arguments)}}(),onCancel:function(){o(!1),Me(void 0)}}),(0,n.jsx)(Oe,{BomBatchingVisible:nt,matedata:u,onBomBatchingCancel:it,BomId:le,onBomBatchingFinish:ut})]})},Fe=pe}}]);
|