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

  1. (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[6131],{45354:function(me,U,n){"use strict";n.r(U),n.d(U,{default:function(){return he}});var Ze=n(57663),H=n(71577),ge=n(58024),q=n(91894),ye=n(32157),_=n(7573),F=n(2824),u=n(39428),T=n(11849),Se=n(34792),g=n(48086),c=n(3182),ee=n(49101),y=n(67294),ae=n(78009),J=n(85224),N=n(16894),Ce=n(71194),te=n(50146),Q=n(86582),x=n(48971);function we(r,t){return E.apply(this,arguments)}function E(){return E=_asyncToGenerator(_regeneratorRuntime().mark(function r(t,i){return _regeneratorRuntime().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.abrupt("return",request("/kitchen/api/FoodMenu/GetFoodMenuGoodsPage",{method:"POST",data:_objectSpread({},t)}));case 1:case"end":return s.stop()}},r)})),E.apply(this,arguments)}function ne(r,t){return O.apply(this,arguments)}function O(){return O=(0,c.Z)((0,u.Z)().mark(function r(t,i){return(0,u.Z)().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.abrupt("return",(0,x.WY)("/kitchen/api/FoodMenu/GetFoodMenuGoodsPage_V2",{method:"POST",data:(0,T.Z)({},t)}));case 1:case"end":return s.stop()}},r)})),O.apply(this,arguments)}function re(r){return K.apply(this,arguments)}function K(){return K=(0,c.Z)((0,u.Z)().mark(function r(t){return(0,u.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,x.WY)("/kitchen/api/FoodMenu/AddFoodMenuGoods",{method:"POST",data:(0,T.Z)({},t)}));case 1:case"end":return e.stop()}},r)})),K.apply(this,arguments)}function ue(r){return W.apply(this,arguments)}function W(){return W=(0,c.Z)((0,u.Z)().mark(function r(t){return(0,u.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,x.WY)("\u200B/kitchen/api/FoodMenu/DelFoodMenuGoods",{method:"POST",data:t}));case 1:case"end":return e.stop()}},r)})),W.apply(this,arguments)}function se(r){return B.apply(this,arguments)}function B(){return B=(0,c.Z)((0,u.Z)().mark(function r(t){return(0,u.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,x.WY)("/kitchen/api/FoodMenu/tree",{data:(0,T.Z)({},t)}));case 1:case"end":return e.stop()}},r)})),B.apply(this,arguments)}function le(r){return V.apply(this,arguments)}function V(){return V=(0,c.Z)((0,u.Z)().mark(function r(t){return(0,u.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,x.WY)("/kitchen/api/FoodMenu/GetGoodsByMenuIdPage",{method:"POST",data:(0,T.Z)({},t)}));case 1:case"end":return e.stop()}},r)})),V.apply(this,arguments)}var l=n(85893),C=[],ie=function(t){var i=(0,y.useState)([]),e=(0,F.Z)(i,2),s=e[0],a=e[1],v=(0,y.useState)([]),$=(0,F.Z)(v,2),j=$[0],I=$[1];t.Data&&(C=t.Data.map(function(m){return m.id}));var Y=[{title:"\u5546\u54C1id",dataIndex:"id",tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",hideInSearch:!0,hideInTable:!0},{title:"\u5546\u54C1\u540D\u79F0",dataIndex:"name"}];return(0,l.jsxs)(te.Z,{width:700,bodyStyle:{padding:"32px 40px 48px"},destroyOnClose:!0,title:"\u9009\u62E9\u5546\u54C1",visible:t.modalVisible,onCancel:function(){C=[],t.onCancel()},onOk:function(){var Z=(0,Q.Z)(j);C=[],t.onSubmit(Z)},maskClosable:!1,children:[(0,l.jsx)(N.ZP,{headerTitle:"\u5546\u54C1\u4FE1\u606F",rowKey:"id",pagination:{defaultPageSize:20},search:!1,toolBarRender:!1,params:{FoodMenuId:t.values},request:function(){var m=(0,c.Z)((0,u.Z)().mark(function Z(R){var M,D;return(0,u.Z)().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:return M=[],D=0,w.next=4,le(R).then(function(k){M=k.data.data,D=k.data.total});case 4:return I(C),w.abrupt("return",{data:M,success:!0,total:D});case 6:case"end":return w.stop()}},Z)}));return function(Z){return m.apply(this,arguments)}}(),columns:Y,rowSelection:{selectedRowKeysChild:j,defaultSelectedRowKeys:C,onChange:function(Z,R){a(R)},onSelect:function(Z,R){R?C=Array.from(new Set([].concat((0,Q.Z)(j),[Z.id]))):C=j.filter(function(M){return M!==Z.id}),I(C)}}}),(s==null?void 0:s.length)>0&&(0,l.jsx)(J.Z,{extra:(0,l.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,l.jsx)("a",{style:{fontWeight:600},children:s.length})," ","\u9879 \xA0\xA0"]}),children:" "})]})},oe=ie,de=function(){var r=(0,c.Z)((0,u.Z)().mark(function t(i){var e;return(0,u.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return e=g.default.loading("\u6B63\u5728\u6DFB\u52A0"),a.prev=1,a.next=4,re((0,T.Z)({},i)).then(function(v){if(!v.succeeded)return g.default.error(v.errors),!1});case 4:return e(),g.default.success("\u6DFB\u52A0\u6210\u529F"),a.abrupt("return",!0);case 9:return a.prev=9,a.t0=a.catch(1),e(),g.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),a.abrupt("return",!1);case 14:case"end":return a.stop()}},t,null,[[1,9]])}));return function(i){return r.apply(this,arguments)}}(),ce=function(){var r=(0,c.Z)((0,u.Z)().mark(function t(i){var e;return(0,u.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,g.default.loading("\u6B63\u5728\u5220\u9664"),e=[],i.forEach(function(v){e.push(v.id)}),a.next=6,ue(e).then(function(v){return g.default.destroy(),v.data?(g.default.success("\u5220\u9664\u6210\u529F"),!0):(g.default.success("\u5220\u9664\u5931\u8D25"),!1)});case 6:a.next=12;break;case 8:return a.prev=8,a.t0=a.catch(0),g.default.error("\u5220\u9664\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),a.abrupt("return",!1);case 12:case"end":return a.stop()}},t,null,[[0,8]])}));return function(i){return r.apply(this,arguments)}}(),fe=function(){var t=(0,y.useState)(),i=(0,F.Z)(t,2),e=i[0],s=i[1],a=(0,y.useRef)(),v=(0,y.useState)(),$=(0,F.Z)(v,2),j=$[0],I=$[1],Y=(0,y.useState)(),m=(0,F.Z)(Y,2),Z=m[0],R=m[1],M=(0,y.useState)(),D=(0,F.Z)(M,2),G=D[0],w=D[1],k=(0,y.useState)(),X=(0,F.Z)(k,2),b=X[0],pe=X[1];(0,y.useEffect)(function(){function f(){se().then(function(o){I(o.data)})}f()},[]);var ve=[{title:"\u5546\u54C1\u540D\u79F0",dataIndex:"name"}];return(0,l.jsxs)(ae.ZP,{children:[(0,l.jsx)(N.ZP,{headerTitle:"\u5546\u54C1\u5217\u8868",actionRef:a,rowKey:"id",search:{labelWidth:120},tableRender:function(o,h){return(0,l.jsxs)("div",{style:{display:"flex",width:"100%"},children:[(0,l.jsx)(q.Z,{title:"\u83DC\u8C31\u5217\u8868",children:(0,l.jsx)(_.Z,{defaultExpandAll:!0,onSelect:function(d){return pe(d[0])},treeData:j})}),(0,l.jsx)("div",{style:{flex:1},children:h})]})},toolBarRender:function(){return[(0,l.jsxs)(H.Z,{type:"primary",onClick:function(){s(!0)},children:[(0,l.jsx)(ee.Z,{})," \u9009\u62E9\u83DC\u54C1"]},"primary")]},params:{FoodMenuId:b},request:function(){var f=(0,c.Z)((0,u.Z)().mark(function o(h){var S,d;return(0,u.Z)().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:return S=[],d=0,P.next=4,ne(h).then(function(p){var L=p.data.data.map(function(z){return console.log(z),{id:z.goodid,name:z.name}});R(L),S=p.data.data,d=p.data.total});case 4:return P.abrupt("return",{data:S,success:!0,total:d});case 5:case"end":return P.stop()}},o)}));return function(o){return f.apply(this,arguments)}}(),columns:ve,rowSelection:{onChange:function(o,h){w(h)}}}),(G==null?void 0:G.length)>0&&(0,l.jsx)(J.Z,{extra:(0,l.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,l.jsx)("a",{style:{fontWeight:600},children:G.length})," ","\u9879 \xA0\xA0"]}),children:(0,l.jsx)(H.Z,{onClick:(0,c.Z)((0,u.Z)().mark(function f(){var o,h;return(0,u.Z)().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.next=2,ce(G);case 2:w([]),(o=a.current)===null||o===void 0||(h=o.reloadAndRest)===null||h===void 0||h.call(o);case 4:case"end":return d.stop()}},f)})),children:"\u6279\u91CF\u5220\u9664"})}),(0,l.jsx)(oe,{onSubmit:function(){var f=(0,c.Z)((0,u.Z)().mark(function o(h){var S,d,A;return(0,u.Z)().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(typeof b!=null){p.next=4;break}s(!1),p.next=12;break;case 4:return S=[],h.map(function(L){S.push({GoodsId:L})}),d={FoodMenuId:b,GoodsIds:S},A=!1,p.next=10,de(d);case 10:A=p.sent,A&&(s(!1),a.current&&a.current.reload());case 12:case"end":return p.stop()}},o)}));return function(o){return f.apply(this,arguments)}}(),onCancel:function(){s(!1),a.current.reload()},Data:Z,modalVisible:e,values:b})]})},he=fe}}]);