Jelajahi Sumber

Merge branch 'feature_20250626_主管任务暂存' into release

zhujindu 5 bulan lalu
induk
melakukan
467ebdb915

+ 17 - 0
src/api/index.js

@@ -1013,3 +1013,20 @@ export function chainsList(query) {
     params: query,
   });
 }
+
+// 主管任务答案暂存接口(同主管任务答案保存接口一致,但是接口不校验答案是否必填)
+export function temporarilyCustomAnswer(data) {
+  return request({
+    url: 'mobile/summaryMobile/temporarilyCustomAnswer',
+    method: 'post',
+    data: data,
+  });
+}
+
+// 删除主管任务暂存
+export function deleteSummaryMobile(query) {
+  return request({
+    url: '/mobile/summaryMobile/' + query.userSummaryId,
+    method: 'delete',
+  });
+}

+ 5 - 0
src/router/index.js

@@ -435,6 +435,11 @@ const router = new VueRouter({
           name: 'VisitSummaryDetail',
           component: () => import('@/views/week/VisitSummaryDetail.vue'),
         },
+        {
+          path: '/VisitSummaryStorageDetail',
+          name: 'VisitSummaryStorageDetail',
+          component: () => import('@/views/week/VisitSummaryStorageDetail.vue'),
+        },
         {
           path: '/assignAwait',
           name: 'assignAwait',

+ 65 - 53
src/views/week/VisitSummary.vue

@@ -46,6 +46,13 @@
             @click="approvalStatusShow = true"
             arrow-direction="down" />
         </van-col>
+        <van-col span="12">
+          <van-cell
+            :title="storageStatus.text"
+            is-link
+            @click="storageStatusShow = true"
+            arrow-direction="down" />
+        </van-col>
       </van-row>
       <br />
       <van-button type="info" size="small" plain class="Btn100" @click="searchBtn">查找</van-button>
@@ -72,15 +79,20 @@
                 <p class="textLeft">{{ item.nickName }}的{{ item.summaryTaskName }}</p>
                 <div class="approvalStatusBtn" v-if="item.approvalStatus">
                   <span class="approvalStatusBtn1" v-if="item.approvalStatus == '2'">审批通过</span>
-                  <span class="approvalStatusBtn2" v-if="item.approvalStatus == '1'"
-                    >提交待审批</span
-                  >
-                  <span class="approvalStatusBtn3" v-if="item.approvalStatus == '3'"
-                    >拒绝待提交</span
-                  >
+                  <span class="approvalStatusBtn2" v-if="item.approvalStatus == '1'">
+                    提交待审批
+                  </span>
+                  <span class="approvalStatusBtn3" v-if="item.approvalStatus == '3'">
+                    拒绝待提交
+                  </span>
                 </div>
+                <div class="approvalStatusBtn" v-if="item.status == '0'">
+                  <span class="status0">暂存</span>
+                </div>
+              </div>
+              <div class="info">
+                部门:{{ item.deptName || item.regionName || item.companyName }}
               </div>
-              <div class="info">部门:{{ item.deptName }}</div>
               <div class="info">提交时间:{{ item.createTime }}</div>
             </div>
           </van-cell>
@@ -151,6 +163,14 @@
         @confirm="onSalesApprovalStatus"
         @cancel="approvalStatusShow = false" />
     </van-popup>
+    <!-- status:状态:1-待审批 2-审批通过 3-拒绝待提交 -->
+    <van-popup v-model="storageStatusShow" capture position="bottom">
+      <van-picker
+        show-toolbar
+        :columns="storageStatusList"
+        @confirm="onStorageStatus"
+        @cancel="storageStatusShow = false" />
+    </van-popup>
   </div>
 </template>
 
@@ -212,10 +232,17 @@ export default {
         { text: '拒绝待提交', value: '3' },
       ],
       approvalStatus: { text: '审批状态(全部)', value: '' },
+      storageStatus: { text: '提交状态(全部)', value: '' },
+      storageStatusList: [
+        // 0-暂存,1-已提交
+        { text: '提交状态(全部)', value: '' },
+        { text: '已提交', value: '1' },
+        { text: '暂存', value: '0' },
+      ],
+      storageStatusShow: false,
     };
   },
   activated() {
-    this.approvalStatus = this.approvalStatusList[0];
     this.userList = [];
     this.formData.startTime = this.getThreeDaysAgo();
     // this.formData.startTime = this.GetPreMonthDay(this.parseTime(new Date(), '{y}-{m}-{d}'),2)
@@ -273,46 +300,10 @@ export default {
   },
   watch: {
     $route(to, from) {
-      // if(to.path=="/VisitSummary"&&from.path!="/My/index"){
-      //     this.userList=[]
-      //     this.formData.pageNum=1
-      //     this.list = [];
-      //     this.tableList=[];
-      //     this.regionName="全部大区"
-      //     this.regionCode=""
-      //     this.deptName="全部销售部"
-      //     this.deptCode=""
-      //     this.userCode=""
-      //     this.userName="全部业务员"
-      //     this.powerGrade = localStorage.getItem("powerGrade")
-      //     this.getDeptInfo("dept")
-      //     if(this.powerGrade==5){
-      //       setTimeout(()=>{
-      //         if(this.$route.query.userCode==undefined){
-      //           this.companyName=this.companyList[0].deptName;
-      //           this.companyCode=this.companyList[0].deptId;}
-      //         this.getDeptInfo("dept",1)
-      //       },1000)
-      //     }
-      //     if(this.powerGrade==4){
-      //       setTimeout(()=>{
-      //         this.getDeptInfo("dept",1)
-      //       },1000)
-      //     }
-      //     if(this.powerGrade==3){
-      //       setTimeout(()=>{
-      //         this.getDeptInfo("dept",2)
-      //       },1000)
-      //     }
-      //     if(this.powerGrade==2||this.powerGrade==1){
-      //       setTimeout(()=>{
-      //         this.getDeptInfo("user")
-      //       },2000)
-      //     }
-      //     setTimeout(()=>{
-      //       this.searchBtn()
-      //     },1000)
-      //   }
+      if (from.path == '/My/index') {
+        this.approvalStatus = this.approvalStatusList[0];
+        this.storageStatus = this.storageStatusList[0];
+      }
     },
   },
   methods: {
@@ -346,6 +337,7 @@ export default {
       this.formData.deptId = this.deptCode; // 部门id,如果为周报或日报为必传  Long类型
       this.formData.userId = this.userCode; // 业务员id,如果为日报为必传      Long类型
       this.formData.approvalStatus = this.approvalStatus.value;
+      this.formData.status = this.storageStatus.value;
       queryHistorySummaryList(this.formData).then((res) => {
         loading1.clear();
         if (res.code == 200) {
@@ -487,13 +479,23 @@ export default {
       });
     },
     dailyFn(row) {
-      this.$router.push({
-        path: '/VisitSummaryDetail',
-        query: { userSummaryId: row.userSummaryId, source: 'VisitSummary' },
-      });
+      // 暂存
+      if (row.status == '0') {
+        this.$router.push({
+          path: '/VisitSummaryStorageDetail',
+          query: { userSummaryId: row.userSummaryId },
+        });
+      } else {
+        this.$router.push({
+          path: '/VisitSummaryDetail',
+          query: { userSummaryId: row.userSummaryId, source: 'VisitSummary' },
+        });
+      }
     },
     onClickLeft() {
-      this.$router.go(-1);
+      this.$router.replace({
+        path: '/My/index',
+      });
     },
     regionClick() {
       // if(this.powerGrade>4){
@@ -585,6 +587,10 @@ export default {
       this.approvalStatus = val;
       this.approvalStatusShow = false;
     },
+    onStorageStatus(val) {
+      this.storageStatus = val;
+      this.storageStatusShow = false;
+    },
   },
 };
 </script>
@@ -701,6 +707,12 @@ export default {
     .approvalStatusBtn3 {
       background-color: red;
     }
+    .status1 {
+      background-color: #07c160;
+    }
+    .status0 {
+      background-color: #ff976a;
+    }
   }
   .van-cell__title {
     overflow: hidden;

+ 60 - 23
src/views/week/VisitSummaryAdd.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="bgcolor">
+  <div class="bgcolor VisitSummaryAdd">
     <!--        顶部条-->
 
     <!--        顶部条-->
@@ -194,6 +194,7 @@
     </div>
     <br />
     <div class="tc" style="padding: 0 16px">
+      <van-button class="submitBtn" block type="primary" @click="onStorage"> 暂存 </van-button>
       <van-button class="submitBtn" block type="info" color="#0057ba" @click="onSubmit">
         提交汇报
       </van-button>
@@ -288,6 +289,7 @@ import {
   getSummaryMobileDeptInfo,
   getDeptsByUser,
   chainsList,
+  temporarilyCustomAnswer,
 } from '@/api/index';
 import zRadio from '@/components/zRadio2';
 import zCheckbox from '@/components/zCheckbox2';
@@ -463,6 +465,32 @@ export default {
     },
     onLoad() {},
     onSubmit() {
+      this.setParams(() => {
+        if (this.flagclick) {
+          this.flagclick = false;
+          this.timer = null;
+          this.timer = setTimeout(() => {
+            this.flagclick = true;
+          }, 2000);
+          insertCustomAnswer({
+            userSummaryId: '', //	Long	用户总结id,如果为新增则不填,编辑则必填
+            summaryId: this.$route.query.summaryId, //Long	主管任务id
+            customItemList: this.collectionItemList, //List<Object>	答案列表
+          })
+            .then((res) => {
+              if (res.code == 200) {
+                this.$router.go(-1);
+              } else {
+                this.$toast(res.msg);
+              }
+            })
+            .catch((err) => {
+              this.$toast(err.msg);
+            });
+        }
+      });
+    },
+    setParams(callback) {
       for (var c = 0; c < this.collectionAnswerlisd.length; c++) {
         for (var b = 0; b < this.collectionItemList.length; b++) {
           if (this.collectionAnswerlisd[c].id == this.collectionItemList[b].customId) {
@@ -491,28 +519,7 @@ export default {
       //   });
       //   JXSSataList.chainList = fileIdList;
       // }
-      if (this.flagclick) {
-        this.flagclick = false;
-        this.timer = null;
-        this.timer = setTimeout(() => {
-          this.flagclick = true;
-        }, 2000);
-        insertCustomAnswer({
-          userSummaryId: '', //	Long	用户总结id,如果为新增则不填,编辑则必填
-          summaryId: this.$route.query.summaryId, //Long	主管任务id
-          customItemList: this.collectionItemList, //List<Object>	答案列表
-        })
-          .then((res) => {
-            if (res.code == 200) {
-              this.$router.go(-1);
-            } else {
-              this.$toast(res.msg);
-            }
-          })
-          .catch((err) => {
-            this.$toast(err.msg);
-          });
-      }
+      callback && callback();
     },
     getReportInfo() {
       let loading1 = this.$toast.loading({
@@ -929,6 +936,26 @@ export default {
         }
       }
     },
+    // 暂存 不校验答案是否必填
+    onStorage() {
+      this.setParams(() => {
+        temporarilyCustomAnswer({
+          userSummaryId: '', //	Long	用户总结id,如果为新增则不填,编辑则必填
+          summaryId: this.$route.query.summaryId, //Long	主管任务id
+          customItemList: this.collectionItemList, //List<Object>	答案列表
+        })
+          .then((res) => {
+            if (res.code == 200) {
+              this.$router.go(-1);
+            } else {
+              this.$toast(res.msg);
+            }
+          })
+          .catch((err) => {
+            this.$toast(err.msg);
+          });
+      });
+    },
   },
 };
 </script>
@@ -987,6 +1014,16 @@ export default {
 .z-cell .van-cell__title {
   font-size: 16px;
 }
+.VisitSummaryAdd {
+  .tc {
+    display: flex;
+    justify-content: space-between;
+    .submitBtn {
+      width: 45%;
+      border-radius: 20px;
+    }
+  }
+}
 </style>
 <style lang="scss">
 .table-headermd {

+ 456 - 0
src/views/week/VisitSummaryStorageDetail.vue

@@ -0,0 +1,456 @@
+<template>
+  <div v-if="info" class="VisitSummaryDetail">
+    <div class="navBarTOP">
+      <van-nav-bar
+        class="navBar"
+        :title="info.summaryTaskName"
+        left-arrow
+        @click-left="onClickLeft"
+        right-text="删除"
+        @click-right="onDelete" />
+    </div>
+    <div class="lineGrey"></div>
+    <div class="lineGrey"></div>
+    <div class="lineGrey"></div>
+    <div class="lineGrey"></div>
+    <div class="lineGrey"></div>
+    <div class="lineGrey" style="height: 6px"></div>
+    <!--        主体内容-->
+    <div
+      class="container linep"
+      style="
+        background-color: #fff;
+        width: 94%;
+        margin: 0px auto;
+        border-radius: 6px;
+        padding: 10px;
+      ">
+      <div style="padding: 4px 0">
+        <van-icon :name="ry" size="16" style="float: left" />
+        <span style="font-size: 13px; margin-left: 8px"
+          >&nbsp;{{ info.nickName }} - {{ info.postName }}</span
+        >
+      </div>
+      <div style="padding: 4px 0">
+        <van-icon :name="zw" size="16" style="float: left" />
+        <span style="font-size: 13px; margin-left: 8px">&nbsp;所属部门:{{ info.deptName }}</span>
+      </div>
+      <div style="padding: 4px 0">
+        <van-icon :name="tm" size="16" style="float: left" />
+        <span style="font-size: 13px; margin-left: 8px">&nbsp;提交时间:{{ info.createTime }}</span>
+      </div>
+    </div>
+    <div class="lineGrey"></div>
+    <div
+      class="container linep"
+      style="background-color: #fff; width: 94%; margin: 0px auto; border-radius: 6px">
+      <!-- 编辑 -->
+      <componVisitSummary
+        :collectionItemLists="collectionItemLists"
+        :approvalStatus="info.approvalStatus"
+        ref="componVisitSummary"></componVisitSummary>
+    </div>
+    <br />
+    <div class="tc" style="padding: 0 16px">
+      <van-button class="submitBtn" block type="primary" @click="onStorage"> 暂存 </van-button>
+      <van-button class="submitBtn" block type="info" color="#0057ba" @click="onSubmit">
+        提交汇报
+      </van-button>
+    </div>
+    <br />
+    <br />
+    <br />
+  </div>
+</template>
+
+<script>
+import history from '@/assets/Icon/history.png';
+import tm from '@/assets/Icon/tm.png';
+import zw from '@/assets/Icon/zw.png';
+import ry from '@/assets/Icon/ry.png';
+import {
+  getSummaryMobilo,
+  insertCustomAnswer,
+  temporarilyCustomAnswer,
+  deleteSummaryMobile,
+} from '@/api/index';
+import { ImagePreview } from 'vant';
+import deleteUploadImg from '@/components/deleteUploadImg';
+import componVisitSummary from '@/views/week/componVisitSummary';
+export default {
+  name: 'daily',
+  components: { deleteUploadImg, componVisitSummary },
+  data() {
+    return {
+      info: null,
+      zw: zw,
+      tm: tm,
+      ry: ry,
+      show: true,
+      num: 0,
+      todayGoal: {},
+      progressWidth: 0,
+      history: history,
+      imgArr: [],
+      activeNames: ['1', '2', '3', '4', '5', '6', '7', '8', '10', '16', '17'],
+      value: '2',
+      message: '',
+      powerGrade: '',
+      Content: '',
+      Content2: '',
+      reportTargetAll: {},
+      reportContents: [{ dayContent: '' }],
+      reportTarget: {},
+      successContent: '',
+      imgList: [],
+      type: '-1',
+      collectionItemLists: [],
+      writeAgain: false,
+      approvalMessage: '',
+      source: '',
+      //
+    };
+  },
+  activated() {
+    this.source = this.$route.query.source || '';
+    this.powerGrade = localStorage.getItem('powerGrade');
+    this.getDetailById();
+    this.num = 0;
+    this.userTodayPlanNum();
+  },
+  methods: {
+    setApprovalStatus(status) {
+      if (status == '1') {
+        return '通过';
+      } else if (status == '2') {
+        return '拒绝';
+      }
+    },
+    pviewFn(val, imgVal) {
+      var imgList = [];
+      var photos = this.reportTarget.photos[val].photos;
+      for (let i = 0; i < photos.length; i++) {
+        imgList.push(photos[i].fileUrl);
+      }
+      ImagePreview({ images: imgList, startPosition: imgVal });
+    },
+    submint() {
+      this.$router.push({
+        path: '/daily',
+        query: { reportId: this.$route.query.reportId, temporaryShow: 'N' },
+      });
+    },
+    getDetailById() {
+      let loading1 = this.$toast.loading({
+        duration: 0,
+        message: '加载中...',
+        forbidClick: true,
+      });
+      getSummaryMobilo({ userSummaryId: this.$route.query.userSummaryId }).then((res) => {
+        loading1.clear();
+        this.reportTargetAll = res.data.reportTargetAll;
+        this.info = res.data;
+        this.type = res.data.userType;
+        if (res.data.status == 3) {
+          this.successContent = res.data.successContent;
+        } else {
+          this.successContent = res.data.failContent;
+        }
+        if (res.data.reportContents && res.data.reportContents.length > 0) {
+          this.Content = res.data.reportContents[0].dayContent;
+          if (res.data.reportContents.length > 1) {
+            this.Content2 = res.data.reportContents[1].dayContent;
+          } else {
+            this.Content2 = '';
+          }
+        } else {
+          this.Content = '';
+          this.Content2 = '';
+        }
+        this.reportContents = res.data.reportContents;
+        var imgList = [];
+        if (res.data.photos != null) {
+          for (var k = 0; k < res.data.photos.length; k++) {
+            imgList.push(res.data.photos[k].fileUrl + '');
+          }
+        }
+        this.imgList = imgList;
+        this.writeAgain = res.data.customItemList.some((item) => {
+          return item.allowWriteAgain;
+        });
+
+        this.collectionItemLists = res.data.customItemList;
+      });
+    },
+    userTodayPlanNum() {
+      // userTodayPlanNum().then((res) => {
+      //   if (res.code == 200) {
+      //     this.todayGoal = res.data;
+      //     this.progressWidth = (this.todayGoal.finishNum / this.todayGoal.planNum) * 100 + '%';
+      //     localStorage.setItem('nickName', res.data.user.nickName);
+      //     localStorage.setItem('storeType', res.data.user.type);
+      //   } else {
+      //     this.$toast.fail(res.msg);
+      //   }
+      // });
+    },
+    onClickLeft() {
+      this.$router.go(-1);
+    },
+    // 暂存 不校验答案是否必填
+    onStorage() {
+      this.setParams((collectionItemList) => {
+        temporarilyCustomAnswer({
+          userSummaryId: this.info.userSummaryId,
+          summaryId: this.info.summaryId, //Long	主管任务id
+          customItemList: collectionItemList, //List<Object>	答案列表
+        })
+          .then((res) => {
+            if (res.code == 200) {
+              this.$toast('操作成功!');
+              this.$router.replace({
+                path: '/VisitSummary',
+              });
+            } else {
+              this.$toast(res.msg);
+            }
+          })
+          .catch((err) => {
+            this.$toast(err.msg);
+          });
+      });
+    },
+    onSubmit() {
+      this.setParams((collectionItemList) => {
+        insertCustomAnswer({
+          userSummaryId: this.info.userSummaryId, //	Long	用户总结id,如果为新增则不填,编辑则必填
+          summaryId: this.info.summaryId, //Long	主管任务id
+          customItemList: collectionItemList,
+        })
+          .then((res) => {
+            if (res.code == 200) {
+              this.$toast('操作成功!');
+              this.$router.replace({
+                path: '/VisitSummary',
+              });
+            } else {
+              this.$toast(res.msg);
+            }
+          })
+          .catch((err) => {
+            this.$toast(err.msg);
+          });
+      });
+    },
+    setParams(callback) {
+      let collectionAnswerlisd = this.$refs.componVisitSummary.collectionAnswerlisd;
+      let collectionItemList = this.$refs.componVisitSummary.collectionItemList;
+      for (var c = 0; c < collectionAnswerlisd.length; c++) {
+        for (var b = 0; b < collectionItemList.length; b++) {
+          if (collectionAnswerlisd[c].id == collectionItemList[b].customId) {
+            collectionItemList[b].customOptionList = collectionAnswerlisd[c].value;
+          }
+        }
+      }
+      // // 照片
+      let zpDataList = collectionItemList.find((item) => item.answerType == 'zp');
+      if (zpDataList) {
+        let fileIdList = [];
+        zpDataList.fileInfoList.forEach((item) => {
+          fileIdList.push(item.id);
+        });
+        zpDataList.fileIdList = fileIdList;
+      }
+      callback && callback(collectionItemList);
+    },
+    // 删除
+    onDelete() {
+      this.$dialog
+        .confirm({
+          title: '提示',
+          message: '确定要删除吗?',
+          showCancelButton: true,
+        })
+        .then(() => {
+          deleteSummaryMobile({ userSummaryId: this.$route.query.userSummaryId })
+            .then((res) => {
+              if (res.code == 200) {
+                this.$toast('操作成功!');
+                this.onClickLeft();
+              } else {
+                this.$toast(res.msg);
+              }
+            })
+            .catch((err) => {
+              this.$toast(err.msg);
+            });
+        })
+        .catch(() => {});
+    },
+  },
+};
+</script>
+<style scoped lang="scss">
+.container {
+  background-color: white;
+}
+
+.van-f-red {
+  color: red;
+  width: 8px;
+  display: inline-block;
+  line-height: 26px;
+}
+
+.formLabel {
+  margin: 0 16px;
+  border-bottom: 1px solid #f1f1f1;
+}
+
+.formLabel .van-cell {
+  padding: 10px 0;
+}
+
+.formLabel .van-cell::after {
+  border: 0;
+}
+
+.formLabel .van-field {
+  border: 1px solid #f1f1f1;
+  padding: 6px;
+  width: 100%;
+  border-radius: 4px;
+  overflow: hidden;
+}
+
+.formLabel .van-field__control {
+  padding: 0 10px;
+}
+
+.formLabel .formLabeltitle {
+  position: absolute;
+  top: 8px;
+}
+
+.z-checkbox .van-radio {
+  padding: 6px 0;
+}
+.z-celly .van-cell__title {
+  font-weight: initial;
+  font-size: 14px;
+}
+.bottomBtn {
+  position: fixed;
+  bottom: 0;
+  z-index: 10;
+  height: 50px;
+  width: 100%;
+  display: flex;
+  flex-direction: row;
+  justify-content: space-around;
+  .van-button {
+    /* flex: 1; */
+    width: 40%;
+  }
+}
+.approvalRemarh {
+  width: 94%;
+  margin: 0px auto;
+  border-radius: 6px;
+  margin-bottom: 40px;
+  .approvalLabel {
+    font-size: 14px;
+    padding: 5px 0;
+  }
+}
+</style>
+<style lang="scss">
+.table-headermd {
+  font-size: 1.2rem;
+  text-align: center;
+  position: initial;
+  width: 94% !important;
+  margin: 0 auto;
+  border-right: 0;
+}
+
+.table-headermd .el-table__header,
+.table-headermd .el-table__body {
+  width: 100% !important;
+}
+
+.table-headermd col {
+  width: 5.8rem;
+}
+
+.table-headermd col:nth-child(2),
+.table-headermd col:nth-child(4),
+.table-headermd col:nth-child(3) {
+  width: 5rem;
+}
+
+.table-headermd .van-cell {
+  padding: 0 4px;
+  height: 100%;
+}
+
+.table-headermd th.el-table__cell > .cell {
+  padding: 0 4px;
+}
+
+.table-headermd th.el-table__cell {
+  background-color: #1989fa;
+  color: #fff;
+}
+
+.table-headermd .el-table__cell {
+  padding: 4px 0;
+}
+
+.table-headermd .tipTitle {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  display: -webkit-box;
+  -webkit-box-orient: vertical;
+  -webkit-line-clamp: 2;
+}
+
+.table-headermd::before {
+  height: 0;
+}
+
+.f-right {
+  text-align: right;
+  margin: 0;
+}
+
+.mg0 {
+  margin: 6px 10px;
+  color: #909090;
+  font-size: 14px;
+}
+
+.selesetText {
+  margin-bottom: 16px;
+}
+
+.z-cells .van-cell__title {
+  font-weight: bold;
+  color: #4a4a4a;
+}
+
+.z-cells .van-cell {
+  padding-bottom: 0;
+}
+
+.VisitSummaryDetail {
+  .tc {
+    display: flex;
+    justify-content: space-between;
+    .submitBtn {
+      width: 45%;
+      border-radius: 20px;
+    }
+  }
+}
+</style>