Quellcode durchsuchen

修改透明度

shaun-sheep vor 4 Jahren
Ursprung
Commit
6123edb52a

+ 2 - 2
public/systemConf.js

@@ -25,8 +25,8 @@ var __systemConf = {
     conf: {
         // 阿里云
         editerUrl: 'http://60.205.177.43:80/wandaEditer/', // 编辑器地址
-        wandaBmGuideUrl: 'http://60.205.177.43:80/wandaBmGuide/', //管理书地址
-        // wandaBmGuideUrl: 'http://192.168.200.26:8090/wandaBmGuide/', //管理书地址
+        // wandaBmGuideUrl: 'http://60.205.177.43:80/wandaBmGuide/', //管理书地址
+        wandaBmGuideUrl: 'http://192.168.200.26:8090/wandaBmGuide/', //管理书地址
     },
 }
 window.__systemConf = __systemConf

+ 15 - 70
src/views/legendLibrary/addForm.vue

@@ -142,6 +142,7 @@
 
 <script>
 import { queryDeviceAndPOsition, createLegend, updateLegend, uploadImg, getVisualization } from '@/api/legendLibrary.js'
+import transparency from './../legendLibrary/transparency.js'
 import { FloorView } from '@/lib/FloorView'
 import { FloorScene } from '@/lib/FloorScene'
 import { GraphView } from '@/lib/GraphView'
