|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[3174,1322],{1983:function(oe,W,u){"use strict";u.r(W),u.d(W,{default:function(){return ne}});var de=u(57663),L=u(71577),ce=u(62350),U=u(24565),T=u(2824),n=u(39428),P=u(11849),fe=u(34792),m=u(48086),f=u(3182),z=u(49101),y=u(67294),x=u(78009),Y=u(16894),pe=u(71194),H=u(50146),b=u(48971);function J(t,r){return E.apply(this,arguments)}function E(){return E=(0,f.Z)((0,n.Z)().mark(function t(r,l){return(0,n.Z)().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",(0,b.WY)("/kitchen/api/FoodMenu/GetStoreFoodMenuPage",{method:"POST",data:(0,P.Z)({},r)}));case 1:case"end":return i.stop()}},t)})),E.apply(this,arguments)}function N(t){return j.apply(this,arguments)}function j(){return j=(0,f.Z)((0,n.Z)().mark(function t(r){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,b.WY)("/kitchen/api/FoodMenu/StoreAddFoodMenu",{method:"POST",data:(0,P.Z)({},r)}));case 1:case"end":return e.stop()}},t)})),j.apply(this,arguments)}function Q(t){return D.apply(this,arguments)}function D(){return D=(0,f.Z)((0,n.Z)().mark(function t(r){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,b.WY)("\u200B/kitchen/api/FoodMenu/DelStoreFoodMenu",{method:"POST",data:r}));case 1:case"end":return e.stop()}},t)})),D.apply(this,arguments)}function X(t){return A.apply(this,arguments)}function A(){return A=(0,f.Z)((0,n.Z)().mark(function t(r){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,b.WY)("/kitchen/\u200Bapi/FoodMenu/tree",{data:(0,P.Z)({},r)}));case 1:case"end":return e.stop()}},t)})),A.apply(this,arguments)}function he(t){return B.apply(this,arguments)}function B(){return B=_asyncToGenerator(_regeneratorRuntime().mark(function t(r){return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",request("/kitchen/\u200Bapi/FoodMenu/GetStorePage",{method:"POST",data:_objectSpread({},r)}));case 1:case"end":return e.stop()}},t)})),B.apply(this,arguments)}function q(t){return G.apply(this,arguments)}function G(){return G=(0,f.Z)((0,n.Z)().mark(function t(r){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,b.WY)("/kitchen/\u200Bapi/FoodMenu/GetStoreFoodMenuFitlePage",{method:"POST",data:(0,P.Z)({},r)}));case 1:case"end":return e.stop()}},t)})),G.apply(this,arguments)}var Z=u(85893),_=function(r){var l=(0,y.useState)([]),e=(0,T.Z)(l,2),i=e[0],a=e[1],w=[{title:"\u5546\u54C1id",dataIndex:"id",tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",hideInSearch:!0,hideInTable:!0},{title:"\u95E8\u5E97\u540D\u79F0",dataIndex:"name"}];return(0,Z.jsx)(H.Z,{width:700,bodyStyle:{padding:"32px 40px 48px"},destroyOnClose:!0,title:"\u9009\u62E9\u95E8\u5E97",visible:r.modalVisible,onCancel:function(){return r.onCancel()},onOk:function(){return r.onSubmit(i)},maskClosable:!1,children:(0,Z.jsx)(Y.ZP,{headerTitle:"\u5546\u54C1\u4FE1\u606F",rowKey:"id",pagination:{defaultPageSize:20},search:!1,toolBarRender:!1,params:{FoodMenuId:r.values},request:function(){var s=(0,f.Z)((0,n.Z)().mark(function g($){var I,M;return(0,n.Z)().wrap(function(R){for(;;)switch(R.prev=R.next){case 0:return I=[],M=0,R.next=4,q($).then(function(k){I=k.data.data,M=k.data.total});case 4:return R.abrupt("return",{data:I,success:!0,total:M});case 5:case"end":return R.stop()}},g)}));return function(g){return s.apply(this,arguments)}}(),columns:w,rowSelection:{onChange:function(g,$){return a($)}}})})},ee=_,O=[],re=function(){var t=(0,f.Z)((0,n.Z)().mark(function r(l){var e;return(0,n.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(l.FoodMenuId!=null){a.next=3;break}return m.default.error("\u8BF7\u9009\u62E9\u83DC\u8C31"),a.abrupt("return",!1);case 3:return e=m.default.loading("\u6B63\u5728\u6DFB\u52A0"),a.prev=4,a.next=7,N((0,P.Z)({},l)).then(function(w){return w.succeeded?(e(),m.default.success("\u6DFB\u52A0\u6210\u529F"),!0):(m.default.error(w.errors),e(),!1)});case 7:return a.abrupt("return",!0);case 10:return a.prev=10,a.t0=a.catch(4),e(),m.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),a.abrupt("return",!1);case 15:case"end":return a.stop()}},r,null,[[4,10]])}));return function(l){return t.apply(this,arguments)}}(),ae=function(){var t=(0,f.Z)((0,n.Z)().mark(function r(l,e){var i,a;return(0,n.Z)().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,i=m.default.loading("\u6B63\u5728\u5220\u9664"),a=[],l.forEach(function(g){a.push(g.id)}),s.next=6,Q({storeIds:a,foodMenuId:e}).then(function(g){return i(),g.data?(m.default.success("\u5220\u9664\u6210\u529F"),!0):(m.default.error("\u5220\u9664\u5931\u8D25"),!1)});case 6:s.next=12;break;case 8:return s.prev=8,s.t0=s.catch(0),m.default.error("\u5220\u9664\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),s.abrupt("return",!1);case 12:case"end":return s.stop()}},r,null,[[0,8]])}));return function(l,e){return t.apply(this,arguments)}}(),te=function(){var r=(0,y.useState)(),l=(0,T.Z)(r,2),e=l[0],i=l[1],a=(0,y.useRef)(),w=(0,y.useState)(),s=(0,T.Z)(w,2),g=s[0],$=s[1],I=(0,y.useState)(),M=(0,T.Z)(I,2),ue=M[0],R=M[1],k=(0,y.useState)(),V=(0,T.Z)(k,2),S=V[0],K=V[1],se=[{title:"\u83DC\u8C31\u5217\u8868",dataIndex:"menuList",valueType:"treeSelect",hideInTable:!0,fieldProps:{options:g,value:S,onChange:function(o){K(o)}}},{title:"\u5E97\u94FA\u540D\u79F0",dataIndex:"name",search:!1},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(o,d){return[(0,Z.jsx)(U.Z,{title:"\u786E\u5B9A\u8981\u5C06\u3010".concat(d.name,"\u3011\u79FB\u51FA\u6B64\u83DC\u8C31\u5417\uFF1F"),onConfirm:function(){return le(d)},okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",children:(0,Z.jsx)("a",{children:"\u79FB\u9664\u95E8\u5E97"},"delete")})]}}],le=function(){var p=(0,f.Z)((0,n.Z)().mark(function o(d){var c,F;return(0,n.Z)().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:return v.next=2,ae([d],S);case 2:(c=a.current)===null||c===void 0||(F=c.reloadAndRest)===null||F===void 0||F.call(c);case 3:case"end":return v.stop()}},o)}));return function(d){return p.apply(this,arguments)}}();return(0,y.useEffect)(function(){function p(){X().then(function(o){var d;K((d=o.data[0])===null||d===void 0?void 0:d.key),$(o.data)})}p()},[]),(0,y.useEffect)(function(){S&&a.current&&a.current.reload()},[S]),(0,Z.jsxs)(x.ZP,{children:[(0,Z.jsx)(Y.ZP,{headerTitle:"\u5E97\u94FA\u5217\u8868",actionRef:a,rowKey:"id",search:{labelWidth:120},toolBarRender:function(){return[(0,Z.jsxs)(L.Z,{type:"primary",onClick:function(){i(!0)},children:[(0,Z.jsx)(z.Z,{})," \u9009\u62E9\u5E97\u94FA"]},"primary")]},params:{FoodMenuId:S},request:function(){var p=(0,f.Z)((0,n.Z)().mark(function o(d){var c;return(0,n.Z)().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(S){h.next=2;break}return h.abrupt("return");case 2:return c=0,h.next=5,J(d).then(function(v){O=v.data.data,c=v.data.total});case 5:return h.abrupt("return",{data:O,success:!0,total:c});case 6:case"end":return h.stop()}},o)}));return function(o){return p.apply(this,arguments)}}(),columns:se}),(0,Z.jsx)(ee,{onSubmit:function(){var p=(0,f.Z)((0,n.Z)().mark(function o(d){var c,F,h,v;return(0,n.Z)().wrap(function(C){for(;;)switch(C.prev=C.next){case 0:if(typeof S!=null){C.next=4;break}i(!1),C.next=13;break;case 4:return F=[],d.map(function(ie){F.push({StoreId:ie.id})}),h={FoodMenuId:S,StoreIds:F},v=!1,C.next=10,re(h);case 10:v=C.sent,v&&i(!1),(c=a.current)===null||c===void 0||c.reload();case 13:case"end":return C.stop()}},o)}));return function(o){return p.apply(this,arguments)}}(),UserData:O,onCancel:function(){i(!1)},modalVisible:e,values:S})]})},ne=te}}]);
|