SanHQin před 1 týdnem
rodič
revize
8604deda59
1 změnil soubory, kde provedl 333 přidání a 0 odebrání
  1. 333 0
      src/components/pages/test/check/returnTestDialog.vue

+ 333 - 0
src/components/pages/test/check/returnTestDialog.vue

@@ -0,0 +1,333 @@
+<template>
+	<div>
+		<el-dialog
+			:center="true"
+			:visible.sync="show"
+			:close-on-click-modal="true"
+			:modal="true"
+			width="auto"
+			height="auto"
+      top="10vh"
+			:append-to-body="true"
+			class="dialog"
+		>
+			<div class="box">
+				<div class="b_head">
+					<span>退回表单</span>
+					<svg
+						@click="close()"
+						t="1748587270371"
+						class="icon"
+						viewBox="0 0 1024 1024"
+						version="1.1"
+						xmlns="http://www.w3.org/2000/svg"
+						p-id="5023"
+						width="200"
+						height="200"
+					>
+						<path
+							d="M0 0h1024v1024H0z"
+							fill="#FF0033"
+							fill-opacity="0"
+							p-id="5024"
+						></path>
+						<path
+							d="M240.448 168l2.346667 2.154667 289.92 289.941333 279.253333-279.253333a42.666667 42.666667 0 0 1 62.506667 58.026666l-2.133334 2.346667-279.296 279.210667 279.274667 279.253333a42.666667 42.666667 0 0 1-58.005333 62.528l-2.346667-2.176-279.253333-279.253333-289.92 289.962666a42.666667 42.666667 0 0 1-62.506667-58.005333l2.154667-2.346667 289.941333-289.962666-289.92-289.92a42.666667 42.666667 0 0 1 57.984-62.506667z"
+							fill="#fff"
+							p-id="5025"
+						></path>
+					</svg>
+				</div>
+				<div class="b_main" v-loading="loading" v-if="data">
+          <div>您将退回内容,并发送以下内容给提交人:</div>
+
+          <div>您提交的“<span>{{ title }}-{{ data.testName?data.testName:'提交记录' }}</span>”的内容已被管理员退回。点击表单链接进行修改后提交。</div>
+          <textarea placeholder="请输入" v-model="textValue"></textarea>
+				</div>
+				<div class="b_bottom">
+          <div @click="close()">取消</div>
+          <div class="b_b_submit" @click="submit()">确定</div>
+				</div>
+			</div>
+		</el-dialog>
+	</div>
+</template>
+
+<script>
+export default {
+  props:{
+    title:{
+      type:String,
+      default:""
+    }
+  },
+	data() {
+		return {
+			loading: false,
+			show: false,
+			data: null,
+      textValue:"",
+      userid:this.$route.query.userid
+		};
+	},
+	methods: {
+		open(data) {
+			this.data = JSON.parse(JSON.stringify(data));
+			this.loading = false;
+			this.show = true;
+		},
+		close() {
+			this.show = false;
+			this.init();
+		},
+		init() {
+			this.data = null;
+      this.textValue = "",
+			this.loading = false;
+		},
+    async submit(){
+      if(!this.textValue.trim()){
+        this.$message({
+          message: '请输入退回理由',
+          type: 'warning'
+        })
+        return
+      }
+
+    // 判断 window.location.href 是否包含 'beta'
+    this.loading = true;
+    let _url =""
+    let _betaUrl = "https://beta.pbl.cocorobo.cn/pbl-teacher-table/dist/#/"
+    let _mainUrl = "https://pbl.cocorobo.cn/pbl-teacher-table/dist/#/"
+    let _userInfo = await this.getUserInfo(this.data.userid)
+
+    if( window.location.href.indexOf('beta') !== -1){
+      _url = `${_betaUrl}doTest?cid=${this.data.courseid}&tid=${this.data.id}&userid=${this.data.userid}&oid=${_userInfo.organizeid}&org=${_userInfo.org}&type=3&role=${_userInfo.role}`
+    }else{
+      _url = `${_mainUrl}doTest?cid=${this.data.courseid}&tid=${this.data.id}&userid=${this.data.userid}&oid=${_userInfo.organizeid}&org=${_userInfo.org}&type=3&role=${_userInfo.role}`
+    }
+
+    let content = `您提交的“<a href="${_url}" target="_blank">${ this.title }-${ this.data.testName?this.data.testName:'提交记录' }</a>”的内容已被管理员退回。点击表单链接进行修改后提交。\n\n退回理由如下:\n\n${this.textValue}`
+
+    let params = [{
+      uid:this.userid,
+      title:`${this.title}表单已被退回`,
+      status:0,
+      type:"其他通知",
+      content:JSON.stringify({text:content}),
+      redUid:this.data.userid,
+      soc:"教师发展-年度考核"
+    }]
+
+
+    let _result  = await this.returnTestFn();
+    if(_result===0)return this.$message.error("退回失败")
+
+    this.ajax.post(this.$store.state.api+"insert_noticeCenter",params).then(res=>{
+      if(res.data==1){
+        this.$message({
+          message: '退回并发送通知成功',
+          type: 'success'
+        })
+        this.reviewChangeFn()
+        this.$emit("success")
+        this.close()
+      }else{
+        this.$message.error("发送通知失败")
+      }
+      this.loading=  false;
+
+    }).catch(err=>{
+      console.log(err)
+      this.$message.error("发送通知失败")
+      this.loading =false
+    })
+
+    },
+    getUserInfo(uid) {
+      let params = {
+        uid: uid,
+      };
+      return new Promise((resolve)=>{
+        this.ajax
+        .get(this.$store.state.api + "selectTestUser", params)
+        .then((res) => {
+          resolve(res.data[0][0])
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+      })
+    },
+    //退回
+    returnTestFn(){
+      let params = [{
+        id:this.data.id,
+        type:"4"
+      }];
+
+      return new Promise((resolve)=>{
+        this.ajax.post(this.$store.state.api+"update_testCourseWorks_typeById",params).then(res=>{
+          if(res.data==1){
+            resolve(1)
+          }else{
+            resolve(0)
+          }
+        }).catch(e=>{
+          console.log(e);
+          resolve(0)
+        })
+      })
+    },
+    //审核取消
+    reviewChangeFn(){
+      let params = [{
+        id:this.data.id,
+        isReview:0
+      }]
+
+      this.ajax.post(this.$store.state.api+"update_testCourseWorks_isReviewById",params).then(res=>{
+        console.log(res);
+      }).catch(e=>{
+        console.log(e);
+      })
+      // console.log(row);
+      // this.tableWorksArray.find(i=>i.id===row.id).isReview = "1";
+      // this.$forceUpdate()
+    },
+	},
+  mounted(){
+
+  },
+};
+</script>
+
+<style scoped>
+.dialog >>> .el-dialog {
+	width: 700px !important;
+	border-radius: 8px;
+	padding: 0;
+	background-color: #fff;
+	overflow: hidden;
+}
+
+.dialog >>> .el-dialog__body {
+	width: 700px !important;
+  height: 80vh;
+	height: auto;
+	flex-shrink: 0;
+	padding: 0;
+	box-sizing: border-box;
+	overflow: auto;
+}
+
+.dialog >>> .el-dialog__header {
+	display: none !important;
+}
+
+.box {
+	width: 700px;
+	height: 380px;
+	background: #fff;
+	border-radius: 15px;
+	box-shadow: 0px 6px 30px 5px rgba(0, 0, 0, 0.05),
+		0px 16px 24px 2px rgba(0, 0, 0, 0.04), 0px 8px 10px -5px rgba(0, 0, 0, 0.08);
+
+}
+
+.b_head {
+	width: 100%;
+	height: 50px;
+	/* border-radius: 15px 15px 0 0; */
+	background: #1A1A1A;
+	display: flex;
+	align-items: center;
+	justify-content: space-between;
+	box-sizing: border-box;
+	padding: 0 20px;
+  color: #fff;
+}
+
+.b_head > span {
+	font-size: 18px;
+	font-weight: bold;
+	color: #fff;
+}
+
+.b_head > img {
+	width: 20px;
+	height: 20px;
+	cursor: pointer;
+}
+
+.b_head > svg {
+	width: 20px;
+	height: 20px;
+	cursor: pointer;
+}
+
+.b_main {
+	width: 100%;
+	height: 250px;
+	background: #fff;
+	padding: 20px 20px 20px 20px;
+	box-sizing: border-box;
+  overflow: auto;
+  font-size:16px;
+}
+
+.b_bottom {
+	width: 100%;
+	height: 70px;
+	display: flex;
+	align-items: center;
+	justify-content: flex-end;
+	box-sizing: border-box;
+	padding: 0 20px;
+}
+
+.b_bottom>div{
+  padding: 10px 25px;
+  background: #fff;
+  color: #000;
+  border-radius: 4px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  border: solid 1px #EEEEEE;
+  margin-left: 15px;
+  cursor: pointer;
+  font-size: 16px;
+}
+
+.b_bottom>.b_b_submit{
+  background: #1A1A1A;
+  color: #D4D4D4;
+  border-color: #1A1A1A;
+}
+
+.b_main>div{
+  margin-top:20px;
+  font-size:16px;
+}
+.b_main>div>span{
+  color:#124BF6;
+  text-decoration:underline;
+}
+
+.b_main>textarea{
+  width: 100%;
+  height: 100px;
+  border-radius: 4px;
+  border: solid 1px #D4D4D4;
+  padding: 10px;
+  box-sizing: border-box;
+  margin-top: 20px;
+  resize: none;
+  transition: border-color 0.2s;
+}
+.b_main>textarea:focus {
+  border-color: #7AB8FF; /* 浅蓝色 */
+  outline: none;
+}
+</style>