SanHQin преди 5 месеца
родител
ревизия
f3e5700ea2

+ 97 - 6
src/components/pages/classroomObservation/components/analysis.vue

@@ -45,11 +45,17 @@
         <div
           class="a_h_r_more"
           slot="reference"
+					v-if="!isDrag"
           @click.stop="visible = !visible"
         >
           <img src="@/assets/icon/classroomObservation/moreIcon.svg" alt="" />
         </div>
 
+				<div class="a_h_r_scBtn" v-if="isDrag">
+					<span class="a_h_r_cancel" @click.stop="dragCancel()">取消</span>
+					<span class="a_h_r_submit" @click.stop="dragSubmit()">完成</span>
+				</div>
+
         <div
           class="a_h_r_boxList"
           v-if="visible"
@@ -88,6 +94,10 @@
 
             添加模块
           </div>
+					<div @click="moveAnalysis()" v-if="tid">
+						<svg t="1727591669869" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4289" width="200" height="200"><path d="M514.64 511m-84.76 0a84.76 84.76 0 1 0 169.52 0 84.76 84.76 0 1 0-169.52 0Z" fill="#000000" p-id="4290"></path><path d="M661.36 190.85L548.54 78a47.85 47.85 0 0 0-32-14c-1.21-0.09-2.43-0.15-3.66-0.15A48.95 48.95 0 0 0 478.58 78L365.77 190.85a48 48 0 0 0 0 67.88 48 48 0 0 0 67.88 0l31.21-31.21v115.22a48 48 0 0 0 48 48 48 48 0 0 0 48-48V226.11l32.61 32.62a48 48 0 0 0 67.89 0 48 48 0 0 0 0-67.88zM364.23 832.86l112.82 112.81a47.82 47.82 0 0 0 32 14c1.21 0.09 2.43 0.15 3.66 0.15A48.9 48.9 0 0 0 547 945.67l112.83-112.81a48 48 0 0 0 0-67.88 48 48 0 0 0-67.89 0l-31.21 31.2V681a48 48 0 0 0-48-48 48 48 0 0 0-48 48v116.59L432.12 765a48 48 0 0 0-67.89 0 48 48 0 0 0 0 67.86zM831.12 663.76L943.93 551a47.86 47.86 0 0 0 14-32c0.09-1.21 0.15-2.43 0.15-3.67A48.86 48.86 0 0 0 943.93 481L831.12 368.17a48 48 0 0 0-67.89 0 48 48 0 0 0 0 67.88l31.21 31.21H679.23a48 48 0 0 0-48 48 48 48 0 0 0 48 48h116.62l-32.62 32.62a48 48 0 0 0 0 67.88 48 48 0 0 0 67.89 0zM187.88 366.64L75.06 479.45a47.82 47.82 0 0 0-14 32c-0.1 1.21-0.16 2.43-0.16 3.67a48.86 48.86 0 0 0 14.17 34.27l112.81 112.84a48 48 0 0 0 67.88 0 48 48 0 0 0 0-67.88l-31.21-31.21h115.21a48 48 0 0 0 48-48 48 48 0 0 0-48-48H223.14l32.62-32.62a48 48 0 0 0 0-67.88 48 48 0 0 0-67.88 0z" fill="#000000" p-id="4291"></path></svg>
+						移动模块
+					</div>
           <div @click="addNewAnalysisGroup(0)">
             <svg
               t="1727073223211"
@@ -274,6 +284,8 @@
             </svg>
             删除分析
           </div>
+
+					
         </div>
         <!-- </el-popover> -->
         <!-- <div class="a-h-r-btn" @click.stop="addTemplate">
@@ -282,12 +294,12 @@
         </div> -->
       </div>
     </div>
-    <div class="a-main" v-show="showItem">
+    <div class="a-main" v-show="showItem || isDrag">
       <template v-for="(item, index) in analysisItemList">
+				<div class="a_m_dragBox" ref="dragBoxRefTop" :type="`${type}_${index}_${item.tIndex}_0`" v-if="isDrag && index===0"></div>
         <analysisItem
           ref="analysisItemRef"
           v-if="
