Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

2 Zeilen
24 KiB

  1. (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[6291],{82983:function(Qe,ge,l){"use strict";l.r(ge),l.d(ge,{default:function(){return Ne}});var Ke=l(57338),Ze=l(25084),Je=l(57663),U=l(71577),S=l(2824),He=l(34792),h=l(48086),G=l(3182),Se=l(94043),o=l.n(Se),ie=l(49101),p=l(67294),Ie=l(78009),je=l(85224),de=l(16894),Fe=l(12826),Xe=l(71194),ne=l(50146),qe=l(77576),ye=l(12028),_e=l(77883),Ce=l(85482),et=l(9715),k=l(86835),tt=l(47673),A=l(4107),at=l(43358),B=l(34041),e=l(85893),Ge=function(t){var i=B.Z.Option,a=B.Z.OptGroup;return(0,e.jsx)(ne.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)(k.Z,{layout:"vertical",preserve:!1,initialValues:t.values,onFinish:t.onFinish,children:[(0,e.jsx)(k.Z.Item,{name:"id",hidden:!0,children:(0,e.jsx)(A.Z,{})}),(0,e.jsx)(k.Z.Item,{name:"stockGoodsCode",label:"\u539F\u6599\u540D\u79F0",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u539F\u6599\u540D\u79F0"}],children:(0,e.jsx)(B.Z,{placeholder:"\u8BF7\u9009\u62E9\u539F\u6599\u540D\u79F0",children:t.stockGoodsData.map(function(x,n){return(0,e.jsx)(B.Z.Option,{index:n,value:x.id,children:x.name},x.id)})})}),(0,e.jsx)(k.Z.Item,{name:"bomQty",label:"\u914D\u65B9\u7528\u91CF",defaultValue:t.values.bomQty,children:(0,e.jsx)(Ce.Z,{placeholder:"\u914D\u65B9\u7528\u91CF",min:0})}),(0,e.jsx)(k.Z.Item,{name:"isMain",label:"\u4E3B\u8981\u539F\u6599",children:(0,e.jsx)(ye.Z,{checkedChildren:"\u5426",unCheckedChildren:"\u662F",defaultChecked:!0})}),(0,e.jsx)(k.Z.Item,{name:"isReplace",label:"\u662F\u5426\u53EF\u4EE5\u66FF\u6362",children:(0,e.jsx)(ye.Z,{checkedChildren:"\u5426",unCheckedChildren:"\u662F",defaultChecked:!0})}),(0,e.jsx)(k.Z.Item,{children:(0,e.jsx)(U.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},be=Ge,Be=function(t){var i=B.Z.Option,a=B.Z.OptGroup;return(0,e.jsx)(ne.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)(k.Z,{layout:"vertical",preserve:!1,initialValues:t.values,onFinish:t.onFinish,children:[(0,e.jsx)(k.Z.Item,{name:"id",hidden:!0,children:(0,e.jsx)(A.Z,{})}),(0,e.jsx)(k.Z.Item,{name:"itemId",label:"\u539F\u6599\u540D\u79F0",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u539F\u6599\u540D\u79F0"}],children:(0,e.jsx)(B.Z,{disabled:!!t.values.id,placeholder:"\u8BF7\u9009\u62E9\u539F\u6599\u540D\u79F0",children:t.stockGoodsData.map(function(x,n){return(0,e.jsx)(B.Z.Option,{index:n,value:x.id,children:x.name},x.id)})})}),(0,e.jsx)(k.Z.Item,{name:"price",label:"\u4EF7\u683C",defaultValue:t.values.price,children:(0,e.jsx)(Ce.Z,{placeholder:"\u4EF7\u683C",min:0})}),(0,e.jsx)(k.Z.Item,{children:(0,e.jsx)(U.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},we=Be,b=l(48971),re={goodsBoms:function(t){return(0,b.WY)("/kitchen/api/GoodsBom/GetBomReplac",{method:"Post",data:t})},updateGoodsBom:function(t){return(0,b.WY)("/kitchen/api/GoodsBom/EditReplac",{method:"PUT",data:t})},addGoodsBom:function(t){return(0,b.WY)("/kitchen/api/GoodsBom/AddReplac",{method:"POST",data:t})},goodList:function(t){return(0,b.WY)("/kitchen/api/goods/goodss",{method:"Post",data:t})},postStockGoods:function(){return(0,b.WY)("/kitchen/api/frachisee-stock-adjust/product-list",{method:"Get"})}},Te=function(t){var i=(0,p.useState)(!1),a=(0,S.Z)(i,2),x=a[0],n=a[1],F=(0,p.useRef)(),X=(0,p.useState)(),V=(0,S.Z)(X,2),z=V[0],$=V[1],q=(0,p.useState)([]),Q=(0,S.Z)(q,2),D=Q[0],ue=Q[1],K=(0,p.useState)([]),w=(0,S.Z)(K,2),J=w[0],se=w[1],H=(0,p.useState)([]),W=(0,S.Z)(H,2),_=W[0],R=W[1];(0,p.useEffect)(function(){function m(){re.postStockGoods().then(function(Z){var v=Z.data;v.forEach(function(I){I.text=I.name,I.stockGoodsId=I.id}),R(v)})}m()},[]);function ee(m){try{return re.addGoodsBom({itemId:m.itemId,price:m.price,goodsbomId:t.values.id,replaceId:t.values.stockGoodsCode}).then(function(Z){Z.data?(h.default.success("\u6DFB\u52A0\u6210\u529F"),F.current.reload()):h.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")}),!0}catch(Z){return h.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}function M(m){console.log("\u4F20\u53C2\u6570\u636E",m);try{return re.updateGoodsBom({id:m.id,status:m.status,itemId:m.itemId,price:m.price,goodsbomId:t.values.id,replaceId:t.values.stockGoodsCode}).then(function(Z){Z.data?h.default.success("\u914D\u7F6E\u6210\u529F"):h.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),F.current.reload()}),!0}catch(Z){return h.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}function te(){if(!D)return!0;try{return re.removeGoodsBom(D.map(function(m){return m.id})).then(function(m){m.data?h.default.success("\u5220\u9664\u6210\u529F\uFF0C\u5373\u5C06\u5237\u65B0"):h.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),F.current.reload()}),!0}catch(m){return h.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),!1}}var O=[{title:"\u4E3B\u952E",dataIndex:"id",hideInTable:!0,hideInSearch:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",render:function(Z,v){return(0,e.jsx)("a",{onClick:function(){$(v),setShowDetail(!0)},children:Z})}},{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(Z,v){return[v.status===0&&(0,e.jsx)("a",{onClick:function(){v.status="1",M(v)},children:"\u505C\u7528"},"link"),(v.status===1||v.status===2)&&(0,e.jsx)("a",{onClick:function(){v.status="0",M(v)},children:"\u542F\u7528"},"warn"),(0,e.jsx)("a",{type:"primary",onClick:function(){$(v),n(!0)},children:"\u66F4\u65B0"},"primary")]}}];return(0,e.jsxs)(ne.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)(de.ZP,{headerTitle:"\u66FF\u6362\u7269\u6599\u5217\u8868",actionRef:F,rowKey:"id",pagination:{defaultPageSize:20},search:!1,toolBarRender:function(){return[(0,e.jsxs)(U.Z,{type:"primary",onClick:function(){return n(!0)},children:[(0,e.jsx)(ie.Z,{})," \u65B0\u589E\u914D\u65B9\u66FF\u6362\u7269\u6599"]},"create")]},request:function(){var m=(0,G.Z)(o().mark(function Z(v){var I,y;return o().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return I=[],y=0,t.values.id!=null&&(v.goodsbomId=t.values.id,v.replaceId=t.values.stockGoodsCode),u.next=5,re.goodsBoms(v).then(function(C){I=C.data.data,y=C.data.total});case 5:return u.abrupt("return",{data:I,success:!0,total:y});case 6:case"end":return u.stop()}},Z)}));return function(Z){return m.apply(this,arguments)}}(),columns:O}),(0,e.jsx)(we,{stockGoodsData:_,onFinish:function(){var m=(0,G.Z)(o().mark(function Z(v){var I;return o().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(I=!1,!v.id){d.next=7;break}return d.next=4,M(v);case 4:I=d.sent,d.next=10;break;case 7:return d.next=9,ee(v);case 9:I=d.sent;case 10:I&&(n(!1),$(void 0),F.current&&F.current.reload());case 11:case"end":return d.stop()}},Z)}));return function(Z){return m.apply(this,arguments)}}(),onCancel:function(){n(!1),$(void 0)},createModalVisible:x,values:z||{}})]})},Ee=Te,N={goodsBoms:function(t){return(0,b.WY)("/kitchen/api/goods-bom/goods-boms",{method:"Post",data:t})},GetDicList:function(t){return(0,b.WY)("/kitchen/api/dict-data/dic-list/".concat(t),{method:"Get"})},updateGoodsBom:function(t){return(0,b.WY)("/kitchen/api/goods-bom",{method:"PUT",data:t})},addGoodsBom:function(t){return(0,b.WY)("/kitchen/api/goods-bom",{method:"POST",data:t})},removeGoodsBom:function(t){return(0,b.WY)("/kitchen/api/goods-bom",{method:"DELETE",data:t})},goodList:function(t){return(0,b.WY)("/kitchen/api/goods/goodss",{method:"Post",data:t})},postStockGoods:function(){return(0,b.WY)("/kitchen/api/frachisee-stock-adjust/product-list",{method:"Get"})}},De=function(t){var i=(0,p.useState)(!1),a=(0,S.Z)(i,2),x=a[0],n=a[1],F=(0,p.useState)(!1),X=(0,S.Z)(F,2),V=X[0],z=X[1],$=(0,p.useState)([]),q=(0,S.Z)($,2),Q=q[0],D=q[1],ue=(0,p.useState)([]),K=(0,S.Z)(ue,2),w=K[0],J=K[1],se=(0,p.useState)(!1),H=(0,S.Z)(se,2),W=H[0],_=H[1],R=(0,p.useRef)(),ee=(0,p.useState)(),M=(0,S.Z)(ee,2),te=M[0],O=M[1],m=(0,p.useState)([]),Z=(0,S.Z)(m,2),v=Z[0],I=Z[1],y=(0,p.useState)([]),d=(0,S.Z)(y,2),u=d[0],C=d[1],P=(0,p.useState)([]),E=(0,S.Z)(P,2),Y=E[0],oe=E[1];(0,p.useEffect)(function(){function f(){N.goodList({current:1,pageSize:20,status:"0"}).then(function(g){var T=g.data.data;T.forEach(function(c){c.text=c.name,c.goodsId=c.id}),C(T)})}f();function j(){N.postStockGoods().then(function(g){var T=g.data;T.forEach(function(c){c.text=c.name,c.stockGoodsId=c.value}),oe(T)})}j();function s(){N.GetDicList("BatchingType").then(function(g){var T=g.data,c={};g.succeeded&&T.forEach(function(L){c[L.value]={text:L.remark}}),console.log(T),D(T)})}},[]);function xe(f){try{return N.addGoodsBom(JSON.stringify(f)).then(function(j){j.data?(h.default.success("\u6DFB\u52A0\u6210\u529F"),R.current.reload()):h.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")}),!0}catch(j){return h.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}function ae(f){console.log(f);try{return N.updateGoodsBom({id:f.id,goodsID:f.goods_Id,stockGoodsCode:f.stockGoodsCode,remark:f.remark,status:f.status,batchingType:f.batchingType,isReplace:f.isReplace,isMain:f.isMain,bomQty:f.bomQty}).then(function(j){j.data?h.default.success("\u914D\u7F6E\u6210\u529F"):h.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),R.current.reload()}),!0}catch(j){return h.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}function rt(){if(!v)return!0;try{return N.removeGoodsBom(v.map(function(f){return f.id})).then(function(f){f.data?h.default.success("\u5220\u9664\u6210\u529F\uFF0C\u5373\u5C06\u5237\u65B0"):h.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),R.current.reload()}),!0}catch(f){return h.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),!1}}var ze=[{title:"\u4E3B\u952E",dataIndex:"id",hideInTable:!0,hideInSearch:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",render:function(j,s){return(0,e.jsx)("a",{onClick:function(){O(s),_(!0)},children:j})}},{title:"\u539F\u6599\u540D\u79F0",dataIndex:"stockGoodsName",hideInForm:!0,hideInSearch:!0},{title:"\u539F\u6599\u540D\u79F0",dataIndex:"stockGoodsCode",hideInForm:!0,hideInTable:!0,valueType:"select",valueEnum:Y},{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:"\u4E3B\u8981\u539F\u6599",dataIndex:"isMain",hideInForm:!0,valueEnum:{false:{text:"\u8F85\u6599",status:"Processing"},true:{text:"\u4E3B\u6599",status:"Success"}}},{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:"\u521B\u5EFA\u65F6\u95F4",dataIndex:"createAt",valueType:"date"},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(j,s){return[s.status==="0"&&(0,e.jsx)("a",{onClick:function(){s.status="1",ae(s)},children:"\u505C\u7528"},"link"),(s.status==="1"||s.status==="2")&&(0,e.jsx)("a",{onClick:function(){s.status="0",ae(s)},children:"\u542F\u7528"},"warn"),s.status==="0"&&s.isReplace&&(0,e.jsx)("a",{onClick:function(){s.isReplace=!1,ae(s)},children:"\u4E0D\u542F\u7528"},"link"),s.status==="0"&&!s.isReplace&&(0,e.jsx)("a",{onClick:function(){s.isReplace=!0,ae(s)},children:"\u542F\u7528\u66FF\u6362"},"warn"),s.status==="0"&&s.isReplace&&(0,e.jsx)("a",{onClick:function(){z(!0),O(s)},children:"\u66FF\u6362\u7269\u6599"},"link"),(0,e.jsx)("a",{onClick:function(){n(!0),O(s)},children:"\u4FEE\u6539"},"link")]}}];return(0,e.jsxs)(ne.Z,{width:1200,bodyStyle:{padding:"32px 40px 48px"},destroyOnClose:!0,title:"\u5546\u54C1\u914D\u65B9",visible:t.setGoodsBomModalVisible,footer:!1,onCancel:function(){return t.onCancel()},maskClosable:!1,children:[(0,e.jsx)(de.ZP,{headerTitle:"\u5546\u54C1\u914D\u65B9\u4FE1\u606F\u67E5\u8BE2",actionRef:R,rowKey:"id",pagination:{defaultPageSize:20},search:!1,toolBarRender:function(){return[(0,e.jsxs)(U.Z,{type:"primary",onClick:function(){return n(!0)},children:[(0,e.jsx)(ie.Z,{})," \u65B0\u589E\u5546\u54C1\u914D\u65B9"]},"create")]},request:function(){var f=(0,G.Z)(o().mark(function j(s){var g,T;return o().wrap(function(L){for(;;)switch(L.prev=L.next){case 0:return g=[],T=0,t.values.id!=null&&(s.goodsId=t.values.id),L.next=5,N.goodsBoms(s).then(function(ke){g=ke.data.data,T=ke.data.total});case 5:return L.abrupt("return",{data:g,success:!0,total:T});case 6:case"end":return L.stop()}},j)}));return function(j){return f.apply(this,arguments)}}(),columns:ze}),(0,e.jsx)(be,{dicData:Q,stockGoodsData:Y,onFinish:function(){var f=(0,G.Z)(o().mark(function j(s){var g;return o().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(g=!1,s.goodsId=t.values.id,s.goods_Id=t.values.id,!s.id){c.next=9;break}return c.next=6,ae(s);case 6:g=c.sent,c.next=12;break;case 9:return c.next=11,xe(s);case 11:g=c.sent;case 12:g&&(n(!1),O(void 0),R.current&&R.current.reload());case 13:case"end":return c.stop()}},j)}));return function(j){return f.apply(this,arguments)}}(),onCancel:function(){n(!1),O(void 0)},createModalVisible:x,values:te||{}}),(0,e.jsx)(Ee,{stockGoodsData:Y,onFinish:function(){var f=(0,G.Z)(o().mark(function j(s){var g;return o().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(g=!1,s.goodsId=t.values.id,!s.id){c.next=8;break}return c.next=5,ae(s);case 5:g=c.sent,c.next=11;break;case 8:return c.next=10,xe(s);case 10:g=c.sent;case 11:g&&(z(!1),O(void 0),R.current&&R.current.reload());case 12:case"end":return c.stop()}},j)}));return function(j){return f.apply(this,arguments)}}(),onCancel:function(){z(!1),O(void 0)},createModalVisible:V,values:te||{}})]})},Re=De,Oe=function(t){var i=B.Z.Option,a=B.Z.OptGroup;return(0,e.jsx)(ne.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)(k.Z,{labelCol:{span:4},layout:"horizontal",preserve:!1,initialValues:t.values,onFinish:t.onFinish,children:[(0,e.jsx)(k.Z.Item,{name:"id",hidden:!0,children:(0,e.jsx)(A.Z,{})}),(0,e.jsx)(k.Z.Item,{name:"code",hidden:!0,label:"\u5546\u54C1\u7F16\u7801",rules:[{required:!0}],children:(0,e.jsx)(A.Z,{})}),(0,e.jsx)(k.Z.Item,{name:"name",label:"\u5546\u54C1\u540D\u79F0",rules:[{required:!0}],children:(0,e.jsx)(A.Z,{})}),(0,e.jsx)(k.Z.Item,{name:"price",label:"\u5546\u54C1\u4EF7\u683C",rules:[{required:!0}],children:(0,e.jsx)(A.Z,{})}),(0,e.jsx)(k.Z.Item,{name:"imgUrl",label:"\u5546\u54C1\u56FE\u7247\u5730\u5740",rules:[{required:!0}],children:(0,e.jsx)(A.Z,{})}),(0,e.jsx)(k.Z.Item,{name:"remark",label:"\u5907\u6CE8",rules:[{required:!0}],children:(0,e.jsx)(A.Z,{})}),(0,e.jsx)(k.Z.Item,{name:"goodsTypeId",label:"\u5546\u54C1\u7C7B\u578B",rules:[{required:!0}],children:(0,e.jsx)(B.Z,{children:t.goodsTypaData==null?"":t.goodsTypaData.map(function(x,n){return(0,e.jsx)(B.Z.Option,{index:n,value:x.id,children:x.goodsType_Name},x.id)})})}),(0,e.jsx)(k.Z.Item,{name:"status",label:"\u72B6\u6001",defaultValue:t.values.status,rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u72B6\u6001"}],children:(0,e.jsx)(B.Z,{placeholder:"\u8BF7\u9009\u62E9\u72B6\u6001",children:(0,e.jsxs)(a,{children:[(0,e.jsx)(B.Z.Option,{value:0,children:"\u6B63\u5E38"}),(0,e.jsx)(B.Z.Option,{value:1,children:"\u505C\u7528"})]})})}),(0,e.jsx)(k.Z.Item,{children:(0,e.jsx)(U.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},Pe=Oe;function Me(r){return le.apply(this,arguments)}function le(){return le=(0,G.Z)(o().mark(function r(t){return o().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,b.WY)("/kitchen/api/goods/goodss",{method:"Post",data:t}));case 1:case"end":return a.stop()}},r)})),le.apply(this,arguments)}function Ve(r){return ce.apply(this,arguments)}function ce(){return ce=(0,G.Z)(o().mark(function r(t){return o().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,b.WY)("/kitchen/api/goods",{method:"POST",data:t}));case 1:case"end":return a.stop()}},r)})),ce.apply(this,arguments)}function $e(r){return fe.apply(this,arguments)}function fe(){return fe=(0,G.Z)(o().mark(function r(t){return o().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return console.log("\u5546\u54C1\u6570\u636E\u4FEE\u6539",t),a.abrupt("return",(0,b.WY)("/kitchen/api/goods",{method:"PUT",data:t}));case 2:case"end":return a.stop()}},r)})),fe.apply(this,arguments)}function We(r){return he.apply(this,arguments)}function he(){return he=(0,G.Z)(o().mark(function r(t){return o().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,b.WY)("/kitchen/api/goods",{method:"DELETE",data:t}));case 1:case"end":return a.stop()}},r)})),he.apply(this,arguments)}function Ye(r){return me.apply(this,arguments)}function me(){return me=(0,G.Z)(o().mark(function r(t){return o().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,b.WY)("/kitchen/api/goods-type/goods-types",{method:"POST",data:t}));case 1:case"end":return a.stop()}},r)})),me.apply(this,arguments)}function nt(r){return pe.apply(this,arguments)}function pe(){return pe=_asyncToGenerator(_regeneratorRuntime.mark(function r(t){return _regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",request("/kitchen/api/goods/push-good/".concat(t),{method:"Get"}));case 1:case"end":return a.stop()}},r)})),pe.apply(this,arguments)}var Ae=function(){var r=(0,G.Z)(o().mark(function t(i){var a;return o().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return console.log("fields",i),a=h.default.loading("\u6B63\u5728\u6DFB\u52A0"),i.createBy="admin",n.prev=3,n.next=6,Ve(JSON.stringify(i)).then(function(F){F.data?h.default.success("\u6DFB\u52A0\u6210\u529F"):h.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")});case 6:return a(),n.abrupt("return",!0);case 10:return n.prev=10,n.t0=n.catch(3),a(),h.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),n.abrupt("return",!1);case 15:case"end":return n.stop()}},t,null,[[3,10]])}));return function(i){return r.apply(this,arguments)}}(),ve=function(){var r=(0,G.Z)(o().mark(function t(i){var a;return o().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return a=h.default.loading("\u6B63\u5728\u914D\u7F6E"),n.prev=1,n.next=4,$e({id:i.id,code:i.code,name:i.name,price:i.price,imgUrl:i.imgUrl,remark:i.remark,status:i.status,goodsTypeId:i.goodsTypeId}).then(function(F){F.data?h.default.success("\u914D\u7F6E\u6210\u529F"):h.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")});case 4:return n.abrupt("return",!0);case 7:return n.prev=7,n.t0=n.catch(1),a(),n.abrupt("return",!1);case 11:case"end":return n.stop()}},t,null,[[1,7]])}));return function(i){return r.apply(this,arguments)}}(),Le=function(){var r=(0,G.Z)(o().mark(function t(i){var a;return o().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(a=h.default.loading("\u6B63\u5728\u5220\u9664"),i){n.next=3;break}return n.abrupt("return",!0);case 3:return n.prev=3,n.next=6,We(i.map(function(F){return F.id})).then(function(F){a(),F.data?h.default.success("\u5220\u9664\u6210\u529F\uFF0C\u5373\u5C06\u5237\u65B0"):h.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")});case 6:return n.abrupt("return",!0);case 9:return n.prev=9,n.t0=n.catch(3),a(),h.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),n.abrupt("return",!1);case 14:case"end":return n.stop()}},t,null,[[3,9]])}));return function(i){return r.apply(this,arguments)}}(),Ue=function(){var t=(0,p.useState)([]),i=(0,S.Z)(t,2),a=i[0],x=i[1];(0,p.useEffect)(function(){function y(){Ye({current:1,pageSize:20}).then(function(d){var u=d.data.data;u.forEach(function(C){C.text=C.goodsType_Name,C.goodsTypeId=C.id}),x(u)})}y()},[]);var n=(0,p.useState)(!1),F=(0,S.Z)(n,2),X=F[0],V=F[1],z=(0,p.useState)(!1),$=(0,S.Z)(z,2),q=$[0],Q=$[1],D=(0,p.useRef)(),ue=(0,p.useState)(),K=(0,S.Z)(ue,2),w=K[0],J=K[1],se=(0,p.useState)([]),H=(0,S.Z)(se,2),W=H[0],_=H[1],R=(0,p.useState)(),ee=(0,S.Z)(R,2),M=ee[0],te=ee[1],O=(0,p.useState)(),m=(0,S.Z)(O,2),Z=m[0],v=m[1],I=[{title:"\u4E3B\u952E",dataIndex:"id",hideInTable:!0,hideInSearch:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",render:function(d,u){return(0,e.jsx)("a",{onClick:function(){J(u),Q(!0)},children:d})}},{title:"\u7F16\u7801",dataIndex:"code",valueType:"textarea"},{title:"\u540D\u79F0",dataIndex:"name",valueType:"textarea"},{title:"\u57FA\u7840\u4EF7\u683C",dataIndex:"price",hideInForm:!0,renderText:function(d){return"".concat(d,"\xA5")}},{title:"\u5546\u54C1\u7C7B\u578B",dataIndex:"goodsTypeName",hideInForm:!0,hideInSearch:!0},{title:"\u5546\u54C1\u7C7B\u578B",dataIndex:"goodsTypeId",hideInForm:!0,hideInTable:!0,valueEnum:a},{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:"\u521B\u5EFA\u65F6\u95F4",dataIndex:"createAt",valueType:"date"},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(d,u){return[(0,e.jsx)("a",{type:"primary",onClick:function(){V(!0),J(u)},children:"\u66F4\u65B0"},"primary"),u.status===0&&(0,e.jsx)("a",{onClick:function(){v(!0),te(u)},children:"\u5546\u54C1\u914D\u65B9"},"config"),(u.status===1||u.status===2)&&(0,e.jsx)("a",{onClick:function(){u.status="0",ve(u),D.current.reload()},children:"\u542F\u7528"},"warn")]}}];return(0,e.jsxs)(Ie.ZP,{children:[(0,e.jsx)(de.ZP,{headerTitle:"\u67E5\u8BE2\u8868\u683C",actionRef:D,rowKey:"id",search:{labelWidth:120},toolBarRender:function(){return[(0,e.jsxs)(U.Z,{type:"primary",onClick:function(){V(!0)},children:[(0,e.jsx)(ie.Z,{})," \u65B0\u5EFA"]},"primary")]},request:function(){var y=(0,G.Z)(o().mark(function d(u){var C,P;return o().wrap(function(Y){for(;;)switch(Y.prev=Y.next){case 0:return C=[],u.goodsTypeId!=null&&(u.goodsTypeId=a[u.goodsTypeId].goodsTypeId),P=0,Y.next=5,Me(u).then(function(oe){C=oe.data.data,P=oe.data.total});case 5:return Y.abrupt("return",{data:C,success:!0,total:P});case 6:case"end":return Y.stop()}},d)}));return function(d){return y.apply(this,arguments)}}(),columns:I,rowSelection:{onChange:function(d,u){_(u)}}}),(W==null?void 0:W.length)>0&&(0,e.jsx)(je.Z,{extra:(0,e.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,e.jsx)("a",{style:{fontWeight:600},children:W.length})," ","\u9879 \xA0\xA0"]}),children:(0,e.jsx)(U.Z,{onClick:(0,G.Z)(o().mark(function y(){var d,u;return o().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:return P.next=2,Le(W);case 2:_([]),(d=D.current)===null||d===void 0||(u=d.reloadAndRest)===null||u===void 0||u.call(d);case 4:case"end":return P.stop()}},y)})),children:"\u5220\u9664"})}),(0,e.jsx)(Pe,{goodsTypaData:a,onFinish:function(){var y=(0,G.Z)(o().mark(function d(u){var C;return o().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:if(C=!1,!u.id){E.next=7;break}return E.next=4,ve(u);case 4:C=E.sent,E.next=10;break;case 7:return E.next=9,Ae(u);case 9:C=E.sent;case 10:C&&(V(!1),J(void 0),D.current&&D.current.reload()),D.current.reload();case 12:case"end":return E.stop()}},d)}));return function(d){return y.apply(this,arguments)}}(),onCancel:function(){V(!1),J(void 0)},createModalVisible:X,values:w||{}}),M&&Object.keys(M).length?(0,e.jsx)(Re,{onCancel:function(){v(!0),te({})},setGoodsBomModalVisible:Z,values:M}):null,(0,e.jsx)(Ze.Z,{width:600,visible:q,onClose:function(){J(void 0),Q(!1)},closable:!1,children:(w==null?void 0:w.name)&&(0,e.jsx)(Fe.ZP,{column:2,title:w==null?void 0:w.name,request:(0,G.Z)(o().mark(function y(){return o().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",{data:w||{}});case 1:case"end":return u.stop()}},y)})),params:{id:w==null?void 0:w.name},columns:I})})]})},Ne=Ue}}]);