Преглед на файлове

1,日志汇总换,2,日志汇总加日期搜索

wucl преди 2 години
родител
ревизия
c2a1678aa9
променени са 2 файла, в които са добавени 137 реда и са изтрити 30 реда
  1. 66 12
      src/views/log/rate.vue
  2. 71 18
      src/views/log/rateCollect.vue

+ 66 - 12
src/views/log/rate.vue

@@ -3,6 +3,30 @@
     <div class="title-container">
       <breadcrumb id="breadcrumb-container" class="breadcrumb-container"/>
     </div>
+    <div class="condition">
+      <el-date-picker
+        v-model="startDate"
+        type="date"
+        value-format="yyyy-MM-dd"
+        style="width: 200px;margin-top: 10px;margin-left: 17px"
+        placeholder="开始日期"
+      />
+      <el-date-picker
+        v-model="endDate"
+        type="date"
+        value-format="yyyy-MM-dd"
+        style="width: 200px ;margin-top: 10px;margin-left: 17px"
+        placeholder="结束日期"
+      />
+      <el-button
+        class="filter-item"
+        style="margin-left: 10px;"
+        type="primary"
+        @click="getLogs"
+        round
+      >搜索
+      </el-button>
+    </div>
     <y-page-list-layout>
       <el-table :data="tableData" slot="table" style="width: 100%;" border="border" height="900px" :row-style="{height:'100px'}">
         <el-table-column v-if="tableData.length>0" label="日期" width="150px" align="center" fixed>
@@ -13,12 +37,14 @@
         <el-table-column :label="name" v-for="(name,index) in userNames" :key="index" width="520px">
           <template slot-scope="{row}">
             <div v-for="(l,index) in row.list" :key="index">
-              <div class="content" v-if = "g.userName===name" v-for="g in l.logs" :key="g.id" @click="openDetail(g.id)">
+              <div class="content" v-if = "g.userName===name" v-for="g in l.logs" :key="g.id">
                 <el-tag effect="dark">{{g.itemName}}</el-tag>
                 <el-tag type="success" effect="dark">{{g.stageName===null?'无':g.stageName}}</el-tag>
-                <el-tooltip content="查看详情" placement="bottom" effect="light">
-                  <el-tag class="info" type="info" effect="dark">{{g.taskSituation}}</el-tag>
-                </el-tooltip>
+                <div class="info">
+                  <div id="info-item" type="info" effect="dark">
+                    {{g.taskSituation}}
+                  </div>
+                </div>
               </div>
             </div>
           </template>
@@ -138,12 +164,14 @@
         dates:[],
         dialogFormVisible: false,
         userNames:[],
