Browse Source

设备大数据

Shan9312 2 months ago
parent
commit
27af95c6dd
2 changed files with 264 additions and 131 deletions
  1. 27 0
      src/api/common.js
  2. 237 131
      src/views/asset/assetBigData/index.vue

+ 27 - 0
src/api/common.js

@@ -418,3 +418,30 @@ export function getDownList(data) {
     data
   })
 }
+
+// 大数据
+export function getBigData(data) {
+  return request({
+    url: '/authdata/eq/data',
+    method: 'get',
+    params: data
+  })
+}
+
+// 大数据记录
+export function getBigDataRecode(data) {
+  return request({
+    url: '/authdata/eq/data/record',
+    method: 'get',
+    params: data
+  })
+}
+
+// 大数据导出
+export function getDownLoadData(data) {
+   return request({
+    url: '/authdata/eq/data/excel',
+    method: 'get',
+    params: data
+  })
+}

+ 237 - 131
src/views/asset/assetBigData/index.vue

@@ -73,14 +73,18 @@
             />
           </el-select>
            <el-input
-            v-model="getdataListParm.parammaps.assetCode"
+            v-model="getdataListParm.parammaps.cardCode"
             placeholder="油卡编号"
             clearable
             style="width: 120px"
             class="filter-item"
           />
-      <el-date-picker ref="inputDatetime" v-model="getdataListParm.parammaps.inputDatetime" class="inputDatetime" type="monthrange" style="width: 250px;top:-3px;" format="yyyy-MM" value-format="yyyy-MM" range-separator="至" start-placeholder="盘点日期" end-placeholder="盘点日期" />
-
+      <!-- <el-date-picker ref="inputDatetime" v-model="getdataListParm.parammaps.inputDatetime" class="inputDatetime" type="monthrange" style="width: 250px;top:-3px;" format="yyyy-MM" value-format="yyyy-MM" range-separator="至" start-placeholder="盘点日期" end-placeholder="盘点日期" /> -->
+      <el-date-picker
+                  v-model="getdataListParm.parammaps.inputDatetime"
+                  type="month"
+                  placeholder="选择月">
+                </el-date-picker>
       <el-button class="filter-item" type="primary" icon="el-icon-search" @click="form_search">搜索</el-button>
       <!-- <el-button class="filter-item" type="info" icon="el-icon-tickets" style="" @click="handleDownloadTemp">模板</el-button> -->
       <!-- <el-upload style="display: inline-block;" :headers="headers" :data="uploadData" :action="uploadExcelUrl" :show-file-list="false" :before-upload="beforeImportExcel" :on-success="handleImportExcelSuccess">
@@ -104,6 +108,7 @@
         class="elTable"
         @selection-change="handleSelectionChange"
         :max-height="myHeight"
+        ref="table"
       >
         <!-- <el-table-column type="selection" width="55" /> -->
         <el-table-column label="序号" align="center" type="index" width="50px">
@@ -113,26 +118,27 @@
         </el-table-column>
         <el-table-column label="牧场" align="center" prop="pastureName" />
 
-        <el-table-column label="设备类别" align="center" prop="assetCode" />
+        <el-table-column label="设备类别" align="center" prop="eqClassName" />
        <el-table-column label="设备名称" align="center" prop="eqName" />
         <el-table-column label="设备内部编号" align="center" prop="eqCode" />
-        <el-table-column label="状态" align="center" prop="rzdate" />
-        <el-table-column label="置换日期"   align="center" prop="unit" />
-        <el-table-column label="财务编号" align="center" prop="specification" />
+        <el-table-column label="状态" align="center" prop="status" />
+        <el-table-column label="置换日期"   align="center" prop="purchaseDate" />
+        <el-table-column label="财务编号" align="center" prop="financeCode" />
         <el-table-column label="部门" align="center" prop="departmentName" />
