mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-13 11:24:17 +00:00
perf: 工单重构
This commit is contained in:
@@ -20,7 +20,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statusMap: this.object.status === 'open' ? STATUS_MAP['notified'] : STATUS_MAP[this.object.state],
|
||||
statusMap: this.object.status === 'open' ? STATUS_MAP['pending'] : STATUS_MAP[this.object.state],
|
||||
imageUrl: require('@/assets/img/admin.png'),
|
||||
form: {
|
||||
comments: ''
|
||||
@@ -33,7 +33,7 @@ export default {
|
||||
return [
|
||||
{
|
||||
key: this.$t('tickets.Applicant'),
|
||||
value: this.object.applicant_display
|
||||
value: this.object.rel_snapshot.applicant
|
||||
},
|
||||
{
|
||||
key: this.$t('tickets.type'),
|
||||
@@ -57,23 +57,23 @@ export default {
|
||||
return [
|
||||
{
|
||||
key: this.$t('tickets.ApplyRunUser'),
|
||||
value: this.object.meta.apply_run_user
|
||||
value: this.object.rel_snapshot.apply_run_user
|
||||
},
|
||||
{
|
||||
key: this.$t('tickets.ApplyRunAsset'),
|
||||
value: this.object.meta.apply_run_asset
|
||||
value: this.object.rel_snapshot.apply_run_asset
|
||||
},
|
||||
{
|
||||
key: this.$t('tickets.ApplyRunSystemUser'),
|
||||
value: this.object.meta.apply_run_system_user
|
||||
value: this.object.rel_snapshot.apply_run_system_user
|
||||
},
|
||||
{
|
||||
key: this.$t('tickets.ApplyRunCommand'),
|
||||
value: this.object.meta.apply_run_command
|
||||
value: this.object.apply_run_command
|
||||
},
|
||||
{
|
||||
key: this.$t('tickets.ApplyFromSession'),
|
||||
value: this.object.meta.apply_from_session_id,
|
||||
value: this.object.apply_from_session,
|
||||
formatter: function(item, value) {
|
||||
const to = { name: 'SessionDetail', params: { id: value }, query: { oid: vm.object.org_id }}
|
||||
if (!vm.$hasPerm('terminal.view_session')) {
|
||||
@@ -85,8 +85,8 @@ export default {
|
||||
{
|
||||
key: this.$t('tickets.ApplyFromCMDFilterRule'),
|
||||
value: {
|
||||
cmdFilterRuleId: this.object.meta.apply_from_cmd_filter_rule_id,
|
||||
cmdFilterId: this.object.meta.apply_from_cmd_filter_id
|
||||
cmdFilterRuleId: this.object.apply_from_cmd_filter_rule,
|
||||
cmdFilterId: this.object.apply_from_cmd_filter
|
||||
},
|
||||
formatter: function(item, value) {
|
||||
const to = {
|
||||
|
||||
@@ -20,7 +20,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statusMap: this.object.status === 'open' ? STATUS_MAP['notified'] : STATUS_MAP[this.object.state],
|
||||
statusMap: this.object.status === 'open' ? STATUS_MAP['pending'] : STATUS_MAP[this.object.state],
|
||||
imageUrl: require('@/assets/img/admin.png'),
|
||||
form: {
|
||||
comments: ''
|
||||
@@ -33,7 +33,7 @@ export default {
|
||||
return [
|
||||
{
|
||||
key: this.$t('tickets.Applicant'),
|
||||
value: this.object['applicant_display']
|
||||
value: this.object.rel_snapshot.applicant
|
||||
},
|
||||
{
|
||||
key: this.$t('tickets.type'),
|
||||
@@ -59,15 +59,15 @@ export default {
|
||||
// apply_login_user: "Administrator(admin)"
|
||||
{
|
||||
key: this.$t('acl.apply_login_asset'),
|
||||
value: this.object.meta['apply_login_asset']
|
||||
value: this.object.rel_snapshot.apply_login_asset
|
||||
},
|
||||
{
|
||||
key: this.$t('acl.apply_login_system_user'),
|
||||
value: this.object.meta['apply_login_system_user']
|
||||
value: this.object.rel_snapshot.apply_login_system_user
|
||||
},
|
||||
{
|
||||
key: this.$t('acl.apply_login_user'),
|
||||
value: this.object.meta['apply_login_user']
|
||||
value: this.object.rel_snapshot.apply_login_user
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -33,18 +33,18 @@ export default {
|
||||
loading: true,
|
||||
initial: {
|
||||
ips_or_not: true,
|
||||
meta: {
|
||||
apply_date_expired: date_expired,
|
||||
apply_date_start: date_start,
|
||||
apply_actions: ['all', 'connect', 'updownload', 'upload_file', 'download_file']
|
||||
},
|
||||
apply_date_expired: date_expired,
|
||||
apply_date_start: date_start,
|
||||
org_id: '',
|
||||
type: 'apply_application'
|
||||
|
||||
},
|
||||
fields: [
|
||||
[this.$t('common.Basic'), ['title', 'type', 'org_id', 'comment']],
|
||||
[this.$t('tickets.RequestPerm'), ['meta']]
|
||||
[this.$t('tickets.RequestPerm'), [
|
||||
'apply_category_type', 'apply_applications', 'apply_system_users',
|
||||
'apply_date_start', 'apply_date_expired'
|
||||
]]
|
||||
],
|
||||
fieldsMeta: {
|
||||
type: {
|
||||
@@ -53,79 +53,78 @@ export default {
|
||||
disabled: true
|
||||
}
|
||||
},
|
||||
meta: {
|
||||
fields: [
|
||||
'apply_category_type', 'apply_applications', 'apply_system_users',
|
||||
'apply_date_start', 'apply_date_expired'],
|
||||
fieldsMeta: {
|
||||
apply_date_start: {
|
||||
label: this.$t('common.DateStart'),
|
||||
type: 'date-picker',
|
||||
el: {
|
||||
type: 'datetime'
|
||||
}
|
||||
},
|
||||
apply_applications: {
|
||||
type: 'assetSelect',
|
||||
component: Select2,
|
||||
label: this.$t('applications.App'),
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
url: '',
|
||||
transformOption: (item) => {
|
||||
return { label: item.name, value: item.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
apply_system_users: {
|
||||
type: 'systemUserSelect',
|
||||
component: Select2,
|
||||
label: this.$t('assets.SystemUser'),
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
url: '',
|
||||
transformOption: (item) => {
|
||||
if (this.$route.query.type === 'k8s') {
|
||||
return { label: item.name, value: item.id }
|
||||
}
|
||||
const username = item.username || '*'
|
||||
return { label: item.name + '(' + username + ')', value: item.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
apply_date_expired: {
|
||||
label: this.$t('common.DateEnd'),
|
||||
type: 'date-picker',
|
||||
el: {
|
||||
type: 'datetime'
|
||||
}
|
||||
},
|
||||
apply_category_type: {
|
||||
type: 'cascader',
|
||||
label: this.$t('applications.appType'),
|
||||
rules: [Required],
|
||||
el: {
|
||||
multiple: false,
|
||||
options: ApplicationCascader
|
||||
},
|
||||
on: {
|
||||
change: ([event], updateForm) => {
|
||||
this.apply_category_type = event
|
||||
updateForm({
|
||||
apply_applications: [],
|
||||
apply_system_users: []
|
||||
})
|
||||
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]}`
|
||||
}
|
||||
apply_applications: {
|
||||
type: 'assetSelect',
|
||||
component: Select2,
|
||||
rules: [
|
||||
{ required: true }
|
||||
],
|
||||
label: this.$t('applications.App'),
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
url: '',
|
||||
transformOption: (item) => {
|
||||
return { label: item.name, value: item.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
apply_system_users: {
|
||||
type: 'systemUserSelect',
|
||||
component: Select2,
|
||||
rules: [
|
||||
{ required: true }
|
||||
],
|
||||
label: this.$t('assets.SystemUser'),
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
url: '',
|
||||
transformOption: (item) => {
|
||||
if (this.$route.query.type === 'k8s') {
|
||||
return { label: item.name, value: item.id }
|
||||
}
|
||||
const username = item.username || '*'
|
||||
return { label: item.name + '(' + username + ')', value: item.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
apply_category_type: {
|
||||
type: 'cascader',
|
||||
label: this.$t('applications.appType'),
|
||||
rules: [Required],
|
||||
el: {
|
||||
multiple: false,
|
||||
options: ApplicationCascader
|
||||
},
|
||||
on: {
|
||||
change: ([event], updateForm) => {
|
||||
this.apply_category_type = event
|
||||
updateForm({
|
||||
apply_applications: [],
|
||||
apply_system_users: []
|
||||
})
|
||||
this.fieldsMeta.apply_applications.el.ajax.url = `/api/v1/applications/applications/suggestion/?oid=${vm.org_id}&category=${event[0]}&type=${event[1]}`
|
||||
this.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]}`
|
||||
}
|
||||
}
|
||||
},
|
||||
apply_date_start: {
|
||||
label: this.$t('common.DateStart'),
|
||||
type: 'date-picker',
|
||||
el: {
|
||||
type: 'datetime'
|
||||
}
|
||||
},
|
||||
apply_date_expired: {
|
||||
label: this.$t('common.DateEnd'),
|
||||
type: 'date-picker',
|
||||
el: {
|
||||
type: 'datetime'
|
||||
}
|
||||
},
|
||||
org_id: {
|
||||
component: Select2,
|
||||
el: {
|
||||
@@ -137,7 +136,7 @@ export default {
|
||||
hidden: (form) => {
|
||||
this.org_id = form['org_id']
|
||||
apply_category_type = this.apply_category_type
|
||||
const fieldsMeta = this.fieldsMeta.meta.fieldsMeta
|
||||
const fieldsMeta = this.fieldsMeta
|
||||
if (apply_category_type) {
|
||||
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]}`
|
||||
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]}`
|
||||
@@ -150,13 +149,13 @@ export default {
|
||||
name: 'TicketList'
|
||||
},
|
||||
cleanFormValue(value) {
|
||||
const applications = value.meta.apply_applications
|
||||
const systemUsers = value.meta.apply_system_users
|
||||
const applications = value.apply_applications
|
||||
const systemUsers = value.apply_system_users
|
||||
if (applications && Array.isArray(applications) && applications.length < 1) {
|
||||
delete value.meta.apply_applications
|
||||
delete value.apply_applications
|
||||
}
|
||||
if (systemUsers && Array.isArray(systemUsers) && systemUsers.length < 1) {
|
||||
delete value.meta.apply_system_users
|
||||
delete value.apply_system_users
|
||||
}
|
||||
return value
|
||||
}
|
||||
@@ -177,14 +176,13 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
performSubmit(validValues) {
|
||||
const validMeta = validValues.meta
|
||||
const applyCategoryType = validMeta.apply_category_type
|
||||
const applyCategoryType = validValues.apply_category_type
|
||||
const filter = (len, field) => {
|
||||
return applyCategoryType && applyCategoryType.length > 0 ? applyCategoryType[len] : validMeta[field]
|
||||
return applyCategoryType && applyCategoryType.length > 0 ? applyCategoryType[len] : validValues[field]
|
||||
}
|
||||
validMeta.apply_category = filter(0, 'apply_category')
|
||||
validMeta.apply_type = filter(1, 'apply_type')
|
||||
delete validMeta['apply_category_type']
|
||||
validValues.apply_category = filter(0, 'apply_category')
|
||||
validValues.apply_type = filter(1, 'apply_type')
|
||||
delete validValues['apply_category_type']
|
||||
return this.$axios['post'](`/api/v1/tickets/tickets/open/?type=apply_application`, validValues)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,13 +26,12 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statusMap: this.object.status === 'open' ? STATUS_MAP['notified'] : STATUS_MAP[this.object.state],
|
||||
statusMap: this.object.status === 'open' ? STATUS_MAP['pending'] : STATUS_MAP[this.object.state],
|
||||
requestForm: {
|
||||
name: this.object.meta.approve_permission_name,
|
||||
application: this.object.meta['apply_applications'],
|
||||
systemuser: this.object.meta['apply_system_users'],
|
||||
apply_date_expired: this.object.meta.apply_date_expired,
|
||||
apply_date_start: this.object.meta.apply_date_start
|
||||
application: this.object.apply_applications,
|
||||
systemuser: this.object.apply_system_users,
|
||||
apply_date_expired: this.object.apply_date_expired,
|
||||
apply_date_start: this.object.apply_date_start
|
||||
},
|
||||
comments: '',
|
||||
assets: []
|
||||
@@ -59,11 +58,11 @@ export default {
|
||||
},
|
||||
{
|
||||
key: this.$t('tickets.user'),
|
||||
value: obj['applicant_display']
|
||||
value: obj.rel_snapshot.applicant
|
||||
},
|
||||
{
|
||||
key: this.$t('tickets.OrgName'),
|
||||
value: obj['org_name']
|
||||
value: obj.org_name
|
||||
},
|
||||
{
|
||||
key: this.$t('common.dateCreated'),
|
||||
@@ -76,37 +75,38 @@ export default {
|
||||
]
|
||||
},
|
||||
specialCardItems() {
|
||||
const meta = this.object.meta || {}
|
||||
const vm = this
|
||||
const rel_snapshot = this.object.rel_snapshot
|
||||
return [
|
||||
{
|
||||
key: this.$t('applications.appType'),
|
||||
value: `${meta['apply_category_display']} / ${meta['apply_type_display']} `
|
||||
value: `${vm.object.apply_category_display} / ${vm.object.apply_type_display} `
|
||||
},
|
||||
{
|
||||
key: this.$t('applications.appName'),
|
||||
value: meta?.apply_applications_display?.join(', ') || ''
|
||||
value: rel_snapshot.apply_applications.join(', ')
|
||||
},
|
||||
{
|
||||
key: this.$t('tickets.SystemUser'),
|
||||
value: meta?.apply_system_users_display?.join(', ') || ''
|
||||
value: rel_snapshot.apply_system_users.join(', ')
|
||||
},
|
||||
{
|
||||
key: this.$t('common.dateStart'),
|
||||
value: toSafeLocalDateStr(meta.apply_date_start)
|
||||
value: toSafeLocalDateStr(vm.object.apply_date_start)
|
||||
},
|
||||
{
|
||||
key: this.$t('common.dateExpired'),
|
||||
value: toSafeLocalDateStr(meta.apply_date_expired)
|
||||
value: toSafeLocalDateStr(vm.object.apply_date_expired)
|
||||
}
|
||||
]
|
||||
},
|
||||
assignedCardItems() {
|
||||
const vm = this
|
||||
const meta = this.object.meta || {}
|
||||
const rel_snapshot = this.object.rel_snapshot
|
||||
return [
|
||||
{
|
||||
key: this.$t('tickets.PermissionName'),
|
||||
value: meta.apply_permission_name,
|
||||
value: vm.object.apply_permission_name,
|
||||
formatter: function(item, value) {
|
||||
const to = { name: 'ApplicationPermissionDetail', params: { id: vm.object.id }, query: { oid: vm.object.org_id }}
|
||||
if (vm.$hasPerm('perms.view_applicationpermission') && vm.object.status === 'closed' && vm.object.state === 'approved') {
|
||||
@@ -118,19 +118,19 @@ export default {
|
||||
},
|
||||
{
|
||||
key: this.$t('applications.appName'),
|
||||
value: meta?.apply_applications_display?.join(', ') || ''
|
||||
value: rel_snapshot.apply_applications.join(', ')
|
||||
},
|
||||
{
|
||||
key: this.$t('tickets.SystemUser'),
|
||||
value: meta?.apply_system_users_display?.join(', ') || ''
|
||||
value: rel_snapshot.apply_system_users.join(', ')
|
||||
},
|
||||
{
|
||||
key: this.$t('common.dateStart'),
|
||||
value: toSafeLocalDateStr(meta.apply_date_start)
|
||||
value: toSafeLocalDateStr(vm.object.apply_date_start)
|
||||
},
|
||||
{
|
||||
key: this.$t('common.dateExpired'),
|
||||
value: toSafeLocalDateStr(meta.apply_date_expired)
|
||||
value: toSafeLocalDateStr(vm.object.apply_date_expired)
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -22,18 +22,19 @@ export default {
|
||||
loading: true,
|
||||
initial: {
|
||||
ips_or_not: true,
|
||||
meta: {
|
||||
apply_date_expired: date_expired,
|
||||
apply_date_start: date_start,
|
||||
apply_actions: ['all', 'connect', 'updownload', 'upload_file', 'download_file'],
|
||||
apply_assets: []
|
||||
},
|
||||
apply_date_expired: date_expired,
|
||||
apply_date_start: date_start,
|
||||
apply_actions: ['all', 'connect', 'updownload', 'upload_file', 'download_file'],
|
||||
apply_assets: [],
|
||||
org_id: '',
|
||||
type: 'apply_asset'
|
||||
},
|
||||
fields: [
|
||||
[this.$t('common.Basic'), ['title', 'type', 'org_id', 'comment']],
|
||||
[this.$t('tickets.RequestPerm'), ['meta']]
|
||||
[this.$t('tickets.RequestPerm'), [
|
||||
'apply_nodes', 'apply_assets', 'apply_system_users',
|
||||
'apply_actions', 'apply_date_start', 'apply_date_expired'
|
||||
]]
|
||||
],
|
||||
fieldsMeta: {
|
||||
type: {
|
||||
@@ -42,57 +43,49 @@ export default {
|
||||
disabled: true
|
||||
}
|
||||
},
|
||||
meta: {
|
||||
fields: [
|
||||
'apply_nodes', 'apply_assets', 'apply_system_users', 'apply_actions',
|
||||
'apply_date_start', 'apply_date_expired'
|
||||
],
|
||||
fieldsMeta: {
|
||||
apply_actions: {
|
||||
label: this.$t('perms.Actions'),
|
||||
component: PermissionFormActionField,
|
||||
helpText: this.$t('common.actionsTips')
|
||||
},
|
||||
apply_nodes: {
|
||||
component: Select2,
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
url: '',
|
||||
transformOption: (item) => {
|
||||
return { label: `${item.full_value}`, value: item.id }
|
||||
}
|
||||
},
|
||||
clearable: true
|
||||
apply_actions: {
|
||||
label: this.$t('perms.Actions'),
|
||||
component: PermissionFormActionField,
|
||||
helpText: this.$t('common.actionsTips')
|
||||
},
|
||||
apply_nodes: {
|
||||
component: Select2,
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
url: '',
|
||||
transformOption: (item) => {
|
||||
return { label: `${item.full_value}`, value: item.id }
|
||||
}
|
||||
},
|
||||
apply_assets: {
|
||||
type: 'assetSelect',
|
||||
label: this.$t('perms.Asset'),
|
||||
component: Select2,
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
url: '',
|
||||
transformOption: (item) => {
|
||||
return { label: item.hostname + '(' + item.protocols + ')', value: item.id }
|
||||
}
|
||||
}
|
||||
clearable: true
|
||||
}
|
||||
},
|
||||
apply_assets: {
|
||||
type: 'assetSelect',
|
||||
label: this.$t('perms.Asset'),
|
||||
component: Select2,
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
url: '',
|
||||
transformOption: (item) => {
|
||||
return { label: item.hostname + '(' + item.protocols + ')', value: item.id }
|
||||
}
|
||||
},
|
||||
apply_system_users: {
|
||||
type: 'systemUserSelect',
|
||||
component: Select2,
|
||||
label: this.$t('assets.SystemUser'),
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
url: '',
|
||||
transformOption: (item) => {
|
||||
const username = item.username || '*'
|
||||
return { label: item.name + '(' + username + ')', value: item.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
apply_system_users: {
|
||||
type: 'systemUserSelect',
|
||||
component: Select2,
|
||||
label: this.$t('assets.SystemUser'),
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
url: '',
|
||||
transformOption: (item) => {
|
||||
const username = item.username || '*'
|
||||
return { label: item.name + '(' + username + ')', value: item.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,7 +99,7 @@ export default {
|
||||
})
|
||||
},
|
||||
hidden: (form) => {
|
||||
const fieldsMeta = this.fieldsMeta.meta.fieldsMeta
|
||||
const fieldsMeta = this.fieldsMeta
|
||||
fieldsMeta.apply_system_users.el.ajax.url = `/api/v1/assets/system-users/suggestions/?oid=${form['org_id']}&protocol__in=rdp,ssh,vnc,telnet`
|
||||
fieldsMeta.apply_assets.el.ajax.url = `/api/v1/assets/assets/suggestions/?oid=${form['org_id']}`
|
||||
fieldsMeta.apply_nodes.el.ajax.url = `/api/v1/assets/nodes/suggestions/?oid=${form['org_id']}`
|
||||
@@ -114,16 +107,16 @@ export default {
|
||||
}
|
||||
},
|
||||
cleanFormValue(value) {
|
||||
Object.keys(value.meta).forEach((item, index, arr) => {
|
||||
if (['apply_system_users'].includes(item)) {
|
||||
if (value.meta[item].length < 1) {
|
||||
delete value.meta[item]
|
||||
Object.keys(value).forEach((item, index, arr) => {
|
||||
if (['apply_system_users', 'apply_assets', 'apply_nodes'].includes(item)) {
|
||||
if (value[item].length < 1) {
|
||||
delete value[item]
|
||||
}
|
||||
}
|
||||
})
|
||||
return value
|
||||
},
|
||||
url: '/api/v1/tickets/tickets/?type=apply_asset&action=open',
|
||||
url: '/api/v1/tickets/apply-asset-tickets/?action=open',
|
||||
createSuccessNextRoute: {
|
||||
name: 'TicketList'
|
||||
}
|
||||
@@ -144,7 +137,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
performSubmit(validValues) {
|
||||
return this.$axios['post'](`/api/v1/tickets/tickets/open/?type=apply_asset`, validValues)
|
||||
return this.$axios['post'](`/api/v1/tickets/apply-asset-tickets/open/`, validValues)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,11 +26,13 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statusMap: this.object.status === 'open' ? STATUS_MAP['notified'] : STATUS_MAP[this.object.state],
|
||||
statusMap: this.object.status === 'open' ? STATUS_MAP['pending'] : STATUS_MAP[this.object.state],
|
||||
requestForm: {
|
||||
node: this.object.meta.apply_nodes,
|
||||
asset: this.object.meta.apply_assets,
|
||||
systemuser: this.object.meta.apply_system_users
|
||||
nodes: this.object.apply_nodes,
|
||||
assets: this.object.apply_assets,
|
||||
systemusers: this.object.apply_system_users,
|
||||
apply_date_expired: this.object.apply_date_expired,
|
||||
apply_date_start: this.object.apply_date_start
|
||||
},
|
||||
comments: '',
|
||||
assets: []
|
||||
@@ -57,7 +59,7 @@ export default {
|
||||
},
|
||||
{
|
||||
key: this.$t('tickets.user'),
|
||||
value: obj['applicant_display']
|
||||
value: obj.rel_snapshot.applicant
|
||||
},
|
||||
{
|
||||
key: this.$t('tickets.OrgName'),
|
||||
@@ -74,41 +76,42 @@ export default {
|
||||
]
|
||||
},
|
||||
specialCardItems() {
|
||||
const meta = this.object.meta || {}
|
||||
const vm = this
|
||||
const rel_snapshot = this.object.rel_snapshot
|
||||
return [
|
||||
{
|
||||
key: this.$t('perms.Node'),
|
||||
value: meta?.apply_nodes_display?.join(', ') || ''
|
||||
value: rel_snapshot.apply_nodes.join(', ')
|
||||
},
|
||||
{
|
||||
key: this.$t('tickets.Asset'),
|
||||
value: meta?.apply_assets_display?.join(', ') || ''
|
||||
value: rel_snapshot.apply_assets.join(', ')
|
||||
},
|
||||
{
|
||||
key: this.$t('tickets.SystemUser'),
|
||||
value: meta?.apply_system_users_display?.join(', ') || ''
|
||||
value: rel_snapshot.apply_system_users.join(', ')
|
||||
},
|
||||
{
|
||||
key: this.$t('assets.Action'),
|
||||
value: forMatAction(this, meta['apply_actions_display'])
|
||||
value: forMatAction(this, vm.object.apply_actions_display)
|
||||
},
|
||||
{
|
||||
key: this.$t('common.dateStart'),
|
||||
value: toSafeLocalDateStr(meta.apply_date_start)
|
||||
value: toSafeLocalDateStr(vm.object.apply_date_start)
|
||||
},
|
||||
{
|
||||
key: this.$t('common.dateExpired'),
|
||||
value: toSafeLocalDateStr(meta.apply_date_expired)
|
||||
value: toSafeLocalDateStr(vm.object.apply_date_expired)
|
||||
}
|
||||
]
|
||||
},
|
||||
assignedCardItems() {
|
||||
const vm = this
|
||||
const meta = this.object.meta || {}
|
||||
const rel_snapshot = this.object.rel_snapshot
|
||||
return [
|
||||
{
|
||||
key: this.$t('tickets.PermissionName'),
|
||||
value: this.object.meta.apply_permission_name,
|
||||
value: this.object.apply_permission_name,
|
||||
formatter: function(item, value) {
|
||||
const to = { name: 'AssetPermissionDetail', params: { id: vm.object.id }, query: { oid: vm.object.org_id }}
|
||||
if (vm.$hasPerm('perms.view_assetpermission') && vm.object.status === 'closed' && vm.object.state === 'approved') {
|
||||
@@ -120,32 +123,29 @@ export default {
|
||||
},
|
||||
{
|
||||
key: this.$t('perms.Node'),
|
||||
value: meta?.apply_nodes_display?.join(', ') || ''
|
||||
value: rel_snapshot.apply_nodes.join(', ')
|
||||
},
|
||||
{
|
||||
key: this.$t('assets.Asset'),
|
||||
value: meta?.apply_assets_display?.join(', ') || ''
|
||||
value: rel_snapshot.apply_assets.join(', ')
|
||||
},
|
||||
{
|
||||
key: this.$t('tickets.SystemUser'),
|
||||
value: meta?.apply_system_users_display?.join(', ') || ''
|
||||
value: rel_snapshot.apply_system_users.join(', ')
|
||||
},
|
||||
{
|
||||
key: this.$t('assets.Action'),
|
||||
value: forMatAction(this, meta['apply_actions_display'])
|
||||
value: forMatAction(this, vm.object.apply_actions_display)
|
||||
},
|
||||
{
|
||||
key: this.$t('common.dateStart'),
|
||||
value: toSafeLocalDateStr(meta?.apply_date_start)
|
||||
value: toSafeLocalDateStr(vm.object.apply_date_start)
|
||||
},
|
||||
{
|
||||
key: this.$t('common.dateExpired'),
|
||||
value: toSafeLocalDateStr(meta?.apply_date_expired)
|
||||
value: toSafeLocalDateStr(vm.object.apply_date_expired)
|
||||
}
|
||||
]
|
||||
},
|
||||
hasActionPerm() {
|
||||
return this.object.assignees.indexOf(this.$store.state.users.profile.id) !== -1
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -159,11 +159,11 @@ export default {
|
||||
window.location.reload()
|
||||
},
|
||||
handleApprove() {
|
||||
const assetLength = this.requestForm.asset.length
|
||||
const nodeLength = this.requestForm.node.length
|
||||
const assetLength = this.requestForm.assets.length
|
||||
const nodeLength = this.requestForm.nodes.length
|
||||
if (assetLength === 0 && nodeLength === 0) {
|
||||
return this.$message.error(this.$tc('common.SelectAtLeastOneAssetOrNodeErrMsg'))
|
||||
} else if (this.requestForm.systemuser.length === 0) {
|
||||
} else if (this.requestForm.systemusers.length === 0) {
|
||||
return this.$message.error(this.$tc('common.RequiredSystemUserErrMsg'))
|
||||
} else {
|
||||
this.$axios.put(`/api/v1/tickets/tickets/${this.object.id}/approve/`, {
|
||||
|
||||
@@ -27,7 +27,7 @@ export default {
|
||||
}
|
||||
],
|
||||
actions: {
|
||||
detailApiUrl: `/api/v1/tickets/tickets/${this.$route.params.id}/`
|
||||
detailApiUrl: `/api/v1/tickets/apply-asset-tickets/${this.$route.params.id}/`
|
||||
},
|
||||
getObjectName: this.getObjectName,
|
||||
hasRightSide: false
|
||||
|
||||
@@ -115,7 +115,7 @@ export default {
|
||||
state: {
|
||||
key: 'state',
|
||||
label: this.$t('tickets.action'),
|
||||
value: 'open',
|
||||
value: 'pending',
|
||||
valueLabel: this.$t('tickets.Pending')
|
||||
}
|
||||
},
|
||||
@@ -128,7 +128,7 @@ export default {
|
||||
children: [
|
||||
{
|
||||
default: true,
|
||||
value: 'open',
|
||||
value: 'pending',
|
||||
label: this.$t('tickets.Pending')
|
||||
},
|
||||
{
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
<el-steps direction="vertical" :active="ticketSteps">
|
||||
<el-step
|
||||
:title="`${this.$t('tickets.OpenTicket')}:${object.type_display}`"
|
||||
:description="`${this.$t('tickets.Applicant')}:${object.user_display}`"
|
||||
:description="`${this.$t('tickets.Applicant')}:${object.rel_snapshot.applicant}`"
|
||||
>
|
||||
<div slot="description">
|
||||
<div>{{ `${this.$t('tickets.Applicant')}:${object.applicant_display}` }}</div>
|
||||
<div>{{ `${this.$t('tickets.Applicant')}:${object.rel_snapshot.applicant}` }}</div>
|
||||
<div>{{ `${this.$t('common.dateCreated')}: ${toSafeLocalDateStr(object.date_created)}` }}</div>
|
||||
</div>
|
||||
</el-step>
|
||||
@@ -21,10 +21,10 @@
|
||||
</div>
|
||||
<div slot="description"><el-button type="text" style="color: blue" @click="lookOver(item.assignees_display)">点击查看 受理人</el-button></div>
|
||||
<div v-if="item.state==='closed'" slot="description">
|
||||
<div>{{ `${thisCopy.$t('tickets.Assignee')}:${object.applicant_display}` }}</div>
|
||||
<div>{{ `${thisCopy.$t('tickets.Assignee')}:${object.rel_snapshot.applicant}` }}</div>
|
||||
<div>{{ `${thisCopy.$t('common.dateFinished')}: ${toSafeLocalDateStr(item.approval_date)}` }}</div>
|
||||
</div>
|
||||
<div v-if="item.state!=='notified' && item.state!=='closed'" slot="description">
|
||||
<div v-if="item.state!=='pending' && item.state!=='closed'" slot="description">
|
||||
<div>{{ `${thisCopy.$t('tickets.Assignee')}:${item.processor_display}` }}</div>
|
||||
<div>{{ `${thisCopy.$t('common.dateFinished')}: ${toSafeLocalDateStr(item.approval_date)}` }}</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import i18n from '@/i18n/i18n'
|
||||
|
||||
export const OPEN = 'notified'
|
||||
export const OPEN = 'pending'
|
||||
export const APPROVE = 'approved'
|
||||
export const REJECT = 'rejected'
|
||||
export const CLOSED = 'closed'
|
||||
|
||||
Reference in New Issue
Block a user