From 395e7130132f70df515b6167b35174bfcc976f50 Mon Sep 17 00:00:00 2001 From: wanglei Date: Tue, 11 Nov 2025 09:39:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E6=A0=B8=E6=A8=A1=E6=9D=BF=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/views/kaohe/template/index.vue | 28 ++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/ruoyi-ui/src/views/kaohe/template/index.vue b/ruoyi-ui/src/views/kaohe/template/index.vue index a11eda6..da2b065 100644 --- a/ruoyi-ui/src/views/kaohe/template/index.vue +++ b/ruoyi-ui/src/views/kaohe/template/index.vue @@ -186,6 +186,8 @@ export default { name: "Template", data() { return { + detail: {}, + items: [], // 遮罩层 loading: true, // 选中数组 @@ -293,7 +295,9 @@ export default { this.reset() const id = row.id || this.ids getTemplate(id).then(response => { - this.form = response.data + this.form = {...response.data}; + this.detail = {...response.data}; + this.items = [...response.data.items]; this.open = true this.title = "修改考核模板" }) @@ -304,11 +308,20 @@ export default { if (valid) { if(this.form.items.length>0){ if (this.form.id != null) { - updateTemplate(this.form).then(response => { - this.$modal.msgSuccess("修改成功") - this.open = false - this.getList() - }) + let ids = this.items.map(item => item.id).sort((a, b) => a - b);; + let ids1 = this.form.items.map(item => item.id).sort((a, b) => a - b);; + console.log(ids,ids1, this.arraysEqual(ids,ids1)); + if(!(this.detail.temName === this.form.temName && this.detail.remark === this.form.remark && this.arraysEqual(ids,ids1))){ + updateTemplate(this.form).then(response => { + this.$modal.msgSuccess("修改成功") + this.open = false + this.getList() + }) + }else { + this.$alert(`数据未发生变化,如不需要修改,请直接点击取消按钮!`, `提示`, { + type: 'warning' + }) + } } else { addTemplate(this.form).then(response => { this.$modal.msgSuccess("新增成功") @@ -416,6 +429,9 @@ export default { delKhitemList(row,index){ this.form.items.splice(index,1) }, + arraysEqual(a, b) { + return JSON.stringify(a.sort()) === JSON.stringify(b.sort()); + } } }