|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[9901],{87430:function(De,_,t){"use strict";t.r(_),t.d(_,{default:function(){return we}});var je=t(57338),se=t(83107),Re=t(57663),ee=t(71577),n=t(39428),Ee=t(34792),y=t(48086),f=t(3182),Te=t(402),te=t(56256),S=t(2824),le=t(49101),ie=t(99165),p=t(67294),oe=t(28790),ce=t(85224),ae=t(16894),O=t(12826),Ie=t(71194),de=t(50146),Be=t(13062),ne=t(71230),$e=t(89032),re=t(15746),Oe=t(43358),ve=t(34041),R=t(48971),E=t(96690);function he(s){return V.apply(this,arguments)}function V(){return V=(0,f.Z)((0,n.Z)().mark(function s(i){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,R.WY)((0,E.zr)()+"/api/devicepushrecode/page",{method:"POST",data:i}));case 1:case"end":return e.stop()}},s)})),V.apply(this,arguments)}function fe(s){return Y.apply(this,arguments)}function Y(){return Y=(0,f.Z)((0,n.Z)().mark(function s(i){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,R.WY)((0,E.zr)()+"/api/devicepushrecode/add",{method:"POST",data:i}));case 1:case"end":return e.stop()}},s)})),Y.apply(this,arguments)}function pe(s){return z.apply(this,arguments)}function z(){return z=(0,f.Z)((0,n.Z)().mark(function s(i){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,R.WY)((0,E.zr)()+"/api/devicepushrecode/update?id="+i,{method:"GET"}));case 1:case"end":return e.stop()}},s)})),z.apply(this,arguments)}function me(s){return H.apply(this,arguments)}function H(){return H=(0,f.Z)((0,n.Z)().mark(function s(i){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,R.WY)((0,E.zr)()+"/api/devicepushrecode/delete",{method:"POST",data:i}));case 1:case"end":return e.stop()}},s)})),H.apply(this,arguments)}function Ze(){return K.apply(this,arguments)}function K(){return K=(0,f.Z)((0,n.Z)().mark(function s(){return(0,n.Z)().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.abrupt("return",(0,R.WY)((0,E.w)()+"/api/device/list",{method:"GET"}));case 1:case"end":return h.stop()}},s)})),K.apply(this,arguments)}function ge(s){return M.apply(this,arguments)}function M(){return M=(0,f.Z)((0,n.Z)().mark(function s(i){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,R.WY)((0,E.w)()+"/api/batching/getpage",{method:"Post",data:i}));case 1:case"end":return e.stop()}},s)})),M.apply(this,arguments)}function ye(s){return N.apply(this,arguments)}function N(){return N=(0,f.Z)((0,n.Z)().mark(function s(i){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,R.WY)((0,E.w)()+"/api/producttopics/list",{method:"Post",data:i}));case 1:case"end":return e.stop()}},s)})),N.apply(this,arguments)}var a=t(85893),Se=function(i){var h=(0,p.useState)([]),e=(0,S.Z)(h,2),A=e[0],L=e[1],W=(0,p.useState)([]),b=(0,S.Z)(W,2),T=b[0],P=b[1],U=(0,p.useState)([]),F=(0,S.Z)(U,2),c=F[0],I=F[1],X=(0,p.useState)(),G=(0,S.Z)(X,2),D=G[0],B=G[1],ue=(0,p.useState)([]),J=(0,S.Z)(ue,2),k=J[0],Q=J[1],q=(0,p.useState)([]),o=(0,S.Z)(q,2),r=o[0],u=o[1],m=(0,p.useRef)();(0,p.useEffect)(function(){console.log(i.values),Ze().then(function(Z){Q(Z.data);var d=Z.data.map(function(v){return{value:v.id,label:v.name}});L(d)})},[i.values]);var l=function(d){B(d);var v=k.find(function(C){return C.id==d});ye({productId:v==null?void 0:v.productId,productVesionId:v==null?void 0:v.productVersionId,IsDefault:!0}).then(function(C){u(C.data)})},x=function(){var Z=(0,f.Z)((0,n.Z)().mark(function d(v){return(0,n.Z)().wrap(function(j){for(;;)switch(j.prev=j.next){case 0:return j.next=2,fe(v).then(function(w){w.data?(y.default.success("\u64CD\u4F5C\u6210\u529F"),P([]),B()):y.default.error(w.errors),i.HandleOk(w.data)});case 2:case"end":return j.stop()}},d)}));return function(v){return Z.apply(this,arguments)}}(),g=[{title:"\u7F16\u7801",dataIndex:"code",valueType:"textarea",with:50},{title:"\u540D\u79F0",dataIndex:"name",valueType:"textarea"}];return(0,a.jsxs)(de.Z,{title:"\u4E0B\u53D1\u6570\u636E",width:1040,visible:i.createModalVisible,bodyStyle:{padding:"32px 40px 1px 48px"},okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",onOk:function(){if(!D)y.default.error("\u8BF7\u9009\u62E9\u8BBE\u5907");else{var d=k.find(function(C){return C.id==D});if(T.length==0)y.default.error("\u8BF7\u9009\u62E9\u7269\u6599\u6570\u636E");else{var v={deviceId:d.id,deviceName:d.name,deviceAutoKey:d.autoKey,type:2,data:T,productVersion:d.vesion,productKey:d.prductKey,topicsData:r};x(v),console.log(d)}}},onCancel:function(){i.onCancel(),P([]),B()},destroyOnClose:!0,children:[(0,a.jsx)(ne.Z,{gutter:26,style:{marginBottom:20},children:(0,a.jsxs)(re.Z,{lg:24,md:24,sm:24,children:["\u9009\u62E9\u8BBE\u5907\uFF1A",(0,a.jsx)(ve.Z,{allowClear:!0,style:{width:"60%"},placeholder:"\u8BF7\u9009\u62E9\u8981\u4E0B\u53D1\u8BBE\u5907",onChange:l,options:A})]})}),(0,a.jsx)(ne.Z,{gutter:26,children:(0,a.jsxs)(re.Z,{span:24,children:["\u9009\u62E9\u6570\u636E\uFF1A",(0,a.jsx)(ae.ZP,{headerTitle:"",actionRef:m,rowKey:"id",pagination:{defaultPageSize:10},search:{labelWidth:120},columns:g,request:function(){var Z=(0,f.Z)((0,n.Z)().mark(function d(v){var C,j,w;return(0,n.Z)().wrap(function($){for(;;)switch($.prev=$.next){case 0:return C=0,j=[],$.next=4,ge(v);case 4:return w=$.sent,w.statusCode==200&&(I(w.data.data),j=w.data.data,C=w.data.total),$.abrupt("return",{data:j,success:!0,total:C});case 7:case"end":return $.stop()}},d)}));return function(d){return Z.apply(this,arguments)}}(),rowSelection:{onChange:function(d,v){P(v)}}})]})})]})},xe=Se,Ce=t(59914),Pe=function(){var i=(0,p.useState)(!1),h=(0,S.Z)(i,2),e=h[0],A=h[1],L=(0,p.useState)(!1),W=(0,S.Z)(L,2),b=W[0],T=W[1],P=(0,p.useRef)(),U=(0,p.useState)(),F=(0,S.Z)(U,2),c=F[0],I=F[1],X=(0,p.useState)([]),G=(0,S.Z)(X,2),D=G[0],B=G[1],ue=te.Z.Paragraph,J=te.Z.Text;(0,p.useEffect)(function(){},[]);var k=function(){var o=(0,f.Z)((0,n.Z)().mark(function r(u){var m;return(0,n.Z)().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:if(m=y.default.loading("\u6B63\u5728\u5220\u9664"),u){x.next=3;break}return x.abrupt("return",!0);case 3:return x.next=5,me(u.map(function(g){return g.id})).then(function(g){g.succeeded?(y.default.success("\u5220\u9664\u6210\u529F"),P.current.reload()):y.default.error(g.errors)});case 5:return m(),x.abrupt("return",!0);case 7:case"end":return x.stop()}},r)}));return function(u){return o.apply(this,arguments)}}(),Q=[{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(){I(u),T(!0)},children:r})}},{title:"\u4E0B\u53D1\u8BBE\u5907",dataIndex:"deviceName",valueType:"textarea",ellipsis:!0},{title:"\u4E0B\u53D1\u72B6\u6001",dataIndex:"status",ellipsis:!0,valueEnum:{1:{text:"\u6210\u529F",status:"Success"},2:{text:"\u5931\u8D25",status:"Processing"}}},{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(){T(!0),I(u)},children:"\u4E0B\u53D1\u8BE6\u60C5"},"config"),(0,a.jsx)("a",{onClick:function(){pe(u.id).then(function(l){l.data?(y.default.success("\u64CD\u4F5C\u6210\u529F"),P.current.reload()):y.default.error("\u64CD\u4F5C\u5931\u8D25")})},children:"\u91CD\u53D1"},"config")]}}],q=function(){var o=(0,f.Z)((0,n.Z)().mark(function r(u){return(0,n.Z)().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:A(!u),P.current.reload();case 2:case"end":return l.stop()}},r)}));return function(u){return o.apply(this,arguments)}}();return(0,a.jsxs)(oe.ZP,{host:!0,header:{title:"",breadcrumb:{}},children:[(0,a.jsx)(ae.ZP,{headerTitle:"",actionRef:P,rowKey:"id",pagination:{defaultPageSize:10},search:{labelWidth:120},toolBarRender:function(){return[(0,a.jsxs)(ee.Z,{type:"primary",onClick:function(){A(!0)},children:[(0,a.jsx)(le.Z,{})," \u4E0B\u53D1\u6570\u636E"]},"primary")]},request:function(){var o=(0,f.Z)((0,n.Z)().mark(function r(u){var m,l;return(0,n.Z)().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return m=[],l=0,u.type=2,g.next=5,he(u).then(function(Z){m=Z.data.data,l=Z.data.total});case 5:return g.abrupt("return",{data:m,success:!0,total:l});case 6:case"end":return g.stop()}},r)}));return function(r){return o.apply(this,arguments)}}(),columns:Q,rowSelection:{onChange:function(r,u){B(u)}}}),(D==null?void 0:D.length)>0&&(0,a.jsx)(ce.Z,{extra:(0,a.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,a.jsx)("a",{style:{fontWeight:600},children:D.length})," ","\u9879 \xA0\xA0"]}),children:(0,a.jsx)(ee.Z,{onClick:(0,f.Z)((0,n.Z)().mark(function o(){var r,u;return(0,n.Z)().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,k(D);case 2:B([]),(r=P.current)===null||r===void 0||(u=r.reloadAndRest)===null||u===void 0||u.call(r);case 4:case"end":return l.stop()}},o)})),children:"\u5220\u9664"})}),(0,a.jsx)(xe,{onFinish:function(){var o=(0,f.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 o.apply(this,arguments)}}(),onCancel:function(){A(!1),I(void 0)},createModalVisible:e,HandleOk:q,values:c||{}}),(0,a.jsx)(se.Z,{width:600,visible:b,onClose:function(){I(void 0),T(!1)},closable:!1,children:(c==null?void 0:c.deviceName)&&(0,a.jsxs)(O.ZP,{column:1,title:"\u4E0B\u53D1\u8BE6\u60C5",children:[(0,a.jsx)(O.ZP.Item,{label:"\u4E0B\u53D1\u8BBE\u5907",valueType:"text",children:c==null?void 0:c.deviceName}),(0,a.jsx)(O.ZP.Item,{label:"topic",copyable:!0,valueType:"text",children:c==null?void 0:c.topic}),(0,a.jsx)(O.ZP.Item,{label:"\u4E0B\u53D1\u72B6\u6001",valueType:"text",children:c==null?void 0:c.description}),(0,a.jsx)(O.ZP.Item,{contentStyle:{maxWidth:"85%"},label:"\u4E0B\u53D1\u6570\u636E",children:(0,a.jsxs)("a",{onClick:function(){var r=document.createElement("input");r.value=c.dataResore,document.body.appendChild(r),r.select(),document.execCommand("Copy"),y.default.success("\u590D\u5236\u6210\u529F"),r.remove()},children:[(0,a.jsx)(ie.Z,{}),(0,a.jsx)("div",{style:{overflow:"scroll",overflowX:"auto"},children:(0,a.jsx)(Ce.ZP,{text:c==null?void 0:c.dataResore,valueType:"jsonCode"})})]})})]})})]})},we=Pe}}]);
|