代码优化
This commit is contained in:
@@ -1,8 +1,23 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<Search :query="query" />
|
||||
<div class="head-container">
|
||||
<Search />
|
||||
<crudOperation>
|
||||
<el-button
|
||||
slot="left"
|
||||
class="filter-item"
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:loading="crud.delAllLoading"
|
||||
@click="confirmDelAll()"
|
||||
>
|
||||
清空
|
||||
</el-button> v-if="columns.visible('username')"
|
||||
</crudOperation>
|
||||
</div>
|
||||
<!--表格渲染-->
|
||||
<el-table v-loading="loading" :data="data" style="width: 100%;">
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="expand">
|
||||
<template slot-scope="props">
|
||||
<el-form label-position="left" inline class="demo-table-expand">
|
||||
@@ -15,17 +30,17 @@
|
||||
</el-form>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="username" label="用户名" />
|
||||
<el-table-column prop="requestIp" label="IP" />
|
||||
<el-table-column :show-overflow-tooltip="true" prop="address" label="IP来源" />
|
||||
<el-table-column prop="description" label="描述" />
|
||||
<el-table-column prop="browser" label="浏览器" />
|
||||
<el-table-column prop="createTime" label="创建日期">
|
||||
<el-table-column v-if="columns.visible('username')" prop="username" label="用户名" />
|
||||
<el-table-column v-if="columns.visible('requestIp')" prop="requestIp" label="IP" />
|
||||
<el-table-column v-if="columns.visible('address')" :show-overflow-tooltip="true" prop="address" label="IP来源" />
|
||||
<el-table-column v-if="columns.visible('description')" prop="description" label="描述" />
|
||||
<el-table-column v-if="columns.visible('browser')" prop="browser" label="浏览器" />
|
||||
<el-table-column v-if="columns.visible('createTime')" prop="createTime" label="创建日期">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="异常详情" width="100px">
|
||||
<el-table-column label="异常详情" width="100px">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" @click="info(scope.row.id)">查看详情</el-button>
|
||||
</template>
|
||||
@@ -35,42 +50,37 @@
|
||||
<pre v-highlightjs="errorInfo"><code class="java" /></pre>
|
||||
</el-dialog>
|
||||
<!--分页组件-->
|
||||
<el-pagination
|
||||
:total="total"
|
||||
:current-page="page + 1"
|
||||
style="margin-top: 8px;"
|
||||
layout="total, prev, pager, next, sizes"
|
||||
@size-change="sizeChange"
|
||||
@current-change="pageChange"
|
||||
/>
|
||||
<pagination />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crud from '@/mixins/crud'
|
||||
import { getErrDetail, delAllError } from '@/api/monitor/log'
|
||||
import Search from './search'
|
||||
import CRUD, { presenter } from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
// crud交由presenter持有
|
||||
const defaultCrud = CRUD({ title: '异常日志', url: 'api/logs/error' })
|
||||
export default {
|
||||
name: 'ErrorLog',
|
||||
components: { Search },
|
||||
mixins: [crud],
|
||||
components: { Search, crudOperation, pagination },
|
||||
mixins: [presenter(defaultCrud)],
|
||||
data() {
|
||||
return {
|
||||
errorInfo: '', dialog: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$nextTick(() => {
|
||||
this.init()
|
||||
})
|
||||
this.crud.optShow = {
|
||||
add: false,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 获取数据前设置好接口地址
|
||||
beforeInit() {
|
||||
this.url = 'api/logs/error'
|
||||
this.params['logType'] = 'ERROR'
|
||||
return true
|
||||
},
|
||||
// 获取异常详情
|
||||
info(id) {
|
||||
this.dialog = true
|
||||
@@ -79,29 +89,22 @@ export default {
|
||||
})
|
||||
},
|
||||
confirmDelAll() {
|
||||
this.delAllLoading = true
|
||||
delAllError().then(res => {
|
||||
this.delAllLoading = false
|
||||
this.$children.forEach(children => {
|
||||
if (children.$refs.del_all) {
|
||||
children.$refs.del_all.doClose()
|
||||
}
|
||||
this.$confirm(`确认清空所有异常日志吗?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.crud.delAllLoading = true
|
||||
delAllError().then(res => {
|
||||
this.crud.delAllLoading = false
|
||||
this.crud.dleChangePage(1)
|
||||
this.crud.delSuccessNotify()
|
||||
this.crud.toQuery()
|
||||
}).catch(err => {
|
||||
this.crud.delAllLoading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
this.dleChangePage()
|
||||
this.init()
|
||||
this.$notify({
|
||||
title: '删除成功',
|
||||
type: 'success',
|
||||
duration: 2500
|
||||
})
|
||||
}).catch(err => {
|
||||
this.delAllLoading = false
|
||||
this.$children.forEach(children => {
|
||||
if (children.$refs.del_all) {
|
||||
children.$refs.del_all.doClose()
|
||||
}
|
||||
})
|
||||
console.log(err.response.data.message)
|
||||
}).catch(() => {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,23 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<Search :query="query" />
|
||||
<div class="head-container">
|
||||
<Search />
|
||||
<crudOperation>
|
||||
<el-button
|
||||
slot="left"
|
||||
class="filter-item"
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:loading="crud.delAllLoading"
|
||||
@click="confirmDelAll()"
|
||||
>
|
||||
清空
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
</div>
|
||||
<!--表格渲染-->
|
||||
<el-table v-loading="loading" :data="data" style="width: 100%;">
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="expand">
|
||||
<template slot-scope="props">
|
||||
<el-form label-position="left" inline class="demo-table-expand">
|
||||
@@ -15,80 +30,68 @@
|
||||
</el-form>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="username" label="用户名" />
|
||||
<el-table-column prop="requestIp" label="IP" />
|
||||
<el-table-column :show-overflow-tooltip="true" prop="address" label="IP来源" />
|
||||
<el-table-column prop="description" label="描述" />
|
||||
<el-table-column prop="browser" label="浏览器" />
|
||||
<el-table-column prop="time" label="请求耗时" align="center">
|
||||
<el-table-column v-if="columns.visible('username')" prop="username" label="用户名" />
|
||||
<el-table-column v-if="columns.visible('requestIp')" prop="requestIp" label="IP" />
|
||||
<el-table-column v-if="columns.visible('address')" :show-overflow-tooltip="true" prop="address" label="IP来源" />
|
||||
<el-table-column v-if="columns.visible('description')" prop="description" label="描述" />
|
||||
<el-table-column v-if="columns.visible('browser')" prop="browser" label="浏览器" />
|
||||
<el-table-column v-if="columns.visible('time')" prop="time" label="请求耗时" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.time <= 300">{{ scope.row.time }}ms</el-tag>
|
||||
<el-tag v-else-if="scope.row.time <= 1000" type="warning">{{ scope.row.time }}ms</el-tag>
|
||||
<el-tag v-else type="danger">{{ scope.row.time }}ms</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建日期" width="180px">
|
||||
<el-table-column v-if="columns.visible('createTime')" prop="createTime" label="创建日期" width="180px">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<el-pagination
|
||||
:total="total"
|
||||
:current-page="page + 1"
|
||||
style="margin-top: 8px;"
|
||||
layout="total, prev, pager, next, sizes"
|
||||
@size-change="sizeChange"
|
||||
@current-change="pageChange"
|
||||
/>
|
||||
<pagination />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crud from '@/mixins/crud'
|
||||
import Search from './search'
|
||||
import { delAllInfo } from '@/api/monitor/log'
|
||||
import CRUD, { presenter } from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
// crud交由presenter持有
|
||||
const defaultCrud = CRUD({ title: '日志', url: 'api/logs' })
|
||||
export default {
|
||||
name: 'Log',
|
||||
components: { Search },
|
||||
mixins: [crud],
|
||||
components: { Search, crudOperation, pagination },
|
||||
mixins: [presenter(defaultCrud)],
|
||||
created() {
|
||||
this.$nextTick(() => {
|
||||
this.init()
|
||||
})
|
||||
this.crud.optShow = {
|
||||
add: false,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: true
|
||||
}
|
||||
},
|
||||
// 获取数据前设置好接口地址
|
||||
methods: {
|
||||
beforeInit() {
|
||||
this.url = 'api/logs'
|
||||
this.params['logType'] = 'INFO'
|
||||
return true
|
||||
},
|
||||
confirmDelAll() {
|
||||
this.delAllLoading = true
|
||||
delAllInfo().then(res => {
|
||||
this.delAllLoading = false
|
||||
this.$children.forEach(children => {
|
||||
if (children.$refs.del_all) {
|
||||
children.$refs.del_all.doClose()
|
||||
}
|
||||
this.$confirm(`确认清空所有操作日志吗?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.crud.delAllLoading = true
|
||||
delAllInfo().then(res => {
|
||||
this.crud.delAllLoading = false
|
||||
this.crud.dleChangePage(1)
|
||||
this.crud.delSuccessNotify()
|
||||
this.crud.toQuery()
|
||||
}).catch(err => {
|
||||
this.crud.delAllLoading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
this.dleChangePage()
|
||||
this.init()
|
||||
this.$notify({
|
||||
title: '删除成功',
|
||||
type: 'success',
|
||||
duration: 2500
|
||||
})
|
||||
}).catch(err => {
|
||||
this.delAllLoading = false
|
||||
this.$children.forEach(children => {
|
||||
if (children.$refs.del_all) {
|
||||
children.$refs.del_all.doClose()
|
||||
}
|
||||
})
|
||||
console.log(err.response.data.message)
|
||||
}).catch(() => {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<el-input
|
||||
v-model="query.blurry"
|
||||
clearable
|
||||
@@ -19,53 +19,17 @@
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
/>
|
||||
<el-button
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="success"
|
||||
icon="el-icon-search"
|
||||
@click="$parent.toQuery"
|
||||
>搜索</el-button>
|
||||
<!-- 导出 -->
|
||||
<el-button
|
||||
:loading="$parent.downloadLoading"
|
||||
size="mini"
|
||||
class="filter-item"
|
||||
type="warning"
|
||||
icon="el-icon-download"
|
||||
@click="$parent.downloadMethod"
|
||||
>导出</el-button>
|
||||
<el-button
|
||||
slot="reference"
|
||||
v-popover:del_all
|
||||
:loading="$parent.delAllLoading"
|
||||
type="danger"
|
||||
size="mini"
|
||||
class="filter-item"
|
||||
icon="el-icon-delete"
|
||||
>清空</el-button>
|
||||
<el-popover ref="del_all" placement="top" width="200" trigger="click">
|
||||
<p>确定删除所有数据吗?</p>
|
||||
<div style="text-align: right; margin: 0">
|
||||
<el-button size="mini" type="text" @click="$refs['del_all'].doClose()">取消</el-button>
|
||||
<el-button
|
||||
:loading="$parent.delAllLoading"
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="$parent.confirmDelAll"
|
||||
>确定</el-button>
|
||||
</div>
|
||||
</el-popover>
|
||||
<rrOperation
|
||||
:crud="crud"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { header } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
export default {
|
||||
props: {
|
||||
query: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
}
|
||||
components: { rrOperation },
|
||||
mixins: [header()]
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -77,6 +77,7 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.crud.msg.del = '强退成功!'
|
||||
this.crud.optShow = {
|
||||
add: false,
|
||||
edit: false,
|
||||
@@ -96,8 +97,8 @@ export default {
|
||||
del(key).then(() => {
|
||||
this.delLoading = false
|
||||
this.$refs[index].doClose()
|
||||
this.dleChangePage()
|
||||
this.notify('踢出成功', 'success')
|
||||
this.crud.dleChangePage(1)
|
||||
this.crud.delSuccessNotify()
|
||||
this.crud.toQuery()
|
||||
}).catch(() => {
|
||||
this.delLoading = false
|
||||
|
||||
@@ -2,31 +2,15 @@
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<!-- 搜索 -->
|
||||
<el-input v-model="query.blurry" clearable size="small" placeholder="输入名称或者服务地址" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
|
||||
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
|
||||
<!-- 新增 -->
|
||||
<el-button
|
||||
v-permission="['admin','server:add']"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="showAddFormDialog"
|
||||
>新增
|
||||
</el-button>
|
||||
<!-- 刷新 -->
|
||||
<el-button
|
||||
size="mini"
|
||||
class="filter-item"
|
||||
type="warning"
|
||||
icon="el-icon-refresh"
|
||||
@click="toQuery"
|
||||
>刷新
|
||||
</el-button>
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-input v-model="query.blurry" clearable size="small" placeholder="输入名称或者服务地址" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<rrOperation :crud="crud" />
|
||||
</div>
|
||||
<crudOperation :permission="permission" />
|
||||
</div>
|
||||
<!--表单组件-->
|
||||
<el-dialog append-to-body :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="getFormTitle()" width="500px">
|
||||
<el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="80px">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" style="width: 370px;" />
|
||||
@@ -42,13 +26,14 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="cancel">取消</el-button>
|
||||
<el-button :loading="loading" type="primary" @click="submitMethod">确认</el-button>
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table v-loading="loading" :data="data" style="width: 100%;">
|
||||
<el-table-column label="状态" width="50px">
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column v-if="columns.visible('state')" prop="state" label="状态" width="50px">
|
||||
<template slot-scope="scope">
|
||||
<el-tag
|
||||
:type="scope.row.state === '1' ? 'success' : 'info'"
|
||||
@@ -59,12 +44,12 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="名称" />
|
||||
<el-table-column prop="address" label="地址" />
|
||||
<el-table-column prop="port" label="端口" width="80px" align="center" />
|
||||
<el-table-column :formatter="formatCpuRate" prop="cpuRate" label="CPU使用率" width="100px" align="center" />
|
||||
<el-table-column prop="cpuCore" label="CPU内核数" width="100px" align="center" />
|
||||
<el-table-column label="物理内存" align="center">
|
||||
<el-table-column v-if="columns.visible('name')" prop="name" label="名称" />
|
||||
<el-table-column v-if="columns.visible('address')" prop="address" label="地址" />
|
||||
<el-table-column v-if="columns.visible('port')" prop="port" label="端口" width="80px" align="center" />
|
||||
<el-table-column v-if="columns.visible('cpuRate')" :formatter="formatCpuRate" prop="cpuRate" label="CPU使用率" width="100px" align="center" />
|
||||
<el-table-column v-if="columns.visible('cpuCore')" prop="cpuCore" label="CPU内核数" width="100px" align="center" />
|
||||
<el-table-column v-if="columns.visible('memTotal')" prop="memTotal" label="物理内存" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-row>
|
||||
<el-col :span="24">{{ formatMem(scope.row) }}</el-col>
|
||||
@@ -76,7 +61,7 @@
|
||||
</el-row>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :formatter="formatDisk" label="磁盘使用情况" align="center">
|
||||
<el-table-column v-if="columns.visible('diskTotal')" prop="diskTotal" :formatter="formatDisk" label="磁盘使用情况" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-row>
|
||||
<el-col :span="24">{{ formatDisk(scope.row) }}</el-col>
|
||||
@@ -88,7 +73,7 @@
|
||||
</el-row>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="交换空间" align="center">
|
||||
<el-table-column v-if="columns.visible('swapTotal')" prop="swapTotal" label="交换空间" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-row>
|
||||
<el-col :span="24">{{ formatSwap(scope.row) }}</el-col>
|
||||
@@ -100,62 +85,41 @@
|
||||
</el-row>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="checkPermission(['admin','server:edit','server:del'])" label="操作" width="150px" align="center">
|
||||
<el-table-column v-permission="['admin','server:edit','server:del']" label="操作" width="150px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-permission="['admin','server:edit']" size="mini" type="primary" icon="el-icon-edit" @click="showEditFormDialog(scope.row)" />
|
||||
<el-popover
|
||||
:ref="scope.row.id"
|
||||
v-permission="['admin','server:del']"
|
||||
placement="top"
|
||||
width="180"
|
||||
>
|
||||
<p>确定删除本条数据吗?</p>
|
||||
<div style="text-align: right; margin: 0">
|
||||
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
|
||||
<el-button :loading="delLoading" type="primary" size="mini" @click="delMethod(scope.row.id)">确定</el-button>
|
||||
</div>
|
||||
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini" />
|
||||
</el-popover>
|
||||
</template>
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template> v-if="columns.visible('name')"
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<el-pagination
|
||||
:total="total"
|
||||
:current-page="page + 1"
|
||||
style="margin-top: 8px;"
|
||||
layout="total, prev, pager, next, sizes"
|
||||
@size-change="sizeChange"
|
||||
@current-change="pageChange"
|
||||
/>
|
||||
<pagination />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crud from '@/mixins/crud'
|
||||
import crudServer from '@/api/monitor/server'
|
||||
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
// crud交由presenter持有
|
||||
const defaultCrud = CRUD({ title: '监控', url: 'api/server', sort: 'sort,asc', crudMethod: { ...crudServer }})
|
||||
const defaultForm = { id: null, name: null, ip: null, port: 8777, state: null, cpuRate: null, cpuCore: null, memTotal: null, memUsed: null, diskTotal: null, diskUsed: null, swapTotal: null, swapUsed: null, sort: 999 }
|
||||
export default {
|
||||
name: 'ServerMonitor',
|
||||
mixins: [crud],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
|
||||
data() {
|
||||
return {
|
||||
title: '监控',
|
||||
crudMethod: { ...crudServer },
|
||||
form: {
|
||||
id: null,
|
||||
name: null,
|
||||
ip: null,
|
||||
port: 8777,
|
||||
state: null,
|
||||
cpuRate: null,
|
||||
cpuCore: null,
|
||||
memTotal: null,
|
||||
memUsed: null,
|
||||
diskTotal: null,
|
||||
diskUsed: null,
|
||||
swapTotal: null,
|
||||
swapUsed: null,
|
||||
sort: 999
|
||||
permission: {
|
||||
add: ['admin', 'server:add'],
|
||||
edit: ['admin', 'server:edit'],
|
||||
del: ['admin', 'server:del']
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
@@ -170,18 +134,7 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$nextTick(() => {
|
||||
this.init()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 获取数据前设置好接口地址
|
||||
beforeInit() {
|
||||
this.url = 'api/server'
|
||||
this.sort = 'sort,asc'
|
||||
return true
|
||||
},
|
||||
formatCpuRate(row, column) {
|
||||
const value = row.cpuRate
|
||||
if (!value) {
|
||||
|
||||
Reference in New Issue
Block a user