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.

p__bom__manage.60140336.async.js 28 KiB

1 年之前
1
  1. (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[1633,1322],{47511:function(He,pe,o){"use strict";o.r(pe),o.d(pe,{default:function(){return Je}});var C=o(39428),$=o(3182),Xe=o(57663),J=o(71577),qe=o(49111),Se=o(19650),_e=o(71153),be=o(60331),et=o(34792),n=o(48086),v=o(2824),fe=o(49101),a=o(67294),ye=o(78009),he=o(16894),tt=o(71194),ne=o(50146),nt=o(77883),me=o(85986),at=o(77576),ge=o(12028),rt=o(9715),Z=o(55843),ot=o(47673),ae=o(4107),ut=o(43358),P=o(34041),t=o(85893),Be=function(e){var b,V=P.Z.Option,d=P.Z.OptGroup;return(0,t.jsx)(ne.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)(Z.Z,{layout:"vertical",preserve:!1,initialValues:e.values,onFinish:e.onFinish,children:[(0,t.jsx)(Z.Z.Item,{name:"id",hidden:!0,children:(0,t.jsx)(ae.Z,{})}),(0,t.jsx)(Z.Z.Item,{name:"code",label:"\u914D\u65B9\u7F16\u7801",children:(0,t.jsx)(ae.Z,{placeholder:"\u914D\u65B9\u7F16\u7801"})}),(0,t.jsx)(Z.Z.Item,{name:"name",label:"\u914D\u65B9\u540D\u79F0",children:(0,t.jsx)(ae.Z,{placeholder:"\u914D\u65B9\u540D\u79F0"})}),(0,t.jsx)(Z.Z.Item,{name:"bomTypeList",label:"\u914D\u65B9\u7C7B\u578B",children:(0,t.jsx)(P.Z,{mode:"multiple",allowClear:!0,children:e==null||(b=e.bomtype)===null||b===void 0?void 0:b.map(function(r,u){return(0,t.jsx)(P.Z.Option,{index:r.id,value:r.id,children:r.name},r.id)})})}),(0,t.jsx)(Z.Z.Item,{name:"isMain",label:"\u914D\u65B9\u7C7B\u578B",children:(0,t.jsx)(ge.Z,{checkedChildren:"\u4E3B\u6599",unCheckedChildren:"\u8F85\u6599"})}),(0,t.jsx)(Z.Z.Item,{name:"sort",label:"\u6392\u5E8F",children:(0,t.jsx)(me.Z,{placeholder:"\u6392\u5E8F",min:1})}),(0,t.jsx)(Z.Z.Item,{children:(0,t.jsx)(J.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},je=Be,Fe=o(73171),Ie=function(e){var b=function(u){var B=JSON.parse(JSON.stringify(e.values));B.push(B[u]),e.onUpdateBom(B)},V=function(u){var B=JSON.parse(JSON.stringify(e.values));B.splice(u,1),e.onUpdateBom(B)},d=function(){e.onFinish(e.values)};return(0,t.jsxs)(ne.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(r,u){return(0,t.jsxs)("div",{className:"formual-form-list",children:[(0,t.jsxs)("div",{className:"form-list-copy",children:[(0,t.jsx)(J.Z,{onClick:function(){return b(u)},children:"\u590D\u5236\u4E00\u4EFD\u914D\u65B9\u7528\u91CF"}),(0,t.jsx)(J.Z,{style:{marginLeft:"10px"},danger:!0,onClick:function(){return V(u)},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)(ae.Z,{placeholder:"\u8BF7\u8F93\u5165\u603B\u91CF",value:r.bomWeight,onChange:function(W){var L=JSON.parse(JSON.stringify(e.values));L[u].bomWeight=W.target.value,e.onUpdateBom(L)}})]}),r.bomMaterials.map(function(B,W){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)(ae.Z,{placeholder:"\u7269\u6599\u540D\u79F0",value:B.name,onChange:function(w){var Y=JSON.parse(JSON.stringify(e.values));Y[u].bomMaterials[W].name=w.target.value,e.onUpdateBom(Y)}})]}),(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)(ae.Z,{placeholder:"\u7269\u6599\u6570\u91CF",value:B.num,onChange:function(w){var Y=JSON.parse(JSON.stringify(e.values));Y[u].bomMaterials[W].num=w.target.value,e.onUpdateBom(Y)}})]}),(0,t.jsx)(J.Z,{onClick:function(){return e.onDeleteMate(B,u)},type:"link",danger:!0,icon:(0,t.jsx)(Fe.Z,{}),style:{marginLeft:"10px"}})]})},B.id)})]},u)})}),(0,t.jsx)(J.Z,{type:"primary",onClick:d,style:{float:"right"},children:"\u4FDD\u5B58"})]})},ke=Ie,F=o(48971),E={add:function(e){return(0,F.WY)("/kitchen/api/bom/add",{method:"Post",data:e})},update:function(e){return(0,F.WY)("/kitchen/api/bom/update",{method:"Post",data:e})},delete:function(e){return(0,F.WY)("/kitchen/api/bom/delete",{method:"Post",data:e})},getpage:function(e){return(0,F.WY)("/kitchen/api/bom/getpage",{method:"Post",data:e})},postStockGoods:function(){return(0,F.WY)("/kitchen/api/frachisee-stock-adjust/product-list",{method:"Get"})},addentry:function(e){return(0,F.WY)("/kitchen/api/bom/addentry",{method:"Post",data:e})},deleteentry:function(e){return(0,F.WY)("/kitchen/api/bom/deleteentry",{method:"Post",data:e})},Enable:function(e){return(0,F.WY)("/kitchen/api/GoodsBom/enable",{method:"Post",data:e})},getentrypage:function(e){return(0,F.WY)("/kitchen/api/bom/getentrypage",{method:"Post",data:e})},getbomtypepage:function(e){return(0,F.WY)("/kitchen/api/bom/getbomtypepage",{method:"Post",data:e})},addBomConsumptionInfo:function(e){return(0,F.WY)("/kitchen/api/bom/addBomConsumptionInfo",{method:"Post",data:e})},getomConsumptionInfo:function(e){return(0,F.WY)("/kitchen/api/bom/getomConsumptionInfo?bomId=".concat(e),{method:"get",data:e})},GetBomTechnologypage:function(e){return(0,F.WY)("/kitchen/api/goodstechnology/getbomtechnologypage",{method:"POST",data:e})},GetGoodstechnologypage:function(e){return(0,F.WY)("/kitchen/api/goodstechnology/getGoodstechnologypage",{method:"Post",data:e})},addBomtechnology:function(e){return(0,F.WY)("/kitchen/api/goodstechnology/addBomtechnology",{method:"Post",data:e})},updatebomtechnology:function(e){return(0,F.WY)("/kitchen/api/goodstechnology/updatebomtechnology",{method:"Post",data:e})},deletebomtechnology:function(e){return(0,F.WY)("/kitchen/api/goodstechnology/deletebomtechnology",{method:"Post",data:e})}},De=function(e){var b=P.Z.Option,V=P.Z.OptGroup;return(0,t.jsx)(ne.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)(Z.Z,{layout:"vertical",preserve:!1,initialValues:e.values,onFinish:e.onFinish,children:[(0,t.jsx)(Z.Z.Item,{name:"id",hidden:!0,children:(0,t.jsx)(ae.Z,{})}),(0,t.jsx)(Z.Z.Item,{name:"itemId",label:"\u539F\u6599\u540D\u79F0",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u539F\u6599\u540D\u79F0"}],children:(0,t.jsx)(P.Z,{disabled:!!e.values.id,placeholder:"\u8BF7\u9009\u62E9\u539F\u6599\u540D\u79F0",children:e.stockGoodsData.map(function(d,r){return(0,t.jsx)(P.Z.Option,{index:r,value:d.id,children:d.name},d.id)})})}),(0,t.jsx)(Z.Z.Item,{name:"price",label:"\u4EF7\u683C",defaultValue:e.values.price,children:(0,t.jsx)(me.Z,{placeholder:"\u4EF7\u683C",min:0})}),(0,t.jsx)(Z.Z.Item,{children:(0,t.jsx)(J.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},Ge=De,de={goodsBoms:function(e){return(0,F.WY)("/kitchen/api/GoodsBom/GetBomReplac",{method:"Post",data:e})},updateGoodsBom:function(e){return(0,F.WY)("/kitchen/api/GoodsBom/EditReplac",{method:"PUT",data:e})},addGoodsBom:function(e){return(0,F.WY)("/kitchen/api/GoodsBom/AddReplac",{method:"POST",data:e})},goodList:function(e){return(0,F.WY)("/kitchen/api/goods/goodss",{method:"Post",data:e})},postStockGoods:function(){return(0,F.WY)("/kitchen/api/frachisee-stock-adjust/product-list",{method:"Get"})}},Oe=function(e){var b=(0,a.useState)(!1),V=(0,v.Z)(b,2),d=V[0],r=V[1],u=(0,a.useRef)(),B=(0,a.useState)(),W=(0,v.Z)(B,2),L=W[0],w=W[1],Y=(0,a.useState)([]),K=(0,v.Z)(Y,2),q=K[0],U=K[1],oe=(0,a.useState)([]),Q=(0,v.Z)(oe,2),ve=Q[0],ie=Q[1],ue=(0,a.useState)([]),H=(0,v.Z)(ue,2),_=H[0],z=H[1];(0,a.useEffect)(function(){function i(){de.postStockGoods().then(function(c){var l=c.data;l.forEach(function(y){y.text=y.name,y.stockGoodsId=y.id}),z(l)})}i()},[]);function j(i){try{return de.addGoodsBom({itemId:i.itemId,price:i.price,goodsbomId:e.values.id,replaceId:e.values.batchingId}).then(function(c){c.data?(n.default.success("\u6DFB\u52A0\u6210\u529F"),u.current.reload()):n.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")}),!0}catch(c){return n.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}function h(i){console.log("\u4F20\u53C2\u6570\u636E",i);try{return de.updateGoodsBom({id:i.id,status:i.status,itemId:i.itemId,price:i.price,goodsbomId:e.values.id,replaceId:e.values.stockGoodsCode}).then(function(c){c.data?n.default.success("\u914D\u7F6E\u6210\u529F"):n.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),u.current.reload()}),!0}catch(c){return n.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}function p(){if(!q)return!0;try{return de.removeGoodsBom(q.map(function(i){return i.id})).then(function(i){i.data?n.default.success("\u5220\u9664\u6210\u529F\uFF0C\u5373\u5C06\u5237\u65B0"):n.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),u.current.reload()}),!0}catch(i){return n.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),!1}}var S=[{title:"\u4E3B\u952E",dataIndex:"id",hideInTable:!0,hideInSearch:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",render:function(c,l){return(0,t.jsx)("a",{onClick:function(){w(l),setShowDetail(!0)},children:c})}},{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(c,l){return[l.status===0&&(0,t.jsx)("a",{onClick:function(){l.status="1",h(l)},children:"\u505C\u7528"},"link"),(l.status===1||l.status===2)&&(0,t.jsx)("a",{onClick:function(){l.status="0",h(l)},children:"\u542F\u7528"},"warn"),(0,t.jsx)("a",{type:"primary",onClick:function(){w(l),r(!0)},children:"\u66F4\u65B0"},"primary")]}}];return(0,t.jsxs)(ne.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)(he.ZP,{headerTitle:"\u66FF\u6362\u7269\u6599\u5217\u8868",actionRef:u,rowKey:"id",pagination:{defaultPageSize:20},search:!1,toolBarRender:function(){return[(0,t.jsxs)(J.Z,{type:"primary",onClick:function(){return r(!0)},children:[(0,t.jsx)(fe.Z,{})," \u65B0\u589E\u914D\u65B9\u66FF\u6362\u7269\u6599"]},"create")]},request:function(){var i=(0,$.Z)((0,C.Z)().mark(function c(l){var y,re;return(0,C.Z)().wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return y=[],re=0,e.values.id!=null&&(l.goodsbomId=e.values.id,l.replaceId=e.values.stockGoodsCode),X.next=5,de.goodsBoms(l).then(function(le){y=le.data.data,re=le.data.total});case 5:return X.abrupt("return",{data:y,success:!0,total:re});case 6:case"end":return X.stop()}},c)}));return function(c){return i.apply(this,arguments)}}(),columns:S}),(0,t.jsx)(Ge,{stockGoodsData:_,onFinish:function(){var i=(0,$.Z)((0,C.Z)().mark(function c(l){var y;return(0,C.Z)().wrap(function(N){for(;;)switch(N.prev=N.next){case 0:if(y=!1,!l.id){N.next=7;break}return N.next=4,h(l);case 4:y=N.sent,N.next=10;break;case 7:return N.next=9,j(l);case 9:y=N.sent;case 10:y&&(r(!1),w(void 0),u.current&&u.current.reload());case 11:case"end":return N.stop()}},c)}));return function(c){return i.apply(this,arguments)}}(),onCancel:function(){r(!1),w(void 0)},createModalVisible:d,values:L||{}})]})},Te=Oe,Re=function(e){var b=P.Z.Option,V=P.Z.OptGroup;return(0,t.jsx)(ne.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)(Z.Z,{layout:"vertical",preserve:!1,initialValues:e.values,onFinish:e.onFinish,children:[(0,t.jsx)(Z.Z.Item,{name:"BatchingId",label:"\u539F\u6599\u540D\u79F0",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u539F\u6599\u540D\u79F0"}],children:(0,t.jsx)(P.Z,{placeholder:"\u8BF7\u9009\u62E9\u539F\u6599\u540D\u79F0",showSearch:!0,optionFilterProp:"children",filterOption:function(r,u){return u.children.toLowerCase().indexOf(r.toLowerCase())>=0},children:e.stockGoodsData.map(function(d,r){return(0,t.jsx)(b,{index:r,value:d.id,children:d.name},d.id)})})}),(0,t.jsx)(Z.Z.Item,{name:"bomQty",label:"\u914D\u65B9\u7528\u91CF",children:(0,t.jsx)(me.Z,{placeholder:"\u914D\u65B9\u7528\u91CF",min:0})}),(0,t.jsx)(Z.Z.Item,{name:"isReplace",label:"\u662F\u5426\u53EF\u4EE5\u66FF\u6362",children:(0,t.jsx)(ge.Z,{checkedChildren:"\u5426",unCheckedChildren:"\u662F"})}),(0,t.jsx)(Z.Z.Item,{children:(0,t.jsx)(J.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},Ee=Re,we=function(e){var b=(0,a.useRef)(),V=(0,a.useState)(!1),d=(0,v.Z)(V,2),r=d[0],u=d[1],B=(0,a.useState)(!1),W=(0,v.Z)(B,2),L=W[0],w=W[1],Y=(0,a.useState)(),K=(0,v.Z)(Y,2),q=K[0],U=K[1],oe=(0,a.useState)([]),Q=(0,v.Z)(oe,2),ve=Q[0],ie=Q[1];(0,a.useEffect)(function(){function j(){E.postStockGoods().then(function(h){var p=h.data;console.log(p),p.forEach(function(S){S.text=S.name,S.stockGoodsId=S.value}),ie(p)})}j()},[]);function ue(j){try{return E.deleteentry({id:j.id}).then(function(h){h.data?n.default.success("\u914D\u7F6E\u6210\u529F"):n.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),b.current.reload()}),!0}catch(h){return n.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}function H(j,h){try{return E.Enable({id:j.id,IsReplace:h}).then(function(p){p.data?n.default.success("\u64CD\u4F5C\u6210\u529F"):n.default.error("\u64CD\u4F5C\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),b.current.reload()}),!0}catch(p){return n.default.error("\u64CD\u4F5C\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}function _(j){try{return E.addentry(JSON.stringify(j)).then(function(h){h.data?(n.default.success("\u6DFB\u52A0\u6210\u529F"),b.current.reload()):n.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")}),!0}catch(h){return n.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}var z=[{title:"\u4E3B\u952E",dataIndex:"id",hideInTable:!0,hideInSearch:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",render:function(h,p){return(0,t.jsx)("a",{onClick:function(){U(p),setShowDetail(!0)},children:h})}},{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(h,p){return[p.isReplace&&(0,t.jsx)("a",{onClick:function(){u(!0),U(p)},children:"\u66FF\u6362\u7269\u6599"},"link1"),p.isReplace&&(0,t.jsx)("a",{onClick:function(){H(p,0)},children:"\u7981\u7528\u66FF\u6362"},"link2"),!p.isReplace&&(0,t.jsx)("a",{onClick:function(){H(p,1)},children:"\u542F\u7528\u66FF\u6362"},"link3"),(0,t.jsx)("a",{onClick:function(){ue(p)},children:"\u5220\u9664"},"link4")]}}];return(0,t.jsxs)(ne.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)(he.ZP,{headerTitle:"\u5546\u54C1\u914D\u65B9\u4FE1\u606F\u67E5\u8BE2",actionRef:b,rowKey:"id",pagination:{defaultPageSize:20},search:!1,toolBarRender:function(){return[(0,t.jsxs)(J.Z,{type:"primary",onClick:function(){return w(!0)},children:[(0,t.jsx)(fe.Z,{})," \u6DFB\u52A0\u914D\u65B9\u539F\u6599"]},"create")]},request:function(){var j=(0,$.Z)((0,C.Z)().mark(function h(p){var S,i;return(0,C.Z)().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return S=[],i=0,e.values.id!=null&&(p.bomId=e.values.id),l.next=5,E.getentrypage(p).then(function(y){S=y.data.data,i=y.data.total});case 5:return l.abrupt("return",{data:S,success:!0,total:i});case 6:case"end":return l.stop()}},h)}));return function(h){return j.apply(this,arguments)}}(),columns:z}),(0,t.jsx)(Te,{onCancel:function(){u(!1),U(void 0)},createModalVisible:r,values:q||{}}),(0,t.jsx)(Ee,{onFinish:function(){var j=(0,$.Z)((0,C.Z)().mark(function h(p){var S;return(0,C.Z)().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return p.bomId=e.values.id,S=!1,c.next=4,_(p);case 4:S=c.sent,S&&w(!1),b.current.reload();case 7:case"end":return c.stop()}},h)}));return function(h){return j.apply(this,arguments)}}(),onCancel:function(){w(!1)},createModalVisible:L,stockGoodsData:ve})]})},Me=we,it=o(62350),Ve=o(24565),Pe=function(e){var b=P.Z.Option,V=P.Z.OptGroup;return(0,t.jsx)(ne.Z,{title:"\u6DFB\u52A0\u914D\u65B9\u5DE5\u827A",width:640,visible:e.bomtechnoVisible,bodyStyle:{padding:"32px 40px 1px 48px"},footer:null,onCancel:function(){e.onCancel()},destroyOnClose:!0,children:(0,t.jsxs)(Z.Z,{layout:"vertical",preserve:!1,initialValues:e.values,onFinish:e.onFinish,children:[(0,t.jsx)(Z.Z.Item,{name:"id",hidden:!0,children:(0,t.jsx)(ae.Z,{})}),(0,t.jsx)(Z.Z.Item,{name:"batchingId",label:"\u539F\u6599\u540D\u79F0",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u539F\u6599\u540D\u79F0"}],children:(0,t.jsx)(P.Z,{placeholder:"\u8BF7\u9009\u62E9\u539F\u6599\u540D\u79F0",showSearch:!0,children:e.stockGoods.map(function(d,r){return(0,t.jsx)(b,{index:r,value:d.id,children:d.batchingName},d.id)})})}),(0,t.jsx)(Z.Z.Item,{name:"chnologyId",label:"\u5DE5\u827A",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u5DE5\u827A\u540D\u79F0"}],children:(0,t.jsx)(P.Z,{placeholder:"\u8BF7\u9009\u62E9\u5DE5\u827A\u540D\u79F0",showSearch:!0,children:e.technologydata.map(function(d,r){return(0,t.jsx)(b,{index:r,value:d.id,children:d.name},d.id)})})}),(0,t.jsx)(Z.Z.Item,{name:"sort",label:"\u6392\u5E8F",rules:[{required:!0,message:"\u8BF7\u6392\u5E8F"}],children:(0,t.jsx)(me.Z,{placeholder:"\u6392\u5E8F",min:0})}),(0,t.jsxs)(Z.Z.Item,{children:[(0,t.jsx)(J.Z,{htmlType:"button",style:{float:"right",left:10},onClick:e.onCancel,children:"\u53D6\u6D88"}),(0,t.jsx)(J.Z,{type:"primary",htmlType:"submit",style:{float:"right"},children:"\u4FDD\u5B58"})]})]})})},Ne=Pe,xe="message",Ae=function(e){var b=(0,a.useState)(!1),V=(0,v.Z)(b,2),d=V[0],r=V[1],u=(0,a.useRef)(),B=(0,a.useState)(),W=(0,v.Z)(B,2),L=W[0],w=W[1],Y=(0,a.useState)([]),K=(0,v.Z)(Y,2),q=K[0],U=K[1],oe=(0,a.useState)(0),Q=(0,v.Z)(oe,2),ve=Q[0],ie=Q[1],ue=(0,a.useState)(!1),H=(0,v.Z)(ue,2),_=H[0],z=H[1],j=(0,a.useState)([]),h=(0,v.Z)(j,2),p=h[0],S=h[1],i=(0,a.useState)([]),c=(0,v.Z)(i,2),l=c[0],y=c[1];(0,a.useEffect)(function(){function M(){return g.apply(this,arguments)}function g(){return g=(0,$.Z)((0,C.Z)().mark(function O(){var k;return(0,C.Z)().wrap(function(A){for(;;)switch(A.prev=A.next){case 0:return k={},e.values.id!=null&&(k.bomId=e.values.id,k.current=1,k.pageSize=100),A.next=4,E.getentrypage(k).then(function(ce){var se=ce.data.data;S(se)});case 4:case"end":return A.stop()}},O)})),g.apply(this,arguments)}function I(){return T.apply(this,arguments)}function T(){return T=(0,$.Z)((0,C.Z)().mark(function O(){var k;return(0,C.Z)().wrap(function(A){for(;;)switch(A.prev=A.next){case 0:return k={},k.current=1,k.pageSize=100,A.next=5,E.GetGoodstechnologypage(k).then(function(ce){var se=ce.data.data;y(se)});case 5:case"end":return A.stop()}},O)})),T.apply(this,arguments)}e.bomTechnologyModalVisible&&(M(),I())},[e.bomTechnologyModalVisible]);var re=function(g){try{g.DeviceId=e.values.key,n.default.loading("\u6B63\u5728\u6DFB\u52A0",xe),E.addBomtechnology(JSON.stringify(g)).then(function(I){return n.default.destroy(xe),I.data?(n.default.success("\u6DFB\u52A0\u6210\u529F"),u.current.reload(),!0):(n.default.error(I.errors),u.current.reload(),!1)})}catch(I){return n.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),u.current.reload(),!1}};function N(M){try{return E.updatebomtechnology(JSON.stringify(M)).then(function(g){g.data?n.default.success("\u4FEE\u6539\u6210\u529F"):n.default.error(g.errors),u.current.reload()}),!0}catch(g){return n.default.error("\u4FEE\u6539\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}var X=function(){var M=(0,$.Z)((0,C.Z)().mark(function g(I){return(0,C.Z)().wrap(function(O){for(;;)switch(O.prev=O.next){case 0:return O.prev=0,E.deletebomtechnology([I]).then(function(k){k.data?n.default.success("\u5220\u9664\u6210\u529F"):n.default.error(k.errors),u.current.reload()}),O.abrupt("return",!0);case 5:O.prev=5,O.t0=O.catch(0),n.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");case 8:case"end":return O.stop()}},g,null,[[0,5]])}));return function(I){return M.apply(this,arguments)}}(),le=[{title:"\u4E3B\u952E",dataIndex:"id",hideInSearch:!0,hideInTable:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key"},{title:"\u7269\u6599",dataIndex:"batchingName",valueType:"textarea"},{title:"\u5DE5\u827A",dataIndex:"technologyName",valueType:"textarea"},{title:"\u6B65\u9AA4",dataIndex:"sort"},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(g,I){return[(0,t.jsxs)("a",{onClick:function(){z(!0),w(I)},children:[" ","\u4FEE\u6539"]},"config"),(0,t.jsx)(Ve.Z,{type:"primary",title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:function(){X(I.id)},onCancel:function(){},children:(0,t.jsx)("a",{href:"#",children:"\u5220\u9664"})},"primary")]}}];return(0,t.jsx)(ne.Z,{title:"\u6DFB\u52A0\u914D\u65B9\u5DE5\u827A",width:940,visible:e.bomTechnologyModalVisible,bodyStyle:{padding:"32px 40px 48px"},footer:null,onCancel:function(){e.onCancel()},destroyOnClose:!0,children:(0,t.jsxs)(ye.ZP,{header:{title:"",breadcrumb:{}},children:[(0,t.jsx)(he.ZP,{headerTitle:"",actionRef:u,rowKey:"id",search:!1,toolBarRender:function(){return[(0,t.jsxs)(J.Z,{type:"primary",onClick:function(){w(void 0),z(!0)},children:[(0,t.jsx)(fe.Z,{})," \u65B0\u5EFA"]},"primary")]},request:function(){var M=(0,$.Z)((0,C.Z)().mark(function g(I){var T,O;return(0,C.Z)().wrap(function(ee){for(;;)switch(ee.prev=ee.next){case 0:return T=[],O=0,console.log(e.values),I.bomId=e.values.id,ee.next=6,E.GetBomTechnologypage(I).then(function(A){T=A.data.data,O=A.data.total,ie(O)});case 6:return ee.abrupt("return",{data:T,success:!0,total:O});case 7:case"end":return ee.stop()}},g)}));return function(g){return M.apply(this,arguments)}}(),columns:le,rowSelection:{onChange:function(g,I){U(I)}}}),(0,t.jsx)(Ne,{isbom:e.isbom,bomIds:e.bomIds,deviceKey:e.values==null?"":e.values.deviceTypeKey,DeviceId:e.values==null?"":e.values.key,onFinish:function(){var M=(0,$.Z)((0,C.Z)().mark(function g(I){var T;return(0,C.Z)().wrap(function(k){for(;;)switch(k.prev=k.next){case 0:console.log(I),T=!1,I.batchingId?T=N(I):T=re(I),T&&u.current.reload(),z(!1);case 5:case"end":return k.stop()}},g)}));return function(g){return M.apply(this,arguments)}}(),onCancel:function(){z(!1)},stockGoods:p,bomtechnoVisible:_,technologydata:l,values:L||{}})]})})},We=Ae,Ye=function(e){var b=(0,a.useState)(!1),V=(0,v.Z)(b,2),d=V[0],r=V[1],u=(0,a.useState)(!1),B=(0,v.Z)(u,2),W=B[0],L=B[1],w=(0,a.useState)(),Y=(0,v.Z)(w,2),K=Y[0],q=Y[1],U=(0,a.useRef)(),oe=(0,a.useState)([]),Q=(0,v.Z)(oe,2),ve=Q[0],ie=Q[1],ue=(0,a.useState)(),H=(0,v.Z)(ue,2),_=H[0],z=H[1],j=(0,a.useState)(),h=(0,v.Z)(j,2),p=h[0],S=h[1],i=(0,a.useState)(!1),c=(0,v.Z)(i,2),l=c[0],y=c[1],re=(0,a.useState)([]),N=(0,v.Z)(re,2),X=N[0],le=N[1],M=(0,a.useState)({}),g=(0,v.Z)(M,2),I=g[0],T=g[1],O=(0,a.useState)([]),k=(0,v.Z)(O,2),ee=k[0],A=k[1],ce=(0,a.useState)(!1),se=(0,v.Z)(ce,2),Ue=se[0],Ce=se[1];(0,a.useEffect)(function(){function D(){E.postStockGoods().then(function(m){var x=m.data;x.forEach(function(f){f.text=f.name,f.stockGoodsId=f.value}),ie(x)}),E.getbomtypepage({current:1,pagesize:1e3}).then(function(m){le(m.data.data);var x={};f(m.data.data);function f(R){for(var G in R)x[R[G].id]={text:R[G].name},R[G].children&&f(R[G].children)}T(x)})}D()},[]);function $e(D){try{return E.add(JSON.stringify(D)).then(function(m){m.data?(n.default.success("\u6DFB\u52A0\u6210\u529F"),U.current.reload()):n.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")}),!0}catch(m){return n.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}function Le(D){try{return E.update(JSON.stringify(D)).then(function(m){m.data?n.default.success("\u4FEE\u6539\u6210\u529F"):n.default.error("\u4FEE\u6539\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),U.current.reload()}),!0}catch(m){return n.default.error("\u4FEE\u6539\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}var ze=[{title:"\u4E3B\u952E",dataIndex:"id",hideInTable:!0,hideInSearch:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",render:function(m,x){return(0,t.jsx)("a",{onClick:function(){q(x),setShowDetail(!0)},children:m})}},{title:"\u914D\u65B9\u7F16\u7801",dataIndex:"code",hideInForm:!0,hideInSearch:!0},{title:"\u914D\u65B9\u540D\u79F0",dataIndex:"name",hideInForm:!0,hideInSearch:!0},{title:"\u6392\u5E8F",dataIndex:"sort",hideInForm:!0,hideInSearch:!0},{title:"\u914D\u65B9\u5206\u7C7B",dataIndex:"bomTypeList",search:!1,width:450,render:function(m,x){return(0,t.jsx)(Se.Z,{children:X.filter(function(f){var R=x.bomTypeList.find(function(te){return te===f.id}),G=X.find(function(te){return te.id===R});return G!=null||void 0}).map(function(f){return(0,t.jsx)(be.Z,{color:"#87d068",children:f.name},f.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(m,x){return[(0,t.jsx)("a",{type:"primary",onClick:function(){z(x),S(!0)},children:"\u6DFB\u52A0\u914D\u65B9\u539F\u6599"},"primary1"),(0,t.jsx)("a",{type:"primary",onClick:function(){z(x),Ce(!0)},children:"\u6DFB\u52A0\u914D\u65B9\u5DE5\u827A"},"primary1"),(0,t.jsx)("a",{type:"primary",onClick:function(){r(!0),q(x)},children:"\u66F4\u65B0"},"primary3")]}}],Ke=function(m){A(m)},Qe=function(m,x){var f=JSON.parse(JSON.stringify(ee)),R=f[x].bomMaterials.findIndex(function(G){return m.id===G.id});f[x].bomMaterials.splice(R,1),A(f)};return(0,t.jsxs)(ye.ZP,{children:[(0,t.jsx)(he.ZP,{headerTitle:"\u914D\u65B9\u5217\u8868",actionRef:U,rowKey:"id",pagination:{defaultPageSize:20},search:!1,toolBarRender:function(){return[(0,t.jsxs)(J.Z,{type:"primary",onClick:function(){return r(!0)},children:[(0,t.jsx)(fe.Z,{})," \u65B0\u589E\u914D\u65B9"]},"create")]},request:function(){var D=(0,$.Z)((0,C.Z)().mark(function m(x){var f,R;return(0,C.Z)().wrap(function(te){for(;;)switch(te.prev=te.next){case 0:return f=[],R=0,te.next=4,E.getpage(x).then(function(Ze){f=Ze.data.data,R=Ze.data.total});case 4:return te.abrupt("return",{data:f,success:!0,total:R});case 5:case"end":return te.stop()}},m)}));return function(m){return D.apply(this,arguments)}}(),columns:ze}),_&&Object.keys(_).length?(0,t.jsx)(Me,{onCancel:function(){S(!1),z({})},createModalVisible:p,values:_}):null,(0,t.jsx)(je,{bomtype:X,onFinish:function(){var D=(0,$.Z)((0,C.Z)().mark(function m(x){var f;return(0,C.Z)().wrap(function(G){for(;;)switch(G.prev=G.next){case 0:if(f=!1,!x.id){G.next=7;break}return G.next=4,Le(x);case 4:f=G.sent,G.next=10;break;case 7:return G.next=9,$e(x);case 9:f=G.sent;case 10:f&&(r(!1),q(void 0),U.current&&U.current.reload()),U.current.reload();case 12:case"end":return G.stop()}},m)}));return function(m){return D.apply(this,arguments)}}(),onCancel:function(){r(!1),q(void 0)},createModalVisible:d,values:K||{}}),(0,t.jsx)(ke,{onFinish:function(){var D=(0,$.Z)((0,C.Z)().mark(function m(x){return(0,C.Z)().wrap(function(R){for(;;)switch(R.prev=R.next){case 0:E.addBomConsumptionInfo({bomId:K.id,bomConsumptionInfo:x}).then(function(G){G.data?(y(!1),n.default.success("\u6210\u529F")):n.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")}),console.log(x);case 2:case"end":return R.stop()}},m)}));return function(m){return D.apply(this,arguments)}}(),visible:l,values:ee,onUpdateBom:Ke,onCancel:function(){y(!1)},onDeleteMate:Qe}),(0,t.jsx)(We,{bomTechnologyModalVisible:Ue,onCancel:function(){Ce(!1)},values:_||{}})]})},Je=Ye}}]);