From 4a800a8fc83c6bd1f86a8e847b079a51a7532c09 Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期三, 20 七月 2022 15:05:58 +0800 Subject: [PATCH] 修复国标配置的bug --- src/pages/library/components/baseList.vue | 156 +++++++++++++++++++++++++++++++++------------------ 1 files changed, 100 insertions(+), 56 deletions(-) diff --git a/src/pages/library/components/baseList.vue b/src/pages/library/components/baseList.vue index ef99051..9a70af5 100644 --- a/src/pages/library/components/baseList.vue +++ b/src/pages/library/components/baseList.vue @@ -1,9 +1,17 @@ <template> - <div :style="listWidth ? `width:${listWidth};` : ''" class="out-div el-menu-vertical-demo"> + <div + :style="listWidth ? `width:${listWidth};` : ''" + class="out-div el-menu-vertical-demo" + > <el-collapse v-model="activeNames"> <el-collapse-item name="1" class="el-collapse-item__wrap"> <template slot="title"> - <img v-if="title === '鍚屾搴�'" src="/images/library/鍚屾搴�2.png" alt="" srcset="" /> + <img + v-if="title === '鍚屾搴�'" + src="/images/library/鍚屾搴�2.png" + alt="" + srcset="" + /> <img v-else src="/images/library/鏈湴搴�2.png" alt="" srcset="" /> <span class="m5">{{ title }}</span> <el-tooltip content="娣诲姞鍚屾搴�" placement="top"> @@ -29,11 +37,26 @@ @click.native="clickCategory(index, 'sync', item)" :class="{ activeRow: categoryIndex == 'sync' + index }" > - <el-col :span="12" :class="item.bwType === '1' ? 'c-red' : 'c-green'"> - <p style="text-align: left; margin-left: 5px" class="name-ellipsis" :title="item.tableName"> - <span class="iconfont iconrenyuanku-09" v-if="item.tableType == 'person'"></span> - <span class="iconfont iconcheliangku-09" v-if="item.tableType == 'car'"></span> - <span style="font-size: 14px; font-weight: bold"> {{ item.tableName }}</span> + <el-col + :span="12" + :class="item.bwType === '1' ? 'c-red' : 'c-green'" + > + <p + style="text-align: left; margin-left: 5px" + class="name-ellipsis" + :title="item.tableName" + > + <span + class="iconfont iconrenyuanku-09" + v-if="item.tableType == 'person'" + ></span> + <span + class="iconfont iconcheliangku-09" + v-if="item.tableType == 'car'" + ></span> + <span style="font-size: 14px; font-weight: bold"> + {{ item.tableName }}</span + > </p> </el-col> <el-col :span="10" :offset="1"> @@ -87,10 +110,23 @@ @click.native="clickCategory(index, 'local', item)" :class="{ activeRow: categoryIndex == 'local' + index }" > - <el-col :span="12" :class="item.bwType === '1' ? 'c-red' : 'c-green'"> - <p style="text-align: left; margin-left: 5px" class="name-ellipsis" :title="item.tableName"> - <span class="iconfont iconrenyuanku-09" v-if="item.tableType == 'person'"></span> - <span class="iconfont iconcheliangku-09" v-if="item.tableType == 'car'"></span> + <el-col + :span="12" + :class="item.bwType === '1' ? 'c-red' : 'c-green'" + > + <p + style="text-align: left; margin-left: 5px" + class="name-ellipsis" + :title="item.tableName" + > + <span + class="iconfont iconrenyuanku-09" + v-if="item.tableType == 'person'" + ></span> + <span + class="iconfont iconcheliangku-09" + v-if="item.tableType == 'car'" + ></span> <span> {{ item.tableName }}</span> </p> </el-col> @@ -123,7 +159,7 @@ </div> </template> <script> -import { updateDbTableStatus } from "@/api/baseLibrary" +import { updateDbTableStatus } from "@/api/baseLibrary"; export default { name: "baseList", data() { @@ -133,113 +169,121 @@ categoryIndex: "", syncTableList: [], localTableList: [], - clickBase: {} // 褰撳墠鐐瑰嚮鐨勫簳搴撳璞� - } + clickBase: {}, // 褰撳墠鐐瑰嚮鐨勫簳搴撳璞� + }; }, computed: { isAdmin() { - if (sessionStorage.getItem("userInfo") && sessionStorage.getItem("userInfo") !== "") { - let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username - return loginName === "superadmin" || loginName === "basic" + if ( + sessionStorage.getItem("userInfo") && + sessionStorage.getItem("userInfo") !== "" + ) { + let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username; + return loginName === "superadmin" || loginName === "basic"; } - return false - } + return false; + }, }, mounted() { - this.init() + this.init(); }, methods: { isShow(authority) { - return this.isAdmin || this.buttonAuthority.indexOf("," + authority + ",") > -1 + return ( + this.isAdmin || this.buttonAuthority.indexOf("," + authority + ",") > -1 + ); }, async init(typ) { - await this.BaseManageData.querySyncTables() - this.syncTableList = this.BaseManageData.syncTables + await this.BaseManageData.querySyncTables(); + this.syncTableList = this.BaseManageData.syncTables; if (typ) { - this.clickLast(typ) + this.$emit("getList"); } else { - this.defaultShow() + this.defaultShow(); } - await this.BaseManageData.queryLocalTables() - this.localTableList = this.BaseManageData.localTables + await this.BaseManageData.queryLocalTables(); + this.localTableList = this.BaseManageData.localTables; if (typ) { - this.clickLast(typ) + this.$emit("getList"); } else { - this.defaultShow() + this.defaultShow(); } }, add(type) { - this.$emit("changeShow", null, type) + this.$emit("changeShow", null, type); }, clickLast(type) { // this.$nextTick(() => { // }); - this.clickCategory(this.syncTableList.length - 1, type, this.syncTableList[this.syncTableList.length - 1]) + this.clickCategory( + this.syncTableList.length - 1, + type, + this.syncTableList[this.syncTableList.length - 1] + ); }, clickCategory(index, type, item) { - this.categoryIndex = type + index + this.categoryIndex = type + index; // 璋冪敤鍒囨崲鍙充晶闈㈡澘鐨勫嚱鏁板苟涓斿垏鎹㈢埗缁勪欢涓璱sSelected鐨勫�艰鍙︿竴涓粍浠舵竻闄よ閫変腑鐘舵�� - this.clickBase = item - this.$emit("getList", item, type) - console.log("clickCategory", item, type) + this.clickBase = item; + this.$emit("getList", item, type); }, // 榛樿鏄剧ず绗竴涓簱鐨勬暟鎹� defaultShow() { if (this.syncTableList && this.syncTableList.length) { - this.clickCategory(0, "sync", this.syncTableList[0]) + this.clickCategory(0, "sync", this.syncTableList[0]); } else { if (this.localTableList && this.localTableList.length) { - this.clickCategory(0, "local", this.syncTableList[0]) + this.clickCategory(0, "local", this.syncTableList[0]); } } }, // 娣诲姞鏃堕棿姣旇緝鍑芥暟 dateParse(dateString) { - var SEPARATOR_BAR = "-" - var SEPARATOR_SLASH = "/" - var SEPARATOR_DOT = "." - var dateArray + var SEPARATOR_BAR = "-"; + var SEPARATOR_SLASH = "/"; + var SEPARATOR_DOT = "."; + var dateArray; if (dateString.indexOf(SEPARATOR_BAR) > -1) { - dateArray = dateString.split(SEPARATOR_BAR) + dateArray = dateString.split(SEPARATOR_BAR); } else if (dateString.indexOf(SEPARATOR_SLASH) > -1) { - dateArray = dateString.split(SEPARATOR_SLASH) + dateArray = dateString.split(SEPARATOR_SLASH); } else { - dateArray = dateString.split(SEPARATOR_DOT) + dateArray = dateString.split(SEPARATOR_DOT); } - return new Date(dateArray[0], dateArray[1] - 1, dateArray[2]) + return new Date(dateArray[0], dateArray[1] - 1, dateArray[2]); }, isEmpty(str) { if (!str || str === undefined || str === null) { - return true + return true; } else { - return false + return false; } - } + }, }, props: { listWidth: { default: "224px", - type: String + type: String, }, title: { default: "鍚屾搴�", - type: String + type: String, }, titleB: { default: "鏈湴搴�", - type: String + type: String, }, isSelected: { default: false, - type: Boolean + type: Boolean, }, type: { default: "", - type: String - } - } -} + type: String, + }, + }, +}; </script> <style lang="scss"> .iconStyle1 { -- Gitblit v1.8.0