From 5c0c6ad7ac6f28e970532af9936de638830f1161 Mon Sep 17 00:00:00 2001 From: ZZJ <10913410+zzj2100@user.noreply.gitee.com> Date: 星期四, 28 七月 2022 10:20:51 +0800 Subject: [PATCH] bugxiufu --- src/views/equipmentManagement/equipmentList/components/FormList.vue | 292 +++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 206 insertions(+), 86 deletions(-) diff --git a/src/views/equipmentManagement/equipmentList/components/FormList.vue b/src/views/equipmentManagement/equipmentList/components/FormList.vue index 347be27..678493a 100644 --- a/src/views/equipmentManagement/equipmentList/components/FormList.vue +++ b/src/views/equipmentManagement/equipmentList/components/FormList.vue @@ -44,7 +44,7 @@ <div class="button add" @click="isShowAdd = true"> <span>+</span>娣诲姞璁惧 </div> - <div class="button export"> + <div class="button export" @click="exportFile"> <span class="iconfont"></span>瀵煎嚭 </div> </div> @@ -101,7 +101,7 @@ </el-table-column> <el-table-column label="鎵�灞為泦缇�" show-overflow-tooltip min-width="154"> - <template> -- </template> + <template slot-scope="scope"> {{ scope.row.clusterName }} </template> </el-table-column> <el-table-column label="鐘舵��" min-width="70"> @@ -114,28 +114,54 @@ <el-table-column label="鎿嶄綔" min-width="180"> <template slot-scope="scope"> <!-- 鍔犲叆 --> - <span class="iconfont option" @click="joinCluster(scope.row)" - ></span + <el-tooltip + content="鍔犲叆闆嗙兢" + placement="top" + v-if="!scope.row.clusterId" > + <span + class="iconfont option" + @click="joinCluster(scope.row)" + :class="{ disable: scope.row.isOnline != 1 }" + ></span + > + </el-tooltip> <!-- 閫�鍑� --> - <span - class="iconfont option" - @click="quitCluster(scope.row)" - v-if="false" - ></span - > + <el-tooltip content="閫�鍑洪泦缇�" placement="top" v-else> + <span + class="iconfont option" + @click="quitCluster(scope.row)" + :class="{ disable: scope.row.isOnline != 1 }" + ></span + > + </el-tooltip> <!-- 绠楁硶璇︽儏 --> - <span class="iconfont option" @click="algorithmDetail(scope.row)" - ></span - > + <el-tooltip content="搴旂敤璇︽儏" placement="top"> + <span + class="iconfont option" + :class="{ disable: scope.row.isOnline != 1 }" + @click="algorithmDetail(scope.row)" + ></span + > + </el-tooltip> <!-- 璁惧璇︽儏 --> - <span class="iconfont option" @click="checkDetail(scope.row)" - ></span - > + <el-tooltip content="璁惧璇︽儏" placement="top"> + <span + class="iconfont option" + :class="{ disable: scope.row.isOnline != 1 }" + @click="checkDetail(scope.row)" + ></span + > + </el-tooltip> <!-- 瑙g粦 --> - <span class="iconfont option" @click="Untying(scope.row)" - ></span - > + <el-tooltip content="瑙i櫎缁戝畾" placement="top"> + <span + class="iconfont option" + @click="Untying(scope.row)" + :class="{ disable: scope.row.isOnline != 1 }" + ></span + > + </el-tooltip> </template> </el-table-column> </el-table> @@ -181,11 +207,18 @@ </template> <script> -import { findDevList } from "@/api/device"; +import { + findDevList, + findClustersBySearch, + exportDevListExcel, +} from "@/api/device"; import AddBox from "@/views/equipmentManagement/equipmentList/components/AddBox"; import UnbindBox from "@/views/equipmentManagement/equipmentDetail/components/UnbindBox"; import QuitClusterBox from "@/views/equipmentManagement/equipmentList/components/QuitClusterBox"; import JoinClusterBox from "@/views/equipmentManagement/equipmentList/components/JoinClusterBox"; + +import bus from "@/plugin/bus"; + export default { components: { AddBox, @@ -193,12 +226,12 @@ QuitClusterBox, JoinClusterBox, }, + created() { + this.getCluster(); + }, data() { return { - searchTime: [ - this.$moment().format("YYYY-MM-DD 00:00:00"), - this.$moment().format("YYYY-MM-DD HH:mm:ss"), - ], //鎼滅储鏃堕棿 + searchTime: [], //鎼滅储鏃堕棿 page: 1, size: 10, //鍒嗛〉鐩稿叧 inputText: "", //杈撳叆妗嗗唴瀹� @@ -207,16 +240,7 @@ isShowAdd: false, //鏄惁灞曠ず鏂板寮圭獥 isShowUnbind: false, //鏄惁灞曠ず瑙g粦寮圭獥 unbindId: "", - clusterArr: [ - { - value: 0, - label: "闆嗙兢1", - }, - { - value: 1, - label: "闆嗙兢2", - }, - ], //鎵�灞為泦缇や笅鎷夋 + clusterArr: [], //鎵�灞為泦缇や笅鎷夋 cluster: null, //閫変腑鐨勯泦缇ょ被鍨� showQuit: false, //灞曠ず閫�鍑洪泦缇ょ殑寮圭獥 showJoin: false, //灞曠ず鍔犲叆闆嗙兢鐨勫脊绐� @@ -224,45 +248,77 @@ }; }, methods: { + async getCluster() { + const res = await findClustersBySearch({ + InputText: "", + Page: 1, + Size: 10000, + userId: JSON.parse(sessionStorage.getItem("userInfo")).id, + }); + if (res && res.success) { + res.data.list.forEach((item) => { + this.clusterArr.push({ + label: item.clusterName, + value: item.clusterId, + }); + }); + } + }, + // 璺冲埌璁惧璇︽儏 checkDetail(row) { + if (row.isOnline != 1) { + return; + } this.$router.push({ path: "/equipmentDetail", query: { id: row.devId, - ip: row.devIp, - port: row.serverPort, - ndid: row.id, }, }); }, // 璺冲埌绠楁硶璇︽儏 algorithmDetail(row) { + if (row.isOnline != 1) { + return; + } this.$router.push({ path: "/algorithmDetail", query: { id: row.devId, - ip: row.devIp, - port: row.serverPort, }, }); }, // 鏌ヨ鍒楄〃 searchingBtn() { - let param = { - page: this.page, - size: this.size, - // startTime: this.searchTime[0], - // endTime: this.searchTime[1], - inputText: this.inputText, - }; + let param = {}; + + if (!this.searchTime) { + param = { + page: this.page, + size: this.size, + startTime: "", + endTime: "", + clusterId: this.cluster, + inputText: this.inputText, + }; + } else { + param = { + page: this.page, + size: this.size, + startTime: this.searchTime[0], + endTime: this.searchTime[1], + clusterId: this.cluster, + inputText: this.inputText, + }; + } + findDevList(param) .then((res) => { this.dataList = res.data.list; //鏃堕棿鍒嗚鏄剧ず - this.dataList.forEach((item) => { item.installTime = item.installTime.split(" "); item.firstUseTime = item.firstUseTime.split(" "); @@ -271,6 +327,8 @@ if (res.data.total <= this.size) { this.page = 1; } + + bus.$emit("refleshNode", this.dataList); }) .catch((err) => { console.log(err); @@ -290,40 +348,11 @@ //瑙g粦鎸夐挳 Untying(row) { - console.log(row); - this.unbindId = row.id; + if (row.isOnline != 1) { + return; + } + this.unbindId = row.devId; this.isShowUnbind = true; - /* this.$confirm( - "瑙g粦鍚庤璁惧灏嗕粠璁惧鍒楄〃涓Щ闄わ紝鏄惁纭鎿嶄綔?", - "瑙g粦鎻愮ず", - { - type: "warning", - center: true, - } - ) - .then(() => { - unbind({ ids: [row.id] }) - .then(() => { - this.$notify({ - type: "success", - message: "瑙g粦鎴愬姛", - duration: 2500, - offset: 57, - }); - this.searchingBtn(); - }) - .catch(() => { - this.$notify({ - type: "error", - message: "瑙g粦澶辫触锛岃鑱旂郴瀹㈡湇", - duration: 2500, - offset: 57, - }); - }); - }) - .catch((e) => { - console.log(e); - }); */ }, //鑾峰緱榛樿鏃堕棿 @@ -347,6 +376,7 @@ //鍏抽棴鏂板寮圭獥 closeAddBox() { this.isShowAdd = false; + this.searchingBtn(); }, // 鍏抽棴瑙g粦寮圭獥 closeUnbindBox() { @@ -362,23 +392,77 @@ clearSearch() { this.searchTime = this.getDateInit(); this.inputText = ""; + this.cluster = ""; this.searchingBtn(); }, //閫�鍑洪泦缇� quitCluster(equipment) { + if (equipment.isOnline != 1) { + return; + } this.activeEquipment = equipment; this.showQuit = true; }, //鍔犲叆闆嗙兢 joinCluster(equipment) { + if (equipment.isOnline != 1) { + return; + } this.activeEquipment = equipment; this.showJoin = true; }, + + //瀵煎嚭鍒楄〃鏂囦欢 + async exportFile() { + let param = {}; + + if (!this.searchTime) { + param = { + page: this.page, + size: this.size, + startTime: "", + endTime: "", + clusterId: this.cluster, + inputText: this.inputText, + }; + } else { + param = { + page: this.page, + size: this.size, + startTime: this.searchTime[0], + endTime: this.searchTime[1], + clusterId: this.cluster, + inputText: this.inputText, + }; + } + const result = await exportDevListExcel(param); + + var blob = new Blob([result.body.data], { + type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8", + }), + Temp = document.createElement("a"); + + Temp.href = window.URL.createObjectURL(blob); + + console.log(result); + console.log(result.fileName); + + Temp.download = window.decodeURI(result.fileName); + + Temp.setAttribute("download", result.fileName); + + document.body.appendChild(Temp); + + Temp.click(); + + document.body.removeChild(Temp); + + window.URL.revokeObjectURL(Temp); + }, }, mounted() { - this.searchTime = this.getDateInit(); this.searchingBtn(); }, }; @@ -392,6 +476,7 @@ padding: 60px 0 30px 0; font-size: 14px; border-bottom: 1px solid #e9ebee; + background-color: #fff; .left, .right, @@ -400,6 +485,26 @@ .cluster { display: flex; align-items: center; + } + + .cluster { + .el-select { + width: 190px; + height: 40px; + line-height: 40px; + + ::v-deep input { + height: 40px; + } + + .el-icon-arrow-up { + line-height: 40px; + } + + ::v-deep .el-icon-arrow-up { + height: 40px; + } + } } .id .el-input ::v-deep { @@ -425,7 +530,7 @@ } .el-input ::v-deep { - width: 280px; + width: 270px; height: 40px; margin-left: 10px; margin-right: 20px; @@ -443,7 +548,7 @@ } .el-date-editor { - width: 318px; + width: 340px; height: 40px; margin-left: 10px; margin-right: 20px; @@ -459,7 +564,7 @@ } .searchBtn { - width: 120px; + width: 110px; height: 40px; line-height: 40px; text-align: center; @@ -469,7 +574,7 @@ } .resetBtn { - width: 120px; + width: 110px; height: 40px; line-height: 40px; text-align: center; @@ -562,12 +667,17 @@ font-size: 24px; color: rgb(0, 101, 255); cursor: pointer; + + &.disable { + color: #666; + cursor: default; + } } } .el-pagination ::v-deep { margin-top: 30px; - text-align: center; + text-align: right; height: 24px; .el-pagination__sizes { margin-right: 0; @@ -601,6 +711,16 @@ border-color: #0065ff; } } + + .el-pagination__jump { + margin-left: 12px; + .el-pagination__editor { + width: 37px; + input { + width: 32px; + } + } + } } } </style> -- Gitblit v1.8.0