@@ -320,77 +321,21 @@ export default {
         //rgba转成16进制
         hexify(color) {
             if (color) {
-                var opacity = ''
-                var rgb = color.split(',')
-                var r = parseInt(rgb[0].split('(')[1])
-                var g = parseInt(rgb[1])
-                var b = parseInt(rgb[2].split(')')[0])
-                switch (parseFloat(rgb[3] || 1) + '') {
-                    case '0':
-                        opacity = '00'
-                        break
-                    case '0.05':
-                        opacity = '0C'
-                        break
-                    case '0.1':
-                        opacity = '19'
-                        break
-                    case '0.15':
-                        opacity = '26'
-                        break
-                    case '0.2':
-                        opacity = '33'
-                        break
-                    case '0.25':
-                        opacity = '3F'
-                        break
-                    case '0.3':
-                        opacity = '4C'
-                        break
-                    case '0.35':
-                        opacity = '59'
-                        break
-                    case '0.4':
-                        opacity = '66'
-                        break
-                    case '0.45':
-                        opacity = '72'
-                        break
-                    case '0.5':
-                        opacity = '7F'
-                        break
-                    case '0.55':
-                        opacity = '8C'
-                        break
-                    case '0.6':
-                        opacity = '99'
-                        break
-                    case '0.65':
-                        opacity = 'A5'
-                        break
-                    case '0.7':
-                        opacity = 'B2'
-                        break
-                    case '0.75':
-                        opacity = 'BF'
-                        break
-                    case '0.8':
-                        opacity = 'CC'
-                        break
-                    case '0.85':
-                        opacity = 'D8'
-                        break
-                    case '0.9':
-                        opacity = 'E5'
-                        break
-                    case '0.95':
-                        opacity = 'F2'
-                        break
-                    case '1':
-                        opacity = 'FF'
-                        break
-                }
+                let opacity = '',
+                    rgb = color.split(','),
+                    r = parseInt(rgb[0].split('(')[1]),
+                    g = parseInt(rgb[1]),
+                    b = parseInt(rgb[2].split(')')[0]),
+                    a = Number(rgb[3].split(')')[0] || 1) * 100
+
+                transparency.forEach((i, index) => {
+                    if (index == a) {
+                        opacity = i
+                    }
+                })
+
                 var hex = '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1) + opacity
+                console.log(hex)
                 return hex
             } else {
                 return

+ 11 - 69
src/views/legendLibrary/index.vue

@@ -172,6 +172,7 @@
 </template>
 <script>
 import addLegend from './addLegend'
+import transparency from './transparency.js'
 import Select from '@/components/Select/Select.vue'
 import {
     queryDeviceAndPOsition,
@@ -185,72 +186,13 @@ import {
 } from '@/api/legendLibrary.js'
 
 function hexToRgba(hex) {
-    let opacity = ''
-    switch (hex.slice(7, 9)) {
-        case '00':
-            opacity = '0'
-            break
-        case '0C':
-            opacity = '0.05'
-            break
-        case '19':
-            opacity = '0.1'
-            break
-        case '26':
-            opacity = '0.15'
-            break
-        case '33':
-            opacity = '0.2'
-            break
-        case '3F':
-            opacity = '0.25'
-            break
-        case '4C':
-            opacity = '0.3'
-            break
-        case '59':
-            opacity = '0.35'
-            break
-        case '66':
-            opacity = '0.4'
-            break
-        case '72':
-            opacity = '0.45'
-            break
-        case '7F':
-            opacity = '0.5'
-            break
-        case '8C':
-            opacity = '0.55'
-            break
-        case '99':
-            opacity = '0.6'
-            break
-        case 'A5':
-            opacity = '0.65'
-            break
-        case 'B2':
-            opacity = '0.7'
-            break
-        case 'BF':
-            opacity = '0.75'
-            break
-        case 'CC':
-            opacity = '0.8'
-            break
-        case 'D8':
-            opacity = '0.85'
-            break
-        case 'E5':
-            opacity = '0.9'
-            break
-        case 'F2':
-            opacity = '0.95'
-            break
-        case 'FF':
-            opacity = '1'
-            break
-    }
+    let opacity = '',
+        a = hex.slice(7, 9)
+    transparency.forEach((i, index) => {
+        if (i == a) {
+            opacity = index / 100
+        }
+    })
     return (
         'rgba(' +
         parseInt('0x' + hex.slice(1, 3)) +
@@ -477,9 +419,9 @@ export default {
             })
         },
         getTableList() {
-            if (this.GraphCategoryIds || this.InfoLocals || this.InfoSystems || this.keyword) {
-                this.currentPage = 1
-            }
+            // if (this.GraphCategoryIds || this.InfoLocals || this.InfoSystems || this.keyword) {
+            //     this.currentPage = 1
+            // }
             let postParams = {
                 Deleted: this.state == 1 ? false : true,
                 GraphCategoryIds: this.GraphCategoryIds.length ? this.GraphCategoryIds : undefined, //说明书位置

+ 104 - 0
src/views/legendLibrary/transparency.js

@@ -0,0 +1,104 @@
+ const Transparency = [
+     "00",
+     "03",
+     "05",
+     "08",
+     "0A",
+     "0D",
+     "0F",
+     "12",
+     "14",
+     "17",
+     "1A",
+     "1C",
+     "1F",
+     "21",
+     "24",
+     "26",
+     "29",
+     "2B",
+     "2E",
+     "30",
+     "33",
+     "36",
+     "38",
+     "3B",
+     "3D",
+     "40",
+     "42",
+     "45",
+     "47",
+     "4A",
+     "4D",
+     "4F",
+     "52",
+     "54",
+     "57",
+     "59",
+     "5C",
+     "5E",
+     "61",
+     "63",
+     "66",
+     "69",
+     "6B",
+     "6E",
+     "70",
+     "73",
+     "75",
+     "78",
+     "7A",
+     "7D",
+     "80",
+     "82",
+     "85",
+     "87",
+     "8A",
+     "8C",
+     "8F",
+     "91",
+     "94",
+     "96",
+     "99",
+     "9C",
+     "9E",
+     "A1",
+     "A3",
+     "A6",
+     "A8",
+     "AB",
+     "AD",
+     "B0",
+     "B3",
+     "B5",
+     "B8",
+     "BA",
+     "BD",
+     "BF",
+     "C2",
+     "C4",
+     "C7",
+     "C9",
+     "CC",
+     "CF",
+     "D1",
+     "D4",
+     "D6",
+     "D9",
+     "DB",
+     "DE",
+     "E0",
+     "E3",
+     "E6",
+     "E8",
+     "EB",
+     "ED",
+     "F0",
+     "F2",
+     "F5",
+     "F7",
+     "FA",
+     "FC",
+     "FF"
+ ];
+ export default Transparency

+ 5 - 13
src/views/legendRules/index.vue

@@ -12,19 +12,11 @@
             </Dropdown>
         </div>-->
         <div class='legend-rules-top'>
-            <span
-                class='el-icon-arrow-left'
-                @click='goBack'
-                style='float: left;
-                        cursor: pointer;
-                        font-size: 25px;
-                        display: inline-block;
-                        margin-top: 10px;
-                        padding-left: 20px;'
-            >
-                <!-- <i style='font-size:14px;display:inline-block;height:48px;line-height:48px'>图例管理</i> -->
-            </span>
-            图例绘制规则
+            <div style='float: left;overflow:hidden; margin-top: 5px;
+                        padding-left: 20px;   display: inline-block;'>
+                <i class='el-icon-arrow-left' @click='goBack' style='cursor: pointer; font-size: 25px;'></i>
+                <span style='margin-bottom:10px; display: inline-block;'>返回</span>
+            </div>图例绘制规则
             <el-button type='primary' class='rules-button' size='small' @click='add'>添加图例</el-button>
         </div>
         <div class='legend-rules-bottom'>