| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- import {
- getEnabledTableColumn,
- getProjectDomainTableColumn,
- getNameDescriptionTableColumn,
- getPublicScopeTableColumn,
- getTimeTableColumn,
- } from '@/utils/common/tableColumn'
- import i18n from '@/locales'
- export default {
- created () {
- this.columns = [
- getNameDescriptionTableColumn({
- onManager: this.onManager,
- field: 'name',
- title: i18n.t('system.text_101'),
- minWidth: 100,
- edit: row => !row.is_system,
- editDesc: row => !row.is_system,
- hideField: true,
- formRules: [
- { required: true, message: i18n.t('system.text_168') },
- ],
- slotCallback: (row, h) => {
- return this.$createElement(
- 'side-page-trigger',
- {
- on: {
- trigger: () => this.handleOpenSidepage(row),
- },
- },
- row.name,
- )
- },
- }),
- getEnabledTableColumn(),
- {
- field: 'scope',
- title: i18n.t('system.text_430', [i18n.t('dictionary.policy')]),
- width: 100,
- formatter: ({ row }) => {
- return this.$t(`policyScopeLabel.${row.scope}`)
- },
- },
- getPublicScopeTableColumn({ vm: this, resource: 'policies' }),
- getProjectDomainTableColumn(),
- getTimeTableColumn(),
- ]
- },
- methods: {
- getTag (tag) {
- const { tags = [] } = tag
- const ret = tags.map(item => {
- const { key, value } = item
- if (value) {
- return `${key.replace('org:', '')}:${value}`
- } else {
- return key.replace('org:', '')
- }
- })
- return ret.join(' - ')
- },
- isOwnerPublic (obj) {
- // fix by http://bug.yunion.io/zentao/bug-view-2958.html 共享的权限在其他域下时应该不能做任何操作
- if (obj.is_public) {
- if (this.isAdminMode) return true
- if (obj.domain_id !== this.userInfo.domain.id) return false
- }
- return true
- },
- },
- }
|