Sfoglia il codice sorgente

词云异步更新

wjj 4 anni fa
parent
commit
b25f65fd1f
3 ha cambiato i file con 25 aggiunte e 35 eliminazioni
  1. 5 23
      src/components/task/Task.vue
  2. 19 12
      src/components/task/TaskCloud.vue
  3. 1 0
      src/js/taskService.js

+ 5 - 23
src/components/task/Task.vue

@@ -63,7 +63,7 @@
                     <el-radio
                       :label="item"
                       name="type"
-                      v-for="item,index in institutionArray"
+                      v-for="(item,index) in institutionArray"
                       :key="index"
                     >{{item.evaluationAgencyName}}
                     </el-radio>
@@ -300,8 +300,7 @@ export default {
       showBD: true,
       rolesPermissions: {},
       loading: false,
-      isModifyMode: false,
-      institutionArray: [],
+      isModifyMode: false,      institutionArray: [],
       tabPosition: 'top',
       resourceType: ResourceType,
       serviceType: [],
@@ -427,24 +426,6 @@ export default {
     serviceType(val) {
       this.serviceType = val
     },
-    // 'task.institution' () {
-    //   if (this.task.institution) {
-    //     //this.$refs.addFormProvince.resetProviceCity()
-    //     this.task.location = {provinceCode: '', cityCode: ''}
-    //   }
-    // },
-    // 'task.location' () {
-    //   if (this.task.location.provinceCode || this.task.location.cityCode) {
-    //     this.task.institution = ''
-    //   }
-    // },
-    // 'task.resource' () {
-    //   if (this.task.resource == '广场') {
-    //     this.$refs.addFormProvince.resetProviceCity()
-    //     this.task.institution = ''
-    //     this.task.location = {provinceCode: '', cityCode: ''}
-    //   }
-    // },
     deep: true
   },
   mounted() {
@@ -701,7 +682,7 @@ export default {
       this.task.title = res.crowdTaskVO.title
       this.task.description = res.crowdTaskVO.description
       this.task.serviceType = res.crowdTaskVO.serviceType
-      this.task.resource = res.crowdTaskVO.resource
+      this.task.resource = res.crowdTaskVO.resource.toString()
       this.task.location = res.crowdTaskVO.location == null ? {
         provinceCode: 3200,
         cityCode: 3201
@@ -722,7 +703,8 @@ export default {
       this.crowdReportUrl = res.crowdTaskVO.writeReportUrl;
       this.acceptedUserList = res.acceptedUserList
       this.handleTestTypeChange(res.crowdTaskVO.serviceType);
-      this.serviceName = this.getServiceByCode(res.crowdTaskVO.serviceType);
+      this.serviceName = this.getServiceByCode(res.crowdTaskVO.serviceType)
+      this.getWordCloud()
       this.hideLoading()
       notify('success', '修改成功')
     },

+ 19 - 12
src/components/task/TaskCloud.vue

@@ -1,5 +1,5 @@
 <template>
-  <div id='taskWordCloud' style="height: 457px;width: 100%" ></div>
+  <div id='taskWordCloud' style="height: 457px;width: 100%"></div>
 </template>
 
 <script>
@@ -14,9 +14,16 @@ export default {
   props: ['info'],
   data() {
     return {
-      chart: null
+      chart: null,
+      words: this.info,
     };
   },
+  watch: {
+    info(nv){
+      this.words = nv;
+      this.initChart();
+    }
+  },
   mounted() {
     this.initChart();
   },
@@ -29,7 +36,7 @@ export default {
   },
   methods: {
     initChart() {
-      this.chart = echarts.init(document.getElementById('taskWordCloud'),{width:'auto',height:'500px'});
+      this.chart = echarts.init(document.getElementById('taskWordCloud'), {width: 'auto', height: '500px'});
       const option = {
         backgroundColor: "#fff",
         // tooltip: {
@@ -53,7 +60,7 @@ export default {
             // maskImage: maskImage,
             textStyle: {
               normal: {
-                color: function() {
+                color: function () {
                   return (
                     "rgb(" +
                     Math.round(Math.random() * 255) +
@@ -66,13 +73,13 @@ export default {
                 }
               }
             },
-            grid:{
-              x:10,
-              y:10,
-              x2:10,
-              y2:10,
-              height:"500px",
-              width:"100%"
+            grid: {
+              x: 10,
+              y: 10,
+              x2: 10,
+              y2: 10,
+              height: "500px",
+              width: "100%"
             },
             //位置相关设置
             // Folllowing left/top/width/height/right/bottom are used for positioning the word cloud
@@ -84,7 +91,7 @@ export default {
             width: "100%",
             height: "100%",
             //数据
-            data: this.info
+            data: this.words
           }
         ]
       };

+ 1 - 0
src/js/taskService.js

@@ -10,6 +10,7 @@ export const updateTask = (projectId, taskId, task, updateTaskSuccess, updateTas
   Http.put(Apis.TASK.UPDATE_TASK.replace('{projectId}', projectId).replace('{taskId}', taskId), task).then((res) => {
     updateTaskSuccess(res)
   }).catch((error) => {
+    console.log(error);
     updateTaskFail(error)
   })
 }