|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[6675],{37542:function(Te,X,t){"use strict";t.r(X),t.d(X,{default:function(){return xe}});var we=t(57338),ne=t(83107),Re=t(57663),q=t(71577),je=t(62350),re=t(24565),n=t(39428),Ee=t(34792),S=t(48086),g=t(3182),Ge=t(402),ue=t(56256),y=t(2824),se=t(49101),v=t(67294),le=t(28790),oe=t(85224),_=t(16894),I=t(12826),Ie=t(71194),ie=t(50146),Be=t(13062),ee=t(71230),$e=t(89032),te=t(15746),Fe=t(43358),ce=t(34041),de=t(11849),P=t(48971);function he(s){return Y.apply(this,arguments)}function Y(){return Y=(0,g.Z)((0,n.Z)().mark(function s(o){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,P.WY)("/groupmeal/api/devicepushrecode/page",{method:"POST",data:o}));case 1:case"end":return e.stop()}},s)})),Y.apply(this,arguments)}function ve(s){return N.apply(this,arguments)}function N(){return N=(0,g.Z)((0,n.Z)().mark(function s(o){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,P.WY)("/groupmeal/api/devicepushrecode/add",{method:"POST",data:o}));case 1:case"end":return e.stop()}},s)})),N.apply(this,arguments)}function Ae(s){return z.apply(this,arguments)}function z(){return z=_asyncToGenerator(_regeneratorRuntime().mark(function s(o){return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",request("/groupmeal/api/devicepushrecode/update",{method:"POST",data:o}));case 1:case"end":return e.stop()}},s)})),z.apply(this,arguments)}function fe(s){return H.apply(this,arguments)}function H(){return H=(0,g.Z)((0,n.Z)().mark(function s(o){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,P.WY)("/groupmeal/api/devicepushrecode/delete",{method:"POST",data:o}));case 1:case"end":return e.stop()}},s)})),H.apply(this,arguments)}function pe(){return K.apply(this,arguments)}function K(){return K=(0,g.Z)((0,n.Z)().mark(function s(){return(0,n.Z)().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return f.abrupt("return",(0,P.WY)("/saasbase/api/device/list",{method:"GET"}));case 1:case"end":return f.stop()}},s)})),K.apply(this,arguments)}function me(s){return M.apply(this,arguments)}function M(){return M=(0,g.Z)((0,n.Z)().mark(function s(o){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,P.WY)("\u200B/saasbase/api\u200B/goodstype/tree",{method:"GET",data:(0,de.Z)({},o)}));case 1:case"end":return e.stop()}},s)})),M.apply(this,arguments)}function ge(s){return V.apply(this,arguments)}function V(){return V=(0,g.Z)((0,n.Z)().mark(function s(o){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,P.WY)("/saasbase/api/goods/page",{method:"Post",data:o}));case 1:case"end":return e.stop()}},s)})),V.apply(this,arguments)}var a=t(85893),ye=function(o){var f=(0,v.useState)([]),e=(0,y.Z)(f,2),w=e[0],k=e[1],B=(0,v.useState)([]),$=(0,y.Z)(B,2),R=$[0],x=$[1],L=(0,v.useState)([]),j=(0,y.Z)(L,2),p=j[0],T=j[1],U=(0,v.useState)(),E=(0,y.Z)(U,2),C=E[0],F=E[1],J=(0,v.useState)(),A=(0,y.Z)(J,2),G=A[0],Q=A[1],c=(0,v.useState)([]),r=(0,y.Z)(c,2),u=r[0],h=r[1],l=(0,v.useState)(!1),i=(0,y.Z)(l,2),m=i[0],O=i[1],Ce=(0,v.useRef)();(0,v.useEffect)(function(){console.log(o.values),pe().then(function(d){h(d.data);var Z=d.data.map(function(W){return{value:W.id,label:W.name}});k(Z)}),me().then(function(d){F(d.data)});var D={current:1,pageSize:10};ae(D)},[o.values]);var ae=function(d){ge(d).then(function(Z){T(Z.data.data)})},De=function(d){Q(d);var Z={current:1,pageSize:10,deviceId:d};ae(Z)},Oe=function(d){G?O(d):S.default.error("\u8BF7\u5148\u9009\u62E9\u8BBE\u5907")},Pe=[{title:"\u7F16\u7801",dataIndex:"code",valueType:"textarea",hideInTable:!0,hideInSearch:!0},{title:"\u540D\u79F0",dataIndex:"name",valueType:"textarea"},{title:"\u5546\u54C1\u7C7B\u578B",dataIndex:"goodsTypeName",valueType:"treeSelect",fieldProps:{showSearch:!0,allowClear:!0,options:C}}];return(0,a.jsxs)(ie.Z,{title:"\u4E0B\u53D1\u6570\u636E",width:1040,visible:o.createModalVisible,bodyStyle:{padding:"32px 40px 1px 48px"},okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",onOk:function(){if(!G)S.default.error("\u8BF7\u9009\u62E9\u8BBE\u5907");else{var d=u.find(function(b){return b.id==G}),Z={goodstechnology:[]};if(R.map(function(b){b.goodstechnology.length>0&&Z.goodstechnology.push(b.goodstechnology)}),Z.goodstechnology.length==0)S.default.error("\u9009\u62E9\u7684\u5546\u54C1\u8FD8\u6CA1\u6709\u5DE5\u827A");else{var W={deviceId:d.id,deviceName:d.name,deviceAutoKey:d.autoKey,type:4,data:Z};o.HandleOk(W),console.log(d)}}},onCancel:function(){o.onCancel()},destroyOnClose:!0,children:[(0,a.jsx)(ee.Z,{gutter:26,style:{marginBottom:20},children:(0,a.jsxs)(te.Z,{lg:24,md:24,sm:24,children:["\u9009\u62E9\u8BBE\u5907\uFF1A",(0,a.jsx)(ce.Z,{allowClear:!0,style:{width:"60%"},placeholder:"\u8BF7\u9009\u62E9\u8981\u4E0B\u53D1\u8BBE\u5907",onChange:De,options:w})]})}),(0,a.jsx)(ee.Z,{gutter:26,children:(0,a.jsxs)(te.Z,{span:24,children:["\u9009\u62E9\u6570\u636E\uFF1A",(0,a.jsx)(_.ZP,{headerTitle:"",actionRef:Ce,rowKey:"id",pagination:{defaultPageSize:10},search:{labelWidth:120},dataSource:p,columns:Pe,rowSelection:{onChange:function(d,Z){x(Z)}}})]})})]})},Ze=ye,Se=function(){var o=(0,v.useState)(!1),f=(0,y.Z)(o,2),e=f[0],w=f[1],k=(0,v.useState)(!1),B=(0,y.Z)(k,2),$=B[0],R=B[1],x=(0,v.useRef)(),L=(0,v.useState)(),j=(0,y.Z)(L,2),p=j[0],T=j[1],U=(0,v.useState)([]),E=(0,y.Z)(U,2),C=E[0],F=E[1],J=ue.Z.Paragraph;(0,v.useEffect)(function(){},[]);var A=function(){var c=(0,g.Z)((0,n.Z)().mark(function r(u){var h;return(0,n.Z)().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(h=S.default.loading("\u6B63\u5728\u5220\u9664"),u){i.next=3;break}return i.abrupt("return",!0);case 3:return i.next=5,fe(u.map(function(m){return m.id})).then(function(m){m.succeeded?(S.default.success("\u5220\u9664\u6210\u529F"),x.current.reload()):S.default.error(m.errors)});case 5:return h(),i.abrupt("return",!0);case 7:case"end":return i.stop()}},r)}));return function(u){return c.apply(this,arguments)}}(),G=[{title:"\u4E3B\u952E",dataIndex:"id",hideInSearch:!0,hideInTable:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",render:function(r,u){return(0,a.jsx)("a",{onClick:function(){T(u),R(!0)},children:r})}},{title:"\u4E0B\u53D1\u8BBE\u5907",dataIndex:"deviceName",valueType:"textarea",ellipsis:!0},{title:"\u4E0B\u53D1\u6570\u636E",dataIndex:"type",ellipsis:!0,valueEnum:{4:{text:"\u5DE5\u827A"}}},{title:"\u4E0B\u53D1\u65F6\u95F4",dataIndex:"createAt",hideInSearch:!0},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(r,u){return[(0,a.jsx)("a",{onClick:function(){R(!0),T(u)},children:"\u4E0B\u53D1\u8BE6\u60C5"},"config"),(0,a.jsx)(re.Z,{type:"primary",title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:(0,g.Z)((0,n.Z)().mark(function h(){return(0,n.Z)().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,DeleteGoodsType(u.id).then(function(m){m.succeeded?(S.default.success("\u5220\u9664\u6210\u529F"),x.current.reload()):S.default.error(m.errors)});case 2:case"end":return i.stop()}},h)})),onCancel:function(){},children:(0,a.jsx)("a",{href:"#",children:"\u5220\u9664"})},"primary")]}}],Q=function(){var c=(0,g.Z)((0,n.Z)().mark(function r(u){return(0,n.Z)().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,ve(u).then(function(i){i.data?(S.default.success("\u64CD\u4F5C\u6210\u529F"),w(!1),x.current.reload()):S.default.error("\u64CD\u4F5C\u5931\u8D25")});case 2:case"end":return l.stop()}},r)}));return function(u){return c.apply(this,arguments)}}();return(0,a.jsxs)(le.ZP,{host:!0,header:{title:"",breadcrumb:{}},children:[(0,a.jsx)(_.ZP,{headerTitle:"",actionRef:x,rowKey:"id",pagination:{defaultPageSize:10},search:{labelWidth:120},toolBarRender:function(){return[(0,a.jsxs)(q.Z,{type:"primary",onClick:function(){w(!0)},children:[(0,a.jsx)(se.Z,{})," \u4E0B\u53D1\u6570\u636E"]},"primary")]},request:function(){var c=(0,g.Z)((0,n.Z)().mark(function r(u){var h,l;return(0,n.Z)().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return h=[],l=0,u.type=4,m.next=5,he(u).then(function(O){h=O.data.data,l=O.data.total});case 5:return m.abrupt("return",{data:h,success:!0,total:l});case 6:case"end":return m.stop()}},r)}));return function(r){return c.apply(this,arguments)}}(),columns:G,rowSelection:{onChange:function(r,u){F(u)}}}),(C==null?void 0:C.length)>0&&(0,a.jsx)(oe.Z,{extra:(0,a.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,a.jsx)("a",{style:{fontWeight:600},children:C.length})," ","\u9879 \xA0\xA0"]}),children:(0,a.jsx)(q.Z,{onClick:(0,g.Z)((0,n.Z)().mark(function c(){var r,u;return(0,n.Z)().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,A(C);case 2:F([]),(r=x.current)===null||r===void 0||(u=r.reloadAndRest)===null||u===void 0||u.call(r);case 4:case"end":return l.stop()}},c)})),children:"\u5220\u9664"})}),(0,a.jsx)(Ze,{onFinish:function(){var c=(0,g.Z)((0,n.Z)().mark(function r(u){return(0,n.Z)().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:case"end":return l.stop()}},r)}));return function(r){return c.apply(this,arguments)}}(),onCancel:function(){w(!1),T(void 0)},createModalVisible:e,HandleOk:Q,values:p||{}}),(0,a.jsx)(ne.Z,{width:600,visible:$,onClose:function(){T(void 0),R(!1)},closable:!1,children:(p==null?void 0:p.deviceName)&&(0,a.jsxs)(I.ZP,{column:1,title:"\u4E0B\u53D1\u8BE6\u60C5",children:[(0,a.jsx)(I.ZP.Item,{label:"\u4E0B\u53D1\u8BBE\u5907",valueType:"text",children:p==null?void 0:p.deviceName}),(0,a.jsx)(I.ZP.Item,{label:"topic",valueType:"text",copyable:!0,children:(0,a.jsx)(J,{copyable:!0,children:p==null?void 0:p.topic})}),(0,a.jsx)(I.ZP.Item,{contentStyle:{maxWidth:"85%"},label:"\u4E0B\u53D1\u6570\u636E",valueType:"jsonCode",children:p==null?void 0:p.dataResore})]})})]})},xe=Se}}]);
|