Selaa lähdekoodia

添加新纪录修改判断

yuanyiming 1 vuosi sitten
vanhempi
commit
c1cda29bf9
2 muutettua tiedostoa jossa 114 lisäystä ja 35 poistoa
  1. 7 2
      src/views/eva/studentDetail.vue
  2. 107 33
      src/views/eva/studentEvaluate.vue

+ 7 - 2
src/views/eva/studentDetail.vue

@@ -84,7 +84,7 @@
           <img class="img" src="../../assets/images/eva/Frame (4).png" alt="" />
           <div>观察记录</div>
         </div>
-        <div style="display: flex;justify-content: flex-end;align-items: center;">
+        <div class="weiSelectCss">
           <!-- <selectStyle
             ref="weiSel"
             @shadeIsShow="shadeIsShow"
@@ -347,7 +347,7 @@ export default {
           a.text = e.name
           this.stuDetailList.push(a)
         })
-        console.log('学生列表', this.stuDetailList)
+        // console.log('学生列表', this.stuDetailList)
         // console.log('获取班学生列表', this.stuList)
         // 查询学生在数组中的位置
         this.num = this.stuList.indexOf(this.stuId)
@@ -653,6 +653,11 @@ export default {
   // left: 0;
 }
 
+.weiSelectCss {
+  display: flex;
+  justify-content: flex-end;
+  align-items: center;
+}
 /deep/.van-dropdown-menu__bar {
   box-shadow: none;
   padding-right: 20px;

+ 107 - 33
src/views/eva/studentEvaluate.vue

@@ -167,26 +167,38 @@
       </template>
     </pop>
 
-    <pop v-show="repShowMask">
+    <pop v-show="addNewShowMask">
       <template v-slot:tit>提示</template>
-      <template v-slot:con v-if="!shareShow">确定{{ repMaskNum ? '添加新纪录' : '重复添加' }}吗?</template>
-      <template v-slot:con v-else>{{ repMaskNum ? '是否保存当前纪录' : '确定重复添加吗' }} ?</template>
+      <template v-slot:con v-if="!shareShow"> 是否添加新纪录 ?</template>
+      <template v-slot:con v-else> 是否保存当前纪录 ?</template>
+
       <template v-slot:btn1>
-        <div class="btn" style="color: rgba(136,136,136,1);" v-if="shareShow" @click="repShowMask = false">
-          {{ repMaskNum ? '不保存' : '取消' }}
+        <div class="btn" style="color: rgba(136,136,136,1);" v-if="!shareShow" @click="addNewShowMask = 0">
+          {{ shareShow ? '不保存' : '取消' }}
         </div>
-        <div class="btn" style="color: rgba(136,136,136,1);" v-else @click="repShowMask = false">
-          取消
+        <div class="btn" v-else style="color: rgba(136,136,136,1);" @click="noSave">
+          {{ shareShow ? '不保存' : '取消' }}
         </div>
       </template>
       <template v-slot:btn2>
         <!-- 新纪录 -->
-        <div class="btn" v-if="repMaskNum" style="color: rgba(251,67,25,1);" @click="AddNewRecord">
+        <div class="btn" style="color: rgba(251,67,25,1);" @click="AddNewRecord">
           {{ shareShow ? '保存' : '确认' }}
         </div>
+      </template>
+    </pop>
 
+    <pop v-show="repShowMask">
+      <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="repShowMask = false">
+          取消
+        </div>
+      </template>
+      <template v-slot:btn2>
         <!-- 重复添加 -->
-        <div class="btn" v-else style="color: rgba(251,67,25,1);" @click="repAddRecord">确认</div>
+        <div class="btn" style="color: rgba(251,67,25,1);" @click="repAddRecord">确认</div>
       </template>
     </pop>
 
@@ -254,8 +266,10 @@ export default {
       studentInfo: {},
       classEspNum: false,
       repShowMask: false,
-      // 重复添加弹出框判断
-      repMaskNum: 0,
+      // // 重复添加弹出框判断
+      // repMaskNum: 0,
+      // 添加新纪录弹框判断
+      addNewShowMask: 0,
       // 返回页面时进行提示
       backShowMask: false,
       // 学生信息
@@ -322,7 +336,7 @@ export default {
 
       selectStudentDetail(stuData).then(res => {
         this.studentInfo = res[0][0]
-        console.log('获取学生信息', this.studentInfo)
+        // console.log('获取学生信息', this.studentInfo)
 
         // 获取班学生列表
         const data2 = {
@@ -449,28 +463,88 @@ export default {
 
       this.isShowMask = true
     },
-
+    // 添加新纪录弹框的不保存按钮
+    noSave() {
+      this.selectSData = []
+      this.selectWData = []
+      this.getPresentDate()
+      this.place = ''
+      this.observeCon = ''
+      this.recordCon = ''
+      this.imgList = []
+      this.placeId = 1
+      this.addNewShowMask = 0
+      this.shareShow = 0
+    },
     // 添加新纪录进行判断
     repetitionSave(e) {
-      // let isOk = 0
-      // this.getPresentDate()
-
       if (this.selectWData.length === 0) return (this.wei = true)
 
-      // let conVal = []
-      // if (this.oldRecordData.contact !== '') {
-      //   conVal = this.oldRecordData.contact.split(',')
-      // }
-
-      // console.log(this.arraysAreEqual(this.selectSData, conVal))
-      // console.log(this.year == this.oldRecordData.term)
+      if (this.shareShow) {
+        let isOk = 1
+        let conVal = []
+        let imgVal = []
+        let typeVal = []
+        if (this.oldRecordData.contact !== '') {
+          conVal = this.oldRecordData.contact.split(',')
+        }
+        if (this.oldRecordData.type !== '') {
+          typeVal = this.oldRecordData.type.split(',')
+        }
+        if (this.oldRecordData.recordImg !== '') {
+          imgVal = this.oldRecordData.recordImg.split(',')
+        }
 
-      // this.oldRecordData.contact
-      // console.log('this.oldRecordData', this.oldRecordData)
+        if (!this.arraysAreEqual(this.selectSData, conVal)) {
+          isOk = 0
+          console.log(isOk)
+        }
+        if (!(this.termData[0] === this.oldRecordData.term)) {
+          isOk = 0
+          console.log(isOk)
+        }
+        if (!this.arraysAreEqual(this.selectWData, typeVal)) {
+          isOk = 0
+          console.log(isOk)
+        }
+        if (!(this.visitTime === this.oldRecordData.recordDate)) {
+          isOk = 0
+          console.log(isOk)
+        }
+        if (!(this.place === this.oldRecordData.place)) {
+          isOk = 0
+          console.log(isOk)
+        }
+        if (!(this.placeId === this.oldRecordData.placeId)) {
+          isOk = 0
+          console.log(isOk)
+        }
+        if (!(this.observeCon === this.oldRecordData.recordTit)) {
+          isOk = 0
+          console.log(isOk)
+        }
+        if (!(this.recordCon === this.oldRecordData.recordContent)) {
+          isOk = 0
+          console.log(isOk)
+        }
+        if (!this.arraysAreEqual(this.imgList, imgVal)) {
+          isOk = 0
+          console.log(isOk)
+        }
+        if (isOk) {
+          console.log('111')
+          this.AddNewRecord()
+          return
+        }
+        this.addNewShowMask = 1
+        return
+        // this.repMaskNum = e
+        // this.repShowMask = true
+      }
+      this.addNewShowMask = 1
 
-      // if (isOk === 1) return
-      this.repMaskNum = e
-      this.repShowMask = true
+      // this.repMaskNum = e
+      // this.repShowMask = true
     },
     arraysAreEqual(arr1, arr2) {
       return JSON.stringify(arr1) === JSON.stringify(arr2)
@@ -483,7 +557,7 @@ export default {
       }
       selectSTEPlace(data).then(res => {
         // this.filtrate = res[0]
-        console.log('getRecordPlace', res)
+        // console.log('getRecordPlace', res)
         var ptype = res[0] // 公共子级分类
         var pctype = res[1] // 该学校子级分类
         var potype = res[2] // 组织子级分类
@@ -564,7 +638,7 @@ export default {
       // }
       if (isOk === 1) return
 
-      this.repMaskNum = e
+      // this.repMaskNum = e
       this.repShowMask = true
       // this.recordCon = ''
       // this.imgList = []
@@ -593,7 +667,7 @@ export default {
       // this.isShowMask = false
 
       insertRecord(data).then(res => {
-        console.log(res)
+        // console.log(res)
         if (res === 1) {
           this.$toast({
             message: '重复添加成功',
@@ -619,7 +693,7 @@ export default {
     },
     // 添加新纪录
     AddNewRecord() {
-      this.repShowMask = false
+      this.addNewShowMask = 0
       this.shareShow = 0
       const data = [
         {
@@ -807,7 +881,7 @@ export default {
       let minutes = currentTime.getMinutes()
       minutes = (minutes < 10 ? '0' : '') + minutes
 
-      console.log(year, month, day, hours, minutes)
+      // console.log(year, month, day, hours, minutes)
       this.visitTime = `${year}-${month}-${day} ${hours}:${minutes}`
       // console.log(this.visitTime)
     },