|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[8954],{10953:function(we,A,n){"use strict";n.r(A),n.d(A,{default:function(){return ne}});var We=n(71194),T=n(50146),Me=n(58996),J=n(77933),$e=n(43358),Q=n(34041),He=n(34792),h=n(48086),Le=n(62350),O=n(24565),Ye=n(57663),C=n(71577),o=n(39428),Z=n(3182),f=n(2824),U=n(49101),d=n(67294),X=n(28790),b=n(16894),Ge=n(62999),q=n(54680),Ke=n(9715),m=n(55843),Ve=n(47673),x=n(4107),e=n(85893),_=function(r){var E=x.Z.TextArea;return(0,e.jsx)(T.Z,{title:r.values.id?"\u7F16\u8F91\u95E8\u5E97":"\u65B0\u5EFA\u95E8\u5E97",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)(x.Z,{})}),(0,e.jsx)(m.Z.Item,{name:"name",label:"\u95E8\u5E97\u540D\u79F0",rules:[{required:!0}],children:(0,e.jsx)(x.Z,{placeholder:"\u8BF7\u8F93\u5165\u95E8\u5E97\u540D\u79F0"})}),(0,e.jsx)(m.Z.Item,{name:"orgId",label:"\u7EC4\u7EC7\u540D\u79F0",rules:[{required:!1}],children:(0,e.jsx)(q.Z,{style:{width:"100%"},dropdownStyle:{maxHeight:400,overflow:"auto"},treeData:r.treeData,placeholder:"\u8BF7\u9009\u62E9\u7EC4\u7EC7\u540D\u79F0",treeDefaultExpandAll:!0,allowClear:!0})}),(0,e.jsx)(m.Z.Item,{name:"header",label:"\u8D1F\u8D23\u4EBA",children:(0,e.jsx)(x.Z,{placeholder:"\u8BF7\u8F93\u5165\u8D1F\u8D23\u4EBA"})}),(0,e.jsx)(m.Z.Item,{name:"phone",label:"\u624B\u673A\u53F7",children:(0,e.jsx)(x.Z,{placeholder:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7"})}),(0,e.jsx)(m.Z.Item,{name:"description",label:"\u63CF\u8FF0",children:(0,e.jsx)(E,{rows:4,rules:[{max:500}]})}),(0,e.jsxs)(m.Z.Item,{children:[(0,e.jsx)(C.Z,{htmlType:"button",style:{float:"right",left:10},onClick:r.onCancel,children:"\u53D6\u6D88"}),(0,e.jsx)(C.Z,{type:"primary",htmlType:"submit",style:{float:"right"},children:"\u4FDD\u5B58"})]})]})})},ee=_,te=n(11849),S=n(48971),g=n(96690),v={getStorePage:function(r){return(0,S.WY)((0,g.w)()+"/api/store/getStorePage",{method:"Post",data:r})},gettree:function(r){return(0,S.WY)((0,g.w)()+"\u200B/api\u200B/organize/tree",{method:"GET",data:(0,te.Z)({},r)})},updateStore:function(r){return(0,S.WY)((0,g.w)()+"/api/store/updateStore",{method:"Post",data:r})},deleteStore:function(r){return(0,S.WY)((0,g.w)()+"/api/store/deleteStore",{method:"Post",data:r})},getAllRecipeList:function(r){return(0,S.WY)((0,g.w)()+"/api/recipe/getAllRecipeList?isWeight=".concat(r),{method:"Get"})},getHasDeviceRelation:function(r){return(0,S.WY)((0,g.w)()+"/api/store/getHasDeviceRelation?storeId=".concat(r),{method:"Get"})},getStoreRelation:function(r){return(0,S.WY)((0,g.w)()+"/api/store/getStoreRelation?storeId=".concat(r),{method:"Get"})},setStoreRelation:function(r){return(0,S.WY)((0,g.w)()+"/api/store/setStoreRelation",{method:"Post",data:r})}},ae=function(){var r=(0,d.useRef)(),E=(0,d.useState)(),P=(0,f.Z)(E,2),re=P[0],F=P[1],ue=(0,d.useState)({}),w=(0,f.Z)(ue,2),se=w[0],j=w[1],le=(0,d.useState)(),W=(0,f.Z)(le,2),D=W[0],M=W[1],ie=(0,d.useState)(!1),$=(0,f.Z)(ie,2),oe=$[0],R=$[1],de=(0,d.useState)(),H=(0,f.Z)(de,2),ce=H[0],fe=H[1],he=(0,d.useState)([]),L=(0,f.Z)(he,2),ve=L[0],pe=L[1],me=(0,d.useState)([]),Y=(0,f.Z)(me,2),G=Y[0],K=Y[1],Se=(0,d.useState)([]),V=(0,f.Z)(Se,2),ge=V[0],Ze=V[1],xe=(0,d.useState)(!1),z=(0,f.Z)(xe,2),ye=z[0],Ce=z[1],Fe=(0,d.useState)(""),N=(0,f.Z)(Fe,2),k=N[0],B=N[1];(0,d.useEffect)(function(){De(),I(k)},[]);function De(){v.gettree().then(function(s){fe(s.data)})}function I(s){v.getAllRecipeList(s).then(function(t){var a=t.data,l=[];a.forEach(function(u){l.push({key:u.id,title:u.name})}),pe(l)})}var Ee=function(){var s=(0,Z.Z)((0,o.Z)().mark(function t(a){return(0,o.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:v.getHasDeviceRelation(a).then(function(i){Ce(i.data)});case 1:case"end":return u.stop()}},t)}));return function(a){return s.apply(this,arguments)}}(),je=function(){return(D==null?void 0:D.length)>0&&(0,e.jsx)(O.Z,{title:"\u786E\u8BA4\u5220\u9664\u5417?",onConfirm:Re,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",children:(0,e.jsx)(C.Z,{type:"primary",children:"\u6279\u91CF\u5220\u9664"})})},Re=function(){var t,a;Be(D),M([]),(t=r.current)===null||t===void 0||(a=t.reloadAndRest)===null||a===void 0||a.call(t)},Be=function(){var s=(0,Z.Z)((0,o.Z)().mark(function t(a){return(0,o.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(a){u.next=2;break}return u.abrupt("return",!0);case 2:return u.next=4,v.deleteStore(a.map(function(i){return i.id})).then(function(i){i.data?(h.default.success("\u5220\u9664\u6210\u529F"),r.current.reload()):h.default.error(i.errors)});case 4:return u.abrupt("return",!0);case 5:case"end":return u.stop()}},t)}));return function(a){return s.apply(this,arguments)}}(),Ie=function(){var s=(0,Z.Z)((0,o.Z)().mark(function t(){var a,l;return(0,o.Z)().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:a=[],G.forEach(function(c,y,ze){a.push({recipeId:c})}),l={storeId:ge,recipeIdList:a},v.setStoreRelation(l).then(function(c){c.succeeded?h.default.success("\u7F16\u8F91\u6210\u529F"):h.default.error(c.errors)}),R(!1),B(""),r.current.reload();case 7:case"end":return i.stop()}},t)}));return function(){return s.apply(this,arguments)}}(),Ae=function(){var s=(0,Z.Z)((0,o.Z)().mark(function t(a){var l;return(0,o.Z)().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:l=[],v.getStoreRelation(a).then(function(c){c.data.forEach(function(y){l.push(y.recipeId)}),K(l)});case 2:case"end":return i.stop()}},t)}));return function(a){return s.apply(this,arguments)}}(),Te=function(t){K(t)},Oe=function(t){B(t),I(t)},Pe=[{title:"\u4E3B\u952E",dataIndex:"id",tip:"key",hideInSearch:!0,hideInTable:!0},{title:"\u95E8\u5E97\u540D\u79F0",dataIndex:"name",ellipsis:!0},{title:"\u7EC4\u7EC7\u540D\u79F0",dataIndex:"orgName",ellipsis:!0,hideInSearch:!0},{title:"\u8D1F\u8D23\u4EBA",dataIndex:"header",ellipsis:!0,hideInSearch:!0},{title:"\u624B\u673A\u53F7",dataIndex:"phone",ellipsis:!0,hideInSearch:!0},{title:"\u63CF\u8FF0",dataIndex:"description",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(){F(!0),j(a)},children:"\u66F4\u65B0"}),(0,e.jsx)("a",{onClick:function(){Ee(a.id),I(k),Ae(a.id),Ze(a.id),R(!0)},children:"\u8BBE\u7F6E\u95E8\u5E97\u914D\u65B9"},"edit"),(0,e.jsx)(O.Z,{type:"primary",title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:function(){v.deleteStore([a.id]).then(function(u){u.succeeded?(h.default.success("\u5220\u9664\u6210\u529F"),r.current.reload()):h.default.error(u.errors)})},children:(0,e.jsx)("a",{href:"#",children:"\u5220\u9664"})},"primary")]}}];return(0,e.jsxs)(X.ZP,{header:{title:"",breadcrumb:{}},children:[(0,e.jsx)(b.ZP,{headerTitle:"\u95E8\u5E97\u5217\u8868",actionRef:r,rowKey:"id",pagination:{defaultPageSize:10},search:{labelWidth:120},toolBarRender:function(){return[(0,e.jsxs)(C.Z,{type:"primary",onClick:function(){F(!0)},children:[(0,e.jsx)(U.Z,{})," \u65B0\u5EFA"]},"primary"),(0,e.jsx)(je,{})]},request:function(){var s=(0,Z.Z)((0,o.Z)().mark(function t(a){var l,u;return(0,o.Z)().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return l=[],u=0,c.next=4,v.getStorePage(a).then(function(y){l=y.data.data,u=y.data.total});case 4:return c.abrupt("return",{data:l,total:u});case 5:case"end":return c.stop()}},t)}));return function(t){return s.apply(this,arguments)}}(),columns:Pe,rowSelection:{onChange:function(t,a){M(a)}}}),(0,e.jsx)(ee,{treeData:ce,onFinish:function(){var s=(0,Z.Z)((0,o.Z)().mark(function t(a){return(0,o.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,v.updateStore(a).then(function(i){i.data?a.id==null?h.default.success("\u6DFB\u52A0\u6210\u529F"):h.default.success("\u4FEE\u6539\u6210\u529F"):h.default.error(i.errors)});case 2:F(!1),j({}),r.current.reload();case 5:case"end":return u.stop()}},t)}));return function(t){return s.apply(this,arguments)}}(),onCancel:function(){F(!1),j({})},modalOpen:re,values:se||{}}),(0,e.jsxs)(T.Z,{width:800,title:"\u8BBE\u7F6E\u95E8\u5E97\u914D\u65B9",open:oe,destroyOnClose:!0,footer:ye?(0,e.jsx)("span",{style:{color:"#FA541C"},children:"\u5DF2\u6709\u8BBE\u5907\u4F7F\u7528\uFF0C\u8BF7\u53D6\u6D88\u8BE5\u95E8\u5E97\u4E0B\u6240\u6709\u8BBE\u5907\u7684\u7ED1\u5B9A\u914D\u65B9!"}):void 0,onOk:function(){Ie()},onCancel:function(){R(!1),B("")},children:[(0,e.jsxs)(Q.Z,{defaultValue:"\u5168\u90E8",style:{width:120,marginBottom:10},onChange:Oe,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)(J.Z,{className:"tree-transfer",listStyle:{width:500,height:500},dataSource:ve,targetKeys:G,onChange:Te,showSearch:!0,pagination:!0,render:function(t){return t.title}})]})]})},ne=ae}}]);
|