"use strict";(self["webpackChunknewfront"]=self["webpackChunknewfront"]||[]).push([[6621],{16621:(e,t,i)=>{i.r(t),i.d(t,{default:()=>k});i(74916),i(64765);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",type:"text",placeholder:"设备编号",clearable:""},model:{value:e.listQuery.devcode,callback:function(t){e.$set(e.listQuery,"devcode",t)},expression:"listQuery.devcode"}})],1)],1),t("normal-table",{ref:"table",attrs:{data:e.list,total:e.total,query:e.listQuery,columns:e.columns,"list-loading":e.listLoading,pagination:!0,options:e.tableOptions,size:"small"},on:{change:e.changePage}},[t("template",{slot:"btns"},[e.hasPerm("/device/simManage/batchimport")?t("el-upload",{staticStyle:{display:"inline-block"},attrs:{limit:1,"show-file-list":!1,"http-request":e.uploadFile,"file-list":e.fileList,action:"string",accept:".xls,.xlsx"}},[t("el-button",{staticClass:"edit_btn",attrs:{slot:"trigger",size:"small"},slot:"trigger"},[e._v(" 批量导入 ")])],1):e._e(),e.hasPerm("/device/simManage/add")?t("el-button",{staticClass:"edit_btn",attrs:{size:"small"},on:{click:e.add}},[e._v(" 新增 ")]):e._e()],1),t("template",{slot:"columns"},[e.hasPerm("/device/simManage/update")||e.hasPerm("/device/simManage/delete")?t("el-table-column",{attrs:{label:"操作",align:"center",width:"160"},scopedSlots:e._u([{key:"default",fn:function(i){return[e.hasPerm("/device/simManage/update")?t("el-button",{attrs:{type:"text"},on:{click:function(t){return e.edit(i.row)}}},[e._v(" 编辑 ")]):e._e(),e.hasPerm("/device/simManage/delete")?t("el-button",{attrs:{size:"small",type:"text"},on:{click:function(t){return e.del(i.row)}}},[e._v(" 删除 ")]):e._e()]}}],null,!1,3436971874)}):e._e()],1)],2),t("edit-device",{ref:"editDevice",on:{watchChild:e.fetchData}})],1)},o=[],l=(i(89554),i(41539),i(54747),i(73210),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":"100px"}},[t("el-row",{attrs:{gutter:20}},[t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"设备编号",prop:"devcode"}},[t("el-input",{attrs:{clearable:"",disabled:"create"!==e.dialogStatus,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:"IMEI号",prop:"imei"}},[t("el-input",{attrs:{clearable:"",disabled:"detail"===e.dialogStatus,type:"text",placeholder:"必填"},model:{value:e.deviceForm.imei,callback:function(t){e.$set(e.deviceForm,"imei","string"===typeof t?t.trim():t)},expression:"deviceForm.imei"}})],1)],1)],1),t("el-row",{attrs:{gutter:20}},[t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"SIM卡号",prop:"iccid"}},[t("el-input",{attrs:{clearable:"",disabled:"detail"===e.dialogStatus,type:"text",placeholder:"必填"},model:{value:e.deviceForm.iccid,callback:function(t){e.$set(e.deviceForm,"iccid","string"===typeof t?t.trim():t)},expression:"deviceForm.iccid"}})],1)],1)],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:"detail"!==e.dialogStatus,expression:"dialogStatus === 'detail' ? false : true"}],staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{attrs:{type:"primary"},on:{click:e.saveData}},[e._v(" 保存 ")]),t("el-button",{on:{click:function(t){e.dialogFormVisible=!1}}},[e._v(" 取消 ")])],1)],1)}),s=[],n=i(3336),r=(i(96647),i(83710),i(39714),i(84471)),c=i(80129),d=i.n(c);function u(e){return(0,r.Z)({url:"device/simManage/listPage",method:"get",params:e})}function m(e){return(0,r.Z)({url:"device/simManage/add",method:"post",params:e})}function h(e){return(0,r.Z)({url:"device/simManage/update",method:"post",params:e})}function f(e){return(0,r.Z)({url:"device/simManage/delete",method:"post",params:{ids:e},paramsSerializer:function(e){return d().stringify(e,{indices:!1})}})}function g(e){var t=new FormData;return t.append("file",e),(0,r.Z)({url:"device/simManage/batchImport",method:"post",timeout:24e4,headers:{"Content-Type":"multipart/form-data"},data:t})}var p=i(25108);const v={name:"EditDeviceImei",data:function(){return{dialogFormVisible:!1,dialogStatus:"",textMap:{update:"编辑",create:"新增",detail:"详情"},deviceForm:{devcode:"",imei:"",iccid:""},rules:{devcode:[{required:!0,message:"设备编号必填",trigger:["blur","change"]}],imei:[{required:!0,message:"IMEI号必填",trigger:["blur","change"]}],iccid:[{required:!0,message:"SIM卡号必填",trigger:["blur","change"]}]}}},methods:{resetForm:function(){this.deviceForm={devcode:"",imei:"",iccid:""}},initDialog:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;p.log(i,"====21=="),this.dialogFormVisible=!0,this.dialogStatus=e,"create"===this.dialogStatus?(this.resetForm(),this.$nextTick((function(){t.$refs["dataForm"].clearValidate()}))):"update"!==this.dialogStatus&&"detail"!==this.dialogStatus||(p.log((0,n.Z)(i.communication)),this.deviceForm={devcode:i.devcode,imei:i.imei,iccid:i.iccid})},saveData:function(){"update"===this.dialogStatus?this.updateData():"create"===this.dialogStatus&&this.createData()},updateData:function(){var e=this;this.$refs["dataForm"].validate((function(t){t&&(e.deviceForm.communication=e.deviceForm.communication.toString(),h(e.deviceForm).then((function(t){200===t.code&&(e.$message.success("修改成功"),e.$emit("watchChild"),e.dialogFormVisible=!1)})))}))},createData:function(){var e=this;this.$refs["dataForm"].validate((function(t){p.log(e.deviceForm),t&&(e.deviceForm.communication=e.deviceForm.communication.toString(),m(e.deviceForm).then((function(t){200===t.code&&e.$confirm("新增成功,是否继续新增?","提示",{confirmButtonText:"是",cancelButtonText:"否",type:"info"}).then((function(){e.resetForm(),e.$nextTick((function(){e.$refs["dataForm"].clearValidate()}))}))["catch"]((function(){e.$emit("watchChild"),e.dialogFormVisible=!1}))})))}))}}},b=v;var F=i(1001),x=(0,F.Z)(b,l,s,!1,null,null,null);const y=x.exports,S={name:"DeviceImei",components:{editDevice:y},data:function(){return{listQuery:{devcode:"",offset:1,limit:20,sort:"id",order:"asc"},columns:[{text:"设备编号",value:"devcode",align:"center"},{text:"IMEI",value:"imei",align:"center"},{text:"ICCID",value:"iccid",align:"center"},{text:"记录时间",value:"logtime",align:"center"}],tableOptions:{needIndex:!1,border:!0},fileList:[],multipleSelection:[],list:[],total:0,listLoading:!0}},created:function(){this.fetchData()},methods:{search:function(){this.fetchData(!1)},fetchData:function(){var e=this;this.listLoading=!0,u(this.listQuery).then((function(t){e.list=t.data.rows,e.total=t.data.total,e.listLoading=!1}))},handleSelectionChange:function(e){this.multipleSelection=e},checkSelection:function(){return 0!==this.multipleSelection.length},del:function(){var e=this;if(this.checkSelection()){var t=[],i=[];this.multipleSelection.forEach((function(e,a){t.push(e.id),i.push(a)})),this.$confirm("确定要删除所选设备吗?","确认操作",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){f(t).then((function(t){200===t.code&&(e.$message.success("删除成功"),e.fetchData())}))}))}else this.$message.error("至少选中一项")},detail:function(e){this.$refs.editDevice.initDialog("detail",e)},add:function(){this.$refs.editDevice.initDialog("create")},edit:function(e){this.$refs.editDevice.initDialog("update",e)},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)"});g(i).then((function(e){o.close(),200===e.code?(t.$message.success("导入成功"),t.fetchData()):t.$message.error(e.message)}))["catch"]((function(){o.close()})),this.fileList=[]},changePage:function(e){e&&e.size&&(this.listQuery.limit=e.size),e&&e.page&&(this.listQuery.offset=e.page),this.fetchData()}}},D=S;var $=(0,F.Z)(D,a,o,!1,null,"33dc83da",null);const k=$.exports}}]);