mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-31 14:38:02 +00:00
fix: 修复工单bug
This commit is contained in:
@@ -947,6 +947,10 @@
|
||||
"OneAssignee": "一级受理人",
|
||||
"TwoAssigneeType": "二级受理人类型",
|
||||
"TwoAssignee": "二级受理人",
|
||||
"SuperAdmin": "超级管理员",
|
||||
"OrgAdmin": "组织管理员",
|
||||
"SuperOrgAdmin": "超级管理员+组织管理员",
|
||||
"CustomUser": "自定义用户",
|
||||
"ApprovalLevel": "审批级别",
|
||||
"FlowDetail": "流程详情",
|
||||
"PermissionName": "授权规则名称",
|
||||
|
@@ -26,12 +26,12 @@ export default {
|
||||
columns: [
|
||||
'name',
|
||||
'users_amount', 'user_groups_amount', 'assets_amount', 'nodes_amount', 'system_users_amount',
|
||||
'date_expired', 'is_valid', 'is_expired', 'is_active',
|
||||
'date_expired', 'is_valid', 'is_expired', 'is_active', 'from_ticket',
|
||||
'created_by', 'date_created', 'comment', 'org_name', 'actions'
|
||||
],
|
||||
columnsShow: {
|
||||
min: ['name', 'actions'],
|
||||
default: ['name', 'users_amount', 'user_groups_amount', 'assets_amount', 'nodes_amount', 'system_users_amount', 'is_valid', 'actions']
|
||||
default: ['name', 'users_amount', 'user_groups_amount', 'assets_amount', 'nodes_amount', 'system_users_amount', 'is_valid', 'from_ticket', 'actions']
|
||||
},
|
||||
columnsMeta: {
|
||||
name: {
|
||||
|
@@ -18,9 +18,14 @@ export default {
|
||||
},
|
||||
|
||||
data() {
|
||||
const vm = this
|
||||
const now = new Date()
|
||||
const date_expired = getDaysFuture(7, now).toISOString()
|
||||
const date_start = now.toISOString()
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var org_id = ''
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var apply_category_type = []
|
||||
return {
|
||||
hasDetailInMsg: false,
|
||||
loading: true,
|
||||
@@ -67,7 +72,7 @@ export default {
|
||||
ajax: {
|
||||
url: '',
|
||||
transformOption: (item) => {
|
||||
return { label: item.name + ' (' + item.type_display + ')', value: item.id }
|
||||
return { label: item.name, value: item.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,8 +166,9 @@ export default {
|
||||
},
|
||||
on: {
|
||||
change: ([event], updateForm) => {
|
||||
this.fieldsMeta.meta.fieldsMeta.apply_applications.el.ajax.url = `/api/v1/applications/applications/?category=${event[0]}&type=${event[1]}`
|
||||
this.fieldsMeta.meta.fieldsMeta.apply_system_users.el.ajax.url = event[0] === 'remote_app' ? `/api/v1/assets/system-users/?protocol=rdp` : `/api/v1/assets/system-users/?protocol=${event[1]}`
|
||||
this.apply_category_type = event
|
||||
this.fieldsMeta.meta.fieldsMeta.apply_applications.el.ajax.url = `/api/v1/applications/applications/suggestion/?oid=${vm.org_id}&category=${event[0]}&type=${event[1]}`
|
||||
this.fieldsMeta.meta.fieldsMeta.apply_system_users.el.ajax.url = event[0] === 'remote_app' ? `/api/v1/assets/system-users/suggestion/?oid=${vm.org_id}&protocol=rdp` : `/api/v1/assets/system-users/suggestion/?oid=${vm.org_id}&protocol=${event[1]}`
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,9 +182,12 @@ export default {
|
||||
return { label: item.name, value: item.id }
|
||||
})
|
||||
},
|
||||
on: {
|
||||
changeOptions: ([event], updateForm) => {
|
||||
this.fieldsMeta.assignees.el.ajax.url = `/api/v1/tickets/assignees/?org_id=${event[0].value}`
|
||||
hidden: (form) => {
|
||||
this.org_id = form['org_id']
|
||||
apply_category_type = this.apply_category_type
|
||||
if (apply_category_type) {
|
||||
this.fieldsMeta.meta.fieldsMeta.apply_applications.el.ajax.url = `/api/v1/applications/applications/suggestions/?oid=${vm.org_id}&category=${apply_category_type[0]}&type=${apply_category_type[1]}`
|
||||
this.fieldsMeta.meta.fieldsMeta.apply_system_users.el.ajax.url = apply_category_type[0] === 'remote_app' ? `/api/v1/assets/system-users/suggestions/?oid=${vm.org_id}&protocol=rdp` : `/api/v1/assets/system-users/suggestions/?oid=${vm.org_id}&protocol=${apply_category_type[1]}`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -5,7 +5,6 @@
|
||||
<script>
|
||||
import { GenericCreateUpdatePage } from '@/layout/components'
|
||||
import Select2 from '@/components/FormFields/Select2'
|
||||
import AssetSelect from '@/components/AssetSelect'
|
||||
import { getDaysFuture } from '@/utils/common'
|
||||
import AssetPermissionFormActionField from '@/views/perms/AssetPermission/components/AssetPermissionFormActionField'
|
||||
export default {
|
||||
@@ -55,10 +54,16 @@ export default {
|
||||
},
|
||||
apply_assets: {
|
||||
type: 'assetSelect',
|
||||
component: AssetSelect,
|
||||
label: this.$t('perms.Asset'),
|
||||
component: Select2,
|
||||
el: {
|
||||
value: []
|
||||
value: [],
|
||||
ajax: {
|
||||
url: '',
|
||||
transformOption: (item) => {
|
||||
return { label: item.hostname + '(' + item.protocols + ')', value: item.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
apply_system_users: {
|
||||
@@ -68,7 +73,7 @@ export default {
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
url: '/api/v1/assets/system-users/?protocol__in=rdp,ssh,vnc,telnet',
|
||||
url: '',
|
||||
transformOption: (item) => {
|
||||
const username = item.username || '*'
|
||||
return { label: item.name + '(' + username + ')', value: item.id }
|
||||
@@ -85,6 +90,10 @@ export default {
|
||||
options: this.$store.state.users.profile.user_all_orgs.map((item) => {
|
||||
return { label: item.name, value: item.id }
|
||||
})
|
||||
},
|
||||
hidden: (form) => {
|
||||
this.fieldsMeta.meta.fieldsMeta.apply_system_users.el.ajax.url = `/api/v1/assets/system-users/suggestions/?oid=${form['org_id']}&protocol__in=rdp,ssh,vnc,telnet`
|
||||
this.fieldsMeta.meta.fieldsMeta.apply_assets.el.ajax.url = `/api/v1/assets/assets/suggestions/?oid=${form['org_id']}`
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -40,6 +40,10 @@ export default {
|
||||
}
|
||||
return `${url}`
|
||||
},
|
||||
cleanFormValue(data) {
|
||||
data['rules'] = data['rules'].slice(0, data['approval_level'])
|
||||
return data
|
||||
},
|
||||
updateSuccessNextRoute: { name: 'TicketList' },
|
||||
createSuccessNextRoute: { name: 'TicketList' }
|
||||
}
|
||||
|
@@ -1,16 +1,16 @@
|
||||
<template>
|
||||
<!-- 自定义组件 my-input -->
|
||||
<div>
|
||||
<div v-for="(item, i) of data.slice(0, level)" :key="i" style="margin-bottom: 10px">
|
||||
<div v-for="(item, i) of approveData" :key="i" style="margin-bottom: 10px">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>{{ i + 1 + '级审批' }}</span>
|
||||
</div>
|
||||
<el-radio-group v-model="item.strategy" @change="onChange()">
|
||||
<el-radio label="super_admin">超级管理员</el-radio>
|
||||
<el-radio label="org_admin">组织管理员</el-radio>
|
||||
<el-radio label="super_org_admin">超级管理员+组织管理员</el-radio>
|
||||
<el-radio label="custom_user">自定义用户</el-radio>
|
||||
<el-radio label="super_admin">{{ vm.$t('tickets.SuperAdmin') }}</el-radio>
|
||||
<el-radio label="org_admin">{{ vm.$t('tickets.OrgAdmin') }}</el-radio>
|
||||
<el-radio label="super_org_admin">{{ vm.$t('tickets.SuperOrgAdmin') }}</el-radio>
|
||||
<el-radio label="custom_user">{{ vm.$t('tickets.CustomUser') }}</el-radio>
|
||||
</el-radio-group>
|
||||
<br>
|
||||
<Select2 v-show="item.strategy === 'custom_user'" v-model="item.assignees" v-bind="select2Option" @change="onChange()" />
|
||||
@@ -39,12 +39,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
vm: this,
|
||||
data: [],
|
||||
initData: [
|
||||
{
|
||||
strategy: 'super_admin',
|
||||
assignees_read_only: []
|
||||
},
|
||||
defaultRule: [
|
||||
{
|
||||
strategy: 'super_admin',
|
||||
assignees_read_only: []
|
||||
@@ -58,18 +53,30 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
approveData() {
|
||||
let rules = []
|
||||
if (this.value.length === 2 && this.level === 1) {
|
||||
rules = this.value.slice(0, this.level)
|
||||
} else if (this.value.length === 1 && this.level === 2) {
|
||||
rules = this.value.concat(this.defaultRule)
|
||||
} else {
|
||||
rules = this.value
|
||||
}
|
||||
rules.forEach(rule => {
|
||||
if (rule.assignees_read_only) {
|
||||
rule['assignees'] = rule.assignees_read_only
|
||||
delete rule.assignees_read_only
|
||||
}
|
||||
})
|
||||
return rules.sort((a, b) => a.level - b.level)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.data = this.value.concat(this.initData)
|
||||
this.data.forEach(item => {
|
||||
item.assignees = item.assignees_read_only
|
||||
delete item.assignees_read_only
|
||||
})
|
||||
this.$emit('input', this.data.slice(0, this.level))
|
||||
this.$emit('input', this.approveData)
|
||||
},
|
||||
methods: {
|
||||
onChange() {
|
||||
this.$emit('input', this.data.slice(0, this.level))
|
||||
this.$emit('input', this.approveData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user