zhulizhen1111 %!s(int64=4) %!d(string=hai) anos
pai
achega
523ab8944a

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

@@ -35,6 +35,7 @@
                     v-if='ruleForm.Type=="Zone"'
                     v-model='ruleForm.FillColor'
                     style='margin:0 172px 0 10px'
+                    show-alpha
                     @change='changBgColor'
                     :color-format='"hex"'
                 ></el-color-picker>
@@ -224,10 +225,23 @@ export default {
                 this.clearGraphy(this.ruleForm.Type == 'Zone' ? 1 : 0)
             }
         },
+        //rgba转成16进制
+        hexify(color) {
+            var values = color
+                .replace(/rgba?\(/, '')
+                .replace(/\)/, '')
+                .replace(/[\s+]/g, '')
+                .split(',')
+            var a = parseFloat(values[3] || 1),
+                r = Math.floor(a * parseInt(values[0]) + (1 - a) * 255),
+                g = Math.floor(a * parseInt(values[1]) + (1 - a) * 255),
+                b = Math.floor(a * parseInt(values[2]) + (1 - a) * 255)
+            return '#' + ('0' + r.toString(16)).slice(-2) + ('0' + g.toString(16)).slice(-2) + ('0' + b.toString(16)).slice(-2)
+        },
         // 背景颜色改变
         changBgColor(val) {
             if (this.view) {
-                this.view.bgcolor = val
+                this.view.bgcolor = this.hexify(val)
             }
         },
         // 线条颜色改变

+ 5 - 3
src/views/legendLibrary/addLegend.vue

@@ -37,11 +37,13 @@ export default {
             this.dialogVisible = true
             this.title = title
             this.GraphCategoryId = GraphCategoryId
-            if (title == '新增图例库') {
+            if (title == '添加图例库') {
                 this.info = {
                     Name: '',
-                    Type: '',
-                    Unit: ''
+                    Type: 'None',
+                    Unit: '',
+                    FillColor: '',
+                    Url: ''
                 }
             }
             if (title == '修改图例库') {

+ 1 - 0
src/views/legendLibrary/index.vue

@@ -290,6 +290,7 @@ export default {
             display: flex;
             align-items: center;
         }
+
         .img {
             width: 28px;
             height: 28px;