You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2 regels
34 KiB

  1. (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[1633,1322,9464,1981,2869,7013,9719,2383],{86811:function(jt,Ue,o){"use strict";o.r(Ue),o.d(Ue,{default:function(){return It}});var d=o(39428),W=o(3182),kt=o(57663),_=o(71577),Ft=o(49111),qe=o(19650),Gt=o(71153),_e=o(60331),Dt=o(34792),y=o(48086),Z=o(2824),Me=o(49101),l=o(67294),et=o(78009),Pe=o(16894),Nt=o(71194),ve=o(50146),Tt=o(77883),We=o(85986),Vt=o(77576),ze=o(12028),Et=o(9715),O=o(55843),Ot=o(47673),le=o(4107),wt=o(43358),ee=o(34041),t=o(85893),tt=function(e){var R,z=ee.Z.Option,w=ee.Z.OptGroup;return(0,t.jsx)(ve.Z,{title:e.values.id?"\u7F16\u8F91":"\u65B0\u5EFA",width:640,visible:e.createModalVisible,bodyStyle:{padding:"32px 40px 48px"},footer:null,onCancel:function(){e.onCancel()},destroyOnClose:!0,children:(0,t.jsxs)(O.Z,{layout:"vertical",preserve:!1,initialValues:e.values,onFinish:e.onFinish,children:[(0,t.jsx)(O.Z.Item,{name:"id",hidden:!0,children:(0,t.jsx)(le.Z,{})}),(0,t.jsx)(O.Z.Item,{name:"code",label:"\u914D\u65B9\u7F16\u7801",children:(0,t.jsx)(le.Z,{placeholder:"\u914D\u65B9\u7F16\u7801"})}),(0,t.jsx)(O.Z.Item,{name:"name",label:"\u914D\u65B9\u540D\u79F0",children:(0,t.jsx)(le.Z,{placeholder:"\u914D\u65B9\u540D\u79F0"})}),(0,t.jsx)(O.Z.Item,{name:"bomTypeList",label:"\u914D\u65B9\u5206\u7C7B",children:(0,t.jsx)(ee.Z,{mode:"multiple",allowClear:!0,children:e==null||(R=e.bomtype)===null||R===void 0?void 0:R.map(function(v){if(v.status==0)return(0,t.jsx)(ee.Z.Option,{index:v.id,value:v.id,children:v.name},v.id)})})}),(0,t.jsx)(O.Z.Item,{name:"isMain",label:"\u914D\u65B9\u7C7B\u578B",children:(0,t.jsx)(ze.Z,{checkedChildren:"\u4E3B\u6599",unCheckedChildren:"\u8F85\u6599"})}),(0,t.jsx)(O.Z.Item,{name:"sort",label:"\u6392\u5E8F",children:(0,t.jsx)(We.Z,{placeholder:"\u6392\u5E8F",min:1})}),(0,t.jsx)(O.Z.Item,{children:(0,t.jsx)(_.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},nt=tt,at=o(73171),ot=function(e){var R=function(j){var D=JSON.parse(JSON.stringify(e.values));D.push(D[j]),e.onUpdateBom(D)},z=function(j){var D=JSON.parse(JSON.stringify(e.values));D.splice(j,1),e.onUpdateBom(D)},w=function(){e.onFinish(e.values)};return(0,t.jsxs)(ve.Z,{width:540,visible:e.visible,bodyStyle:{padding:"32px 40px 48px"},footer:null,onCancel:function(){e.onCancel()},title:"\u914D\u65B9\u7528\u91CF",children:[(0,t.jsx)("div",{className:"formual-form-card",children:e.values.map(function(v,j){return(0,t.jsxs)("div",{className:"formual-form-list",children:[(0,t.jsxs)("div",{className:"form-list-copy",children:[(0,t.jsx)(_.Z,{onClick:function(){return R(j)},children:"\u590D\u5236\u4E00\u4EFD\u914D\u65B9\u7528\u91CF"}),(0,t.jsx)(_.Z,{style:{marginLeft:"10px"},danger:!0,onClick:function(){return z(j)},children:"\u5220\u9664\u914D\u65B9\u7528\u91CF"})]}),(0,t.jsxs)("div",{className:"form-list-item form-list-total",children:[(0,t.jsx)("span",{className:"form-input-label",children:"\u603B\u91CF"}),(0,t.jsx)(le.Z,{placeholder:"\u8BF7\u8F93\u5165\u603B\u91CF",value:v.bomWeight,onChange:function(Q){var te=JSON.parse(JSON.stringify(e.values));te[j].bomWeight=Q.target.value,e.onUpdateBom(te)}})]}),v.bomMaterials.map(function(D,Q){return(0,t.jsx)("div",{className:"form-list-detail",children:(0,t.jsxs)("div",{className:"form-detail-card",children:[(0,t.jsxs)("div",{className:"form-list-item formmual-name",children:[(0,t.jsx)("span",{className:"form-input-label",children:"\u540D\u79F0"}),(0,t.jsx)(le.Z,{placeholder:"\u7269\u6599\u540D\u79F0",value:D.name,onChange:function(L){var K=JSON.parse(JSON.stringify(e.values));K[j].bomMaterials[Q].name=L.target.value,e.onUpdateBom(K)}})]}),(0,t.jsxs)("div",{className:"form-list-item formmual-company",children:[(0,t.jsx)("span",{className:"form-input-label",children:"\u6570\u91CF"}),(0,t.jsx)(le.Z,{placeholder:"\u7269\u6599\u6570\u91CF",value:D.num,onChange:function(L){var K=JSON.parse(JSON.stringify(e.values));K[j].bomMaterials[Q].num=L.target.value,e.onUpdateBom(K)}})]}),(0,t.jsx)(_.Z,{onClick:function(){return e.onDeleteMate(D,j)},type:"link",danger:!0,icon:(0,t.jsx)(at.Z,{}),style:{marginLeft:"10px"}})]})},D.id)})]},j)})}),(0,t.jsx)(_.Z,{type:"primary",onClick:w,style:{float:"right"},children:"\u4FDD\u5B58"})]})},rt=ot,S=o(48971),P={add:function(e){return(0,S.WY)("/kitchen/api/bom/add",{method:"Post",data:e})},update:function(e){return(0,S.WY)("/kitchen/api/bom/update",{method:"Post",data:e})},delete:function(e){return(0,S.WY)("/kitchen/api/bom/delete",{method:"Post",data:e})},getpage:function(e){return(0,S.WY)("/kitchen/api/bom/getpage",{method:"Post",data:e})},postStockGoods:function(){return(0,S.WY)("/kitchen/api/frachisee-stock-adjust/product-list",{method:"Get"})},addentry:function(e){return(0,S.WY)("/kitchen/api/bom/addentry",{method:"Post",data:e})},deleteentry:function(e){return(0,S.WY)("/kitchen/api/bom/deleteentry",{method:"Post",data:e})},Enable:function(e){return(0,S.WY)("/kitchen/api/GoodsBom/enable",{method:"Post",data:e})},getentrypage:function(e){return(0,S.WY)("/kitchen/api/bom/getentrypage",{method:"Post",data:e})},getbomtypepage:function(e){return(0,S.WY)("/kitchen/api/bom/getbomtypepage",{method:"Post",data:e})},addBomConsumptionInfo:function(e){return(0,S.WY)("/kitchen/api/bom/addBomConsumptionInfo",{method:"Post",data:e})},getomConsumptionInfo:function(e){return(0,S.WY)("/kitchen/api/bom/getomConsumptionInfo?bomId=".concat(e),{method:"get",data:e})},GetBomTechnologypage:function(e){return(0,S.WY)("/kitchen/api/goodstechnology/getbomtechnologypage",{method:"POST",data:e})},GetGoodstechnologypage:function(e){return(0,S.WY)("/kitchen/api/goodstechnology/getGoodstechnologypage",{method:"Post",data:e})},addBomtechnology:function(e){return(0,S.WY)("/kitchen/api/goodstechnology/addBomtechnology",{method:"Post",data:e})},updatebomtechnology:function(e){return(0,S.WY)("/kitchen/api/goodstechnology/updatebomtechnology",{method:"Post",data:e})},deletebomtechnology:function(e){return(0,S.WY)("/kitchen/api/goodstechnology/deletebomtechnology",{method:"Post",data:e})},gettechnologyactionList:function(e){return(0,S.WY)("/kitchen/api/goodstechnology/gettechnologyactionList?GoodstechnologyId="+e,{method:"Get"})},GetGoodsTechnology:function(e){return(0,S.WY)("/kitchen/api/goodstechnology/GetGoodsTechnology",{method:"Post",data:e})},getbomtechnologyactionList:function(e){return(0,S.WY)("/kitchen/api/goodstechnology/getbomtechnologyactionList",{method:"Post",data:e})},addbomtechnologyaction:function(e){return(0,S.WY)("/kitchen/api/goodstechnology/addbomtechnologyaction",{method:"Post",data:e})},getbomtechnologyaction:function(e){return(0,S.WY)("/kitchen/api/goodstechnology/getbomtechnologyaction",{method:"Post",data:e})},getbomtechnologyactionbybom:function(e){return(0,S.WY)("/kitchen/api/goodstechnology/getbomtechnologyactionbybom?bomId="+e,{method:"Get"})},getbomtechnologyactionbyid:function(e){return(0,S.WY)("/kitchen/api/goodstechnology/getbomtechnologyactionbyid?id="+e,{method:"Get"})},deletebomtechnologyaction:function(e){return(0,S.WY)("/kitchen/api/goodstechnology/deletebomtechnologyaction?ids="+e,{method:"Get"})},updatesortbomtechnologyaction:function(e){return(0,S.WY)("/kitchen/api/goodstechnology/updatesortbomtechnologyaction",{method:"Post",data:e})}},ut=function(e){var R=ee.Z.Option,z=ee.Z.OptGroup;return(0,t.jsx)(ve.Z,{title:e.values.id?"\u7F16\u8F91":"\u65B0\u5EFA",width:640,visible:e.createModalVisible,bodyStyle:{padding:"32px 40px 48px"},footer:null,onCancel:function(){e.onCancel()},destroyOnClose:!0,children:(0,t.jsxs)(O.Z,{layout:"vertical",preserve:!1,initialValues:e.values,onFinish:e.onFinish,children:[(0,t.jsx)(O.Z.Item,{name:"id",hidden:!0,children:(0,t.jsx)(le.Z,{})}),(0,t.jsx)(O.Z.Item,{name:"itemId",label:"\u539F\u6599\u540D\u79F0",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u539F\u6599\u540D\u79F0"}],children:(0,t.jsx)(ee.Z,{disabled:!!e.values.id,placeholder:"\u8BF7\u9009\u62E9\u539F\u6599\u540D\u79F0",children:e.stockGoodsData.map(function(w,v){return(0,t.jsx)(ee.Z.Option,{index:v,value:w.id,children:w.name},w.id)})})}),(0,t.jsx)(O.Z.Item,{name:"price",label:"\u4EF7\u683C",defaultValue:e.values.price,children:(0,t.jsx)(We.Z,{placeholder:"\u4EF7\u683C",min:0})}),(0,t.jsx)(O.Z.Item,{children:(0,t.jsx)(_.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},it=ut,ke={goodsBoms:function(e){return(0,S.WY)("/kitchen/api/GoodsBom/GetBomReplac",{method:"Post",data:e})},updateGoodsBom:function(e){return(0,S.WY)("/kitchen/api/GoodsBom/EditReplac",{method:"PUT",data:e})},addGoodsBom:function(e){return(0,S.WY)("/kitchen/api/GoodsBom/AddReplac",{method:"POST",data:e})},goodList:function(e){return(0,S.WY)("/kitchen/api/goods/goodss",{method:"Post",data:e})},postStockGoods:function(){return(0,S.WY)("/kitchen/api/frachisee-stock-adjust/product-list",{method:"Get"})}},st=function(e){var R=(0,l.useState)(!1),z=(0,Z.Z)(R,2),w=z[0],v=z[1],j=(0,l.useRef)(),D=(0,l.useState)(),Q=(0,Z.Z)(D,2),te=Q[0],L=Q[1],K=(0,l.useState)([]),ce=(0,Z.Z)(K,2),ae=ce[0],H=ce[1],ge=(0,l.useState)([]),ue=(0,Z.Z)(ge,2),be=ue[0],Be=ue[1],pe=(0,l.useState)([]),ie=(0,Z.Z)(pe,2),se=ie[0],de=ie[1];(0,l.useEffect)(function(){function f(){ke.postStockGoods().then(function(m){var g=m.data;g.forEach(function(G){G.text=G.name,G.stockGoodsId=G.id}),de(g)})}f()},[]);function N(f){try{return ke.addGoodsBom({itemId:f.itemId,price:f.price,goodsbomId:e.values.id,replaceId:e.values.batchingId}).then(function(m){m.data?(y.default.success("\u6DFB\u52A0\u6210\u529F"),j.current.reload()):y.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")}),!0}catch(m){return y.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}function C(f){console.log("\u4F20\u53C2\u6570\u636E",f);try{return ke.updateGoodsBom({id:f.id,status:f.status,itemId:f.itemId,price:f.price,goodsbomId:e.values.id,replaceId:e.values.stockGoodsCode}).then(function(m){m.data?y.default.success("\u914D\u7F6E\u6210\u529F"):y.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),j.current.reload()}),!0}catch(m){return y.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}function k(){if(!ae)return!0;try{return ke.removeGoodsBom(ae.map(function(f){return f.id})).then(function(f){f.data?y.default.success("\u5220\u9664\u6210\u529F\uFF0C\u5373\u5C06\u5237\u65B0"):y.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),j.current.reload()}),!0}catch(f){return y.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),!1}}var T=[{title:"\u4E3B\u952E",dataIndex:"id",hideInTable:!0,hideInSearch:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",render:function(m,g){return(0,t.jsx)("a",{onClick:function(){L(g),setShowDetail(!0)},children:m})}},{title:"\u539F\u6599\u540D\u79F0",dataIndex:"name",hideInForm:!0,hideInSearch:!0},{title:"\u5546\u54C1\u4EF7\u683C",dataIndex:"price",valueType:"money"},{title:"\u72B6\u6001",dataIndex:"status",hideInForm:!0,valueEnum:{0:{text:"\u6B63\u5E38",status:"Processing"},1:{text:"\u505C\u7528",status:"Error"},2:{text:"\u5220\u9664",status:"Error"}}},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(m,g){return[g.status===0&&(0,t.jsx)("a",{onClick:function(){g.status="1",C(g)},children:"\u505C\u7528"},"link"),(g.status===1||g.status===2)&&(0,t.jsx)("a",{onClick:function(){g.status="0",C(g)},children:"\u542F\u7528"},"warn"),(0,t.jsx)("a",{type:"primary",onClick:function(){L(g),v(!0)},children:"\u66F4\u65B0"},"primary")]}}];return(0,t.jsxs)(ve.Z,{width:1200,bodyStyle:{padding:"32px 40px 48px"},destroyOnClose:!0,title:"\u914D\u65B9\u7269\u6599\u66FF\u6362",visible:e.createModalVisible,footer:!1,onCancel:function(){return e.onCancel()},maskClosable:!1,children:[(0,t.jsx)(Pe.ZP,{headerTitle:"\u66FF\u6362\u7269\u6599\u5217\u8868",actionRef:j,rowKey:"id",pagination:{defaultPageSize:20},search:!1,toolBarRender:function(){return[(0,t.jsxs)(_.Z,{type:"primary",onClick:function(){return v(!0)},children:[(0,t.jsx)(Me.Z,{})," \u65B0\u589E\u914D\u65B9\u66FF\u6362\u7269\u6599"]},"create")]},request:function(){var f=(0,W.Z)((0,d.Z)().mark(function m(g){var G,he;return(0,d.Z)().wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return G=[],he=0,e.values.id!=null&&(g.goodsbomId=e.values.id,g.replaceId=e.values.stockGoodsCode),X.next=5,ke.goodsBoms(g).then(function(Ie){G=Ie.data.data,he=Ie.data.total});case 5:return X.abrupt("return",{data:G,success:!0,total:he});case 6:case"end":return X.stop()}},m)}));return function(m){return f.apply(this,arguments)}}(),columns:T}),(0,t.jsx)(it,{stockGoodsData:se,onFinish:function(){var f=(0,W.Z)((0,d.Z)().mark(function m(g){var G;return(0,d.Z)().wrap(function(J){for(;;)switch(J.prev=J.next){case 0:if(G=!1,!g.id){J.next=7;break}return J.next=4,C(g);case 4:G=J.sent,J.next=10;break;case 7:return J.next=9,N(g);case 9:G=J.sent;case 10:G&&(v(!1),L(void 0),j.current&&j.current.reload());case 11:case"end":return J.stop()}},m)}));return function(m){return f.apply(this,arguments)}}(),onCancel:function(){v(!1),L(void 0)},createModalVisible:w,values:te||{}})]})},lt=st,ct=function(e){var R=ee.Z.Option,z=ee.Z.OptGroup;return(0,t.jsx)(ve.Z,{title:"\u6DFB\u52A0\u914D\u65B9\u539F\u6599",width:640,visible:e.createModalVisible,bodyStyle:{padding:"32px 40px 48px"},footer:null,onCancel:function(){e.onCancel()},destroyOnClose:!0,children:(0,t.jsxs)(O.Z,{layout:"vertical",preserve:!1,initialValues:e.values,onFinish:e.onFinish,children:[(0,t.jsx)(O.Z.Item,{name:"BatchingId",label:"\u539F\u6599\u540D\u79F0",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u539F\u6599\u540D\u79F0"}],children:(0,t.jsx)(ee.Z,{placeholder:"\u8BF7\u9009\u62E9\u539F\u6599\u540D\u79F0",showSearch:!0,optionFilterProp:"children",filterOption:function(v,j){return j.children.toLowerCase().indexOf(v.toLowerCase())>=0},children:e.stockGoodsData.map(function(w,v){return(0,t.jsx)(R,{index:v,value:w.id,children:w.name},w.id)})})}),(0,t.jsx)(O.Z.Item,{name:"bomQty",label:"\u914D\u65B9\u7528\u91CF",children:(0,t.jsx)(We.Z,{placeholder:"\u914D\u65B9\u7528\u91CF",min:0})}),(0,t.jsx)(O.Z.Item,{name:"isReplace",label:"\u662F\u5426\u53EF\u4EE5\u66FF\u6362",children:(0,t.jsx)(ze.Z,{checkedChildren:"\u5426",unCheckedChildren:"\u662F"})}),(0,t.jsx)(O.Z.Item,{children:(0,t.jsx)(_.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},dt=ct,ht=function(e){var R=(0,l.useRef)(),z=(0,l.useState)(!1),w=(0,Z.Z)(z,2),v=w[0],j=w[1],D=(0,l.useState)(!1),Q=(0,Z.Z)(D,2),te=Q[0],L=Q[1],K=(0,l.useState)(),ce=(0,Z.Z)(K,2),ae=ce[0],H=ce[1],ge=(0,l.useState)([]),ue=(0,Z.Z)(ge,2),be=ue[0],Be=ue[1];(0,l.useEffect)(function(){function N(){P.postStockGoods().then(function(C){var k=C.data;k.forEach(function(T){T.text=T.name,T.stockGoodsId=T.value}),Be(k)})}N()},[]);function pe(N){try{return P.deleteentry({id:N.id}).then(function(C){C.data?y.default.success("\u914D\u7F6E\u6210\u529F"):y.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),R.current.reload()}),!0}catch(C){return y.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}function ie(N,C){try{return P.Enable({id:N.id,IsReplace:C}).then(function(k){k.data?y.default.success("\u64CD\u4F5C\u6210\u529F"):y.default.error("\u64CD\u4F5C\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),R.current.reload()}),!0}catch(k){return y.default.error("\u64CD\u4F5C\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}function se(N){try{return P.addentry(JSON.stringify(N)).then(function(C){C.data?(y.default.success("\u6DFB\u52A0\u6210\u529F"),R.current.reload()):y.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")}),!0}catch(C){return y.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}var de=[{title:"\u4E3B\u952E",dataIndex:"id",hideInTable:!0,hideInSearch:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",render:function(C,k){return(0,t.jsx)("a",{onClick:function(){H(k),setShowDetail(!0)},children:C})}},{title:"\u539F\u6599\u540D\u79F0",dataIndex:"batchingName",hideInForm:!0,hideInSearch:!0},{title:"\u914D\u65B9\u7528\u91CF",dataIndex:"bomQty",hideInSearch:!0,width:120},{title:"\u662F\u5426\u53EF\u4EE5\u66FF\u6362",dataIndex:"isReplace",hideInForm:!0,valueEnum:{false:{text:"\u4E0D\u53EF\u66FF\u6362",status:"Processing"},true:{text:"\u53EF\u66FF\u6362",status:"Success"}}},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(C,k){return[k.isReplace&&(0,t.jsx)("a",{onClick:function(){j(!0),H(k)},children:"\u66FF\u6362\u7269\u6599"},"link1"),k.isReplace&&(0,t.jsx)("a",{onClick:function(){ie(k,0)},children:"\u7981\u7528\u66FF\u6362"},"link2"),!k.isReplace&&(0,t.jsx)("a",{onClick:function(){ie(k,1)},children:"\u542F\u7528\u66FF\u6362"},"link3"),(0,t.jsx)("a",{onClick:function(){pe(k)},children:"\u5220\u9664"},"link4")]}}];return(0,t.jsxs)(ve.Z,{title:"\u67E5\u770B"+e.values.name+"\u914D\u65B9\u539F\u6599",width:640,visible:e.createModalVisible,bodyStyle:{padding:"32px 40px 48px"},footer:null,onCancel:function(){e.onCancel()},destroyOnClose:!0,children:[(0,t.jsx)(Pe.ZP,{headerTitle:"\u5546\u54C1\u914D\u65B9\u4FE1\u606F\u67E5\u8BE2",actionRef:R,rowKey:"id",pagination:{defaultPageSize:20},search:!1,toolBarRender:function(){return[(0,t.jsxs)(_.Z,{type:"primary",onClick:function(){return L(!0)},children:[(0,t.jsx)(Me.Z,{})," \u6DFB\u52A0\u914D\u65B9\u539F\u6599"]},"create")]},request:function(){var N=(0,W.Z)((0,d.Z)().mark(function C(k){var T,f;return(0,d.Z)().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return T=[],f=0,e.values.id!=null&&(k.bomId=e.values.id),g.next=5,P.getentrypage(k).then(function(G){T=G.data.data,f=G.data.total});case 5:return g.abrupt("return",{data:T,success:!0,total:f});case 6:case"end":return g.stop()}},C)}));return function(C){return N.apply(this,arguments)}}(),columns:de}),(0,t.jsx)(lt,{onCancel:function(){j(!1),H(void 0)},createModalVisible:v,values:ae||{}}),(0,t.jsx)(dt,{onFinish:function(){var N=(0,W.Z)((0,d.Z)().mark(function C(k){var T;return(0,d.Z)().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return k.bomId=e.values.id,T=!1,m.next=4,se(k);case 4:T=m.sent,T&&L(!1),R.current.reload();case 7:case"end":return m.stop()}},C)}));return function(C){return N.apply(this,arguments)}}(),onCancel:function(){L(!1)},createModalVisible:te,stockGoodsData:be})]})},ft=ht,Rt=o(13062),mt=o(71230),At=o(89032),Ke=o(15746),Mt=o(58024),Qe=o(91894),Pt=o(32157),gt=o(7573),Wt=o(62350),pt=o(24565),yt=o(86582),Yt=o(63185),vt=o(9676),bt=o(32059),$t=o(13254),Zt=o(42762),St=o(64107),Jt=o(96486),Lt="message",Ut=function(){return _jsx(_Empty,{})},Ct=function(e){var R=(0,l.useState)(!1),z=(0,Z.Z)(R,2),w=z[0],v=z[1],j=(0,l.useState)([]),D=(0,Z.Z)(j,2),Q=D[0],te=D[1],L=(0,l.useState)([]),K=(0,Z.Z)(L,2),ce=K[0],ae=K[1],H=(0,l.useState)("\u6B65\u9AA4"),ge=(0,Z.Z)(H,2),ue=ge[0],be=ge[1],Be=(0,l.useState)([]),pe=(0,Z.Z)(Be,2),ie=pe[0],se=pe[1],de=(0,l.useState)([]),N=(0,Z.Z)(de,2),C=N[0],k=N[1],T=(0,l.useState)([]),f=(0,Z.Z)(T,2),m=f[0],g=f[1],G=(0,l.useState)(!1),he=(0,Z.Z)(G,2),J=he[0],X=he[1],Ie=(0,l.useState)(""),Ne=(0,Z.Z)(Ie,2),Te=Ne[0],He=Ne[1],Ye=(0,l.useState)(),Ve=(0,Z.Z)(Ye,2),Ee=Ve[0],Fe=Ve[1],Oe=(0,l.useState)([]),we=(0,Z.Z)(Oe,2),Re=we[0],ye=we[1],Ze=l.useRef(null),$e=(0,l.useRef)();(0,l.useEffect)(function(){function F(){return s.apply(this,arguments)}function s(){return s=(0,W.Z)((0,d.Z)().mark(function a(){var r;return(0,d.Z)().wrap(function(I){for(;;)switch(I.prev=I.next){case 0:return be("\u6B65\u9AA4"),r={},e.values.id!=null&&(r.bomId=e.values.id,r.current=1,r.pageSize=100),I.next=5,P.getentrypage(r).then(function(h){var p=h.data.data;te(p)});case 5:case"end":return I.stop()}},a)})),s.apply(this,arguments)}function n(){return i.apply(this,arguments)}function i(){return i=(0,W.Z)((0,d.Z)().mark(function a(){var r;return(0,d.Z)().wrap(function(I){for(;;)switch(I.prev=I.next){case 0:return r={},r.current=1,r.pageSize=100,I.next=5,P.GetGoodstechnologypage(r).then(function(h){var p=h.data.data;ae(p)});case 5:case"end":return I.stop()}},a)})),i.apply(this,arguments)}e.bomTechnologyModalVisible&&(F(),n(),ye([]),Ge())},[e.bomTechnologyModalVisible]);function Ge(){return De.apply(this,arguments)}function De(){return De=(0,W.Z)((0,d.Z)().mark(function F(){return(0,d.Z)().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,P.GetGoodsTechnology().then(function(i){var a=i.data,r=[];a.length>0&&(a.forEach(function(u){r.push({label:u.name,value:u.id,isBatch:u.isBatch})}),se(r))});case 2:return n.next=4,P.getbomtechnologyactionbybom(e.values.id).then(function(i){var a=i.data,r=[];a&&(a.forEach(function(u,I){r.push({title:u.stepName,key:u.id,value:u.id,actionjson:u.actionJson,chnologyId:u.chnologyId,isBatch:u.isBatch,sort:u.sort,index:I})}),k(r))});case 4:case"end":return n.stop()}},F)})),De.apply(this,arguments)}var Je=function(){var F=(0,W.Z)((0,d.Z)().mark(function s(n){var i,a;return(0,d.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(ye([]),g([]),(i=Ze.current)===null||i===void 0||i.setFieldsValue({stepName:n.title,id:n.key}),X(n.isBatch),Fe(n.chnologyId),be("\u3010"+n.title+"\u3011\u6B65\u9AA4"),a=JSON.parse(n.actionjson),n.isBatch){u.next=11;break}x(n.chnologyId,a),u.next=13;break;case 11:return u.next=13,B(Q,a);case 13:case"end":return u.stop()}},s)}));return function(n){return F.apply(this,arguments)}}(),Le=function(s,n){var i;ye([]),g([]),Fe(s);var a=n.label;He(a),(i=Ze.current)===null||i===void 0||i.setFieldsValue({stepName:a,id:""}),be("\u3010"+a+"\u3011\u6B65\u9AA4");var r=[];n.isBatch?(X(!1),x(s,r)):(X(!0),B(Q,r))},V=function(s,n,i,a,r){var u=i.find(function(h){return h.batchingId==n}),I={TechnologyactionId:"",ActionName:u.batchingName,ActionValue:u.bomQty,BatchingId:u.batchingId};r.target.checked?a.push(I):a.splice(a.findIndex(function(h){return h.BatchingId===I.BatchingId}),1),g(a),B(i,a)},x=function(){var F=(0,W.Z)((0,d.Z)().mark(function s(n,i){var a;return(0,d.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return a=[],u.next=3,P.gettechnologyactionList(n).then(function(I){for(var h=I.data,p=0;p<h.length;p++){var Y={};if(h[p].actionType=="select"&&h[p].actionValue)for(var fe=JSON.parse(h[p].actionValue),M=0;M<fe.length;M++){var q={text:fe[M].actionValueName};Y[fe[M].actionValueName]=q}for(var $="",re=0;re<(i==null?void 0:i.length);re++){var ne=i[re];h[p].actionType=="select"?h[p].id+":"+h[p].actionName==ne.TechnologyactionId+":"+ne.ActionName&&($=ne.ActionValue):h[p].actionName==ne.ActionName&&($=ne.ActionValue)}var Se={title:h[p].actionName,dataIndex:h[p].id+":"+h[p].actionName,valueType:h[p].actionType,width:"md",initialValue:$};h[p].actionType=="select"&&(Se.valueEnum=Y),a.push(Se)}ye(a)});case 3:case"end":return u.stop()}},s)}));return function(n,i){return F.apply(this,arguments)}}(),B=function(){var F=(0,W.Z)((0,d.Z)().mark(function s(n,i){var a,r,u,I,h,p,Y;return(0,d.Z)().wrap(function(M){for(;;)switch(M.prev=M.next){case 0:for(a=[],ye([]),r=n,u=0,I=[],h=function($){var re,ne,Se;u=i==null||(re=i.find(function(U){return U.BatchingId==r[$].batchingId}))===null||re===void 0?void 0:re.ActionValue;var Ce=!1;u&&(Ce=!0,I.push({TechnologyactionId:"",ActionName:r[$].batchingName,ActionValue:"'"+r[$].bomQty+"'",BatchingId:r[$].batchingId})),Y=r[$].batchingId+":"+r[$].batchingName;var me={title:b(Ce,r[$].batchingId,r[$].batchingName,n,i),dataIndex:r[$].batchingId+":"+r[$].batchingName,valueType:"text",width:"md",initialValue:(ne=u)!==null&&ne!==void 0?ne:0};a.push(me),(Se=Ze.current)===null||Se===void 0||Se.setFieldsValue((0,bt.Z)({},Y,u))},p=0;p<r.length;p++)h(p);g(I),ye(a);case 9:case"end":return M.stop()}},s)}));return function(n,i){return F.apply(this,arguments)}}();function b(F,s,n,i,a){return(0,t.jsx)(vt.Z,{checked:F,onChange:V.bind(this,s+":"+n,s,i,a),children:n},s)}var A=function(){var F=(0,W.Z)((0,d.Z)().mark(function s(n){var i,a,r,u,I,h,p,Y;return(0,d.Z)().wrap(function(M){for(;;)switch(M.prev=M.next){case 0:if(i=[],a={BomId:e.values.id,ChnologyId:Ee,ActionJson:"",StepName:n.stepName,isBatch:J,Id:n.id},r=Object.keys(n),u=[],J)for(I=0;I<m.length;I++)h=m[I],u.push(h.BatchingId+":"+h.ActionName);else u=r;console.log(u);for(p in u)u[p]!="stepName"&&(Y={TechnologyactionId:"",ActionName:"",ActionValue:"",BatchingId:""},J?(Y.TechnologyactionId="",m.length>0&&(Y.BatchingId=m==null?void 0:m.find(function(q){return q.BatchingId==u[p].split(":")[0]}).BatchingId)):Y.TechnologyactionId=u[p].split(":")[0],Y.ActionValue=n[u[p]],Y.ActionName=u[p].split(":")[1],i.push(Y));if(a.ActionJson=JSON.stringify(i),console.log(a),!(a.ActionJson.length<=2)){M.next=14;break}return y.default.error("\u8BF7\u9009\u62E9\u5DE5\u827A\u5E76\u914D\u7F6E\u76F8\u5173\u52A8\u4F5C\u6B65\u9AA4"),M.abrupt("return",!1);case 14:return M.next=16,P.addbomtechnologyaction(a).then(function(q){q.succeeded?y.default.success("\u4FDD\u5B58\u6210\u529F"):y.default.error("\u4FDD\u5B58\u5931\u8D25\uFF0C\u5931\u8D25\u539F\u56E0\uFF1A"+q.errors)});case 16:Ge();case 17:case"end":return M.stop()}},s)}));return function(n){return F.apply(this,arguments)}}(),E=function(){var F=(0,W.Z)((0,d.Z)().mark(function s(n){return(0,d.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return console.log(n),a.next=3,P.deletebomtechnologyaction(n).then(function(r){r.succeeded?(y.default.success("\u5220\u9664\u6210\u529F"),Ge()):y.default.error("\u5220\u9664\u6210\u529F\uFF0C\u5931\u8D25\u539F\u56E0\uFF1A"+r.errors)});case 3:case"end":return a.stop()}},s)}));return function(n){return F.apply(this,arguments)}}(),oe=function(){var F=(0,W.Z)((0,d.Z)().mark(function s(n){var i,a,r,u,I,h,p,Y,fe,M,q,$,re,ne;return(0,d.Z)().wrap(function(Ce){for(;;)switch(Ce.prev=Ce.next){case 0:for(i=n.node.key,a=n.dragNode.key,r=n.node.pos.split("-"),u=n.dropPosition-Number(r[r.length-1]),I=function me(U,je,Xe){for(var xe=0;xe<U.length;xe++){if(U[xe].key===je)return Xe(U[xe],xe,U);U[xe].children&&me(U[xe].children,je,Xe)}},h=(0,yt.Z)(C),I(h,a,function(me,U,je){je.splice(U,1),p=me}),Y=[],I(h,i,function(me,U,je){Y=je,fe=U}),u===-1?Y.splice(fe,0,p):Y.splice(fe+1,0,p),console.log(h),M=[],q=0,$=C[0].sort;q<h.length;$++)re=h[q],ne=C[q],re.value!=ne.value&&M.push({id:re.value,sort:$}),q++;return console.log(M),k(h),Ce.next=18,P.updatesortbomtechnologyaction(M).then(function(me){if(me.succeeded){var U;y.default.success("\u4FEE\u6539\u5217\u8868\u6392\u5E8F\u6210\u529F"),(U=$e.current)===null||U===void 0||U.reload()}else y.default.error("\u4FEE\u6539\u5217\u8868\u6392\u5E8F\u5931\u8D25\uFF1A"+me.errors)});case 18:case"end":return Ce.stop()}},s)}));return function(n){return F.apply(this,arguments)}}(),Ae=function(s){console.log(s)};return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(ve.Z,{title:"\u6DFB\u52A0\u914D\u65B9\u5DE5\u827A",width:1040,visible:e.bomTechnologyModalVisible,bodyStyle:{padding:"32px 40px 48px"},footer:null,onCancel:function(){e.onCancel()},destroyOnClose:!0,children:(0,t.jsxs)(mt.Z,{gutter:16,children:[(0,t.jsx)(Ke.Z,{span:8,children:(0,t.jsx)(Qe.Z,{title:"\u5DE5\u827A\u6B65\u9AA4",style:{width:320},bodyStyle:{padding:1,lineheight:40},size:"small",children:(0,t.jsx)(gt.Z,{defaultExpandAll:!0,onSelect:function(s,n){return[Je(n.node)]},titleRender:function(s){return(0,t.jsxs)("div",{style:{"line-height":40},children:[(0,t.jsx)("span",{children:s.title}),(0,t.jsx)(pt.Z,{type:"primary",title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:function(){E(s.key)},onCancel:function(){},children:(0,t.jsx)("a",{href:"#",style:{color:"#ff4d4f",float:"right"},children:"\u5220\u9664"})},"primary")]})},draggable:{icon:(0,t.jsx)(Zt.Z,{style:{cursor:"grab",color:"#080808","line-height":45}})},blockNode:!0,onDragEnd:Ae,onDrop:oe,treeData:C})})}),(0,t.jsx)(Ke.Z,{span:8,children:(0,t.jsx)(Qe.Z,{title:ue,extra:(0,t.jsxs)("span",{children:["\u9009\u62E9\u5DE5\u827A\uFF1A",(0,t.jsx)(ee.Z,{style:{width:"150px"},options:ie,onChange:function(){var F=(0,W.Z)((0,d.Z)().mark(function s(n,i){return(0,d.Z)().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:Le(n,i);case 1:case"end":return r.stop()}},s)}));return function(s,n){return F.apply(this,arguments)}}()})]}),style:{width:600},children:(0,t.jsxs)(O.Z,{layout:"horizontal",labelAlign:"right",preserve:!1,ref:Ze,labelCol:{span:4},wrapperCol:{span:24},onFinish:function(){var F=(0,W.Z)((0,d.Z)().mark(function s(n){return(0,d.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",A(n));case 1:case"end":return a.stop()}},s)}));return function(s){return F.apply(this,arguments)}}(),children:[(0,t.jsx)(O.Z.Item,{name:"id",hidden:!0,children:(0,t.jsx)(le.Z,{})}),(0,t.jsx)(O.Z.Item,{name:"stepName",label:"\u6B65\u9AA4\u540D\u79F0",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6B65\u9AA4\u540D\u79F0"}],children:(0,t.jsx)(le.Z,{placeholder:"\u8BF7\u8F93\u5165\u6B65\u9AA4\u540D\u79F0",defaultValue:Te,style:{width:328}})}),(0,t.jsx)(St.Z,{layoutType:"Embed",grid:!0,shouldUpdate:!0,formItemProps:{forceRender:!0,labelAlign:"left"},columns:Re}),(0,t.jsxs)(O.Z.Item,{style:{"text-align":"center"},children:[(0,t.jsx)(_.Z,{type:"primary",htmlType:"submit",style:{right:10},children:"\u4FDD\u5B58"}),(0,t.jsx)(_.Z,{htmlType:"button",onClick:e.onCancel,children:"\u53D6\u6D88"})]})]})})})]})})})},xt=Ct,Bt=function(e){var R=(0,l.useState)(!1),z=(0,Z.Z)(R,2),w=z[0],v=z[1],j=(0,l.useState)(!1),D=(0,Z.Z)(j,2),Q=D[0],te=D[1],L=(0,l.useState)(),K=(0,Z.Z)(L,2),ce=K[0],ae=K[1],H=(0,l.useRef)(),ge=(0,l.useState)([]),ue=(0,Z.Z)(ge,2),be=ue[0],Be=ue[1],pe=(0,l.useState)(),ie=(0,Z.Z)(pe,2),se=ie[0],de=ie[1],N=(0,l.useState)(),C=(0,Z.Z)(N,2),k=C[0],T=C[1],f=(0,l.useState)(!1),m=(0,Z.Z)(f,2),g=m[0],G=m[1],he=(0,l.useState)([]),J=(0,Z.Z)(he,2),X=J[0],Ie=J[1],Ne=(0,l.useState)({}),Te=(0,Z.Z)(Ne,2),He=Te[0],Ye=Te[1],Ve=(0,l.useState)([]),Ee=(0,Z.Z)(Ve,2),Fe=Ee[0],Oe=Ee[1],we=(0,l.useState)(!1),Re=(0,Z.Z)(we,2),ye=Re[0],Ze=Re[1];(0,l.useEffect)(function(){function V(){P.postStockGoods().then(function(x){var B=x.data;B.forEach(function(b){b.text=b.name,b.stockGoodsId=b.value}),Be(B)}),P.getbomtypepage({current:1,pagesize:1e3,status:"0"}).then(function(x){Ie(x.data.data);var B={};b(x.data.data);function b(A){for(var E in A)B[A[E].id]={text:A[E].name},A[E].children&&b(A[E].children)}Ye(B)})}V()},[]);function $e(V){try{return P.add(JSON.stringify(V)).then(function(x){x.data?(y.default.success("\u6DFB\u52A0\u6210\u529F"),H.current.reload()):y.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")}),!0}catch(x){return y.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}function Ge(V){try{return P.update(JSON.stringify(V)).then(function(x){x.data?y.default.success("\u4FEE\u6539\u6210\u529F"):y.default.error("\u4FEE\u6539\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),H.current.reload()}),!0}catch(x){return y.default.error("\u4FEE\u6539\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}var De=[{title:"\u4E3B\u952E",dataIndex:"id",hideInTable:!0,hideInSearch:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",render:function(x,B){return(0,t.jsx)("a",{onClick:function(){ae(B),setShowDetail(!0)},children:x})}},{title:"\u914D\u65B9\u7F16\u7801",dataIndex:"code",hideInForm:!0,hideInSearch:!0},{title:"\u914D\u65B9\u540D\u79F0",dataIndex:"name",hideInForm:!0,hideInSearch:!1},{title:"\u6392\u5E8F",dataIndex:"sort",hideInForm:!0,hideInSearch:!0},{title:"\u914D\u65B9\u5206\u7C7B",dataIndex:"bomTypeList",search:!1,width:450,render:function(x,B){return(0,t.jsx)(qe.Z,{children:X.filter(function(b){var A=B.bomTypeList.find(function(oe){return oe===b.id}),E=X.find(function(oe){return oe.id===A});return E!=null||void 0}).map(function(b){return(0,t.jsx)(_e.Z,{color:"#87d068",children:b.name},b.id)})})}},{title:"\u914D\u65B9\u7C7B\u578B",dataIndex:"isMain",hideInForm:!0,valueEnum:{false:{text:"\u8F85\u6599\u914D\u65B9",status:"Processing"},true:{text:"\u4E3B\u6599\u914D\u65B9",status:"Success"}}},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(x,B){return[(0,t.jsx)("a",{type:"primary",onClick:function(){de(B),T(!0)},children:"\u67E5\u770B\u914D\u65B9\u539F\u6599"},"primary1"),(0,t.jsx)("a",{type:"primary",onClick:function(){de(B),Ze(!0)},children:"\u6DFB\u52A0\u914D\u65B9\u5DE5\u827A"},"primary1"),(0,t.jsx)("a",{type:"primary",onClick:function(){v(!0),ae(B)},children:"\u66F4\u65B0"},"primary3")]}}],Je=function(x){Oe(x)},Le=function(x,B){var b=JSON.parse(JSON.stringify(Fe)),A=b[B].bomMaterials.findIndex(function(E){return x.id===E.id});b[B].bomMaterials.splice(A,1),Oe(b)};return(0,t.jsxs)(et.ZP,{children:[(0,t.jsx)(Pe.ZP,{headerTitle:"\u914D\u65B9\u5217\u8868",actionRef:H,rowKey:"id",pagination:{defaultPageSize:20},search:!0,toolBarRender:function(){return[(0,t.jsxs)(_.Z,{type:"primary",onClick:function(){return v(!0)},children:[(0,t.jsx)(Me.Z,{})," \u65B0\u589E\u914D\u65B9"]},"create")]},request:function(){var V=(0,W.Z)((0,d.Z)().mark(function x(B){var b,A;return(0,d.Z)().wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:return b=[],A=0,oe.next=4,P.getpage(B).then(function(Ae){b=Ae.data.data,A=Ae.data.total});case 4:return oe.abrupt("return",{data:b,success:!0,total:A});case 5:case"end":return oe.stop()}},x)}));return function(x){return V.apply(this,arguments)}}(),columns:De}),se&&Object.keys(se).length?(0,t.jsx)(ft,{onCancel:function(){T(!1),de({})},createModalVisible:k,values:se}):null,(0,t.jsx)(nt,{bomtype:X,onFinish:function(){var V=(0,W.Z)((0,d.Z)().mark(function x(B){var b;return(0,d.Z)().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:if(b=!1,!B.id){E.next=7;break}return E.next=4,Ge(B);case 4:b=E.sent,E.next=10;break;case 7:return E.next=9,$e(B);case 9:b=E.sent;case 10:b&&(v(!1),ae(void 0),H.current&&H.current.reload()),H.current.reload();case 12:case"end":return E.stop()}},x)}));return function(x){return V.apply(this,arguments)}}(),onCancel:function(){v(!1),ae(void 0)},createModalVisible:w,values:ce||{}}),(0,t.jsx)(rt,{onFinish:function(){var V=(0,W.Z)((0,d.Z)().mark(function x(B){return(0,d.Z)().wrap(function(A){for(;;)switch(A.prev=A.next){case 0:P.addBomConsumptionInfo({bomId:ce.id,bomConsumptionInfo:B}).then(function(E){E.data?(G(!1),y.default.success("\u6210\u529F")):y.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")}),console.log(B);case 2:case"end":return A.stop()}},x)}));return function(x){return V.apply(this,arguments)}}(),visible:g,values:Fe,onUpdateBom:Je,onCancel:function(){G(!1)},onDeleteMate:Le}),(0,t.jsx)(xt,{bomTechnologyModalVisible:ye,onCancel:function(){Ze(!1)},values:se||{}})]})},It=Bt}}]);