Pārlūkot izejas kodu

报修人记录接口对接

epans 2 gadi atpakaļ
vecāks
revīzija
67da5bb36b
1 mainītis faili ar 62 papildinājumiem un 30 dzēšanām
  1. 62 30
      src/views/report/repairRecord/index.vue

+ 62 - 30
src/views/report/repairRecord/index.vue

@@ -17,14 +17,14 @@
             v-model="getdataListParm.parammaps.inputDatetime"
             class="inputDatetime"
             type="datetimerange"
-            style="width: 250px;top:-3px;"
+            style="width: 280px;top:-3px;"
             format="yyyy-MM-dd"
             value-format="yyyy-MM-dd"
             range-separator="至"
             start-placeholder="时间"
             end-placeholder="时间"
           />
-      <el-input v-model="getdataListParm.parammaps.name" placeholder="姓名" style="width: 200px;" class="filter-item" />
+      <el-input v-model="getdataListParm.parammaps.empname" placeholder="姓名" style="width: 200px;" class="filter-item" />
  
  
       <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_search">搜索</el-button>
@@ -43,17 +43,19 @@
         :cell-style="tableCellStyle"
         class="elTable"
         show-summary
+        :summary-method="getSummaries1" 
       >
         <el-table-column label="序号" align="center" type="index" width="50px">
           <template slot-scope="scope">
             <span>{{ scope.$index + (pageNum-1) * pageSize + 1 }}</span>
           </template>
         </el-table-column>
-        <el-table-column label="牧场" align="center" prop="name" />
-        <el-table-column label="月份" align="center" prop="deapartmentName" />
-        <el-table-column label="部门" align="center" prop="deapartmentName" />
-        <el-table-column label="姓名" align="center" prop="equipmentNumber" />
-        <el-table-column label="报修次数" align="center" prop="realNumber" />
+        <el-table-column label="牧场" align="center" prop="pasturename" />
+        <el-table-column label="月份" align="center" prop="date" />
+ 
+        <el-table-column label="部门" align="center" prop="departmentName" />
+        <el-table-column label="姓名" align="center" prop="empname" />
+        <el-table-column label="报修次数" align="center" prop="count" />
       </el-table>
       <pagination v-show="total>=0" :total="total" :page.sync="getdataListParm.offset" :limit.sync="getdataListParm.pagecount" @pagination="getList" />
     </div>
@@ -64,7 +66,8 @@
 // 引入
 import { GetDataByName, GetDataByNames, getRecuData, GetAccount } from '@/api/common'
 import waves from '@/directive/waves'
-import { json2excel } from '@/utils/index.js'
+ 
+import { parseTime, json2excel, sortChange } from '@/utils/index.js'
 import Pagination from '@/components/Pagination'
 import TreeSelect from '@/components/TreeSelect'
 import Cookies from 'js-cookie'
