代码优化
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
|
||||
</el-input>
|
||||
<div class="login-code">
|
||||
<img :src="codeUrl" alt="验证码" @click="getCode">
|
||||
<img :src="codeUrl" alt="加载失败" @click="getCode">
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-checkbox v-model="loginForm.rememberMe" style="margin:0 0 25px 0;">
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:loading="crud.delAllLoading"
|
||||
:loading="delLoading"
|
||||
:disabled="crud.selections.length === 0"
|
||||
@click="crud.toDelete(crud.selections)"
|
||||
@click="doDelete(crud.selections)"
|
||||
>
|
||||
强退
|
||||
</el-button>
|
||||
@@ -91,18 +91,37 @@ export default {
|
||||
this.url = 'auth/online'
|
||||
return true
|
||||
},
|
||||
doDelete(datas) {
|
||||
this.$confirm(`确认强退选中的${datas.length}个用户?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.delMethod(datas)
|
||||
}).catch(() => {})
|
||||
},
|
||||
// 踢出用户
|
||||
delMethod(key, index) {
|
||||
const ids = []
|
||||
if (key instanceof Array) {
|
||||
key.forEach(val => {
|
||||
ids.push(val.key)
|
||||
})
|
||||
} else ids.push(key)
|
||||
this.delLoading = true
|
||||
del(key).then(() => {
|
||||
del(ids).then(() => {
|
||||
this.delLoading = false
|
||||
this.$refs[index].doClose()
|
||||
if (this.$refs[index]) {
|
||||
this.$refs[index].doClose()
|
||||
}
|
||||
this.crud.dleChangePage(1)
|
||||
this.crud.delSuccessNotify()
|
||||
this.crud.toQuery()
|
||||
}).catch(() => {
|
||||
this.delLoading = false
|
||||
this.$refs[index].doClose()
|
||||
if (this.$refs[index]) {
|
||||
this.$refs[index].doClose()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ 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 }
|
||||
const defaultForm = { id: null, address: 'localhost', 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',
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
@@ -134,6 +134,9 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.crud.optShow.download = false
|
||||
},
|
||||
methods: {
|
||||
formatCpuRate(row, column) {
|
||||
const value = row.cpuRate
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :tree-props="{children: 'children', hasChildren: 'hasChildren'}" default-expand-all :data="crud.data" row-key="id" @select="crud.selectChange" @select-all="crud.selectAllChange" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column :selectable="checkboxT" type="selection" width="55" />
|
||||
<el-table-column v-if="columns.visible('name')" label="名称" prop="name" />
|
||||
<el-table-column v-if="columns.visible('enabled')" label="状态" align="center" prop="enabled">
|
||||
<template slot-scope="scope">
|
||||
@@ -148,6 +148,9 @@ export default {
|
||||
}).catch(() => {
|
||||
data.enabled = !data.enabled
|
||||
})
|
||||
},
|
||||
checkboxT(row, rowIndex) {
|
||||
return row.id !== 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ const defaultForm = {
|
||||
sort: 999,
|
||||
enabled: true,
|
||||
dept: {
|
||||
id: null
|
||||
id: 1
|
||||
}
|
||||
}
|
||||
export default {
|
||||
|
||||
@@ -134,7 +134,7 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
|
||||
// crud交由presenter持有
|
||||
const defaultCrud = CRUD({ title: '角色', url: 'api/roles', sort: 'level,asc', crudMethod: { ...crudRoles }})
|
||||
const defaultForm = { name: null, depts: [], remark: null, dataScope: null, level: 3, permission: null }
|
||||
const defaultForm = { name: null, depts: [], remark: null, dataScope: '全部', level: 3, permission: null }
|
||||
export default {
|
||||
name: 'Role',
|
||||
components: { Treeselect, pagination, crudOperation, rrOperation, udOperation },
|
||||
@@ -172,7 +172,6 @@ export default {
|
||||
},
|
||||
// 编辑前
|
||||
[CRUD.HOOK.beforeToEdit](crud, form) {
|
||||
console.log(form.dataScope)
|
||||
if (form.dataScope === '自定义') {
|
||||
this.getDepts()
|
||||
}
|
||||
@@ -181,7 +180,6 @@ export default {
|
||||
depts.push(dept.id)
|
||||
})
|
||||
form.depts = depts
|
||||
console.log(form)
|
||||
},
|
||||
// 提交前做的操作
|
||||
[CRUD.HOOK.afterValidateCU](crud) {
|
||||
|
||||
Reference in New Issue
Block a user