فهرست منبع

重复添加与添加新纪录

yuanyiming 1 سال پیش
والد
کامیت
f485751f72
2فایلهای تغییر یافته به همراه117 افزوده شده و 29 حذف شده
  1. 1 1
      src/views/eva/components/ImageComponent.vue
  2. 116 28
      src/views/eva/studentEvaluate.vue

+ 1 - 1
src/views/eva/components/ImageComponent.vue

@@ -25,7 +25,7 @@
 
     <pop v-show="repShowMask">
       <template v-slot:tit>提示</template>
-      <template v-slot:con>确定删除吗</template>
+      <template v-slot:con>确定删除吗</template>
       <template v-slot:btn1>
         <div class="btn" style="color: rgba(136,136,136,1);" @click="repShowMask = false">取消</div>
       </template>

+ 116 - 28
src/views/eva/studentEvaluate.vue

@@ -26,7 +26,9 @@
       </div>
       <div class="claName">
         <div class="tit">班级</div>
-        <div class="studentName">{{ studentInfo.cname }}</div>
+        <div class="studentName classEspCss" :style="{ whiteSpace: classEspNum ? 'wrap' : 'nowrap' }" @click="classEsp">
+          {{ studentInfo.cname }}
+        </div>
       </div>
 
       <div class="claName">
@@ -147,8 +149,8 @@
       <!-- <div class="btn" @click="isShowMask = true">删除</div> -->
       <!-- <div class="btn" v-if="shareShow" @click="repPop">重复添加</div>
       <div class="btn" v-if="shareShow" @click="repetitionSave">添加新纪录</div> -->
-      <div class="btn" @click="repPop">重复添加</div>
-      <div class="btn" @click="repetitionSave">添加新纪录</div>
+      <div class="btn" @click="repPop(0)">重复添加</div>
+      <div class="btn" @click="repetitionSave(1)">添加新纪录</div>
       <div class="btn" v-if="!shareShow" @click="save">发布并返回</div>
       <div class="btn" v-else @click="amend">修改并返回</div>
     </div>
@@ -167,15 +169,30 @@
 
     <pop v-show="repShowMask">
       <template v-slot:tit>提示</template>
-      <template v-slot:con>确定添加新纪录吗?</template>
+      <template v-slot:con>确定{{ repMaskNum ? '添加新纪录' : '重复添加' }}吗?</template>
       <template v-slot:btn1>
         <div class="btn" style="color: rgba(136,136,136,1);" @click="repShowMask = false">取消</div>
       </template>
       <template v-slot:btn2>
-        <div class="btn" style="color: rgba(251,67,25,1);" @click="repAddRecord">确认</div>
+        <!-- 新纪录 -->
+        <div class="btn" v-if="repMaskNum" style="color: rgba(251,67,25,1);" @click="AddNewRecord">确认</div>
+
+        <!-- 重复添加 -->
+        <div class="btn" v-else style="color: rgba(251,67,25,1);" @click="repAddRecord">确认</div>
       </template>
     </pop>
 
+    <!-- <pop v-show="repAddShowMask">
+      <template v-slot:tit>提示</template>
+      <template v-slot:con>确定重复添加吗?</template>
+      <template v-slot:btn1>
+        <div class="btn" style="color: rgba(136,136,136,1);" @click="repAddShowMask = false">取消</div>
+      </template>
+      <template v-slot:btn2>
+        <div class="btn" style="color: rgba(251,67,25,1);" @click="repAddShowMaskRecord">确认</div>
+      </template>
+    </pop> -->
+
     <pop v-show="backShowMask">
       <template v-slot:tit>提示</template>
       <template v-slot:con>是否放弃当前编辑内容?</template>
