chunk-2d0e9d4e.a51ef5c8.js 9.3 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0e9d4e"],{"8ee0":function(t,e,o){"use strict";o.r(e);var n=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"app-container"},[o("el-form",{directives:[{name:"show",rawName:"v-show",value:t.showSearch,expression:"showSearch"}],ref:"queryForm",attrs:{model:t.queryParams,size:"small",inline:!0}},[o("el-form-item",{attrs:{label:"挂载点",prop:"mountPoint"}},[o("el-input",{attrs:{placeholder:"请输入挂载点",clearable:""},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.handleQuery(e)}},model:{value:t.queryParams.mountPoint,callback:function(e){t.$set(t.queryParams,"mountPoint",e)},expression:"queryParams.mountPoint"}})],1),o("el-form-item",{attrs:{label:"序列号",prop:"serialNumber"}},[o("el-input",{attrs:{placeholder:"请输入磁盘序列号",clearable:""},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.handleQuery(e)}},model:{value:t.queryParams.serialNumber,callback:function(e){t.$set(t.queryParams,"serialNumber",e)},expression:"queryParams.serialNumber"}})],1),o("el-form-item",[o("el-button",{attrs:{type:"primary",icon:"el-icon-search",size:"mini"},on:{click:t.handleQuery}},[t._v("搜索")]),o("el-button",{attrs:{icon:"el-icon-refresh",size:"mini"},on:{click:t.resetQuery}},[t._v("重置")])],1)],1),o("el-row",{staticClass:"mb8",attrs:{gutter:10}},[o("el-col",{attrs:{span:1.5}},[o("el-button",{attrs:{type:"info",plain:"",icon:"el-icon-refresh-right",size:"mini"},on:{click:t.handleDiscover}},[t._v("磁盘发现")])],1),o("right-toolbar",{attrs:{showSearch:t.showSearch},on:{"update:showSearch":function(e){t.showSearch=e},"update:show-search":function(e){t.showSearch=e},queryTable:t.getList}})],1),o("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],attrs:{data:t.diskList}},[o("el-table-column",{attrs:{label:"序号",align:"center",type:"index",width:"55"}}),o("el-table-column",{attrs:{label:"设备路径",align:"center",prop:"devicePath","show-overflow-tooltip":!0}}),o("el-table-column",{attrs:{label:"挂载点",align:"center",prop:"mountPoint","show-overflow-tooltip":!0}}),o("el-table-column",{attrs:{label:"磁盘型号",align:"center",prop:"model","show-overflow-tooltip":!0}}),o("el-table-column",{attrs:{label:"序列号",align:"center",prop:"serialNumber","show-overflow-tooltip":!0}}),o("el-table-column",{attrs:{label:"可用容量",align:"center",prop:"availableCapacity",formatter:t.formatCapacity}}),o("el-table-column",{attrs:{label:"挂载状态",align:"center",prop:"isMounted"},scopedSlots:t._u([{key:"default",fn:function(e){return[o("el-tag",{attrs:{type:"true"===e.row.isMounted?"success":"danger"}},[t._v(" "+t._s("true"===e.row.isMounted?"已挂载":"未挂载")+" ")])]}}])}),o("el-table-column",{attrs:{label:"类型",align:"center",prop:"isExternal"},scopedSlots:t._u([{key:"default",fn:function(e){return[o("el-tag",{attrs:{type:"true"===e.row.isExternal?"info":"primary"}},[t._v(" "+t._s("true"===e.row.isExternal?"外接":"内置")+" ")])]}}])}),o("el-table-column",{attrs:{label:"操作",align:"center","class-name":"small-padding fixed-width"},scopedSlots:t._u([{key:"default",fn:function(e){return[o("el-button",{attrs:{size:"mini",type:"text",icon:"el-icon-view"},on:{click:function(o){return t.handleView(e.row)}}},[t._v("查看")]),"false"===e.row.isMounted&&"true"===e.row.isExternal?o("el-button",{attrs:{size:"mini",type:"text",icon:"el-icon-upload"},on:{click:function(o){return t.handleMount(e.row)}}},[t._v("挂载")]):t._e(),"true"===e.row.isMounted&&"true"===e.row.isExternal?o("el-button",{attrs:{size:"mini",type:"text",icon:"el-icon-download"},on:{click:function(o){return t.handleUnmount(e.row)}}},[t._v("卸载")]):t._e()]}}])})],1),o("pagination",{directives:[{name:"show",rawName:"v-show",value:t.total>0,expression:"total>0"}],attrs:{total:t.total,page:t.queryParams.pageNum,limit:t.queryParams.pageSize},on:{"update:page":function(e){return t.$set(t.queryParams,"pageNum",e)},"update:limit":function(e){return t.$set(t.queryParams,"pageSize",e)},pagination:t.getList}}),o("el-dialog",{attrs:{title:t.title,visible:t.openView,width:"700px","append-to-body":""},on:{"update:visible":function(e){t.openView=e}}},[o("el-descriptions",{attrs:{column:2,border:""}},[o("el-descriptions-item",{attrs:{label:"设备路径"}},[t._v(t._s(t.form.devicePath))]),o("el-descriptions-item",{attrs:{label:"挂载点"}},[t._v(t._s(t.form.mountPoint))]),o("el-descriptions-item",{attrs:{label:"磁盘型号"}},[t._v(t._s(t.form.model))]),o("el-descriptions-item",{attrs:{label:"磁盘厂商"}},[t._v(t._s(t.form.vendor))]),o("el-descriptions-item",{attrs:{label:"序列号"}},[t._v(t._s(t.form.serialNumber))]),o("el-descriptions-item",{attrs:{label:"文件系统"}},[t._v(t._s(t.form.fileSystemType))]),o("el-descriptions-item",{attrs:{label:"可用容量"}},[t._v(t._s(t.formatCapacity(null,null,t.form.availableCapacity)))]),o("el-descriptions-item",{attrs:{label:"挂载状态"}},[o("el-tag",{attrs:{type:"true"===t.form.isMounted?"success":"danger"}},[t._v(" "+t._s("true"===t.form.isMounted?"已挂载":"未挂载")+" ")])],1),o("el-descriptions-item",{attrs:{label:"磁盘类型"}},[o("el-tag",{attrs:{type:"true"===t.form.isExternal?"info":"primary"}},[t._v(" "+t._s("true"===t.form.isExternal?"外接":"内置")+" ")])],1),o("el-descriptions-item",{attrs:{label:"最后检测时间"}},[t._v(t._s(t.form.lastDetectTime))])],1),o("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{on:{click:function(e){t.openView=!1}}},[t._v("关 闭")])],1)],1),o("el-dialog",{attrs:{title:t.title,visible:t.openMount,width:"500px","append-to-body":""},on:{"update:visible":function(e){t.openMount=e}}},[o("el-form",{ref:"mountForm",attrs:{model:t.mountForm,rules:t.mountRules,"label-width":"100px"}},[o("el-form-item",{attrs:{label:"设备路径",prop:"devicePath"}},[o("el-input",{attrs:{disabled:""},model:{value:t.mountForm.devicePath,callback:function(e){t.$set(t.mountForm,"devicePath",e)},expression:"mountForm.devicePath"}})],1),o("el-form-item",{attrs:{label:"挂载点",prop:"mountPoint"}},[o("el-input",{attrs:{placeholder:"请输入挂载点,例如 /mnt/sdb1"},model:{value:t.mountForm.mountPoint,callback:function(e){t.$set(t.mountForm,"mountPoint",e)},expression:"mountForm.mountPoint"}})],1)],1),o("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{attrs:{type:"primary"},on:{click:t.submitMountForm}},[t._v("确 定")]),o("el-button",{on:{click:t.cancelMount}},[t._v("取 消")])],1)],1)],1)},i=[],a=(o("e9c4"),o("b680"),o("b64b"),o("ac1f"),o("5319"),o("b775"));function r(t){return Object(a["a"])({url:"/disk/queryDiskList",method:"post",data:t})}function l(){return Object(a["a"])({url:"/disk/diskDiscovery",method:"post"})}function s(t){return Object(a["a"])({url:"/disk/diskMount",method:"post",data:t})}function u(t){return Object(a["a"])({url:"/disk/diskUnMountPartition",method:"post",data:t})}var c={name:"DiskManagement",data:function(){return{loading:!0,showSearch:!0,diskList:[],total:0,title:"",openView:!1,openMount:!1,queryParams:{pageNum:1,pageSize:10,mountPoint:void 0,serialNumber:void 0,isMounted:void 0,isExternal:void 0},form:{},mountForm:{id:null,devicePath:"",mountPoint:""},mountRules:{mountPoint:[{required:!0,message:"挂载点不能为空",trigger:"blur"}]}}},created:function(){this.getList()},methods:{getList:function(){var t=this;this.loading=!0,r(this.queryParams).then((function(e){t.diskList=e.data,e.total?t.total=e.total:t.total=e.data.length,t.loading=!1})).catch((function(){t.loading=!1}))},cancel:function(){this.openView=!1,this.reset()},cancelMount:function(){this.openMount=!1,this.resetMountForm()},reset:function(){this.form={}},resetMountForm:function(){this.mountForm={id:null,devicePath:"",mountPoint:""},this.resetForm("mountForm")},handleQuery:function(){this.queryParams.pageNum=1,this.getList()},resetQuery:function(){this.resetForm("queryForm"),this.handleQuery()},handleDiscover:function(){var t=this;this.loading=!0,l().then((function(){t.$modal.msgSuccess("磁盘扫描完成"),t.getList()})).catch((function(){t.loading=!1}))},handleView:function(t){this.reset(),this.form=JSON.parse(JSON.stringify(t)),this.title="磁盘详情",this.openView=!0},handleMount:function(t){this.resetMountForm(),this.mountForm.id=t.id,this.mountForm.devicePath=t.devicePath;var e=t.model||t.serialNumber||"disk";this.mountForm.mountPoint="/mnt/"+e.replace(/[^a-zA-Z0-9]/g,""),this.title="挂载磁盘",this.openMount=!0},submitMountForm:function(){var t=this;this.$refs["mountForm"].validate((function(e){e&&s(t.mountForm).then((function(){t.$modal.msgSuccess("挂载成功"),t.openMount=!1,t.getList()})).catch((function(){}))}))},handleUnmount:function(t){var e=this;this.$modal.confirm('是否确认卸载磁盘 "'+t.devicePath+'"?').then((function(){return u({id:t.id})})).then((function(){e.getList(),e.$modal.msgSuccess("卸载成功")})).catch((function(){}))},formatCapacity:function(t,e,o){var n=o;if(t&&(n=t.availableCapacity),!n||isNaN(parseFloat(n)))return"N/A";var i=parseFloat(n);if(0===i)return"0 B";var a=1024,r=["B","KB","MB","GB","TB","PB"],l=Math.floor(Math.log(i)/Math.log(a));return parseFloat((i/Math.pow(a,l)).toFixed(2))+" "+r[l]}}},m=c,d=o("2877"),p=Object(d["a"])(m,n,i,!1,null,null,null);e["default"]=p.exports}}]);