Lijy 7 місяців тому
батько
коміт
1bc87c988c

+ 0 - 7
fhKeeper/formulahousekeeper/timesheet/src/main.js

@@ -121,13 +121,6 @@ router.beforeEach((to, from, next) => {
     let user = JSON.parse(sessionStorage.getItem('user'));
 
     // 添加临时路由
-    if(user && user.moduleList && user.companyId == 10 && user.moduleList.length > 0) {
-        const modulOne = JSON.parse(JSON.stringify(user.moduleList[0] || [])) 
-        console.log(modulOne, '<===== modulOne')
-        modulOne.name = '设备管理'
-        modulOne.path = '/deviceManagement'
-        user.moduleList.splice(2, 0, modulOne);
-    }
 
     if (!user && to.path != '/login') {
         next({ path: '/login' })

+ 7 - 0
fhKeeper/formulahousekeeper/timesheet/src/permissions.js

@@ -148,6 +148,10 @@ const StringUtil = {
 
         // 用户分组管理
         userGroupManage: false,
+
+        // 设备管理
+        equipmentInformationManagement: false,
+        equipmentCostManagement: false
         
     }
     // console.log(arr);
@@ -282,6 +286,9 @@ const StringUtil = {
         arr[i] == '审核立项申请' ? obj.projectApprovalCheck = true : ''
 
         arr[i] == '用户分组管理' ? obj.userGroupManage = true : ''
+        
+        arr[i] == '设备信息管理' ? obj.equipmentInformationManagement = true : ''
+        arr[i] == '设备成本管理' ? obj.equipmentCostManagement = true : ''
     }
     return obj
   }

+ 508 - 92
fhKeeper/formulahousekeeper/timesheet/src/views/deviceManagement/deviceManagement.vue

@@ -1,54 +1,135 @@
 <template>
   <div class="deviceManagement">
-    <div class="deviceManagement-title">
-      <div class="deviceManagement-title-left">
-        <div>设备管理</div>
-        <el-input placeholder="请输入设备编码" v-model.trim="equipmentCode" size="small" style="width: 300px;" clearable>
-          <template slot="append">
-            <el-button @click="searchForDevices">搜索</el-button>
-          </template>
-        </el-input>
-      </div>
-
-      <div class="deviceManagement-title-right">
-        <el-button type="primary" size="small" @click="editDevice({}, true)">添加设备</el-button>
-      </div>
+    <!-- 菜单栏 -->
+    <div>
+      <el-menu :default-active="menuIndex" class="el-menu-vertical-demo"
+        @select="(index) => menuHandleSelect(index, false)">
+        <el-menu-item index="info" v-if="permissions.equipmentInformationManagement">
+          <i class="el-icon-menu"></i>
+          <span slot="title">设备信息管理</span>
+        </el-menu-item>
+        <el-menu-item index="cost" v-if="permissions.equipmentCostManagement">
+          <i class="el-icon-document"></i>
+          <span slot="title">设备成本管理</span>
+        </el-menu-item>
+      </el-menu>
     </div>
 
-    <div class="deviceManagement-table">
-      <el-table :data="deviceManagementList" border style="width: 100%" height="calc(100% - 10px)">
-        <el-table-column prop="equipmentNumber" label="设备编号"></el-table-column>
-        <el-table-column prop="equipmentName" label="设备名称"></el-table-column>
-        <el-table-column prop="equipmentModel" label="设备型号"></el-table-column>
-        <el-table-column prop="manufacturer" label="制造商"></el-table-column>
-        <el-table-column prop="purchaseDate" label="购置日期" width="200"></el-table-column>
-        <el-table-column prop="maintenanceDate" label="维保日期" width="200"></el-table-column>
-        <el-table-column prop="operation" label="操作" width="200">
-          <template slot-scope="scope">
-            <el-button type="text" @click="editDevice(scope.row, true)">编辑</el-button>
-            <el-button type="text" @click="deleteDevice(scope.$index, scope.row)">删除</el-button>
-            <el-button type="text" @click="seeDevice(scope.$index, scope.row)">查看二维码</el-button>
-          </template>
-        </el-table-column>
-      </el-table>
+    <!-- 主页面 -->
+    <div class="deviceManagement-container">
+      <!-- 审核信息管理 -->
+      <template v-if="menuIndex === 'info'">
+        <div class="deviceManagement-title">
+          <div class="deviceManagement-title-left">
+            <div>设备管理</div>
+            <el-input placeholder="请输入关键字" v-model.trim="equipmentCode" size="small" style="width: 380px;" clearable>
+              <el-select v-model="deviceStringType" slot="prepend" style="width: 80px;">
+                <el-option label="编号" value="1"></el-option>
+                <el-option label="名称" value="2"></el-option>
+              </el-select>
+              <template slot="append">
+                <el-button @click="searchForDevices">搜索</el-button>
+              </template>
+            </el-input>
+          </div>
+
+          <div class="deviceManagement-title-right">
+            <el-button type="text" @click="editDevice({}, true)">添加设备</el-button>
+            <el-button type="text" @click="exportDevice()" :loading="allLoading.exportDeviceLoading">导出设备</el-button>
+          </div>
+        </div>
+
+        <div class="deviceManagement-table">
+          <el-table :data="deviceManagementList" border height="calc(100% - 10px)" v-loading="allLoading.tableLoading"
+            :key="12" style="width: 100%;">
+            <el-table-column prop="deviceCode" label="设备编号"></el-table-column>
+            <el-table-column prop="deviceName" label="设备名称"></el-table-column>
+            <el-table-column prop="deviceModel" label="设备型号"></el-table-column>
+            <el-table-column prop="manufacturer" label="制造商"></el-table-column>
+            <el-table-column prop="purchaseDate" label="购置日期" width="120"></el-table-column>
+            <el-table-column prop="maintenanceDate" label="维保日期" width="120"></el-table-column>
+            <el-table-column prop="operation" label="操作" width="200">
+              <template slot-scope="scope">
+                <el-button type="text" @click="editDevice(scope.row, true)">编辑</el-button>
+                <el-button type="text" @click="deleteDevice(scope.$index, scope.row)">删除</el-button>
+                <el-button type="text" @click="seeDevice(scope.$index, scope.row)">查看二维码</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+      </template>
+
+      <!-- 设备成本管理 -->
+      <template v-if="menuIndex === 'cost'">
+        <div class="deviceManagement-title">
+          <div class="deviceManagement-title-left">
+            <div>设备成本管理</div>
+
+            <el-date-picker v-model="costYmonth" value-format="yyyy-MM" type="month" size="small"
+              style="width: 120px;margin-right: 20px" :clearable="false" @change="searchDevicesCost"></el-date-picker>
+
+            <el-input placeholder="请输入关键字" v-model.trim="costDeviceCode" size="small" style="width: 380px;" clearable>
+              <template slot="append">
+                <el-button @click="searchDevicesCost">搜索</el-button>
+              </template>
+            </el-input>
+          </div>
+
+          <div class="deviceManagement-title-right">
+            <el-button type="text" @click="displayFileUpload()" style="margin-right: 10px;">成本数据上传</el-button>
+            <!-- <el-button type="text">成本模板下载</el-button> -->
+            <el-link type="primary" :underline="false" href="./upload/设备成本.xlsx" download="设备成本.xlsx">成本模板下载</el-link>
+          </div>
+        </div>
+
+        <div class="deviceManagement-table">
+          <el-table :data="deviceCostList" border height="calc(100% - 10px)" @selection-change="handleSelectionChange"
+            v-loading="allLoading.tableLoading" :key="21" show-summary :summary-method="getSummaries" style="width: 100%;">
+            <el-table-column type="selection" width="55"></el-table-column>
+            <el-table-column prop="deviceCode" label="设备编号"></el-table-column>
+            <el-table-column prop="deviceName" label="设备名称"></el-table-column>
+            <el-table-column prop="deviceModel" label="设备型号"></el-table-column>
+            <el-table-column prop="manufacturer" label="制造商"></el-table-column>
+            <el-table-column prop="monthCost" label="当月成本(元)"></el-table-column>
+            <el-table-column prop="operation" label="操作" width="120">
+              <template slot-scope="scope">
+                <el-button type="text" @click="displaModifyCost(scope.row, true)">修改成本</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+      </template>
+
+      <!-- 分页 -->
+      <div class="deviceManagement-page">
+        <div>
+          <el-button v-if="menuIndex == 'cost'" type="primary" size="small" :disabled="tableSelection.length == 0"
+            @click="batchDeletion()">批量删除</el-button>
+        </div>
+        <el-pagination background layout="total, prev, pager, next, sizes" :page-size="pageSize" :total="total"
+          :page-sizes="[10, 20, 30, 50, 100, 200]" :current-page="pageIndex" @current-change="handleCurrentChange"
+          @size-change="handleSizeChange" size="small">
+        </el-pagination>
+      </div>
     </div>
 
     <!-- 新增编辑 -->
-    <el-dialog title="新增/修改设备" :visible.sync="equipmentVisable" width="780px" top="7.8vh" :before-close="handleClose">
+    <el-dialog title="新增/修改设备" :visible.sync="equipmentVisable" width="780px" top="7.8vh"
+      :before-close="addEditCallback">
       <div class="modifyEquipment">
         <el-form :model="equipmentForm" :rules="equipmentRules" ref="equipmentruleForm" label-width="100px"
           class="demo-ruleForm">
-          <el-form-item label="设备编号" prop="equipmentNumber">
-            <el-input v-model.trim="equipmentForm.equipmentNumber" placeholder="请输入设备编码"></el-input>
+          <el-form-item label="设备编号" prop="deviceCode">
+            <el-input v-model.trim="equipmentForm.deviceCode" placeholder="请输入设备编码" :maxlength="100"></el-input>
           </el-form-item>
-          <el-form-item label="设备名称" prop="equipmentName">
-            <el-input v-model.trim="equipmentForm.equipmentName" placeholder="请输入设备名称"></el-input>
+          <el-form-item label="设备名称" prop="deviceName">
+            <el-input v-model.trim="equipmentForm.deviceName" placeholder="请输入设备名称" :maxlength="100"></el-input>
           </el-form-item>
-          <el-form-item label="设备型号" prop="equipmentModel">
-            <el-input v-model.trim="equipmentForm.equipmentModel" placeholder="请输入设备型号"></el-input>
+          <el-form-item label="设备型号" prop="deviceModel">
+            <el-input v-model.trim="equipmentForm.deviceModel" placeholder="请输入设备型号" :maxlength="100"></el-input>
           </el-form-item>
           <el-form-item label="制造商" prop="manufacturer">
-            <el-input v-model.trim="equipmentForm.manufacturer" placeholder="请输入制造商"></el-input>
+            <el-input v-model.trim="equipmentForm.manufacturer" placeholder="请输入制造商" :maxlength="100"></el-input>
           </el-form-item>
           <el-form-item label="购置日期" prop="purchaseDate">
             <el-date-picker v-model="equipmentForm.purchaseDate" value-format="yyyy-MM-dd" type="date"
@@ -61,19 +142,67 @@
         </el-form>
       </div>
       <span slot="footer" class="dialog-footer">
-        <el-button @click="equipmentVisable = false">取 消</el-button>
+        <el-button @click="closeEquipmentVisable()">取 消</el-button>
         <el-button type="primary" @click="submitForm('equipmentruleForm')">确 定</el-button>
       </span>
     </el-dialog>
 
     <!-- 查看二维码 -->
-    <el-dialog :title="`${equipmentItem.equipmentNumber} - ${equipmentItem.equipmentName}`"
+    <!-- <el-dialog :title="`${equipmentItem.deviceCode} - ${equipmentItem.deviceName}`" -->
+    <el-dialog :title="`查看二维码`"
       :visible.sync="equipmentQrCodeVisable" width="600px" top="7.8vh" :before-close="handleClose">
-      <div class="equipmentQrCode">
+      <div class="equipmentQrCode" ref="printContent">
         <div class="equipmentQrCodeImg">
           <img :src="qrCodeURL" alt="二维码" />
         </div>
+        <div class="equipmentQrCodeText">
+          <p>设备编号:{{ equipmentItem.deviceCode }}</p>
+          <p>设备名称:{{ equipmentItem.deviceName }}</p>
+        </div>
       </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="print()">打 印</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 成本数据上传 -->
+    <el-dialog title="成本数据上传" :visible.sync="uploadFileVisable" width="780px" top="7.8vh" :before-close="handleClose">
+      <el-form :model="uploadFileFormVal" label-width="100px" class="demo-ruleForm">
+        <el-form-item label="上传月份">
+          <el-date-picker v-model="uploadFileFormVal.ymonthStr" value-format="yyyy-MM" type="month" size="small"
+            style="" :clearable="false"></el-date-picker>
+        </el-form-item>
+        <el-form-item label="上传文件">
+          <el-upload class="upload-demo" :show-file-list="false" :http-request="uploadFileCost"
+            v-if="!uploadFileFormVal.fileName">
+            <el-button size="small" type="primary">点击上传</el-button>
+          </el-upload>
+          <el-tag closable @close="closeCostFile()" disable-transitions v-else>{{ uploadFileFormVal.fileName }}</el-tag>
+        </el-form-item>
+        <div class="textPrompt">上传会更新已有的设备成本!!!</div>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="uploadFileVisable = false">取 消</el-button>
+        <el-button type="primary" :disabled="!uploadFileFormVal.fileName" :loading="allLoading.costFileLoading"
+          @click="uploadCostFiles()">确 定</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 修改成本 -->
+    <el-dialog :title="modifyCostTitle" :visible.sync="modifyCostVisable" width="780px" top="7.8vh"
+      :before-close="handleClose">
+      <el-form :model="modifyCostform" label-width="100px" style="margin-top: 20px;">
+        <el-form-item label="当月成本">
+          <el-input-number v-model="modifyCostform.monthCost" controls-position="right" size="small"
+            style="width: 60%;"></el-input-number>
+          <span>(元)</span>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="modifyCostVisable = false">取 消</el-button>
+        <el-button type="primary" :disabled="!modifyCostform.monthCost" :loading="allLoading.modifyCostLoading"
+          @click="modifyCostAmountOfMoney()">确 定</el-button>
+      </span>
     </el-dialog>
   </div>
 </template>
@@ -83,44 +212,217 @@ import QRCode from 'qrcode';
 export default {
   data() {
     return {
+      menuIndex: 'info',
       equipmentCode: '',
+      deviceStringType: '1',
       equipmentVisable: false,
       equipmentQrCodeVisable: false,
       equipmentForm: {},
       equipmentItem: {},
       qrCodeURL: '',
+      pageIndex: 1,
+      pageSize: 20,
+      total: 0,
       equipmentRules: {
-        equipmentNumber: [{ required: true, message: '请输入设备编码', trigger: 'blur' }],
-        equipmentName: [{ required: true, message: '请输入设备名称', trigger: 'blur' }],
-        equipmentModel: [{ required: true, message: '请输入设备型号', trigger: 'blur' }],
+        deviceCode: [{ required: true, message: '请输入设备编码', trigger: 'blur' }],
+        deviceName: [{ required: true, message: '请输入设备名称', trigger: 'blur' }],
+        deviceModel: [{ required: true, message: '请输入设备型号', trigger: 'blur' }],
         manufacturer: [{ required: true, message: '请输入制造商', trigger: 'blur' }],
         purchaseDate: [{ required: true, message: '请选择购置日期', trigger: 'blur' }],
         maintenanceDate: [{ required: true, message: '请选择维保日期', trigger: 'blur' }]
       },
-      deviceManagementList: [
-        { equipmentNumber: '123456789', equipmentName: '设备名称1(在使用)', equipmentModel: '设备型号', manufacturer: '制造商', purchaseDate: '2019-01-01', maintenanceDate: '2020-01-01', status: 1, projectName: '展示项目', durationOfUse: 1, usageTime: '2024-09-03 10:11:11' },
-        { equipmentNumber: '987654321', equipmentName: '设备名称2', equipmentModel: '设备型号', manufacturer: '制造商', purchaseDate: '2019-01-01', maintenanceDate: '2020-01-01' },
-        { equipmentNumber: 'aabbccas', equipmentName: '设备名称3', equipmentModel: '设备型号', manufacturer: '制造商', purchaseDate: '2019-01-01', maintenanceDate: '2020-01-01' },
-        { equipmentNumber: 'jkjkjkjkjk', equipmentName: '设备名称4(在使用)', equipmentModel: '设备型号', manufacturer: '制造商', purchaseDate: '2019-01-01', maintenanceDate: '2020-01-01', status: 1, projectName: '小小神射手', durationOfUse: 15, usageTime: '2024-08-07 08:09:11' },
-      ],
-      deviceManagementListTwo: [
-        { equipmentNumber: '123456789', equipmentName: '设备名称1(在使用)', equipmentModel: '设备型号', manufacturer: '制造商', purchaseDate: '2019-01-01', maintenanceDate: '2020-01-01', status: 1, projectName: '展示项目', durationOfUse: 1, usageTime: '2024-09-03 10:11:11' },
-        { equipmentNumber: '987654321', equipmentName: '设备名称2', equipmentModel: '设备型号', manufacturer: '制造商', purchaseDate: '2019-01-01', maintenanceDate: '2020-01-01' },
-        { equipmentNumber: 'aabbccas', equipmentName: '设备名称3', equipmentModel: '设备型号', manufacturer: '制造商', purchaseDate: '2019-01-01', maintenanceDate: '2020-01-01' },
-        { equipmentNumber: 'jkjkjkjkjk', equipmentName: '设备名称4(在使用)', equipmentModel: '设备型号', manufacturer: '制造商', purchaseDate: '2019-01-01', maintenanceDate: '2020-01-01', status: 1, projectName: '小小神射手', durationOfUse: 15, usageTime: '2024-08-07 08:09:11' },
-      ]
+      deviceManagementList: [],
+      allLoading: {
+        exportDeviceLoading: false,
+        tableLoading: false,
+        costFileLoading: false,
+        modifyCostLoading: false
+      },
+
+      costYmonth: this.dayjs().format('YYYY-MM'),
+      costDeviceCode: '',
+      deviceCostList: [],
+      uploadFileFormVal: {
+        file: '',
+        fileName: '',
+        ymonthStr: '',
+      },
+      uploadFileVisable: false,
+      modifyCostVisable: false,
+      modifyCostTitle: '',
+      modifyCostform: {
+        monthCost: ''
+      },
+      tableSelection: [],
+      permissions: JSON.parse(sessionStorage.getItem("permissions")),
     };
   },
   mounted() {
+    if (this.permissions.equipmentInformationManagement) {
+      this.menuIndex = 'info'
+      this.getDeviceManagementList()
+      return
+    }
+
+    if (this.permissions.equipmentCostManagement) {
+      this.menuIndex = 'cost'
+      this.getDeviceCostList()
+      return
+    }
   },
   methods: {
+    // 打印
+    print() {
+      this.$print(this.$refs.printContent)
+    },
+    getSummaries(param) {
+      const { columns, data } = param;
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = '总计';
+          return;
+        }
+        if (index === 5) {
+          const values = data.map(item => Number(item[column.property]));
+          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] = 'N/A';
+          }
+        }
+      });
+
+      return sums;
+    },
+    batchDeletion() {
+      const numbers = this.tableSelection.map(item => item.deviceCode).join(',')
+      const ids = this.tableSelection.map(item => item.id).join(',')
+      this.$confirm(`此操作将删除设备编码为【${numbers}】的设备, 是否继续?`, '删除设备', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.postData(`/device-cost/deleteBatch`, { ids }).then(() => {
+          this.$message({
+            type: 'success',
+            message: '删除成功!'
+          });
+          this.searchDevicesCost()
+        })
+      }).catch(() => { });
+    },
+    handleSelectionChange(val) {
+      this.tableSelection = val
+    },
+    modifyCostAmountOfMoney() {
+      const { id, monthCost } = this.modifyCostform
+      this.allLoading.modifyCostLoading = true
+      this.postData(`/device-cost/edit`, {
+        id,
+        monthCost
+      }).then(res => {
+        this.$message.success('修改成功')
+        this.modifyCostVisable = false
+        this.getDeviceCostList()
+      }).finally(() => {
+        this.allLoading.modifyCostLoading = false
+      })
+    },
+    exportDevice() {
+      this.allLoading.exportDeviceLoading = true
+      const formVal = this.deviceStringType === '1'
+        ? { deviceCode: this.equipmentCode }
+        : this.deviceStringType === '2'
+          ? { deviceName: this.equipmentCode }
+          : {};
+      this.postData(`/device/exportDevice`, {
+        ...formVal
+      }).then((res) => {
+        this.downloadFiles(res.data, '设备信息表')
+      }).finally(() => {
+        this.allLoading.exportDeviceLoading = false
+      })
+    },
     searchForDevices() {
-      console.log('点击搜索')
-      const newList = JSON.parse(JSON.stringify(this.deviceManagementListTwo))
-      this.deviceManagementList = newList.filter(item => item.equipmentNumber.indexOf(this.equipmentCode) > -1)
+      this.getDeviceManagementList()
+    },
+    searchDevicesCost() {
+      this.getDeviceCostList()
+    },
+    getDeviceCostList() {
+      this.allLoading.tableLoading = true
+      this.postData(`/device-cost/getDeviceCostPage`, {
+        pageIndex: this.pageIndex,
+        pageSize: this.pageSize,
+        deviceCode: this.costDeviceCode,
+        ymonth: this.costYmonth
+      }).then(res => {
+        const { total, mapList } = res.data
+        this.deviceCostList = mapList
+        this.total = total
+      }).finally(() => {
+        this.allLoading.tableLoading = false
+      })
+    },
+    getDeviceManagementList() {
+      const formVal = this.deviceStringType === '1'
+        ? { deviceCode: this.equipmentCode }
+        : this.deviceStringType === '2'
+          ? { deviceName: this.equipmentCode }
+          : {};
+      this.allLoading.tableLoading = true
+      this.postData(`/device/getDevicePage`, {
+        pageIndex: this.pageIndex,
+        pageSize: this.pageSize,
+        ...formVal
+      }).then(res => {
+        const { total, data } = res.data
+        this.deviceManagementList = data
+        this.total = total
+      }).finally(() => {
+        this.allLoading.tableLoading = false
+      })
+    },
+    uploadFileCost(file) {
+      console.log(file, '<==== 选择文件')
+      this.uploadFileFormVal = {
+        ...this.uploadFileFormVal,
+        file: file.file,
+        fileName: file.file.name
+      }
+    },
+    closeCostFile() {
+      this.uploadFileFormVal = {
+        ...this.uploadFileFormVal,
+        file: '',
+        fileName: ''
+      }
+    },
+    displaModifyCost(row) {
+      this.modifyCostform = { ...row }
+      this.modifyCostTitle = `修改设备编码【${row.deviceCode}】的成本`
+      this.modifyCostVisable = true
+    },
+    displayFileUpload() {
+      this.uploadFileFormVal = {
+        file: '',
+        fileName: '',
+        ymonthStr: this.dayjs().format('YYYY-MM'),
+      }
+      this.uploadFileVisable = true
     },
     seeDevice(i, row) {
-      QRCode.toDataURL(JSON.stringify(row))
+      console.log(JSON.stringify({id: row.id}))
+      QRCode.toDataURL(JSON.stringify({id: row.id}))
         .then(url => {
           this.qrCodeURL = url;
         })
@@ -131,50 +433,132 @@ export default {
       this.equipmentQrCodeVisable = true
     },
     editDevice(row, flag) {
-      this.equipmentForm = row
+      this.equipmentForm = { ...row }
       this.equipmentVisable = flag
     },
     deleteDevice(i, row) {
-      const { equipmentNumber } = row
-      this.$confirm(`此操作将删除设备编码为【${equipmentNumber}】的设备, 是否继续?`, '删除设备', {
+      const { deviceCode, id } = row
+      this.$confirm(`此操作将删除设备编码为【${deviceCode}】的设备, 是否继续?`, '删除设备', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        this.deviceManagementList.splice(i, 1)
-        this.deviceManagementListTwo.splice(i, 1)
-        this.$message({
-          type: 'success',
-          message: '删除成功!'
-        });
+        this.postData(`/device/delete`, { id }).then(() => {
+          this.$message({
+            type: 'success',
+            message: '删除成功!'
+          });
+          this.searchForDevices()
+        })
       }).catch(() => { });
     },
     submitForm(formName) {
       this.$refs[formName].validate((valid) => {
         if (valid) {
           console.log('submit!');
-          const { equipmentNumber } = this.equipmentForm
-          const numverList = this.deviceManagementList.map(item => item.equipmentNumber == equipmentNumber)
-          if (numverList.length > 0) {
+          this.postData('/device/updateOrInsert', this.equipmentForm).then(() => {
             this.$message({
-              message: '设备编号重复',
-              type: 'error'
-            })
-            return
-          }
-          this.deviceManagementList.push(this.equipmentForm)
-          this.deviceManagementListTwo.push(this.equipmentForm)
-          this.$message({
-            message: '提交成功',
-            type: 'success'
-          });
-          this.equipmentVisable = false
+              message: '操作成功',
+              type: 'success'
+            });
+            this.searchForDevices()
+            this.equipmentVisable = false
+          })
         } else {
           console.log('error submit!!');
           return false;
         }
       });
-    }
+    },
+    handleCurrentChange(val) {
+      this.pageIndex = val
+      this.menuHandleSelect(this.menuIndex, true)
+    },
+    handleSizeChange(val) {
+      this.pageSize = val
+      this.pageIndex = 1
+      this.menuHandleSelect(this.menuIndex, true)
+    },
+    menuHandleSelect(index, flag = false) {
+      console.log(flag, '<==== 已修改')
+      if (!flag) {
+        this.pageIndex = 1
+      }
+      if (index == 'info') {
+        this.getDeviceManagementList()
+      }
+      if (index == 'cost') {
+        this.searchDevicesCost()
+      }
+      this.tableSelection = []
+      this.menuIndex = index
+    },
+    downloadFiles(filePath, fileName) {
+      const a = document.createElement('a'); // 创建a标签
+      a.setAttribute('download', fileName + '.xlsx');// download属性
+      a.setAttribute('href', filePath);// href链接
+      a.click(); //自执行点击事件
+      a.remove();
+    },
+    uploadCostFiles() {
+      const file = this.uploadFileFormVal.file
+      const ymonthStr = this.uploadFileFormVal.ymonthStr
+      const formData = new FormData()
+      formData.append('file', file)
+      formData.append('ymonthStr', ymonthStr)
+      this.allLoading.costFileLoading = true
+      this.http.uploadFile(`/device-cost/importDeviceCost`, formData, res => {
+        if (res.code == 'ok') {
+          this.$message({
+            type: 'success',
+            message: `上传成功`
+          })
+          this.searchDevicesCost()
+        } else {
+          this.$message({
+            message: res.msg,
+            type: 'error'
+          })
+        }
+        this.uploadFileVisable = false
+        this.allLoading.costFileLoading = false
+      }, err => {
+        this.allLoading.costFileLoading = false
+      })
+    },
+    addEditCallback(done) {
+      this.$refs['equipmentruleForm'].resetFields();
+      done()
+    },
+    closeEquipmentVisable() {
+      this.$refs['equipmentruleForm'].resetFields();
+      this.equipmentVisable = false
+    },
+    async postData(urls, param) { // 封装请求函数
+      return new Promise((resolve, reject) => {
+        this.http.post(urls, { ...param },
+          res => {
+            if (res.code == 'ok') {
+              resolve(res)
+            } else {
+              this.$message({
+                message: res.msg,
+                type: 'error'
+              })
+              reject(res)
+            }
+            resolve(res)
+          },
+          error => {
+            this.$message({
+              message: error,
+              type: "error"
+            });
+            reject(error)
+          }
+        )
+      });
+    },
   },
 };
 </script>