-        stageName: "第二阶段",
+        startDate:null,
+        endDate:null
       }
     },
     created() {
-        this.getLogs();
-
+      this.endDate = this.timeDefault;
+      this.startDate = this.getago(this.endDate, -10);
+      this.getLogs();
     },
     mounted() {
       // const d = this.tableData;
@@ -153,9 +181,30 @@
       // })
     },
     computed:{
-
+      timeDefault() {
+        const date = new Date();
+        const s1 = date.getFullYear() + "-" + (this.getZero(date.getMonth() + 1)) + "-" + this.getZero((date.getDate()));
+        return s1;
+      },
     },
     methods:{
+      getago(startDate, valueTime){
+        var date = new Date(startDate);
+        var newDate = new Date(date.getFullYear(), date.getMonth(), date.getDate()+ +valueTime);
+        var Y = newDate.getFullYear();
+        var M = newDate.getMonth()+1;
+        M = M<10?'0'+M:M;
+        var D = newDate.getDate();
+        D = D<10?'0'+D:D;
+        return `${Y}-${M}-${D}`;
+      },
+      getZero(num) {
+        // 单数前面加0
+        if (parseInt(num) < 10) {
+          num = '0' + num;
+        }
+        return num;
+      },
       openDetail(id){
         const that = this;
         this.$api.itemLog.detail(id).then(res=>{
@@ -168,7 +217,7 @@
         )
       },
       getLogs(){
-        this.$api.itemLog.collect({scope:this.scope, itemId: this.itemId}).then(res=>{
+        this.$api.itemLog.collect({scope:this.scope, itemId:this.itemId, startDate:this.startDate, endDate:this.endDate}).then(res=>{
           this.tableData = res.data;
           const us = this.userNames;
           const d = this.tableData;
@@ -196,11 +245,16 @@
 <style lang="scss" scoped>
   div.content{
     margin-bottom: 5px;
+    width: 520px;
   }
-  .info:hover{
-    cursor: pointer;
+  .info {
+    width: 500px;
+    height: auto;
+  }
+  #info-item{
+    text-overflow: ellipsis !important;
+    white-space: pre-wrap !important;
   }
-
   /deep/.myDialog{
     border-radius: 20px;
   }

+ 71 - 18
src/views/log/rateCollect.vue

@@ -3,6 +3,30 @@
     <div class="title-container">
       <breadcrumb id="breadcrumb-container" class="breadcrumb-container"/>
     </div>
+    <div class="condition">
+      <el-date-picker
+        v-model="startDate"
+        type="date"
+        value-format="yyyy-MM-dd"
+        style="width: 200px;margin-top: 10px;margin-left: 17px"
+        placeholder="开始日期"
+      />
+      <el-date-picker
+        v-model="endDate"
+        type="date"
+        value-format="yyyy-MM-dd"
+        style="width: 200px ;margin-top: 10px;margin-left: 17px"
+        placeholder="结束日期"
+      />
+      <el-button
+        class="filter-item"
+        style="margin-left: 10px;"
+        type="primary"
+        @click="getLogs"
+        round
+      >搜索
+      </el-button>
+    </div>
     <y-page-list-layout>
       <el-table :data="tableData" slot="table" style="width: 100%;" border="border" height="900px" :row-style="{height:'100px'}">
         <el-table-column v-if="tableData.length>0" label="日期" width="150px" align="center" fixed>
@@ -13,12 +37,14 @@
         <el-table-column :label="name" v-for="(name,index) in userNames" :key="index" width="520px">
           <template slot-scope="{row}">
             <div v-for="(l,index) in row.list" :key="index">
-              <div class="content" v-if = "g.userName===name" v-for="g in l.logs" :key="g.id" @click="openDetail(g.id)">
+              <div class="content" v-if = "g.userName===name" v-for="g in l.logs" :key="g.id">
                 <el-tag effect="dark">{{g.itemName}}</el-tag>
                 <el-tag type="success" effect="dark">{{g.stageName===null?'无':g.stageName}}</el-tag>
-                <el-tooltip content="查看详情" placement="bottom" effect="light">
-                  <el-tag class="info" type="info" effect="dark">{{g.taskSituation}}</el-tag>
-                </el-tooltip>
+                <div class="info">
+                  <div id="info-item" type="info" effect="dark">
+                    {{g.taskSituation}}
+                  </div>
+                </div>
               </div>
             </div>
           </template>
@@ -135,23 +161,41 @@
         userNames:[],
         dialogFormVisible: false,
         postForm:{},
+        startDate:null,
+        endDate:null
       }
     },
     created() {
-        this.getLogs();
+      this.endDate = this.timeDefault;
+      this.startDate = this.getago(this.endDate, -10);
+      this.getLogs();
 
     },
-    mounted() {
-      // const d = this.tableData;
-      // console.log(d);
-      // d.forEach(function (e) {
-      //   console.log(e.logDate);
-      // })
-    },
     computed:{
-
+      timeDefault() {
+        const date = new Date();
+        const s1 = date.getFullYear() + "-" + (this.getZero(date.getMonth() + 1)) + "-" + this.getZero((date.getDate()));
+        return s1;
+      },
     },
     methods:{
+      getago(startDate, valueTime){
+        var date = new Date(startDate);
+        var newDate = new Date(date.getFullYear(), date.getMonth(), date.getDate()+ +valueTime);
+        var Y = newDate.getFullYear();
+        var M = newDate.getMonth()+1;
+        M = M<10?'0'+M:M;
+        var D = newDate.getDate();
+        D = D<10?'0'+D:D;
+        return `${Y}-${M}-${D}`;
+      },
+      getZero(num) {
+        // 单数前面加0
+        if (parseInt(num) < 10) {
+          num = '0' + num;
+        }
+        return num;
+      },
       openDetail(id){
         const that = this;
         this.$api.itemLog.detail(id).then(res=>{
@@ -164,7 +208,9 @@
         )
       },
       getLogs(){
-        this.$api.itemLog.collect({scope:this.scope, departmentId:this.departmentId, itemId:this.itemId}).then(res=>{
+        this.tableData = null;
+        this.userNames = [];
+        this.$api.itemLog.collect({scope:this.scope, departmentId:this.departmentId, itemId:this.itemId, startDate:this.startDate, endDate:this.endDate}).then(res=>{
           this.tableData = res.data;
           const us = this.userNames;
           const d = this.tableData;
@@ -192,12 +238,19 @@
 <style lang="css" scoped>
     div.content{
       margin-bottom: 5px;
-      width: 8000px;
+      width: 520px;
     }
-    .info:hover{
-      cursor: pointer;
+    /*.info:hover{*/
+    /*  cursor: pointer;*/
+    /*}*/
+    .info {
+      width: 500px;
+      height: auto;
+    }
+    #info-item{
+      text-overflow: ellipsis !important;
+      white-space: pre-wrap !important;
     }
-
     /deep/.myDialog{
       border-radius: 20px;
     }