包含后厨 团餐 门店分支
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
8.5 KiB

  1. (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[7657],{78568:function(Pe,B,n){"use strict";n.r(B),n.d(B,{default:function(){return ne}});var Oe=n(71194),R=n(50146),we=n(58996),Q=n(77933),We=n(43358),U=n(34041),d=n(39428),Me=n(34792),h=n(48086),x=n(3182),$e=n(62350),L=n(24565),Ye=n(57663),D=n(71577),f=n(2824),X=n(49101),o=n(67294),q=n(28790),_=n(16894),Ke=n(62999),A=n(54680),ke=n(9715),m=n(55843),Ge=n(47673),F=n(4107),e=n(85893),ee=function(r){var y=F.Z.TextArea;return(0,e.jsx)(R.Z,{title:r.values.id?"\u7F16\u8F91\u8BBE\u5907":"\u65B0\u5EFA\u8BBE\u5907",width:640,bodyStyle:{padding:"32px 40px 1px 48px"},open:r.modalOpen,onCancel:r.onCancel,footer:null,maskClosable:!1,destroyOnClose:!0,children:(0,e.jsxs)(m.Z,{layout:"horizontal",preserve:!1,labelCol:{span:4},initialValues:r.values,onFinish:r.onFinish,children:[(0,e.jsx)(m.Z.Item,{name:"id",hidden:!0,children:(0,e.jsx)(F.Z,{})}),(0,e.jsx)(m.Z.Item,{name:"name",label:"\u8BBE\u5907\u540D\u79F0",rules:[{required:!0}],children:(0,e.jsx)(F.Z,{placeholder:"\u8BF7\u8F93\u5165\u8BBE\u5907\u540D\u79F0"})}),(0,e.jsx)(m.Z.Item,{name:"storeId",label:"\u95E8\u5E97\u540D\u79F0",rules:[{required:!0}],children:(0,e.jsx)(A.Z,{style:{width:"100%"},dropdownStyle:{maxHeight:400,overflow:"auto"},treeData:r.storeList,placeholder:"\u8BF7\u9009\u62E9\u95E8\u5E97\u540D\u79F0",treeDefaultExpandAll:!0,allowClear:!0})}),(0,e.jsx)(m.Z.Item,{name:"isEnable",label:"\u4F7F\u7528\u60C5\u51B5",rules:[{required:!0}],children:(0,e.jsx)(A.Z,{style:{width:"100%"},dropdownStyle:{maxHeight:400,overflow:"auto"},treeData:r.enableList,placeholder:"\u8BF7\u9009\u62E9\u4F7F\u7528\u60C5\u51B5",treeDefaultExpandAll:!0,allowClear:!0})}),(0,e.jsx)(m.Z.Item,{name:"remark",label:"\u5907\u6CE8",children:(0,e.jsx)(y,{rows:4,rules:[{max:500}]})}),(0,e.jsxs)(m.Z.Item,{children:[(0,e.jsx)(D.Z,{htmlType:"button",style:{float:"right",left:10},onClick:r.onCancel,children:"\u53D6\u6D88"}),(0,e.jsx)(D.Z,{type:"primary",htmlType:"submit",style:{float:"right"},children:"\u4FDD\u5B58"})]})]})})},te=ee,g=n(48971),S=n(96690),v={getDevicePage:function(r){return(0,g.WY)((0,S.w)()+"/api/store/getDevicePage",{method:"Post",data:r})},getAllStoreList:function(){return(0,g.WY)((0,S.w)()+"/api/store/getAllStoreList",{method:"Get"})},updateDevice:function(r){return(0,g.WY)((0,S.w)()+"/api/store/updateDevice",{method:"Post",data:r})},deleteDevice:function(r){return(0,g.WY)((0,S.w)()+"/api/store/deleteDevice",{method:"Post",data:r})},getStoreRecipeList:function(r,y){return(0,g.WY)((0,S.w)()+"/api/recipe/getStoreRecipeList?storeId=".concat(r,"&isWeight=").concat(y),{method:"Get"})},getDeviceRelation:function(r){return(0,g.WY)((0,S.w)()+"/api/store/getDeviceRelation?deviceId=".concat(r),{method:"Get"})},setDeviceRelation:function(r){return(0,g.WY)((0,S.w)()+"/api/store/setDeviceRelation",{method:"Post",data:r})}},ae=function(){var r=(0,o.useRef)(),y=(0,o.useState)(),T=(0,f.Z)(y,2),C=T[0],P=T[1],re=(0,o.useState)([]),O=(0,f.Z)(re,2),w=O[0],ue=O[1],ie=(0,o.useState)(),W=(0,f.Z)(ie,2),se=W[0],I=W[1],le=(0,o.useState)({}),M=(0,f.Z)(le,2),oe=M[0],j=M[1],ce=(0,o.useState)(!1),$=(0,f.Z)(ce,2),de=$[0],E=$[1],fe=(0,o.useState)([]),Y=(0,f.Z)(fe,2),he=Y[0],ve=Y[1],pe=(0,o.useState)([]),K=(0,f.Z)(pe,2),k=K[0],G=K[1],me=(0,o.useState)([]),V=(0,f.Z)(me,2),ge=V[0],Se=V[1],xe=(0,o.useState)([]),z=(0,f.Z)(xe,2),ye=z[0],Ze=z[1],De=(0,o.useState)(""),H=(0,f.Z)(De,2),Ce=H[0],b=H[1],N=[{value:"1",label:"\u542F\u7528"},{value:"0",label:"\u505C\u7528"}];(0,o.useEffect)(function(){Ie()},[]);function Ie(){v.getAllStoreList().then(function(u){var t=u.data,a=[];t.forEach(function(s){a.push({value:s.id,label:s.name})}),ue(a)})}function J(u,t){v.getStoreRecipeList(u,t).then(function(a){var s=a.data,i=[];s.forEach(function(l){i.push({key:l.id,title:l.name})}),ve(i)})}var Fe=function(){return(C==null?void 0:C.length)>0&&(0,e.jsx)(L.Z,{title:"\u786E\u8BA4\u5220\u9664\u5417?",onConfirm:je,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",children:(0,e.jsx)(D.Z,{type:"primary",children:"\u6279\u91CF\u5220\u9664"})})},je=function(){var t,a;Ee(C),P([]),(t=r.current)===null||t===void 0||(a=t.reloadAndRest)===null||a===void 0||a.call(t)},Ee=function(){var u=(0,x.Z)((0,d.Z)().mark(function t(a){return(0,d.Z)().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(a){i.next=2;break}return i.abrupt("return",!0);case 2:return i.next=4,v.deleteDevice(a.map(function(l){return l.id})).then(function(l){l.data?(h.default.success("\u5220\u9664\u6210\u529F"),r.current.reload()):h.default.error(l.errors)});case 4:return i.abrupt("return",!0);case 5:case"end":return i.stop()}},t)}));return function(a){return u.apply(this,arguments)}}(),Be=function(){var u=(0,x.Z)((0,d.Z)().mark(function t(){var a,s;return(0,d.Z)().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:a=[],k.forEach(function(c,Z,Ve){a.push({recipeId:c})}),s={deviceId:ge,recipeIdList:a},v.setDeviceRelation(s).then(function(c){c.succeeded?h.default.success("\u7F16\u8F91\u6210\u529F"):h.default.error(c.errors)}),E(!1),r.current.reload();case 6:case"end":return l.stop()}},t)}));return function(){return u.apply(this,arguments)}}(),Re=function(){var u=(0,x.Z)((0,d.Z)().mark(function t(a){var s;return(0,d.Z)().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:s=[],v.getDeviceRelation(a).then(function(c){c.data.forEach(function(Z){s.push(Z.recipeId)}),G(s)});case 2:case"end":return l.stop()}},t)}));return function(a){return u.apply(this,arguments)}}(),Le=function(t){G(t)},Ae=function(t){b(t),J(ye,t)},Te=[{title:"\u4E3B\u952E",dataIndex:"id",tip:"key",hideInSearch:!0,hideInTable:!0},{title:"\u8BBE\u5907\u540D\u79F0",dataIndex:"name",ellipsis:!0},{title:"\u95E8\u5E97\u540D\u79F0",dataIndex:"storeId",valueType:"select",hideInSearch:!0,fieldProps:{options:w}},{title:"\u4F7F\u7528\u60C5\u51B5",dataIndex:"isEnable",valueType:"select",hideInSearch:!0,fieldProps:{options:N}},{title:"\u8BBE\u5907\u552F\u4E00key",dataIndex:"autoKey",ellipsis:!0,hideInSearch:!0},{title:"\u5907\u6CE8",dataIndex:"remark",ellipsis:!0,hideInSearch:!0},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",fixed:"right",width:350,render:function(t,a){return[(0,e.jsx)("a",{onClick:function(){I(!0),j(a)},children:"\u66F4\u65B0"}),(0,e.jsx)("a",{onClick:function(){J(a.storeId,Ce),Ze(a.storeId),Re(a.id),Se(a.id),E(!0)},children:"\u8BBE\u7F6E\u8BBE\u5907\u914D\u65B9"},"edit"),(0,e.jsx)(L.Z,{type:"primary",title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:function(){v.deleteDevice([a.id]).then(function(i){i.succeeded?(h.default.success("\u5220\u9664\u6210\u529F"),r.current.reload()):h.default.error(i.errors)})},children:(0,e.jsx)("a",{href:"#",children:"\u5220\u9664"})},"primary")]}}];return(0,e.jsxs)(q.ZP,{header:{title:"",breadcrumb:{}},children:[(0,e.jsx)(_.ZP,{headerTitle:"\u8BBE\u5907\u5217\u8868",actionRef:r,rowKey:"id",pagination:{defaultPageSize:10},search:{labelWidth:120},toolBarRender:function(){return[(0,e.jsxs)(D.Z,{type:"primary",onClick:function(){I(!0)},children:[(0,e.jsx)(X.Z,{})," \u65B0\u5EFA"]},"primary"),(0,e.jsx)(Fe,{})]},request:function(){var u=(0,x.Z)((0,d.Z)().mark(function t(a){var s,i;return(0,d.Z)().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return s=[],i=0,c.next=4,v.getDevicePage(a).then(function(Z){s=Z.data.data,i=Z.data.total});case 4:return c.abrupt("return",{data:s,total:i});case 5:case"end":return c.stop()}},t)}));return function(t){return u.apply(this,arguments)}}(),columns:Te,rowSelection:{onChange:function(t,a){P(a)}}}),(0,e.jsx)(te,{storeList:w,enableList:N,onFinish:function(){var u=(0,x.Z)((0,d.Z)().mark(function t(a){return(0,d.Z)().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,v.updateDevice(a).then(function(l){l.data?a.id==null?h.default.success("\u6DFB\u52A0\u6210\u529F"):h.default.success("\u4FEE\u6539\u6210\u529F"):h.default.error(l.errors)});case 2:I(!1),j({}),r.current.reload();case 5:case"end":return i.stop()}},t)}));return function(t){return u.apply(this,arguments)}}(),onCancel:function(){I(!1),j({})},modalOpen:se,values:oe||{}}),(0,e.jsxs)(R.Z,{width:800,title:"\u8BBE\u7F6E\u95E8\u5E97\u914D\u65B9",open:de,destroyOnClose:!0,onOk:function(){Be()},onCancel:function(){E(!1),b("")},children:[(0,e.jsxs)(U.Z,{defaultValue:"\u5168\u90E8",style:{width:120,marginBottom:10},onChange:Ae,children:[(0,e.jsx)(Option,{value:"",children:"\u5168\u90E8"}),(0,e.jsx)(Option,{value:!1,children:"\u6807\u51C6\u6A21\u5F0F"}),(0,e.jsx)(Option,{value:!0,children:"\u79F0\u91CD\u6A21\u5F0F"})]}),(0,e.jsx)(Q.Z,{className:"tree-transfer",listStyle:{width:500,height:500},dataSource:he,targetKeys:k,onChange:Le,showSearch:!0,pagination:!0,render:function(t){return t.title}})]})]})},ne=ae}}]);