|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[2351],{20173:function(Se,J,a){"use strict";a.d(J,{lM:function(){return v},IH:function(){return ne},mm:function(){return ae},eP:function(){return X},FM:function(){return H}});var x=a(39428),B=a(11849),r=a(3182),K=a(48971),S=a(96690);function v(i,g){return Q.apply(this,arguments)}function Q(){return Q=(0,r.Z)((0,x.Z)().mark(function i(g,R){return(0,x.Z)().wrap(function(z){for(;;)switch(z.prev=z.next){case 0:return z.abrupt("return",(0,K.WY)((0,S.w)()+"/api/organize/page",{method:"POST",data:(0,B.Z)({},g)}));case 1:case"end":return z.stop()}},i)})),Q.apply(this,arguments)}function ne(i){return w.apply(this,arguments)}function w(){return w=(0,r.Z)((0,x.Z)().mark(function i(g){return(0,x.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,K.WY)((0,S.w)()+"/api/organize/addorg",{method:"POST",data:(0,B.Z)({},g)}));case 1:case"end":return u.stop()}},i)})),w.apply(this,arguments)}function pe(i){return h.apply(this,arguments)}function h(){return h=_asyncToGenerator(_regeneratorRuntime().mark(function i(g){return _regeneratorRuntime().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",request(getDataBaseUrl()+"\u200B/api\u200B/organize/getorglist",{method:"POST",data:_objectSpread({},g)}));case 1:case"end":return u.stop()}},i)})),h.apply(this,arguments)}function ae(i){return N.apply(this,arguments)}function N(){return N=(0,r.Z)((0,x.Z)().mark(function i(g){return(0,x.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,K.WY)((0,S.w)()+"\u200B/api\u200B/organize/deleteorg?id="+g,{method:"GET"}));case 1:case"end":return u.stop()}},i)})),N.apply(this,arguments)}function X(i){return _.apply(this,arguments)}function _(){return _=(0,r.Z)((0,x.Z)().mark(function i(g){return(0,x.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,K.WY)((0,S.w)()+"\u200B/api\u200B/organize/updateorg",{method:"POST",data:(0,B.Z)({},g)}));case 1:case"end":return u.stop()}},i)})),_.apply(this,arguments)}function re(i){return q.apply(this,arguments)}function q(){return q=_asyncToGenerator(_regeneratorRuntime().mark(function i(g){return _regeneratorRuntime().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",request(getDataBaseUrl()+"/api\u200B/sysOrg\u200B/detail",{method:"POST",data:_objectSpread({},g)}));case 1:case"end":return u.stop()}},i)})),q.apply(this,arguments)}function H(i){return ee.apply(this,arguments)}function ee(){return ee=(0,r.Z)((0,x.Z)().mark(function i(g){return(0,x.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,K.WY)((0,S.w)()+"\u200B/api\u200B/organize/tree",{method:"GET",data:(0,B.Z)({},g)}));case 1:case"end":return u.stop()}},i)})),ee.apply(this,arguments)}},94164:function(Se,J,a){"use strict";a.r(J),a.d(J,{default:function(){return De}});var x=a(57663),B=a(71577),r=a(39428),K=a(34792),S=a(48086),v=a(3182),Q=a(62350),ne=a(24565),w=a(2824),pe=a(49101),h=a(67294),ae=a(28790),N=a(85224),X=a(16894),_=a(71194),re=a(50146),q=a(47673),H=a(4107),ee=a(9715),i=a(55843);let g=n=>crypto.getRandomValues(new Uint8Array(n)),R=(n,e,s)=>{let t=(2<<Math.log(n.length-1)/Math.LN2)-1,W=-~(1.6*t*e/n.length);return(U=e)=>{let I="";for(;;){let V=s(W),F=W;for(;F--;)if(I+=n[V[F]&t]||"",I.length===U)return I}}},u=(n,e=21)=>R(n,e,g),z=(n=21)=>crypto.getRandomValues(new Uint8Array(n)).reduce((e,s)=>(s&=63,s<36?e+=s.toString(36):s<62?e+=(s-26).toString(36).toUpperCase():s>62?e+="-":e+="_",e),"");var l=a(85893),we=function(e){var s=(0,h.useState)(),t=(0,w.Z)(s,2),W=t[0],U=t[1],I=i.Z.useForm(),V=(0,w.Z)(I,1),F=V[0];return(0,h.useEffect)(function(){var O;if(console.log(e.values),e!=null&&(O=e.values)!==null&&O!==void 0&&O.id){var k,L,P,A;F.setFieldsValue({id:e==null||(k=e.values)===null||k===void 0?void 0:k.id,name:e==null||(L=e.values)===null||L===void 0?void 0:L.name,code:e==null||(P=e.values)===null||P===void 0?void 0:P.code}),U(e==null||(A=e.values)===null||A===void 0?void 0:A.orgId)}else F.resetFields()},[e.values]),(0,l.jsx)(re.Z,{title:e.values.id?"\u7F16\u8F91":"\u65B0\u5EFA",width:640,visible:e.createModalVisible,bodyStyle:{padding:"32px 40px 48px"},footer:null,onCancel:function(){e.onCancel()},destroyOnClose:!0,children:(0,l.jsxs)(i.Z,{layout:"Horizontal",labelCol:{span:4},preserve:!1,form:F,onFinish:e.onFinish,children:[(0,l.jsx)(i.Z.Item,{name:"id",hidden:!0,children:(0,l.jsx)(H.Z,{})}),(0,l.jsx)(i.Z.Item,{label:"\u83DC\u8C31\u7F16\u7801",name:"code",initialValue:z(20),rules:[{required:!0,max:50}],children:(0,l.jsx)(H.Z,{})}),(0,l.jsx)(i.Z.Item,{label:"\u83DC\u8C31\u540D\u79F0",name:"name",rules:[{required:!0,max:50}],children:(0,l.jsx)(H.Z,{})}),(0,l.jsx)(i.Z.Item,{children:(0,l.jsx)(B.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},Fe=we,ve=a(86582),Ce=a(11849),D=a(48971),ge=a(96690);function Te(n){return ue.apply(this,arguments)}function ue(){return ue=(0,v.Z)((0,r.Z)().mark(function n(e){return(0,r.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,D.WY)("/saasstore/api/foodmenu/page",{method:"POST",data:e}));case 1:case"end":return t.stop()}},n)})),ue.apply(this,arguments)}function Me(n){return se.apply(this,arguments)}function se(){return se=(0,v.Z)((0,r.Z)().mark(function n(e){return(0,r.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,D.WY)("/saasstore/api/foodmenu/add",{method:"POST",data:e}));case 1:case"end":return t.stop()}},n)})),se.apply(this,arguments)}function xe(n){return ie.apply(this,arguments)}function ie(){return ie=(0,v.Z)((0,r.Z)().mark(function n(e){return(0,r.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,D.WY)("/saasstore/api/foodmenu/update",{method:"POST",data:e}));case 1:case"end":return t.stop()}},n)})),ie.apply(this,arguments)}function je(n){return le.apply(this,arguments)}function le(){return le=(0,v.Z)((0,r.Z)().mark(function n(e){return(0,r.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,D.WY)("/saasstore/api/foodmenu/delete",{method:"POST",data:e}));case 1:case"end":return t.stop()}},n)})),le.apply(this,arguments)}function be(n){return oe.apply(this,arguments)}function oe(){return oe=(0,v.Z)((0,r.Z)().mark(function n(e){return(0,r.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,D.WY)("/saasstore/api/foodmenu/editfoodmenugoods",{method:"POST",data:e}));case 1:case"end":return t.stop()}},n)})),oe.apply(this,arguments)}function Ie(n){return de.apply(this,arguments)}function de(){return de=(0,v.Z)((0,r.Z)().mark(function n(e){return(0,r.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,D.WY)("/saasstore/api/foodmenu/getfoodmenugoods?foodMenuId="+e,{method:"GET"}));case 1:case"end":return t.stop()}},n)})),de.apply(this,arguments)}function Oe(n){return ce.apply(this,arguments)}function ce(){return ce=(0,v.Z)((0,r.Z)().mark(function n(e){return(0,r.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,D.WY)((0,ge.w)()+"/api/goods/page",{method:"POST",data:e}));case 1:case"end":return t.stop()}},n)})),ce.apply(this,arguments)}function Pe(n){return fe.apply(this,arguments)}function fe(){return fe=(0,v.Z)((0,r.Z)().mark(function n(e){return(0,r.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,D.WY)((0,ge.w)()+"\u200B/api\u200B/goodstype/tree",{method:"GET",data:(0,Ce.Z)({},e)}));case 1:case"end":return t.stop()}},n)})),fe.apply(this,arguments)}function Ve(){return he.apply(this,arguments)}function he(){return he=_asyncToGenerator(_regeneratorRuntime().mark(function n(){return _regeneratorRuntime().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.abrupt("return",request(getDataBaseUrl()+"/api/device/list",{method:"GET"}));case 1:case"end":return s.stop()}},n)})),he.apply(this,arguments)}var Ee=function(e){var s=(0,h.useRef)(),t=(0,h.useState)(),W=(0,w.Z)(t,2),U=W[0],I=W[1],V=(0,h.useState)([]),F=(0,w.Z)(V,2),O=F[0],k=F[1],L=(0,h.useState)([]),P=(0,w.Z)(L,2),A=P[0],Y=P[1];(0,h.useEffect)(function(){var j;console.log(e.values),Pe().then(function(c){I(c.data)}),Ie(e==null||(j=e.values)===null||j===void 0?void 0:j.id).then(function(c){if(c.data.length>0){var T=c.data.map(function(m){return m.goodsId});Y(T)}else Y([])})},[e.values]);var Ze=[{title:"\u4E3B\u952E",dataIndex:"id",hideInSearch:!0,hideInTable:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key"},{title:"\u5DE5\u827A\u5206\u7C7B",dataIndex:"goodsTypeName",valueType:"treeSelect",hideInTable:!0,fieldProps:{showSearch:!0,allowClear:!0,options:U}},{title:"\u5546\u54C1\u540D\u79F0",dataIndex:"name",search:!0}];return(0,l.jsx)(re.Z,{title:"\u5173\u8054\u5546\u54C1",width:1040,visible:e.foodMenuGoodsModalVisible,bodyStyle:{padding:"32px 40px 48px"},okText:"\u4FDD\u5B58",cancelText:"\u53D6\u6D88",onOk:function(){if(console.log(O),console.log(e.values),O.length>0){var c=O.map(function(m){return m.id}),T={foodMenuId:e.values.id,GoodsIds:c};e.handleOk(T)}else S.default.error("\u8BF7\u9009\u62E9\u5546\u54C1")},onCancel:function(){e.onCancel()},destroyOnClose:!0,children:(0,l.jsx)(X.ZP,{headerTitle:"\u5546\u54C1\u4FE1\u606F",actionRef:s,rowKey:"id",pagination:{defaultPageSize:10},search:{labelWidth:120},request:function(){var j=(0,v.Z)((0,r.Z)().mark(function c(T){var m,Z;return(0,r.Z)().wrap(function(M){for(;;)switch(M.prev=M.next){case 0:return m=[],Z=0,M.next=4,Oe(T).then(function(G){m=G.data.data,Z=G.data.total});case 4:return M.abrupt("return",{data:m,success:!0,total:Z});case 5:case"end":return M.stop()}},c)}));return function(c){return j.apply(this,arguments)}}(),columns:Ze,rowSelection:{type:"checkbox",selectedRowKeys:A,onSelect:function(c,T){var m=(0,ve.Z)(A);console.log(c),console.log(m);var Z=m.findIndex(function(y){return y===c.id});T?Z<0&&m.push(c.id):Z>-1&&m.splice(Z,1),Y(m)},onSelectAll:function(c,T,m){var Z=(0,ve.Z)(A);c?T.forEach(function(y){if(!!y){var M=Z.findIndex(function(G){return G===y.id});M<0&&Z.push(y.id)}}):m.forEach(function(y){var M=Z.findIndex(function(G){return G===y.id});M>-1&&Z.splice(M,1)}),Y(Z)},onChange:function(c,T){k(T)}}})})},Ae=Ee,Ge=a(20173),Le="message",Re=function(){var e=(0,h.useState)([]),s=(0,w.Z)(e,2),t=s[0],W=s[1];(0,h.useEffect)(function(){(0,Ge.FM)().then(function(p){W(p.data)})},[]);var U=(0,h.useState)(!1),I=(0,w.Z)(U,2),V=I[0],F=I[1],O=(0,h.useState)(!1),k=(0,w.Z)(O,2),L=k[0],P=k[1],A=(0,h.useState)(!1),Y=(0,w.Z)(A,2),Ze=Y[0],j=Y[1],c=(0,h.useRef)(),T=(0,h.useState)(),m=(0,w.Z)(T,2),Z=m[0],y=m[1],M=(0,h.useState)([]),G=(0,w.Z)(M,2),te=G[0],ye=G[1],We=[{title:"\u4E3B\u952E",dataIndex:"id",hideInSearch:!0,hideInTable:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key"},{title:"\u83DC\u8C31\u7F16\u7801",dataIndex:"code",search:!0},{title:"\u83DC\u8C31\u540D\u79F0",dataIndex:"name",ellipsis:!0},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",fixed:"right",width:400,render:function(f,d){return[(0,l.jsx)("a",{onClick:function(){F(!0),y(d)},children:"\u66F4\u65B0"},"update"),(0,l.jsx)(ne.Z,{type:"primary",title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:function(){var o=[{id:d.id}];Ue(o)},onCancel:function(){},children:(0,l.jsx)("a",{href:"#",children:"\u5220\u9664"})},"primary"),(0,l.jsx)("a",{onClick:function(){P(!0),y(d)},children:"\u5173\u8054\u5546\u54C1"},"update")]}}],ke=function(){var p=(0,v.Z)((0,r.Z)().mark(function f(d){return(0,r.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,Me(JSON.stringify(d)).then(function(b){b.succeeded?(S.default.success("\u6DFB\u52A0\u6210\u529F"),F(!1),y(void 0),c.current.reload()):S.default.error(b.errors)});case 2:case"end":return o.stop()}},f)}));return function(d){return p.apply(this,arguments)}}(),Be=function(){var p=(0,v.Z)((0,r.Z)().mark(function f(d){return(0,r.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,xe(JSON.stringify(d)).then(function(b){b.succeeded?(S.default.success("\u4FEE\u6539\u6210\u529F"),F(!1),y(void 0),c.current.reload()):S.default.error(b.errors)});case 2:case"end":return o.stop()}},f)}));return function(d){return p.apply(this,arguments)}}(),Ue=function(){var p=(0,v.Z)((0,r.Z)().mark(function f(d){var C;return(0,r.Z)().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return C=[],d.forEach(function(E){C.push(E.id)}),b.next=4,je(C).then(function(E){if(E.succeeded){var $,me;S.default.success("\u5220\u9664\u6210\u529F"),ye([]),($=c.current)===null||$===void 0||(me=$.reloadAndRest)===null||me===void 0||me.call($)}else S.default.error(E.errors)});case 4:case"end":return b.stop()}},f)}));return function(d){return p.apply(this,arguments)}}();return(0,l.jsxs)(ae.ZP,{host:!0,header:{title:"",breadcrumb:{}},children:[(0,l.jsx)(X.ZP,{headerTitle:"\u573A\u666F\u4FE1\u606F",actionRef:c,rowKey:"id",pagination:{defaultPageSize:10},search:{labelWidth:120},toolBarRender:function(){return[(0,l.jsxs)(B.Z,{type:"primary",onClick:function(){F(!0)},children:[(0,l.jsx)(pe.Z,{})," \u65B0\u5EFA"]},"primary")]},request:function(){var p=(0,v.Z)((0,r.Z)().mark(function f(d){var C,o;return(0,r.Z)().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return C=[],o=0,E.next=4,Te(d).then(function($){C=$.data.data,o=$.data.total});case 4:return E.abrupt("return",{data:C,success:!0,total:o});case 5:case"end":return E.stop()}},f)}));return function(f){return p.apply(this,arguments)}}(),columns:We,rowSelection:{onChange:function(f,d){ye(d)}}}),(te==null?void 0:te.length)>0&&(0,l.jsx)(N.Z,{extra:(0,l.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,l.jsx)("a",{style:{fontWeight:600},children:te.length})," ","\u9879 \xA0\xA0"]})}),(0,l.jsx)(Fe,{OrgList:t,onFinish:function(){var p=(0,v.Z)((0,r.Z)().mark(function f(d){return(0,r.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!d.id){o.next=5;break}return o.next=3,Be(d);case 3:o.next=7;break;case 5:return o.next=7,ke(d);case 7:case"end":return o.stop()}},f)}));return function(f){return p.apply(this,arguments)}}(),onCancel:function(){F(!1),y(void 0)},createModalVisible:V,values:Z||{}}),(0,l.jsx)(Ae,{foodMenuGoodsModalVisible:L,values:Z||{},onCancel:function(){P(!1),y(void 0)},handleOk:function(f){console.log(f),be(f).then(function(d){d.succeeded?(S.default.success("\u4FDD\u5B58\u6210\u529F"),P(!1),y(void 0)):S.default.error(d.errors)})}})]})},De=Re}}]);
|