Shan9312 2 месяцев назад
Родитель
Сommit
990a3c26d7

+ 62 - 40
src/views/asset/assetBigData/index.vue

@@ -287,7 +287,7 @@
               :cell-style="cellStyle"
               class="elTable"
               @selection-change="handleSelectionChange"
-              :max-height="myHeight"
+              :max-height="myHeight2"
            >
             <el-table-column label="序号" align="center" type="index" width="50px">
               <template slot-scope="scope">
@@ -367,7 +367,8 @@ export default {
       uploadImageUrl: process.env.VUE_APP_BASE_API + 'authdata/uploaderimage',
       rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
       cellStyle: { padding: 0 + 'px' },
-      myHeight:document.documentElement.clientHeight - 85- 150
+      myHeight: document.documentElement.clientHeight - 85 - 150,
+      myHeight2:  document.documentElement.clientHeight - 150
     }
   },
   computed: {
@@ -407,15 +408,20 @@ export default {
     async handlegetBigDataRecode() {
        const obj = {
         startTime: '',
-        endTime:"",
+        endTime: "",
+        eqId:this.see.temp.eqId
       }
       if (this.getdataListParm.parammaps.inputDatetime == '' || this.getdataListParm.parammaps.inputDatetime == null) {
         this.getdataListParm.parammaps.inputDatetime = ''
-        obj.startTime = ''
-        obj.endTime = ''
+        const currentYear = new Date().getFullYear();
+        obj.startTime =  `${currentYear}-01-01`;
+        obj.endTime = `${currentYear}-12-31`;
       } else {
         obj.startTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+'-01'
-        obj.endTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+ '-31'
+        const year = new Date(this.getdataListParm.parammaps.inputDatetime).getFullYear();
+        const month = new Date(this.getdataListParm.parammaps.inputDatetime).getMonth() + 1; // 月份从0开始
+        const lastDay = new Date(year, month, 0).getDate(); // 获取当前月份的最后一天
+        obj.endTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}') + '-' + lastDay;
       }
       const { data } = await getBigDataRecode(obj)
       console.log(data, '记录')
@@ -495,8 +501,12 @@ export default {
         this.getdataListParm.parammaps.startTime = ''
         this.getdataListParm.parammaps.endTime = ''
       } else {
-        this.getdataListParm.parammaps.startTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+'-01'
-        this.getdataListParm.parammaps.endTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+ '-31'
+        this.getdataListParm.parammaps.startTime = parseTime(this.getdataListParm.parammaps.inputDatetime, '{y}-{m}') + '-01'
+        const year = new Date(this.getdataListParm.parammaps.inputDatetime).getFullYear();
+        const month = new Date(this.getdataListParm.parammaps.inputDatetime).getMonth() + 1; // 月份从0开始
+        const lastDay = new Date(year, month, 0).getDate(); // 获取当前月份的最后一天
+        this.getdataListParm.parammaps.endTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}') + '-' + lastDay;
+        // this.getdataListParm.parammaps.endTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+ '-31'
       }
     if (this.getdataListParm.parammaps.departmentId == undefined) { this.getdataListParm.parammaps.departmentId = '' }
 
@@ -614,33 +624,29 @@ export default {
     },
 
 // 处理每一行数据,生成与表头对应的字段
- 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];
+processData(downLoadList, filterVal, tHeader) {
+    return downLoadList.map(item => {
+        let row = {};
+        // 遍历 filterVal,根据顺序提取相应字段的值
+        filterVal.forEach((key, index) => {
+            // 如果是 1 到 31 天的数据,处理工作时长和加油量
+            if (key.includes('时长')) {
+                // 对应工作时长
+                const dayIndex = parseInt(key.split('(')[0]) - 1; // 获取天数索引
+                row[key] = item.hours[dayIndex] || '0'; // 如果没有数据则默认为0
+            } else if (key.includes('加油量')) {
+                // 对应加油量
+                const dayIndex = parseInt(key.split('(')[0]) - 1; // 获取天数索引
+                row[key] = item.diesel[dayIndex] || '0'; // 如果没有数据则默认为0
+            } else {
+                // 其他字段直接赋值
+                row[key] = item[key] || ''; // 如果没有数据则默认为空
             }
-          })
-      } else {
-        // 其他字段直接赋值
-        row[filterVal[index]] = item[key];
-      }
+        });
+        return row;
     });
-    return row;
-  });
 },
 
