2.5dev (#81)
* 同一界面内,多CRUD共存 * 解决多crud,对inject修改造成注入混乱,弃用Vue注入方式 * 自定义数据id字段名 * 以$options.cruds()方式实例化crud,避免多组件实例共享crud
This commit is contained in:
@@ -61,12 +61,13 @@ 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, crudOperation, pagination },
|
||||
mixins: [presenter(defaultCrud)],
|
||||
cruds() {
|
||||
return CRUD({ title: '异常日志', url: 'api/logs/error' })
|
||||
},
|
||||
mixins: [presenter()],
|
||||
data() {
|
||||
return {
|
||||
errorInfo: '', dialog: false
|
||||
|
||||
@@ -60,12 +60,13 @@ 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, crudOperation, pagination },
|
||||
mixins: [presenter(defaultCrud)],
|
||||
cruds() {
|
||||
return CRUD({ title: '日志', url: 'api/logs' })
|
||||
},
|
||||
mixins: [presenter()],
|
||||
created() {
|
||||
this.crud.optShow = {
|
||||
add: false,
|
||||
|
||||
@@ -64,12 +64,13 @@ import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
// crud交由presenter持有
|
||||
const defaultCrud = CRUD({ url: 'auth/online', title: '在线用户' })
|
||||
export default {
|
||||
name: 'OnlineUser',
|
||||
components: { pagination, crudOperation, rrOperation },
|
||||
mixins: [presenter(defaultCrud), header(), crud()],
|
||||
cruds() {
|
||||
return CRUD({ url: 'auth/online', title: '在线用户' })
|
||||
},
|
||||
mixins: [presenter(), header(), crud()],
|
||||
data() {
|
||||
return {
|
||||
delLoading: false,
|
||||
|
||||
@@ -107,13 +107,14 @@ 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, 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 },
|
||||
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({ title: '监控', url: 'api/server', sort: 'sort,asc', crudMethod: { ...crudServer }})
|
||||
},
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
data() {
|
||||
return {
|
||||
permission: {
|
||||
|
||||
Reference in New Issue
Block a user