From 21b2c44753bf6e0587bd795f2557da63399d6fdf Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期六, 12 三月 2022 19:29:17 +0800
Subject: [PATCH] 完善底库功能

---
 src/pages/library/components/baseList.vue |  156 ++++++++++++++++++---------------------------------
 1 files changed, 56 insertions(+), 100 deletions(-)

diff --git a/src/pages/library/components/baseList.vue b/src/pages/library/components/baseList.vue
index 3062d4d..ef99051 100644
--- a/src/pages/library/components/baseList.vue
+++ b/src/pages/library/components/baseList.vue
@@ -1,17 +1,9 @@
 <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">
@@ -37,26 +29,11 @@
             @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">
@@ -110,23 +87,10 @@
             @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>
@@ -159,7 +123,7 @@
   </div>
 </template>
 <script>
-import { updateDbTableStatus } from "@/api/baseLibrary";
+import { updateDbTableStatus } from "@/api/baseLibrary"
 export default {
   name: "baseList",
   data() {
@@ -169,121 +133,113 @@
       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.clickLast(typ)
       } 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.clickLast(typ)
       } 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);
+      this.clickBase = item
+      this.$emit("getList", item, type)
+      console.log("clickCategory", 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