-
     handleDownload() {
       this.$alert('设备大数据正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
       this.isPercentage = true
@@ -655,16 +661,31 @@ export default {
       }, 1000)
       if (this.getdataListParm.parammaps.inputDatetime == '' || this.getdataListParm.parammaps.inputDatetime == null) {
         this.getdataListParm.parammaps.inputDatetime = ''
-        this.getdataListParm.parammaps.startTime = ''
-        this.getdataListParm.parammaps.endTime = ''
+        const currentYear = new Date().getFullYear();
+        this.getdataListParm.parammaps.startTime = `${currentYear}-01-01`;
+        this.getdataListParm.parammaps.endTime = `${currentYear}-12-31`;
       } else {
         this.getdataListParm.parammaps.startTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+'-01'
-        this.getdataListParm.parammaps.endTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+ '-31'
+        const year = new Date(this.getdataListParm.parammaps.inputDatetime).getFullYear();
+        const month = new Date(this.getdataListParm.parammaps.inputDatetime).getMonth() + 1; // 月份从0开始
+        const lastDay = new Date(year, month, 0).getDate(); // 获取当前月份的最后一天
+        this.getdataListParm.parammaps.endTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}') + '-' + lastDay;
       }
       if( this.getdataListParm.parammaps.departmentId == undefined){ this.getdataListParm.parammaps.departmentId = ''}
 
+       // 对于多选的牧场,根据数组的名称来转换 pastureArr =》 pastureId TODO:
+      if (this.getdataListParm.parammaps.pastureArr && this.getdataListParm.parammaps.pastureArr.length > 0) {
+        const arr = this.findAllPasture.filter((item) => {
+          if (this.getdataListParm.parammaps.pastureArr.includes(item.name)) {
+            return item
+          }
+        })
+        const ids = arr.map((child) => { return child.id })
+        this.getdataListParm.parammaps.pastureId = ids.toString();
+      }
+
       const obj = JSON.parse(JSON.stringify(this.getdataListParm.parammaps));
