Procházet zdrojové kódy

fix: 批量核查bug修复

梦辉 před 3 měsíci
rodič
revize
e3a96312b6

+ 29 - 9
src/subPages/pages/commitment/commitmentDetail/index.vue

@@ -14,7 +14,21 @@ export default {
       currentStep: 0,
       batchCheckForm:{
         fileList:[]
-      }
+      },
+      checkResultColumns: [
+        {
+          text: '整改',
+          value: 1
+        },
+        {
+          text: '整改扣分',
+          value: 2
+        },
+        {
+          text: '符合',
+          value: 0
+        }
+      ]
     };
   },
   computed: {
@@ -36,6 +50,10 @@ export default {
       set(value) {
         this.$store.commit('template/setIndicatorList', value)
       }
+    },
+    /* 批量核查的列表,只有auditResult为3(未核查的)和approvalStatus已拒绝(0)的 */
+    batchCheckIndicatorList(){
+      return this.indicatorList.filter(item => item.auditResult === 3 || item.approvalStatus === 0)
     }
   },
   watch:{
@@ -82,16 +100,16 @@ export default {
     },
     onCheckResultSubmit(){
       const result = []
-      this.indicatorList.forEach(item => {
+      this.batchCheckIndicatorList.forEach(item => {
         result.push({
-          "uuid": item.item,
+          "uuid": item.uuid,
           "promiseId": item.promiseId,
           "indicatorId": item.indicatorId,
           "indicatorInput": item.indicatorInput,
           "indicatorInputBody": item.indicatorInputBody,
           "auditor": uni.getStorageSync("userInfo").realName,
-          "auditResult": this.batchCheckForm.auditResult,
-          "auditScore": this.batchCheckForm.auditScore,
+          "auditResult": this.checkResultColumns.find(item => item.text === this.batchCheckForm.auditResult)
+              && this.checkResultColumns.find(item => item.text === this.batchCheckForm.auditResult).value,
           "auditRemark": this.batchCheckForm.auditRemark,
           "expandStr": this.batchCheckForm.fileList.map(item => item.uuid).join(','),
         })
@@ -100,6 +118,7 @@ export default {
         if (res.code === 0) {
           this.$toast('核查成功')
           this.actionSheetShow = false
+          this.batchCheckForm={}
           await this.$store.dispatch('template/getPromiseDetail', this.$route.query.uuid)
         }else{
           this.$toast('核查失败' + res.msg)
@@ -120,20 +139,21 @@ export default {
         <InputComponents v-else-if="item.base.moduleName === 'Input'" :index="index"></InputComponents>
         <DividerComponents v-else-if="item.base.moduleName === 'divider'" :index="index"></DividerComponents>
       </view>
-      <view class="commit-title" @click="handleBatchCommitment">批量核查</view>
+      <view class="commit-title" v-if="batchCheckIndicatorList.length > 0" @click="handleBatchCommitment">批量核查</view>
       <IndicatorComponents></IndicatorComponents>
     </view>
     <view class="page-bottom">
       <van-button plain type="primary" @click="handleClose">关闭</van-button>
       <van-button v-if="!noDownload" type="info" @click="handleDownPdf">下载PDF</van-button>
     </view>
-    <van-action-sheet v-model="actionSheetShow" title="标题">
+    <van-action-sheet v-model="actionSheetShow" title="批量核查">
       <div class="content">
         <view v-show="currentStep === 0" class="first-step">
           <van-checkbox
               shape="square"
-              v-for="(item,index) in indicatorList" :key="index" :name="index"
-              v-model="indicatorList[index].selectValue">
+              style="margin-top: 20px"
+              v-for="(item,index) in batchCheckIndicatorList" :key="index" :name="index"
+              v-model="batchCheckIndicatorList[index].selectValue">
             {{ item.indicatorInputBody }}
           </van-checkbox>