-        <el-table-column label="责任人" sortable align="center" prop="yuanzhi" />
-        <el-table-column label="物联网编码" sortable align="center" prop="count" />
-        <el-table-column label="标准工作时长" sortable align="center" prop="profit" />
-        <el-table-column label="油卡号" sortable align="center" prop="tag" />
-        <el-table-column label="油卡类型" sortable align="center" prop="importdate" />
-        <el-table-column label="油卡状态" sortable align="center" prop="inventorydate" />
+        <el-table-column label="责任人" sortable align="center" prop="employeName" />
+        <el-table-column label="物联网编码" sortable align="center" prop="license" />
+        <el-table-column label="标准工作时长" sortable align="center" prop="duration" />
+        <el-table-column label="油卡号" sortable align="center" prop="cardCode" />
+        <el-table-column label="油卡类型" sortable align="center" prop="cardType" />
+        <el-table-column label="油卡状态" sortable align="center" prop="enable" >
+          </el-table-column>
         <el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width" fixed="right">
           <template slot-scope="{row}">
             <el-button type="primary" size="mini" @click="form_see(row)">查看</el-button>
           </template>
         </el-table-column>
      </el-table>
-      <pagination v-show="total>=0" :total="total" :page.sync="getdataListParm.offset" :limit.sync="getdataListParm.pagecount" @pagination="get_table_data" />
+      <pagination v-show="total>=0" :total="total" :page.sync="getdataListParm.parammaps.offset" :limit.sync="getdataListParm.parammaps.pagecount" @pagination="get_table_data" />
       <el-dialog title="查看详情" :visible.sync="dialogFormVisible" :close-on-click-modal="false" width="80%">
         <div class="app-change">
           <el-tabs v-model="activeName" @tab-click="handleClick">
@@ -150,25 +156,25 @@
                 </el-form-item>
               </el-col>
               <el-col :span="8">
-                <el-form-item label="设备类别:" prop="departmentName">
-                 <el-input ref="departmentName" v-model="see.temp.departmentName" placeholder="部门" disabled />
+                <el-form-item label="设备类别:" prop="eqClassName">
+                 <el-input ref="departmentName" v-model="see.temp.eqClassName" placeholder="设备类别" disabled />
                 </el-form-item>
               </el-col>
             </el-row>
             <el-row>
               <el-col :span="8">
-                <el-form-item label="设备内部编号:" prop="assetCode">
-                 <el-input ref="assetCode" v-model="see.temp.assetCode" placeholder="设备内部编号" disabled />
+                <el-form-item label="设备内部编号:" prop="eqCode">
+                 <el-input ref="assetCode" v-model="see.temp.eqCode" placeholder="设备内部编号" disabled />
                 </el-form-item>
               </el-col>
               <el-col :span="8">
                 <el-form-item label="设备规格:" prop="eqName">
-                 <el-input ref="eqName" v-model="see.temp.eqName" placeholder="资产名称" disabled />
+                 <el-input ref="eqName" v-model="see.temp.eqName" placeholder="设备规格" disabled />
                 </el-form-item>
               </el-col>
               <el-col :span="8">
-                <el-form-item label="品牌:" prop="eqCode">
-                  <el-input ref="eqCode" v-model="see.temp.eqCode" placeholder="资产编号" disabled />
+                <el-form-item label="品牌:" prop="brandName">
+                  <el-input ref="eqCode" v-model="see.temp.brandName" placeholder="品牌" disabled />
                 </el-form-item>
               </el-col>
 
@@ -176,70 +182,70 @@
             <el-row>
               <el-col :span="8">
 
-                <el-form-item label="用途:" prop="unit">
-                  <el-input ref="unit" v-model="see.temp.unit" placeholder="计量单位" disabled />
+                <el-form-item label="用途:" prop="purpose">
+                  <el-input ref="unit" v-model="see.temp.purpose" placeholder="用途" disabled />
                 </el-form-item>
               </el-col>
               <el-col :span="8">
-                <el-form-item label="购置日期:" prop="specification">
-                 <el-input ref="specification" v-model="see.temp.specification" placeholder="规格" disabled />
+                <el-form-item label="购置日期:" prop="purchaseDate">
+                 <el-input ref="purchaseDate" v-model="see.temp.purchaseDate" placeholder="购置日期" disabled />
                 </el-form-item>
               </el-col>
               <el-col :span="8">
-                <el-form-item label="财务编号:" prop="quantity">
-                 <el-input ref="quantity" v-model="see.temp.quantity" placeholder="资产数量" disabled />
+                <el-form-item label="财务编号:" prop="financeCode">
+                 <el-input ref="financeCode" v-model="see.temp.financeCode" placeholder="财务编号" disabled />
                 </el-form-item>
               </el-col>
             </el-row>
             <el-row>
               <el-col :span="8">
