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