-            converter(item.jsonData.name) != converter('词频词汇分析') &&
               ![
                 converter('S-T分析:课堂时间分配'),
                 converter('S-T分析:师生互动分析'),
@@ -303,12 +315,15 @@
           :key="item.id + item.Type + '-' + index"
           :data="item"
           :tid="tid"
+					:dialogTagList="dialogTagList"
           :fileId="fileId"
           :index="index"
           :showBrief="showBrief"
+					:isDrag="isDrag"
           @delItem="delItem"
           @editItem="editItem"
           @saveItem="saveItem"
+					@moveAnalysis="moveAnalysisSubmit"
         />
         <analysisSpecialItem
           v-if="
@@ -327,16 +342,21 @@
           :key="item.id + item.Type + '-' + index"
           :data="item"
           :tid="tid"
+					:dialogTagList="dialogTagList"
           :fileId="fileId"
           :index="index"
+					:isDrag="isDrag"
           :showBrief="showBrief"
           @delItem="delItem"
           @editItem="editItem"
           @saveItem="saveItem"
+					@moveAnalysis="moveAnalysisSubmit"
         />
+				<div class="a_m_dragBox" ref="dragBoxRefBottom" :type="`${type}_${index}_${item.tIndex}_1`" v-if="isDrag"></div>
       </template>
       <div class="a_m_empty" v-if="analysisItemList.length == 0">
-        暂无模块...
+        <span v-if="!isDrag">暂无模块...</span>
+				<div class="a_m_dragBox" ref="dragBoxRefBottom" :type="`${type}_0_0_2`" v-if="isDrag"></div>
       </div>
     </div>
     <editNameDialog ref="editNameDialogRef" @success="editNameSuccess" />
@@ -430,7 +450,15 @@ export default {
     maxIndex: {
       type: Number,
       default: 0
-    }
+    },
+		isDrag:{
+			type:Boolean,
+			default:false
+		},
+		dialogTagList:{
+			type:Array,
+			default:()=>{return []}
+		},
   },
   components: {
     analysisItem,
@@ -442,7 +470,7 @@ export default {
       return function(word) {
         return converter2(word);
       };
-    }
+    },
   },
   data() {
     return {
@@ -561,7 +589,21 @@ export default {
       this.visible = false;
       if (!this.tid) return this.$message.error("请新建课堂,或选择历史课堂");
       this.$emit("setTheLocation", { value: this.type, type: type });
-    }
+    },
+		moveAnalysis(){
+			this.visible = false;
+			this.$parent.isDrag = true;
+		},
+		dragSubmit(){
+			this.visible = false;
+			this.$parent.isDrag = false;
+		},
+		moveAnalysisSubmit(data){
+			this.$emit('moveAnalysis',data)
+		},
+		dragCancel(){
+			this.$parent.moveAnalysisCancel()
+		}
   }
 };
 </script>
@@ -986,4 +1028,53 @@ export default {
 .a_h_l_t_input >>> .el-form-item {
   margin-bottom: 0;
 }
+
+.a_m_dragBox{
+	width: 100%;
+	height: 40px;
+	border-radius: 3px;
+	box-sizing: border-box;
+	margin-bottom: 10px;
+	border: 1px dashed rgba(54, 129, 252, 1);
+	background-color: #F8F9FA;
+	transition: .3s;
+	cursor: pointer;
+}
+
+.a_h_r_scBtn{
+	height: 100%;
+	padding: 0 10px 0;
+	display: flex;
+	justify-content: center;
+	align-items: center;
+}
+
+.a_h_r_scBtn>.a_h_r_submit{
+	padding: 5px 10px;
+	background-color: rgba(54, 129, 252, 1);
+	border-radius: 3px;
+	color: #fff;
+	cursor: pointer;
+	font-size: 14px;
+}
+
+.a_h_r_submit>a_h_r_submit:hover{
+	background-color: rgb(19, 106, 247);
+}
+
+.a_h_r_scBtn>.a_h_r_cancel{
+	padding: 5px 10px;
+	background-color: #fff;
+	border-radius: 3px;
+	color: black;
+	cursor: pointer;
+	border: solid 1px #e7e7e7;
+	font-size: 14px;
+	margin-right: 10px;
+}
+
+.a_h_r_submit>.a_h_r_cancel:hover{
+	background-color: #e0d9d9;
+}
+
 </style>

+ 170 - 52
src/components/pages/classroomObservation/components/analysisItem.vue

@@ -1,6 +1,15 @@
 <template>
-  <div class="analysisItem">
-    <div class="ai-header" v-show="data.jsonData.name != '词频词汇分析'">
+  <div
+    class="analysisItem"
+    ref="analysisItemRef"
+    :style="
+      `top:${moveTop}px;transition:${isDragging ? '0' : '.3s'}s;${
+        isDragging ? 'z-index:999' : ''
+      }`
+    "
+		@mousedown="moveDown($event)"
+  >
+    <div class="ai-header">
       <div class="ai-h-left" @click="changeOpenItem(!openItem)">
         <span
           :class="['ai-h-l-icon', openItem ? 'ai-h-l-iconActive' : '']"
@@ -37,7 +46,7 @@
           content="修改名称"
           placement="top"
         >
-          <span class="a_h_l_edit" @click.stop="editTitleFn()">
+          <span class="a_h_l_edit" @click.stop="editTitleFn()" v-if="!isDrag">
             <img
               src="../../../../assets/icon/classroomObservation/editIcon2.svg"
             />
@@ -45,10 +54,10 @@
         </el-tooltip>
       </div>
       <div class="ai-h-right">
-        <span style="width: 100px;" class="generateError" v-if="loadNum == 2"
+        <span style="width: 100px;" class="generateError" v-if="loadNum == 2&& !isDrag"
           >优化失败
         </span>
-        <span style="width: 100px" v-if="loadNum == 1">
+        <span style="width: 100px" v-if="loadNum == 1 && !isDrag">
           <span v-if="loading" class="generate">
             <img
               :src="
@@ -65,13 +74,10 @@
             />
             生成完成
           </span>
-        
-				</span>
-
-				
+        </span>
 
         <span
-          v-if="loadNum == 0 && !openItem && tid"
+          v-if="loadNum == 0 && !openItem && tid && !isDrag""
           class="ai-h-r-icon4"
           @click="delBtn()"
         >
@@ -89,15 +95,8 @@
           </el-tooltip>
         </span>
 
-				<!-- <span
-          v-if="loadNum == 0 && !openItem && tid"
-          class="ai-h-r-moveIcon"
-        >
-					<svg t="1727418782659" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="14988" width="200" height="200"><path d="M236.288 787.712V1024H0v-236.288h236.288z m393.856 0V1024H393.856v-236.288h236.288z m393.856 0V1024h-236.288v-236.288H1024zM236.288 393.856v236.288H0V393.856h236.288z m393.856 0v236.288H393.856V393.856h236.288z m393.856 0v236.288h-236.288V393.856H1024zM236.288 0v236.288H0V0h236.288z m393.856 0v236.288H393.856V0h236.288zM1024 0v236.288h-236.288V0H1024z" fill="#000000" p-id="14989"></path></svg>
-        </span> -->
-
         <span
-          v-if="loadNum == 0 && openItem"
+          v-if="loadNum == 0 && openItem && !isDrag"
           :class="['ai-h-r-icon1', showIndex <= 0 ? 'ai_h_r_iconOpacity' : '']"
           @click="changeShowIndex(-1)"
         >
@@ -115,8 +114,9 @@
           </el-tooltip>
         </span>
 
+
         <span
-          v-if="loadNum != 1 && openItem"
+          v-if="loadNum != 1 && openItem && !isDrag"
           :class="[
             showIndex >= historyResult.length - 1 ? 'ai_h_r_iconOpacity' : ''
           ]"
