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

  1. (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[1298,7975,1322],{68703:function(xe,H,n){"use strict";n.r(H),n.d(H,{default:function(){return he}});var Ee=n(57663),X=n(71577),De=n(62350),b=n(24565),ke=n(71153),q=n(60331),s=n(39428),$e=n(34792),Z=n(48086),h=n(3182),C=n(2824),_=n(78009),ee=n(16894),j=n(48971);function re(l){return T.apply(this,arguments)}function T(){return T=(0,h.Z)((0,s.Z)().mark(function l(u){return(0,s.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,j.WY)("/kitchen/api/printer/store-infos",{method:"Post",data:u}));case 1:case"end":return t.stop()}},l)})),T.apply(this,arguments)}function te(l){return(0,j.WY)("/kitchen/api/printer/printer-list/".concat(l),{method:"get",data:l})}function ne(l){return w.apply(this,arguments)}function w(){return w=(0,h.Z)((0,s.Z)().mark(function l(u){return(0,s.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,j.WY)("/kitchen/api/printer/printer",{method:"Post",data:u}));case 1:case"end":return t.stop()}},l)})),w.apply(this,arguments)}function ae(l){return B.apply(this,arguments)}function B(){return B=(0,h.Z)((0,s.Z)().mark(function l(u){return(0,s.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,j.WY)("/kitchen/api/printer/printer",{method:"PUT",data:u}));case 1:case"end":return t.stop()}},l)})),B.apply(this,arguments)}function ue(l,u){return M.apply(this,arguments)}function M(){return M=(0,h.Z)((0,s.Z)().mark(function l(u,m){return(0,s.Z)().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.abrupt("return",(0,j.WY)("/kitchen/api/printer/set-printer-host/".concat(u,"/").concat(m),{method:"post"}));case 1:case"end":return c.stop()}},l)})),M.apply(this,arguments)}function se(l){return L.apply(this,arguments)}function L(){return L=(0,h.Z)((0,s.Z)().mark(function l(u){return(0,s.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,j.WY)("/kitchen/api/printer/del-printer",{method:"post",data:u}));case 1:case"end":return t.stop()}},l)})),L.apply(this,arguments)}function le(l){return O.apply(this,arguments)}function O(){return O=(0,h.Z)((0,s.Z)().mark(function l(u){return(0,s.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,j.WY)("/kitchen/api/printer/printer-templater",{method:"get",data:u}));case 1:case"end":return t.stop()}},l)})),O.apply(this,arguments)}function ie(l){return G.apply(this,arguments)}function G(){return G=(0,h.Z)((0,s.Z)().mark(function l(u){return(0,s.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,j.WY)("/kitchen/api/printer/store-food-menu/".concat(u),{method:"get",data:u}));case 1:case"end":return t.stop()}},l)})),G.apply(this,arguments)}var g=n(67294),oe=n(49101),Te=n(71194),de=n(50146),we=n(63185),U=n(9676),Be=n(13062),K=n(71230),Me=n(43358),N=n(34041),Le=n(89032),P=n(15746),Oe=n(47673),A=n(4107),Ge=n(9715),y=n(55843),e=n(85893),ce=function(u){var m,t=y.Z.useForm(),c=(0,C.Z)(t,1),x=c[0],R=function(){var I=(0,h.Z)((0,s.Z)().mark(function D(){var S,k,E;return(0,s.Z)().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:return v.next=2,x.validateFields();case 2:if(S=v.sent,!S.id){v.next=10;break}return v.next=6,ae(S);case 6:k=v.sent,k.statusCode===200?(Z.default.success("\u6253\u5370\u673A\u66F4\u65B0\u6210\u529F\uFF01"),u.onOk()):Z.default.error(k.errors||"\u6253\u5370\u673A\u66F4\u65B0\u5931\u8D25\uFF01"),v.next=15;break;case 10:return S.storeId=u.currentStore.storeId,v.next=13,ne(S);case 13:E=v.sent,E.statusCode===200?(Z.default.success("\u6253\u5370\u673A\u521B\u5EFA\u6210\u529F\uFF01"),u.onOk()):Z.default.error(E.errors||"\u6253\u5370\u673A\u521B\u5EFA\u5931\u8D25\uFF01");case 15:case"end":return v.stop()}},D)}));return function(){return I.apply(this,arguments)}}();return(0,g.useEffect)(function(){x.setFieldsValue(u.printer)},[]),(0,e.jsx)(de.Z,{title:"\u3010".concat(((m=u.printer)===null||m===void 0?void 0:m.name)||"\u65B0\u5EFA","\u3011\u6253\u5370\u673A"),destroyOnClose:!0,width:900,visible:u.isModalOpen,onOk:R,onCancel:u.onCancel,children:(0,e.jsxs)(y.Z,{name:"basic",labelCol:{span:8},autoComplete:"off",form:x,children:[(0,e.jsx)(y.Z.Item,{name:"id",hidden:!0,children:(0,e.jsx)(A.Z,{})}),(0,e.jsxs)(K.Z,{children:[(0,e.jsx)(P.Z,{span:12,children:(0,e.jsx)(y.Z.Item,{name:"name",label:"\u6253\u5370\u673A\u540D\u79F0",placeholder:"\u8BF7\u8F93\u5165\u6253\u5370\u673A\u540D\u79F0",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6253\u5370\u673A\u540D\u79F0\uFF01"}],children:(0,e.jsx)(A.Z,{})})}),(0,e.jsx)(P.Z,{span:12,children:(0,e.jsx)(y.Z.Item,{name:"applicationId",label:"\u5E94\u7528ID",placeholder:"\u8BF7\u8F93\u5165\u5E94\u7528ID",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5E94\u7528ID\uFF01"}],children:(0,e.jsx)(A.Z,{})})}),(0,e.jsx)(P.Z,{span:12,children:(0,e.jsx)(y.Z.Item,{name:"applicationkey",label:"\u5E94\u7528\u79D8\u94A5",placeholder:"\u8BF7\u8F93\u5165\u5E94\u7528\u79D8\u94A5",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5E94\u7528\u79D8\u94A5\uFF01"}],children:(0,e.jsx)(A.Z,{})})}),(0,e.jsx)(P.Z,{span:12,children:(0,e.jsx)(y.Z.Item,{name:"terminalId",label:"\u7EC8\u7AEFID",placeholder:"\u7EC8\u7AEFID",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u7EC8\u7AEFID\uFF01"}],children:(0,e.jsx)(A.Z,{})})}),(0,e.jsx)(P.Z,{span:12,children:(0,e.jsx)(y.Z.Item,{name:"terminalKey",label:"\u7EC8\u7AEF\u79D8\u94A5",placeholder:"\u7EC8\u7AEF\u79D8\u94A5",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u7EC8\u7AEF\u79D8\u94A5\uFF01"}],children:(0,e.jsx)(A.Z,{})})}),(0,e.jsx)(P.Z,{span:12,children:(0,e.jsx)(y.Z.Item,{name:"templaterId",label:"\u6253\u5370\u673A\u6A21\u677F",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u6253\u5370\u673A\u6A21\u677F\uFF01"}],children:(0,e.jsx)(N.Z,{placeholder:"\u8BF7\u9009\u62E9\u6253\u5370\u673A\u6A21\u677F\uFF01",allowClear:!0,children:u.printerTemplaterList.map(function(I){return(0,e.jsx)(N.Z.Option,{value:I.value,children:I.label},I.value)})})})})]}),(0,e.jsx)(y.Z.Item,{name:"goodsIdList",label:"\u5546\u54C1",labelCol:{span:3},children:(0,e.jsx)(U.Z.Group,{children:(0,e.jsx)(K.Z,{children:u.storeFoodMenuAll.map(function(I){return(0,e.jsx)(P.Z,{span:8,children:(0,e.jsx)(U.Z,{value:I.foodId,style:{lineHeight:"32px"},children:I.foodName})},I.foodId)})})})})]})})},fe=ce,pe=function(){var u=(0,g.useRef)(),m=(0,g.useState)(null),t=(0,C.Z)(m,2),c=t[0],x=t[1],R=(0,g.useState)([]),I=(0,C.Z)(R,2),D=I[0],S=I[1],k=(0,g.useState)([]),E=(0,C.Z)(k,2),W=E[0],v=E[1],me=(0,g.useState)(!1),z=(0,C.Z)(me,2),V=z[0],$=z[1],ve=(0,g.useState)(null),J=(0,C.Z)(ve,2),Ze=J[0],Y=J[1],Ie=(0,g.useState)([]),Q=(0,C.Z)(Ie,2),ge=Q[0],ye=Q[1],Fe=function(){var d=(0,h.Z)((0,s.Z)().mark(function i(){var r;return(0,s.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,re({current:1,pageSize:999});case 3:r=a.sent,r.statusCode===200?(r.data.data.forEach(function(o){o.value=o.storeId,o.label=o.storeName}),x(r.data.data[0]),S(r.data.data)):Z.default.error(r.errors||"\u83B7\u53D6\u5E97\u94FA\u5217\u8868\u5931\u8D25"),a.next=10;break;case 7:a.prev=7,a.t0=a.catch(0),S([]);case 10:case"end":return a.stop()}},i,null,[[0,7]])}));return function(){return d.apply(this,arguments)}}(),je=function(){var d=(0,h.Z)((0,s.Z)().mark(function i(){var r,f;return(0,s.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,le();case 2:r=o.sent,r.statusCode===200?((f=r.data)===null||f===void 0||f.forEach(function(p){p.value=p.id,p.label=p.title}),v(r.data)):Z.default.error(r.errors||"\u83B7\u53D6\u6253\u5370\u673A\u6A21\u677F\u5217\u8868\u5931\u8D25");case 4:case"end":return o.stop()}},i)}));return function(){return d.apply(this,arguments)}}(),Se=function(){var d=(0,h.Z)((0,s.Z)().mark(function i(){var r;return(0,s.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(!c){a.next=5;break}return a.next=3,ie(c.storeId);case 3:r=a.sent,r.statusCode===200&&ye(r.data);case 5:case"end":return a.stop()}},i)}));return function(){return d.apply(this,arguments)}}(),Ce=function(){var d=(0,h.Z)((0,s.Z)().mark(function i(r){var f,a;return(0,s.Z)().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,ue(c.storeId,r);case 2:f=p.sent,f.statusCode===200?(Z.default.success("\u8BBE\u7F6E\u4E3B\u6253\u5370\u673A\u6210\u529F\uFF01"),(a=u.current)===null||a===void 0||a.reload()):Z.default.error(f.errors||"\u8BBE\u7F6E\u4E3B\u6253\u5370\u673A\u51FA\u9519");case 4:case"end":return p.stop()}},i)}));return function(r){return d.apply(this,arguments)}}(),Pe=function(){var d=(0,h.Z)((0,s.Z)().mark(function i(r){var f,a;return(0,s.Z)().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,se([r]);case 2:f=p.sent,f.statusCode===200?(Z.default.success("\u5220\u9664\u6210\u529F\uFF01"),(a=u.current)===null||a===void 0||a.reload()):Z.default.error(Z.default.error||"\u5220\u9664\u5931\u8D25");case 4:case"end":return p.stop()}},i)}));return function(r){return d.apply(this,arguments)}}(),Ae=[{title:"\u95E8\u5E97",valueType:"select",hideInTable:!0,fieldProps:{options:D,value:c==null?void 0:c.storeId,onChange:function(i){var r=D.find(function(f){return f.storeId===i});r&&x(r)}}},{title:"\u6253\u5370\u673A\u540D\u79F0",dataIndex:"name",key:"name",render:function(i,r){return[r.isHost?(0,e.jsxs)("div",{children:[r.name,(0,e.jsx)(q.Z,{style:{marginLeft:"5px"},color:"#87d068",children:"\u4E3B\u6253\u5370\u673A"})]}):r.name]},hideInSearch:!0},{title:"\u5E94\u7528ID",dataIndex:"applicationId",key:"applicationId",hideInSearch:!0},{title:"\u7EC8\u7AEFID",dataIndex:"terminalId",key:"terminalId",hideInSearch:!0},{title:"\u6A21\u677F",dataIndex:"templaterId",key:"templaterId",valueType:"select",hideInSearch:!0,fieldProps:{options:W}},{title:"\u64CD\u4F5C",valueType:"option",key:"option",render:function(i,r,f,a){return[(0,e.jsx)("a",{onClick:function(){Y(r),$(!0)},children:"\u7F16\u8F91"},"edit"),(0,e.jsx)(b.Z,{title:"\u786E\u5B9A\u8981\u5C06\u3010".concat(r.name,"\u3011\u8BBE\u4E3A\u4E3B\u6253\u5370\u673A\u5417\uFF1F"),onConfirm:function(){return Ce(r.id)},okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",children:(0,e.jsx)("a",{href:"#",children:"\u4E3B\u6253\u5370\u673A"})},"confirm"),(0,e.jsx)(b.Z,{title:"\u786E\u5B9A\u8981\u5C06\u3010".concat(r.name,"\u3011\u5220\u9664\u5417\uFF1F"),onConfirm:function(){return Pe(r.id)},okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",children:(0,e.jsx)("a",{href:"#",children:"\u5220\u9664"})},"delete")]}}];return(0,g.useEffect)(function(){Fe(),je()},[]),(0,g.useEffect)(function(){var d;(d=u.current)===null||d===void 0||d.reload(),Se()},[c]),(0,e.jsxs)(_.ZP,{children:[(0,e.jsx)(ee.ZP,{columns:Ae,actionRef:u,cardBordered:!0,request:(0,h.Z)((0,s.Z)().mark(function d(){var i,r,f,a,o=arguments;return(0,s.Z)().wrap(function(F){for(;;)switch(F.prev=F.next){case 0:if(i=o.length>0&&o[0]!==void 0?o[0]:{},r=o.length>1?o[1]:void 0,f=o.length>2?o[2]:void 0,!c){F.next=14;break}return F.next=6,te(c.storeId);case 6:if(a=F.sent,a.statusCode!==200){F.next=11;break}return F.abrupt("return",{data:a.data,success:!0});case 11:Z.default.error(a.errors||"\u83B7\u53D6\u6253\u5370\u673A\u5217\u8868\u51FA\u9519");case 12:F.next=15;break;case 14:return F.abrupt("return",[]);case 15:case"end":return F.stop()}},d)})),rowKey:"id",dateFormatter:"string",headerTitle:"\u6253\u5370\u673A\u5217\u8868",toolBarRender:function(){return[(0,e.jsx)(X.Z,{icon:(0,e.jsx)(oe.Z,{}),type:"primary",onClick:function(){Y(null),$(!0)},children:"\u65B0\u5EFA"},"button")]}}),V&&(0,e.jsx)(fe,{storeFoodMenuAll:ge,currentStore:c,isModalOpen:V,onOk:function(){var i;$(!1),(i=u.current)===null||i===void 0||i.reload()},onCancel:function(){$(!1),Y(null)},printerTemplaterList:W,printer:Ze})]})},he=pe}}]);