@@ -182,9 +566,30 @@ export default {
 <style lang="scss" scoped>
 .deviceManagement {
   display: flex;
-  flex-direction: column;
+  flex-direction: row;
   height: 100%;
 
+  .deviceManagement-title-right {
+    display: flex;
+    align-items: center;
+    padding-right: 10px;
+  }
+
+  .deviceManagement-page {
+    background: #F2F2F2;
+    padding: 10px 20px;
+    display: flex;
+    box-sizing: border-box;
+    justify-content: space-between;
+  }
+
+  .deviceManagement-container {
+    flex: 1;
+    display: flex;
+    height: 100%;
+    flex-direction: column;
+  }
+
   .deviceManagement-title {
     display: flex;
     align-items: center;
@@ -198,7 +603,7 @@ export default {
       margin-right: 20px;
 
       &>div {
-        width: 80px;
+        width: 100px;
       }
     }
   }
@@ -215,23 +620,34 @@ export default {
   }
 
   .equipmentQrCodeImg {
-    width: 400px;
-    height: 400px;
+    width: 350px;
+    height: 350px;
     background: red;
+    margin: auto;
 
     img {
       width: 100%;
       height: 100%;
     }
   }
+  .equipmentQrCodeText {
+    width: 100%;
+    font-size: 20px;
+    padding: 0 20px 10px 20px;
+  }
 
   .equipmentQrCode {
     display: flex;
-    justify-content: center;
-    align-items: center;
-    flex-wrap: wrap;
+    flex-direction: column;
     width: 100%;
-    height: 500px;
+    height: 60vh;
+    overflow-y: auto;
+    overflow-x: hidden;
+  }
+
+  .textPrompt {
+    color: red;
+    padding: 0 0 0 30px;
   }
 }
 </style>

+ 208 - 3
fhKeeper/formulahousekeeper/timesheet_h5/src/views/deviceManagement/usageHistory.vue

@@ -1,7 +1,56 @@
 <template>
   <div class="useRegistration">
-    <van-nav-bar title="设备使用记录" left-text="返回" @click-left="back" fixed left-arrow style="z-index:1000" />
+    <van-nav-bar title="设备使用记录" left-text="返回" @click-left="back()" left-arrow style="z-index:1000" />
+    <van-dropdown-menu>
+      <van-dropdown-item :title="`开始日期:${starDate}`" ref="starCustom">
+        <van-datetime-picker type="date" title="选择开始时间" v-model="starCurrentDate"
+          @confirm="(date) => dataStartChange(date, 'star', 'starCustom')"
+          @cancel="closeDataStartChange('starCustom')" />
+      </van-dropdown-item>
+      <van-dropdown-item :title="`结束日期:${endDate}`" ref="endCustom">
+        <van-datetime-picker type="date" title="选择结束时间" v-model="endCurrentDate"
+          @confirm="(date) => dataStartChange(date, 'end', 'endCustom')"
+          @cancel="closeDataStartChange('endCustom')" />
+      </van-dropdown-item>
+    </van-dropdown-menu>
 
+    <!-- 主要内容 -->
+    <div class="primaryCoverage">
+      <div class="primaryCoverageItem" v-for="(item, index) in historicalRecordsList" :key="index">
+        <van-row>
+          <van-col span="6" class="primaryLabel">设备编码</van-col>
+          <van-col span="18">{{ item.deviceCode }}</van-col>
+        </van-row>
+        <van-row>
+          <van-col span="6" class="primaryLabel">设备名称</van-col>
+          <van-col span="18">{{ item.deviceName }}</van-col>
+        </van-row>
+        <van-row>
+          <van-col span="6" class="primaryLabel">投入项目</van-col>
+          <van-col span="18">{{ item.projectName }}</van-col>
+        </van-row>
+        <van-row>
+          <van-col span="6" class="primaryLabel">使用时段</van-col>
+          <van-col span="18" class="timeText
+          ">{{ item.startTime }} - {{ item.usageStatus ? '至今' : item.endTime }} </van-col>
+        </van-row>
+        <van-row style="display: flex;align-items: center;">
+          <van-col span="6" class="primaryLabel">使用时长</van-col>
+          <van-col span="14">
+            <span v-if="item.usageStatus" style="color: #FF5F4E;">使用中</span>
+            <span v-else>{{ item.useTime }} 小时</span>
+          </van-col>
+          <van-col span="4">
+            <template v-if="item.usageStatus">
+              <van-button type="primary" size="mini" @click="endOfUse(item)">结束使用</van-button>
+            </template>
+            <template v-if="!item.usageStatus">
+              <span style="color: #0283EF;">已完成</span>
+            </template>
+          </van-col>
+        </van-row>
+      </div>
+    </div>
   </div>
 </template>
 
@@ -9,12 +58,122 @@
 export default {
   data() {
     return {
-
+      starDate: this.getFirstDayOfMonth(),
+      endDate: this.getCurrentDate(),
+      starCurrentDate: new Date(),
+      endCurrentDate: new Date(),
+      historicalRecordsList: []
     };
   },
   mounted() {
+    this.retrieveUsageRecords()
   },
   methods: {
+    endOfUse(row) {
+      const { deviceId, projectId, startTime, deviceLogId, deviceName } = row
+      const endTime = this.getToday()
+      this.$dialog.confirm({
+        message: `确定结束使用【${deviceName}】设备?`
+      }).then(() => {
+        this.postData(`/device-log/updateDeviceUsageStatus`, { id: deviceId, projectId, startTime, endTime, deviceLogId, startOrEnd: false }).then((res) => {
+          this.$toast.success('操作成功')
+          this.retrieveUsageRecords()
+        })
+      })
+    },
+    retrieveUsageRecords() {
+      this.postData(`/device-log/getDeviceLogList`, {
+        startTime: `${this.starDate} 00:00`,
+        endTime: `${this.endDate} 23:59`
+      }).then((res) => {
+        const { data } = res
+        this.historicalRecordsList = data.map((item) => {
+          return {
+            ...item,
+            startTime: this.formatDateTime(item.startTime),
+            endTime: item.endTime ? this.formatDateTime(item.endTime) : ''
+          }
+        })
+      })
+    },
+    dataStartChange(date, type, refs) {
+      const one = new Date(date)
+      const two = new Date(this.starDate + ' 00:00:00')
+      const three = new Date(this.endDate)
+      if (type == 'star') {
+        if(one > three) {
+          this.$toast('选择开始时间不能大于结束时间')
+          return
+        }
+        this.starDate = this.formatDate(date)
+      }
+      if (type == 'end') {
+        if(one < two) {
+          this.$toast('选择结束时间不能小于开始时间')
+          return
+        }
+        this.endDate = this.formatDate(date)
+      }
+      this.closeDataStartChange(refs)
+      this.retrieveUsageRecords()
+    },
+    closeDataStartChange(type) {
+      if (type == 'starCustom') {
+        this.$refs.starCustom.toggle(false);
+      } else {
+        this.$refs.endCustom.toggle(false);
+      }
+    },
+    getToday() {
+      return this.formatDateTime(new Date())
+    },
+    formatDateTime(date) {
+      const dates = new Date(date);
+      return dates.toLocaleString('zh-CN', {
+        year: 'numeric',
+        month: '2-digit',
+        day: '2-digit',
+        hour: '2-digit',
+        minute: '2-digit',
+        hour12: false
+      }).replace(/\//g, '-');
+    },
+    // 格式化日期
+    formatDate(date) {
+      const year = date.getFullYear();
+      const month = String(date.getMonth() + 1).padStart(2, '0');
+      const day = String(date.getDate()).padStart(2, '0');
+      return `${year}-${month}-${day}`;
+    },
+    // 获取当月第一天 YYYY-MM-DD
+    getFirstDayOfMonth() {
+      const now = new Date();
+      const year = now.getFullYear();
+      const month = String(now.getMonth() + 1).padStart(2, '0');
+      const firstDay = '01';
+      return `${year}-${month}-${firstDay}`;
+    },
+    // 获取当天的日期 YYYY-MM-DD
+    getCurrentDate() {
+      const now = new Date();
+      const year = now.getFullYear();
+      const month = String(now.getMonth() + 1).padStart(2, '0');
+      const day = String(now.getDate()).padStart(2, '0');
+      return `${year}-${month}-${day}`;
+    },
+    async postData(urls, param) {
+      return new Promise((resolve, reject) => {
+        this.$axios.post(urls, { ...param })
+          .then(res => {
+            if (res.code == "ok") {
+              resolve(res)
+            } else {
+              this.$toast.fail('获取失败:' + res.msg);
+              reject(res)
+            }
+          }).catch(err => { this.$toast.clear(); reject(err) });
+      })
+    },
     back() {
       history.back();
     },
@@ -22,4 +181,50 @@ export default {
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+.useRegistration {
+  width: 100%;
+  height: 100vh;
+  display: flex;
+  flex-direction: column;
+
+  .primaryCoverage {
+    flex: 1;
+    overflow-y: auto;
+    box-sizing: border-box;
+    padding: 0 10px;
+    margin: 10px 0;
+  }
+
+  .primaryCoverageItem {
+    background: #fff;
+    width: 100%;
+    margin-bottom: 10px;
+    padding: 15px 20px;
+    box-sizing: border-box;
+    position: relative;
+    border-radius: 4px;
+    overflow: hidden;
+  }
+
+  .timeText {
+    font-size: 14px;
+  }
+
+  .primaryLabel {
+    color: #999 !important;
+  }
+
+  .van-row {
+    margin-bottom: 10px;
+
+    .van-col {
+      color: #333;
+    }
+
+    &:last-child {
+      margin-bottom: 0;
+    }
+  }
+}
+</style>

+ 121 - 25
fhKeeper/formulahousekeeper/timesheet_h5/src/views/deviceManagement/useRegistration.vue

@@ -6,19 +6,30 @@
     <div class="useRegistration-content">
       <van-cell-group>
         <van-field v-model="equipmentForm.code" label="设备编号" placeholder="请扫码" readonly clearable :label-width="100" />
-        <van-field v-model="equipmentForm.code" label="设备名称" placeholder="请扫码" readonly clearable :label-width="100" />
+        <van-field v-model="equipmentForm.name" label="设备名称" placeholder="请扫码" readonly clearable :label-width="100" />
         <van-field readonly v-model="equipmentForm.projectName" clickable type="textarea" autosize :label="'选择项目'"
-          :placeholder="'请选择项目'" @click="showPickerUserddp = true" />
-        <van-field v-model="equipmentForm.time" label="开始使用时间" placeholder="请选择使用时间" @click="endDateShow = true"
-          readonly clickable></van-field>
+          :placeholder="'请选择项目'" @click="showPopup('showPickerUserddp')" v-if="isItMe" />
+        <van-field v-model="equipmentForm.startTime" label="开始使用时间" placeholder="请选择使用时间"
+          @click="showPopup('endDateShow')" v-if="isItMe" readonly clickable></van-field>
+        <van-field v-model="equipmentForm.endTime" label="结束使用时间" placeholder="请选择结束时间"
+          @click="showPopup('endDateShowTwo', false)" v-if="status == 1 && isItMe" readonly clickable></van-field>
         <van-field v-model="durationOfUse" label="已使用时长(小时)" placeholder="请扫码" readonly clearable :label-width="120"
-          v-if="status == 1" />
+          v-if="status == 1 && isItMe" />
       </van-cell-group>
       <!-- 选择时间 -->
       <van-popup v-model="endDateShow" position="bottom">
-        <van-datetime-picker type="datetime" title="选择截止时间" v-model="currentDate2" @confirm="endDateChange"
+        <van-datetime-picker type="datetime" title="选择开始时间" v-model="currentDate2" @confirm="endDateChange"
           @cancel="endDateShow = false; $forceUpdate();" />
       </van-popup>
+      <van-popup v-model="endDateShowTwo" position="bottom">
+        <van-datetime-picker type="datetime" title="选择结束时间" v-model="currentDatetwo2" @confirm="endDateChangeTwo"
+          @cancel="endDateShowTwo = false; $forceUpdate();" />
+      </van-popup>
+      <!-- 不是本人 -->
+      <template v-if="!isItMe">
+        <van-field v-model="equipmentForm.usageUserName" label="使用人" readonly error clearable :label-width="100" />
+        <div class="equipmentUsage">该设备当前已被占用,请换其他设备扫码</div>
+      </template>
       <!-- 选择项目 -->
       <van-popup v-model="showPickerUserddp" position="bottom" style="height: 84%">
         <div class="popupDiv">
@@ -49,7 +60,7 @@
         </div>
       </van-popup>
     </div>
-    <div class="useRegistration-footer">
+    <div class="useRegistration-footer" v-if="isItMe">
       <van-button type="primary" size="info" round block @click="operation" :disabled="!this.equipmentForm.code">{{
         status == 0 ? '确定开始使用' : '确定结束使用' }}</van-button>
     </div>
@@ -70,7 +81,7 @@ export default {
         code: '',
         name: '',
         projectName: '',
-        time: this.getToday()
+        startTime: this.getToday()
       },
       endDateShow: false,
       currentDate2: this.getToday(),
@@ -82,7 +93,11 @@ export default {
       proads: [],
       showQrcode: false,
       status: 0, // 0: 新增,1:编辑
-      durationOfUse: 0
+      durationOfUse: 0,
+      endDateShowTwo: false,
+      currentDatetwo2: this.getToday(),
+      userInfo: JSON.parse(localStorage.userInfo),
+      isItMe: true // 是否为本人
     };
   },
   mounted() {
@@ -92,48 +107,118 @@ export default {
   },
   methods: {
     operation() {
+      const { id, projectId, startTime, endTime, deviceLogId } = this.equipmentForm
+      console.log(this.equipmentForm, '<===== this.equipmentForm')
+      if (endTime) {
+        const one = new Date(startTime)
+        const two = new Date(endTime)
+        if (one > two) {
+          this.$toast.fail('结束时间不能早于开始时间')
+          return
+        }
+      }
+      this.$axios.post("/device-log/updateDeviceUsageStatus", {
+        id,
+        projectId,
+        startTime,
+        endTime,
+        deviceLogId,
+        startOrEnd: !this.status ? true : false,
+      })
+        .then(res => {
+          if (res.code == "ok") {
+            this.$toast.success('操作成功')
+            this.resetData()
+          } else {
+            this.$toast.fail('获取失败:' + res.msg);
+          }
+        }).catch(err => { this.$toast.clear(); });
+    },
+    resetData() {
       this.equipmentForm = {
         code: '',
         name: '',
         projectName: '',
-        time: this.getToday()
-      },
-        this.status = 0
-      this.$toast.success('操作成功')
+        startTime: this.getToday()
+      }
+      this.status = 0
     },
     closeQrcode() {
       this.showQrcode = false
     },
     scanClick() {
       this.showQrcode = true
+      setTimeout(() => {
+        // const val = '{"id":3,"deviceCode":"设备编号1","deviceName":"设备名称1","deviceModel":"设备型号1","manufacturer":"制造商1","purchaseDate":"2024-10-09","maintenanceDate":"2024-10-10","companyId":10,"usageStatus":false,"usageUserId":null,"usageUserName":null,"projectId":null,"projectName":null,"startTime":null,"endTime":null,"startOrEnd":null,"deviceLogId":null,"useTime":null}'
+        const val = localStorage.getItem('scanCodeData')
+        this.determineQrcode(val)
+      }, 3000)
     },
     determineQrcode(val) {
       console.log(val, '<=========== val')
       if (val != '') {
         const newVal = JSON.parse(val)
-        this.equipmentForm = {
-          code: newVal.equipmentNumber,
-          name: newVal.equipmentName,
-          projectName: newVal.projectName,
-          time: newVal.usageTime
-        }
-        this.durationOfUse = newVal.durationOfUse || 0
-        this.status = newVal.status || 0
+        this.$axios.post("/device/getDeviceDetail", { id: newVal.id })
+          .then(res => {
+            if (res.code == "ok") {
+              console.log(res, '<===== 返回的数据')
+              const values = res.data
+              const endtimes = this.getToday()
+              this.equipmentForm = {
+                ...values,
+                code: values.deviceCode,
+                name: values.deviceName,
+                projectName: values.projectName,
+                startTime: values.startTime || this.getToday(),
+                id: values.id,
+                endTime: endtimes
+              }
+              this.durationOfUse = this.calculateUsageTime(res.data)
+              this.currentDatetwo2 = endtimes
+              this.status = values.usageStatus ? 1 : 0
+              if (values.usageUserId) {
+                this.isItMe = values.usageUserId == this.userInfo.id
+              } else {
+                this.isItMe = true
+              }
+            } else {
+              this.$toast.fail('获取失败:' + res.msg);
+            }
+          }).catch(err => { this.$toast.clear(); });
       } else {
         this.$toast.fail('无效的二维码')
       }
       this.closeQrcode()
     },
+    showPopup(type, flag = true) {
+      if (this.status == 1 && flag) {
+        return
+      }
+      this[type] = true
+    },
+    calculateUsageTime(row) {
+      const { startTime } = row
+      if (!startTime) {
+        return 0
+      }
+      const endTime = this.getToday()
+      const startDate = new Date(startTime);
+      const endDate = new Date(endTime);
+      const diffInMs = endDate - startDate;
+      const diffInHours = diffInMs / (1000 * 60 * 60);
+      return diffInHours.toFixed(2);
+    },
     reset() {
       this.equipmentForm = {
         code: '',
         name: '',
         projectName: '',
-        time: this.getToday()
+        startTime: this.getToday()
       }
     },
     fZr(row, index) {
       this.equipmentForm.projectName = row.projectName
+      this.equipmentForm.projectId = row.id
       this.showPickerUserddp = false
     },
     sea() {
@@ -156,14 +241,18 @@ export default {
       const day = String(date.getDate()).padStart(2, '0'); // 获取日期,并确保两位数
       const hours = String(date.getHours()).padStart(2, '0'); // 获取小时,并确保两位数
       const minutes = String(date.getMinutes()).padStart(2, '0'); // 获取分钟,并确保两位数
-      const seconds = String(date.getSeconds()).padStart(2, '0'); // 获取秒钟,并确保两位数
 
-      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+      return `${year}-${month}-${day} ${hours}:${minutes}`;
     },
     endDateChange(date) {
-      this.equipmentForm.time = this.formatDate(date)
+      console.log('执行了')
+      this.equipmentForm.startTime = this.formatDate(date)
       this.endDateShow = false
     },
+    endDateChangeTwo(date) {
+      this.equipmentForm.endTime = this.formatDate(date)
+      this.endDateShowTwo = false
+    },
     back() {
       history.back();
     },
@@ -226,5 +315,12 @@ export default {
     height: 100vh;
     z-index: 9999;
   }
+
+  .equipmentUsage {
+    width: 100%;
+    text-align: center;
+    color: #ee0a24;
+    padding-top: 40px;
+  }
 }
 </style>

+ 43 - 21
fhKeeper/formulahousekeeper/timesheet_h5/src/views/index/index.vue

@@ -1,20 +1,18 @@
 <template>
-    <div class="body">
+    <div class="body indexFlex">
         <van-swipe class="my-swipe" :autoplay="3000" :height="200" indicator-color="white">
             <van-swipe-item v-for="(item, index) in images" :key="index" class="swipe-img">
                 <img :src="item"/>
             </van-swipe-item> 
         </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)">
-            </van-grid-item>
-        </van-grid>
-        <!-- <div class="tip"  v-if="isCorpWX">
-            工时报表统计等更多功能,请从PC端企业微信进入
-        </div> -->
-        <!-- <van-icon v-if="isCorpWX" class="kefu" name="service-o" size="30" color="#20a0ff" @click="tokefu" /> -->
+        <div class="indexFlex1">
+            <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)">
+                </van-grid-item>
+            </van-grid>
+        </div>
         <div v-if="isCorpWX" class="kefu" @click="tokefu"><img src="../../assets/icon/kefu.png" alt=""></div>
         <div class="tip"  v-if="!isCorpWX">
             体验报表统计等更多功能,尽在PC端<br>
@@ -273,6 +271,18 @@
                             icon: 'balance-list-o'
                         });
                     }