@@ -87,16 +90,14 @@ export default {
       getRecuListParm: { name: 'getAssetTypeList', idname: 'id', params: [-1] },
       tableKey: 0,
       list: [
-        {id:1},
-        {id:1},
-        {id:1},
-        {id:1},
+         
       ],
       total: 0,
-      listLoading: false,
+      listLoading: true,
       getdataListParm: {
-        name: 'getEquipmentAndEquipmentStandard', page: 1, offset: 1, pagecount: 10, returntype: 'Map',inputDatetime: '',
-        parammaps: { pastureId: Cookies.get('pastureid'), pastureName: Cookies.get('pasturename'), departmentName: '', eqClassId: '' }
+        name: 'getRecordsOfRepairman', page: 1, offset: 1, pagecount: 10, returntype: 'Map',inputDatetime: '',
+        parammaps: { pastureId: Cookies.get('pastureid'), pastureName: Cookies.get('pasturename'), departmentName: '', eqClassId: '', startTime: "",
+        stopTime: "",departmentId: "" ,inputDatetime: [parseTime(new Date().getTime() - 30 * 24 * 60 * 60 * 1000, '{y}-{m}-{d}'), parseTime(new Date().getTime() - 24 * 60 * 60 * 1000, '{y}-{m}-{d}')],}
       },
       requestParam: { name: 'insertAsset', offset: 0, pagecount: 0, parammaps: {}}, statueReason: false,
       downLoadParm: {},
@@ -112,10 +113,40 @@ export default {
   },
   created() {
     this.get_select_list()
-   // this.getList()
+     this.getList()
  
   },
   methods: {
+
+    getSummaries1(param) {
+        const { columns, data } = param;
+        const sums = [];
+        columns.forEach((column, index) => {
+          if (index === 0) {
+              sums[index] = '合计';
+            return;
+          }
+          const values = data.map(item => Number(item[column.property]));
+          console.log(column.property)
+          console.log(values)
+          if (!values.every(value => isNaN(value))) {
+            sums[index] = values.reduce((prev, curr) => {
+              const value = Number(curr);
+              if (!isNaN(value)) {
+                return prev + curr;
+              } else {
+                return prev;
+              }
+            }, 0);
+            // sums[index] += ' 元';
+          } else {
+            sums[index] = '-';
+          }
+        });
+
+        return sums;
+    },
+
     get_select_list() {
       GetDataByNames(this.requestParams).then(response => {
         if (response.data.list !== null) {
@@ -173,19 +204,19 @@ export default {
   
   
     tableCellStyle({ row, column, rowIndex, columnIndex }) {
-      if (columnIndex === 3) {
-        return {
-          textDecoration: 'underline'
-        }
-      }
-      return {
-        textDecoration: 'none'
-      }
+      // if (columnIndex === 3) {
+      //   return {
+      //     textDecoration: 'underline'
+      //   }
+      // }
+      // return {
+      //   textDecoration: 'none'
+      // }
     },
    
 
     handleDownload() {
-      this.$alert('设备基础信息正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
+      this.$alert('报修人记录正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
       this.isPercentage = true
       this.percentage = 1
       var timer = setInterval(() => {
@@ -196,7 +227,7 @@ export default {
         }
         this.percentage = this.percentage
       }, 1000)
-      this.downLoadParm.name = 'getAssetList'
+      this.downLoadParm.name = 'getRecordsOfRepairman'
       this.downLoadParm.parammaps = this.getdataListParm.parammaps
       GetAccount(this.downLoadParm).then(response => {
         this.downLoadList = response.data.list
@@ -209,15 +240,16 @@ export default {
         console.log(this.downLoadList)
         const elecExcelDatas = [
           {
-            tHeader: ['设备类别', '资产编号', '设备名称', '设备内部编号', '设备规格', '品牌', '供应商', '用途', '状态', '购置日期', '入场日期', '折旧年限', '财务编号', '原值', '残值', '月核减值', '保养级别', '保养费用', '维修费用', '基数(小时)', '牧场', '部门', '责任人', '录入人', '录入时间', '折旧年限', '使用时长(年)', '使用率(%)'],
-            filterVal: ['eqClassName', 'assetCode', 'eqName', 'eqCode', 'specification', 'brandName', 'providerName', 'purpose', 'status', 'purchaseDate', 'entranceDate', 'depreciation', 'financeCode', 'yuanzhi', 'salvage', 'subtractvalue', 'upkeepgrade', 'yearUpkeepCost', 'yearMaintainCost', 'baseHours', 'pastureName', 'deptName', 'employeName', 'inputUserName', 'inputDatetime', 'depreciation', 'serviceDuration', 'utilizationRate'],
+            tHeader: ['牧场', '月份', '部门', '姓名', '报修次数'],
+            filterVal: ['pasturename', 'date', 'departmentName', 'empname', 'count' ],
             tableDatas: this.downLoadList,
-            sheetName: '设备基础信息'
+            sheetName: '报修人记录'
           }
         ]
-        json2excel(elecExcelDatas, '设备基础信息', true, 'xlsx')
+        json2excel(elecExcelDatas, '报修人记录', true, 'xlsx')
       })
     }
+ 
 
   }
 }