-                <el-form-item label="残值:" prop="count">
-                  <el-input ref="count" v-model="see.temp.count" placeholder="实际盘点数" disabled />
+                <el-form-item label="残值:" prop="salvage">
+                  <el-input ref="salvage" v-model="see.temp.salvage" placeholder="残值" disabled />
                 </el-form-item>
               </el-col>
               <el-col :span="8">
-                <el-form-item label="保养级别:" prop="profit">
-                 <el-input ref="profit" v-model="see.temp.profit" placeholder="盈亏量" disabled />
+                <el-form-item label="保养级别:" prop="upkeepgrade">
+                 <el-input ref="upkeepgrade" v-model="see.temp.upkeepgrade" placeholder="保养级别" disabled />
                 </el-form-item>
               </el-col>
               <el-col :span="8">
-                <el-form-item label="保养费用:" prop="tag">
-                 <el-input ref="tag" v-model="see.temp.tag" placeholder="有无标签" disabled />
+                <el-form-item label="保养费用:" prop="yearUpkeepCost">
+                 <el-input ref="yearUpkeepCost" v-model="see.temp.yearUpkeepCost" placeholder="保养费用" disabled />
                 </el-form-item>
               </el-col>
 
             </el-row>
             <el-row>
               <el-col :span="8">
-                <el-form-item label="责任人:" prop="inventorydate">
-                  <el-input ref="inventorydate" v-model="see.temp.inventorydate" placeholder="盘点时间" disabled />
+                <el-form-item label="责任人:" prop="employeName">
+                  <el-input ref="employeName" v-model="see.temp.employeName" placeholder="责任人" disabled />
                 </el-form-item>
               </el-col>
               <el-col :span="8">
-                <el-form-item label="物联网编码:" prop="checkTakerName">
-                 <el-input ref="checkTakerName" v-model="see.temp.checkTakerName" placeholder="盘点人" disabled />
+                <el-form-item label="物联网编码:" prop="license">
+                 <el-input ref="license" v-model="see.temp.license" placeholder="物联网编码" disabled />
                 </el-form-item>
               </el-col>
               <el-col :span="8">
-                <el-form-item label="标准工作时长:" prop="remark">
-                 <el-input ref="remark" v-model="see.temp.remark" placeholder="备注" disabled />
+                <el-form-item label="标准工作时长:" prop="duration">
+                 <el-input ref="duration" v-model="see.temp.duration" placeholder="标准工作时长" disabled />
                 </el-form-item>
               </el-col>
             </el-row>
             <el-row>
               <el-col :span="8">
-                <el-form-item label="油卡号:" prop="inventorydate">
-                  <el-input ref="inventorydate" v-model="see.temp.inventorydate" placeholder="盘点时间" disabled />
+                <el-form-item label="油卡号:" prop="cardCode">
+                  <el-input ref="cardCode" v-model="see.temp.cardCode" placeholder="油卡号" disabled />
                 </el-form-item>
               </el-col>
               <el-col :span="8">
-                <el-form-item label="油卡类型:" prop="checkTakerName">
-                 <el-input ref="checkTakerName" v-model="see.temp.checkTakerName" placeholder="盘点人" disabled />
+                <el-form-item label="油卡类型:" prop="cardType">
+                 <el-input ref="cardType" v-model="see.temp.cardType" placeholder="油卡类型" disabled />
                 </el-form-item>
               </el-col>
               <el-col :span="8">
-                <el-form-item label="油卡状态:" prop="remark">
-                 <el-input ref="remark" v-model="see.temp.remark" placeholder="备注" disabled />
+                <el-form-item label="油卡状态:" prop="enable">
+                 <el-input ref="enable" v-model="see.temp.enable" placeholder="油卡状态" disabled />
                 </el-form-item>
               </el-col>
             </el-row>
@@ -247,20 +253,32 @@
           </el-tab-pane>
 
           <el-tab-pane label="记录" name="second">