@@ -136,7 +136,7 @@
           </el-tooltip>
         </span>
 
-        <span v-if="loadNum != 1 && openItem && tid" @click="editBtn()">
+        <span v-if="loadNum != 1 && openItem && tid && !isDrag" @click="editBtn()">
           <el-tooltip
             class="item"
             effect="light"
@@ -156,7 +156,7 @@
             loadNum != 1 &&
               openItem &&
               tid &&
-              ['1', '2', '3'].includes(data.jsonData.echartsType)
+              ['1', '2', '3'].includes(data.jsonData.echartsType) && !isDrag
           "
           @click="editEcharts()"
         >
@@ -177,7 +177,7 @@
         <!-- <span class="ai-h-r-icon4" @click.stop="delBtn()"></span> -->
       </div>
     </div>
-    <div class="ai-main" v-if="openItem">
+    <div class="ai-main" v-if="openItem && !isDrag">
       <div class="a-m-brief" v-if="showBrief">
         {{ data.jsonData.result }}
         <!-- <mdView :text="data.jsonData.result" /> -->
@@ -268,10 +268,22 @@ export default {
         return {};
       }
     },
-		dataList:{
-			type:Array,
-			default:()=>{return []}
-		},
+    dataList: {
+      type: Array,
+      default: () => {
+        return [];
+      }
+    },
+    isDrag: {
+      type: Boolean,
+      default: false
+    },
+    dialogTagList: {
+      type: Array,
+      default: () => {
+        return [];
+      }
+    }
   },
   data() {
     return {
@@ -307,7 +319,13 @@ export default {
             message: "长度需在1-20个字符之间"
           }
         ]
-      }
+      },
+      startY: 0,
+      startTop: 0,
+      moveTop: 0,
+      isDragging: false,
+      dragBoxList: [],
+      enterDrag: null
     };
   },
   computed: {
@@ -327,6 +345,7 @@ export default {
   },
   methods: {
     changeOpenItem(newValue) {
+			if(this.isDrag)return;
       if (this.loading == true && this.loadNum != 0)
         return this.$message("请稍后...");
       this.loadNum = 0;
@@ -338,7 +357,7 @@ export default {
         this.openItem = false;
         this.loadNum = 1;
         let type = 0; //0 用agentId  1:用提示词 3:啥都没有
-				let tips = "";
+        let tips = "";
         let assistant =
           this.dialogTagDataList.find(i => i.id == this.data.jsonData.mId) ||
           this.dialogTagDataList.find(i => i.name == this.data.jsonData.name);
@@ -354,13 +373,15 @@ export default {
 
         if (assistant.tips) {
           type = 1;
-					let analysisData = ``;
-					for(let i = 0;i<this.dataList.length;i++){
-							let _json = this.dataList[i].jsonData;
-							analysisData +=`### ${_json.anotherName?_json.anotherName:_json.name}\n`
-							analysisData +=`${_json.content}\n`
-					}
-					tips = assistant.tips.replaceAll('${analysisData}',analysisData)
+          let analysisData = ``;
+          for (let i = 0; i < this.dataList.length; i++) {
+            let _json = this.dataList[i].jsonData;
+            analysisData += `### ${
+              _json.anotherName ? _json.anotherName : _json.name
+            }\n`;
+            analysisData += `${_json.content}\n`;
+          }
+          tips = assistant.tips.replaceAll("${analysisData}", analysisData);
         } else if (assistant.agentid) {
           type = 0;
         } else {
@@ -375,8 +396,6 @@ export default {
 课堂名称:${this.bmData.courseName}  搜课年级:${this.bmData.grade}  授课科目:${this.bmData.subject}`;
         }
 
-
-
         // console.log('👇')
         // return console.log(_msg)
         let parm = {
@@ -436,7 +455,8 @@ export default {
             // }
             let _copyData = JSON.parse(JSON.stringify(this.data));
             // _copyData.jsonData.result = "";
-						if(!_copyData.jsonData.mId && assistant.agentid)_copyData.jsonData.mId = assistant.agentid
+            if (!_copyData.jsonData.mId && assistant.agentid)
+              _copyData.jsonData.mId = assistant.agentid;
             _copyData.jsonData.content = _data.message;
             _copyData.jsonData.dataFileList = [];
             _copyData.jsonData.fileList = [];
@@ -670,7 +690,7 @@ export default {
             res.forEach((item, index) => {
               if (index == 0) return; //去掉表头
               radarData.push({ name: item[0], max: 5 });
-							let _valueItem = 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);
@@ -727,7 +747,7 @@ export default {
             stepList = this.calculateTopValues(res.length - 1);
             res.forEach((item, index) => {
               if (index == 0) return;
-							let _valueItem = item[1] ? item[1] : "0";
+              let _valueItem = item[1] ? item[1] : "0";
               let _value = _valueItem.match(/(\d+)/);
               _value = _value ? parseInt(_value[0]) : 0;
               // 求百分比
@@ -827,7 +847,7 @@ export default {
       }
       this.loadNum = 2;
       this.loading = false;
-			return this.$message.error("生成图表失败");
+      return this.$message.error("生成图表失败");
     },
     calculateTopValues(len, minTop = -80, maxTop = 70, maxStep = 40) {
       const length = len;
@@ -875,9 +895,9 @@ export default {
 
           // 匹配每个单元格 (th 或 td)
           while ((cellMatch = cellRegex.exec(rowContent)) !== null) {
-						let _text = cellMatch[2].trim();
-						_text = _text.replace(/&[a-zA-Z]+;/g, '');
-						_text = _text.replace(/<\/?[^>]+(>|$)/g, '')
+            let _text = cellMatch[2].trim();
+            _text = _text.replace(/&[a-zA-Z]+;/g, "");
+            _text = _text.replace(/<\/?[^>]+(>|$)/g, "");
             rowData.push(_text); // 将每个单元格的内容添加到当前行的数组中
           }
 
@@ -901,6 +921,101 @@ export default {
 
       // 组合三种颜色(红、绿、蓝)的随机值
       return `#${randomHex()}${randomHex()}${randomHex()}`;
+    },
+    moveDown(e) {
+			if(!this.isDrag)return;
+      this.isDragging = true;
+      this.startY = e.clientY;
+      this.$nextTick(() => {
+        this.dialogTagList.forEach(i => {
+          this.dragBoxList.push(
+            ...this.$parent.$parent.$refs[`analysis_${i.value}`][0].$refs
+              .dragBoxRefTop
+          );
+					if(this.$parent.$parent.$refs[`analysis_${i.value}`][0].$refs.dragBoxRefBottom.length>0){
+						this.dragBoxList.push(
+            ...this.$parent.$parent.$refs[`analysis_${i.value}`][0].$refs
+              .dragBoxRefBottom
+          );
+					}else if(this.$parent.$parent.$refs[`analysis_${i.value}`][0].$refs.dragBoxRefBottom){
+						this.dragBoxList.push(this.$parent.$parent.$refs[`analysis_${i.value}`][0].$refs.dragBoxRefBottom);
+					}
+          
+        });
+        // 禁用页面文本选择
+        document.body.style.userSelect = "none";
+        document.addEventListener("mousemove", this.onMouseMove);
+        document.addEventListener("mouseup", this.stopDragging);
+      });
+    },
+    onMouseMove(e) {
+      if (!this.isDragging) return;
+
+      const newTop = e.clientY - this.startY; // 计算鼠标移动的Y轴距离
+
+      // // 更新div的top样式,使其跟随鼠标移动
+      this.moveTop = newTop;
+      // this.dragBoxList.forEach(i=>{
+      // 	let _i = i.getBoundingClientRect();
+      // 	if(e.clientX>=_i.left && e.clientX<=_i.right && e.clientY>=_i.top && e.clientY<=_i.bottom){
+      // 		this.enterDrag = i;
+      // 		console.log("👇")
+      // 		console.log(e)
+      // 	}else{
+      // 		this.enterDrag = null;
+      // 	}
+      // })
+      // for (let i = 0; i <= this.dragBoxList.length; i++) {
+      //   let _i = this.dragBoxList[i].getBoundingClientRect();
+      //   if (
+      //     e.clientX >= _i.left &&
+      //     e.clientX <= _i.right &&
+      //     e.clientY >= _i.top &&
+      //     e.clientY <= _i.bottom
+      //   ) {
+      //     this.enterDrag = this.dragBoxList[i];
+      //     console.log("👇");
+      //     console.log(e);
+      // 		break;
+      //   } else {
+      //     this.enterDrag = null;
+      //   }
+      // }
+    },
+    stopDragging(e) {
+      this.isDragging = false;
+      try {
+        for (let i = 0; i <= this.dragBoxList.length; i++) {
+          let _i = this.dragBoxList[i].getBoundingClientRect();
+          if (
+            e.clientX >= _i.left &&
+            e.clientX <= _i.right &&
+            e.clientY >= _i.top &&
+            e.clientY <= _i.bottom
+          ) {
+            this.enterDrag = this.dragBoxList[i];
+            break;
+          } else {
+            this.enterDrag = null;
+          }
+        }
+        // 恢复页面的文本选择
+        document.body.style.userSelect = "";
+        if (!this.enterDrag) {
+          this.moveTop = 0;
+        } else {
+					this.moveTop = 0;
+					let moveData = this.enterDrag.getAttribute('type');
+					this.$emit("moveAnalysis",{form:`${this.data.Type}_${this.index}_${this.data.tIndex}`,to:moveData})
+        }
+        // 移除全局的鼠标移动和释放事件
+        document.removeEventListener("mousemove", this.onMouseMove);
+        document.removeEventListener("mouseup", this.stopDragging);
+      } catch (error) {
+				this.moveTop = 0;
+				document.removeEventListener("mousemove", this.onMouseMove);
+        document.removeEventListener("mouseup", this.stopDragging);
+			}
     }
   },
   mounted() {
@@ -924,6 +1039,9 @@ export default {
   border: 1px solid #e7e7e7;
   border-radius: 4px;
   transition: 0.3s;
+  background-color: #fff;
+  position: relative;
+  top: 0;
 }
 
 .analysisItem:hover {
@@ -1029,18 +1147,18 @@ export default {
   display: block;
 }
 
-.ai-h-r-moveIcon{
-	display: none;
-	cursor: move !important;
+.ai-h-r-moveIcon {
+  display: none;
+  cursor: move !important;
 }
 
-.analysisItem:hover .ai-h-r-moveIcon{
-	display: block;
+.analysisItem:hover .ai-h-r-moveIcon {
+  display: block;
 }
 
-.ai-h-r-moveIcon>svg{
-	width: 18px;
-	height: 18px;
+.ai-h-r-moveIcon > svg {
+  width: 18px;
+  height: 18px;
 }
 
 .ai-main {

+ 22 - 5
src/components/pages/classroomObservation/components/analysisSpecialItem.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="analysisItem">
-    <div class="ai-header" v-show="data.jsonData.name != '词频词汇分析'">
+    <div class="ai-header">
       <div class="ai-h-left" @click.stop="changeOpenItem(!openItem)">
         <span
           :class="['ai-h-l-icon', openItem ? 'ai-h-l-iconActive' : '']"
@@ -38,14 +38,14 @@
           content="修改名称"
           placement="top"
         >
-          <span class="a_h_l_edit" @click.stop="editTitleFn()">
+          <span class="a_h_l_edit" @click.stop="editTitleFn()" v-if="!isDrag">
             <img
               src="../../../../assets/icon/classroomObservation/editIcon2.svg"
             />
           </span>
         </el-tooltip>
       </div>
-      <div class="ai-h-right">
+      <div class="ai-h-right" v-if="!isDrag">
         <span style="width: 100px" class="generateError" v-if="loadNum == 2"
           >优化失败
         </span>
@@ -162,7 +162,7 @@
         <!-- <span class="ai-h-r-icon4" @click.stop="delBtn()"></span> -->
       </div>
     </div>
-    <div class="ai-main" v-if="openItem">
+    <div class="ai-main" v-if="openItem && !isDrag">
       <div class="a-m-brief" v-if="showBrief">
         {{ data.jsonData.result }}
       </div>
@@ -266,6 +266,16 @@ export default {
     showBrief: {
       type: Boolean,
       default: true
+    },
+		isDrag: {
+      type: Boolean,
+      default: false
+    },
+    dialogTagList: {
+      type: Array,
+      default: () => {
+        return [];
+      }
     }
   },
   data() {
@@ -303,7 +313,13 @@ export default {
             message: "长度需在1-20个字符之间"
           }
         ]
-      }
+      },
+			startY: 0,
+      startTop: 0,
+      moveTop: 0,
+      isDragging: false,
+      dragBoxList: [],
+      enterDrag: null
     };
   },
   computed: {
@@ -328,6 +344,7 @@ export default {
   },
   methods: {
     changeOpenItem(newValue) {
+			if(this.isDrag)return;
       if (this.loading == true && this.loadNum != 0)
         return this.$message("请稍后...");
       this.loadNum = 0;

+ 87 - 212
src/components/pages/classroomObservation/components/messageArea.vue

@@ -42,9 +42,10 @@
         v-for="(item, index) in dialogTagList"
         :key="item.value"
         :index="index"
+        :dialogTagList="dialogTagList"
         :maxIndex="dialogTagList.length - 1"
         @updateMessage="updateMessage"
-        :ref="`analysis${item.value}`"
+        :ref="`analysis_${item.value}`"
         :showBrief="showBrief"
         @delItem="delAnalysisItem"
         @editItem="editAnalysisItem"
@@ -53,6 +54,7 @@
         @addNewAnalysisGroup="addNewAnalysisGroup"
         @delAnalysisGroup="delAnalysisGroup"
         @setTheLocation="setTheLocation"
+        @moveAnalysis="moveAnalysis"
         :dataList="dataList.filter(i => !(item.value == 0 && i.tIndex == 2))"
         :bmData="bmData.jsonData"
         :title="item.name"
@@ -65,207 +67,10 @@
         :type="item.value"
         :tid="tid"
         :fileId="fileId"
+        :isDrag="isDrag"
         v-loading="item.loading"
       />
-
-      <!-- <div class="ma_m_addNewAnalysisBox"></div> -->
-
-      <!-- <analysis
-				@updateMessage="updateMessage"
-				ref="analysis0"
-				:showBrief="showBrief"
-				@delItem="delAnalysisItem"
-				@editItem="editAnalysisItem"
-				@saveItem="saveAnalysis"
-				:bmData="bmData.jsonData"
-				title="通用课堂分析"
-				:dialogTagDataList="dialogTagDataList"
-				:analysisItemList="dataList.filter((i) => i.Type === 0 && i.tIndex!=2)"
-				:type="0"
-				:tid="tid"
-				:fileId="fileId"
-				v-loading="currencyLoading"
-			/>
-			<analysis
-				@updateMessage="updateMessage"
-				ref="analysis1"
-				:showBrief="showBrief"
-				:bmData="bmData.jsonData"
-				@delItem="delAnalysisItem"
-				@editItem="editAnalysisItem"
-				@saveItem="saveAnalysis"
-				title="学科课堂分析"
-				:dialogTagDataList="dialogTagDataList"
-				:analysisItemList="dataList.filter((i) => i.Type === 1)"
-				:type="1"
-				:tid="tid"
-				:fileId="fileId"
-				v-loading="scienceLoading"
-			/>
-			<analysis
-				@updateMessage="updateMessage"
-				ref="analysis2"
-				:bmData="bmData.jsonData"
-				:showBrief="showBrief"
-				@delItem="delAnalysisItem"
-				@editItem="editAnalysisItem"
-				@saveItem="saveAnalysis"
-				title="扩展分析"
-				:dialogTagDataList="dialogTagDataList"
-				:analysisItemList="dataList.filter((i) => i.Type === 2)"
-				:type="2"
-				:tid="tid"
-				:fileId="fileId"
-				v-loading="extendLoading"
-			/> -->
-      <!-- <analysis
-				@updateMessage="updateMessage"
-				ref="analysis3"
-				:showBrief="showBrief"
-				@delItem="delAnalysisItem"
-				@editItem="editAnalysisItem"
-				title="增值性分析"
-				:dialogTagDataList="dialogTagDataList"
-				:analysisItemList="dataList.filter((i) => i.Type === 3)"
-				:type="3"
-				:tid="tid"
-				:fileId="fileId"
-				v-loading="valueAddedLoading"
-			/> -->
-      <!-- <currencyAnalysis
-				@updateMessage="updateMessage"
-				@delItem="delAnalysisItem"
-				@editItem="editAnalysisItem"
-				:analysisItemList="dataList.filter((i) => i.Type === 0)"
-				:tid="tid"
-				v-loading="currencyLoading"
-				ref="currencyAnalysisRef"
-			/>
-
-			<scienceAnalysis
-				@updateMessage="updateMessage"
-				@delItem="delAnalysisItem"
-				@editItem="editAnalysisItem"
-				:analysisItemList="dataList.filter((i) => i.Type === 1)"
-				:tid="tid"
-				v-loading="scienceLoading"
-				ref="scienceAnalysisRef"
-			/>
-
-			<extendAnalysis
-				@updateMessage="updateMessage"
-				@delItem="delAnalysisItem"
-				@editItem="editAnalysisItem"
-				:analysisItemList="dataList.filter((i) => i.Type === 2)"
-				:tid="tid"
-				v-loading="extendLoading"
-				ref="extendAnalysisRef"
-			/> -->
-      <!-- <div style="height: 10000px;"></div> -->
     </div>
-    <!-- <el-dialog
-			:center="true"
-			:visible.sync="dialogVisible"
-			width="1200px"
-			class="addTemplateDialog"
-		>
-			<div class="a-d-top">
-				<div class="a-d-topTit"><div style="width: 136px">添加模块</div></div>
-				<div>
-					<el-input
-						placeholder="请输入内容"
-						prefix-icon="el-icon-search"
-						v-model="input2"
-						clearable
-					>
-					</el-input>
-				</div>
-				<div class="a-d-t-right">
-					<span @click.stop="dialogVisible = false">×</span>
-				</div>
-			</div>
-			<div style="display: flex; height: 100%">
-				<div class="a-d-t-left">
-					<div
-						:style="
-							tagIndex == index
-								? 'background: rgba(226, 238, 255, 1);color: rgba(54, 129, 252, 1)'
-								: ''
-						"
-						class="a-d-t-l-item"
-						v-for="(item, index) in dialogTagList"
-						:key="item.id"
-						@click.stop="tagIndex = index"
-					>
-						{{ item.name }}
-					</div>
-				</div>
-				<div class="a-d-box">
-					<div
-						style="
-							font-family: PingFang SC;
-							font-size: 16px;
-							font-weight: 600;
-							line-height: 22px;
-							text-align: left;
-							margin: 20px 0;
-							margin-bottom: 10px;
-						"
-					>
-						推荐
-					</div>
-					<div class="a-d-b-subject">
-						<span
-							:class="[
-								'a_d_b_s_btn',
-								tagSubject == item ? 'a_d_b_s_ActiveBtn' : '',
-							]"
-							v-for="(item, index) in tagSubjectList"
-							:key="index + '-' + tagIndex"
-							@click.stop="tagSubject = item"
-							>{{ item }}</span
-						>
-					</div>
-					<div style="display: flex; flex-wrap: wrap">
-						<div
-							class="a-d-b-item"
-							v-for="(item, index) in searchDataList"
-							:key="index"
-						>
-							<div class="a-d-b-i-top">
-								<img
-									style="height: 22px; width: 22px"
-									:src="
-										require('../../../../assets/icon/classroomObservation/digImg.svg')
-									"
-								/>
-								<div class="a-d-b-i-t-title">{{ item.name }}</div>
-							</div>
-							<div class="a-d-b-i-bottom">{{ item.detail }}</div>
-							<div class="a-d-b-i-bottomPer" style="display: block">
-								{{ item.count }}人已使用
-							</div>
-							<div class="a-d-b-i-bottomBtn" style="display: none">
-								<div
-									style="
-										display: flex;
-										width: 100%;
-										justify-content: space-around;
-									"
-								>
-									<div
-										class="a-d-b-i-t-btn1"
-										@click="addAnalysisItem(item.name)"
-									>
-										添加
-									</div>
-								</div>
-							</div>
-						</div>
-					</div>
-				</div>
-			</div>
-		</el-dialog> -->
     <!-- 添加模块 -->
     <addNewAnalysisDialog
       @update="getDialogTagDataList"
@@ -358,7 +163,9 @@ export default {
       dialogTagDataList: [],
       bmData: {},
       dataList: [],
-      imageList: {}
+      imageList: {},
+      isDrag: false,
+      copyDataList: []
     };
   },
   computed: {
@@ -387,6 +194,11 @@ export default {
     // },
   },
   watch: {
+    isDrag(newValue) {
+      if (newValue) {
+        this.copyDataList = JSON.parse(JSON.stringify(this.dataList));
+      }
+    }
     // tagIndex() {
     // 	this.tagSubject = "";
     // },
@@ -560,7 +372,7 @@ export default {
               // } else if (_result.Type == 2) {
               //   this.$refs.analysis2[0].getReport(_result.id);
               // }
-              this.$refs[`analysis${_result.Type}`][0].getReport(_result.id);
+              this.$refs[`analysis_${_result.Type}`][0].getReport(_result.id);
               this.$message.success("添加成功");
               resolve();
             } else {
@@ -926,6 +738,7 @@ export default {
     getData(arr = []) {
       return new Promise(resolve => {
         this.dataList = [];
+        this.isDrag = false;
         this.$forceUpdate();
         if (this.tid) {
           return this.getAnalysisData(0).then(res => {
@@ -939,8 +752,8 @@ export default {
                   promises.push(this.getAnalysisData(i.value));
                 });
                 Promise.all(promises).then(res => {
-									this.dataList.sort((a,b)=>a.tIndex - b.tIndex);
-									this.dataList.sort((a,b)=>a.Type - b.Type)
+                  this.dataList.sort((a, b) => a.tIndex - b.tIndex);
+                  this.dataList.sort((a, b) => a.Type - b.Type);
                   resolve();
                 });
               });
@@ -1165,7 +978,7 @@ export default {
         })
           .then(() => {
             this.dialogTagList.forEach(i => {
-              this.$refs[`analysis${i.value}`][0].getReport();
+              this.$refs[`analysis_${i.value}`][0].getReport();
             });
             // this.$refs["analysis0"][0].getReport();
             // this.$refs["analysis1"][0].getReport();
@@ -1363,22 +1176,22 @@ export default {
       if (_index === -1) return; // 如果没找到,直接退出
       if (data.type == 0) {
         // 置顶
-				moveList = this.moveListFn(moveList, _index, 0)
+        moveList = this.moveListFn(moveList, _index, 0);
       } else if (data.type == 1) {
         // 置底
-				moveList = this.moveListFn(moveList, _index, moveList.length-1)
+        moveList = this.moveListFn(moveList, _index, moveList.length - 1);
       } else if (data.type == 2) {
         // 上移
-				moveList = this.moveListFn(moveList, _index, _index-1)
+        moveList = this.moveListFn(moveList, _index, _index - 1);
       } else if (data.type == 3) {
         // 下移
-				moveList = this.moveListFn(moveList, _index, _index+1)
+        moveList = this.moveListFn(moveList, _index, _index + 1);
       }
       this.dialogTagList = moveList;
-			this.bmData.jsonData["dialogTagList"] = this.dialogTagList;
-      this.saveData(this.bmData)
-			this.$forceUpdate()
-		},
+      this.bmData.jsonData["dialogTagList"] = this.dialogTagList;
+      this.saveData(this.bmData);
+      this.$forceUpdate();
+    },
     moveListFn(arr, fromIndex, toIndex) {
       // 确保索引在数组范围内
       if (
@@ -1394,6 +1207,67 @@ export default {
       }
       return arr;
     },
+    moveArrayElement(arr, fromIndex, toIndex) {
+      const element = arr[fromIndex];
+      arr.splice(fromIndex, 1); // 删除原位置的元素
+
+      // 调整目标下标以确保正确插入
+      const newIndex = toIndex < fromIndex ? toIndex : toIndex - 1;
+
+      arr.splice(newIndex, 0, element); // 插入到新位置
+      return arr;
+    },
+    moveAnalysis(data) {
+      let _form = data.form.split("_");
+      let _to = data.to.split("_");
+
+      if (_form[0] === _to[0] && _form[1] === _to[1] && _form[2] === _to[2])
+        return console.log("位置不变");
+      if (
+        _form[0] === _to[0] &&
+        parseInt(_form[1]) - 1 === parseInt(_to[1]) &&
+        _to[3] == "1"
+      )
+        return console.log("位置不变2");
+      let _formIndex = this.dataList.findIndex(
+        i => i.Type == parseInt(_form[0]) && i.tIndex == parseInt(_form[2])
+      );
+      let _toIndex = -1;
+      if (["0", "1"].includes(_to[3])) {
+        _toIndex = this.dataList.findIndex(
+          i => i.Type == parseInt(_to[0]) && i.tIndex == parseInt(_to[2])
+        );
+      }
+      // 更新Type与tIndex
+      this.dataList[_formIndex].Type = parseInt(_to[0]);
+      if (_to[3] === "1") {
+        //下面
+        this.moveArrayElement(this.dataList, _formIndex, _toIndex+1);
+      } else if (_to[3] === "0") {
+        //上面
+        this.moveArrayElement(this.dataList, _formIndex, _toIndex);
+      } else if (_to[3] === "2") {
+        console.log("移到了空模块");
+      }
+
+      this.dialogTagList.forEach(i => {
+        let _data = this.dataList.filter(i2 => i2.Type === i.value);
+        let _fTIndex = i.value === 0 ? 2 : 0;
+        _data.forEach(i3 => {
+          if (this.dataList.find(i4 => i4.id === i3.id).tIndex != _fTIndex) {
+            this.dataList.find(i4 => i4.id === i3.id).tIndex = _fTIndex;
+          }
+          _fTIndex++;
+        });
+      });
+      this.$forceUpdate();
+      console.log("更换成功");
+    },
+    moveAnalysisCancel() {
+      this.isDrag = false;
+      this.dataList = JSON.parse(JSON.stringify(this.copyDataList));
+      this.copyDataList = [];
+    },
     init() {
       this.bmData = {};
       this.getDefaultData();
@@ -1460,6 +1334,7 @@ export default {
   width: 100%;
   height: calc(100vh - 123px);
   overflow: auto;
+  position: relative;
 }
 
 .a-d-top {

+ 20 - 53
src/components/pages/classroomObservation/index.vue

@@ -225,9 +225,26 @@ export default {
       tag: {
         0: "一",
         1: "二",
-        2: "三"
-      }
-    };
+        2: "三",
+				3: '四',
+				4: '五',
+				5: '六',
+				6: '七',
+				7:'八',
+				8:'九',
+				9:'十',
+				10:'十一',
+				11:'十二',
+				12:'十三',
+				13:'十四',
+				14:'十五',
+				15:'十六',
+				16:'十七',
+				17:'十八',
+				18:'十九',
+				19:'二十',
+    	},
+		}
   },
   methods: {
     //切换了课堂
@@ -505,56 +522,6 @@ export default {
 
         let analysisHtml = ``;
 
-        // tagList.forEach(i => {
-        //   let dire = `<div>`;
-        //   let tagHtml = `<div style="margin-bottom:100px">`;
-        //   if (i.value == 0) {
-        //     i.dataList = i.dataList.filter(i2 => i2.tIndex != 2);
-        //   }
-        //   i.dataList.sort((a, b) => a.tIndex - b.tIndex);
-
-        //   tagHtml += `<h1 style="font-size:16pt;margin-bottom:30px">${
-        //     this.tag[i.value]
-        //   }、${i.name}</h1>`;
-        //   dire += `<div style="font-size:14pt;margin:15px 0">${
-        //     this.tag[i.value]
-        //   }、${i.name}</div>`;
-        //   i.dataList.forEach(async (i2, i2Index) => {
-        //     tagHtml += `<h2 style="font-size:14pt;margin-bottom:20px">${i2Index +
-        //       1}、${
-        //       i2.jsonData.anotherName
-        //         ? i2.jsonData.anotherName
-        //         : i2.jsonData.name
-        //     }</h2>`;
-        //     dire += `<div style="font-size:11pt;margin:10px 0;margin-left:50px">${i2Index +
-        //       1}、${
-        //       i2.jsonData.anotherName
-        //         ? i2.jsonData.anotherName
-        //         : i2.jsonData.name
-        //     }</div>`;
-        //     if (showBrief) {
-        //       tagHtml += `<div style="font-size:10.5pt;font-style:italic;margin-bottom:10px;color:#6b798e">${i2.jsonData.result}</div>`;
-        //     }
-        //     if (i2.jsonData.eChartData) {
-        //       console.log(
-        //         await this.getEChartsImageSrc(i2.jsonData.eChartData)
-        //       );
-        //       // tagHtml += `<div>${await this.getEChartsImageSrc(
-        //       //   i2.jsonData.eChartData
-        //       // )}</div>`;
-        //       // tagHtml+=`<img src="${await this.getEChartsImageSrc(i2.jsonData.eChartData)}" style="width:400px;height:400px;"/>`
-        //     }
-        //     let _content = md.render(i2.jsonData.content);
-
-        //     tagHtml += `<div style="font-size:10.5pt;margin-bottom:10px">${_content}</div>`;
-        //   });
-
-        //   tagHtml += "</div>";
-        //   dire += "</div>";
-        //   analysisHtml += tagHtml;
-        //   directoryHtml += dire;
-        // });
-
         for (let c = 0; c < tagList.length; c++) {
           let i = tagList[c];
           let dire = `<div>`;