From fed6d3bfe1aa5dbbdffa8f78de86e469e1654bd1 Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Wed, 6 Nov 2019 10:08:52 +0800 Subject: 修复数量显示不对的bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/templates/js/modules/sys/system.js | 14 ++++++++------ .../src/main/resources/templates/modules/sys/system.html | 8 ++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/nezha-admin/src/main/resources/templates/js/modules/sys/system.js b/nezha-admin/src/main/resources/templates/js/modules/sys/system.js index c6b1c120..19fa753a 100644 --- a/nezha-admin/src/main/resources/templates/js/modules/sys/system.js +++ b/nezha-admin/src/main/resources/templates/js/modules/sys/system.js @@ -80,8 +80,8 @@ var nodeRelComponent = Vue.extend({ type: Array, required: true }, - selectedTotalCount: Number, - selectableTotalCount: Number + initSelectedTotalCount: Number, + initSelectableTotalCount: Number }, data: function () { return { @@ -94,6 +94,8 @@ var nodeRelComponent = Vue.extend({ selectableIPEnd: '', selectedCount: 0, selectableCount: 0, + selectedTotalCount: null, + selectableTotalCount: null, selectedNodesAdd: [], //新增的已分配节点 selectableNodesAdd: [], //新增的可分配节点(从已分配节点里删除的) colModel: [ @@ -179,10 +181,6 @@ var nodeRelComponent = Vue.extend({ $(tmp[i]).addClass("new-node"); $("#" + toSelector + "-box").find("tbody").prepend(tmp[i]); } - //已选数量和总数量控制 - this.countControll(); - //更新序号 - this.refreshRowIndex(); //同步数组数据 this.selectedNodesAdd = []; this.selectableNodesAdd = []; @@ -193,6 +191,10 @@ var nodeRelComponent = Vue.extend({ $("#selectable-box").find(".new-node").each(function(index) { vmTemp.selectableNodesAdd.push($(this).attr("uuid")); }); + //已选数量和总数量控制 + this.countControll(); + //更新序号 + this.refreshRowIndex(); //将数据传递给父组件 this.$emit("node-change", [this.selectedNodesAdd, this.selectableNodesAdd]); }, diff --git a/nezha-admin/src/main/resources/templates/modules/sys/system.html b/nezha-admin/src/main/resources/templates/modules/sys/system.html index ef4737b6..9aeba89f 100644 --- a/nezha-admin/src/main/resources/templates/modules/sys/system.html +++ b/nezha-admin/src/main/resources/templates/modules/sys/system.html @@ -137,8 +137,8 @@ v-on:node-change="nodeChange" :selected-nodes="selectedNodes" :selectable-nodes="selectableNodes" - :selected-total-count="selectedNodes.length" - :selectable-total-count="selectableNodes.length" + :init-selected-total-count="selectedNodes.length" + :init-selectable-total-count="selectableNodes.length" > @@ -180,7 +180,7 @@ -