perf: ticket optimization

This commit is contained in:
feng 2022-11-17 17:27:52 +08:00
parent 3704e4d478
commit c691a93ee5
5 changed files with 20 additions and 17 deletions

View File

@ -97,7 +97,7 @@ export default {
width: '90px',
sortable: 'custom',
formatter: row => {
if (row.status === 'open') {
if (row.status.value === 'open') {
return <el-tag
type='success'
size='mini'

View File

@ -20,7 +20,7 @@
<Select2 v-model="requestForm.assets" v-bind="assetSelect2" style="width: 50% !important" />
</el-form-item>
<el-form-item :label="$tc('tickets.SystemUser')" :rules="isRequired">
<AccountFormatter v-model="requestForm.accounts" v-bind="requestForm.accounts" style="width: 50% !important" />
<AccountFormatter v-model="requestForm.accounts" style="width: 50% !important" />
</el-form-item>
<el-form-item :label="$tc('common.DateStart')" required>
<el-date-picker
@ -199,23 +199,27 @@ export default {
window.location.reload()
},
handleApprove() {
const nodes = this.requestForm.nodes
const assets = this.requestForm.assets
const accounts = this.requestForm.accounts
console.log('nodes', nodes)
console.log('assets', assets)
console.log('accounts', accounts)
if (this.object.approval_step === this.object.process_map.length) {
const assetLength = this.requestForm.assets.length
const nodeLength = this.requestForm.nodes.length
if (assetLength === 0 && nodeLength === 0) {
if (assets.length === 0 && nodes.length === 0) {
return this.$message.error(this.$tc('common.SelectAtLeastOneAssetOrNodeErrMsg'))
} else if (this.requestForm.accounts.length === 0) {
} else if (accounts.length === 0) {
return this.$message.error(this.$tc('common.RequiredSystemUserErrMsg'))
}
}
this.$axios.patch(`/api/v1/tickets/apply-asset-tickets/${this.object.id}/approve/`, {
apply_accounts: this.requestForm.accounts ? this.requestForm.accounts : [],
apply_nodes: this.requestForm.nodes ? this.requestForm.nodes : [],
apply_assets: this.requestForm.assets ? this.requestForm.assets : [],
apply_nodes: nodes || [],
apply_assets: assets || [],
apply_accounts: accounts || [],
org_id: this.object.org_id,
apply_actions: this.requestForm.actions,
apply_date_start: this.requestForm.apply_date_start,
apply_date_expired: this.requestForm.apply_date_expired,
org_id: this.object.org_id
apply_date_expired: this.requestForm.apply_date_expired
}).then(() => {
this.$message.success(this.$tc('common.updateSuccessMsg'))
this.reloadPage()

View File

@ -33,7 +33,7 @@ export default {
},
{
key: this.$t('tickets.ApprovalLevel'),
value: this.object.approval_level + ''
value: this.object.approval_level + 'level'
},
{
key: this.$t('common.CreatedBy'),
@ -50,7 +50,6 @@ export default {
]
},
specialCardItems() {
// eslint-disable-next-line no-unused-vars
const approvalData = [
{
key: this.$t('tickets.OneAssigneeType'),
@ -68,7 +67,7 @@ export default {
key: this.$t('tickets.TwoAssignee'),
value: ''
}]
this.object.rules.forEach((item, index) => {
this.object.rules.forEach(item => {
if (item.level === 1) {
approvalData[0].value = item.strategy.label
approvalData[1].value = item.assignees_display.join(',')

View File

@ -30,8 +30,8 @@ export default {
columnsMeta: {
org_name: {
formatter: function(row, col, cell) {
var currentOrg = vm.$store.getters.currentOrg
return currentOrg.is_root ? row.org_name : currentOrg.name
const currentOrg = vm.$store.getters.currentOrg
return currentOrg['is_root'] ? row.org_name : currentOrg.name
}
},
type: {

View File

@ -57,7 +57,7 @@ export default {
methods: {
getTicketOpenCount() {
getTicketOpenCount(this.currentUser.id).then(data => {
this.assignedTicketCount = data.count
this.assignedTicketCount = data['count']
})
},
getBadgeValue(props) {