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
25 KiB

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