mirror of https://github.com/veops/cmdb.git
Merge branch 'master' of github.com:veops/cmdb
This commit is contained in:
commit
96ba04dc31
|
@ -78,6 +78,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import _ from 'lodash'
|
||||
import Pager from './pager.vue'
|
||||
import SearchForm from './searchForm.vue'
|
||||
import { searchPermissonHistory } from '@/modules/acl/api/history'
|
||||
|
@ -251,23 +252,25 @@ export default {
|
|||
},
|
||||
// 处理查询参数
|
||||
handleQueryParams(queryParams) {
|
||||
const _queryParams = _.cloneDeep(queryParams)
|
||||
|
||||
let q = ''
|
||||
for (const key in queryParams) {
|
||||
for (const key in _queryParams) {
|
||||
if (
|
||||
key !== 'page' &&
|
||||
key !== 'page_size' &&
|
||||
key !== 'app_id' &&
|
||||
key !== 'start' &&
|
||||
key !== 'end' &&
|
||||
queryParams[key] !== undefined
|
||||
_queryParams[key] !== undefined
|
||||
) {
|
||||
if (q) q += `,${key}:${queryParams[key]}`
|
||||
else q += `${key}:${queryParams[key]}`
|
||||
delete queryParams[key]
|
||||
if (q) q += `,${key}:${_queryParams[key]}`
|
||||
else q += `${key}:${_queryParams[key]}`
|
||||
delete _queryParams[key]
|
||||
}
|
||||
}
|
||||
const newQueryParams = { ...queryParams, q }
|
||||
return q ? newQueryParams : queryParams
|
||||
const newQueryParams = { ..._queryParams, q }
|
||||
return q ? newQueryParams : _queryParams
|
||||
},
|
||||
|
||||
// searchForm相关
|
||||
|
@ -283,7 +286,7 @@ export default {
|
|||
this.getTable(this.queryParams)
|
||||
},
|
||||
handleSearch(queryParams) {
|
||||
this.queryParams = { ...queryParams, app_id: this.app_id }
|
||||
this.queryParams = { ...this.queryParams, ...queryParams, app_id: this.app_id }
|
||||
this.getTable(this.queryParams)
|
||||
},
|
||||
|
||||
|
|
|
@ -212,7 +212,12 @@ export default {
|
|||
|
||||
// searchForm相关
|
||||
handleSearch(queryParams) {
|
||||
this.queryParams = { ...queryParams, app_id: this.app_id, scope: this.checked ? 'resource_group' : 'resource' }
|
||||
this.queryParams = {
|
||||
...this.queryParams,
|
||||
...queryParams,
|
||||
app_id: this.app_id,
|
||||
scope: this.checked ? 'resource_group' : 'resource',
|
||||
}
|
||||
this.getTable(this.queryParams)
|
||||
},
|
||||
searchFormReset() {
|
||||
|
@ -245,9 +250,11 @@ export default {
|
|||
},
|
||||
|
||||
handleQueryParams(queryParams) {
|
||||
const _queryParams = _.cloneDeep(queryParams)
|
||||
|
||||
let flag = false
|
||||
let q = queryParams.q ? queryParams.q : ''
|
||||
for (const key in queryParams) {
|
||||
let q = _queryParams.q ? _queryParams.q : ''
|
||||
for (const key in _queryParams) {
|
||||
if (
|
||||
key !== 'page' &&
|
||||
key !== 'page_size' &&
|
||||
|
@ -255,16 +262,16 @@ export default {
|
|||
key !== 'q' &&
|
||||
key !== 'start' &&
|
||||
key !== 'end' &&
|
||||
queryParams[key] !== undefined
|
||||
_queryParams[key] !== undefined
|
||||
) {
|
||||
flag = true
|
||||
if (q) q += `,${key}:${queryParams[key]}`
|
||||
else q += `${key}:${queryParams[key]}`
|
||||
delete queryParams[key]
|
||||
if (q) q += `,${key}:${_queryParams[key]}`
|
||||
else q += `${key}:${_queryParams[key]}`
|
||||
delete _queryParams[key]
|
||||
}
|
||||
}
|
||||
const newQueryParams = { ...queryParams, q }
|
||||
return flag ? newQueryParams : queryParams
|
||||
const newQueryParams = { ..._queryParams, q }
|
||||
return flag ? newQueryParams : _queryParams
|
||||
},
|
||||
handleTagColor(operateType) {
|
||||
return this.colorMap.get(operateType)
|
||||
|
|
|
@ -179,7 +179,7 @@ export default {
|
|||
|
||||
// searchForm相关
|
||||
handleSearch(queryParams) {
|
||||
this.queryParams = { ...queryParams, app_id: this.app_id, scope: 'resource_type' }
|
||||
this.queryParams = { ...this.queryParams, ...queryParams, app_id: this.app_id, scope: 'resource_type' }
|
||||
this.getTable(this.queryParams)
|
||||
},
|
||||
searchFormReset() {
|
||||
|
@ -206,9 +206,11 @@ export default {
|
|||
},
|
||||
|
||||
handleQueryParams(queryParams) {
|
||||
const _queryParams = _.cloneDeep(queryParams)
|
||||
|
||||
let flag = false
|
||||
let q = queryParams.q ? queryParams.q : ''
|
||||
for (const key in queryParams) {
|
||||
let q = _queryParams.q ? _queryParams.q : ''
|
||||
for (const key in _queryParams) {
|
||||
if (
|
||||
key !== 'page' &&
|
||||
key !== 'page_size' &&
|
||||
|
@ -216,16 +218,16 @@ export default {
|
|||
key !== 'q' &&
|
||||
key !== 'start' &&
|
||||
key !== 'end' &&
|
||||
queryParams[key] !== undefined
|
||||
_queryParams[key] !== undefined
|
||||
) {
|
||||
flag = true
|
||||
if (q) q += `,${key}:${queryParams[key]}`
|
||||
else q += `${key}:${queryParams[key]}`
|
||||
delete queryParams[key]
|
||||
if (q) q += `,${key}:${_queryParams[key]}`
|
||||
else q += `${key}:${_queryParams[key]}`
|
||||
delete _queryParams[key]
|
||||
}
|
||||
}
|
||||
const newQueryParams = { ...queryParams, q }
|
||||
return flag ? newQueryParams : queryParams
|
||||
const newQueryParams = { ..._queryParams, q }
|
||||
return flag ? newQueryParams : _queryParams
|
||||
},
|
||||
handleTagColor(operateType) {
|
||||
return this.colorMap.get(operateType)
|
||||
|
|
|
@ -220,7 +220,12 @@ export default {
|
|||
this.getTable(this.queryParams)
|
||||
},
|
||||
handleSearch(queryParams) {
|
||||
this.queryParams = { ...queryParams, app_id: this.app_id, scope: this.checked ? 'role_relation' : 'role' }
|
||||
this.queryParams = {
|
||||
...this.queryParams,
|
||||
...queryParams,
|
||||
app_id: this.app_id,
|
||||
scope: this.checked ? 'role_relation' : 'role',
|
||||
}
|
||||
this.getTable(this.queryParams)
|
||||
},
|
||||
searchFormReset() {
|
||||
|
@ -237,9 +242,11 @@ export default {
|
|||
|
||||
// 处理查询参数
|
||||
handleQueryParams(queryParams) {
|
||||
const _queryParams = _.cloneDeep(queryParams)
|
||||
|
||||
let flag = false
|
||||
let q = queryParams.q ? queryParams.q : ''
|
||||
for (const key in queryParams) {
|
||||
let q = _queryParams.q ? _queryParams.q : ''
|
||||
for (const key in _queryParams) {
|
||||
if (
|
||||
key !== 'page' &&
|
||||
key !== 'page_size' &&
|
||||
|
@ -247,16 +254,16 @@ export default {
|
|||
key !== 'q' &&
|
||||
key !== 'start' &&
|
||||
key !== 'end' &&
|
||||
queryParams[key] !== undefined
|
||||
_queryParams[key] !== undefined
|
||||
) {
|
||||
flag = true
|
||||
if (q) q += `,${key}:${queryParams[key]}`
|
||||
else q += `${key}:${queryParams[key]}`
|
||||
delete queryParams[key]
|
||||
if (q) q += `,${key}:${_queryParams[key]}`
|
||||
else q += `${key}:${_queryParams[key]}`
|
||||
delete _queryParams[key]
|
||||
}
|
||||
}
|
||||
const newQueryParams = { ...queryParams, q }
|
||||
return flag ? newQueryParams : queryParams
|
||||
const newQueryParams = { ..._queryParams, q }
|
||||
return flag ? newQueryParams : _queryParams
|
||||
},
|
||||
// 处理tag颜色
|
||||
handleTagColor(operateType) {
|
||||
|
|
|
@ -147,7 +147,6 @@ export default {
|
|||
expand: false,
|
||||
queryParams: {
|
||||
page: 1,
|
||||
page_size: 50,
|
||||
},
|
||||
date: undefined,
|
||||
checked: false,
|
||||
|
@ -188,7 +187,6 @@ export default {
|
|||
handleReset() {
|
||||
this.queryParams = {
|
||||
page: 1,
|
||||
page_size: 50,
|
||||
}
|
||||
this.date = undefined
|
||||
this.$emit('searchFormReset')
|
||||
|
|
|
@ -200,7 +200,7 @@ export default {
|
|||
|
||||
// searchForm相关
|
||||
handleSearch(queryParams) {
|
||||
this.queryParams = queryParams
|
||||
this.queryParams = { ...this.queryParams, ...queryParams }
|
||||
this.queryParams.app_id = this.app_id
|
||||
this.getTable(this.queryParams)
|
||||
},
|
||||
|
@ -281,25 +281,27 @@ export default {
|
|||
}
|
||||
},
|
||||
handleQueryParams(queryParams) {
|
||||
const _queryParams = _.cloneDeep(queryParams)
|
||||
|
||||
let q = ''
|
||||
for (const key in queryParams) {
|
||||
for (const key in _queryParams) {
|
||||
if (
|
||||
key !== 'page' &&
|
||||
key !== 'page_size' &&
|
||||
key !== 'app_id' &&
|
||||
key !== 'start' &&
|
||||
key !== 'end' &&
|
||||
queryParams[key] !== undefined
|
||||
_queryParams[key] !== undefined
|
||||
) {
|
||||
if (q) {
|
||||
q += `,${key}:${queryParams[key]}`
|
||||
q += `,${key}:${_queryParams[key]}`
|
||||
} else {
|
||||
q += `${key}:${queryParams[key]}`
|
||||
q += `${key}:${_queryParams[key]}`
|
||||
}
|
||||
}
|
||||
}
|
||||
const newQueryParams = { ...queryParams, q }
|
||||
return q ? newQueryParams : queryParams
|
||||
const newQueryParams = { ..._queryParams, q }
|
||||
return q ? newQueryParams : _queryParams
|
||||
},
|
||||
handleTagColor(operateType) {
|
||||
return this.colorMap.get(operateType)
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import _ from 'lodash'
|
||||
import debounce from 'lodash/debounce'
|
||||
import Pager from '../../module/pager.vue'
|
||||
import SearchForm from '../../module/searchForm.vue'
|
||||
|
@ -347,7 +348,7 @@ export default {
|
|||
this.getTable(this.queryParams)
|
||||
},
|
||||
handleSearch(queryParams) {
|
||||
this.queryParams = queryParams
|
||||
this.queryParams = { ...this.queryParams, ...queryParams }
|
||||
this.getTable(this.queryParams)
|
||||
},
|
||||
handleExpandChange(expand) {
|
||||
|
@ -387,23 +388,24 @@ export default {
|
|||
},
|
||||
|
||||
handleQueryParams(queryParams) {
|
||||
const _queryParams = _.cloneDeep(queryParams)
|
||||
let q = ''
|
||||
for (const key in queryParams) {
|
||||
for (const key in _queryParams) {
|
||||
if (
|
||||
key !== 'page' &&
|
||||
key !== 'page_size' &&
|
||||
key !== 'app_id' &&
|
||||
key !== 'start' &&
|
||||
key !== 'end' &&
|
||||
queryParams[key] !== undefined
|
||||
_queryParams[key] !== undefined
|
||||
) {
|
||||
if (q) q += `,${key}:${queryParams[key]}`
|
||||
else q += `${key}:${queryParams[key]}`
|
||||
delete queryParams[key]
|
||||
if (q) q += `,${key}:${_queryParams[key]}`
|
||||
else q += `${key}:${_queryParams[key]}`
|
||||
delete _queryParams[key]
|
||||
}
|
||||
}
|
||||
const newQueryParams = { ...queryParams, q }
|
||||
return q ? newQueryParams : queryParams
|
||||
const newQueryParams = { ..._queryParams, q }
|
||||
return q ? newQueryParams : _queryParams
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -267,7 +267,7 @@ export default {
|
|||
this.isExpand = expand
|
||||
},
|
||||
handleSearch(queryParams) {
|
||||
this.queryParams = { ...queryParams, scope: this.checked ? 'resource_group' : 'resource' }
|
||||
this.queryParams = { ...this.queryParams, ...queryParams, scope: this.checked ? 'resource_group' : 'resource' }
|
||||
this.getTable(this.queryParams)
|
||||
},
|
||||
searchFormReset() {
|
||||
|
@ -317,9 +317,11 @@ export default {
|
|||
},
|
||||
|
||||
handleQueryParams(queryParams) {
|
||||
const _queryParams = _.cloneDeep(queryParams)
|
||||
|
||||
let flag = false
|
||||
let q = queryParams.q ? queryParams.q : ''
|
||||
for (const key in queryParams) {
|
||||
let q = _queryParams.q ? _queryParams.q : ''
|
||||
for (const key in _queryParams) {
|
||||
if (
|
||||
key !== 'page' &&
|
||||
key !== 'page_size' &&
|
||||
|
@ -327,16 +329,16 @@ export default {
|
|||
key !== 'q' &&
|
||||
key !== 'start' &&
|
||||
key !== 'end' &&
|
||||
queryParams[key] !== undefined
|
||||
_queryParams[key] !== undefined
|
||||
) {
|
||||
flag = true
|
||||
if (q) q += `,${key}:${queryParams[key]}`
|
||||
else q += `${key}:${queryParams[key]}`
|
||||
delete queryParams[key]
|
||||
if (q) q += `,${key}:${_queryParams[key]}`
|
||||
else q += `${key}:${_queryParams[key]}`
|
||||
delete _queryParams[key]
|
||||
}
|
||||
}
|
||||
const newQueryParams = { ...queryParams, q }
|
||||
return flag ? newQueryParams : queryParams
|
||||
const newQueryParams = { ..._queryParams, q }
|
||||
return flag ? newQueryParams : _queryParams
|
||||
},
|
||||
handleTagColor(operateType) {
|
||||
return this.colorMap.get(operateType)
|
||||
|
|
|
@ -217,7 +217,7 @@ export default {
|
|||
this.isExpand = expand
|
||||
},
|
||||
handleSearch(queryParams) {
|
||||
this.queryParams = { ...queryParams, scope: 'resource_type' }
|
||||
this.queryParams = { ...this.queryParams, ...queryParams, scope: 'resource_type' }
|
||||
this.getTable(this.queryParams)
|
||||
},
|
||||
searchFormReset() {
|
||||
|
@ -253,9 +253,11 @@ export default {
|
|||
},
|
||||
|
||||
handleQueryParams(queryParams) {
|
||||
const _queryParams = _.cloneDeep(queryParams)
|
||||
|
||||
let flag = false
|
||||
let q = queryParams.q ? queryParams.q : ''
|
||||
for (const key in queryParams) {
|
||||
let q = _queryParams.q ? _queryParams.q : ''
|
||||
for (const key in _queryParams) {
|
||||
if (
|
||||
key !== 'page' &&
|
||||
key !== 'page_size' &&
|
||||
|
@ -263,16 +265,16 @@ export default {
|
|||
key !== 'q' &&
|
||||
key !== 'start' &&
|
||||
key !== 'end' &&
|
||||
queryParams[key] !== undefined
|
||||
_queryParams[key] !== undefined
|
||||
) {
|
||||
flag = true
|
||||
if (q) q += `,${key}:${queryParams[key]}`
|
||||
else q += `${key}:${queryParams[key]}`
|
||||
delete queryParams[key]
|
||||
if (q) q += `,${key}:${_queryParams[key]}`
|
||||
else q += `${key}:${_queryParams[key]}`
|
||||
delete _queryParams[key]
|
||||
}
|
||||
}
|
||||
const newQueryParams = { ...queryParams, q }
|
||||
return flag ? newQueryParams : queryParams
|
||||
const newQueryParams = { ..._queryParams, q }
|
||||
return flag ? newQueryParams : _queryParams
|
||||
},
|
||||
handleTagColor(operateType) {
|
||||
return this.colorMap.get(operateType)
|
||||
|
|
|
@ -231,7 +231,7 @@ export default {
|
|||
this.getTable(this.queryParams)
|
||||
},
|
||||
handleSearch(queryParams) {
|
||||
this.queryParams = { ...queryParams, scope: this.checked ? 'role_relation' : 'role' }
|
||||
this.queryParams = { ...this.queryParams, ...queryParams, scope: this.checked ? 'role_relation' : 'role' }
|
||||
this.getTable(this.queryParams)
|
||||
},
|
||||
searchFormReset() {
|
||||
|
@ -247,9 +247,10 @@ export default {
|
|||
|
||||
// 处理查询参数
|
||||
handleQueryParams(queryParams) {
|
||||
const _queryParams = _.cloneDeep(queryParams)
|
||||
let flag = false
|
||||
let q = queryParams.q ? queryParams.q : ''
|
||||
for (const key in queryParams) {
|
||||
let q = _queryParams.q ? _queryParams.q : ''
|
||||
for (const key in _queryParams) {
|
||||
if (
|
||||
key !== 'page' &&
|
||||
key !== 'page_size' &&
|
||||
|
@ -257,16 +258,16 @@ export default {
|
|||
key !== 'q' &&
|
||||
key !== 'start' &&
|
||||
key !== 'end' &&
|
||||
queryParams[key] !== undefined
|
||||
_queryParams[key] !== undefined
|
||||
) {
|
||||
flag = true
|
||||
if (q) q += `,${key}:${queryParams[key]}`
|
||||
else q += `${key}:${queryParams[key]}`
|
||||
delete queryParams[key]
|
||||
if (q) q += `,${key}:${_queryParams[key]}`
|
||||
else q += `${key}:${_queryParams[key]}`
|
||||
delete _queryParams[key]
|
||||
}
|
||||
}
|
||||
const newQueryParams = { ...queryParams, q }
|
||||
return flag ? newQueryParams : queryParams
|
||||
const newQueryParams = { ..._queryParams, q }
|
||||
return flag ? newQueryParams : _queryParams
|
||||
},
|
||||
// 处理tag颜色
|
||||
handleTagColor(operateType) {
|
||||
|
|
|
@ -241,7 +241,7 @@ export default {
|
|||
this.isExpand = expand
|
||||
},
|
||||
handleSearch(queryParams) {
|
||||
this.queryParams = queryParams
|
||||
this.queryParams = { ...this.queryParams, ...queryParams }
|
||||
this.getTable(this.queryParams)
|
||||
},
|
||||
searchFormReset() {
|
||||
|
@ -326,25 +326,27 @@ export default {
|
|||
}
|
||||
},
|
||||
handleQueryParams(queryParams) {
|
||||
const _queryParams = _.cloneDeep(queryParams)
|
||||
|
||||
let q = ''
|
||||
for (const key in queryParams) {
|
||||
for (const key in _queryParams) {
|
||||
if (
|
||||
key !== 'page' &&
|
||||
key !== 'page_size' &&
|
||||
key !== 'app_id' &&
|
||||
key !== 'start' &&
|
||||
key !== 'end' &&
|
||||
queryParams[key] !== undefined
|
||||
_queryParams[key] !== undefined
|
||||
) {
|
||||
if (q) {
|
||||
q += `,${key}:${queryParams[key]}`
|
||||
q += `,${key}:${_queryParams[key]}`
|
||||
} else {
|
||||
q += `${key}:${queryParams[key]}`
|
||||
q += `${key}:${_queryParams[key]}`
|
||||
}
|
||||
}
|
||||
}
|
||||
const newQueryParams = { ...queryParams, q }
|
||||
return q ? newQueryParams : queryParams
|
||||
const newQueryParams = { ..._queryParams, q }
|
||||
return q ? newQueryParams : _queryParams
|
||||
},
|
||||
handleTagColor(operateType) {
|
||||
return this.colorMap.get(operateType)
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
<template>
|
||||
<div class="ci-type-grant">
|
||||
<vxe-table size="mini" stripe class="ops-stripe-table" :data="filterTableData" :max-height="`${tableHeight}px`">
|
||||
<vxe-table
|
||||
ref="xTable"
|
||||
size="mini"
|
||||
stripe
|
||||
class="ops-stripe-table"
|
||||
:data="filterTableData"
|
||||
:max-height="`${tableHeight}px`"
|
||||
:row-style="(params) => getCurrentRowStyle(params, addedRids)"
|
||||
>
|
||||
<vxe-column field="name"></vxe-column>
|
||||
<vxe-column v-for="col in columns" :key="col" :field="col" :title="permMap[col]">
|
||||
<template #default="{row}">
|
||||
|
@ -37,6 +45,7 @@ import _ from 'lodash'
|
|||
import { permMap } from './constants.js'
|
||||
import { grantCiType, revokeCiType } from '../../api/CIType'
|
||||
import ReadCheckbox from './readCheckbox.vue'
|
||||
import { getCurrentRowStyle } from './utils'
|
||||
|
||||
export default {
|
||||
name: 'CiTypeGrant',
|
||||
|
@ -55,10 +64,13 @@ export default {
|
|||
type: String,
|
||||
default: 'ci_type',
|
||||
},
|
||||
addedRids: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
filterTableData() {
|
||||
console.log(_.cloneDeep(this.tableData))
|
||||
const _tableData = this.tableData.filter((data) => {
|
||||
const _intersection = _.intersection(
|
||||
Object.keys(data),
|
||||
|
@ -90,6 +102,7 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
getCurrentRowStyle,
|
||||
async handleChange(e, col, row) {
|
||||
if (e.target.checked) {
|
||||
await grantCiType(this.CITypeId, row.rid, { perms: [col] }).catch(() => {
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
@grantDepart="grantDepart"
|
||||
@grantRole="grantRole"
|
||||
@getTableData="getTableData"
|
||||
ref="grant_ci_type"
|
||||
:addedRids="addedRids"
|
||||
/>
|
||||
</template>
|
||||
<template
|
||||
|
@ -25,6 +27,8 @@
|
|||
@grantRole="grantRole"
|
||||
@getTableData="getTableData"
|
||||
@openReadGrantModal="openReadGrantModal"
|
||||
ref="grant_ci"
|
||||
:addedRids="addedRids"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="cmdbGrantType.includes('type_relation')">
|
||||
|
@ -36,6 +40,8 @@
|
|||
@grantDepart="grantDepart"
|
||||
@grantRole="grantRole"
|
||||
@getTableData="getTableData"
|
||||
ref="grant_type_relation"
|
||||
:addedRids="addedRids"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="cmdbGrantType.includes('relation_view')">
|
||||
|
@ -47,6 +53,8 @@
|
|||
@grantDepart="grantDepart"
|
||||
@grantRole="grantRole"
|
||||
@getTableData="getTableData"
|
||||
ref="grant_relation_view"
|
||||
:addedRids="addedRids"
|
||||
/>
|
||||
</template>
|
||||
|
||||
|
@ -108,6 +116,7 @@ export default {
|
|||
attrGroup: [],
|
||||
filerPerimissions: {},
|
||||
loading: false,
|
||||
addedRids: [], // 本次新增的rid
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -282,6 +291,12 @@ export default {
|
|||
})
|
||||
)
|
||||
}
|
||||
this.addedRids = rids
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.$refs[`grant_${grantType}`].$refs.xTable.elemStore['main-body-wrapper'].scrollTo(0, 0)
|
||||
}, 300)
|
||||
})
|
||||
},
|
||||
openReadGrantModal(col, row) {
|
||||
this.$refs.readGrantModal.open(col, row)
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
<template>
|
||||
<div class="ci-relation-grant">
|
||||
<vxe-table size="mini" stripe class="ops-stripe-table" :data="tableData" :max-height="`${tableHeight}px`">
|
||||
<vxe-table
|
||||
ref="xTable"
|
||||
size="mini"
|
||||
stripe
|
||||
class="ops-stripe-table"
|
||||
:data="tableData"
|
||||
:max-height="`${tableHeight}px`"
|
||||
:row-style="(params) => getCurrentRowStyle(params, addedRids)"
|
||||
>
|
||||
<vxe-column field="name"></vxe-column>
|
||||
<vxe-column v-for="col in columns" :key="col" :field="col" :title="permMap[col]">
|
||||
<template #default="{row}">
|
||||
|
@ -18,6 +26,8 @@
|
|||
<script>
|
||||
import { permMap } from './constants.js'
|
||||
import { grantRelationView, revokeRelationView } from '../../api/preference.js'
|
||||
import { getCurrentRowStyle } from './utils'
|
||||
|
||||
export default {
|
||||
name: 'RelationViewGrant',
|
||||
inject: ['loading', 'isModal'],
|
||||
|
@ -34,6 +44,10 @@ export default {
|
|||
type: String,
|
||||
default: 'relation_view',
|
||||
},
|
||||
addedRids: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -53,6 +67,7 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
getCurrentRowStyle,
|
||||
grantDepart() {
|
||||
this.$emit('grantDepart', this.grantType)
|
||||
},
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
<template>
|
||||
<div class="ci-relation-grant">
|
||||
<vxe-table size="mini" stripe class="ops-stripe-table" :data="tableData" :max-height="`${tableHeight}px`">
|
||||
<vxe-table
|
||||
ref="xTable"
|
||||
size="mini"
|
||||
stripe
|
||||
class="ops-stripe-table"
|
||||
:data="tableData"
|
||||
:max-height="`${tableHeight}px`"
|
||||
:row-style="(params) => getCurrentRowStyle(params, addedRids)"
|
||||
>
|
||||
<vxe-column field="name"></vxe-column>
|
||||
<vxe-column v-for="col in columns" :key="col" :field="col" :title="permMap[col]">
|
||||
<template #default="{row}">
|
||||
|
@ -18,6 +26,8 @@
|
|||
<script>
|
||||
import { permMap } from './constants.js'
|
||||
import { grantTypeRelation, revokeTypeRelation } from '../../api/CITypeRelation.js'
|
||||
import { getCurrentRowStyle } from './utils'
|
||||
|
||||
export default {
|
||||
name: 'TypeRelationGrant',
|
||||
inject: ['loading', 'isModal'],
|
||||
|
@ -34,6 +44,10 @@ export default {
|
|||
type: Array,
|
||||
default: null,
|
||||
},
|
||||
addedRids: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -53,6 +67,7 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
getCurrentRowStyle,
|
||||
grantDepart() {
|
||||
this.$emit('grantDepart', this.grantType)
|
||||
},
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
export const getCurrentRowStyle = ({ row }, addedRids) => {
|
||||
const idx = addedRids.findIndex(item => item.rid === row.rid)
|
||||
return idx > -1 ? 'background-color:#E0E7FF!important' : ''
|
||||
}
|
|
@ -1,130 +1,137 @@
|
|||
<template>
|
||||
<a-form :form="form" class="create-new-attribute">
|
||||
<a-divider style="font-size:14px;margin-top:6px;">基础设置</a-divider>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="属性名(英文)">
|
||||
<a-input
|
||||
name="name"
|
||||
placeholder="英文"
|
||||
v-decorator="[
|
||||
'name',
|
||||
{
|
||||
rules: [
|
||||
{ required: true, message: '请输入属性名' },
|
||||
{ message: '不能以数字开头,可以是英文 数字以及下划线 (_)', pattern: RegExp('^(?!\\d)[a-zA-Z_0-9]+$') },
|
||||
{ message: '内置字段', pattern: RegExp('^(?!(id|_id|ci_id|type|_type|ci_type)$).*$') },
|
||||
],
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="别名">
|
||||
<a-input name="alias" v-decorator="['alias', { rules: [] }]" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="数据类型">
|
||||
<a-select
|
||||
name="value_type"
|
||||
style="width: 100%"
|
||||
v-decorator="['value_type', { rules: [{ required: true }], initialValue: '2' }]"
|
||||
@change="handleChangeValueType"
|
||||
>
|
||||
<a-select-option :value="key" :key="key" v-for="(value, key) in valueTypeMap">{{ value }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="currentValueType === '6' ? 24 : 12">
|
||||
<a-form-item
|
||||
:label-col="{ span: currentValueType === '6' ? 4 : 8 }"
|
||||
:wrapper-col="{ span: currentValueType === '6' ? 18 : 12 }"
|
||||
label="默认值"
|
||||
>
|
||||
<template>
|
||||
<a-select
|
||||
v-if="form.getFieldValue('is_list')"
|
||||
mode="tags"
|
||||
:style="{ width: '100%' }"
|
||||
v-decorator="['default_value', { rules: [{ required: false }] }]"
|
||||
>
|
||||
</a-select>
|
||||
<a-input-number
|
||||
style="width: 100%"
|
||||
v-else-if="currentValueType === '1'"
|
||||
v-decorator="['default_value', { rules: [{ required: false }] }]"
|
||||
>
|
||||
</a-input-number>
|
||||
<a-select
|
||||
v-decorator="['default_value', { rules: [{ required: false }] }]"
|
||||
mode="tags"
|
||||
v-else-if="currentValueType === '0'"
|
||||
@select="selectIntDefaultValue"
|
||||
>
|
||||
<a-select-option key="$auto_inc_id">
|
||||
自增ID
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<a-row>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="属性名(英文)">
|
||||
<a-input
|
||||
style="width: 100%"
|
||||
v-else-if="currentValueType === '2' || currentValueType === '5'"
|
||||
v-decorator="['default_value', { rules: [{ required: false }] }]"
|
||||
>
|
||||
</a-input>
|
||||
<a-select
|
||||
allowClear
|
||||
v-decorator="['default_value', { rules: [{ required: false }] }]"
|
||||
v-else-if="currentValueType === '3' && defaultForDatetime !== '$custom_time'"
|
||||
@select="changeDefaultForDatetime"
|
||||
>
|
||||
<a-select-option key="$created_at">
|
||||
创建时间
|
||||
</a-select-option>
|
||||
<a-select-option key="$updated_at">
|
||||
更新时间
|
||||
</a-select-option>
|
||||
<a-select-option key="$custom_time">
|
||||
自定义时间
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<template v-else-if="currentValueType === '4' || currentValueType === '3'">
|
||||
<a-date-picker
|
||||
style="width: 100%"
|
||||
v-decorator="['default_value', { rules: [{ required: false }] }]"
|
||||
:format="currentValueType === '4' ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss'"
|
||||
:showTime="currentValueType === '4' ? false : { format: 'HH:mm:ss' }"
|
||||
/>
|
||||
<a-dropdown
|
||||
:style="{ position: 'absolute', right: '-15px', top: '-10px' }"
|
||||
:trigger="['click']"
|
||||
v-if="currentValueType === '3'"
|
||||
>
|
||||
<a><a-icon type="down" /> </a>
|
||||
<a-menu slot="overlay" @click="onClick">
|
||||
<a-menu-item key="$created_at">
|
||||
<a>创建时间</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item key="$updated_at">
|
||||
<a>更新时间</a>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
|
||||
<vue-json-editor
|
||||
v-else-if="currentValueType === '6'"
|
||||
:style="{ '--custom-height': `${200}px` }"
|
||||
v-model="default_value_json"
|
||||
:showBtns="false"
|
||||
:mode="'code'"
|
||||
lang="zh"
|
||||
@json-change="onJsonChange"
|
||||
@has-error="onJsonError"
|
||||
name="name"
|
||||
placeholder="英文"
|
||||
v-decorator="[
|
||||
'name',
|
||||
{
|
||||
rules: [
|
||||
{ required: true, message: '请输入属性名' },
|
||||
{
|
||||
message: '不能以数字开头,可以是英文 数字以及下划线 (_)',
|
||||
pattern: RegExp('^(?!\\d)[a-zA-Z_0-9]+$'),
|
||||
},
|
||||
{ message: '内置字段', pattern: RegExp('^(?!(id|_id|ci_id|type|_type|ci_type)$).*$') },
|
||||
],
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="别名">
|
||||
<a-input name="alias" v-decorator="['alias', { rules: [] }]" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="数据类型">
|
||||
<a-select
|
||||
name="value_type"
|
||||
style="width: 100%"
|
||||
v-decorator="['value_type', { rules: [{ required: true }], initialValue: '2' }]"
|
||||
@change="handleChangeValueType"
|
||||
>
|
||||
<a-select-option :value="key" :key="key" v-for="(value, key) in valueTypeMap">{{ value }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="currentValueType === '6' ? 24 : 12">
|
||||
<a-form-item
|
||||
:label-col="{ span: currentValueType === '6' ? 4 : 8 }"
|
||||
:wrapper-col="{ span: currentValueType === '6' ? 18 : 12 }"
|
||||
label="默认值"
|
||||
>
|
||||
<template>
|
||||
<a-select
|
||||
v-if="form.getFieldValue('is_list')"
|
||||
mode="tags"
|
||||
:style="{ width: '100%' }"
|
||||
v-decorator="['default_value', { rules: [{ required: false }] }]"
|
||||
>
|
||||
</a-select>
|
||||
<a-input-number
|
||||
style="width: 100%"
|
||||
v-else-if="currentValueType === '1'"
|
||||
v-decorator="['default_value', { rules: [{ required: false }] }]"
|
||||
>
|
||||
</a-input-number>
|
||||
<a-select
|
||||
v-decorator="['default_value', { rules: [{ required: false }] }]"
|
||||
mode="tags"
|
||||
v-else-if="currentValueType === '0'"
|
||||
@select="selectIntDefaultValue"
|
||||
>
|
||||
<a-select-option key="$auto_inc_id">
|
||||
自增ID
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<a-input
|
||||
style="width: 100%"
|
||||
v-else-if="currentValueType === '2' || currentValueType === '5'"
|
||||
v-decorator="['default_value', { rules: [{ required: false }] }]"
|
||||
>
|
||||
</a-input>
|
||||
<a-select
|
||||
allowClear
|
||||
v-decorator="['default_value', { rules: [{ required: false }] }]"
|
||||
v-else-if="currentValueType === '3' && defaultForDatetime !== '$custom_time'"
|
||||
@select="changeDefaultForDatetime"
|
||||
>
|
||||
<a-select-option key="$created_at">
|
||||
创建时间
|
||||
</a-select-option>
|
||||
<a-select-option key="$updated_at">
|
||||
更新时间
|
||||
</a-select-option>
|
||||
<a-select-option key="$custom_time">
|
||||
自定义时间
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<template v-else-if="currentValueType === '4' || currentValueType === '3'">
|
||||
<a-date-picker
|
||||
style="width: 100%"
|
||||
v-decorator="['default_value', { rules: [{ required: false }] }]"
|
||||
:format="currentValueType === '4' ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss'"
|
||||
:showTime="currentValueType === '4' ? false : { format: 'HH:mm:ss' }"
|
||||
/>
|
||||
<a-dropdown
|
||||
:style="{ position: 'absolute', right: '-15px', top: '-10px' }"
|
||||
:trigger="['click']"
|
||||
v-if="currentValueType === '3'"
|
||||
>
|
||||
<a><a-icon type="down" /> </a>
|
||||
<a-menu slot="overlay" @click="onClick">
|
||||
<a-menu-item key="$created_at">
|
||||
<a>创建时间</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item key="$updated_at">
|
||||
<a>更新时间</a>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
|
||||
<vue-json-editor
|
||||
v-else-if="currentValueType === '6'"
|
||||
:style="{ '--custom-height': `${200}px` }"
|
||||
v-model="default_value_json"
|
||||
:showBtns="false"
|
||||
:mode="'code'"
|
||||
lang="zh"
|
||||
@json-change="onJsonChange"
|
||||
@has-error="onJsonError"
|
||||
/>
|
||||
</template>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-col :span="6">
|
||||
<a-form-item
|
||||
|
|
|
@ -534,7 +534,7 @@ export default {
|
|||
})
|
||||
},
|
||||
getAllFlatEmployees() {
|
||||
getEmployeeList({ block_status: 0, page_size: 99999 }).then((res) => {
|
||||
getEmployeeList({ block_status: -1, page_size: 99999 }).then((res) => {
|
||||
this.allFlatEmployees = res.data_list
|
||||
})
|
||||
},
|
||||
|
@ -721,7 +721,7 @@ export default {
|
|||
this.loading = false
|
||||
},
|
||||
updateAll() {
|
||||
this.expression = []
|
||||
// this.expression = []
|
||||
this.updateCount()
|
||||
this.updateTableDataByFilter()
|
||||
},
|
||||
|
@ -774,7 +774,7 @@ export default {
|
|||
},
|
||||
reset() {
|
||||
this.filterName = ''
|
||||
this.$refs.filterComp.expression = ''
|
||||
this.$refs.filterComp.expression = []
|
||||
this.updateTableDataByFilter()
|
||||
},
|
||||
handleSearch(expression) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue