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