Explorar o código

修改图例库

shaun-sheep %!s(int64=4) %!d(string=hai) anos
pai
achega
c4e61ac1fa

+ 31 - 17
src/views/legendLibrary/addForm.vue

@@ -19,6 +19,7 @@
             <div class='input-right' ref='graph' v-show='ruleForm.Type=="Zone" || ruleForm.Type=="Image" || ruleForm.Type =="Line"'>
                 <div v-show=' ruleForm.Type=="Image" && ruleForm.Url' class='input-right'>
                     <img :src='`/serve/topology-wanda/Picture/query/${ruleForm.Url}`' alt />
+                    <!-- {{ruleForm.Url}} -->
                 </div>
                 <canvas id='canvas' :width='canvasWidth' :height='canvasHeight' v-show='!(ruleForm.Type=="Image" && ruleForm.Url)'></canvas>
             </div>
@@ -54,11 +55,6 @@
                     </el-option>
                 </el-select>
 
-                <!-- <el-select v-model='ruleForm.LineWidth' placeholder='请选择' size='small' style='width:160px;' ref='select' @change='changeLineWidth'>
-                    <el-option v-for='item in linepxOption' :key='item.id' :label='item.src' :value='item.id'>
-                        <img :src='item.src' alt />
-                    </el-option>
-                </el-select>-->
                 <div style='position:relative'>
                     <a-input-number id='inputNumber' v-model='ruleForm.LineWidth' :min='1' :max='10' ref='select' @change='changeLineWidth' />
                     <span class='line-width'>px</span>
@@ -92,21 +88,15 @@
                 <el-select v-model='value' placeholder='请选择' size='small' style='width:200px;margin-right:48px'>
                     <el-option v-for='item in options2' :key='item.value' :label='item.label' :value='item.value'></el-option>
                 </el-select>
-                <!-- <el-select v-model='value' placeholder='请选择' size='small' style='width:200px;'>
-                    <el-option v-for='item in options3' :key='item.value' :label='item.label' :value='item.value'></el-option>
-                </el-select>-->
+
                 <TreeSelect
-                    title='已选项'
-                    unit='个'
-                    placeholder='请选择'
                     tipPlace='top'
-                    height='300'
+                    height='200'
                     :notNull='true'
                     :returnParentNode='false'
                     :isShowAllChoice='true'
-                    :selectedIds='select11'
                     :choseArea='true'
-                    :data='dataTreeMultiple5'
+                    :data='typeVisualization'
                     @change='treeConfirm'
                     @focusChange='focusChange'
                 />
@@ -116,7 +106,7 @@
 </template>
 
 <script>
-import { createLegend, updateLegend, uploadImg } from '@/api/legendLibrary.js'
+import { createLegend, updateLegend, uploadImg, getVisualization } from '@/api/legendLibrary.js'
 import { FloorView } from '@/lib/FloorView'
 import { FloorScene } from '@/lib/FloorScene'
 import { GraphView } from '@/lib/GraphView'
@@ -185,8 +175,8 @@ export default {
             canvasHeight: 114,
             view: null,
             scene: null,
-            dataTreeMultiple5: [],
-            select11: []
+            typeVisualization: [],
+            visualizationList: [] //已选铺位可视化
         }
     },
     props: ['ruleForm', 'title'],
