(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-5e15"],{"6B8d":function(e,t,i){"use strict";var a=i("zJNJ");i.n(a).a},K2ro:function(e,t,i){},KTTK:function(e,t,i){"use strict";i.d(t,"b",function(){return o}),i.d(t,"a",function(){return n}),i.d(t,"c",function(){return l});var a=i("t3Un");function o(e){return Object(a.a)({url:"template/download",method:"get",params:{filename:e},responseType:"blob"})}function n(e){var t=new FormData;return t.append("file",e.file),Object(a.a)({url:"imageUpload",method:"post",headers:{"Content-Type":"multipart/form-data"},data:t})}function l(e){return Object(a.a)({url:"tenant/list",method:"get",params:e})}},RUEN:function(e,t,i){},WBmV:function(e,t,i){"use strict";var a=i("RUEN");i.n(a).a},"ZB/Q":function(e,t,i){"use strict";i.r(t);var a=i("t3Un"),o=i("Qyje"),n=i.n(o);var l={name:"EditNbDevice",data:function(){return{dialogFormVisible:!1,dialogStatus:"",deviceForm:{id:"",nbDeviceId:"",devcode:"",verifyCode:"",nodeid:"",timeout:0,name:"",manufacturerId:"birmm",manufacturerName:"birmm",deviceType:"BIRMM",model:"birmm-nb",protocalType:"CoAP",isSecure:"FALSE"},textMap:{update:"编辑",create:"新增",detail:"详情"},deviceTypeList:null,deviceModelList:null,showDeviceType:!0,showModelType:!0,isEditMode:!1,saveBtnDisable:!1,rules:{name:[{required:!0,message:"设备名称不能为空",trigger:["blur","change"]}],devcode:[{required:!0,message:"设备编号不能为空",trigger:["blur","change"]}],nodeid:[{required:!0,message:"设备唯一标识必填",trigger:["blur","change"]}],verifyCode:[{required:!0,message:"验证码必填",trigger:["blur","change"]}]}}},methods:{initDialog:function(e,t){var i=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.dialogStatus=e,this.dialogFormVisible=t,"create"===e?(this.resetForm(),this.$nextTick(function(){i.$refs.dataForm.clearValidate()}),this.isEditMode=!1):"update"===e&&(this.deviceForm={id:a.id,nbDeviceId:a.nbDeviceId,devcode:a.devcode,verifyCode:a.verifyCode,nodeid:a.nodeid,timeout:a.timeout,name:a.name,manufacturerId:a.manufacturerId,manufacturerName:a.manufacturerName,deviceType:a.deviceType,model:a.model,protocalType:a.protocalType,isSecure:a.isSecure},this.isEditMode=!0)},resetForm:function(){this.deviceForm={id:"",nbDeviceId:"",devcode:"",verifyCode:"",nodeid:"",timeout:0,name:"",manufacturerId:"birmm",manufacturerName:"birmm",deviceType:"BIRMM",model:"birmm-nb",protocalType:"CoAP",isSecure:"FALSE"}},saveData:function(){"update"===this.dialogStatus?this.updateData():"create"===this.dialogStatus&&this.createData()},createData:function(){var e=this;this.$refs.dataForm.validate(function(t){e.deviceForm.verifyCode=e.deviceForm.nodeid,t&&(e.saveBtnDisable=!0,function(e){return Object(a.a)({url:"nbdevice/add",method:"post",params:e})}(e.deviceForm).then(function(t){200===t.code&&e.$confirm("新增成功,是否继续新增?","提示",{confirmButtonText:"是",cancelButtonText:"否",type:"info"}).then(function(){e.resetForm(),e.saveBtnDisable=!1,e.$nextTick(function(){e.$refs.dataForm.clearValidate()})}).catch(function(){e.$emit("watchChild"),e.dialogFormVisible=!1,e.saveBtnDisable=!1})}).catch(function(t){e.saveBtnDisable=!1}))})},updateData:function(){var e=this;this.$refs.dataForm.validate(function(t){t&&function(e){return Object(a.a)({url:"nbdevice/update",method:"post",params:e})}(e.deviceForm).then(function(t){200===t.code&&(e.$message.success("修改成功"),e.$emit("watchChild"),e.dialogFormVisible=!1)})})},cancel:function(){this.dialogFormVisible=!1,this.$emit("watchChild")}}},r=(i("lbj1"),i("KHd+")),s=Object(r.a)(l,function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("el-dialog",{attrs:{title:e.textMap[e.dialogStatus],visible:e.dialogFormVisible,"append-to-body":""},on:{"update:visible":function(t){e.dialogFormVisible=t}}},[i("el-form",{ref:"dataForm",attrs:{rules:e.rules,model:e.deviceForm,"label-well-code":"right","label-width":"120px"}},[i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"设备编号",prop:"devcode"}},[i("el-input",{attrs:{disabled:e.isEditMode,type:"text",placeholder:"必填"},model:{value:e.deviceForm.devcode,callback:function(t){e.$set(e.deviceForm,"devcode","string"==typeof t?t.trim():t)},expression:"deviceForm.devcode"}})],1)],1),e._v(" "),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"设备唯一标识",prop:"nodeid"}},[i("el-input",{attrs:{disabled:e.isEditMode,type:"text",placeholder:"必填"},model:{value:e.deviceForm.nodeid,callback:function(t){e.$set(e.deviceForm,"nodeid","string"==typeof t?t.trim():t)},expression:"deviceForm.nodeid"}})],1)],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"设备名称",prop:"name"}},[i("el-input",{attrs:{type:"text",placeholder:"必填"},model:{value:e.deviceForm.name,callback:function(t){e.$set(e.deviceForm,"name","string"==typeof t?t.trim():t)},expression:"deviceForm.name"}})],1)],1),e._v(" "),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"验证码"}},[i("el-input",{attrs:{disabled:"",type:"text",placeholder:"必填"},model:{value:e.deviceForm.nodeid,callback:function(t){e.$set(e.deviceForm,"nodeid","string"==typeof t?t.trim():t)},expression:"deviceForm.nodeid"}})],1)],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"设备类型",prop:"deviceType"}},[i("el-input",{attrs:{type:"text",placeholder:"必填"},model:{value:e.deviceForm.deviceType,callback:function(t){e.$set(e.deviceForm,"deviceType","string"==typeof t?t.trim():t)},expression:"deviceForm.deviceType"}})],1)],1),e._v(" "),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"设备型号",prop:"model"}},[i("el-input",{attrs:{type:"text",placeholder:"非必填"},model:{value:e.deviceForm.model,callback:function(t){e.$set(e.deviceForm,"model","string"==typeof t?t.trim():t)},expression:"deviceForm.model"}})],1)],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"厂商ID",prop:".manufacturerId"}},[i("el-input",{attrs:{type:"text",placeholder:"非必填"},model:{value:e.deviceForm.manufacturerId,callback:function(t){e.$set(e.deviceForm,"manufacturerId","string"==typeof t?t.trim():t)},expression:"deviceForm.manufacturerId"}})],1)],1),e._v(" "),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"厂商名称",prop:"manufactureName"}},[i("el-input",{attrs:{type:"text",placeholder:"非必填"},model:{value:e.deviceForm.manufacturerName,callback:function(t){e.$set(e.deviceForm,"manufacturerName","string"==typeof t?t.trim():t)},expression:"deviceForm.manufacturerName"}})],1)],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"设备协议类型",prop:"protocalType"}},[i("el-input",{attrs:{type:"text",placeholder:"非必填"},model:{value:e.deviceForm.protocalType,callback:function(t){e.$set(e.deviceForm,"protocalType","string"==typeof t?t.trim():t)},expression:"deviceForm.protocalType"}})],1)],1),e._v(" "),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"设备安全模式",prop:"isSecure"}},[i("el-input",{attrs:{disabled:e.isEditMode,type:"text",placeholder:"非必填"},model:{value:e.deviceForm.isSecure,callback:function(t){e.$set(e.deviceForm,"isSecure","string"==typeof t?t.trim():t)},expression:"deviceForm.isSecure"}})],1)],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"超时时间",prop:"timeout"}},[i("el-input",{attrs:{disabled:e.isEditMode,type:"text",placeholder:"非必填"},model:{value:e.deviceForm.timeout,callback:function(t){e.$set(e.deviceForm,"timeout","string"==typeof t?t.trim():t)},expression:"deviceForm.timeout"}})],1)],1)],1)],1),e._v(" "),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{attrs:{disabled:e.saveBtnDisable,type:"primary"},on:{click:e.saveData}},[e._v("保存")]),e._v(" "),i("el-button",{on:{click:e.cancel}},[e._v("取消")])],1)],1)},[],!1,null,"b4c36b76",null);s.options.__file="editNbDevice.vue";var c=s.exports,d=i("yH/+"),u=i("KTTK"),m={name:"ListNbDevice",components:{DownloadTemplate:i("eIqJ").a,editNbDevice:c,selectTree:d.a},data:function(){return{listQuery:{devcode:"",deviceType:"",offset:1,limit:20,sort:"id",order:"asc"},columns:[{text:"设备编号",value:"devcode",align:"center"},{text:"设备唯一标识",value:"nodeid",align:"center"},{text:"验证码",value:"verifyCode",align:"center"},{text:"设备名称",value:"name",align:"center"},{text:"厂商名称",value:"manufacturerName",align:"center"},{text:"设备类型",value:"deviceType",width:100,align:"center"},{text:"设备型号",value:"model",align:"center"},{text:"设备协议类型",value:"protocalType",width:110,align:"center"}],multipleSelection:[],list:[],total:0,deviceTypeList:[],deptProps:{parent:"pid",value:"id",label:"name",children:"children"},deptTreeList:null,showDeptTree:0,showDeviceType:!0,listLoading:!0,fullscreenLoading:!1,editShow:!1,detailShow:!1,filename:"nbDevice_template.xlsx",fileList:[]}},created:function(){this.fetchData()},methods:{checkSelection:function(){return 0!==this.multipleSelection.length},add:function(){this.dialogFormVisible=!0,this.editShow=!0,this.$refs.editdevice.initDialog("create",this.dialogFormVisible)},edit:function(e){this.dialogFormVisible=!0,this.editShow=!0,this.$refs.editdevice.initDialog("update",this.dialogFormVisible,e)},detail:function(e){this.dialogFormVisible=!0,this.detailShow=!0,this.$refs.detaildevice.initDialog("detail",this.dialogFormVisible,e)},del:function(){var e=this;if(this.checkSelection()){var t=[];this.multipleSelection.forEach(function(e,i){t.push(e.id)}),this.$confirm("确定要删除所选设备吗?","确认操作",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){(function(e){return Object(a.a)({url:"nbdevice/delete",method:"post",params:{ids:e},paramsSerializer:function(e){return n.a.stringify(e,{indices:!1})}})})(t).then(function(t){200===t.code&&(e.$message.success("删除成功"),e.fetchData())})})}else this.$message.error("至少选中一项")},uploadFile:function(e){var t=this,i=e.file;if(!(i.size/1024/1024<5))return this.$message.error("请上传5M以下的excel文件"),!1;var o=this.$loading({lock:!0,text:"导入中,请稍后...",spinner:"el-icon-loading",background:"rgba(0, 0, 0, 0.7)"});(function(e){var t=new FormData;return t.append("file",e),Object(a.a)({url:"nbdevice/batchImport",method:"post",headers:{"Content-Type":"multipart/form-data"},data:t})})(i).then(function(e){o.close(),200===e.code?(t.$message.success("导入成功"),t.fetchData()):t.$message.error(e.message)}).catch(function(e){o.close()}),this.fileList=[]},downloadTemplate:function(){var e=this,t=this.$loading({lock:!0,text:"下载中,请稍后...",spinner:"el-icon-loading",background:"rgba(0, 0, 0, 0.7)"});Object(u.b)("concenTemplate.xlsx").then(function(e){t.close(),console.log("download===",e);var i=new Blob([e.data]),a=document.createElement("a"),o=window.URL.createObjectURL(i);a.href=o,a.download="new name",document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(o)}).catch(function(i){t.close(),e.$message.error(i.message)})},batchExport:function(){var e=this;console.log("批量导出集中器");var t=this.$loading({lock:!0,text:"下载中,请稍后...",spinner:"el-icon-loading",background:"rgba(0, 0, 0, 0.7)"});(function(e){return Object(a.a)({url:"nbdevice/batchExport",method:"get",params:e,responseType:"blob"})})(this.listQuery).then(function(e){t.close(),console.log("download===",e);var i=new Blob([e.data]),a=document.createElement("a"),o=window.URL.createObjectURL(i);a.href=o,a.download="NB注册信息导出.xlsx",document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(o)}).catch(function(i){t.close(),e.$message.error(i.message)})},search:function(){this.fetchData(!1)},fetchData:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.listLoading=!0,t||(this.listQuery.offset=1),function(e){return Object(a.a)({url:"nbdevice/list",method:"get",params:e})}(this.listQuery).then(function(t){e.list=t.data.rows,e.total=parseInt(t.data.total),e.listLoading=!1})},indexMethod:function(e){return this.listQuery.limit*(this.listQuery.offset-1)+e+1},handleSizeChange:function(e){this.listQuery.limit=e,this.fetchData()},handleCurrentChange:function(e){this.listQuery.offset=e,this.fetchData()},handleSelectionChange:function(e){this.multipleSelection=e}}},p=(i("WBmV"),Object(r.a)(m,function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"app-container"},[i("div",{staticClass:"search-div"},[i("el-form",{ref:"selectForm",staticClass:"form-container",attrs:{inline:!0,model:e.listQuery}},[i("el-row",[i("el-form-item",{staticClass:"selectForm-container-item",attrs:{prop:"devcode"}},[i("el-input",{attrs:{placeholder:"设备编号",clearable:""},model:{value:e.listQuery.devcode,callback:function(t){e.$set(e.listQuery,"devcode","string"==typeof t?t.trim():t)},expression:"listQuery.devcode"}})],1),e._v(" "),i("el-button",{staticClass:"filter-item",attrs:{type:"primary",icon:"el-icon-search"},on:{click:e.search}},[e._v("搜索")])],1)],1)],1),e._v(" "),i("div",[i("el-row",{staticClass:"table-title"},[i("el-col",{attrs:{span:6}},[i("div",{staticClass:"title-header"},[i("i",{staticClass:"el-icon-menu"}),e._v("数据列表")])]),e._v(" "),i("el-col",{staticClass:"edit_btns",attrs:{span:12,offset:6}},[e.hasPerm("/nbdevice/batchImport")?i("download-template",{attrs:{filename:e.filename}}):e._e(),e._v(" "),e.hasPerm("/nbdevice/batchImport")?i("el-upload",{staticClass:"edit_btn",attrs:{limit:1,"show-file-list":!1,"http-request":e.uploadFile,"file-list":e.fileList,action:"string",accept:".xls,.xlsx"}},[i("el-button",{attrs:{slot:"trigger",size:"small"},slot:"trigger"},[e._v("批量导入")])],1):e._e(),e._v(" "),e.hasPerm("/nbdevice/delete")?i("el-button",{staticClass:"edit_btn",attrs:{size:"small"},on:{click:e.del}},[e._v("删除")]):e._e(),e._v(" "),e.hasPerm("/nbdevice/add")?i("el-button",{staticClass:"edit_btn",attrs:{size:"small"},on:{click:e.add}},[e._v("新增")]):e._e()],1)],1),e._v(" "),i("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.listLoading,expression:"listLoading"}],staticClass:"table",attrs:{data:e.list,border:""},on:{"selection-change":e.handleSelectionChange}},[i("el-table-column",{attrs:{align:"center",type:"selection",width:"55"}}),e._v(" "),i("el-table-column",{attrs:{index:e.indexMethod,align:"center",type:"index"}}),e._v(" "),e._l(e.columns,function(t){return i("el-table-column",{key:t.value,attrs:{label:t.text,width:t.width,align:t.align,"show-overflow-tooltip":""},scopedSlots:e._u([{key:"default",fn:function(i){return[e._v("\n "+e._s(i.row[t.value])+"\n ")]}}])})}),e._v(" "),e.hasPerm("/nbdevice/update")?i("el-table-column",{attrs:{label:"操作",align:"center",width:"60"},scopedSlots:e._u([{key:"default",fn:function(t){return[e.hasPerm("/nbdevice/update")?i("el-button",{attrs:{type:"text"},on:{click:function(i){e.edit(t.row)}}},[e._v("编辑")]):e._e()]}}])}):e._e()],2)],1),e._v(" "),i("div",{staticClass:"pagination-container"},[i("el-pagination",{directives:[{name:"show",rawName:"v-show",value:e.total>e.listQuery.limit,expression:"total>listQuery.limit"}],attrs:{"current-page":e.listQuery.offset,"page-sizes":[20,30,50],"page-size":e.listQuery.limit,total:e.total,align:"center",layout:"total, sizes, prev, pager, next"},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}})],1),e._v(" "),i("edit-nb-device",{directives:[{name:"show",rawName:"v-show",value:e.editShow,expression:"editShow"}],ref:"editdevice",on:{watchChild:e.fetchData}})],1)},[],!1,null,"19c09535",null));p.options.__file="listNbDevice.vue";t.default=p.exports},eIqJ:function(e,t,i){"use strict";var a=i("KTTK"),o={name:"DownloadTemplate",props:{filename:{type:String,default:""}},methods:{downloadTemplate:function(){var e=this;if(""!==this.filename){var t=this.filename,i=this.$loading({lock:!0,text:"数据处理中,请稍后...",spinner:"el-icon-loading",background:"rgba(0, 0, 0, 0.7)"});Object(a.b)(t).then(function(e){i.close(),console.log("download===",e);var a=new Blob([e.data]),o=document.createElement("a"),n=window.URL.createObjectURL(a);o.href=n,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(n)}).catch(function(t){i.close(),e.$message.error(t.message)})}}}},n=(i("6B8d"),i("KHd+")),l=Object(n.a)(o,function(){var e=this.$createElement;return(this._self._c||e)("el-button",{staticClass:"edit_btn",attrs:{size:"small"},on:{click:this.downloadTemplate}},[this._v("批量导入模板下载")])},[],!1,null,"5776ee8f",null);l.options.__file="index.vue";t.a=l.exports},lbj1:function(e,t,i){"use strict";var a=i("K2ro");i.n(a).a},zJNJ:function(e,t,i){}}]);