+                    
+                    if(list[i].name == '设备管理') {
+                        this.routers.push({
+                            name: '设备管理',
+                            url: '/useRegistration',
+                            icon: 'label-o'
+                        }, {
+                            name: '设备使用记录',
+                            url: '/usageHistory',
+                            icon: 'label-o'
+                        });
+                    }
                 }
                 if (this.user.manageDeptId != 0 && this.user.company.packageEngineering == 1) {
                     this.routers.push(
@@ -301,14 +311,17 @@
                 }
 
                 // 设备管理
-                if(this.user.companyId == 10) {
-                    this.routers.push(
-                    {
-                        name: '设备管理',
-                        url: '/useRegistration',
-                        icon: 'label-o'
-                    });
-                }
+                // if(this.user.companyId == 10) {
+                //     this.routers.push({
+                //         name: '设备管理',
+                //         url: '/useRegistration',
+                //         icon: 'label-o'
+                //     }, {
+                //         name: '设备使用记录',
+                //         url: '/usageHistory',
+                //         icon: 'label-o'
+                //     });
+                // }
             },
 
             // 获取企业微信参数
@@ -498,6 +511,16 @@
 </script>
 
 <style lang="less" scoped>
+    .indexFlex {
+        display: flex;
+        flex-direction: column;
+        height: 100%;
+        width: 100%;
+        .indexFlex1 {
+            flex: 1;
+            overflow-y: auto;
+        }
+    }
     .swipe-img {
         img {
             width: 100%;
@@ -526,12 +549,11 @@
     }
 
     .tip {
-        position: absolute;
         width: 100%;
         bottom: 5px;
         font-size: 14px;
         color: #8f8f8f;
-        margin-top: 20px;
+        margin-top: 10px;
         text-align: center;
         line-height: 20px;
     }