|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[54],{50727:function(ta,Oe,a){"use strict";var aa=a(9715),Me=a(55843),na=a(57663),Je=a(71577),h=a(96156),Ot=a(28481),T=a(81253),D=a(55507),Mt=a(92137),v=a(28991),n=a(85893),jt=a(49101),fe=a(97462),At=a(952),N=a(78775),Ft=a(26369),je=a(22270),Qe=a(48171),Ae=a(60249),Xe=a(21770),o=a(88306),Fe=a(8880),I=a(67294),qe=a(77153),Vt=["onTableChange","maxLength","formItemProps","recordCreatorProps","rowKey","controlled","defaultValue","onChange","editableFormRef"],et=["record","position","creatorButtonText","newRecordType","parentKey","style"],tt=I.createContext(void 0);function Ve(t){var j=t.children,Q=t.record,B=t.position,_=t.newRecordType,X=t.parentKey,z=(0,I.useContext)(tt);return I.cloneElement(j,(0,v.Z)((0,v.Z)({},j.props),{},{onClick:function(){var q=(0,Mt.Z)((0,D.Z)().mark(function he(ee){var oe,H,G,F;return(0,D.Z)().wrap(function(C){for(;;)switch(C.prev=C.next){case 0:return C.next=2,(oe=(H=j.props).onClick)===null||oe===void 0?void 0:oe.call(H,ee);case 2:if(F=C.sent,F!==!1){C.next=5;break}return C.abrupt("return");case 5:z==null||(G=z.current)===null||G===void 0||G.addEditRecord(Q,{position:B,newRecordType:_,parentKey:X});case 6:case"end":return C.stop()}},he)}));function A(he){return q.apply(this,arguments)}return A}()}))}function at(t){var j,Q,B=(0,N.YB)(),_=t.onTableChange,X=t.maxLength,z=t.formItemProps,q=t.recordCreatorProps,A=t.rowKey,he=t.controlled,ee=t.defaultValue,oe=t.onChange,H=t.editableFormRef,G=(0,T.Z)(t,Vt),F=(0,Ft.Z)(t.value),le=(0,I.useRef)(),C=(0,I.useRef)();(0,I.useImperativeHandle)(G.actionRef,function(){return le.current});var nt=(0,Xe.Z)(function(){return t.value||ee||[]},{value:t.value,onChange:t.onChange}),se=(0,Ot.Z)(nt,2),b=se[0],ge=se[1],W=I.useMemo(function(){return typeof A=="function"?A:function(l,e){return l[A]||e}},[A]),ie=function(e){if(typeof e=="number"&&!t.name){if(e>=b.length)return e;var s=b&&b[e];return W==null?void 0:W(s,e)}if((typeof e=="string"||e>=b.length)&&t.name){var c=b.findIndex(function(f,Z){var S;return(W==null||(S=W(f,Z))===null||S===void 0?void 0:S.toString())===(e==null?void 0:e.toString())});return c}return e};(0,I.useImperativeHandle)(H,function(){var l=function(c){var f,Z;if(c==null)throw new Error("rowIndex is required");var S=ie(c),R=[t.name,(f=S==null?void 0:S.toString())!==null&&f!==void 0?f:""].flat(1).filter(Boolean);return(Z=C.current)===null||Z===void 0?void 0:Z.getFieldValue(R)},e=function(){var c,f=[t.name].flat(1).filter(Boolean);if(Array.isArray(f)&&f.length===0){var Z,S=(Z=C.current)===null||Z===void 0?void 0:Z.getFieldsValue();return Array.isArray(S)?S:Object.keys(S).map(function(R){return S[R]})}return(c=C.current)===null||c===void 0?void 0:c.getFieldValue(f)};return(0,v.Z)((0,v.Z)({},C.current),{},{getRowData:l,getRowsData:e,setRowData:function(c,f){var Z,S,R,ae;if(c==null)throw new Error("rowIndex is required");var k=ie(c),$=[t.name,(Z=k==null?void 0:k.toString())!==null&&Z!==void 0?Z:""].flat(1).filter(Boolean),de=((S=C.current)===null||S===void 0||(R=S.getFieldsValue)===null||R===void 0?void 0:R.call(S))||{},Ze=(0,Fe.Z)(de,$,(0,v.Z)((0,v.Z)({},l(c)),f||{}));return(ae=C.current)===null||ae===void 0?void 0:ae.setFieldsValue(Ze)}})}),(0,I.useEffect)(function(){!t.controlled||b.forEach(function(l,e){var s;(s=C.current)===null||s===void 0||s.setFieldsValue((0,h.Z)({},W(l,e),l))},{})},[b,t.controlled]),(0,I.useEffect)(function(){if(t.name){var l;C.current=t==null||(l=t.editable)===null||l===void 0?void 0:l.form}},[(j=t.editable)===null||j===void 0?void 0:j.form,t.name]);var U=q||{},r=U.record,ye=U.position,rt=U.creatorButtonText,wt=U.newRecordType,$t=U.parentKey,Kt=U.style,Lt=(0,T.Z)(U,et),ut=ye==="top",te=(0,I.useMemo)(function(){return X&&X<=(b==null?void 0:b.length)?!1:q!==!1&&(0,n.jsx)(Ve,{record:(0,je.h)(r,b==null?void 0:b.length,b)||{},position:ye,parentKey:(0,je.h)($t,b==null?void 0:b.length,b),newRecordType:wt,children:(0,n.jsx)(Je.Z,(0,v.Z)((0,v.Z)({type:"dashed",style:(0,v.Z)({display:"block",margin:"10px 0",width:"100%"},Kt),icon:(0,n.jsx)(jt.Z,{})},Lt),{},{children:rt||B.getMessage("editableTable.action.add","\u6DFB\u52A0\u4E00\u884C\u6570\u636E")}))})},[q,X,b==null?void 0:b.length]),ot=(0,I.useMemo)(function(){return te?ut?{components:{header:{wrapper:function(e){var s,c=e.className,f=e.children;return(0,n.jsxs)("thead",{className:c,children:[f,(0,n.jsxs)("tr",{style:{position:"relative"},children:[(0,n.jsx)("td",{colSpan:0,style:{visibility:"hidden"},children:te}),(0,n.jsx)("td",{style:{position:"absolute",left:0,width:"100%"},colSpan:(s=G.columns)===null||s===void 0?void 0:s.length,children:te})]})]})}}}}:{tableViewRender:function(e,s){var c,f;return(0,n.jsxs)(n.Fragment,{children:[(c=(f=t.tableViewRender)===null||f===void 0?void 0:f.call(t,e,s))!==null&&c!==void 0?c:s,te]})}}:{}},[ut,te]),m=(0,v.Z)({},t.editable),u=(0,Qe.J)(function(l,e){var s,c,f;if((s=t.editable)===null||s===void 0||(c=s.onValuesChange)===null||c===void 0||c.call(s,l,e),(f=t.onValuesChange)===null||f===void 0||f.call(t,e,l),t.controlled){var Z;t==null||(Z=t.onChange)===null||Z===void 0||Z.call(t,e)}});return((t==null?void 0:t.onValuesChange)||((Q=t.editable)===null||Q===void 0?void 0:Q.onValuesChange)||t.controlled&&(t==null?void 0:t.onChange))&&(m.onValuesChange=u),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(tt.Provider,{value:le,children:(0,n.jsx)(qe.Z,(0,v.Z)((0,v.Z)((0,v.Z)({search:!1,options:!1,pagination:!1,rowKey:A,revalidateOnFocus:!1},G),ot),{},{tableLayout:"fixed",actionRef:le,onChange:_,editable:(0,v.Z)((0,v.Z)({},m),{},{formProps:(0,v.Z)({formRef:C},m.formProps)}),dataSource:b,onDataSourceChange:function(e){if(ge(e),t.name&&ye==="top"){var s,c=(0,Fe.Z)({},[t.name].flat(1).filter(Boolean),e);(s=C.current)===null||s===void 0||s.setFieldsValue(c)}}}))}),t.name?(0,n.jsx)(fe.Z,{name:[t.name],children:function(e){var s,c,f=(0,o.Z)(e,[t.name].flat(1)),Z=f==null?void 0:f.find(function(S,R){return!(0,Ae.Z)(S,F==null?void 0:F[R])});return Z&&F&&(t==null||(s=t.editable)===null||s===void 0||(c=s.onValuesChange)===null||c===void 0||c.call(s,Z,f)),null}}):null]})}function Y(t){var j=At.ZP.useFormInstance();return t.name?(0,n.jsx)(Me.Z.Item,(0,v.Z)((0,v.Z)({style:{maxWidth:"100%"}},t==null?void 0:t.formItemProps),{},{name:t.name,children:(0,n.jsx)(at,(0,v.Z)((0,v.Z)({},t),{},{editable:(0,v.Z)((0,v.Z)({},t.editable),{},{form:j})}))})):(0,n.jsx)(at,(0,v.Z)({},t))}Y.RecordCreator=Ve,Oe.Z=Y},29724:function(ta,Oe,a){"use strict";a.r(Oe),a.d(Oe,{default:function(){return ot}});var aa=a(57663),Me=a(71577),na=a(62350),Je=a(24565),h=a(39428),Ot=a(34792),T=a(48086),D=a(3182),Mt=a(9715),v=a(55843),n=a(2824),jt=a(47673),fe=a(4107),At=a(43358),N=a(34041),Ft=a(35556),je=a(75899),Qe=a(6700),Ae=a(49101),Xe=a(28790),o=a(67294),Fe=a(16894),I=a(71194),qe=a(50146),Vt=a(49111),et=a(19650),tt=a(48736),Ve=a(27049),at=a(88983),Y=a(47933),t=a(71153),j=a(60331),Q=a(86582),B=a(48971),_=a(96690);function X(m){return z.apply(this,arguments)}function z(){return z=(0,D.Z)((0,h.Z)().mark(function m(u){return(0,h.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,B.WY)((0,_.w)()+"/api/bom/getbomtypelist",{method:"Get"}));case 1:case"end":return e.stop()}},m)})),z.apply(this,arguments)}function q(m){return A.apply(this,arguments)}function A(){return A=(0,D.Z)((0,h.Z)().mark(function m(u){return(0,h.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,B.WY)((0,_.w)()+"/api/batching/getbatchingselectlist",{method:"Get"}));case 1:case"end":return e.stop()}},m)})),A.apply(this,arguments)}function he(m){return ee.apply(this,arguments)}function ee(){return ee=(0,D.Z)((0,h.Z)().mark(function m(u){return(0,h.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,B.WY)((0,_.w)()+"/api/goods/addgoodsbomattribute",{method:"Post",data:u}));case 1:case"end":return e.stop()}},m)})),ee.apply(this,arguments)}function oe(m){return H.apply(this,arguments)}function H(){return H=(0,D.Z)((0,h.Z)().mark(function m(u){return(0,h.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,B.WY)((0,_.w)()+"/api/goodsattribute/getbygoodsidattribute?id="+u,{method:"Get"}));case 1:case"end":return e.stop()}},m)})),H.apply(this,arguments)}function G(m){return F.apply(this,arguments)}function F(){return F=(0,D.Z)((0,h.Z)().mark(function m(u){return(0,h.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,B.WY)((0,_.w)()+"/api/goods/getgoodsbompage",{method:"Post",data:u}));case 1:case"end":return e.stop()}},m)})),F.apply(this,arguments)}function le(m){return C.apply(this,arguments)}function C(){return C=(0,D.Z)((0,h.Z)().mark(function m(u){return(0,h.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,B.WY)((0,_.w)()+"/api/goods/delgoodsbom?Ids=".concat(u),{method:"GET"}));case 1:case"end":return e.stop()}},m)})),C.apply(this,arguments)}function nt(m){return se.apply(this,arguments)}function se(){return se=(0,D.Z)((0,h.Z)().mark(function m(u){return(0,h.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,B.WY)((0,_.w)()+"/api/bom/addbomtype",{method:"Post",data:u}));case 1:case"end":return e.stop()}},m)})),se.apply(this,arguments)}function b(){return ge.apply(this,arguments)}function ge(){return ge=(0,D.Z)((0,h.Z)().mark(function m(){return(0,h.Z)().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.abrupt("return",(0,B.WY)((0,_.w)()+"/api/bom/getbomlist",{method:"Get"}));case 1:case"end":return l.stop()}},m)})),ge.apply(this,arguments)}function W(m){return ie.apply(this,arguments)}function ie(){return ie=(0,D.Z)((0,h.Z)().mark(function m(u){return(0,h.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,B.WY)((0,_.w)()+"/api/bom/getbyidbomlist?bomId="+u,{method:"Get"}));case 1:case"end":return e.stop()}},m)})),ie.apply(this,arguments)}var U=a(50727),r=a(85893),ye=function(u){var l,e=N.Z.Option,s=N.Z.OptGroup,c=(0,o.useState)([]),f=(0,n.Z)(c,2),Z=f[0],S=f[1],R=(0,o.useState)([]),ae=(0,n.Z)(R,2),k=ae[0],$=ae[1],de=(0,o.useState)([]),Ze=(0,n.Z)(de,2),Gt=Ze[0],we=Ze[1],$e=v.Z.useForm(),Wt=(0,n.Z)($e,1),ne=Wt[0],lt=(0,o.useState)(""),be=(0,n.Z)(lt,2),Ke=be[0],st=be[1],it=(0,o.useRef)(null),Le=(0,o.useState)("block"),dt=(0,n.Z)(Le,2),ct=dt[0],pe=dt[1],Ge=(0,o.useState)("none"),We=(0,n.Z)(Ge,2),re=We[0],Se=We[1],Ue=(0,o.useState)(1),vt=(0,n.Z)(Ue,2),mt=vt[0],ce=vt[1],ft=(0,o.useState)(""),Ce=(0,n.Z)(ft,2),Ut=Ce[0],ht=Ce[1],gt=(0,o.useState)(""),Ee=(0,n.Z)(gt,2),Nt=Ee[0],Yt=Ee[1],yt=(0,o.useState)(!1),De=(0,n.Z)(yt,2),ra=De[0],zt=De[1],Zt=(0,o.useState)([]),Be=(0,n.Z)(Zt,2),bt=Be[0],Te=Be[1],pt=(0,o.useState)([]),Re=(0,n.Z)(pt,2),St=Re[0],Ne=Re[1],Ct=(0,o.useState)([]),Pe=(0,n.Z)(Ct,2),Et=Pe[0],xe=Pe[1],Dt=(0,o.useState)(!1),Ie=(0,n.Z)(Dt,2),Ht=Ie[0],Bt=Ie[1],Tt=function(i){st(i.target.value)},Ye=function(i){if(i.preventDefault(),Ke.length==0)T.default.error("\u8BF7\u8F93\u5165\u540D\u79F0");else{var g={name:Ke};nt(g).then(function(d){d.succeeded?(T.default.success("\u6DFB\u52A0\u6210\u529F"),u.initTypeList(),st("")):T.default.error(d.errors)})}};(0,o.useEffect)(function(){var y=ne.getFieldValue("type");if(y!=0&&(pe("block"),Se("none"),xe([{required:!0,message:"\u8BF7\u9009\u62E9\u914D\u65B9"}]),Te([{required:!1}]),Ne([{required:!1}])),u.defaultmatedata){var i=[];u.defaultmatedata.forEach(function(g,d){var P={id:d,batchingId:g,dosage:0};i.push(P)}),we(i.map(function(g){return g.id})),$(i)}},[u]);var kt=[{title:"\u7269\u6599\u540D\u79F0",dataIndex:"batchingId",formItemProps:function(i,g){var d=g.rowIndex;return{rules:d>1?[{required:!0,message:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879"}]:[]}},valueType:"select",fieldProps:{showSearch:!0,options:u.matedata.map(function(y,i){return{label:y.name,value:y.id}})},width:"25%"},{title:"\u7528\u91CF",dataIndex:"dosage",valueType:"digit",width:"15%"},{title:"\u64CD\u4F5C",valueType:"option",width:"15%",render:function(){return null}}],Jt=function(){ne.validateFields().then(function(i){var g=!0,d=i;console.log("values",i),Z.length==0?(g=!1,T.default.error("\u8BF7\u9009\u62E9\u5546\u54C1\u5C5E\u6027")):d.shuxing=Z,re=="block"&&(k.length==0?(g=!1,T.default.error("\u8BF7\u9009\u62E9\u7269\u6599")):d.mate=k.map(function(P){return{batchingId:P.batchingId,dosage:P.dosage}})),g&&(ne.resetFields(),ct=="block"?d.Type="check":d.Type="add",d.goodsAttributeValue=Ut,d.bomType=1,d.bomName=i.bomName+"("+Nt+")",u.onFinish(d),$([]),ht(""))}).catch(function(i){T.default.error("\u8BF7\u586B\u5199\u5FC5\u586B\u4FE1\u606F")})},Rt=function(i){for(var g=i.target,d=g.name,P=g.value,V="",x="",K=(0,Q.Z)(Z),ue=0;ue<u.goodsAttriburteData.length;ue++)d==="radiogroup"+ue&&(K[ue]=P);u.goodsAttriburteData.forEach(function(xt){for(var It=function(He){var me;_e=(me=xt.goodsAttributeValueList.find(function(Qt){return Qt.goodsAttributeValuId==K[He]}))===null||me===void 0?void 0:me.attributeValue,_e&&(V=V+_e,x=x+_e,He<K.length-1&&(V=V+"-",x=x+"-"))},ve=0;ve<K.length;ve++){var _e;It(ve)}}),Yt(V),ht(x),S(K)},ze=function(i){console.log("selected ".concat(i)),ne.setFieldsValue({bomId:i}),W(i).then(function(g){var d,P,V=[];(d=g.data)===null||d===void 0||(P=d.bomEntry)===null||P===void 0||P.forEach(function(x,K){var ue={id:K,batchingId:x.batchingId,dosage:x.bomQty};V.push(ue)}),$(V)})},Pt=function(i){console.log(ne),ce(i.target.value),$([]),zt(!1),i.target.value==1?(Bt(!1),pe("block"),Se("none"),xe([{required:!0,message:"\u8BF7\u9009\u62E9\u914D\u65B9"}]),Te([{required:!1}]),Ne([{required:!1}])):(xe([{required:!1}]),Te([{required:!0,message:"\u8BF7\u8F93\u5165\u914D\u65B9\u540D\u79F0!"}]),Ne([{required:!0,message:"\u914D\u65B9\u5206\u7C7B"}]),Bt({newRecordType:"dataSource",record:function(){return{id:Date.now()}}}),pe("none"),Se("block"))};return(0,r.jsxs)(qe.Z,{title:"\u5173\u8054\u914D\u65B9",width:1040,visible:u.handleCreateoodsBomModalVisible,bodyStyle:{padding:"32px 40px 1px 48px"},okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:Jt,onCancel:function(){u.onCancel()},maskClosable:!1,destroyOnClose:!0,children:[(0,r.jsxs)("span",{children:[(0,r.jsx)("span",{style:{color:"red",marginRight:3},children:"*"}),"\u5546\u54C1\u5C5E\u6027"]}),u.goodsAttriburteData==null||u.goodsAttriburteData.length==0?(0,r.jsxs)("div",{style:{fontSize:"12px",marginLeft:10},children:["\u5F53\u524D\u5546\u54C1\u7684\u5DE5\u827A\u5206\u7C7B\u8FD8\u672A\u914D\u7F6E\u5C5E\u6027\u70B9\u51FB\u8DF3\u8F6C ",(0,r.jsx)("a",{type:"primary",onClick:function(){B.m8.push({pathname:"/database/goods/goodstypemanage"})},children:"\u6DFB\u52A0\u5C5E\u6027"},"primary")]}):u.goodsAttriburteData.map(function(y,i){return(0,r.jsx)("div",{style:{marginLeft:80,marginBottom:10},children:(0,r.jsxs)("div",{children:[(0,r.jsxs)("span",{style:{marginRight:10},children:[" ",(0,r.jsx)(j.Z,{color:"blue",children:y.attributeName}),"\uFF1A"]}),(0,r.jsx)("span",{children:(0,r.jsx)(Y.ZP.Group,{name:"radiogroup"+i,buttonStyle:"solid",size:"small",onChange:Rt,children:y.goodsAttributeValueList.map(function(g,d){return(0,r.jsx)(Y.ZP.Button,{name:d,value:g.goodsAttributeValuId,style:{marginRight:22,marginTop:16},children:g.attributeValue})})})})]})})}),(0,r.jsxs)(v.Z,{layout:"horizontal",preserve:!1,form:ne,children:[(0,r.jsx)(v.Z.Item,{name:"type",label:"\u529F\u80FD\u7C7B\u578B",children:(0,r.jsxs)(Y.ZP.Group,{name:"type",defaultValue:1,value:mt,onChange:Pt,children:[(0,r.jsx)(Y.ZP.Button,{value:1,children:"\u9009\u62E9\u914D\u65B9"}),(0,r.jsx)(Y.ZP.Button,{value:0,children:"\u65B0\u5EFA\u914D\u65B9"})]})}),(0,r.jsx)(v.Z.Item,{shouldUpdate:!0,style:{display:ct},name:"bomId",label:"\u9009\u62E9\u914D\u65B9",rules:Et,children:(0,r.jsx)(N.Z,{allowClear:!0,showSearch:!0,optionFilterProp:"children",onChange:ze,placeholder:"\u8BF7\u9009\u914D\u65B9\u4FE1\u606F",children:(l=u.Bomdata)===null||l===void 0?void 0:l.map(function(y,i){return(0,r.jsx)(e,{index:i,value:y.id,children:y.name},y.id)})})}),(0,r.jsx)(v.Z.Item,{style:{display:re},label:"\u914D\u65B9\u540D\u79F0",name:"bomName",rules:bt,children:(0,r.jsx)(fe.Z,{placeholder:"\u8BF7\u8F93\u5165\u914D\u65B9\u540D\u79F0"})}),(0,r.jsx)(v.Z.Item,{style:{display:re},name:"bomTypeList",rules:St,label:"\u914D\u65B9\u5206\u7C7B",children:(0,r.jsx)(N.Z,{style:{width:"100%"},mode:"tags",placeholder:"\u8BF7\u9009\u914D\u65B9\u5206\u7C7B",options:u.bomTypeData,dropdownRender:function(i){return(0,r.jsxs)(r.Fragment,{children:[i,(0,r.jsx)(Ve.Z,{style:{margin:"8px 0"}}),(0,r.jsxs)(et.Z,{style:{padding:"0 8px 4px"},children:[(0,r.jsx)(fe.Z,{placeholder:"\u8BF7\u8F93\u5165\u914D\u65B9\u5206\u7C7B",ref:it,value:Ke,onChange:Tt,onKeyDown:function(d){return d.stopPropagation()}}),(0,r.jsx)(Me.Z,{type:"text",icon:(0,r.jsx)(Ae.Z,{}),onClick:Ye,children:"\u65B0\u589E"})]})]})}})})]}),(0,r.jsx)(U.Z,{headerTitle:(0,r.jsxs)("span",{children:[(0,r.jsx)("span",{style:{color:"red",marginRight:3},children:"*"}),"\u914D\u65B9\u8BE6\u60C5"]}),columns:kt,rowKey:"id",value:k,onChange:$,recordCreatorProps:Ht,editable:{type:"multiple",editableKeys:Gt,actionRender:function(i,g,d){return[d.delete,d.Button]},onValuesChange:function(i,g){$(g)},onDelete:function(){var y=(0,D.Z)((0,h.Z)().mark(function g(d,P){return(0,h.Z)().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:console.log(d),console.log(P);case 2:case"end":return x.stop()}},g)}));function i(g,d){return y.apply(this,arguments)}return i}(),onChange:we}})]})},rt=ye,wt=a(9669),$t=je.Z.Step,Kt=N.Z.Option,Lt=N.Z.OptGroup,ut=fe.Z.TextArea,te=function(u){var l,e,s,c=v.Z.useForm(),f=(0,n.Z)(c,1),Z=f[0],S=(0,o.useState)([]),R=(0,n.Z)(S,2),ae=R[0],k=R[1],$=(0,o.useState)([]),de=(0,n.Z)($,2),Ze=de[0],Gt=de[1],we=(0,o.useState)([]),$e=(0,n.Z)(we,2),Wt=$e[0],ne=$e[1],lt=(0,o.useState)([]),be=(0,n.Z)(lt,2),Ke=be[0],st=be[1],it=(0,o.useState)(),Le=(0,n.Z)(it,2),dt=Le[0],ct=Le[1],pe=(0,o.useState)(!1),Ge=(0,n.Z)(pe,2),We=Ge[0],re=Ge[1],Se=(0,o.useState)([]),Ue=(0,n.Z)(Se,2),vt=Ue[0],mt=Ue[1],ce=(0,o.useRef)(),ft=(0,o.useState)("basis"),Ce=(0,n.Z)(ft,2),Ut=Ce[0],ht=Ce[1],gt=(0,o.useState)(u.location.query.values?u.location.query.values.imgUrl:null),Ee=(0,n.Z)(gt,2),Nt=Ee[0],Yt=Ee[1],yt=(0,o.useState)(0),De=(0,n.Z)(yt,2),ra=De[0],zt=De[1],Zt=(0,o.useState)([]),Be=(0,n.Z)(Zt,2),bt=Be[0],Te=Be[1],pt=(0,o.useState)([]),Re=(0,n.Z)(pt,2),St=Re[0],Ne=Re[1],Ct=(0,o.useState)([]),Pe=(0,n.Z)(Ct,2),Et=Pe[0],xe=Pe[1],Dt=(0,o.useState)(),Ie=(0,n.Z)(Dt,2),Ht=Ie[0],Bt=Ie[1],Tt=(0,o.useState)(""),Ye=(0,n.Z)(Tt,2),kt=Ye[0],Jt=Ye[1],Rt=(0,o.useState)([]),ze=(0,n.Z)(Rt,2),Pt=ze[0],y=ze[1],i=(0,o.useRef)(null),g=(0,o.useState)([]),d=(0,n.Z)(g,2),P=d[0],V=d[1],x=(0,o.useState)([]),K=(0,n.Z)(x,2),ue=K[0],xt=K[1],It=(0,o.useState)(),ve=(0,n.Z)(It,2),_e=ve[0],ua=ve[1],He=(0,o.useState)(!1),me=(0,n.Z)(He,2),Qt=me[0],ca=me[1],oa=(0,o.useState)(!1),Xt=(0,n.Z)(oa,2),va=Xt[0],ma=Xt[1],la=(0,o.useState)(),qt=(0,n.Z)(la,2),fa=qt[0],ha=qt[1];(0,o.useEffect)(function(){ea(),sa()},[]);function ea(){X().then(function(O){var M=[];O.data.length>0&&O.data.forEach(function(E){M.push({text:E.name,value:E.id,label:E.name})}),y(M)})}function sa(){q().then(function(O){xe(O.data)})}function ia(){ea()}var da=[{title:"\u4E3B\u952E",dataIndex:"id",key:"id",hideInTable:!0,hideInSearch:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key"},{title:"\u914D\u65B9\u540D\u79F0",key:"name",dataIndex:"name",valueType:"textarea"},{title:"\u5546\u54C1\u5C5E\u6027",key:"goodsAttributeValue",dataIndex:"goodsAttributeValue",valueType:"textarea",fieldProps:{placeholder:"\u8BF7\u8F93\u5165\u5C5E\u6027,\u5C5E\u6027\u683C\u5F0F\u4E3A\uFF1Axx-xx"}},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(M,E){return[(0,r.jsx)(Je.Z,{type:"primary",title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:(0,D.Z)((0,h.Z)().mark(function L(){return(0,h.Z)().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return p.prev=0,le(E.id).then(function(ke){ke.data?(T.default.success("\u5220\u9664\u6210\u529F"),ce.current.reload()):(T.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),ce.current.reload())}),p.abrupt("return",!0);case 5:return p.prev=5,p.t0=p.catch(0),p.abrupt("return",!1);case 8:case"end":return p.stop()}},L,null,[[0,5]])})),onCancel:function(){},children:(0,r.jsx)("a",{href:"#",children:"\u5220\u9664"})},"primary")]}}];return(0,r.jsxs)(Xe.ZP,{host:!0,header:{title:[(0,r.jsxs)("a",{onClick:function(){B.m8.push({pathname:"/database/goods/newgoods"})},children:[(0,r.jsx)(Qe.Z,{}),"\u8FD4\u56DE"]},"back")],breadcrumb:{}},children:[(0,r.jsx)(Fe.ZP,{columns:da,actionRef:ce,rowKey:"id",search:!0,toolBarRender:function(){return[(0,r.jsxs)(Me.Z,{type:"primary",onClick:(0,D.Z)((0,h.Z)().mark(function M(){var E,L;return(0,h.Z)().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(!(((E=u.location.query.values)===null||E===void 0?void 0:E.id)==null||((L=u.location.query.values)===null||L===void 0?void 0:L.id)==null)){p.next=4;break}T.default.info("\u8BF7\u5148\u6DFB\u52A0\u5546\u54C1\u57FA\u7840\u4FE1\u606F!"),p.next=7;break;case 4:return p.next=6,oe(u.location.query.values.id).then(function(ke){Te(ke.data)});case 6:re(!0);case 7:case"end":return p.stop()}},M)})),children:[(0,r.jsx)(Ae.Z,{})," \u5173\u8054\u914D\u65B9"]},"primary")]},request:function(){var O=(0,D.Z)((0,h.Z)().mark(function M(E){var L,w,p;return(0,h.Z)().wrap(function(J){for(;;)switch(J.prev=J.next){case 0:if(!(u.location.query.values.id==null||u.location.query.values.id==null)){J.next=3;break}J.next=11;break;case 3:return E.GoodsId=u.location.query.values.id,L=0,J.next=7,G(E);case 7:return w=J.sent,w.data.data.length>0&&(p=w.data.data.map(function(_t){return _t.bomId}),xt(p)),b().then(function(_t){console.log("nom",p),V(_t.data)}),J.abrupt("return",{data:w.data.data,success:!0,total:L});case 11:case"end":return J.stop()}},M)}));return function(M){return O.apply(this,arguments)}}(),rowSelection:{onChange:function(M,E){return mt(E)}}}),(0,r.jsx)(rt,{handleCreateoodsBomModalVisible:We,bomTypeData:Pt,Bomdata:P,initTypeList:ia,onFinish:function(){var O=(0,D.Z)((0,h.Z)().mark(function M(E){return(0,h.Z)().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:return E.goodsId=u.location.query.values.id,console.log(E),w.next=4,he(E).then(function(p){console.log(p),p.data?(T.default.success("\u6DFB\u52A0\u6210\u529F"),re(!1)):T.default.error(p.errors),ce.current.reload()});case 4:case"end":return w.stop()}},M)}));return function(M){return O.apply(this,arguments)}}(),goodsid:(l=u.location.query.values)===null||l===void 0?void 0:l.id,goodsname:(e=u.location.query.values)===null||e===void 0?void 0:e.name,goodsAttriburteData:bt,matedata:Et,bomtype:St,defaultmatedata:(s=u.location.query.values)===null||s===void 0?void 0:s.defaultMate,onCancel:function(){re(!1)}})]})},ot=te}}]);
|