2 Commity b484bda1a2 ... 3786bdda45

Autor SHA1 Wiadomość Data
  SanHQin 3786bdda45 Merge branch 'beta' of https://git.cocorobo.cn/CocoRoboLabs/pbl-teacher-table into beta 1 tydzień temu
  SanHQin 0b4c600389 update 1 tydzień temu

+ 7 - 7
src/components/pages/test/add/components/checkOrder.vue

@@ -324,13 +324,13 @@ export default {
                         className += " test_icon_time"
                     }
 										let itemType = item.type;
-										// if(itemType===1){
-										// 	if(item.json.type===1){
-										// 		itemType = 9;
-										// 	}else if(item.json.type==2){
-										// 		itemType = 10;
-										// 	}
-										// }
+										if(itemType===1){
+											if(item.json.type===1){
+												itemType = 9;
+											}else if(item.json.type==2){
+												itemType = 10;
+											}
+										}
                     return `${this.etype=='edit'?'<span class="test_index">'+(index+1)+'</span>':index+1+'、'}` + "" + (item.json && this.etype != 'edit' ? `<span class='${className}'></span>` : `<span class='${className}'></span>` + this.options2[itemType]) + (item.json && this.etype != 'edit' ? `${item.json.title}` : "");
                 } else if (item.ttype == 2) {
                     return `${item.name ? item.name : `第${index + 1}组`}(共${item.array.length}题)`;

+ 52 - 4
src/components/pages/test/add/edit/index.vue

@@ -43,6 +43,9 @@
       ></editBox>
       <checkBox v-if="type == 2" :cJson="checkJson" :title="title"></checkBox>
     </div>
+		<div class="ajaxCancel" v-if="loading && ajaxCancelToken">
+			 <el-button type="primary" @click.stop="cancelAjax">停止生成</el-button>
+		</div>
   </div>
 </template>
 
@@ -50,6 +53,8 @@
 import editBox from "./edit/index.vue";
 import checkBox from "./check/index.vue";
 import { v4 as uuidv4 } from "uuid";
+import ConvertApi from 'convertapi-js'
+let convertApi = ConvertApi.auth('secret_8jZzewWvAJluEjTR')
 export default {
   components: {
     editBox,
@@ -84,8 +89,8 @@ export default {
       checkJson: [],
       loading: false,
 			userId: this.$route.query.userid,
-
 			viewFile:false,
+			ajaxCancelToken:null,
     };
   },
   watch: {
@@ -145,15 +150,27 @@ export default {
       input.type = "file";
       // input.accept = ".wav";
       // input.accept = "audio/*, .txt, .pdf, .xlsx";
-      input.accept = ".docx";
+      input.accept = ".docx,.doc";
       input.click();
       input.onchange = async () => {
         this.loading = true;
         let file = input.files[0];
+				if(/\.(doc)$/i.test(file.name)){
+					let params = convertApi.createParams()
+          params.add('file', file)
+					let result = await convertApi.convert('doc', 'docx', params)
+          // Get result file URL
+          file = await fetch(result.files[0].Url).then(res => res.blob()).then(blob => {
+            return new File([blob], result.files[0].FileName, { type: 'application/octet-stream' });
+          });
+				}
+				console.log("file",file)
         if (!/\.(docx)$/i.test(file.name)) {
           this.loading = false;
           return this.$message.error("请上传.docx格式的文件");
         }
+
+				
         let uploadData = await this.uploadFile(file);
         if (uploadData == 1) {
           this.loading = false;
@@ -170,6 +187,10 @@ export default {
         }
 
 				let testData = await this.getCheckJSon(_fileData.fileId);
+				if(testData==2){
+					this.loading = false;
+					return;
+				}
 				if (testData == 1) {
           this.loading = false;
           return this.$message.error("生成题目失败");
@@ -298,10 +319,11 @@ Instruction: Based on the context, follow "Format example", write content
           // model: "gpt-4o-2024-08-06"
         };
 				console.log(params)
+				this.ajaxCancelToken = this.ajax.setCancelSource()
         this.ajax
           // .post("https://gpt4.cocorobo.cn/chat", params)
           // .post("https://claude3.cocorobo.cn/chat", params)
-          .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", params)
+          .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", params,this.ajaxCancelToken)
           .then(res => {
             let _data = res.data.FunctionResponse.message;
             _data = _data.replaceAll("```json", "").replaceAll("```", "");
@@ -314,15 +336,25 @@ Instruction: Based on the context, follow "Format example", write content
             } else {
               resolve(1);
             }
+						this.ajaxCancelToken = null;
           })
           .catch(e => {
             console.log(e);
-            resolve(1);
+						this.ajaxCancelToken = null;
+            resolve(2);
           });
       });
     },
 		viewUploadFile(){
 			this.viewFile = !this.viewFile;
+		},
+		cancelAjax(){
+			if(this.ajaxCancelToken){
+				this.ajaxCancelToken.cancel('Request canceled by the user.');
+				this.ajaxCancelToken = null;
+				this.$message.info("已停止文档生成");
+				this.loading = false;
+			}
 		}
   },
   mounted() {
@@ -467,4 +499,20 @@ Instruction: Based on the context, follow "Format example", write content
   position: absolute;
   left: 30px;
 }
+
+.ajaxCancel{
+	position: fixed;
+	top: calc(50vh + 100px);
+	left: 50vw;
+	transform: translate(-50%,-50%);
+	z-index: 9999;
+	width: 150px;
+	height: 80px;
+	background: #fff;
+	border-radius: 5px;
+	display: flex;
+	flex-direction: column;
+	align-items: center;
+	justify-content: center;
+}
 </style>

+ 324 - 285
src/components/pages/test/dataCom/cascader.vue

@@ -1,332 +1,371 @@
 <template>
-    <div class="cascader">
-        <div class="title" @click="showBox">{{ checkArray.length ? setCheckName(checkArray) : '点击选择教研室范围' }}</div>
-        <div class="box" v-if="show" v-loading="loading">
-            <div class="inputBox">
-                <input v-model="searchTerm" placeholder="输入教师名字搜索" />
-                <i class="search" @click="searchTeacher"></i>
-            </div>
-            <div class="options">
-                <div v-if="filteredOptions.length" class="ul">
-                    <div @click="selectOption(option)" v-for="(option, index) in filteredOptions" :key="index"
-                        class="li" :class="{ active: checkF === option.id }">
-                        <span>{{ option.name }}</span>
-                    </div>
-                </div>
-                <div v-if="children.length" class="ul">
-                    <div v-for="(option, index) in children" :key="index" class="li" @click="selectOption2(option)"
-                        :class="{ active: checkF2 === option.id }">
-                        <span>{{ option.name }}</span>
-                    </div>
-                </div>
-                <div v-else-if="checkF" class="ul">
-                    <div class="liNone">无子分类</div>
-                </div>
-                <div v-if="teacher.length" class="ul">
-                    <div class="li" @click="checkAll()"
-                    :class="{ active: panCheckAll === 1 }"><span>全部</span> </div>
-                    <div v-for="(teacher, index) in teacher" :key="index" class="li" @click="selectOption3(teacher)"
-                    :class="{ active: checkTeacher(teacher) === 2 }">
-                        <span>{{ teacher.name }}</span>
-                    </div>
-                </div>
-                <div v-else-if="checkF2" class="ul">
-                    <div class="liNone">暂无教师</div>
-                </div>
-            </div>
-            <div class="button">
-                <el-button size="small" @click="reset">重置</el-button>
-                <el-button type="primary" size="small" @click="confirm">确认</el-button>
-
-            </div>
+  <div class="cascader">
+    <div class="title" @click="showBox">
+      {{ checkArray.length ? setCheckName(checkArray) : "点击选择教研室范围" }}
+    </div>
+    <div class="box" v-if="show" v-loading="loading">
+      <div class="inputBox">
+        <input v-model="searchTerm" placeholder="输入教师名字搜索" />
+        <i class="search" @click="searchTeacher"></i>
+      </div>
+      <div class="options">
+        <div v-if="filteredOptions.length" class="ul">
+          <div
+            @click="selectOption(option)"
+            v-for="(option, index) in filteredOptions"
+            :key="index"
+            class="li"
+            :class="{ active: checkF === option.id }"
+          >
+            <span>{{ option.name }}</span>
+          </div>
+        </div>
+        <div v-if="children.length" class="ul">
+          <div
+            v-for="(option, index) in children"
+            :key="index"
+            class="li"
+            @click="selectOption2(option)"
+            :class="{ active: checkF2 === option.id }"
+          >
+            <span>{{ option.name }}</span>
+          </div>
+        </div>
+        <div v-else-if="checkF" class="ul">
+          <div class="liNone">无子分类</div>
+        </div>
+        <div v-if="teacher.length" class="ul">
+          <div
+            class="li"
+            @click="checkAll()"
+            :class="{ active: panCheckAll === 1 }"
+          >
+            <span>全部</span>
+          </div>
+          <div
+            v-for="(teacher, index) in teacher"
+            :key="index"
+            class="li"
+            @click="selectOption3(teacher)"
+            :class="{ active: checkTeacher(teacher) === 2 }"
+          >
+            <span>{{ teacher.name }}</span>
+          </div>
         </div>
+        <div v-else-if="checkF2" class="ul">
+          <div class="liNone">暂无教师</div>
+        </div>
+      </div>
+      <div class="button">
+        <el-button size="small" @click="reset">重置</el-button>
+        <el-button type="primary" size="small" @click="confirm">确认</el-button>
+      </div>
     </div>
+  </div>
 </template>
 
 <script>
 export default {
-    name: 'Cascader',
-    props: {
-        options: {
-            type: Array,
-            required: true
+  name: "Cascader",
+  props: {
+    options: {
+      type: Array,
+      required: true
+    }
+  },
+  data() {
+    return {
+      searchTerm: "",
+      filteredOptions: this.options,
+      checkF: "",
+      checkF2: "",
+      children: [],
+      teacher: [],
+      loading: false,
+      show: false,
+      checkArray: [],
+      checkArray2: []
+    };
+  },
+  computed: {
+    setCheckName() {
+      return function(arr) {
+        let content = "";
+        if (arr.length < 3) {
+          content = arr.map(item => item.name).join(" 、 ");
+        } else {
+          content =
+            arr
+              .slice(0, 2)
+              .map(item => item.name)
+              .join(" 、 ") +
+            "...共" +
+            arr.length +
+            "位老师";
         }
+        return content;
+      };
     },
-    data() {
-        return {
-            searchTerm: '',
-            filteredOptions: this.options,
-            checkF: "",
-            checkF2: "",
-            children: [],
-            teacher: [],
-            loading: false,
-            show: false,
-            checkArray: [],
-            checkArray2: []
-        };
+    checkTeacher() {
+      return function(teacher) {
+        let a = 1;
+        this.checkArray2.forEach(element => {
+          if (element.userid == teacher.userid) {
+            a = 2;
+          }
+        });
+        return a;
+      };
     },
-    computed: {
-        setCheckName() {
-            return function (arr) {
-                let content = ''
-                if(arr.length < 3){
-                    content = arr.map((item) => item.name).join(" 、 ");
-                }else {
-                    content = arr.slice(0, 2).map((item) => item.name).join(" 、 ") + "...共"+arr.length+"位老师";
-                }
-                return content;
-            };
-        },
-        checkTeacher() {
-            return function (teacher) {
-                let a = 1
-                this.checkArray2.forEach(element => {
-                   if (element.userid == teacher.userid) {
-                       a = 2
-                   }
-                   
-                });
-                return a
-            };
-        },
-        panCheckAll(){
-            if(this.teacher.length && this.checkArray2.length){
-                let userid = this.checkArray2.map((item) => item.userid)
-                let userid2 = this.teacher.map((item) => item.userid)
-                let userid3 = this.arrayToArray(userid, userid2)
-                if(userid2.length == userid3.length){
-                    return 1
-                }else{
-                    return 2
-                }
-            }else{
-                return 2
-            }
+    panCheckAll() {
+      if (this.teacher.length && this.checkArray2.length) {
+        let userid = this.checkArray2.map(item => item.userid);
+        let userid2 = this.teacher.map(item => item.userid);
+        let userid3 = this.arrayToArray(userid, userid2);
+        if (userid2.length == userid3.length) {
+          return 1;
+        } else {
+          return 2;
         }
-    },
-    methods: {
-        showBox(){
-            if(this.show){
-                this.reset()
-            }else{
-                this.checkArray2 = JSON.parse(JSON.stringify(this.checkArray));
-            }
-            this.show = !this.show
-        },
-        arrayToArray(arrayo, arrayt) {
-            let array1 = arrayo;
-            let array2 = arrayt;
-
-            let commonElements = [];
+      } else {
+        return 2;
+      }
+    }
+  },
+  methods: {
+    showBox() {
+      if (this.show) {
 
-            for (let i = 0; i < array1.length; i++) {
-                for (let j = 0; j < array2.length; j++) {
-                if (array1[i] === array2[j]) {
-                    commonElements.push(array1[i]);
-                }
-                }
-            }
-            return commonElements;
-        },
-        reset() {
-            this.checkArray2 = []
-            this.checkF = ''
-            this.checkF2 = ''
-            this.teacher = [],
-            this.children = []
-        },
-        confirm() {
-            this.checkArray = JSON.parse(JSON.stringify(this.checkArray2));
-            let array = this.checkArray.map(item => item.userid)
-            this.$emit('setTeacher', array)
-            this.show = false
-        },
-        selectOption(option) {
-            if(this.checkF == option.id){
-                return
-            }
-            console.log(option);
-            this.checkF2 = '';
-            this.teacher = []
-            this.checkF = option.id;
-            this.children = option.child;
-            if(option.child.length){
-                this.selectOption2(option.child[0])
-            }
-            this.$forceUpdate();
-        },
-        selectOption2(option) {
-            if(this.checkF2 == option.id){
-                return
-            }
-            this.checkF2 = option.id;
-            this.teacher = []
-            this.loading = true
-            let params = {
-                cid: option.id,
-                name: this.searchTerm,
-                userid: this.$route.query.userid
-            };
-            this.ajax
-                .get(this.$store.state.api + "getTypeTeacher", params)
-                .then((res) => {
-                    this.teacher = res.data[0];
-                    this.loading = false
+        this.reset();
+      } else {
+				
+        this.checkArray2 = JSON.parse(JSON.stringify(this.checkArray));
+				if (this.filteredOptions.length && this.checkF=='') {
+					this.selectOption(this.filteredOptions[0]);
+					if(this.filteredOptions[0].child.length){
+						this.selectOption2(this.filteredOptions[0].child[0]);
+					}
+        }
+        
+      }
+      this.show = !this.show;
+    },
+    arrayToArray(arrayo, arrayt) {
+      let array1 = arrayo;
+      let array2 = arrayt;
 
-                })
-                .catch((err) => {
-                    this.loading = false;
-                    console.error(err);
-                });
-        },
-        searchTeacher() {
-            if(!this.checkF2){
-                this.$message.error('请先选择子分类');
-            }
-            this.teacher = []
-            this.loading = true
-            let params = {
-                cid: this.checkF2,
-                name: this.searchTerm,
-                userid: this.$route.query.userid
-            };
-            this.ajax
-                .get(this.$store.state.api + "getTypeTeacher", params)
-                .then((res) => {
-                    this.teacher = res.data[0];
-                    this.loading = false
+      let commonElements = [];
 
-                })
-                .catch((err) => {
-                    this.loading = false;
-                    console.error(err);
-                });
-        },
-        selectOption3(teacher){
-            if(this.checkTeacher(teacher) == 1){
-                this.checkArray2.push(teacher)
-            }else {
-                this.checkArray2 = this.checkArray2.filter(item => item.userid != teacher.userid)
-            }
-        },
-        checkAll(){
-            let userid = this.checkArray2.map((item) => item.userid)
-            let userid2 = this.teacher.map((item) => item.userid)
-            if(this.panCheckAll == 1){
-                this.checkArray2 = this.checkArray2.filter(item => !userid2.includes(item.userid))
-            }else{
-                let userAarray = this.arrayToArray(userid, userid2)
-                let teacher = this.teacher.filter(item => !userAarray.includes(item.userid))
-                teacher.forEach(item => {
-                    this.checkArray2.push(item)
-                })
-            }
-        },
+      for (let i = 0; i < array1.length; i++) {
+        for (let j = 0; j < array2.length; j++) {
+          if (array1[i] === array2[j]) {
+            commonElements.push(array1[i]);
+          }
+        }
+      }
+      return commonElements;
+    },
+    reset() {
+      this.checkArray2 = [];
+      this.checkF = "";
+      this.checkF2 = "";
+      (this.teacher = []), (this.children = []);
+    },
+    confirm() {
+      this.checkArray = JSON.parse(JSON.stringify(this.checkArray2));
+      let array = this.checkArray.map(item => item.userid);
+      this.$emit("setTeacher", array);
+      this.show = false;
+    },
+    selectOption(option) {
+      if (this.checkF == option.id) {
+        return;
+      }
+      console.log(option);
+      this.checkF2 = "";
+      this.teacher = [];
+      this.checkF = option.id;
+      this.children = option.child;
+      if (option.child.length) {
+        this.selectOption2(option.child[0]);
+      }
+      this.$forceUpdate();
+    },
+    selectOption2(option) {
+      if (this.checkF2 == option.id) {
+        return;
+      }
+      this.checkF2 = option.id;
+      this.teacher = [];
+      this.loading = true;
+      let params = {
+        cid: option.id,
+        name: this.searchTerm,
+        userid: this.$route.query.userid
+      };
+      this.ajax
+        .get(this.$store.state.api + "getTypeTeacher", params)
+        .then(res => {
+          this.teacher = res.data[0];
+          this.loading = false;
+        })
+        .catch(err => {
+          this.loading = false;
+          console.error(err);
+        });
+    },
+    searchTeacher() {
+      if (!this.checkF2) {
+        this.$message.error("请先选择子分类");
+      }
+      this.teacher = [];
+      this.loading = true;
+      let params = {
+        cid: this.checkF2,
+        name: this.searchTerm,
+        userid: this.$route.query.userid
+      };
+      this.ajax
+        .get(this.$store.state.api + "getTypeTeacher", params)
+        .then(res => {
+          this.teacher = res.data[0];
+          this.loading = false;
+        })
+        .catch(err => {
+          this.loading = false;
+          console.error(err);
+        });
+    },
+    selectOption3(teacher) {
+      if (this.checkTeacher(teacher) == 1) {
+        this.checkArray2.push(teacher);
+      } else {
+        this.checkArray2 = this.checkArray2.filter(
+          item => item.userid != teacher.userid
+        );
+      }
+    },
+    checkAll() {
+      let userid = this.checkArray2.map(item => item.userid);
+      let userid2 = this.teacher.map(item => item.userid);
+      if (this.panCheckAll == 1) {
+        this.checkArray2 = this.checkArray2.filter(
+          item => !userid2.includes(item.userid)
+        );
+      } else {
+        let userAarray = this.arrayToArray(userid, userid2);
+        let teacher = this.teacher.filter(
+          item => !userAarray.includes(item.userid)
+        );
+        teacher.forEach(item => {
+          this.checkArray2.push(item);
+        });
+      }
     }
+  }
 };
 </script>
 
 <style scoped>
 .cascader {
-    position: relative;
+  position: relative;
 }
 
-.cascader>.title {
-    min-width: 300px;
-    background: #fff;
-    border-radius: 5px;
-    height: 30px;
-    display: flex;
-    align-items: center;
-    padding: 0 10px;
-    box-sizing: border-box;
-    cursor: pointer;
-    color: #00000066;
+.cascader > .title {
+  min-width: 300px;
+  background: #fff;
+  border-radius: 5px;
+  height: 30px;
+  display: flex;
+  align-items: center;
+  padding: 0 10px;
+  box-sizing: border-box;
+  cursor: pointer;
+  color: #00000066;
 }
 
 .box {
-    position: absolute;
-    z-index: 999;
-    border-radius: 5px;
-    overflow: hidden;
-    background: #fff;
-    box-shadow: 0 0 3px 2px #0000002b;
+  position: absolute;
+  z-index: 999;
+  border-radius: 5px;
+  overflow: hidden;
+  background: #fff;
+  box-shadow: 0 0 3px 2px #0000002b;
 }
 
 .inputBox {
-    padding: 5px 8px;
-    border-bottom: 1px solid #c4c4c4;
-    display: flex;
-    box-sizing: border-box;
-    width: 100%;
-    align-items: center;
-    position: relative
+  padding: 5px 8px;
+  border-bottom: 1px solid #c4c4c4;
+  display: flex;
+  box-sizing: border-box;
+  width: 100%;
+  align-items: center;
+  position: relative;
 }
 
-.inputBox>input {
-    width: 100%;
-    background: #fff;
-    border-radius: 5px;
-    height: 30px;
-    padding: 0 10px;
-    border: 1px solid #c4c4c4;
-    outline: none;
+.inputBox > input {
+  width: 100%;
+  background: #fff;
+  border-radius: 5px;
+  height: 30px;
+  padding: 0 10px;
+  border: 1px solid #c4c4c4;
+  outline: none;
 }
 
-.inputBox>.search {
-    position: absolute;
-    right: 20px;
-    top: 50%;
-    transform: translateY(-50%);
-    width: 13px;
-    height: 13px;
-    background: url("../../../../assets/icon/test/test_search.png") no-repeat;
-    background-size: 100% 100%;
-    cursor: pointer;
+.inputBox > .search {
+  position: absolute;
+  right: 20px;
+  top: 50%;
+  transform: translateY(-50%);
+  width: 13px;
+  height: 13px;
+  background: url("../../../../assets/icon/test/test_search.png") no-repeat;
+  background-size: 100% 100%;
+  cursor: pointer;
 }
 
 .options {
-    height: 200px;
-    display: flex;
+  height: 200px;
+  display: flex;
 }
 
-.options>.ul {
-    height: 100%;
-    overflow-y: auto;
-    list-style: none;
-    padding: 0;
-    width: 135px;
-    border-right: 1px solid #c4c4c4;
-    /* width: 100%; */
-    text-align: center;
+.options > .ul {
+  height: 100%;
+  overflow-y: auto;
+  list-style: none;
+  padding: 0;
+  width: 135px;
+  border-right: 1px solid #c4c4c4;
+  /* width: 100%; */
+  text-align: center;
 }
 
-.options>.ul:nth-child(3) {
-    border-right: none;
+.options > .ul:nth-child(3) {
+  border-right: none;
 }
 
-.options>.ul>.li.active,
-.options>.ul>.li:hover {
-    color: #3681FC;
+.options > .ul > .li.active,
+.options > .ul > .li:hover {
+  color: #3681fc;
 }
 
-.options>.ul>.li,
-.options>.ul>.liNone {
-    cursor: pointer;
-    padding: 10px 8px;
-    max-width: 100%;
-    overflow: hidden;
-    text-overflow: ellipsis;
-    white-space: nowrap;
+.options > .ul > .li,
+.options > .ul > .liNone {
+  cursor: pointer;
+  padding: 10px 8px;
+  max-width: 100%;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
 }
 
 .button {
-    padding: 5px 8px;
-    border-top: 1px solid #c4c4c4;
-    display: flex;
-    justify-content: flex-end;
-    box-sizing: border-box;
-    width: 100%;
+  padding: 5px 8px;
+  border-top: 1px solid #c4c4c4;
+  display: flex;
+  justify-content: flex-end;
+  box-sizing: border-box;
+  width: 100%;
 }
-</style>
+</style>

+ 268 - 241
src/components/pages/test/dataCom/radarZong.vue

@@ -1,261 +1,288 @@
 <template>
-    <div class="data_body">
-        <div style="width: 100%; height: 100%" v-if="this.ooption.xdata.length">
-            <div id="charts_canvas" class="echart" style="width: 100%; height: 100%; "></div>
-        </div>
-        <div style="width: 100%; height: 100%;display: flex;align-items: center;justify-content: center;"
-            v-show="!this.ooption.xdata.length">暂无数据</div>
+  <div class="data_body">
+    <div style="width: 100%; height: 100%" v-if="this.ooption.xdata.length || this.ooption.xdata2.length">
+      <div
+        id="charts_canvas"
+        class="echart"
+        style="width: 100%; height: 100%; "
+      ></div>
     </div>
+    <div
+      style="width: 100%; height: 100%;display: flex;align-items: center;justify-content: center;"
+      v-show="!this.ooption.xdata.length && !this.ooption.xdata2.length"
+    >
+      暂无数据
+    </div>
+  </div>
 </template>
 
 <script>
 export default {
-    props: {
-        evCourseArray: {
-            type: Object,
-            default: function () {
-                return {}
-            }
-        },
-        evCourseArray2: {
-            type: Object,
-            default: function () {
-                return {}
-            }
-        },
+  props: {
+    evCourseArray: {
+      type: Object,
+      default: function() {
+        return {};
+      }
     },
-    data() {
-        return {
-            chartObj: null,
-            ooption: {
-                xdata: [],
-                xdata2: [],
-                sdata: [],
+    evCourseArray2: {
+      type: Object,
+      default: function() {
+        return {};
+      }
+    }
+  },
+  data() {
+    return {
+      chartObj: null,
+      ooption: {
+        xdata: [],
+        xdata2: [],
+        sdata: []
+      },
+      option: {
+        legend: {},
+        tooltip: {},
+        radar: {
+          axisName: {
+            color: "#000"
+          },
+          // shape: 'circle',
+          indicator: [
+            // { name: '目标一', max: 5 },
+            // { name: '目标二', max: 5 },
+            // { name: '目标三', max: 5 },
+            // { name: '目标四', max: 5 },
+            // { name: '目标五', max: 5 }
+          ]
+        },
+        series: [
+          {
+            name: "教师考核",
+            type: "radar",
+            data: [
+              // {
+              //     areaStyle: {
+              //         opacity: 0.2,
+              //         color: '#0061FF'
+              //     },
+              //     itemStyle: {
+              //         color: '#0061FF',
+              //         lineStyle: {
+              //         color: '#0061FF'
+              //         }
+              //     },
+              //     value: [],
+              //     name: ''
+              // }
+            ]
+          }
+        ]
+      }
+    };
+  },
+  methods: {
+    setChart(option) {
+      // 雷达图显示的标签
+      let newPromise = new Promise(resolve => {
+        resolve();
+      });
+      //然后异步执行echarts的初始化函数
+      newPromise.then(() => {
+        const chartObj = this.$echarts.init(
+          //劳动课程
+          this.$el.querySelector("#charts_canvas")
+        );
+        this.option.radar.indicator = option.sdata;
+        if (option.xdata.length > 0) {
+				
+          this.option.series[0].data[0] = {
+            // areaStyle: {
+            //     opacity: 0.2,
+            //     color: '#0061FF'
+            // },
+            itemStyle: {
+              color: "#0061FF",
+              lineStyle: {
+                color: "#0061FF"
+              }
             },
-            option: {
-                legend: {},
-                tooltip: {},
-                radar: {
-                    axisName: {
-                        color: "#000"
-                    },
-                    // shape: 'circle',
-                    indicator: [
-                        // { name: '目标一', max: 5 },
-                        // { name: '目标二', max: 5 },
-                        // { name: '目标三', max: 5 },
-                        // { name: '目标四', max: 5 },
-                        // { name: '目标五', max: 5 }
-                    ]
-                },
-                series: [
-                    {
-                        name: '教师考核',
-                        type: 'radar',
-                        data: [
-                            // {
-                            //     areaStyle: {
-                            //         opacity: 0.2,
-                            //         color: '#0061FF'
-                            //     },
-                            //     itemStyle: {
-                            //         color: '#0061FF',
-                            //         lineStyle: {
-                            //         color: '#0061FF'
-                            //         }
-                            //     },
-                            //     value: [],
-                            //     name: ''
-                            // }
-                        ]
-                    }
-                ]
+            value: option.xdata,
+            name: "全体教师平均得分率"
+          };
+        }else{
+					// this.option.series[0].data.splice(0,1)
+					// this.option.series[0].data[0] = {};
+				}
+        if (option.xdata2.length > 0) {
+          this.option.series[0].data[1] = {
+            // areaStyle: {
+            //     opacity: 0.2,
+            //     color: '#68bbc4'
+            // },
+            itemStyle: {
+              // color: "#68bbc4",
+              // lineStyle: {
+              //   color: "#68bbc4"
+              // }
+							color: "#0061FF",
+              lineStyle: {
+                color: "#0061FF"
+              }
             },
-        };
-    },
-    methods: {
-        setChart(option) {
-            // 雷达图显示的标签
-            let newPromise = new Promise((resolve) => {
-                resolve();
-            });
-            //然后异步执行echarts的初始化函数
-            newPromise.then(() => {
-                const chartObj = this.$echarts.init(
-                    //劳动课程
-                    this.$el.querySelector("#charts_canvas")
-                );
-                this.option.radar.indicator = option.sdata;
-                if (option.xdata.length > 0) {
-                    this.option.series[0].data[0] = {
-                        // areaStyle: {
-                        //     opacity: 0.2,
-                        //     color: '#0061FF'
-                        // },
-                        itemStyle: {
-                            color: '#0061FF',
-                            lineStyle: {
-                                color: '#0061FF'
-                            }
-                        },
-                        value: option.xdata,
-                        name: '全体教师平均得分率'
-                    }
-                }
-                if (option.xdata2.length > 0) {
-                    this.option.series[0].data[1] = {
-                        // areaStyle: {
-                        //     opacity: 0.2,
-                        //     color: '#68bbc4'
-                        // },
-                        itemStyle: {
-                            color: '#68bbc4',
-                            lineStyle: {
-                                color: '#68bbc4'
-                            }
-                        },
-                        value: option.xdata2,
-                        name: '平均得分率'
-                    }
-                }else {
-                    this.option.series[0].data[1] = []
-                }
-                // this.option.series[0].data[0].value = option.xdata;
-                // 初始化雷达图
-                this.chartObj = chartObj;
-                this.chartObj.setOption(this.option);
-            });
-        },
-        setArray(array, type) {
-            if(Object.keys(array).length){
-                this.ooption.sdata =  Object.keys(array).map((item) => {
-                    return {
-                        name: item,
-                        max: 100,
-                    };
-                });
-            }else if(this.evCourseArray.length){
-                this.ooption.sdata =  Object.keys(this.evCourseArray).map((item) => {
-                    return {
-                        name: item,
-                        max: 100,
-                    };
-                });
-                this.ooption.xdata = Object.keys(this.evCourseArray).map((item) => {
-                    return array[item].cogScore;
-                })
-                this.ooption.xdata2 = []
-            }
-            if (type == 1) {
-                this.ooption.xdata = Object.keys(array).map((item) => {
-                    return array[item].cogScore;
-                })
-                this.ooption.xdata2 = []
-            }
-            if (type == 2) {
-
-                this.ooption.xdata2 = Object.keys(array).length ? Object.keys(array).map((item) => {
-                    return array[item].cogScore;
-                }) : []
-            }
-            if (!this.chartObj) {
-                this.setChart(this.ooption);
-            } else {
-                this.option.radar.indicator = this.ooption.sdata;
-                if (this.ooption.xdata.length > 0) {
-                    this.option.series[0].data[0] = {
-                        // areaStyle: {
-                        //     opacity: 0.2,
-                        //     color: '#0061FF'
-                        // },
-                        itemStyle: {
-                            color: '#0061FF',
-                            lineStyle: {
-                                color: '#0061FF'
-                            }
-                        },
-                        value: this.ooption.xdata,
-                        name: '全体教师平均得分率'
-                    }
-                }
-                if (this.ooption.xdata2.length > 0) {
-                    this.option.series[0].data[1] = {
-                        // areaStyle: {
-                        //     opacity: 0.2,
-                        //     color: '#68bbc4'
-                        // },
-                        itemStyle: {
-                            color: '#68bbc4',
-                            lineStyle: {
-                                color: '#68bbc4'
-                            }
-                        },
-                        value: this.ooption.xdata2,
-                        name: '平均得分率'
-                    }
-                }else {
-                    this.option.series[0].data[1] = []
-                }
-                this.chartObj.setOption(this.option);
-            }
-            setTimeout(() => {
-                if (this.chartObj) {
-                    this.chartObj.resize();
-                }
-            }, 200);
-            this.$forceUpdate();
-        },
+            value: option.xdata2,
+            name: "平均得分率"
+          };
+        } else {
+          this.option.series[0].data[1] = {};
+        }
+        // this.option.series[0].data[0].value = option.xdata;
+        // 初始化雷达图
+				this.option.series[0].data = this.option.series[0].data.filter(i=>Object.keys(i).length>0);
+        this.chartObj = chartObj;
+        this.chartObj.setOption(this.option);
+      });
     },
-    watch: {
-        evCourseArray: {
-            immediate: true,
-            deep: true,
-            handler(newValue, oldValue) {
-                this.ooption.xdata = [];
-                this.setArray(newValue, 1)
-                this.$forceUpdate();
+    setArray(array, type) {
+      if (Object.keys(array).length) {
+        this.ooption.sdata = Object.keys(array).map(item => {
+          return {
+            name: item,
+            max: 100
+          };
+        });
+      } else if (this.evCourseArray.length) {
+        this.ooption.sdata = Object.keys(this.evCourseArray).map(item => {
+          return {
+            name: item,
+            max: 100
+          };
+        });
+        this.ooption.xdata = Object.keys(this.evCourseArray).map(item => {
+          return array[item].cogScore;
+        });
+        this.ooption.xdata2 = [];
+      }
+      if (type == 1) {
+        this.ooption.xdata = Object.keys(array).map(item => {
+          return array[item].cogScore;
+        });
+        this.ooption.xdata2 = [];
+      }
+      if (type == 2) {
+        this.ooption.xdata2 = Object.keys(array).length
+          ? Object.keys(array).map(item => {
+              return array[item].cogScore;
+            })
+          : [];
+					this.ooption.xdata = []
+      }
+      if (!this.chartObj) {
+        this.setChart(this.ooption);
+      } else {
+        this.option.radar.indicator = this.ooption.sdata;
+        if (this.ooption.xdata.length > 0) {
+          this.option.series[0].data[0] = {
+            // areaStyle: {
+            //     opacity: 0.2,
+            //     color: '#0061FF'
+            // },
+            itemStyle: {
+              color: "#0061FF",
+              lineStyle: {
+                color: "#0061FF"
+              }
             },
-        },
-        evCourseArray2: {
-            immediate: true,
-            deep: true,
-            handler(newValue, oldValue) {
-                this.ooption.xdata2 = [];
-                this.setArray(newValue, 2)
-                console.log(2222222222222222);
-                this.$forceUpdate();
+            value: this.ooption.xdata,
+            name: "全体教师平均得分率"
+          };
+        }else{
+					this.option.series[0].data[0] = {};
+				}
+        if (this.ooption.xdata2.length > 0) {
+          this.option.series[0].data[1] = {
+            // areaStyle: {
+            //     opacity: 0.2,
+            //     color: '#68bbc4'
+            // },
+            itemStyle: {
+              // color: "#68bbc4",
+              // lineStyle: {
+              //   color: "#68bbc4"
+              // }
+							color: "#0061FF",
+              lineStyle: {
+                color: "#0061FF"
+              }
             },
-        },
-    },
-    mounted() {
-        this.ooption = {
-            xdata: [],
-            xdata2: [],
-            sdata: [],
+            value: this.ooption.xdata2,
+            name: "平均得分率"
+          };
+        } else {
+          this.option.series[0].data[1] = {};
         }
-        this.setArray(this.evCourseArray, 1)
-        // this.setChart(this.ooption);
-        var _this = this;
-        window.addEventListener("resize", () => {
-            if (_this.chartObj) {
-                _this.chartObj.resize();
-            }
-        });
+				this.option.series[0].data = this.option.series[0].data.filter(i=>Object.keys(i).length>0);
+        this.chartObj.setOption(this.option);
+      }
+      setTimeout(() => {
+        if (this.chartObj) {
+          this.chartObj.resize();
+        }
+      }, 200);
+      this.$forceUpdate();
+    }
+  },
+  watch: {
+    evCourseArray: {
+      immediate: true,
+      deep: true,
+      handler(newValue, oldValue) {
+        this.ooption.xdata = [];
+        this.setArray(newValue, 1);
+        this.$forceUpdate();
+      }
     },
+    evCourseArray2: {
+      immediate: true,
+      deep: true,
+      handler(newValue, oldValue) {
+        this.ooption.xdata2 = [];
+				if(Object.keys(newValue).length){
+					this.setArray(newValue, 2);
+				}
+        this.$forceUpdate();
+      }
+    }
+  },
+  mounted() {
+    this.ooption = {
+      xdata: [],
+      xdata2: [],
+      sdata: []
+    };
+    this.setArray(this.evCourseArray, 1);
+    // this.setChart(this.ooption);
+    var _this = this;
+    window.addEventListener("resize", () => {
+      if (_this.chartObj) {
+        _this.chartObj.resize();
+      }
+    });
+  }
 };
 </script>
 
 <style scoped>
 .data_body {
-    height: 100%;
-    /* display: flex; */
-    position: relative;
-    border-radius: 5px;
-    /* border: 1px solid #eee; */
-    margin: 0 auto;
-    box-sizing: border-box;
-    padding: 0;
-    width: 95%;
-    background: #fff;
+  height: 100%;
+  /* display: flex; */
+  position: relative;
+  border-radius: 5px;
+  /* border: 1px solid #eee; */
+  margin: 0 auto;
+  box-sizing: border-box;
+  padding: 0;
+  width: 95%;
+  background: #fff;
 }
-</style>
+</style>