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', width: '90px',
sortable: 'custom', sortable: 'custom',
formatter: row => { formatter: row => {
if (row.status === 'open') { if (row.status.value === 'open') {
return <el-tag return <el-tag
type='success' type='success'
size='mini' size='mini'

View File

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

View File

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

View File

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

View File

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