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 regels
24 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),U=c(71577),S=c(2824),o=c(39428),Je=c(34792),h=c(48086),G=c(3182),ie=c(49101),p=c(67294),Se=c(78009),Ie=c(85224),de=c(16894),je=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),A=c(4107),tt=c(43358),B=c(34041),e=c(85893),Fe=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)(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)(A.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.jsx)(x.Z.Item,{children:(0,e.jsx)(U.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},Ge=Fe,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)(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)(A.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.jsx)(x.Z.Item,{children:(0,e.jsx)(U.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},Be=be,b=c(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"})}},we=function(t){var i=(0,p.useState)(!1),a=(0,S.Z)(i,2),C=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(k){var v=k.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(k){k.data?(h.default.success("\u6DFB\u52A0\u6210\u529F"),F.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 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(k){k.data?h.default.success("\u914D\u7F6E\u6210\u529F"):h.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),F.current.reload()}),!0}catch(k){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(k,v){return(0,e.jsx)("a",{onClick:function(){$(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",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)((0,o.Z)().mark(function k(v){var I,Z;return(0,o.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return I=[],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){I=y.data.data,Z=y.data.total});case 5:return u.abrupt("return",{data:I,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,G.Z)((0,o.Z)().mark(function k(v){var I;return(0,o.Z)().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()}},k)}));return function(k){return m.apply(this,arguments)}}(),onCancel:function(){n(!1),$(void 0)},createModalVisible:C,values:z||{}})]})},Te=we,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"})}},Ee=function(t){var i=(0,p.useState)(!1),a=(0,S.Z)(i,2),C=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)([]),k=(0,S.Z)(m,2),v=k[0],I=k[1],Z=(0,p.useState)([]),d=(0,S.Z)(Z,2),u=d[0],y=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(l){l.text=l.name,l.goodsId=l.id}),y(T)})}f();function j(){N.postStockGoods().then(function(g){var T=g.data;T.forEach(function(l){l.text=l.name,l.stockGoodsId=l.value}),oe(T)})}j();function s(){N.GetDicList("BatchingType").then(function(g){var T=g.data,l={};g.succeeded&&T.forEach(function(L){l[L.value]={text:L.remark}}),console.log(T),D(T)})}},[]);function Ce(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 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(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)((0,o.Z)().mark(function j(s){var g,T;return(0,o.Z)().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(xe){g=xe.data.data,T=xe.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:Ne}),(0,e.jsx)(Ge,{dicData:Q,stockGoodsData:Y,onFinish:function(){var f=(0,G.Z)((0,o.Z)().mark(function j(s){var g;return(0,o.Z)().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(g=!1,s.goodsId=t.values.id,s.goods_Id=t.values.id,!s.id){l.next=9;break}return l.next=6,ae(s);case 6:g=l.sent,l.next=12;break;case 9:return l.next=11,Ce(s);case 11:g=l.sent;case 12:g&&(n(!1),O(void 0),R.current&&R.current.reload());case 13:case"end":return l.stop()}},j)}));return function(j){return f.apply(this,arguments)}}(),onCancel:function(){n(!1),O(void 0)},createModalVisible:C,values:te||{}}),(0,e.jsx)(Te,{stockGoodsData:Y,onFinish:function(){var f=(0,G.Z)((0,o.Z)().mark(function j(s){var g;return(0,o.Z)().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(g=!1,s.goodsId=t.values.id,!s.id){l.next=8;break}return l.next=5,ae(s);case 5:g=l.sent,l.next=11;break;case 8:return l.next=10,Ce(s);case 10:g=l.sent;case 11:g&&(z(!1),O(void 0),R.current&&R.current.reload());case 12:case"end":return l.stop()}},j)}));return function(j){return f.apply(this,arguments)}}(),onCancel:function(){z(!1),O(void 0)},createModalVisible:V,values:te||{}})]})},De=Ee,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 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)(A.Z,{})}),(0,e.jsx)(x.Z.Item,{name:"code",hidden:!0,label:"\u5546\u54C1\u7F16\u7801",rules:[{required:!0}],children:(0,e.jsx)(A.Z,{})}),(0,e.jsx)(x.Z.Item,{name:"name",label:"\u5546\u54C1\u540D\u79F0",rules:[{required:!0}],children:(0,e.jsx)(A.Z,{})}),(0,e.jsx)(x.Z.Item,{name:"price",label:"\u5546\u54C1\u4EF7\u683C",rules:[{required:!0}],children:(0,e.jsx)(A.Z,{})}),(0,e.jsx)(x.Z.Item,{name:"imgUrl",label:"\u5546\u54C1\u56FE\u7247\u5730\u5740",rules:[{required:!0}],children:(0,e.jsx)(A.Z,{})}),(0,e.jsx)(x.Z.Item,{name:"remark",label:"\u5907\u6CE8",rules:[{required:!0}],children:(0,e.jsx)(A.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.jsx)(x.Z.Item,{children:(0,e.jsx)(U.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},Oe=Re;function Pe(r){return le.apply(this,arguments)}function le(){return le=(0,G.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,b.WY)("/kitchen/api/goods/goodss",{method:"Post",data:t}));case 1:case"end":return a.stop()}},r)})),le.apply(this,arguments)}function Me(r){return ce.apply(this,arguments)}function ce(){return ce=(0,G.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,b.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,G.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,b.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,G.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,b.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,G.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,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 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,G.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(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)((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(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)}}(),Ae=function(){var r=(0,G.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(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)}}(),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(d){var u=d.data.data;u.forEach(function(y){y.text=y.goodsType_Name,y.goodsTypeId=y.id}),C(u)})}Z()},[]);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),k=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)(Se.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 Z=(0,G.Z)((0,o.Z)().mark(function d(u){var y,P;return(0,o.Z)().wrap(function(Y){for(;;)switch(Y.prev=Y.next){case 0:return y=[],u.goodsTypeId!=null&&(u.goodsTypeId=a[u.goodsTypeId].goodsTypeId),P=0,Y.next=5,Pe(u).then(function(oe){y=oe.data.data,P=oe.data.total});case 5:return Y.abrupt("return",{data:y,success:!0,total:P});case 6:case"end":return Y.stop()}},d)}));return function(d){return Z.apply(this,arguments)}}(),columns:I,rowSelection:{onChange:function(d,u){_(u)}}}),(W==null?void 0:W.length)>0&&(0,e.jsx)(Ie.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)((0,o.Z)().mark(function Z(){var d,u;return(0,o.Z)().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:return P.next=2,Ae(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()}},Z)})),children:"\u5220\u9664"})}),(0,e.jsx)(Oe,{goodsTypaData:a,onFinish:function(){var Z=(0,G.Z)((0,o.Z)().mark(function d(u){var y;return(0,o.Z)().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:if(y=!1,!u.id){E.next=7;break}return E.next=4,ve(u);case 4:y=E.sent,E.next=10;break;case 7:return E.next=9,Ye(u);case 9:y=E.sent;case 10:y&&(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 Z.apply(this,arguments)}}(),onCancel:function(){V(!1),J(void 0)},createModalVisible:X,values:w||{}}),M&&Object.keys(M).length?(0,e.jsx)(De,{onCancel:function(){v(!0),te({})},setGoodsBomModalVisible:k,values:M}):null,(0,e.jsx)(ke.Z,{width:600,visible:q,onClose:function(){J(void 0),Q(!1)},closable:!1,children:(w==null?void 0:w.name)&&(0,e.jsx)(je.ZP,{column:2,title:w==null?void 0:w.name,request:(0,G.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:w||{}});case 1:case"end":return u.stop()}},Z)})),params:{id:w==null?void 0:w.name},columns:I})})]})},Ue=Le}}]);