Browse Source

key添加

zhulizhen1111 4 years ago
parent
commit
15aea85a50

+ 10 - 3
src/views/legendLibrary/addForm.vue

@@ -26,7 +26,7 @@
             </div>
             <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 />
+                    <img :key='key' :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>
@@ -215,7 +215,8 @@ export default {
             typeVisualization: [],
 
             // majorList: [], //专业
-            deviceList: []
+            deviceList: [],
+            key: 1
         }
     },
     props: ['ruleForm', 'title'],
@@ -231,6 +232,8 @@ export default {
             // //console.log(file, fileList, 'file')
         },
         getFile(file) {
+            // let imgSrc = document.querySelector('.input-right>img')
+            // console.log(imgSrc)
             this.file = file.file
             var formData = new FormData()
             formData.append('file', file.file)
@@ -240,6 +243,7 @@ export default {
             let postParams = formData
             uploadImg({ postParams }).then(res => {
                 if (res.Result == 'success') {
+                    this.key++
                     this.$set(this.ruleForm, 'Url', res.EntityList[0])
                     this.$message.success('图标上传成功!')
                 }
@@ -250,7 +254,6 @@ export default {
             let postParams = {
                 Content: [this.ruleForm]
             }
-
             createLegend({ postParams }).then(res => {
                 if (res.Result == 'success') {
                     this.$message.success('添加图例成功!')
@@ -502,6 +505,10 @@ export default {
             display: flex;
             align-items: center;
             justify-content: center;
+            img {
+                width: 28px;
+                height: 28px;
+            }
             .model1 {
                 width: 56px;
                 height: 6px;

+ 1 - 1
src/views/legendLibrary/addLegend.vue

@@ -64,7 +64,6 @@ export default {
                 })
                 //treeSelect
                 this.modalShow4 = true
-
                 this.info = {
                     Name: '',
                     Type: 'None',
@@ -92,6 +91,7 @@ export default {
             } else if (title == '修改图例库') {
                 this.dialogVisible = true
                 this.info = row
+                console.log(this.info)
                 // 图例库规则中的transform
             } else if (title == '' && this.$refs.searchList) {
                 this.$refs.searchList.queryAll()

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

@@ -94,7 +94,7 @@
                 ></Select>
                 <el-input size='small' @change='getTableList' prefix-icon='el-icon-search' v-model='keyword' style='width:192px;margin-right:12px;'></el-input>
             </div>
-            <el-table :data='tableData' :border='true' style='width: 100%'>
+            <el-table :data='tableData' :key='key' :border='true' style='width: 100%'>
                 <el-table-column prop='Name' label='图例名称'>
                     <template slot-scope='{row}'>{{row.Name || '--'}}</template>
                 </el-table-column>
@@ -164,6 +164,7 @@ export default {
     data() {
         return {
             tableData: [],
+            key: 1,
             dataSelect2: [
                 { id: 'test1', name: '选择项' },
                 { id: 'test2', name: '单平米' },
@@ -330,6 +331,7 @@ export default {
                 Type: this.Type == 'all' ? undefined : this.Type
             }
             graphElementSearch({ postParams }).then(res => {
+                this.key++
                 this.tableData = res.Content
                 this.total = res.Total
             })