-            <div style="margin-bottom: 40px;">
-            <el-date-picker
-              v-model="mountDate"
-              type="month"
-              value-format="yyyy-MM"
-              style="margin-bottom: 20px;"
-              placeholder="选择月">
-            </el-date-picker>
+            <div style="margin-bottom: 60px;">
+          <!-- <el-date-picker
+            ref="inputDatetime2"
+            v-model="getdataListParm.parammaps.inputDatetime"
+            class="inputDatetime"
+            type="month"
+            style="width: 250px; top: -3px"
+            format="yyyy-MM"
+            value-format="yyyy-MM"
+            range-separator="至"
+            start-placeholder="购置日期"
+            end-placeholder="购置日期"
+            @change="getDateByList"
+          /> -->
+          <el-date-picker
+            v-model="getdataListParm.parammaps.inputDatetime"
+            type="month"
+            @change="getDateByList"
+            placeholder="选择月">
+          </el-date-picker>
 
              <el-table
               key="tableRef"
               v-loading="listLoading"
               element-loading-text="给我一点时间"
-              :data="list"
+              :data="recodeList"
               border
               fit
               highlight-current-row
@@ -276,9 +294,9 @@
                 <span>{{ scope.$index + (pageNum-1) * pageSize + 1 }}</span>
               </template>
             </el-table-column>
-            <el-table-column label="日期" align="center" prop="pastureName" />
-            <el-table-column label="工作时长/h" align="center" prop="assetCode" />
-            <el-table-column label="加油量/L" align="center" prop="eqName" />
+            <el-table-column label="日期" align="center" prop="date" />
+            <el-table-column label="工作时长/h" align="center" prop="hour" />
+            <el-table-column label="加油量/L" align="center" prop="oilAmount" />
              </el-table>
 
             </div>
@@ -297,7 +315,7 @@
 </template>
 
 <script>
-import { GetDataByName, GetDataByNames,checkButtons,postJson,getJson } from '@/api/common'
+import { GetDataByName, GetDataByNames,checkButtons,postJson,getJson ,getBigData,getBigDataRecode, getDownLoadData} from '@/api/common'
 import { parseTime, json2excel } from '@/utils/index.js'
 import Pagination from '@/components/Pagination'
 import { MessageBox } from 'element-ui'
