|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[8395],{61863:function(Ze,V,t){"use strict";t.r(V),t.d(V,{default:function(){return ce}});var ge=t(57663),E=t(71577),Se=t(58024),z=t(91894),ye=t(32157),U=t(7573),y=t(2824),n=t(39428),I=t(11849),Ce=t(34792),h=t(48086),f=t(3182),H=t(49101),Z=t(67294),J=t(78009),Q=t(85224),W=t(53779),De=t(71194),X=t(50146),T=t(48971);function q(u,r){return F.apply(this,arguments)}function F(){return F=(0,f.Z)((0,n.Z)().mark(function u(r,i){return(0,n.Z)().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.abrupt("return",(0,T.WY)("/kitchen/api/Device/GetDeviceGoods",{method:"POST",data:(0,I.Z)({},r)}));case 1:case"end":return c.stop()}},u)})),F.apply(this,arguments)}function _(u){return x.apply(this,arguments)}function x(){return x=(0,f.Z)((0,n.Z)().mark(function u(r){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,T.WY)("/kitchen/api/Device/AddDeviceGood",{method:"POST",data:(0,I.Z)({},r)}));case 1:case"end":return e.stop()}},u)})),x.apply(this,arguments)}function ee(u){return A.apply(this,arguments)}function A(){return A=(0,f.Z)((0,n.Z)().mark(function u(r){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,T.WY)("\u200B/kitchen/api/Device/DelDeviceGood",{method:"POST",data:r}));case 1:case"end":return e.stop()}},u)})),A.apply(this,arguments)}function ae(u){return B.apply(this,arguments)}function B(){return B=(0,f.Z)((0,n.Z)().mark(function u(r){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,T.WY)("/kitchen/api/Device/StoreDeviceTree?isTMC=false",{data:(0,I.Z)({},r)}));case 1:case"end":return e.stop()}},u)})),B.apply(this,arguments)}function te(u){return P.apply(this,arguments)}function P(){return P=(0,f.Z)((0,n.Z)().mark(function u(r){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,T.WY)("/kitchen/\u200Bapi/Device/GetGoods",{method:"POST",data:(0,I.Z)({},r)}));case 1:case"end":return e.stop()}},u)})),P.apply(this,arguments)}var s=t(85893),re=function(r){var i=(0,Z.useState)([]),e=(0,y.Z)(i,2),c=e[0],a=e[1],p=[{title:"\u5546\u54C1id",dataIndex:"goodsId",tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",hideInSearch:!0,hideInTable:!0},{title:"\u5546\u54C1\u540D\u79F0",dataIndex:"goodsName"}];return(0,s.jsx)(X.Z,{width:700,bodyStyle:{padding:"32px 40px 48px"},destroyOnClose:!0,title:"\u9009\u62E9\u5546\u54C1",visible:r.modalVisible,onCancel:function(){return r.onCancel()},onOk:function(){return r.onSubmit(c)},maskClosable:!1,children:(0,s.jsx)(W.ZP,{headerTitle:"\u5546\u54C1\u4FE1\u606F",rowKey:"goodsId",pagination:{defaultPageSize:5e3},search:!1,toolBarRender:!1,params:{DeviceId:r.values},request:function(){var C=(0,f.Z)((0,n.Z)().mark(function $(b){var k,D;return(0,n.Z)().wrap(function(S){for(;;)switch(S.prev=S.next){case 0:return k=[],D=0,S.next=4,te(b).then(function(O){k=O.data,D=1});case 4:return S.abrupt("return",{data:k,success:!0,total:D});case 5:case"end":return S.stop()}},$)}));return function($){return C.apply(this,arguments)}}(),columns:p,rowSelection:{onChange:function($,b){return a(b)}}})})},ne=re,ue=t(817),se=function(){var u=(0,f.Z)((0,n.Z)().mark(function r(i){var e;return(0,n.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return e=h.default.loading("\u6B63\u5728\u6DFB\u52A0"),a.prev=1,a.next=4,_((0,I.Z)({},i)).then(function(p){if(!p.succeeded)return h.default.error(p.errors),!1});case 4:return e(),h.default.success("\u6DFB\u52A0\u6210\u529F"),a.abrupt("return",!0);case 9:return a.prev=9,a.t0=a.catch(1),e(),h.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),a.abrupt("return",!1);case 14:case"end":return a.stop()}},r,null,[[1,9]])}));return function(i){return u.apply(this,arguments)}}(),le=function(){var u=(0,f.Z)((0,n.Z)().mark(function r(i){var e;return(0,n.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,h.default.loading("\u6B63\u5728\u5220\u9664"),e=[],i.forEach(function(p){e.push(p.id)}),a.next=6,ee(e).then(function(p){return p.data?(h.default.success("\u5220\u9664\u6210\u529F"),!0):(h.default.success("\u5220\u9664\u5931\u8D25"),!1)});case 6:a.next=12;break;case 8:return a.prev=8,a.t0=a.catch(0),h.default.error("\u5220\u9664\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),a.abrupt("return",!1);case 12:case"end":return a.stop()}},r,null,[[0,8]])}));return function(i){return u.apply(this,arguments)}}(),ie=function(){var r=(0,Z.useState)(),i=(0,y.Z)(r,2),e=i[0],c=i[1],a=(0,Z.useRef)(),p=(0,Z.useState)(),C=(0,y.Z)(p,2),$=C[0],b=C[1],k=(0,Z.useState)(),D=(0,y.Z)(k,2),w=D[0],S=D[1],O=(0,Z.useState)(!1),M=(0,y.Z)(O,2),oe=M[0],Y=M[1],de=(0,Z.useState)(),K=(0,y.Z)(de,2),L=K[0],fe=K[1],ve=(0,Z.useState)(),N=(0,y.Z)(ve,2),G=N[0],he=N[1];(0,Z.useEffect)(function(){function d(){ae().then(function(l){b(l.data)})}d()},[]);var pe=[{title:"\u5546\u54C1\u540D\u79F0",dataIndex:"goods_Name"}];return(0,s.jsxs)(J.ZP,{children:[(0,s.jsx)(W.ZP,{headerTitle:"\u5546\u54C1\u5217\u8868",actionRef:a,rowKey:"id",search:{labelWidth:120},tableRender:function(l,v){return(0,s.jsxs)("div",{style:{display:"flex",width:"100%"},children:[(0,s.jsx)(z.Z,{title:"\u5E97\u94FA\u8BBE\u5907\u5217\u8868",children:(0,s.jsx)(U.Z,{defaultExpandAll:!0,onSelect:function(o,j){return[he(o[0]),fe(j.node)]},treeData:$})}),(0,s.jsx)("div",{style:{flex:1},children:v})]})},toolBarRender:function(){return[(0,s.jsxs)(E.Z,{type:"primary",onClick:function(){c(!0)},children:[(0,s.jsx)(H.Z,{})," \u4E0A\u67B6\u83DC\u54C1\u5546\u54C1"]},"primary"),(0,s.jsx)(E.Z,{type:"primary",onClick:function(){if(G==null){h.default.error("\u8BF7\u9009\u62E9\u8BBE\u5907");return}L.parentId!="0"&&Y(!0)},children:"\u8BBE\u5907\u5E93\u5B58\u7BA1\u7406"},"primary")]},params:{DeviceId:G},request:function(){var d=(0,f.Z)((0,n.Z)().mark(function l(v){var g,o;return(0,n.Z)().wrap(function(R){for(;;)switch(R.prev=R.next){case 0:return g=[],o=0,R.next=4,q(v).then(function(m){g=m.data.data,o=m.data.total});case 4:return R.abrupt("return",{data:g,success:!0,total:o});case 5:case"end":return R.stop()}},l)}));return function(l){return d.apply(this,arguments)}}(),columns:pe,rowSelection:{onChange:function(l,v){S(v)}}}),(w==null?void 0:w.length)>0&&(0,s.jsx)(Q.Z,{extra:(0,s.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,s.jsx)("a",{style:{fontWeight:600},children:w.length})," ","\u9879 \xA0\xA0"]}),children:(0,s.jsx)(E.Z,{onClick:(0,f.Z)((0,n.Z)().mark(function d(){var l,v;return(0,n.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,le(w);case 2:S([]),(l=a.current)===null||l===void 0||(v=l.reloadAndRest)===null||v===void 0||v.call(l);case 4:case"end":return o.stop()}},d)})),children:"\u6279\u91CF\u5220\u9664"})}),(0,s.jsx)(ne,{onSubmit:function(){var d=(0,f.Z)((0,n.Z)().mark(function l(v){var g,o,j;return(0,n.Z)().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:if(G!=null){m.next=5;break}h.default.error("\u8BF7\u9009\u62E9\u8BBE\u5907"),c(!1),m.next=13;break;case 5:return g=[],v.map(function(me){g.push({FoodId:me.goodsId})}),o={DeviceId:G,Foodss:g},j=!1,m.next=11,se(o);case 11:j=m.sent,j&&(c(!1),a.current&&a.current.reload());case 13:case"end":return m.stop()}},l)}));return function(l){return d.apply(this,arguments)}}(),onCancel:function(){c(!1)},modalVisible:e,values:G}),(0,s.jsx)(ue.default,{onCancel:function(){Y(!1)},stockModalVisible:oe,values:L})]})},ce=ie}}]);
|