@@ -227,9 +244,10 @@ export default {
   data() {
     return {
       studentInfo: {},
-
-      // 重复添加弹出框判断
+      classEspNum: false,
       repShowMask: false,
+      // 重复添加弹出框判断
+      repMaskNum: 0,
       // 返回页面时进行提示
       backShowMask: false,
       // 学生信息
@@ -281,6 +299,10 @@ export default {
   },
 
   methods: {
+    classEsp() {
+      this.classEspNum = !this.classEspNum
+      // console.log('点击了');
+    },
     getData() {
       // 获取学生信息
       const stuData = {
@@ -416,26 +438,18 @@ export default {
 
       this.isShowMask = true
     },
-    // 重复添加
-    repPop() {
-      this.recordCon = ''
-      this.imgList = []
-      this.getPresentDate()
-    },
+
     // 添加新纪录进行判断
-    repetitionSave() {
-      let isOk = 0
+    repetitionSave(e) {
+      // let isOk = 0
 
-      if (this.selectWData.length === 0) {
-        this.wei = true
-        isOk = 1
-      }
+      if (this.selectWData.length === 0) return
       // if (this.visitTime === '') {
       //   this.tim = true
       //   isOk = 1
       // }
-      if (isOk === 1) return
-
+      // if (isOk === 1) return
+      this.repMaskNum = e
       this.repShowMask = true
     },
     // 获取记录地点
@@ -513,8 +527,77 @@ export default {
 
       this.isShowMask = true
     },
-    // 添加新纪录
+    // 重复添加弹窗框
+    repPop(e) {
+      let isOk = 0
+      // console.log(this.$store.state);
+      if (this.selectWData.length === 0) {
+        this.wei = true
+        isOk = 1
+      }
+      // if (this.visitTime === '') {
+      //   this.tim = true
+      //   isOk = 1
+      // }
+      if (isOk === 1) return
+
+      this.repMaskNum = e
+      this.repShowMask = true
+      // this.recordCon = ''
+      // this.imgList = []
+      // this.getPresentDate()
+    },
+    // 确定重复添加
     repAddRecord() {
+      // this.shareShow = 0
+      this.repShowMask = false
+      const data = [
+        {
+          // uid: localStorage.getItem('userId'),
+          uid: this.studentInfo.userid,
+          tid: this.$store.state.user.userinfo.userid,
+          contact: this.selectSData.join(','),
+          type: this.selectWData.join(','),
+          timing: this.visitTime,
+          place: this.place,
+          observeCon: this.observeCon,
+          recordCon: this.recordCon,
+          imgList: this.imgList.join(','),
+          term: this.termData[0],
+          pid: this.placeId
+        }
+      ]
+      // this.isShowMask = false
+
+      insertRecord(data).then(res => {
+        console.log(res)
+        if (res === 1) {
+          this.$toast({
+            message: '重复添加成功',
+            type: 'success'
+          })
+          // this.shareShow = 0
+          this.recordCon = ''
+          this.imgList = []
+          this.getPresentDate()
+          // this.selectSData = []
+          // this.selectWData = []
+          // this.getPresentDate()
+          // this.place = ''
+          // this.observeCon = ''
+          // this.recordCon = ''
+          // this.imgList = ''
+          // this.repShowMask = false
+          // setTimeout(() => {
+          //   this.$router.replace('/studentDetail')
+          // }, 1000)
+        }
+      })
+    },
+    // 添加新纪录
+    AddNewRecord() {
+      this.repShowMask = false
+      this.shareShow = 0
       const data = [
         {
           // uid: localStorage.getItem('userId'),
@@ -532,7 +615,7 @@ export default {
         }
       ]
       // return console.log(data)
-      this.isShowMask = false
+      // this.isShowMask = false
 
       // return console.log(data)
 
@@ -549,11 +632,11 @@ export default {
           this.place = ''
           this.observeCon = ''
           this.recordCon = ''
-          this.imgList = ''
-          this.repShowMask = false
-          setTimeout(() => {
-            this.$router.replace('/studentDetail')
-          }, 1000)
+          this.imgList = []
+          this.placeId = 1
+          // setTimeout(() => {
+          //   this.$router.replace('/studentDetail')
+          // }, 1000)
         }
       })
     },
@@ -886,6 +969,11 @@ export default {
       // align-items: center;
       border-bottom: 1px solid #e7e7e7;
     }
+    .classEspCss {
+      white-space: nowrap;
+      overflow: hidden;
+      text-overflow: ellipsis;
+    }
     .studentName2 {
       flex: 1;
       width: 100%;