@@ -309,19 +327,31 @@ export default {
   components: { Pagination },
   data() {
     return {
+      recodeList:[],
       mountDate:'',
       tableKey: 0,
       list: [],
+      statusMap: [
+            { id: 17, label: "正常", value: "正常" },
+            { id: 18, label: "闲置", value: "闲置" },
+            { id: 19, label: "报废", value: "报废" },
+            { id: 20, label: "封存", value: "封存" }
+        ],
       activeName: 'first',
       getDictByName:[],
       total: 0,
       listLoading: true,
       getdataListParm: {
-        name: 'getAssetList', page: 1, offset: 1, pagecount: 50, returntype: 'Map',
-        parammaps: { pastureId: parseInt(Cookies.get('pastureid')),  inputDatetime: '', startTime: '', stopTime: '', departmentId: '' }
+        parammaps: { offset: 1, pagecount: 50, pastureId:'',  cardCode: '', status: '', departmentName: '', departmentId: '',eqCode:"",eqName:"",financeCode:"" ,inputDatetime:this.getCurrentMonthStart() , startTime: '', endTime: '',} // [this.getCurrentMonthStart(), this.getCurrentMonthEnd()]
       },
       isAssetinventorySee: [], isBasicsCard: [], isBasicsUpdate: [], isBasicsDel: [], isBasicsDel2: [], isBasic: [], isBasicSH: [], isBasicExamine: [],
       requestParams: [
+          {
+          name: 'getDictByName',
+          offset: 0,
+          pagecount: 0,
+          params: ['资产状态']
+        },
         { name: 'findAllPasture', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': "18" }}
       ],
       getDepartParam: { name: 'findAllDepart1', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid'), 'eId': Cookies.get('employeid') }},
@@ -365,13 +395,50 @@ export default {
 
   created() {
     // this.get_buttons()
-    this.get_table_data()
+
+    this.get_select_list()
 
   },
   methods: {
+    getDateByList(val) {
+      console.log(val,'yue')
+      this.handlegetBigDataRecode()
+   },
+    async handlegetBigDataRecode() {
+       const obj = {
+        startTime: '',
+        endTime:"",
+      }
+      if (this.getdataListParm.parammaps.inputDatetime == '' || this.getdataListParm.parammaps.inputDatetime == null) {
+        this.getdataListParm.parammaps.inputDatetime = ''
+        obj.startTime = ''
+        obj.endTime = ''
+      } else {
+        obj.startTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+'-01'
+        obj.endTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+ '-31'
+      }
+      const { data } = await getBigDataRecode(obj)
+      console.log(data, '记录')
+      this.recodeList = data.list;
+
+    },
+     // 获取当前月份的开始日期
+    getCurrentMonthStart() {
+        const date = new Date();
+        return new Date(date.getFullYear(), date.getMonth());
+        // return new Date(date.getFullYear(), date.getMonth(), 1);
+    },
+    // 获取当前月份的结束日期
+    getCurrentMonthEnd() {
+        const date = new Date();
+        return new Date(date.getFullYear(), date.getMonth() + 1, 0);
+    },
     handleClick(){
       // this.get_table_data()
-      this.activeName = 'second'
+      this.activeName = 'second';
+      if ( this.activeName == 'second') {
+       this. handlegetBigDataRecode()
+      }
     },
         // 删除
     removeTag() {
@@ -408,11 +475,11 @@ export default {
       GetDataByNames(this.requestParams).then(response => {
         if (response.data.list !== null) {
           this.findAllPasture = response.data.findAllPasture.list
-          this.getdataListParm.parammaps.pastureArr = this.findAllPasture.map(item => {
-          return item.name
-           })
-
+          this.getDictByName = response.data.getDictByName.list
+          this.getdataListParm.parammaps.pastureArr = [Cookies.get('pasturename')]
           this.getDepartDownList()
+           this.get_table_data()
+
         }
       })
     },
@@ -423,17 +490,15 @@ export default {
     },
     get_table_data() {
       this.listLoading = true
-      if (this.getdataListParm.parammaps.inputDatetime == null || this.getdataListParm.parammaps.inputDatetime == []) {
+      if (this.getdataListParm.parammaps.inputDatetime == '' || this.getdataListParm.parammaps.inputDatetime == null) {
         this.getdataListParm.parammaps.inputDatetime = ''
         this.getdataListParm.parammaps.startTime = ''
-        this.getdataListParm.parammaps.stopTime = ''
+        this.getdataListParm.parammaps.endTime = ''
       } else {
-        this.getdataListParm.parammaps.startTime = parseTime(this.getdataListParm.parammaps.inputDatetime[0],'{y}-{m}')+'-01'
-        this.getdataListParm.parammaps.stopTime = parseTime(this.getdataListParm.parammaps.inputDatetime[1],'{y}-{m}')+ '-31'
+        this.getdataListParm.parammaps.startTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+'-01'
+        this.getdataListParm.parammaps.endTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+ '-31'
       }
-      // if( this.getdataListParm.parammaps.startTime == undefined){ this.getdataListParm.parammaps.startTime = ''}
-      // if( this.getdataListParm.parammaps.stopTime == undefined){ this.getdataListParm.parammaps.stopTime = ''}
-      if (this.getdataListParm.parammaps.departmentId == undefined) { this.getdataListParm.parammaps.departmentId = '' }
+    if (this.getdataListParm.parammaps.departmentId == undefined) { this.getdataListParm.parammaps.departmentId = '' }
 
         // 对于多选的牧场,根据数组的名称来转换 pastureArr =》 pastureId TODO:
       if (this.getdataListParm.parammaps.pastureArr && this.getdataListParm.parammaps.pastureArr.length > 0) {
@@ -445,28 +510,31 @@ export default {
         const ids = arr.map((child) => { return child.id })
         this.getdataListParm.parammaps.pastureId = ids.toString();
       }
+      const obj = JSON.parse(JSON.stringify(this.getdataListParm.parammaps));
 
-      let url ='/authdata/stock/list?'
-      let data = 'offset=' + this.getdataListParm.offset
-                + '&pagecount=' + this.getdataListParm.pagecount
-                + '&pastureId=' + this.getdataListParm.parammaps.pastureId
-                + '&departmentId=' + this.getdataListParm.parammaps.departmentId
-                + '&startdate=' + this.getdataListParm.parammaps.startTime
-                + '&enddate=' + this.getdataListParm.parammaps.stopTime
-      getJson(url,data).then(response => {
+      delete obj.pastureArr
+      delete obj.endTime
+      delete obj.startTime
+      getBigData(obj).then(response => {
         console.log('table数据', response.data.list)
         if (response.data.list !== null) {
-          this.list = response.data.list
+          this.list = response.data.list.map((child) => {
+            const status = this.statusMap.find(item => item.id == child.status);
+            child.status = status.value || '暂无状态'
+            child.enable = child.enable == true ? '禁用' : '启用'
+            return child;
+          })
           this.pageNum = 1
           this.pageSize = response.data.pagecount
         } else {
           this.list = []
         }
         this.total = response.data.count
-        setTimeout(() => {
-          this.listLoading = false
-        }, 100)
-        this.get_select_list()
+        this.listLoading = false;
+        // setTimeout(() => {
+        //   this.listLoading = false
+        // }, 100)
+
       })
     },
     changePastureName(item) {
@@ -481,10 +549,10 @@ export default {
       if (this.getdataListParm.parammaps.inputDatetime == null) {
         this.getdataListParm.parammaps.inputDatetime = ''
         this.getdataListParm.parammaps.startTime = ''
-        this.getdataListParm.parammaps.stopTime = ''
+        this.getdataListParm.parammaps.endTime = ''
       } else {
         this.getdataListParm.parammaps.startTime = this.getdataListParm.parammaps.inputDatetime[0]
-        this.getdataListParm.parammaps.stopTime = this.getdataListParm.parammaps.inputDatetime[1]
+        this.getdataListParm.parammaps.endTime = this.getdataListParm.parammaps.inputDatetime[1]
       }
       this.getdataListParm.offset = 1
       this.get_table_data()
@@ -493,6 +561,7 @@ export default {
       this.see.temp = Object.assign({}, row) // copy obj
       this.dialogStatus = 'see'
       this.dialogFormVisible = true
+      this.activeName = 'first'
     },
     form_delete(row){
       MessageBox.confirm('确认删除此信息?', {
@@ -543,19 +612,37 @@ export default {
         })
       })
     },
-    handleDownloadTemp(){
-      const elecExcelDatas = [
-        {
-          tHeader: ['序号','牧场','部门', '资产编号', '资产名称', '设备内部编号', '实物入账日期', '计量单位', '规格', '资产数量', '资产原值', '实际盘点数', '盈亏量', '有无标签', '备注'  ],
-          filterVal: ['','','', '', '', '', '', '', '', '', '', '', '', '', ''],
-          tableDatas: [],
-          sheetName: '资产盘点模板'
-        }
-      ]
-      json2excel(elecExcelDatas, '资产盘点模板', true, 'xlsx')
-    },
+
+// 处理每一行数据,生成与表头对应的字段
+ processData(downLoadList, filterVal, tHeader) {
+   return downLoadList.map(item => {
+     let row = {};
+     // 遍历 filterVal,根据顺序提取相应字段的值
+     filterVal.forEach((key, index) => {
+       // 如果是 1 到 31 天的数据,处理工作时长和加油量
+       if (key.includes('工作时长') || key.includes('加油量')) {
+        // 对应工作时长
+         item.day.forEach((child,indexl) => {
+            if (tHeader[index].includes('工作时长')) {
+              row[tHeader[index]] = item.hours[indexl];
+            }
+             // 对应加油量
+            if (tHeader[index].includes('加油量')) {
+              row[tHeader[index]] = item.diesel[indexl];
+            }
+          })
+      } else {
+        // 其他字段直接赋值
+        row[filterVal[index]] = item[key];
+      }
+    });
+    return row;
+  });
+},
+
+
     handleDownload() {
-      this.$alert('设备基础信息正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
+      this.$alert('设备大数据正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
       this.isPercentage = true
       this.percentage = 1
       var timer = setInterval(() => {
@@ -566,49 +653,68 @@ export default {
         }
         this.percentage = this.percentage
       }, 1000)
-      if (this.getdataListParm.parammaps.inputDatetime == null || this.getdataListParm.parammaps.inputDatetime == []) {
+      if (this.getdataListParm.parammaps.inputDatetime == '' || this.getdataListParm.parammaps.inputDatetime == null) {
         this.getdataListParm.parammaps.inputDatetime = ''
         this.getdataListParm.parammaps.startTime = ''
-        this.getdataListParm.parammaps.stopTime = ''
+        this.getdataListParm.parammaps.endTime = ''
       } else {
-        this.getdataListParm.parammaps.startTime = parseTime(this.getdataListParm.parammaps.inputDatetime[0],'{y}-{m}')+'-01'
-        this.getdataListParm.parammaps.stopTime = parseTime(this.getdataListParm.parammaps.inputDatetime[1],'{y}-{m}')+ '-31'
+        this.getdataListParm.parammaps.startTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+'-01'
+        this.getdataListParm.parammaps.endTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+ '-31'
       }
       if( this.getdataListParm.parammaps.departmentId == undefined){ this.getdataListParm.parammaps.departmentId = ''}
-      let url ='/authdata/stock/list?'
-      let data = 'offset=' + this.getdataListParm.offset
-                + '&pagecount='+9999999
-                + '&pastureId=' + this.getdataListParm.parammaps.pastureId
-                + '&departmentId=' + this.getdataListParm.parammaps.departmentId
-                + '&startdate=' + this.getdataListParm.parammaps.startTime
-                + '&enddate=' + this.getdataListParm.parammaps.stopTime
-      getJson(url,data).then(response => {
-        var downLoadList = response.data.list
+
+      const obj = JSON.parse(JSON.stringify(this.getdataListParm.parammaps));
+      obj.pastureId = Cookies.get('pastureid');
+      delete obj.pastureArr
+      getDownLoadData(obj).then(response => {
+        var downLoadList = response.data.list.map((child) => {
+          const status = this.statusMap.find(item => item.id == child.status);
+          child.status = status && status.value;
+          child.enable = child.enable == true ? '禁用' : '启用'
+          return child
+        })
+
+
+        const days = downLoadList[0].day;
+        const currentData = downLoadList[0];
+        let filterVal = []
+        const filterVal0 = ['pastureName', 'eqClassName', 'eqName', 'eqCode', 'status', 'purchaseDate', 'financeCode', 'departmentName', 'employeName', 'license', 'duration', 'cardCode', 'cardType', 'enable'];
+        filterVal = [...filterVal0];
+
+        // 添加每一天的 hours 和 diesel 数据
+        currentData.day.forEach(day => {
+          filterVal.push(`${day}天(工作时长)`); // 添加对应的 hours
+        });
+        currentData.day.forEach(day => {
+          filterVal.push(`${day}天(加油量)`); // 添加对应的 diesel
+        });
+
         if (response.data.list !== '') {
-          this.percentage = 99
+          this.percentage = 99;
           setTimeout(() => {
-            this.isPercentage = false
-          }, 2000)
+            this.isPercentage = false;
+          }, 2000);
         }
+
+        const table = this.$refs.table;
+        const labels = table.columns.map((column) => column.label !== '序号' && column.label !== '操作' ? column.label : null).filter(label => label !== null);
+        const tHeader = [...labels, ...currentData.day.map(d => `${d}天(工作时长)`), ...currentData.day.map(d => `${d}天(加油量)`)];
+
+        const processedData = this.processData(downLoadList, filterVal, tHeader);
         const elecExcelDatas = [
           {
-            tHeader: ['牧场','部门', '资产编号', '资产名称', '设备内部编号', '实物入账日期', '计量单位', '规格', '资产数量', '资产原值', '实际盘点数', '盈亏量', '有无标签','导入日期','盘点日期','盘点人', '备注'],
-            filterVal: ['pastureName','departmentName', 'eqCode', 'eqName', 'assetCode', 'rzdate', 'unit', 'specification', 'quantity', 'yuanzhi', 'count', 'profit', 'tag', 'importdate', 'inventorydate', 'checkTakerName', 'remark'],
-            tableDatas: downLoadList,
-            sheetName: '资产盘点'
+            tHeader: tHeader,
+            filterVal: filterVal,
+            tableDatas: processedData,
+            sheetName: '设备大数据',
+            autowidth: true
           }
-        ]
-        json2excel(elecExcelDatas, '资产盘点', true, 'xlsx')
-      })
-    },
-    // 导入
-     beforeImportExcel(file) {
-      const isLt2M = file.size / 1024 / 1024 < 10
-      if (!isLt2M) {
-        this.$message.error('上传文件大小不能超过 10MB!')
-      }
-      return isLt2M
+        ];
+        console.log(elecExcelDatas, 'elecExcelDatas')
+        json2excel(elecExcelDatas, '设备大数据', true, 'xlsx')
+     })
     },
+
     handleImportExcelSuccess(res, file) {
       if (res.msg === 'ok') {
         this.$message({ title: '成功', message: '导入成功:' + res.data.success + '条!', type: 'success', duration: 2000 })