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 lines
21 KiB

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