ソースを参照

新增查看报工

Lijy 1 年間 前
コミット
4d4b5939da

+ 7 - 3
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/components/chooseSomeone.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="chooseSomeone">
-    <p style="line-height: 30px;text-align: center;">请选择要{{type?'替换':'新增'}}的人员</p>
+    <p style="line-height: 30px;text-align: center;" v-if="typeSHow">请选择要{{type?'替换':'新增'}}的人员</p>
     <div class="chooseSomeone_selsect">
       <van-search v-model.trim="selectValue" shape="round" background="#F4F4F4" placeholder="请输入姓名" @search="onSearch"
         @input="onSearch"></van-search>
@@ -87,8 +87,12 @@ export default {
     },
     type:{
       type:Number,
-      default:()=> 0//0新增 1换人
-    }
+      default:()=> 0//0新增 1换人,
+    },
+    typeSHow:{
+      type: Boolean,
+      default:()=> true, 
+    },
   },
   components: {},
   data() {

+ 17 - 1
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/index/index.vue

@@ -7,7 +7,8 @@
         </van-swipe>
         <van-grid :column-num="3">
             <van-grid-item v-for="(item, index) in routers" :key="index" :icon="item.icon" :text="item.name"
-                :info="(item.name == '消息记录' && unreadNum > 0) ? unreadNum : ''" :to="item.url" @click="pfdClick(item)">
+                :info="(item.name == '消息记录' && unreadNum > 0) ? unreadNum : ''" @click="pfdClick(item)">
+                <!-- :info="(item.name == '消息记录' && unreadNum > 0) ? unreadNum : ''" :to="item.url" @click="pfdClick(item)"> -->
             </van-grid-item>
         </van-grid>
         <div v-if="isCorpWX" class="kefu" @click="tokefu"><img src="../../assets/icon/kefu.png" alt=""></div>
@@ -109,6 +110,15 @@ export default {
                 // 将要传过去的值
                 this.previewPDF(url, name)
             }
+
+            if(item.name != '使用说明') {
+                this.$router.push({
+                    path: item.url,
+                    query: {
+                        name: item.name
+                    }
+                })
+            }
         },
         // 预览pdf
         previewPDF(url, name) {
@@ -181,6 +191,12 @@ export default {
               }
             });
             const routersList = [
+                {
+                    name: '查看报工',
+                    moudelName: '查看报工',
+                    url: '/report',
+                    icon: 'balance-list-o'
+                },
                 {
                     name: '今日计划',
                     moudelName: '今日计划',

+ 204 - 14
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/workView/workView.vue

@@ -1,17 +1,35 @@
 <template>
   <div class="distribution">
-    <van-nav-bar title="报工" left-text="返回" @click-left="back" fixed left-arrow />
+    <van-nav-bar :title="reportBoolean ? '查看报工' : '报工'" left-text="返回" @click-left="back" fixed left-arrow />
     <div class="distribution_con contentRoll">
-      <div>
-        <van-field v-model="vehicleNum" type="digit" label="车辆序号" @blur="getMyPlanProcedureList()"/>
+      <!-- 报工 -->
+      <div v-if="!reportBoolean">
+        <van-field v-model="vehicleNum" type="digit" label="车辆序号" @blur="getMyPlanProcedureList()" />
       </div>
+      <!-- 查看报工 -->
+      <div v-if="reportBoolean">
+        <van-cell title="日期" :value="reportDate" @click="reportDateShow = true" is-link />
+        <van-cell title="人员" :value="personnelName" @click="popupShow = true" is-link>
+          <template #right-icon>
+            <div class="vanCellIcon">
+              <van-icon name="cross" class="search-icon" v-if="personnelName" color="#969799" @click.stop="clearName" />
+              <van-icon name="arrow" class="search-icon" v-else color="#969799" />
+            </div>
+          </template>
+        </van-cell>
+      </div>
+      <!-- 内容 -->
       <van-empty v-if="myPlanProcedureList.length == 0">暂无待报工任务</van-empty>
       <div v-for="(prod, prodIndex) in myPlanProcedureList" :key="prodIndex">
         <div class="distribution_header">
-          <div class="textDis">{{ prod.plan_type == 0 ? prod.product_name : prod.task_name }}</div>
+          <div class="textDis">
+            <span>{{ prod.plan_type == 0 ? prod.product_name : prod.task_name }}</span>
+            <span v-if="reportBoolean">{{ prod.userName }}</span>
+          </div>
           <div v-if="prod.plan_type == 0">{{ prod.product_scheduling_num }}</div>
-          <div>{{ prod.start_date.replace(/-/g, '') }}-{{!prod.end_date?"":prod.end_date.replace(/-/g, '') }}</div>
-          <div v-if="prod.vehicle_num_start &&  prod.vehicle_num_end">{{ prod.vehicle_num_start }}-{{ prod.vehicle_num_end }}</div>
+          <div>{{ prod.start_date.replace(/-/g, '') }}-{{ !prod.end_date ? "" : prod.end_date.replace(/-/g, '') }}</div>
+          <div v-if="prod.vehicle_num_start && prod.vehicle_num_end">{{ prod.vehicle_num_start }}-{{ prod.vehicle_num_end
+          }}</div>
         </div>
         <div class="distribution_box" v-for="item, index in prod.procedureList" :key="index" @click="reportItem(item)">
           <div>
@@ -22,13 +40,24 @@
             </van-row>
             <div style="margin-top:10px;text-align: center;">
               <van-row gutter="20">
-                <van-col span="8">
+                <!-- <van-col span="8">
                   <div class="valueCls">
                     {{ item.progress }}%
                   </div>
                   <div class="labelCls">
                     进度
                   </div>
+                </van-col> -->
+                <van-col span="8">
+                  <div class="valueCls" v-if="reportBoolean">
+                    {{ (item.finishNum && item.finishNum) ? item.finishNum : 0 }}
+                  </div>
+                  <div class="valueCls" v-if="!reportBoolean">
+                    {{ num }}
+                  </div>
+                  <div class="labelCls">
+                    件数
+                  </div>
                 </van-col>
                 <van-col span="8">
                   <div class="valueCls">
@@ -54,14 +83,20 @@
     </div>
     <!-- 弹出层选人 -->
     <van-popup v-model="popupShow" round position="bottom" :style="{ height: '80%', background: '#F4F4F4' }">
+      <ChooseSomeone ref="ChooseSomeone" :groupView="1" :typeSHow="false" @ChooseSomeoneChanhe="chooseSomeoneChanhe"
+        :peopleListId="[personnelId]" :peopleList="crewMember" v-if="popupShow"></ChooseSomeone>
     </van-popup>
+    <!-- 日期 -->
+    <van-calendar v-model="reportDateShow" :min-date="minDate" @confirm="reportDateOnConfirm" />
   </div>
 </template>
 
 <script>
+import ChooseSomeone from '../../components/chooseSomeone.vue'
 export default {
   props: {},
   components: {
+    ChooseSomeone
   },
   data() {
     return {
@@ -71,13 +106,29 @@ export default {
       popupShow: false,
       titleText: '今日计划', // 默认文字
       todayAndTomorrow: true, // true 今日计划,false 明日计划
-      vehicleNum:null
+      vehicleNum: null,
+      reportBoolean: false, // false 报工, true 查看报工
+      reportDateShow: false, // 报工日期弹出层
+      minDate: new Date(2010, 0, 1),
+      reportDate: this.formatDate(new Date()), // 报工日期
+      personnelName: '', // 人员姓名
+      personnelId: '', // 人员id
+      crewMember: [], // 班组人员列表
+      userInfo: JSON.parse(localStorage.userInfo),
     };
   },
   computed: {},
   watch: {},
   created() { },
   mounted() {
+    const { name } = this.$route.query;
+    this.reportBoolean = name == '查看报工' ? true : false;
+    if (this.reportBoolean) {
+      const { id, name } = this.userInfo
+      this.personnelName = name
+      this.personnelId = id
+      this.getCrewMemberList()
+    }
     this.getMyPlanProcedureList();
   },
   methods: {
@@ -92,24 +143,114 @@ export default {
       this.distributionIndex = index
       this.popupShow = true
     },
-
+    getCrewMemberList() {
+      this.$axios.post('/department/getMyManageUserList', {
+        date: this.reportDate,
+      })
+        .then(res => {
+          if (res.code == "ok") {
+            this.crewMember = res.data.map(item => {
+              return {
+                name: item.name,
+                id: item.id,
+                jobNumber: item.jobNumber,
+                phone: item.phone
+              }
+            })
+          } else {
+            this.$toast.fail(res.msg);
+          }
+        }).catch(err => { this.$toast.clear(); });
+    },
     getMyPlanProcedureList() {
       const toast = this.$toast.loading({
         forbidClick: true,
         duration: 0
       });
-      this.$axios.post("/plan-procedure-total/getReportForWorkList", {
-        vehicleNum:this.vehicleNum
-      })
+
+      let urls = ''
+      let params = {}
+      console.log('查看 ==>', this.reportBoolean, typeof this.reportBoolean)
+      if (this.reportBoolean) {
+        urls = '/report/getReportList'
+        params = {
+          // date: '2023-11-20',
+          // userId: '8377462629387460613'
+          date: this.reportDate,
+          userId: this.personnelId
+        }
+      } else {
+        urls = '/plan-procedure-total/getReportForWorkList'
+        params = {
+          vehicleNum: this.vehicleNum
+        }
+      }
+
+      this.$axios.post(urls, params)
         .then(res => {
           if (res.code == "ok") {
             this.$toast.clear();
-            this.myPlanProcedureList = res.data;
+            if (this.reportBoolean) {
+              this.myPlanProcedureList = this.handleData(res.data);
+              console.log(this.handleData(res.data))
+            } else {
+              this.myPlanProcedureList = res.data;
+            }
           } else {
             this.$toast.clear();
             this.$toast.fail(res.msg);
           }
         }).catch(err => { this.$toast.clear(); });
+
+      // this.$axios.post("/report/getReportList", {
+      //   date: '2023-11-20',
+      //   userId: '8377462629387460613'
+      // })
+      // this.$axios.post("/plan-procedure-total/getReportForWorkList", {
+      //   vehicleNum:this.vehicleNum
+      // })
+    },
+
+    handleData(data) {
+      let newList = []
+      for (var j in data) {
+        const it = data[j].data
+        let obj = {}
+        let arr = []
+        for (var i in it) {
+          const item = it[i]
+          obj = {
+            end_date: item.endDate,
+            plan_id: item.planId,
+            plan_type: item.planType,
+            plan_name: item.planName,
+            product_name: item.productName,
+            product_scheduling_num: item.productSchedulingNum,
+            start_date: item.startDate.join('-'),
+            task_change_notice_num: item.taskChangeNoticeNum,
+            task_name: item.taskName,
+            task_type_name: item.taskTypeName,
+            vehicle_num_end: item.vehicleNumEnd,
+            vehicle_num_start: item.vehicleNumStart,
+          }
+          arr.push({
+            check_type: item.checkType,
+            checker_id: item.checkerId,
+            checker_name: item.checkerName,
+            job_of_money: item.jobOfMoney,
+            plan_check_type: item.planCheckType,
+            procedure_name: item.procedureName,
+            progress: item.progress,
+            work_time: item.workTime,
+            finishNum: item.finishNum,
+            id: item.id
+          })
+        }
+        obj.procedureList = arr
+        obj.userName = data[j].name
+        newList.push(obj)
+      }
+      return newList
     },
 
     //打开报工页面
@@ -121,6 +262,34 @@ export default {
         }
       })
     },
+
+    formatDate(date) {
+      // 中国标准时间转成 YYYY-MM-DD
+      const year = date.getFullYear();
+      const month = date.getMonth() + 1;
+      const day = date.getDate();
+      return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
+    },
+    reportDateOnConfirm(date) {
+      this.reportDateShow = false;
+      this.reportDate = this.formatDate(date);
+      this.getCrewMemberList()
+    },
+
+    // 选中人员
+    chooseSomeoneChanhe(item) {
+      const { name, id } = item[0]
+      this.$set(this, 'personnelName', name)
+      this.$set(this, 'personnelId', id)
+      this.getMyPlanProcedureList()
+      this.$refs.ChooseSomeone['loadingBtn'] = false
+      this.popupShow = false
+    },
+    clearName() {
+      this.$set(this, 'personnelName', '')
+      this.$set(this, 'personnelId', '')
+      this.getMyPlanProcedureList()
+    }
   },
 };
 </script>
@@ -130,11 +299,31 @@ export default {
   box-sizing: border-box;
 }
 
+.vanCellIcon {
+  width: 16px;
+  height: 24px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  margin-left: 4px;
+}
+
 .textDis {
   width: 320px;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
   overflow: hidden;
   text-overflow: ellipsis;
   white-space: nowrap;
+
+  span:first-child {
+    display: inline-block;
+    width: 260px;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+  }
 }
 
 .valueCls {
@@ -225,4 +414,5 @@ export default {
       }
     }
   }
-}</style>
+}
+</style>