-      obj.pastureId = Cookies.get('pastureid');
+      // obj.pastureId = Cookies.get('pastureid');
       delete obj.pastureArr
       getDownLoadData(obj).then(response => {
         var downLoadList = response.data.list.map((child) => {
@@ -678,15 +699,15 @@ export default {
         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'];
+        const filterVal0 = ['date','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
+          filterVal.push(`${day}(时长)`); // 添加对应的 hours
         });
         currentData.day.forEach(day => {
-          filterVal.push(`${day}(加油量)`); // 添加对应的 diesel
+          filterVal.push(`${day}(加油量)`); // 添加对应的 diesel
         });
 
         if (response.data.list !== '') {
@@ -698,9 +719,10 @@ export default {
 
         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 tHeader = ['日期',...labels, ...currentData.day.map(d => `${d}(时长)`), ...currentData.day.map(d => `${d}(加油量)`)];
 
         const processedData = this.processData(downLoadList, filterVal, tHeader);
+
         const elecExcelDatas = [
           {
             tHeader: tHeader,
@@ -711,7 +733,7 @@ export default {
           }
         ];
         console.log(elecExcelDatas, 'elecExcelDatas')
-        json2excel(elecExcelDatas, '设备大数据', true, 'xlsx')
+        json2excel(elecExcelDatas, '设备大数据', false, 'xlsx')
      })
     },
 

+ 13 - 2
src/views/maintenance/repair/index.vue

@@ -2800,12 +2800,23 @@ export default {
       this.getDepartParam2.parammaps.pastureId = this.createTempCont.pastureId
       this.get_depart_list2()
       this.createTempCont.RUCode = row.repairCode
-      this.dialogFormVisibleCont = true
-      this.listLoading = false
+
+     // 获取设备编号的下拉列表
+      this.requestEqName2.parammaps['eqCode'] = row.eqCode;
+      GetDataByName(this.requestEqName2).then(response => {
+        this.EqNameList = response.data.list
+        console.log(this.EqNameList ,'this.EqNameList ')
+        this.listAddCont[0].sealNumberHis = this.EqNameList[0].sealNumberHis;
+
+        this.dialogFormVisibleCont = true
+        this.listLoading = false
+      })
       this.$nextTick(() => {
         this.$refs['createTempCont'].clearValidate()
       })
 
+
+
        //新增生成单号
       this.get_create_num()
     },

+ 52 - 18
src/views/maintenance/subcontractingMainten/tabPage/tab2.vue

@@ -259,7 +259,8 @@
             <el-table-column :render-header="addRedStar"  label="铅封号 " prop="sealNumber" align="center" min-width="80px">
               <template slot-scope="scope">
                 <span v-if="dialogStatus ==='create'||dialogStatus ==='update'">
-                  <el-input v-model="scope.row.sealNumber" style="margin-top:10px" />
+                  <!-- <el-input v-model="scope.row.sealNumber" style="margin-top:10px" /> -->
+                   {{ scope.row.sealNumber }}
                 </span>
                 <span v-if="dialogStatus ==='see'">{{ scope.row.sealNumber }}</span>
               </template>
@@ -379,11 +380,8 @@
                 </template>
               </el-table-column>
 
+              <el-table-column label="领用状态" min-width="100px" align="center" :formatter="formatStatue"  prop="statue"/>
 
-
-
-
-              <el-table-column label="领用状态" min-width="100px" align="center" :formatter="statue" />
               <el-table-column label="操作" min-width="80px" align="center">
                 <template slot-scope="{row}">
                   <el-button type="primary" size="mini" @click="handleCollarUseSee(row)">查看</el-button>
@@ -993,6 +991,15 @@ export default {
 
   },
   methods: {
+     formatStatue(row,column) {
+      if (row.statue == 0) {
+        return '未领用'
+      } else if (row.statue == 1) {
+        return '已领用'
+      } else {
+        return '已关闭'
+      }
+    },
        // 导出
     handleDownload() {
       this.$alert('正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
@@ -1024,12 +1031,14 @@ export default {
            if(response.data.list !== null && response.data.list !== ''){
           for(let i=0;i<response.data.list.length;i++){
                   //  <span v-if="scope.row.iscontract == 0 ">有</span>
-            if(response.data.list[i].status == 0){
-              this.$set(response.data.list[i],'status','未离厂')
-            }else if(response.data.list[i].status == 1){
-              this.$set(response.data.list[i],'status','未回厂')
-            }else if(response.data.list[i].status == 2){
-              this.$set(response.data.list[i],'status','已回厂')
+            if (response.data.list[i].status == 0) {
+              this.$set(response.data.list[i], 'status', '未离厂')
+            } else if (response.data.list[i].status == 1) {
+              this.$set(response.data.list[i], 'status', '未回厂')
+            } else if (response.data.list[i].status == 2) {
+              this.$set(response.data.list[i], 'status', '已回厂')
+            } else {
+               this.$set(response.data.list[i], 'status', '已验收')
             }
 
             if (response.data.list[i].iscontract == 0) {
@@ -1038,11 +1047,12 @@ export default {
               this.$set(response.data.list[i],'iscontract','无合同')
             }
 
-            if (response.data.list[i].amountStauts == 0) {
-              this.$set(response.data.list[i],'amountStauts','未领用')
+            if (response.data.list[i].partCode) {
+              this.$set(response.data.list[i], 'amountStauts', response.data.list[i].amountStauts == 0 ? '未领用' : '已领用');
             } else {
-              this.$set(response.data.list[i],'amountStauts','已领用')
+              this.$set(response.data.list[i], 'amountStauts', '');
             }
+
           }
         }else{
           response.data.list = []
@@ -1338,6 +1348,7 @@ export default {
       GetDataByName(this.getCollarUseSeeParm).then(response => {
         this.listCreateCollectionSpareParts = response.data.list
 
+
       })
     },
 
@@ -1655,17 +1666,29 @@ export default {
       console.log('备件模糊查询选中值', item)
       if (this.listCreateCollectionSpareParts.length > 0) {
         // eslint-disable-next-line no-redeclare
+
+
         if (this.listCreateCollectionSpareParts.find(obj => obj.partId === item.partId)) {
           this.$message({ type: 'warning', message: '此备件已存在,请重新选择备件' })
         } else {
-
+           if (this.listAddCont.length > 0) {
+             this.$set(item, 'eqCode', this.listAddCont[0].eqCode)
+             this.$set(item, 'eqName', this.listAddCont[0].eqName)
+        }
           item.date = this.collectionSparePartsSeeTemp.applyDate
+          console.log(item,'001')
           this.listCreateCollectionSpareParts.unshift(item)
         }
       } else {
+         if (this.listAddCont.length > 0) {
+            this.$set(item, 'eqCode', this.listAddCont[0].eqCode)
+            this.$set(item, 'eqName', this.listAddCont[0].eqName)
+         }
         item.date = this.collectionSparePartsSeeTemp.applyDate
+          console.log(item,'002')
         this.listCreateCollectionSpareParts.unshift(item)
       }
+
     },
 
 
@@ -1817,9 +1840,20 @@ export default {
     getCollectionSpareParts() {
       this.getCollarUseListParm.parammaps.RUCode = this.createTemp.acceptanceCode
       GetDataByName(this.getCollarUseListParm).then(response => {
-        console.log('领用table数据', response.data.list)
-        this.listCollectionSpareParts = response.data.list
-      })
+
+        this.listCollectionSpareParts = response.data.list.map((item) => {
+          if (item.statue == 0) {
+            item.statusName = '未领用'
+          } else if (item.statue == 1) {
+            item.statusName = '已领用'
+          } else if (item.statue == 2) {
+            item.statusName = '关闭'
+          }
+          return item
+        })
+
+         console.log('领用table数据', this.listCollectionSpareParts )      })
+
     },
 
     // 新增删除