Newer
Older
smartwell_front_dz / smartwell / static / js / 8282.ed3c0d06.js
wangxitong on 11 Sep 2023 14 KB first commit
"use strict";(self["webpackChunknewfront"]=self["webpackChunknewfront"]||[]).push([[8282],{88282:(e,t,i)=>{i.r(t),i.d(t,{default:()=>$});i(74916),i(64765),i(73210);var a=function(){var e=this,t=e._self._c;return t("app-container",[t("search-area",{attrs:{size:"small"},on:{search:e.search}},[t("search-item",[t("el-input",{attrs:{size:"small",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)],1),t("div",[t("el-row",{staticClass:"table-title"},[t("el-col",{attrs:{span:6}},[t("div",{staticClass:"title-header"},[t("i",{staticClass:"el-icon-menu"}),e._v("数据列表 ")])]),t("el-col",{staticClass:"edit_btns",attrs:{span:12,offset:6}},[e.hasPerm("/nbdevice/batchImport")?t("download-template",{attrs:{filename:e.filename}}):e._e(),e.hasPerm("/nbdevice/batchImport")?t("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"}},[t("el-button",{attrs:{slot:"trigger",size:"small"},slot:"trigger"},[e._v(" 批量导入 ")])],1):e._e(),e.hasPerm("/nbdevice/delete")?t("el-button",{staticClass:"edit_btn",attrs:{size:"small"},on:{click:e.del}},[e._v(" 删除 ")]):e._e(),e.hasPerm("/nbdevice/add")?t("el-button",{staticClass:"edit_btn",attrs:{size:"small"},on:{click:e.add}},[e._v(" 新增 ")]):e._e()],1)],1),t("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}},[t("el-table-column",{attrs:{align:"center",type:"selection",width:"55"}}),t("el-table-column",{attrs:{index:e.indexMethod,align:"center",type:"index"}}),e._l(e.columns,(function(i){return t("el-table-column",{key:i.value,attrs:{label:i.text,width:i.width,align:i.align,"show-overflow-tooltip":""},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v(" "+e._s(t.row[i.value])+" ")]}}],null,!0)})})),e.hasPerm("/nbdevice/update")?t("el-table-column",{attrs:{label:"操作",align:"center",width:"60"},scopedSlots:e._u([{key:"default",fn:function(i){return[e.hasPerm("/nbdevice/update")?t("el-button",{attrs:{type:"text"},on:{click:function(t){return e.edit(i.row)}}},[e._v(" 编辑 ")]):e._e()]}}],null,!1,3601428897)}):e._e()],2)],1),t("div",{staticClass:"pagination-container"},[t("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),t("edit-nb-device",{directives:[{name:"show",rawName:"v-show",value:e.editShow,expression:"editShow"}],ref:"editdevice",on:{watchChild:e.fetchData}})],1)},o=[],l=(i(89554),i(41539),i(54747),i(78783),i(33948),i(60285),i(41637),i(91058),i(68309),function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:e.textMap[e.dialogStatus],visible:e.dialogFormVisible,"append-to-body":""},on:{"update:visible":function(t){e.dialogFormVisible=t}}},[t("el-form",{ref:"dataForm",attrs:{rules:e.rules,model:e.deviceForm,"label-well-code":"right","label-width":"120px"}},[t("el-row",{attrs:{gutter:20}},[t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"设备编号",prop:"devcode"}},[t("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),t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"设备唯一标识",prop:"nodeid"}},[t("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),t("el-row",{attrs:{gutter:20}},[t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"设备名称",prop:"name"}},[t("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),t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"验证码"}},[t("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),t("el-row",{attrs:{gutter:20}},[t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"设备类型",prop:"deviceType"}},[t("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),t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"设备型号",prop:"model"}},[t("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),t("el-row",{attrs:{gutter:20}},[t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"厂商ID",prop:".manufacturerId"}},[t("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),t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"厂商名称",prop:"manufactureName"}},[t("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),t("el-row",{attrs:{gutter:20}},[t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"设备协议类型",prop:"protocalType"}},[t("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),t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"设备安全模式",prop:"isSecure"}},[t("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),t("el-row",{attrs:{gutter:20}},[t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"超时时间",prop:"timeout"}},[t("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),t("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{attrs:{disabled:e.saveBtnDisable,type:"primary"},on:{click:e.saveData}},[e._v(" 保存 ")]),t("el-button",{on:{click:e.cancel}},[e._v(" 取消 ")])],1)],1)}),r=[],n=i(84471),s=i(80129),c=i.n(s);function d(e){return(0,n.Z)({url:"nbdevice/list",method:"get",params:e})}function u(e){return(0,n.Z)({url:"nbdevice/add",method:"post",params:e})}function m(e){return(0,n.Z)({url:"nbdevice/update",method:"post",params:e})}function p(e){return(0,n.Z)({url:"nbdevice/delete",method:"post",params:{ids:e},paramsSerializer:function(e){return c().stringify(e,{indices:!1})}})}function h(e){var t=new FormData;return t.append("file",e),(0,n.Z)({url:"nbdevice/batchImport",method:"post",headers:{"Content-Type":"multipart/form-data"},data:t})}function f(e){return(0,n.Z)({url:"nbdevice/batchExport",method:"get",params:e,responseType:"blob"})}const v={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,u(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&&m(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")}}},g=v;var b=i(1001),y=(0,b.Z)(g,l,r,!1,null,"4eae619a",null);const w=y.exports;var F=i(56955),x=i(53649),C=i(25108);const D={name:"ListNbDevice",components:{DownloadTemplate:x.Z,editNbDevice:w},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(){p(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,a=i.size/1024/1024<5;if(!a)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)"});h(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="concenTemplate.xlsx",i=this.$loading({lock:!0,text:"下载中,请稍后...",spinner:"el-icon-loading",background:"rgba(0, 0, 0, 0.7)"});(0,F.f)(t).then((function(e){i.close(),C.log("download===",e);var t=new Blob([e.data]),a=document.createElement("a"),o=window.URL.createObjectURL(t);a.href=o,a.download="new name",document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(o)}))["catch"]((function(t){i.close(),e.$message.error(t.message)}))},batchExport:function(){var e=this;C.log("批量导出集中器");var t=this.$loading({lock:!0,text:"下载中,请稍后...",spinner:"el-icon-loading",background:"rgba(0, 0, 0, 0.7)"});f(this.listQuery).then((function(e){t.close(),C.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),d(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}}},T=D;var k=(0,b.Z)(T,a,o,!1,null,"61ae6759",null);const $=k.exports},56955:(e,t,i)=>{i.d(t,{W:()=>r,f:()=>l});var a=i(84471),o="";function l(e){return(0,a.Z)({url:o+"template/download",method:"get",params:{filename:e},responseType:"blob"})}function r(e){var t=new FormData;return t.append("file",e.file),(0,a.Z)({url:o+"imageUpload",method:"post",headers:{"Content-Type":"multipart/form-data"},data:t})}}}]);