Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 

2 рядки
12 KiB

  1. (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[5523,1322],{72887:function(re,P,t){"use strict";t.r(P),t.d(P,{default:function(){return Se}});var Q=t(57663),O=t(71577),k=t(2824),a=t(39428),j=t(34792),u=t(48086),o=t(3182),w=t(67294),E=t(78009),V=t(85224),$=t(49101),b=t(16894),W=t(71194),X=t(50146),je=t(9715),R=t(55843),Ae=t(47673),B=t(4107),Ge=t(43358),q=t(34041),ae=t(51496),s=t(85893),te=function(r){var h=q.Z.Option,e=q.Z.OptGroup;return(0,s.jsx)(X.Z,{title:r.values.id?"\u7F16\u8F91":"\u65B0\u5EFA",width:640,visible:r.createModalVisible,bodyStyle:{padding:"32px 40px 48px"},footer:null,onCancel:function(){r.onCancel()},destroyOnClose:!0,children:(0,s.jsxs)(R.Z,{layout:"vertical",preserve:!1,initialValues:r.values,onFinish:r.onFinish,children:[(0,s.jsx)(R.Z.Item,{name:"id",hidden:!0,children:(0,s.jsx)(B.Z,{})}),(0,s.jsx)(R.Z.Item,{label:"\u83DC\u8C31\u7F16\u7801",name:"code",initialValue:(0,ae.x0)(20),rules:[{required:!0,max:20}],children:(0,s.jsx)(B.Z,{})}),(0,s.jsx)(R.Z.Item,{label:"\u83DC\u8C31\u540D\u79F0",name:"name",rules:[{required:!0,max:20}],children:(0,s.jsx)(B.Z,{})}),(0,s.jsx)(R.Z.Item,{label:"\u6392\u5E8F",name:"sort",rules:[{required:!0}],children:(0,s.jsx)(B.Z,{type:"number"})}),(0,s.jsx)(R.Z.Item,{children:(0,s.jsx)(O.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},ue=te,_=t(11849),G=t(48971);function se(l){return Y.apply(this,arguments)}function Y(){return Y=(0,o.Z)((0,a.Z)().mark(function l(r){return(0,a.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,G.WY)("/kitchen/api/FoodMenu/GetFoodMenuInfoPage",{method:"POST",data:r}));case 1:case"end":return e.stop()}},l)})),Y.apply(this,arguments)}function le(l){return K.apply(this,arguments)}function K(){return K=(0,o.Z)((0,a.Z)().mark(function l(r){return(0,a.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,G.WY)("/kitchen/api/FoodMenu/AddUpdateFoodMenu",{method:"POST",data:r}));case 1:case"end":return e.stop()}},l)})),K.apply(this,arguments)}function oe(l){return N.apply(this,arguments)}function N(){return N=(0,o.Z)((0,a.Z)().mark(function l(r){return(0,a.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,G.WY)("/kitchen/api/FoodMenu/AddUpdateFoodMenu",{method:"POST",data:r}));case 1:case"end":return e.stop()}},l)})),N.apply(this,arguments)}function ie(l){return J.apply(this,arguments)}function J(){return J=(0,o.Z)((0,a.Z)().mark(function l(r){return(0,a.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,G.WY)("\u200B/kitchen/api/FoodMenu/DelFoodMenu",{method:"POST",data:r}));case 1:case"end":return e.stop()}},l)})),J.apply(this,arguments)}function de(l){return z.apply(this,arguments)}function z(){return z=(0,o.Z)((0,a.Z)().mark(function l(r){return(0,a.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,G.WY)("/kitchen/api/FoodMenu/GetGoodsByMenuIdPage",{method:"POST",data:(0,_.Z)({},r)}));case 1:case"end":return e.stop()}},l)})),z.apply(this,arguments)}function ce(l){return L.apply(this,arguments)}function L(){return L=(0,o.Z)((0,a.Z)().mark(function l(r){return(0,a.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,G.WY)("/kitchen/api/FoodMenu/GetFoodMenuGoodsPage_V2",{method:"POST",data:(0,_.Z)({},r)}));case 1:case"end":return e.stop()}},l)})),L.apply(this,arguments)}function fe(l){return H.apply(this,arguments)}function H(){return H=(0,o.Z)((0,a.Z)().mark(function l(r){return(0,a.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,G.WY)("/kitchen/api/FoodMenu/EditFoodMenuGoods",{method:"POST",data:r}));case 1:case"end":return e.stop()}},l)})),H.apply(this,arguments)}var ke=t(49111),he=t(19650),Re=t(62350),pe=t(24565),ee=t(86582),ve=[{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"}],me=function(r){var h=(0,w.useRef)(),e=(0,w.useState)([]),C=(0,k.Z)(e,2),n=C[0],m=C[1],U=function(){var F=(0,o.Z)((0,a.Z)().mark(function p(){var Z,c,i;return(0,a.Z)().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:if((Z=r.foodMenu)!==null&&Z!==void 0&&Z.id){v.next=2;break}return v.abrupt("return");case 2:return c={goodsIds:[],foodMenuId:r.foodMenu.id},n.forEach(function(d){c.goodsIds.push({goodsId:d})}),v.next=6,fe(c);case 6:i=v.sent,i.statusCode===200?(u.default.success("\u66F4\u65B0\u83DC\u8C31\u5546\u54C1\u6210\u529F\uFF01"),r.onOk()):u.default.error(JSON.stringify(i.errors)||"\u66F4\u65B0\u83DC\u8C31\u5546\u54C1\u51FA\u9519");case 8:case"end":return v.stop()}},p)}));return function(){return F.apply(this,arguments)}}(),T=function(){var F=(0,o.Z)((0,a.Z)().mark(function p(){var Z,c,i,f;return(0,a.Z)().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(!r.foodMenu.id){d.next=5;break}return d.next=3,ce({current:1,pageSize:999,FoodMenuId:r.foodMenu.id});case 3:Z=d.sent,Z.statusCode===200&&(f=[],(c=Z.data)===null||c===void 0||(i=c.data)===null||i===void 0||i.forEach(function(D){f.push(D.goodid)}),m(f));case 5:case"end":return d.stop()}},p)}));return function(){return F.apply(this,arguments)}}();return(0,w.useEffect)(function(){T()},[]),(0,s.jsx)(X.Z,{width:800,title:r.foodMenu.name,visible:r.open,onOk:U,onCancel:r.onCancel,children:(0,s.jsx)(b.ZP,{columns:ve,actionRef:h,pagination:{pageSize:10},rowSelection:{type:"checkbox",selectedRowKeys:n,onSelect:function(p,Z){var c=(0,ee.Z)(n),i=c.findIndex(function(f){return f===p.id});Z?i<0&&c.push(p.id):i>-1&&c.splice(i,1),m(c)},onSelectAll:function(p,Z,c){var i=(0,ee.Z)(n);p?Z.forEach(function(f){if(!!f){var v=i.findIndex(function(d){return d===f.id});v<0&&i.push(f.id)}}):c.forEach(function(f){var v=i.findIndex(function(d){return d===f.id});v>-1&&i.splice(v,1)}),m(i)}},tableAlertOptionRender:function(){return(0,s.jsx)(he.Z,{size:16,children:(0,s.jsx)(pe.Z,{title:"\u6B64\u64CD\u4F5C\u4F1A\u53D6\u6D88\u6240\u6709\u9009\u4E2D\u9879\uFF0C\u786E\u5B9A\u8981\u53D6\u6D88\u5417\uFF1F",onConfirm:function(){return m([])},okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",children:(0,s.jsx)("a",{children:"\u53D6\u6D88\u9009\u62E9"})})})},request:(0,o.Z)((0,a.Z)().mark(function F(){var p,Z,c,i,f=arguments;return(0,a.Z)().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return p=f.length>0&&f[0]!==void 0?f[0]:{},Z=f.length>1?f[1]:void 0,c=f.length>2?f[2]:void 0,p.FoodMenuId=r.foodMenu.id,d.next=6,de(p);case 6:if(i=d.sent,i.statusCode!==200){d.next=11;break}return d.abrupt("return",{data:i.data.data,success:!0,total:i.data.total});case 11:return d.abrupt("return",[]);case 12:case"end":return d.stop()}},F)})),rowKey:"id",headerTitle:"\u5546\u54C1\u5217\u8868"})})},Ze=me,x="message",ge=function(){var l=(0,o.Z)((0,a.Z)().mark(function r(h){var e;return(0,a.Z)().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return e=!1,n.prev=1,u.default.loading("\u6B63\u5728\u6DFB\u52A0",x),n.next=5,oe(JSON.stringify(h)).then(function(m){u.default.destroy(x),m.data?(u.default.success("\u6DFB\u52A0\u6210\u529F"),e=!0):(u.default.error(m.errors||"\u6DFB\u52A0\u5931\u8D25"),e=!1)});case 5:n.next=11;break;case 7:n.prev=7,n.t0=n.catch(1),u.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),e=!1;case 11:return n.abrupt("return",e);case 12:case"end":return n.stop()}},r,null,[[1,7]])}));return function(h){return l.apply(this,arguments)}}(),ye=function(){var l=(0,o.Z)((0,a.Z)().mark(function r(h){var e;return(0,a.Z)().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return e=!1,n.prev=1,u.default.loading("\u6B63\u5728\u4FEE\u6539",x),u.default.destroy(x),n.next=6,le(JSON.stringify(h)).then(function(m){u.default.destroy(x),m.data?(u.default.success("\u4FEE\u6539\u6210\u529F"),e=!0):(u.default.error(m.errors||"\u4FEE\u6539\u5931\u8D25"),e=!1)});case 6:n.next=12;break;case 8:n.prev=8,n.t0=n.catch(1),u.default.error("\u4FEE\u6539\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),e=!1;case 12:return n.abrupt("return",e);case 13:case"end":return n.stop()}},r,null,[[1,8]])}));return function(h){return l.apply(this,arguments)}}(),Me=function(){var l=(0,o.Z)((0,a.Z)().mark(function r(h){var e;return(0,a.Z)().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,u.default.loading("\u6B63\u5728\u5220\u9664"),e=[],h.forEach(function(m){e.push(m.id)}),n.next=6,ie(e).then(function(m){return u.default.destroy(),m.data?(u.default.success("\u5220\u9664\u6210\u529F"),!0):(u.default.error("\u83DC\u8C31\u5DF2\u5173\u8054\u5230\u5546\u54C1\uFF0C\u5220\u9664\u5931\u8D25"),!1)});case 6:n.next=12;break;case 8:return n.prev=8,n.t0=n.catch(0),u.default.error("\u5220\u9664\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),n.abrupt("return",!1);case 12:case"end":return n.stop()}},r,null,[[0,8]])}));return function(h){return l.apply(this,arguments)}}(),Fe=function(){var r=(0,w.useState)(!1),h=(0,k.Z)(r,2),e=h[0],C=h[1],n=(0,w.useRef)(),m=(0,w.useState)(),U=(0,k.Z)(m,2),T=U[0],F=U[1],p=(0,w.useState)([]),Z=(0,k.Z)(p,2),c=Z[0],i=Z[1],f=(0,w.useState)(!1),v=(0,k.Z)(f,2),d=v[0],D=v[1],we=[{title:"\u4E3B\u952E",dataIndex:"id",hideInSearch:!0,hideInTable:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key"},{title:"\u83DC\u8C31\u540D\u79F0",dataIndex:"name"},{title:"\u83DC\u8C31\u7F16\u7801",dataIndex:"code"},{title:"\u6392\u5E8F",dataIndex:"sort"},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(S,y){return[(0,s.jsx)("a",{onClick:function(){C(!0),F(y)},children:"\u7F16\u8F91"},"config"),(0,s.jsx)("a",{onClick:function(){F(y),D(!0)},children:"\u5173\u8054\u52A0\u76DF\u5546\u5546\u54C1"},"food")]}}],Ce=function(){D(!1)};return(0,s.jsxs)(E.ZP,{children:[(0,s.jsx)(b.ZP,{headerTitle:"\u83DC\u8C31\u57FA\u7840\u4FE1\u606F",actionRef:n,rowKey:"id",search:{labelWidth:120},toolBarRender:function(){return[(0,s.jsxs)(O.Z,{type:"primary",onClick:function(){C(!0)},children:[(0,s.jsx)($.Z,{})," \u65B0\u5EFA"]},"primary")]},request:function(){var I=(0,o.Z)((0,a.Z)().mark(function S(y){var A,M;return(0,a.Z)().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return A=[],M=0,g.next=4,se(y).then(function(ne){A=ne.data.data,M=ne.data.total});case 4:return g.abrupt("return",{data:A,success:!0,total:M});case 5:case"end":return g.stop()}},S)}));return function(S){return I.apply(this,arguments)}}(),columns:we,rowSelection:{onChange:function(S,y){i(y)}}}),(c==null?void 0:c.length)>0&&(0,s.jsx)(V.Z,{extra:(0,s.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,s.jsx)("a",{style:{fontWeight:600},children:c.length})," ","\u9879 \xA0\xA0"]}),children:(0,s.jsx)(O.Z,{onClick:(0,o.Z)((0,a.Z)().mark(function I(){var S,y;return(0,a.Z)().wrap(function(M){for(;;)switch(M.prev=M.next){case 0:return M.next=2,Me(c);case 2:i([]),(S=n.current)===null||S===void 0||(y=S.reloadAndRest)===null||y===void 0||y.call(S);case 4:case"end":return M.stop()}},I)})),children:"\u5220\u9664"})}),(0,s.jsx)(ue,{onFinish:function(){var I=(0,o.Z)((0,a.Z)().mark(function S(y){var A,M;return(0,a.Z)().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:if(M=!1,!y.id){g.next=7;break}return g.next=4,ye(y);case 4:M=g.sent,g.next=10;break;case 7:return g.next=9,ge(y);case 9:M=g.sent;case 10:console.log("success",M),M&&(C(!1),F(void 0)),(A=n.current)===null||A===void 0||A.reload();case 13:case"end":return g.stop()}},S)}));return function(S){return I.apply(this,arguments)}}(),onCancel:function(){C(!1),F(void 0)},createModalVisible:e,values:T||{}}),T&&d&&(0,s.jsx)(Ze,{foodMenu:T,open:d,onOk:Ce,onCancel:function(){return D(!1)}})]})},Se=Fe},51496:function(re,P,t){"use strict";t.d(P,{x0:function(){return a}});let Q=j=>crypto.getRandomValues(new Uint8Array(j)),O=(j,u,o)=>{let w=(2<<Math.log(j.length-1)/Math.LN2)-1,E=-~(1.6*w*u/j.length);return(V=u)=>{let $="";for(;;){let b=o(E),W=E;for(;W--;)if($+=j[b[W]&w]||"",$.length===V)return $}}},k=(j,u=21)=>O(j,u,Q),a=(j=21)=>crypto.getRandomValues(new Uint8Array(j)).reduce((u,o)=>(o&=63,o<36?u+=o.toString(36):o<62?u+=(o-26).toString(36).toUpperCase():o>62?u+="-":u+="_",u),"")}}]);