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 rivejä
7.7 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),X=n(91894),ye=n(32157),q=n(7573),R=n(2824),u=n(39428),T=n(11849),Se=n(34792),C=n(48086),c=n(3182),_=n(49101),g=n(67294),ee=n(78009),ae=n(85224),J=n(53779),Ce=n(71194),te=n(50146),N=n(86582),$=n(48971);function we(r,t){return K.apply(this,arguments)}function K(){return K=_asyncToGenerator(_regeneratorRuntime().mark(function r(t,l){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)})),K.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,l){return(0,u.Z)().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.abrupt("return",(0,$.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 E.apply(this,arguments)}function E(){return E=(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,$.WY)("/kitchen/api/FoodMenu/AddFoodMenuGoods",{method:"POST",data:(0,T.Z)({},t)}));case 1:case"end":return e.stop()}},r)})),E.apply(this,arguments)}function ue(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,$.WY)("\u200B/kitchen/api/FoodMenu/DelFoodMenuGoods",{method:"POST",data:t}));case 1:case"end":return e.stop()}},r)})),B.apply(this,arguments)}function se(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,$.WY)("/kitchen/api/FoodMenu/tree",{data:(0,T.Z)({},t)}));case 1:case"end":return e.stop()}},r)})),W.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,$.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 o=n(85893),y=[],oe=function(t){var l=(0,g.useState)([]),e=(0,R.Z)(l,2),s=e[0],a=e[1],v=(0,g.useState)([]),I=(0,R.Z)(v,2),D=I[0],k=I[1];t.Data&&(y=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,o.jsx)(te.Z,{width:700,bodyStyle:{padding:"32px 40px 48px"},destroyOnClose:!0,title:"\u9009\u62E9\u5546\u54C1",visible:t.modalVisible,onCancel:function(){y=[],t.onCancel()},onOk:function(){var Z=(0,N.Z)(D);y=[],t.onSubmit(Z)},maskClosable:!1,children:(0,o.jsx)(J.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(F){var M,G;return(0,u.Z)().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:return M=[],G=0,w.next=4,le(F).then(function(b){M=b.data.data,G=b.data.total});case 4:return k(y),w.abrupt("return",{data:M,success:!0,total:G});case 6:case"end":return w.stop()}},Z)}));return function(Z){return m.apply(this,arguments)}}(),columns:Y,defaultSelectedRowKeys:y,rowSelection:{selectedRowKeys:D,defaultSelectedRowKeys:y,onChange:function(Z,F){a(F)},onSelect:function(Z,F){F?y=Array.from(new Set([].concat((0,N.Z)(D),[Z.id]))):y=D.filter(function(M){return M!==Z.id}),k(y)}}})})},ie=oe,de=function(){var r=(0,c.Z)((0,u.Z)().mark(function t(l){var e;return(0,u.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return e=C.default.loading("\u6B63\u5728\u6DFB\u52A0"),a.prev=1,a.next=4,re((0,T.Z)({},l)).then(function(v){if(!v.succeeded)return C.default.error(v.errors),!1});case 4:return e(),C.default.success("\u6DFB\u52A0\u6210\u529F"),a.abrupt("return",!0);case 9:return a.prev=9,a.t0=a.catch(1),e(),C.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(l){return r.apply(this,arguments)}}(),ce=function(){var r=(0,c.Z)((0,u.Z)().mark(function t(l){var e;return(0,u.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,C.default.loading("\u6B63\u5728\u5220\u9664"),e=[],l.forEach(function(v){e.push(v.id)}),a.next=6,ue(e).then(function(v){return v.data?(C.default.success("\u5220\u9664\u6210\u529F"),!0):(C.default.success("\u5220\u9664\u5931\u8D25"),!1)});case 6:a.next=12;break;case 8:return a.prev=8,a.t0=a.catch(0),C.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(l){return r.apply(this,arguments)}}(),fe=function(){var t=(0,g.useState)(),l=(0,R.Z)(t,2),e=l[0],s=l[1],a=(0,g.useRef)(),v=(0,g.useState)(),I=(0,R.Z)(v,2),D=I[0],k=I[1],Y=(0,g.useState)(),m=(0,R.Z)(Y,2),Z=m[0],F=m[1],M=(0,g.useState)(),G=(0,R.Z)(M,2),j=G[0],w=G[1],b=(0,g.useState)(),Q=(0,R.Z)(b,2),A=Q[0],pe=Q[1];(0,g.useEffect)(function(){function f(){se().then(function(i){k(i.data)})}f()},[]);var ve=[{title:"\u5546\u54C1\u540D\u79F0",dataIndex:"name"}];return(0,o.jsxs)(ee.ZP,{children:[(0,o.jsx)(J.ZP,{headerTitle:"\u5546\u54C1\u5217\u8868",actionRef:a,rowKey:"id",search:{labelWidth:120},tableRender:function(i,h){return(0,o.jsxs)("div",{style:{display:"flex",width:"100%"},children:[(0,o.jsx)(X.Z,{title:"\u83DC\u8C31\u5217\u8868",children:(0,o.jsx)(q.Z,{defaultExpandAll:!0,onSelect:function(d){return pe(d[0])},treeData:D})}),(0,o.jsx)("div",{style:{flex:1},children:h})]})},toolBarRender:function(){return[(0,o.jsxs)(H.Z,{type:"primary",onClick:function(){s(!0)},children:[(0,o.jsx)(_.Z,{})," \u9009\u62E9\u83DC\u54C1"]},"primary")]},params:{FoodMenuId:A},request:function(){var f=(0,c.Z)((0,u.Z)().mark(function i(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}});F(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()}},i)}));return function(i){return f.apply(this,arguments)}}(),columns:ve,rowSelection:{onChange:function(i,h){w(h)}}}),(j==null?void 0:j.length)>0&&(0,o.jsx)(ae.Z,{extra:(0,o.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,o.jsx)("a",{style:{fontWeight:600},children:j.length})," ","\u9879 \xA0\xA0"]}),children:(0,o.jsx)(H.Z,{onClick:(0,c.Z)((0,u.Z)().mark(function f(){var i,h;return(0,u.Z)().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.next=2,ce(j);case 2:w([]),(i=a.current)===null||i===void 0||(h=i.reloadAndRest)===null||h===void 0||h.call(i);case 4:case"end":return d.stop()}},f)})),children:"\u6279\u91CF\u5220\u9664"})}),(0,o.jsx)(ie,{onSubmit:function(){var f=(0,c.Z)((0,u.Z)().mark(function i(h){var S,d,x;return(0,u.Z)().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(typeof A!=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:A,GoodsIds:S},x=!1,p.next=10,de(d);case 10:x=p.sent,x&&(s(!1),a.current&&a.current.reload());case 12:case"end":return p.stop()}},i)}));return function(i){return f.apply(this,arguments)}}(),onCancel:function(){s(!1),a.current.reload()},Data:Z,modalVisible:e,values:A})]})},he=fe}}]);