From 8f62227adb3e8d8ce3e2e647806d34236b24b64a Mon Sep 17 00:00:00 2001 From: thexqn Date: Fri, 23 Aug 2024 16:29:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D=E5=9C=A8=E7=BB=A7?= =?UTF-8?q?=E6=89=BF=E6=A8=A1=E5=9E=8B=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B?= =?UTF-8?q?=EF=BC=8C=E9=9D=9E=E7=BB=A7=E6=89=BF=E5=B1=9E=E6=80=A7=E4=B8=8E?= =?UTF-8?q?=E7=BB=A7=E6=89=BF=E5=B1=9E=E6=80=A7=E7=9A=84=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E5=85=B6=E4=BB=96=E5=88=86=E7=BB=84=E7=9A=84?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cmdb/views/ci_types/attributesTable.vue | 45 +++++++------------ 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/cmdb-ui/src/modules/cmdb/views/ci_types/attributesTable.vue b/cmdb-ui/src/modules/cmdb/views/ci_types/attributesTable.vue index 18855b5..c01a402 100644 --- a/cmdb-ui/src/modules/cmdb/views/ci_types/attributesTable.vue +++ b/cmdb-ui/src/modules/cmdb/views/ci_types/attributesTable.vue @@ -479,53 +479,42 @@ export default { console.log('changess', group) if (e.hasOwnProperty('moved') && e.moved.oldIndex !== e.moved.newIndex) { if (group === -1 || group === null) { - this.$message.error(this.$t('cmdb.ciType.attributeSortedTips')) - this.refreshPage() + this.refreshPage(this.$t('cmdb.ciType.attributeSortedTips')) } else if (e.moved.newIndex < this.groupMaxCount[group]) { - this.$message.error(this.$t('cmdb.ciType.attributeSortedTips2')) - this.refreshPage() + this.refreshPage(this.$t('cmdb.ciType.attributeSortedTips2')) } else { transferCITypeAttrIndex(this.CITypeId, { from: { attr_id: e.moved.element.id, group_name: group }, - to: { order: e.moved.newIndex, group_name: group }, + to: { order: e.moved.newIndex, group_name: group } }) - .then((res) => this.$message.success(this.$t('updateSuccess'))) - .catch(() => { - this.refreshPage() - }) + .then(() => this.$message.success(this.$t('updateSuccess'))) + .catch(() => this.init()) } } - if (e.hasOwnProperty('added')) { this.addRemoveGroupFlag = { to: { group_name: group, order: e.added.newIndex }, inited: true } } - if (e.hasOwnProperty('removed')) { this.$nextTick(() => { if (this.addRemoveGroupFlag.to.order < this.groupMaxCount[this.addRemoveGroupFlag.to.group_name]) { - this.$message.error(this.$t('cmdb.ciType.attributeSortedTips2')) - this.refreshPage() - this.addRemoveGroupFlag = {} + this.refreshPage(this.$t('cmdb.ciType.attributeSortedTips2')) } else { - transferCITypeAttrIndex(this.CITypeId, { - from: { attr_id: e.removed.element.id, group_name: group }, - to: { group_name: this.addRemoveGroupFlag.to.group_name, order: this.addRemoveGroupFlag.to.order }, - }) - .then((res) => this.$message.success(this.$t('saveSuccess'))) - .catch(() => { - this.refreshPage() - }) - .finally(() => { - this.addRemoveGroupFlag = {} + transferCITypeAttrIndex(this.CITypeId, { + from: { attr_id: e.removed.element.id, group_name: group }, + to: { group_name: this.addRemoveGroupFlag.to.group_name, order: this.addRemoveGroupFlag.to.order } }) + .then(() => this.$message.success(this.$t('saveSuccess'))) + .catch(() => this.init()) + .finally(() => { + this.addRemoveGroupFlag = {} + }) } }) } }, - abortDraggable() { - this.$nextTick(() => { - this.$router.push({ name: 'ci_type' }) - }) + refreshPage(errorMessage) { + this.$message.error(errorMessage) + this.init() }, updatePropertyIndex() { const attributes = [] // All attributes