@@ -311,6 +301,7 @@ export default {
             }
         },
         base64ToFile(dataurl, filename) {
+            console.log(dataurl, 'url')
             let arr = dataurl.split(',')
             let mime = arr[0].match(/:(.*?);/)[1]
             if (!filename) {
@@ -354,9 +345,32 @@ export default {
         },
         focusChange(status) {
             console.log('focusChange', status)
+        },
+        visualization() {
+            getVisualization({}).then(res => {
+                this.typeVisualization = res.Data && res.Data.map(i => this.getTree(i))
+                console.log(this.typeVisualization)
+            })
+        },
+        getTree(data) {
+            return {
+                id: data.Id,
+                name: data.Name,
+                children: data.Children ? data.Children.map(i => this.getTree(i)) : []
+            }
+        },
+        treeConfirm(id) {
+            this.visualizationList = id.map(i => {
+                return { id: i }
+            })
+        },
+        focusChange(status) {
+            console.log('focusChange', status)
         }
     },
     mounted() {
+        this.visualization()
+
         if (this.title == '修改图例库') {
             this.changeLineWidth(this.ruleForm.LineWidth)
             this.changeLineType(this.ruleForm.LineDash)

+ 2 - 4
src/views/legendLibrary/addLegend.vue

@@ -71,7 +71,6 @@ export default {
                 }
             } else if (title == '添加图例库') {
                 this.dialogVisible = true
-
                 this.info = {
                     Name: '',
                     Type: 'None',
@@ -80,6 +79,7 @@ export default {
                     Url: ''
                 }
             } else if (title == '修改图例库') {
+                this.dialogVisible = true
                 this.info = row
                 // 图例库规则中的transform
             } else if (title == '' && this.$refs.searchList) {
@@ -126,10 +126,8 @@ export default {
             }
         },
         treeConfirm(ids, dataObj) {
-            console.log('确定:::', ids)
-            console.log('确定:::', dataObj)
             let postParams = {
-                GraphCategoryId: this.GraphCategoryId,
+                GraphCategoryId: this.GraphCategoryId.join(' '),
                 GraphElementIds: ids
             }
             updateRelation({ postParams }).then(res => {

+ 27 - 22
src/views/legendLibrary/index.vue

@@ -39,24 +39,15 @@
                     @change='getTableList'
                     style='margin:0 12px'
                 ></Select>
-                <!-- <Select
-                    width='180'
-                    tipPlace='top'
-                    v-model='TypeId'
-                    caption='铺位可视化:'
-                    :selectdata='typeIdSelect'
-                    :placeholder='"请选择"'
-                    @change='getTableList'
-                ></Select>-->
+
                 <TreeSelect
                     caption='铺位可视化:'
                     tipPlace='top'
-                    width='250'
-                    :lastStage='true'
-                    :linkage='false'
+                    height='250'
+                    :returnParentNode='false'
+                    :isShowAllChoice='true'
                     :choseArea='true'
-                    :data='typeIdSelect'
-                    :hideClear='true'
+                    :data='typeVisualization'
                     @change='treeConfirm'
                     @focusChange='focusChange'
                 />
@@ -181,7 +172,9 @@ export default {
                 { id: 'RQXT', name: '燃气系统-楼层分布' },
                 { id: 'SCPZ', name: '土建装饰-石材铺装' }
             ],
-            keyword: ''
+            keyword: '',
+            typeVisualization: [],
+            visualizationList: [] //已选铺位可视化
         }
     },
     methods: {
@@ -196,10 +189,17 @@ export default {
         },
         visualization() {
             getVisualization({}).then(res => {
-                this.typeIdSelect = res.Data
-                console.log(this.typeIdSelect)
+                this.typeVisualization = res.Data && res.Data.map(i => this.getTree(i))
+                console.log(this.typeVisualization, 'typeVisualization')
             })
         },
+        getTree(data) {
+            return {
+                id: data.Type,
+                name: data.Name,
+                children: data.Children ? data.Children.map(i => this.getTree(i)) : []
+            }
+        },
         add() {
             this.$refs.addLegend.open('', '添加图例库')
         },
@@ -246,7 +246,6 @@ export default {
             queryRelation({ data, postParams }).then(res => {
                 this.tableData = res.data.Content
                 this.total = res.Total
-                console.log(this.tableData, res)
             })
         },
         getTableList() {
@@ -261,9 +260,9 @@ export default {
             }
             // 状态
             if (this.state == 1) {
-                postParams.Filters += `deleted='true'`
+                postParams.Filters += `deleted=0`
             } else {
-                postParams.Filters += `deleted='true'`
+                postParams.Filters += `deleted=1`
             }
             if (this.Type) {
                 postParams.Filters += `;Type='${this.Type}'`
@@ -271,6 +270,9 @@ export default {
             // 位置分类InfoLocal
             //专业 InfoSystem
             // 可视化InfoTypeId
+            if (this.visualizationList.length > 0) {
+                postParams.Filters += `;InfoTypeId contain '${JSON.stringify(this.visualizationList)}'`
+            }
             // 搜索 Name
             if (this.keyword) {
                 postParams.Filters += `;Name contain '${this.keyword}'`
@@ -287,8 +289,11 @@ export default {
         addSuccess() {
             this.getTableList()
         },
-        treeConfirm(data) {
-            console.log(data)
+        treeConfirm(id, info) {
+            this.visualizationList = info.map(i => i.id)
+            console.log(info)
+            // this.getTableList()
+            console.log(this.visualizationList, '==visualizationList=visualizationListvisualizationList')
         },
         focusChange(status) {
             console.log('focusChange', status)