SanHQin 2 miesięcy temu
rodzic
commit
41ad3a855b

+ 13 - 6
src/components/pages/classroomObservation/components/analysisItem.vue

@@ -574,7 +574,7 @@ export default {
             res.forEach((item, index) => {
               if (index == 0) return; //去掉表头
               let _valueItem = item[2] ? item[2] : item[1];
-              let _value = _valueItem.match(/(\d+)/g);
+              let _value = _valueItem.match(/(\d+)/);
               _value = _value ? parseInt(_value[0]) : 0;
               _result.push({
                 value: _value,
@@ -644,7 +644,10 @@ export default {
             res.forEach((item, index) => {
               if (index == 0) return; //去掉表头
               radarData.push({ name: item[0], max: 5 });
-              seriesData.value.push(parseInt(item[1] ? item[1] : 0));
+							let _valueItem = item[1] ? item[1] :"0";
+              let _value = _valueItem.match(/(\d+)/);
+              _value = _value ? parseInt(_value[0]) : 0;
+              seriesData.value.push(_value);
             });
 
             let _option = {
@@ -698,10 +701,11 @@ export default {
             stepList = this.calculateTopValues(res.length - 1);
             res.forEach((item, index) => {
               if (index == 0) return;
+							let _valueItem = item[1] ? item[1] : "0";
+              let _value = _valueItem.match(/(\d+)/);
+              _value = _value ? parseInt(_value[0]) : 0;
               // 求百分比
-              let _value = Math.floor(
-                (parseInt(item[1] ? item[1] : 0) / 5).toFixed(2) * 100
-              );
+              _value = Math.floor((_value / 5).toFixed(2) * 100);
               _data.push({
                 value: _value,
                 name: item[0],
@@ -845,7 +849,10 @@ export default {
 
           // 匹配每个单元格 (th 或 td)
           while ((cellMatch = cellRegex.exec(rowContent)) !== null) {
-            rowData.push(cellMatch[2].trim()); // 将每个单元格的内容添加到当前行的数组中
+						let _text = cellMatch[2].trim();
+						_text = _text.replace(/&[a-zA-Z]+;/g, '');
+						_text = _text.replace(/<\/?[^>]+(>|$)/g, '')
+            rowData.push(_text); // 将每个单元格的内容添加到当前行的数组中
           }
 
           // 如果该行有数据,推送到 _contentTableList 中

+ 6 - 4
src/components/pages/classroomObservation/components/analysisSpecialItem.vue

@@ -320,7 +320,7 @@ export default {
       this.openItem = newValue;
     },
     editBtn(flag = false) {
-      if (!flag) return console.log("不执行获取");
+      // if (!flag) return console.log("不执行获取");
       this.loadNum = 1;
       this.getData(1);
 
@@ -466,6 +466,7 @@ export default {
     getTimeAllocationData(_dataList, type = 0) {
       this.loading = true;
       this.openItem = false;
+			console.log(_dataList)
       let _data = _dataList.reduce(
         (pre, cur) => {
           if (cur.role == "学生") {
@@ -480,13 +481,12 @@ export default {
           { value: 0, name: "学生" }
         ]
       );
-
-			let _dataPercentage = _data
+				console.log(_data)
+			let _dataPercentage = JSON.parse(JSON.stringify(_data))
 			_data.forEach((i, index) => {
 				_dataPercentage[index].percentage = (i.value / _data.reduce((pre, cur) => pre + cur.value, 0) * 100).toFixed(2)+'%'
 			})
 
-			_dataPercentage.forEach(i=>delete i.value)
       if (type == 1) {
         let _msg = `这是某一节课的师生时间占比,请你分析,写出结论,并给出指导建议。请使用3句完整的话,分析并给出建议。 请注意,当老师或学生的时间占比在【40~59%】之间的时候,也认为师生占比约为1:1,各占50%,师生时间占比比较均衡。
 师生时间占比数据:
@@ -544,6 +544,8 @@ export default {
         ]
       };
 
+			console.log(_option)
+
       let _copyData = JSON.parse(JSON.stringify(this.data));
       _copyData.jsonData.eChartData = _option;
       _copyData.json_data = JSON.stringify(_copyData.jsonData);

+ 18 - 9
src/components/pages/classroomObservation/components/messageArea.vue

@@ -453,7 +453,7 @@ export default {
     useTemplate(json) {
       let _result = [];
       json.forEach(i => {
-				if(i.isOtherData)return _result.push(i);
+        if (i.isOtherData) return _result.push(i);
         let _obj = {
           jsonData: i.jsonData,
           type: i.Type,
@@ -792,7 +792,7 @@ export default {
             resolve();
           });
         } else {
-          this.getDefaultData()
+          this.getDefaultData();
         }
       });
       // this.getValueAddedData();
@@ -811,10 +811,19 @@ export default {
             let _data = res.data[0][0];
             if (_data) {
               _data.tips = JSON.parse(_data.tips);
+              _data.tips.forEach(i => {
+                // if (i.jsonData.eChartData) {
+                //   delete i.jsonData.eChartData;
+                // }
+                // if (i.jsonData.RT && i.jsonData.CH) {
+                //   delete i.jsonData.RT;
+                //   delete i.jsonData.CH;
+                // }
+              });
               this.dataList = _data.tips;
             }
             this.loading = false;
-						resolve();
+            resolve();
           });
       });
     },
@@ -1107,12 +1116,12 @@ export default {
           this.$message.error("获取模块分析列表失败");
         });
     },
-    changeAnalysisName(data,type = 0) {
-			if(type==0){
-				this.dialogTagList.find(i => i.value == data.type).name = data.name;
-			}else if(type==1){
-				this.dialogTagList = data;
-			}
+    changeAnalysisName(data, type = 0) {
+      if (type == 0) {
+        this.dialogTagList.find(i => i.value == data.type).name = data.name;
+      } else if (type == 1) {
+        this.dialogTagList = data;
+      }
       this.bmData.jsonData["dialogTagList"] = this.dialogTagList;
       this.saveData(this.bmData).then(res => {
         // this.$message.success("修改名称成功");

+ 281 - 244
src/components/pages/classroomObservation/components/saveTemplateDialog.vue

@@ -1,294 +1,331 @@
 <template>
-	<div>
-		<el-dialog
-			:center="true"
-			:visible.sync="dialogVisible"
-			:close-on-click-modal="false"
-			width="500px"
-			class="bindingFormDialog"
-		>
-			<div class="a-d-top">
-				<div class="a-d-topTit">
-					<div>另存为模板</div>
-				</div>
-				<div class="a-d-t-right">
-					<span @click.stop="close()">×</span>
-				</div>
-			</div>
-			<div class="bfd_box" v-loading="loading" label-position="top">
-				<el-form :model="form" :rules="rules" ref="ruleForm">
-					<div style="display: flex;width: 100%;justify-content: space-between;">
-						<el-form-item label="模板名称" prop="name">
-  				  <el-input v-model="form.name" placeholder="请输入模板名称" style="width: 300px;"></el-input>
-  				</el-form-item>
-					<el-form-item label="所属学科" prop="subject">
-						<el-select v-model="form.subject" placeholder="请选择所属学科" style="width: 300px;">
-  					  <el-option
-  					    v-for="item in subjectList"
-  					    :key="item.value"
-  					    :label="item.label"
-  					    :value="item.value">
-  					  </el-option>
-  					</el-select>
-  				  <!-- <el-input v-model="form.subject" placeholder="请输入所属学科" style="width: 300px;"></el-input> -->
-  				</el-form-item>
-					</div>
-					<el-form-item label="模板简介(40字以内)" prop="brief">
-						<el-input type="textarea" v-model="form.brief" style="width: 100%;" :rows="3" :maxlength="40" resize="none" placeholder="请输入模板简介"></el-input>
-					</el-form-item>
-					<el-form-item label="权限管理" style="display: flex;flex-direction: column;align-items: flex-start;">
-						<div>公开到社区:<el-switch v-model="form.permissions"></el-switch></div>
-					</el-form-item>
-				</el-form>
-			</div>
-			<div class="bfd_bottom" v-loading="loading">
-				<el-button @click="close()">取消</el-button>
-				<el-button type="primary" @click="submitBtn('ruleForm')">保存</el-button>
-			</div>
-		</el-dialog>
-	</div>
+  <div>
+    <el-dialog
+      :center="true"
+      :visible.sync="dialogVisible"
+      :close-on-click-modal="false"
+      width="500px"
+      class="bindingFormDialog"
+    >
+      <div class="a-d-top">
+        <div class="a-d-topTit">
+          <div>另存为模板</div>
+        </div>
+        <div class="a-d-t-right">
+          <span @click.stop="close()">×</span>
+        </div>
+      </div>
+      <div class="bfd_box" v-loading="loading" label-position="top">
+        <el-form :model="form" :rules="rules" ref="ruleForm">
+          <div
+            style="display: flex;width: 100%;justify-content: space-between;"
+          >
+            <el-form-item label="模板名称" prop="name">
+              <el-input
+                v-model="form.name"
+                placeholder="请输入模板名称"
+                style="width: 300px;"
+              ></el-input>
+            </el-form-item>
+            <el-form-item label="所属学科" prop="subject">
+              <el-select
+                v-model="form.subject"
+                placeholder="请选择所属学科"
+                style="width: 300px;"
+              >
+                <el-option
+                  v-for="item in subjectList"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                >
+                </el-option>
+              </el-select>
+              <!-- <el-input v-model="form.subject" placeholder="请输入所属学科" style="width: 300px;"></el-input> -->
+            </el-form-item>
+          </div>
+          <el-form-item label="模板简介(40字以内)" prop="brief">
+            <el-input
+              type="textarea"
+              v-model="form.brief"
+              style="width: 100%;"
+              :rows="3"
+              :maxlength="40"
+              resize="none"
+              placeholder="请输入模板简介"
+            ></el-input>
+          </el-form-item>
+          <el-form-item
+            label="权限管理"
+            style="display: flex;flex-direction: column;align-items: flex-start;"
+          >
+            <div>
+              公开到社区:<el-switch v-model="form.permissions"></el-switch>
+            </div>
+          </el-form-item>
+        </el-form>
+      </div>
+      <div class="bfd_bottom" v-loading="loading">
+        <el-button @click="close()">取消</el-button>
+        <el-button type="primary" @click="submitBtn('ruleForm')"
+          >保存</el-button
+        >
+      </div>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
 var OpenCC = require("opencc-js");
 let converter = OpenCC.Converter({
-		from:'hk',
-		to:'cn'
-})
+  from: "hk",
+  to: "cn"
+});
 export default {
-	emits: ["success"],
-	props: {
-		dataList:{
-			type:Array,
-			default:()=>{return []}
-		},
-		bmData:{
-			type:Object,
-			default:()=>{return {}}
-		},
-	},
-	data() {
-		return {
-			loading: false,
-			dialogVisible: false,
-			userId: this.$route.query["userid"],
-			oid: this.$route.query["oid"],
-			org: this.$route.query["org"],
-			subjectList:[
-				{value:'1',label:'语文'},
-				{value:'2',label:'数学'},
-				{value:'3',label:'英语'},
-				{value:'4',label:'科学'},
-				{value:'5',label:'物理'},
-				{value:'6',label:'化学'},
-				{value:'7',label:'生物'},
-				{value:'8',label:'历史'},
-				{value:'9',label:'地理'},
-				{value:'10',label:'政治'},
-				
-			],
-			form:{
-				name:"",
-				subject:"",
-				brief:"",
-				permissions:false,
-			},
-			rules:{
-				name:[{required:true,message:"请输入课程名称",trigger:"blur"}],
-				subject:[{required:true,message:"请输入所属学科",trigger:"blur"}]
-			},
+  emits: ["success"],
+  props: {
+    dataList: {
+      type: Array,
+      default: () => {
+        return [];
+      }
+    },
+    bmData: {
+      type: Object,
+      default: () => {
+        return {};
+      }
+    }
+  },
+  data() {
+    return {
+      loading: false,
+      dialogVisible: false,
+      userId: this.$route.query["userid"],
+      oid: this.$route.query["oid"],
+      org: this.$route.query["org"],
+      subjectList: [
+        { value: "1", label: "语文" },
+        { value: "2", label: "数学" },
+        { value: "3", label: "英语" },
+        { value: "4", label: "科学" },
+        { value: "5", label: "物理" },
+        { value: "6", label: "化学" },
+        { value: "7", label: "生物" },
+        { value: "8", label: "历史" },
+        { value: "9", label: "地理" },
+        { value: "10", label: "政治" }
+      ],
+      form: {
+        name: "",
+        subject: "",
+        brief: "",
+        permissions: false
+      },
+      rules: {
+        name: [{ required: true, message: "请输入课程名称", trigger: "blur" }],
+        subject: [
+          { required: true, message: "请输入所属学科", trigger: "blur" }
+        ]
+      }
+    };
+  },
+  methods: {
+    open(_json) {
+      this.form = {
+        name: "",
+        subject: "",
+        brief: "",
+        permissions: false
+      };
+      this.loading = false;
+      this.dialogVisible = true;
+    },
+    close() {
+      this.dialogVisible = false;
+      this.form = {
+        name: "",
+        subject: "",
+        brief: "",
+        permissions: false
+      };
+    },
+    submitBtn(ref) {
+      this.$refs[ref].validate(valid => {
+        if (valid) {
+          this.loading = true;
+          let _data = JSON.parse(JSON.stringify(this.dataList));
+          let _result = [];
 
-		};
-	},
-	methods: {
-		open(_json) {
-			this.form = {
-				name:"",
-				subject:"",
-				brief:"",
-				permissions:false,
-			}
-			this.loading = false;
-			this.dialogVisible = true;
-		},
-		close() {
-			this.dialogVisible = false;
-			this.form = {
-				name:"",
-				subject:"",
-				brief:"",
-				permissions:false,
-			};
-		},
-		submitBtn(ref) {
-			this.$refs[ref].validate((valid) => {
-          if (valid) {
-						this.loading = true;
-						let _data = JSON.parse(JSON.stringify(this.dataList));
-						let _result = [];
-						
-						_data.forEach(i=>{
-							if(converter(i.jsonData.name)==converter('词频词汇分析')){
-								return
-							}else{
-								i.jsonData.content = "";
-								i.jsonData.dataFileList = [];
-								i.jsonData.fileList = [];
-								i.createtime = "";
-								i.id = "",
-								i.tId = "",
-								i.userid = "";
-								_result.push(i)
-							}
-							
-							
-						})
+          _data.forEach(i => {
+            if (converter(i.jsonData.name) == converter("词频词汇分析")) {
+              return;
+            } else {
+              i.jsonData.content = "";
+              i.jsonData.dataFileList = [];
+              i.jsonData.fileList = [];
+              i.createtime = "";
+              (i.id = ""), (i.tId = ""), (i.userid = "");
+              if (i.jsonData.eChartData) {
+                delete i.jsonData.eChartData;
+              }
+              if (i.jsonData.RT && i.jsonData.CH) {
+                delete i.jsonData.RT;
+                delete i.jsonData.CH;
+              }
+              _result.push(i);
+            }
+          });
 
-						let otherData = {
-							isOtherData:true,
-							dialogTagList:this.bmData.jsonData.dialogTagList,
-						}
-						_result.push(otherData)
-						// console.log(_result)
-						// this.loading = false
-						// return
-						let params = [{
-							title:this.form.name,
-							subject:this.form.subject,
-							uid:this.userId,
-							brief:this.form.brief,
-							per:this.form.permissions?1:0,
-							jsonData:JSON.stringify(_result),
-						}]
-						// this.loading = false;
-						// return console.log(params);
-						this.ajax.post(this.$store.state.api+"insertClassroomTemplate",params).then(res=>{
-							console.log(res)
-							this.$message.success("另存模板成功");
-							this.loading = false;
-							this.close();
-						}).catch(e=>{
-							console.log(e);
-							this.$message.error("另存失败");
-							this.loading = false;
-						})
-						// return console.log(params)
-          }
-        });
-		},
-
-	},
+          let otherData = {
+            isOtherData: true,
+            dialogTagList: this.bmData.jsonData.dialogTagList
+          };
+          _result.push(otherData);
+          // console.log(_result)
+          // this.loading = false
+          // return
+          let params = [
+            {
+              title: this.form.name,
+              subject: this.form.subject,
+              uid: this.userId,
+              brief: this.form.brief,
+              per: this.form.permissions ? 1 : 0,
+              jsonData: JSON.stringify(_result)
+            }
+          ];
+          // this.loading = false;
+          // return console.log(params);
+          this.ajax
+            .post(this.$store.state.api + "insertClassroomTemplate", params)
+            .then(res => {
+              console.log(res);
+              this.$message.success("另存模板成功");
+              this.loading = false;
+              this.close();
+            })
+            .catch(e => {
+              console.log(e);
+              this.$message.error("另存失败");
+              this.loading = false;
+            });
+          // return console.log(params)
+        }
+      });
+    }
+  }
 };
 </script>
 
 <style scoped>
 .bindingFormDialog >>> .el-dialog {
-	min-width: 700px;
+  min-width: 700px;
 
-	height: 500px;
-	box-shadow: 0px 0 8px 0px #555555;
-	border-radius: 8px;
-	background-color: #fff;
-	/* top: 0px; */
-	/* margin: 0 auto; */
-	overflow: hidden;
+  height: 500px;
+  box-shadow: 0px 0 8px 0px #555555;
+  border-radius: 8px;
+  background-color: #fff;
+  /* top: 0px; */
+  /* margin: 0 auto; */
+  overflow: hidden;
 }
 .bindingFormDialog >>> .el-dialog__body {
-	height: 100%;
-	min-width: 700px;
-	flex-shrink: 0;
-	box-sizing: border-box;
-	padding-bottom: 50px;
-	padding-top: 10px;
+  height: 100%;
+  min-width: 700px;
+  flex-shrink: 0;
+  box-sizing: border-box;
+  padding-bottom: 50px;
+  padding-top: 10px;
 }
 .bindingFormDialog >>> .el-dialog__header {
-	display: none !important;
+  display: none !important;
 }
 
 .a-d-top {
-	/* background: #adadad; */
-	display: flex;
-	flex-direction: row;
-	flex-wrap: nowrap;
-	align-items: center;
-	justify-content: space-between;
-	height: 54px;
-	border-radius: 8px 8px 0 0;
-	user-select: none;
-	border-bottom: 1px #ccc solid;
+  /* background: #adadad; */
+  display: flex;
+  flex-direction: row;
+  flex-wrap: nowrap;
+  align-items: center;
+  justify-content: space-between;
+  height: 54px;
+  border-radius: 8px 8px 0 0;
+  user-select: none;
+  border-bottom: 1px #ccc solid;
 }
 .a-d-top >>> .el-input__inner {
-	width: 320px;
-	height: 32px;
+  width: 320px;
+  height: 32px;
 }
 .a-d-top >>> .el-input__icon {
-	line-height: 32px;
+  line-height: 32px;
 }
 
 .a-d-topTit {
-	/* width: 171px; */
-	/* margin-left: 20px; */
-	height: 32px;
-	display: flex;
-	align-items: center;
-	font-family: PingFang SC;
-	box-sizing: border-box;
-	padding: 5px;
-	line-height: 22px;
-	justify-content: center;
-	/* text-align: left; */
+  /* width: 171px; */
+  /* margin-left: 20px; */
+  height: 32px;
+  display: flex;
+  align-items: center;
+  font-family: PingFang SC;
+  box-sizing: border-box;
+  padding: 5px;
+  line-height: 22px;
+  justify-content: center;
+  /* text-align: left; */
 }
 
 .a-d-t-right {
-	width: 40px;
-	height: 40px;
-	margin-right: 10px;
-	display: flex;
-	justify-content: center;
-	align-items: center;
-	color: black !important;
+  width: 40px;
+  height: 40px;
+  margin-right: 10px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  color: black !important;
 }
 
 .a-d-t-right > span {
-	width: 25px;
-	height: 25px;
-	border-radius: 25px;
-	display: flex;
-	align-items: center;
-	justify-content: center;
-	/* align-items: center; */
-	font-size: 22px;
-	color: #fff;
-	/* background-color: #adadad; */
-	cursor: pointer;
-	/* background-color: #e6e6e6; */
-	color: #adadad;
+  width: 25px;
+  height: 25px;
+  border-radius: 25px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  /* align-items: center; */
+  font-size: 22px;
+  color: #fff;
+  /* background-color: #adadad; */
+  cursor: pointer;
+  /* background-color: #e6e6e6; */
+  color: #adadad;
 }
 
 .bfd_box {
-	width: 100%;
-	height: calc(100% - 80px);
-	overflow: hidden;
+  width: 100%;
+  height: calc(100% - 80px);
+  overflow: hidden;
 }
 
 .bfd_bottom {
-	width: 100%;
-	height: calc(40px);
-	margin-top: 10px;
-	display: flex;
-	justify-content: flex-end;
+  width: 100%;
+  height: calc(40px);
+  margin-top: 10px;
+  display: flex;
+  justify-content: flex-end;
 }
 
 .bfd_b_left {
-	flex: 1;
-	height: 100%;
-	display: flex;
-	align-items: center;
+  flex: 1;
+  height: 100%;
+  display: flex;
+  align-items: center;
 }
 
 .a_d_t_input {
-	display: flex;
-	align-items: center;
+  display: flex;
+  align-items: center;
 }
 
 /* .bfd_b_right {

+ 9 - 0
src/components/pages/classroomObservation/index.vue

@@ -378,6 +378,15 @@ export default {
           !i.isOtherData &&
           converter(i.jsonData.name) != converter("词频词汇分析")
       );
+			json.forEach(i=>{
+				if(i.jsonData.eChartData){
+					delete i.jsonData.eChartData
+				}
+				if(i.jsonData.RT && i.jsonData.CH){
+					delete i.jsonData.RT
+					delete i.jsonData.CH
+				}
+			})
       return new Promise((resolve, reject) => {
         this.loading = true;
         const _newTid = uuidv4();