|
@@ -6,12 +6,13 @@
|
|
|
<!-- 按钮部分-->
|
|
<!-- 按钮部分-->
|
|
|
<el-form ref="elSearchFormRef" class="demo-form-inline" :rules="searchRule" >
|
|
<el-form ref="elSearchFormRef" class="demo-form-inline" :rules="searchRule" >
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
|
- <el-input v-model="searchInfo" placeholder="搜索工单编号" clearable style="width: 200px;margin: 5px"></el-input>
|
|
|
|
|
|
|
+ <el-input v-model="searchInfo" placeholder="搜索维修原因" clearable style="width: 200px;margin: 5px"></el-input>
|
|
|
<el-button type="primary" class="bt" icon="search" @click="search">搜索</el-button>
|
|
<el-button type="primary" class="bt" icon="search" @click="search">搜索</el-button>
|
|
|
- <el-button type="primary" class="bt" icon="download" @click="search">维修工时统计</el-button>
|
|
|
|
|
- <el-button type="primary" class="bt" icon="download" @click="hzToExcel" >设备运行时间统计</el-button>
|
|
|
|
|
- <el-button type="primary" class="bt" icon="download" @click="hzToExcel" >导出到Excel</el-button>
|
|
|
|
|
|
|
+ <el-button type="primary" class="bt" icon="download" v-if="iscode === true" @click="wxgstoexcel">维修工时统计</el-button>
|
|
|
|
|
+ <el-button type="primary" class="bt" icon="download" v-if="iscode === true" @click="yxsjToExcel" >设备运行时间统计</el-button>
|
|
|
|
|
+ <el-button type="primary" class="bt" icon="download" @click="wxToExcel" >导出到Excel</el-button>
|
|
|
<el-button type="primary" class="bt" @click="onADD" >新增</el-button>
|
|
<el-button type="primary" class="bt" @click="onADD" >新增</el-button>
|
|
|
|
|
+ <el-button type="primary" class="bt" :disabled="!selectedIds" @click="onDelete" >删除</el-button>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
|
|
@@ -41,15 +42,14 @@
|
|
|
@selection-change="selectionChange($event)"
|
|
@selection-change="selectionChange($event)"
|
|
|
:row-style="{ height: '20px' }" :selectable="checkboxT"
|
|
:row-style="{ height: '20px' }" :selectable="checkboxT"
|
|
|
:cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
|
|
:cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
|
|
|
- :header-cell-style="{ padding: '0px' }" @row-click="wxyearRowClick"
|
|
|
|
|
- :row-class-name="pchzrowClassStyle"
|
|
|
|
|
|
|
+ :header-cell-style="{ padding: '0px' }" @row-click="yearRowClick"
|
|
|
|
|
+ :row-class-name="pchzrowClassStyle"
|
|
|
highlight-current-row="true" @row-dblclick="gytableDatadoubleClick" id="pchztable"
|
|
highlight-current-row="true" @row-dblclick="gytableDatadoubleClick" id="pchztable"
|
|
|
style="width: 100%;height: 30vh" border tooltip-effect="dark" :data="yeartableData" row-key="ID" >
|
|
style="width: 100%;height: 30vh" border tooltip-effect="dark" :data="yeartableData" row-key="ID" >
|
|
|
<el-table-column sortable align="center" label="使用部门" prop="使用部门" width="120" />
|
|
<el-table-column sortable align="center" label="使用部门" prop="使用部门" width="120" />
|
|
|
<el-table-column sortable align="center" label="设备编号" prop="设备编号" width="130" />
|
|
<el-table-column sortable align="center" label="设备编号" prop="设备编号" width="130" />
|
|
|
<el-table-column align="center" label="设备名称" prop="设备名称" width="220" />
|
|
<el-table-column align="center" label="设备名称" prop="设备名称" width="220" />
|
|
|
- <el-table-column v-if="yearcode === 1" align="center" label="维修次数" prop="total" width="90" />
|
|
|
|
|
- <el-table-column v-else-if="yearcode === 2" align="center" label="保养次数" prop="total" width="90" />
|
|
|
|
|
|
|
+ <el-table-column align="center" :label="yearcode=== 1 ? '维修次数' : '保养次数'" prop="total" width="90" />
|
|
|
<el-table-column align="center" label="1月" prop="01" width="70" />
|
|
<el-table-column align="center" label="1月" prop="01" width="70" />
|
|
|
<el-table-column align="center" label="2月" prop="02" width="70" />
|
|
<el-table-column align="center" label="2月" prop="02" width="70" />
|
|
|
<el-table-column align="center" label="3月" prop="03" width="70" />
|
|
<el-table-column align="center" label="3月" prop="03" width="70" />
|
|
@@ -69,50 +69,52 @@
|
|
|
<el-table ref="multipleTable"
|
|
<el-table ref="multipleTable"
|
|
|
v-if="!isyear && iscode"
|
|
v-if="!isyear && iscode"
|
|
|
:show-overflow-tooltip="true"
|
|
:show-overflow-tooltip="true"
|
|
|
- @selection-change="selectionChange($event)"
|
|
|
|
|
:row-style="{ height: '20px' }" :selectable="checkboxT"
|
|
:row-style="{ height: '20px' }" :selectable="checkboxT"
|
|
|
:cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
|
|
:cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
|
|
|
- :header-cell-style="{ padding: '0px' }" @row-click="sbhzRowClick"
|
|
|
|
|
- highlight-current-row="true" @row-dblclick="gytableDatadoubleClick" id="sbhztable"
|
|
|
|
|
|
|
+ :header-cell-style="{ padding: '0px' }" @row-click="wxmonthRowClick"
|
|
|
|
|
+ highlight-current-row="true" @row-dblclick="wxmonthdoubleClick" id="wxtable"
|
|
|
|
|
+ @selection-change="wxSelectionChange"
|
|
|
style="width: 100%;height: 30vh" border tooltip-effect="dark" :data="wxmonthtableData" row-key="ID" >
|
|
style="width: 100%;height: 30vh" border tooltip-effect="dark" :data="wxmonthtableData" row-key="ID" >
|
|
|
- <el-table-column fixed align="left" label="设备编号" prop="设备编号" width="90"/>
|
|
|
|
|
- <el-table-column fixed align="left" label="设备名称" prop="设备名称" width="220"/>
|
|
|
|
|
- <el-table-column align="left" label="报障时间" prop="报障时间" width="120"/>
|
|
|
|
|
- <el-table-column align="left" label="维修受理时间" prop="维修受理时间" width="120"/>
|
|
|
|
|
- <el-table-column align="left" label="修复时间" prop="修复时间" width="120"/>
|
|
|
|
|
- <el-table-column align="left" label="故障维修工时" prop="故障维修工时" width="110"/>
|
|
|
|
|
- <el-table-column align="left" label="非故障维修工时" prop="非故障维修工时" width="125"/>
|
|
|
|
|
- <el-table-column align="left" label="计划维修工时" prop="计划维修工时" width="110"/>
|
|
|
|
|
- <el-table-column align="left" label="专项维修工时" prop="专项维修工时" width="110"/>
|
|
|
|
|
- <el-table-column align="left" label="验收情况" prop="验收情况" width="110"/>
|
|
|
|
|
- <el-table-column align="left" label="维修姓名1" prop="维修姓名1" width="110"/>
|
|
|
|
|
- <el-table-column align="left" label="故障现象" prop="故障现象" width="110"/>
|
|
|
|
|
- <el-table-column align="left" label="处理方法" prop="处理方法" width="110"/>
|
|
|
|
|
- <el-table-column align="left" label="使用部门" prop="使用部门" width="110"/>
|
|
|
|
|
- <el-table-column align="left" label="创建用户" prop="创建用户" width="110"/>
|
|
|
|
|
- <el-table-column align="left" label="创建时间" prop="创建时间" width="120"/>
|
|
|
|
|
- <el-table-column align="left" label="修改时间" prop="修改时间" width="120"/>
|
|
|
|
|
|
|
+ <el-table-column type="selection" width="30" />
|
|
|
|
|
+ <el-table-column fixed align="left" label="设备编号" prop="设备编号" width="90"/>
|
|
|
|
|
+ <el-table-column fixed align="left" label="设备名称" prop="设备名称" width="220"/>
|
|
|
|
|
+ <el-table-column align="left" label="报障时间" prop="报障时间" width="120"/>
|
|
|
|
|
+ <el-table-column align="left" label="维修受理时间" prop="维修受理时间" width="120"/>
|
|
|
|
|
+ <el-table-column align="left" label="修复时间" prop="修复时间" width="120"/>
|
|
|
|
|
+ <el-table-column align="left" label="故障维修工时" prop="故障维修工时" width="110"/>
|
|
|
|
|
+ <el-table-column align="left" label="非故障维修工时" prop="非故障维修工时" width="125"/>
|
|
|
|
|
+ <el-table-column align="left" label="计划维修工时" prop="计划维修工时" width="110"/>
|
|
|
|
|
+ <el-table-column align="left" label="专项维修工时" prop="专项维修工时" width="110"/>
|
|
|
|
|
+ <el-table-column align="left" label="验收情况" prop="验收情况" width="110"/>
|
|
|
|
|
+ <el-table-column align="left" label="维修姓名1" prop="维修姓名1" width="110"/>
|
|
|
|
|
+ <el-table-column align="left" label="故障现象" prop="故障现象" width="110"/>
|
|
|
|
|
+ <el-table-column align="left" label="处理方法" prop="处理方法" width="110"/>
|
|
|
|
|
+ <el-table-column align="left" label="使用部门" prop="使用部门" width="110"/>
|
|
|
|
|
+ <el-table-column align="left" label="创建用户" prop="创建用户" width="110"/>
|
|
|
|
|
+ <el-table-column align="left" label="创建时间" prop="创建时间" width="120"/>
|
|
|
|
|
+ <el-table-column align="left" label="修改时间" prop="修改时间" width="120"/>
|
|
|
</el-table>
|
|
</el-table>
|
|
|
|
|
|
|
|
<el-table ref="JPmultipleTable"
|
|
<el-table ref="JPmultipleTable"
|
|
|
v-if="!isyear && !iscode"
|
|
v-if="!isyear && !iscode"
|
|
|
:show-overflow-tooltip="true"
|
|
:show-overflow-tooltip="true"
|
|
|
- @selection-change="selectionChange($event)"
|
|
|
|
|
:row-style="{ height: '20px' }" :cell-class-name="tableDataCellClass"
|
|
:row-style="{ height: '20px' }" :cell-class-name="tableDataCellClass"
|
|
|
:cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
|
|
:cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
|
|
|
- :header-cell-style="{ padding: '0px' }" @row-click="sbmxRowClick"
|
|
|
|
|
|
|
+ :header-cell-style="{ padding: '0px' }" @row-click="bymonthRowClick"
|
|
|
:row-class-name="sbmxrowClassStyle"
|
|
:row-class-name="sbmxrowClassStyle"
|
|
|
- highlight-current-row="true" @row-dblclick="JPgytableDatadoubleClick" id="sbmxtable"
|
|
|
|
|
|
|
+ highlight-current-row="true" @row-dblclick="bymonthdoubleClick" id="sbmxtable"
|
|
|
|
|
+ @selection-change="bySelectionChange"
|
|
|
style="width: 100%;height: 45vh" border tooltip-effect="dark" :data="bymonthtableData" row-key="ID" >
|
|
style="width: 100%;height: 45vh" border tooltip-effect="dark" :data="bymonthtableData" row-key="ID" >
|
|
|
|
|
+ <el-table-column type="selection" width="30" />
|
|
|
<el-table-column align="left" label="设备编号" prop="设备编号" width="100" />
|
|
<el-table-column align="left" label="设备编号" prop="设备编号" width="100" />
|
|
|
<el-table-column align="left" label="设备名称" prop="设备名称" width="200" />
|
|
<el-table-column align="left" label="设备名称" prop="设备名称" width="200" />
|
|
|
<el-table-column align="left" label="使用部门" prop="使用部门" width="100" />
|
|
<el-table-column align="left" label="使用部门" prop="使用部门" width="100" />
|
|
|
- <el-table-column align="left" label="保养日期" prop="保养日期" width="120" />
|
|
|
|
|
|
|
+ <el-table-column align="left" label="保养类型" prop="保养类型" width="120" />
|
|
|
<el-table-column align="left" label="保养开始时间" prop="保养开始时间" width="120" />
|
|
<el-table-column align="left" label="保养开始时间" prop="保养开始时间" width="120" />
|
|
|
<el-table-column align="left" label="保养结束时间" prop="保养结束时间" width="120" />
|
|
<el-table-column align="left" label="保养结束时间" prop="保养结束时间" width="120" />
|
|
|
<el-table-column align="left" label="保养工时" prop="保养工时" width="100" />
|
|
<el-table-column align="left" label="保养工时" prop="保养工时" width="100" />
|
|
|
<el-table-column align="left" label="执行机修" prop="执行机修" width="100" />
|
|
<el-table-column align="left" label="执行机修" prop="执行机修" width="100" />
|
|
|
- <el-table-column align="left" label="执行机长" prop="保养人员" width="100" />
|
|
|
|
|
|
|
+ <el-table-column align="left" label="执行机长" prop="执行机长" width="100" />
|
|
|
<el-table-column align="left" label="保养备注" prop="保养备注" width="150" />
|
|
<el-table-column align="left" label="保养备注" prop="保养备注" width="150" />
|
|
|
<el-table-column align="left" label="验收人员" prop="验收人员" width="100" />
|
|
<el-table-column align="left" label="验收人员" prop="验收人员" width="100" />
|
|
|
<el-table-column align="left" label="验收备注" prop="验收备注" width="150" />
|
|
<el-table-column align="left" label="验收备注" prop="验收备注" width="150" />
|
|
@@ -128,14 +130,14 @@
|
|
|
:cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
|
|
:cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
|
|
|
:header-cell-style="{ padding: '0px' }" @row-click="getUid"
|
|
:header-cell-style="{ padding: '0px' }" @row-click="getUid"
|
|
|
highlight-current-row="true" @row-dblclick="JPgytableDatadoubleClick" id="pcmxtable"
|
|
highlight-current-row="true" @row-dblclick="JPgytableDatadoubleClick" id="pcmxtable"
|
|
|
- style="width: 100%;height: 45vh" border tooltip-effect="dark" :data="pcmxtableData" row-key="ID" >
|
|
|
|
|
|
|
+ style="width: 100%;height: 45vh" border tooltip-effect="dark" :data="mxtableData" row-key="ID" >
|
|
|
<el-table-column align="left" fixed label="日期" prop="日期" width="110"/>
|
|
<el-table-column align="left" fixed label="日期" prop="日期" width="110"/>
|
|
|
<el-table-column align="left" fixed label="交易类别" prop="交易类别" width="90"/>
|
|
<el-table-column align="left" fixed label="交易类别" prop="交易类别" width="90"/>
|
|
|
<el-table-column align="left" fixed label="领用部门" prop="领用部门" width="90"/>
|
|
<el-table-column align="left" fixed label="领用部门" prop="领用部门" width="90"/>
|
|
|
<el-table-column align="left" label="机台编号" prop="机台编号" width="90"/>
|
|
<el-table-column align="left" label="机台编号" prop="机台编号" width="90"/>
|
|
|
<el-table-column align="left" label="仓库编号" prop="仓库编号" width="90"/>
|
|
<el-table-column align="left" label="仓库编号" prop="仓库编号" width="90"/>
|
|
|
<el-table-column align="left" label="仓库名称" prop="仓库名称" width="120"/>
|
|
<el-table-column align="left" label="仓库名称" prop="仓库名称" width="120"/>
|
|
|
- <el-table-column align="left" label="物料编号" prop="物料编号" width="90"/>
|
|
|
|
|
|
|
+ <el-table-column align="left" label="物料编号" prop="物料编号" width="120"/>
|
|
|
<el-table-column align="left" label="物料名称" prop="物料名称" width="120"/>
|
|
<el-table-column align="left" label="物料名称" prop="物料名称" width="120"/>
|
|
|
<el-table-column align="left" label="领用数量" prop="领用数量" width="90"/>
|
|
<el-table-column align="left" label="领用数量" prop="领用数量" width="90"/>
|
|
|
<el-table-column align="left" label="领用单位" prop="领用单位" width="110"/>
|
|
<el-table-column align="left" label="领用单位" prop="领用单位" width="110"/>
|
|
@@ -148,8 +150,8 @@
|
|
|
|
|
|
|
|
<!-- 设备维修记录弹出框 -->
|
|
<!-- 设备维修记录弹出框 -->
|
|
|
<el-dialog
|
|
<el-dialog
|
|
|
- v-model="dialogFormVisible"
|
|
|
|
|
- :before-close="closeDialog"
|
|
|
|
|
|
|
+ v-model="dialogwxFormVisible"
|
|
|
|
|
+ :before-close="wxcloseDialog"
|
|
|
:title="type === 'create' ? '设备维修记录新增' : '设备维修记录修改'"
|
|
:title="type === 'create' ? '设备维修记录新增' : '设备维修记录修改'"
|
|
|
destroy-on-close
|
|
destroy-on-close
|
|
|
style="width: 60%; margin: 5vh auto;"
|
|
style="width: 60%; margin: 5vh auto;"
|
|
@@ -318,8 +320,156 @@
|
|
|
<!-- 弹窗底部按钮 -->
|
|
<!-- 弹窗底部按钮 -->
|
|
|
<template #footer>
|
|
<template #footer>
|
|
|
<div class="dialog-footer" style="width: 100%;">
|
|
<div class="dialog-footer" style="width: 100%;">
|
|
|
- <el-button @click="closeDialog" style="width: 100px; height: 40px;">关 闭</el-button>
|
|
|
|
|
- <el-button type="primary" @click="enterDialog" style="width: 100px; height: 40px;">确 定</el-button>
|
|
|
|
|
|
|
+ <el-button @click="wxcloseDialog" style="width: 100px; height: 40px;">关 闭</el-button>
|
|
|
|
|
+ <el-button type="primary" @click="wxenterDialog" style="width: 100px; height: 40px;">确 定</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+</el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+<!-- 设备保养记录弹出框 -->
|
|
|
|
|
+<el-dialog
|
|
|
|
|
+ v-model="dialogbyFormVisible"
|
|
|
|
|
+ :before-close="bycloseDialog"
|
|
|
|
|
+ :title="type === 'create' ? '设备保养记录新增' : '设备保养记录修改'"
|
|
|
|
|
+ destroy-on-close
|
|
|
|
|
+ style="width: 60%; margin: 5vh auto;"
|
|
|
|
|
+>
|
|
|
|
|
+ <el-form :model="maintenanceForm" label-width="120px">
|
|
|
|
|
+ <!-- 第一行:部门 -->
|
|
|
|
|
+ <el-row :gutter="20">
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="部门">
|
|
|
|
|
+ <el-input v-model="maintenanceForm.部门" @keyup.enter="getbm()" placeholder="请输入部门" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 第二行:设备信息 -->
|
|
|
|
|
+ <el-row :gutter="20">
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="设备编号">
|
|
|
|
|
+ <el-input v-model="maintenanceForm.设备编号" @keyup.enter="getsb()" placeholder="请输入设备编号" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="设备名称">
|
|
|
|
|
+ <el-input v-model="maintenanceForm.设备名称" placeholder="请输入设备名称" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 第三行:保养信息 -->
|
|
|
|
|
+ <el-row :gutter="20">
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="保养类型">
|
|
|
|
|
+ <el-select v-model="maintenanceForm.保养类型" placeholder="请选择保养类型" style="width: 100%">
|
|
|
|
|
+ <el-option label="一级保养" value="一级保养" />
|
|
|
|
|
+ <el-option label="二级保养" value="二级保养" />
|
|
|
|
|
+ <el-option label="三级保养" value="三级保养" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 第四行:保养时间 -->
|
|
|
|
|
+ <el-row :gutter="20">
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="保养时间段">
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="maintenanceForm.保养时间段"
|
|
|
|
|
+ type="datetimerange"
|
|
|
|
|
+ range-separator="至"
|
|
|
|
|
+ start-placeholder="开始时间"
|
|
|
|
|
+ end-placeholder="结束时间"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="6">
|
|
|
|
|
+ <el-form-item label="保养工时">
|
|
|
|
|
+ <el-input v-model="maintenanceForm.保养工时" placeholder="请输入保养工时" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 第五行:执行人员 -->
|
|
|
|
|
+ <el-row :gutter="20">
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="执行机修">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="maintenanceForm.code1"
|
|
|
|
|
+ @keyup.enter.native="() => openEmployeeDialog('code1')"
|
|
|
|
|
+ placeholder="请输入编号或首字母缩写"
|
|
|
|
|
+ />
|
|
|
|
|
+ <el-input v-model="maintenanceForm.name1" readonly />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="执行机长">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="maintenanceForm.code2"
|
|
|
|
|
+ @keyup.enter.native="() => openEmployeeDialog('code2')"
|
|
|
|
|
+ placeholder="请输入编号或首字母缩写"
|
|
|
|
|
+ />
|
|
|
|
|
+ <el-input v-model="maintenanceForm.name2" readonly />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 第六行:保养信息 -->
|
|
|
|
|
+ <el-form-item label="保养备注">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="maintenanceForm.保养备注"
|
|
|
|
|
+ type="textarea"
|
|
|
|
|
+ :rows="3"
|
|
|
|
|
+ placeholder="请输入保养备注"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 第六行:验收信息 -->
|
|
|
|
|
+ <el-row :gutter="20">
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="验收人员">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="maintenanceForm.code3"
|
|
|
|
|
+ @keyup.enter.native="() => openEmployeeDialog('code3')"
|
|
|
|
|
+ placeholder="请输入编号或首字母缩写"
|
|
|
|
|
+ />
|
|
|
|
|
+ <el-input v-model="maintenanceForm.name3" readonly />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item label="验收备注">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="maintenanceForm.验收备注"
|
|
|
|
|
+ type="textarea"
|
|
|
|
|
+ :rows="3"
|
|
|
|
|
+ placeholder="请输入验收备注"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 第七行:工时信息 -->
|
|
|
|
|
+ <el-row :gutter="20">
|
|
|
|
|
+
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="保养评价">
|
|
|
|
|
+ <el-select v-model="maintenanceForm.保养评价" placeholder="请选择保养评价" style="width: 100%">
|
|
|
|
|
+ <el-option label="合格" value="合格" />
|
|
|
|
|
+ <el-option label="不合格" value="不合格" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 弹窗底部按钮 -->
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <div class="dialog-footer" style="width: 100%;">
|
|
|
|
|
+ <el-button @click="bycloseDialog" style="width: 100px; height: 40px;">关 闭</el-button>
|
|
|
|
|
+ <el-button type="primary" @click="byenterDialog" style="width: 100px; height: 40px;">确 定</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
@@ -372,6 +522,47 @@
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ <!-- 维修人员工作设备维修统计弹窗-->
|
|
|
|
|
+<el-dialog v-model="wxtjDialog" title="维修人员工作设备维修统计" destroy-on-close style="height: 30%;width: 20%;">
|
|
|
|
|
+ <el-form-item label="选择年月" label-width="100px">
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="wxtjrq"
|
|
|
|
|
+ type="month"
|
|
|
|
|
+ placeholder="选择年月"
|
|
|
|
|
+ :default-value="new Date()"
|
|
|
|
|
+ @change="onchange_data"
|
|
|
|
|
+ style="width: 200px;"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <div class="dialog-footer" style="text-align: right;">
|
|
|
|
|
+ <el-button @click="wxtjcloseDialog">取消</el-button>
|
|
|
|
|
+ <el-button type="primary" @click="wxtjonDialog">确定</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 设备维修保养记录导出弹窗-->
|
|
|
|
|
+<el-dialog v-model="sbyxDialog" title="设备维修保养记录导出" destroy-on-close style="height: 30%;width: 20%;">
|
|
|
|
|
+ <el-form-item label="选择年月" label-width="100px">
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="sbyxrq"
|
|
|
|
|
+ type="month"
|
|
|
|
|
+ placeholder="选择年月"
|
|
|
|
|
+ :default-value="new Date()"
|
|
|
|
|
+ @change="onchange_data"
|
|
|
|
|
+ style="width: 200px;"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <div class="dialog-footer" style="text-align: right;">
|
|
|
|
|
+ <el-button @click="sbyxcloseDialog">取消</el-button>
|
|
|
|
|
+ <el-button type="primary" @click="sbyxonDialog">确定</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
</el-main>
|
|
</el-main>
|
|
|
</layout-content>
|
|
</layout-content>
|
|
@@ -381,16 +572,37 @@
|
|
|
</template>
|
|
</template>
|
|
|
<script setup>
|
|
<script setup>
|
|
|
// 全量引入格式化工具 请按需保留
|
|
// 全量引入格式化工具 请按需保留
|
|
|
|
|
+ import dayjs, { Dayjs } from 'dayjs';
|
|
|
import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
|
|
import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
|
|
|
import {ref, reactive} from 'vue'
|
|
import {ref, reactive} from 'vue'
|
|
|
import { exportExcelFile } from '@/utils/excel'
|
|
import { exportExcelFile } from '@/utils/excel'
|
|
|
- import {ElMessage} from "element-plus";
|
|
|
|
|
- import {getMaintenanceTab,YearMaintenanceList,YearAccessoriesList,YearMaintainList,MonthAccessoriesList,MouthMaintainList,getDepartment} from "@/api/mes/job.js"
|
|
|
|
|
|
|
+ import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
|
|
+ import {getMaintenanceTab,YearMaintenanceList,YearAccessoriesList,YearMaintainList,MonthAccessoriesList,
|
|
|
|
|
+ MouthMaintainList,getDepartment,MachineMaintenanceAdd,MachineMaintenanceDetail,MachineMaintenanceUpdate,
|
|
|
|
|
+ MachineMaintainAdd,MachineMaintainDetail,MachineMaintainUpdate,MachineMaintainDelete} from "@/api/mes/job.js"
|
|
|
import {gdzl_MachineList} from "@/api/yunyin/yunying.js"
|
|
import {gdzl_MachineList} from "@/api/yunyin/yunying.js"
|
|
|
import {getYg} from "@/api/jixiaoguanli/jitairibaobiao"
|
|
import {getYg} from "@/api/jixiaoguanli/jitairibaobiao"
|
|
|
|
|
+ import { useUserStore } from '@/pinia/modules/user'
|
|
|
|
|
+ import * as XLSX from 'xlsx'
|
|
|
|
|
+ import FileSaver from 'file-saver'
|
|
|
|
|
+
|
|
|
|
|
+ const userStore = useUserStore()
|
|
|
|
|
+ const sys_id='['+userStore.userInfo.userName+'/'+userStore.userInfo.nickName+']'
|
|
|
|
|
|
|
|
|
|
|
|
|
defineOptions({name: 'Company'})
|
|
defineOptions({name: 'Company'})
|
|
|
|
|
+
|
|
|
|
|
+ // 获取当前日期
|
|
|
|
|
+const today = new Date();
|
|
|
|
|
+ const year = today.getFullYear();
|
|
|
|
|
+ const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要补零
|
|
|
|
|
+ const day = String(today.getDate()).padStart(2, '0');
|
|
|
|
|
+ const hours = String(today.getHours()).padStart(2, '0');
|
|
|
|
|
+ const minutes = String(today.getMinutes()).padStart(2, '0');
|
|
|
|
|
+ const seconds = String(today.getSeconds()).padStart(2, '0');
|
|
|
|
|
+ const currentDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
|
|
|
+ const currentDates = `${year}-${month}-${day}`;
|
|
|
|
|
+
|
|
|
// =========== 获取左侧树侧形结构 ===========
|
|
// =========== 获取左侧树侧形结构 ===========
|
|
|
const treeData = ref([])
|
|
const treeData = ref([])
|
|
|
|
|
|
|
@@ -450,70 +662,63 @@
|
|
|
|
|
|
|
|
getTreeData()
|
|
getTreeData()
|
|
|
|
|
|
|
|
-const yearcode = ref(0)//判断年度维修or年度保养
|
|
|
|
|
-const isyear = ref(false)//判断年度
|
|
|
|
|
-const iscode = ref(false)//判断月度
|
|
|
|
|
-const wxmonthtableData = ref([]) // 月度维修
|
|
|
|
|
-const bymonthtableData = ref([]) // 月度保养
|
|
|
|
|
|
|
+const yearcode = ref(0); // 判断维修(1)或保养(2)
|
|
|
|
|
+const isyear = ref(false); // 判断年度
|
|
|
|
|
+const iscode = ref(false); // 判断月度
|
|
|
|
|
+const wxmonthtableData = ref([]); // 月度维修
|
|
|
|
|
+const bymonthtableData = ref([]); // 月度保养
|
|
|
const yeartableData = ref([]);
|
|
const yeartableData = ref([]);
|
|
|
|
|
+const mxtableData = ref([]);
|
|
|
|
|
+const noderq = ref(''); // 节点的日期
|
|
|
|
|
+
|
|
|
|
|
+// 通用的行点击处理
|
|
|
|
|
+const handleRowClick = async (row, apiFunc, params = {}) => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await apiFunc({
|
|
|
|
|
+ machine: row.设备编号,
|
|
|
|
|
+ year: noderq.value,
|
|
|
|
|
+ sist: row.使用部门,
|
|
|
|
|
+ type: yearcode.value === 1 ? '维修' : '保养',
|
|
|
|
|
+ ...params,
|
|
|
|
|
+ });
|
|
|
|
|
+ if (res.code === 0) mxtableData.value = res.data;
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('请求失败:', error);
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 通用的数据加载
|
|
|
|
|
+const fetchData = async (apiFunc, options = {}) => {
|
|
|
|
|
+ const { nodeData, isYear = false, isCode = false, code = 1 } = options;
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await apiFunc({
|
|
|
|
|
+ sist: nodeData.label.split('(')[0],
|
|
|
|
|
+ ...(isYear ? { year: nodeData.rq } : { mouth: nodeData.rq }),
|
|
|
|
|
+ });
|
|
|
|
|
+ isyear.value = isYear;
|
|
|
|
|
+ iscode.value = isCode;
|
|
|
|
|
+ yearcode.value = code;
|
|
|
|
|
+ return res.data;
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('数据加载失败:', error);
|
|
|
|
|
+ return [];
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
-// 定义不同 code 对应的处理函数
|
|
|
|
|
|
|
+// 动态 actionMap
|
|
|
const actionMap = {
|
|
const actionMap = {
|
|
|
- '年度维修': async (nodeData) => {
|
|
|
|
|
- console.log('获取年度维修数据:', nodeData.rq); // 比如 nodeData.rq = "2025"
|
|
|
|
|
- try {
|
|
|
|
|
- const res = await YearMaintenanceList({ sist: nodeData.label.split('(')[0], year: nodeData.rq });
|
|
|
|
|
- isyear.value = true;
|
|
|
|
|
- yearcode.value = 1;
|
|
|
|
|
- yeartableData.value = res.data;
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error('年度维修数据获取失败:', error);
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- '月度维修': async (nodeData) => {
|
|
|
|
|
- console.log('获取月度维修数据:', nodeData.rq); // 比如 nodeData.rq = "2024-12"
|
|
|
|
|
- try {
|
|
|
|
|
- const res = await MonthAccessoriesList({ sist: nodeData.label.split('(')[0], mouth: nodeData.rq });
|
|
|
|
|
- isyear.value = false;
|
|
|
|
|
- iscode.value = true;
|
|
|
|
|
- wxmonthtableData.value = res.data;
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error('月度维修数据获取失败:', error);
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- '年度保养': async (nodeData) => {
|
|
|
|
|
- console.log('获取年度保养数据:', nodeData.rq);
|
|
|
|
|
- try {
|
|
|
|
|
- const res = await YearMaintainList({ sist: nodeData.label.split('(')[0], year: nodeData.rq });
|
|
|
|
|
- isyear.value = true;
|
|
|
|
|
- yearcode.value = 2;
|
|
|
|
|
- yeartableData.value = res.data;
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error('年度保养数据获取失败:', error);
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- '月度保养': async (nodeData) => {
|
|
|
|
|
- console.log('获取月度保养数据:', nodeData.rq);
|
|
|
|
|
- try {
|
|
|
|
|
- const res = await MouthMaintainList({ sist: nodeData.label.split('(')[0], mouth: nodeData.rq });
|
|
|
|
|
- isyear.value = false;
|
|
|
|
|
- iscode.value = false;
|
|
|
|
|
- bymonthtableData.value = res.data;
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error('月度保养数据获取失败:', error);
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ '年度维修': (nodeData) => fetchData(YearMaintenanceList, { nodeData, isYear: true, code: 1 }).then(data => yeartableData.value = data),
|
|
|
|
|
+ '月度维修': (nodeData) => fetchData(MonthAccessoriesList, { nodeData, isCode: true, code: 1 }).then(data => wxmonthtableData.value = data),
|
|
|
|
|
+ '年度保养': (nodeData) => fetchData(YearMaintainList, { nodeData, isYear: true, code: 2 }).then(data => yeartableData.value = data),
|
|
|
|
|
+ '月度保养': (nodeData) => fetchData(MouthMaintainList, { nodeData, code: 2 }).then(data => bymonthtableData.value = data),
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const noderq = ref('')//节点的rq
|
|
|
|
|
-// 点击节点时的处理函数
|
|
|
|
|
|
|
+// 节点点击事件
|
|
|
const handleNodeClick = async (nodeData) => {
|
|
const handleNodeClick = async (nodeData) => {
|
|
|
- console.log('当前点击节点:', nodeData);
|
|
|
|
|
-
|
|
|
|
|
- if (!nodeData.children) { // 确保是叶子节点(如"检验车间(10台次)")
|
|
|
|
|
|
|
+ if (!nodeData.children) {
|
|
|
const action = actionMap[nodeData.code];
|
|
const action = actionMap[nodeData.code];
|
|
|
if (action) {
|
|
if (action) {
|
|
|
- await action(nodeData); // 执行对应的函数,并传入 nodeData
|
|
|
|
|
|
|
+ await action(nodeData);
|
|
|
noderq.value = nodeData.rq;
|
|
noderq.value = nodeData.rq;
|
|
|
} else {
|
|
} else {
|
|
|
console.warn('未知节点类型:', nodeData.code);
|
|
console.warn('未知节点类型:', nodeData.code);
|
|
@@ -521,32 +726,71 @@ const handleNodeClick = async (nodeData) => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-const wxyearRowClick = (row, column, event) => {
|
|
|
|
|
- console.log('row:', row); // 调试信息
|
|
|
|
|
|
|
+const searchInfo = ref('')
|
|
|
|
|
+//搜索
|
|
|
|
|
+const search = async () => {
|
|
|
|
|
+ const res = await MonthAccessoriesList({search:searchInfo.value})
|
|
|
|
|
+ console.log(res)
|
|
|
|
|
+ isyear.value=false
|
|
|
|
|
+ iscode.value=true
|
|
|
|
|
+ wxmonthtableData.value = res.data
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 绑定行点击事件
|
|
|
|
|
+const yearRowClick = (row) => handleRowClick(row, YearAccessoriesList);
|
|
|
|
|
+const wxmonthRowClick = (row) => handleRowClick(row, YearAccessoriesList);
|
|
|
|
|
+const bymonthRowClick = (row) => handleRowClick(row, YearAccessoriesList);
|
|
|
|
|
+
|
|
|
const initRepairForm = () => ({
|
|
const initRepairForm = () => ({
|
|
|
部门: '',
|
|
部门: '',
|
|
|
设备编号: '',
|
|
设备编号: '',
|
|
|
设备名称: '',
|
|
设备名称: '',
|
|
|
- 机长: '',
|
|
|
|
|
故障报告时间: '',
|
|
故障报告时间: '',
|
|
|
- 故障现象: '',
|
|
|
|
|
维修性质: '',
|
|
维修性质: '',
|
|
|
|
|
+ 故障现象: '',
|
|
|
维修受理时间: '',
|
|
维修受理时间: '',
|
|
|
等配件时间: '',
|
|
等配件时间: '',
|
|
|
修复时间: '',
|
|
修复时间: '',
|
|
|
- 维修人员: Array(8).fill(''), // 8个维修人员
|
|
|
|
|
原因分析及措施: '',
|
|
原因分析及措施: '',
|
|
|
实际维修工时: '',
|
|
实际维修工时: '',
|
|
|
设备故障总工时: '',
|
|
设备故障总工时: '',
|
|
|
验收人: '',
|
|
验收人: '',
|
|
|
- 验收情况: ''
|
|
|
|
|
|
|
+ 验收情况: '',
|
|
|
|
|
+ code5: '',
|
|
|
|
|
+ name5: '',
|
|
|
|
|
+ code1: '',
|
|
|
|
|
+ name1: '',
|
|
|
|
|
+ code2: '',
|
|
|
|
|
+ name2: '',
|
|
|
|
|
+ code3: '',
|
|
|
|
|
+ name3: '',
|
|
|
|
|
+ code4: '',
|
|
|
|
|
+ name4: '',
|
|
|
})
|
|
})
|
|
|
|
|
+const initMaintenanceForm = () => ({
|
|
|
|
|
+ 部门: '',
|
|
|
|
|
+ 设备编号: '',
|
|
|
|
|
+ 设备名称: '',
|
|
|
|
|
+ 保养类型: '',
|
|
|
|
|
+ 保养时间段: [],
|
|
|
|
|
+ 保养工时: '',
|
|
|
|
|
+ 保养备注: '',
|
|
|
|
|
+ 验收备注: '',
|
|
|
|
|
+ 保养评价: '',
|
|
|
|
|
+ code1: '',
|
|
|
|
|
+ name1: '',
|
|
|
|
|
+ code2: '',
|
|
|
|
|
+ name2: '',
|
|
|
|
|
+ code3: '',
|
|
|
|
|
+ name3: '',
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
|
|
|
const repairForm = reactive(initRepairForm())
|
|
const repairForm = reactive(initRepairForm())
|
|
|
-const dialogFormVisible = ref(false)
|
|
|
|
|
|
|
+const maintenanceForm = reactive(initMaintenanceForm())
|
|
|
|
|
+
|
|
|
|
|
+const dialogwxFormVisible = ref(false)
|
|
|
|
|
+const dialogbyFormVisible = ref(false)
|
|
|
const type = ref('create') // 'create' 或 'edit'
|
|
const type = ref('create') // 'create' 或 'edit'
|
|
|
const deptDialogVisible = ref(false) // 部门选择弹窗控制
|
|
const deptDialogVisible = ref(false) // 部门选择弹窗控制
|
|
|
const deptTreeData = ref([]) // 部门树数据
|
|
const deptTreeData = ref([]) // 部门树数据
|
|
@@ -559,17 +803,95 @@ const defaultProps = {
|
|
|
|
|
|
|
|
// 打开弹窗
|
|
// 打开弹窗
|
|
|
const onADD = () => {
|
|
const onADD = () => {
|
|
|
- Object.assign(repairForm, initRepairForm()) // 重置表单
|
|
|
|
|
- type.value = 'create'
|
|
|
|
|
- dialogFormVisible.value = true
|
|
|
|
|
|
|
+ if(yearcode.value === 0){
|
|
|
|
|
+ ElMessage.error('请先选择左侧菜单')
|
|
|
|
|
+ }else if (yearcode.value === 1 ){
|
|
|
|
|
+ Object.assign(repairForm, initRepairForm()) // 重置表单
|
|
|
|
|
+ type.value = 'create'
|
|
|
|
|
+ dialogwxFormVisible.value = true
|
|
|
|
|
+ }else if (yearcode.value === 2 ){
|
|
|
|
|
+ Object.assign(maintenanceForm, initMaintenanceForm()) // 重置表单
|
|
|
|
|
+ console.log('保养弹窗')
|
|
|
|
|
+ type.value = 'create'
|
|
|
|
|
+ dialogbyFormVisible.value = true
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 关闭弹窗
|
|
// 关闭弹窗
|
|
|
-const closeDialog = () => {
|
|
|
|
|
- dialogFormVisible.value = false
|
|
|
|
|
|
|
+const wxcloseDialog = () => {
|
|
|
|
|
+ dialogwxFormVisible.value = false
|
|
|
|
|
+}
|
|
|
|
|
+const bycloseDialog = () => {
|
|
|
|
|
+ dialogbyFormVisible.value = false
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const wxmonthdoubleClick = async (row) => {
|
|
|
|
|
+ type.value = 'update'
|
|
|
|
|
+ const res = await MachineMaintenanceDetail({ UniqId: row.UniqId })
|
|
|
|
|
+
|
|
|
|
|
+ // 清空原有数据
|
|
|
|
|
+ Object.assign(repairForm, initRepairForm())
|
|
|
|
|
+
|
|
|
|
|
+ // 逐个赋值
|
|
|
|
|
+ repairForm.部门 = res.data.使用部门 || ''
|
|
|
|
|
+ repairForm.设备编号 = res.data.设备编号 || ''
|
|
|
|
|
+ repairForm.设备名称 = res.data.设备名称 || ''
|
|
|
|
|
+ repairForm.故障报告时间 = res.data.报障时间 || ''
|
|
|
|
|
+ repairForm.维修性质 = res.data.维修性质 || ''
|
|
|
|
|
+ repairForm.故障现象 = res.data.故障现象 || ''
|
|
|
|
|
+ repairForm.维修受理时间 = res.data.维修受理时间 || ''
|
|
|
|
|
+ repairForm.等配件时间 = res.data.等配件时间 || ''
|
|
|
|
|
+ repairForm.修复时间 = res.data.修复时间 || ''
|
|
|
|
|
+ repairForm.原因分析及措施 = res.data.原因分析及措施 || ''
|
|
|
|
|
+ repairForm.实际维修工时 = res.data.实际维修工时 || ''
|
|
|
|
|
+ repairForm.设备故障总工时 = res.data.故障工时 || ''
|
|
|
|
|
+ repairForm.验收人 = res.data.验收人 || ''
|
|
|
|
|
+ repairForm.验收情况 = res.data.验收情况 || ''
|
|
|
|
|
|
|
|
|
|
+ repairForm.code5 = res.data.机长 || ''
|
|
|
|
|
+ repairForm.name5 = res.data.机长姓名 || ''
|
|
|
|
|
+ repairForm.code1 = res.data.维修人员1 || ''
|
|
|
|
|
+ repairForm.name1 = res.data.维修人员姓名1 || ''
|
|
|
|
|
+ repairForm.code2 = res.data.维修人员2 || ''
|
|
|
|
|
+ repairForm.name2 = res.data.维修人员姓名2 || ''
|
|
|
|
|
+ repairForm.code3 = res.data.维修人员3 || ''
|
|
|
|
|
+ repairForm.name3 = res.data.维修人员姓名3 || ''
|
|
|
|
|
+ repairForm.code4 = res.data.维修人员4 || ''
|
|
|
|
|
+ repairForm.name4 = res.data.维修人员姓名4 || ''
|
|
|
|
|
+ repairForm.UniqId = res.data.UniqId || ''
|
|
|
|
|
+ dialogwxFormVisible.value = true
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const bymonthdoubleClick = async (row) => {
|
|
|
|
|
+ type.value = 'update'
|
|
|
|
|
+ const res = await MachineMaintainDetail({ UniqId: row.UniqId })
|
|
|
|
|
+
|
|
|
|
|
+ // 清空原有数据
|
|
|
|
|
+ Object.assign(maintenanceForm, initMaintenanceForm())
|
|
|
|
|
+ console.log('维修详情',res)
|
|
|
|
|
+ // 逐个赋值
|
|
|
|
|
+ maintenanceForm.部门 = res.data.使用部门 || ''
|
|
|
|
|
+ maintenanceForm.设备编号 = res.data.设备编号 || ''
|
|
|
|
|
+ maintenanceForm.设备名称 = res.data.设备名称 || ''
|
|
|
|
|
+ maintenanceForm.保养类型 = res.data.保养类型 || ''
|
|
|
|
|
+ maintenanceForm.保养时间段[0] = res.data.保养开始时间 || ''
|
|
|
|
|
+ maintenanceForm.保养时间段[1] = res.data.保养结束时间 || ''
|
|
|
|
|
+ maintenanceForm.保养工时 = res.data.保养工时 || ''
|
|
|
|
|
+ maintenanceForm.code1 = res.data.执行机修 || ''
|
|
|
|
|
+ maintenanceForm.name1 = res.data.执行机修姓名 || ''
|
|
|
|
|
+ maintenanceForm.code2 = res.data.执行机长 || ''
|
|
|
|
|
+ maintenanceForm.name2 = res.data.执行机长姓名 || ''
|
|
|
|
|
+ maintenanceForm.保养备注 = res.data.保养备注 || ''
|
|
|
|
|
+ maintenanceForm.code3 = res.data.验收人员 || ''
|
|
|
|
|
+ maintenanceForm.name3 = res.data.验收人员姓名 || ''
|
|
|
|
|
+ maintenanceForm.验收备注 = res.data.验收备注 || ''
|
|
|
|
|
+ maintenanceForm.保养评价 = res.data.验收情况 || ''
|
|
|
|
|
+ maintenanceForm.UniqId = res.data.UniqId || ''
|
|
|
|
|
+ dialogbyFormVisible.value = true
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取部门数据
|
|
// 获取部门数据
|
|
@@ -592,19 +914,24 @@ const getbm = async () => {
|
|
|
|
|
|
|
|
// 部门选择处理
|
|
// 部门选择处理
|
|
|
const handleDeptSelect = (data) => {
|
|
const handleDeptSelect = (data) => {
|
|
|
- repairForm.部门 = data.label
|
|
|
|
|
- deptDialogVisible.value = false
|
|
|
|
|
|
|
+ if(yearcode.value === 1){
|
|
|
|
|
+ repairForm.部门 = data.label
|
|
|
|
|
+ deptDialogVisible.value = false
|
|
|
|
|
+ }else if(yearcode.value === 2){
|
|
|
|
|
+ maintenanceForm.部门 = data.label
|
|
|
|
|
+ deptDialogVisible.value = false
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 获取设备数据
|
|
// 获取设备数据
|
|
|
const getsb = async () => {
|
|
const getsb = async () => {
|
|
|
- if (!repairForm.部门) {
|
|
|
|
|
|
|
+ if (!repairForm.部门&&!maintenanceForm.部门) {
|
|
|
ElMessage.warning('请先选择部门')
|
|
ElMessage.warning('请先选择部门')
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- const res = await gdzl_MachineList({ address: repairForm.部门 })
|
|
|
|
|
|
|
+ const res = await gdzl_MachineList({ address: yearcode.value === 1 ? repairForm.部门 : maintenanceForm.部门 })
|
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
|
if (!res.data) {
|
|
if (!res.data) {
|
|
|
ElMessage.warning('该部门下暂无设备')
|
|
ElMessage.warning('该部门下暂无设备')
|
|
@@ -625,9 +952,16 @@ const getsb = async () => {
|
|
|
|
|
|
|
|
// 设备选择处理
|
|
// 设备选择处理
|
|
|
const handleDeviceSelect = (row) => {
|
|
const handleDeviceSelect = (row) => {
|
|
|
- repairForm.设备编号 = row.id
|
|
|
|
|
|
|
+ if(yearcode.value === 1){
|
|
|
|
|
+ repairForm.设备编号 = row.id
|
|
|
repairForm.设备名称 = row.name
|
|
repairForm.设备名称 = row.name
|
|
|
deviceDialogVisible.value = false
|
|
deviceDialogVisible.value = false
|
|
|
|
|
+ }else if(yearcode.value === 2){
|
|
|
|
|
+ maintenanceForm.设备编号 = row.id
|
|
|
|
|
+ maintenanceForm.设备名称 = row.name
|
|
|
|
|
+ deviceDialogVisible.value = false
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -635,11 +969,20 @@ const handleDeviceSelect = (row) => {
|
|
|
const showEmployeeDialog = ref(false)
|
|
const showEmployeeDialog = ref(false)
|
|
|
const employeeList = ref([])
|
|
const employeeList = ref([])
|
|
|
const currentSelectField = ref('') // 记录当前正在编辑的字段
|
|
const currentSelectField = ref('') // 记录当前正在编辑的字段
|
|
|
|
|
+const currentFormType = ref('repair') // 记录当前操作的表单类型
|
|
|
|
|
|
|
|
// 打开员工选择弹窗
|
|
// 打开员工选择弹窗
|
|
|
const openEmployeeDialog = (fieldPrefix) => {
|
|
const openEmployeeDialog = (fieldPrefix) => {
|
|
|
|
|
+ // 判断当前操作的表单类型
|
|
|
|
|
+ if (dialogwxFormVisible.value) {
|
|
|
|
|
+ currentFormType.value = 'repair'
|
|
|
|
|
+ } else if (dialogbyFormVisible.value) {
|
|
|
|
|
+ currentFormType.value = 'maintenance'
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
currentSelectField.value = fieldPrefix.replace('code', '') // 存储基础数字部分
|
|
currentSelectField.value = fieldPrefix.replace('code', '') // 存储基础数字部分
|
|
|
- const codeValue = repairForm[fieldPrefix] || '' // 直接使用fieldPrefix作为key
|
|
|
|
|
|
|
+ const form = currentFormType.value === 'repair' ? repairForm : maintenanceForm
|
|
|
|
|
+ const codeValue = form[fieldPrefix] || ''
|
|
|
getEmployee(codeValue)
|
|
getEmployee(codeValue)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -667,11 +1010,415 @@ const getEmployee = async (searchValue = '') => {
|
|
|
const selectEmployee = (row) => {
|
|
const selectEmployee = (row) => {
|
|
|
if (currentSelectField.value) {
|
|
if (currentSelectField.value) {
|
|
|
const index = currentSelectField.value
|
|
const index = currentSelectField.value
|
|
|
- repairForm[`code${index}`] = row.员工编号
|
|
|
|
|
- repairForm[`name${index}`] = row.ygxm
|
|
|
|
|
|
|
+ if (currentFormType.value === 'repair') {
|
|
|
|
|
+ repairForm[`code${index}`] = row.员工编号
|
|
|
|
|
+ repairForm[`name${index}`] = row.ygxm
|
|
|
|
|
+ } else {
|
|
|
|
|
+ maintenanceForm[`code${index}`] = row.员工编号
|
|
|
|
|
+ maintenanceForm[`name${index}`] = row.ygxm
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
showEmployeeDialog.value = false
|
|
showEmployeeDialog.value = false
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+const wxenterDialog = async () => {
|
|
|
|
|
+ console.log('repairForm:', repairForm)
|
|
|
|
|
+ const params = {
|
|
|
|
|
+ 使用部门: repairForm.部门,
|
|
|
|
|
+ 设备编号: repairForm.设备编号,
|
|
|
|
|
+ 设备名称: repairForm.设备名称,
|
|
|
|
|
+ 报障时间: dayjs(repairForm.故障报告时间).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
|
|
+ 报障人: repairForm.code5,
|
|
|
|
|
+ 故障现象: repairForm.故障现象,
|
|
|
|
|
+ 维修性质: repairForm.维修性质,
|
|
|
|
|
+ 维修受理时间: dayjs(repairForm.维修受理时间).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
|
|
+ 等配件时间: repairForm.等配件时间,
|
|
|
|
|
+ 修复时间: dayjs(repairForm.修复时间).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
|
|
+ 维修人员1: repairForm.code1,
|
|
|
|
|
+ 维修人员2: repairForm.code2,
|
|
|
|
|
+ 维修人员3: repairForm.code3,
|
|
|
|
|
+ 维修人员4: repairForm.code4,
|
|
|
|
|
+ 处理方法: repairForm.原因分析及措施,
|
|
|
|
|
+ 实际维修工时: repairForm.实际维修工时,
|
|
|
|
|
+ 故障工时: repairForm.设备故障总工时,
|
|
|
|
|
+ 验收人: repairForm.验收人,
|
|
|
|
|
+ 验收情况: repairForm.验收情况,
|
|
|
|
|
+ sys_id: sys_id,
|
|
|
|
|
+ }
|
|
|
|
|
+console.log(params)
|
|
|
|
|
+console.log(type.value)
|
|
|
|
|
+ if (type.value === 'create') {
|
|
|
|
|
+ console.log('新增')
|
|
|
|
|
+ // 新增
|
|
|
|
|
+ try {
|
|
|
|
|
+ const response = await MachineMaintenanceAdd(params)
|
|
|
|
|
+ if (response.code === 0) {
|
|
|
|
|
+ ElMessage.success('新增成功')
|
|
|
|
|
+ wxcloseDialog()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage.error(response.msg || '新增失败')
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }else if (type.value === 'update') {
|
|
|
|
|
+ // 新增
|
|
|
|
|
+ console.log('修改')
|
|
|
|
|
+ params.UniqId = repairForm.UniqId
|
|
|
|
|
+ try {
|
|
|
|
|
+ const response = await MachineMaintenanceUpdate(params)
|
|
|
|
|
+ if (response.code === 0) {
|
|
|
|
|
+ ElMessage.success('修改成功')
|
|
|
|
|
+ wxcloseDialog()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage.error(response.msg || '修改失败')
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const byenterDialog = async () => {
|
|
|
|
|
+ console.log('maintenanceForm:', maintenanceForm)
|
|
|
|
|
+ const params = {
|
|
|
|
|
+ 使用部门: maintenanceForm.部门,
|
|
|
|
|
+ 设备编号: maintenanceForm.设备编号,
|
|
|
|
|
+ 设备名称: maintenanceForm.设备名称,
|
|
|
|
|
+ 保养类型: maintenanceForm.保养类型,
|
|
|
|
|
+ 维修性质: maintenanceForm.维修性质,
|
|
|
|
|
+ 保养开始时间: dayjs(maintenanceForm.保养时间段[0]).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
|
|
+ 保养结束时间: dayjs(maintenanceForm.保养时间段[1]).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
|
|
+ 保养工时: maintenanceForm.保养工时,
|
|
|
|
|
+ 执行机修: maintenanceForm.code1,
|
|
|
|
|
+ 执行机长:maintenanceForm.code2,
|
|
|
|
|
+ 保养备注: maintenanceForm.保养备注,
|
|
|
|
|
+ 验收人员: maintenanceForm.code3,
|
|
|
|
|
+ 验收备注: maintenanceForm.验收备注,
|
|
|
|
|
+ 验收情况: maintenanceForm.验收评价,
|
|
|
|
|
+ sys_id: sys_id,
|
|
|
|
|
+ }
|
|
|
|
|
+console.log(params)
|
|
|
|
|
+console.log(type.value)
|
|
|
|
|
+ if (type.value === 'create') {
|
|
|
|
|
+ console.log('新增')
|
|
|
|
|
+ // 新增
|
|
|
|
|
+ try {
|
|
|
|
|
+ const response = await MachineMaintainAdd(params)
|
|
|
|
|
+ if (response.code === 0) {
|
|
|
|
|
+ ElMessage.success('新增成功')
|
|
|
|
|
+ bycloseDialog()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage.error(response.msg || '新增失败')
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }else if (type.value === 'update') {
|
|
|
|
|
+ // 新增
|
|
|
|
|
+ console.log('修改')
|
|
|
|
|
+ params.UniqId = maintenanceForm.UniqId
|
|
|
|
|
+ try {
|
|
|
|
|
+ const response = await MachineMaintainUpdate(params)
|
|
|
|
|
+ if (response.code === 0) {
|
|
|
|
|
+ ElMessage.success('修改成功')
|
|
|
|
|
+ bycloseDialog()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage.error(response.msg || '修改失败')
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 导出
|
|
|
|
|
+const wxtjDialog = ref(false)
|
|
|
|
|
+const wxtjrq = ref('')
|
|
|
|
|
+const wxgstoexcel = async () => {
|
|
|
|
|
+ wxtjDialog.value = true
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const wxtjonDialog = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await MonthAccessoriesList({ mouth: dayjs(wxtjrq.value).format('YYYY-MM') });
|
|
|
|
|
+
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ const employeeStats = {};
|
|
|
|
|
+
|
|
|
|
|
+ res.data.forEach(record => {
|
|
|
|
|
+ const repairHours = parseFloat(record.故障维修工时) || 0;
|
|
|
|
|
+
|
|
|
|
|
+ for (let i = 1; i <= 4; i++) {
|
|
|
|
|
+ const nameKey = `维修姓名${i}`;
|
|
|
|
|
+ const codeKey = `维修编号${i}`;
|
|
|
|
|
+ const employeeName = record[nameKey];
|
|
|
|
|
+ const employeeCode = record[codeKey];
|
|
|
|
|
+
|
|
|
|
|
+ if (employeeName) {
|
|
|
|
|
+ const employeeKey = employeeCode || employeeName;
|
|
|
|
|
+
|
|
|
|
|
+ if (!employeeStats[employeeKey]) {
|
|
|
|
|
+ employeeStats[employeeKey] = {
|
|
|
|
|
+ code: employeeCode || '',
|
|
|
|
|
+ name: employeeName,
|
|
|
|
|
+ count: 0,
|
|
|
|
|
+ totalHours: 0
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ employeeStats[employeeKey].count += 1;
|
|
|
|
|
+ employeeStats[employeeKey].totalHours += repairHours;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ const tableData = Object.values(employeeStats).map(emp => ({
|
|
|
|
|
+ '员工编号': emp.code,
|
|
|
|
|
+ '员工姓名': emp.name,
|
|
|
|
|
+ '维修次数': emp.count, // 直接使用数字
|
|
|
|
|
+ '维修工时': Number(emp.totalHours.toFixed(2)) // 转换为Number类型
|
|
|
|
|
+ }));
|
|
|
|
|
+
|
|
|
|
|
+ const ws = XLSX.utils.json_to_sheet(tableData);
|
|
|
|
|
+
|
|
|
|
|
+ // 设置列格式
|
|
|
|
|
+ ws['!cols'] = [
|
|
|
|
|
+ { wch: 15 }, // 员工编号
|
|
|
|
|
+ { wch: 15 }, // 员工姓名
|
|
|
|
|
+ { wch: 10, t: 'n' }, // 维修次数 - 数字
|
|
|
|
|
+ { wch: 10, t: 'n' } // 维修工时 - 数字
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ // 确保数字单元格有正确的类型
|
|
|
|
|
+ const range = XLSX.utils.decode_range(ws['!ref']);
|
|
|
|
|
+ for (let row = range.s.r + 1; row <= range.e.r; row++) {
|
|
|
|
|
+ // 维修次数列(C列)
|
|
|
|
|
+ const countCell = ws[`C${row}`];
|
|
|
|
|
+ if (countCell) {
|
|
|
|
|
+ countCell.t = 'n';
|
|
|
|
|
+ countCell.z = '0';
|
|
|
|
|
+ }
|
|
|
|
|
+ // 维修工时列(D列)
|
|
|
|
|
+ const hoursCell = ws[`D${row}`];
|
|
|
|
|
+ if (hoursCell) {
|
|
|
|
|
+ hoursCell.t = 'n';
|
|
|
|
|
+ hoursCell.z = '0.00';
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const wb = XLSX.utils.book_new();
|
|
|
|
|
+ XLSX.utils.book_append_sheet(wb, ws, "员工维修统计");
|
|
|
|
|
+
|
|
|
|
|
+ const fileName = `员工维修统计_${dayjs(wxtjrq.value).format('YYYY年MM月')}.xlsx`;
|
|
|
|
|
+ XLSX.writeFile(wb, fileName);
|
|
|
|
|
+
|
|
|
|
|
+ wxtjDialog.value = false;
|
|
|
|
|
+ ElMessage.success('导出成功');
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('导出失败:', error);
|
|
|
|
|
+ ElMessage.error('导出失败');
|
|
|
|
|
+ wxtjDialog.value = false;
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 导出
|
|
|
|
|
+const sbyxDialog = ref(false)
|
|
|
|
|
+const sbyxrq = ref('')
|
|
|
|
|
+const yxsjToExcel = async () => {
|
|
|
|
|
+ sbyxDialog.value = true
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+//运行工时导出
|
|
|
|
|
+const sbyxonDialog = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await MonthAccessoriesList({ mouth: dayjs(sbyxrq.value).format('YYYY-MM') });
|
|
|
|
|
+
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ // 1. 按设备编号统计数据
|
|
|
|
|
+ const deviceStats = {};
|
|
|
|
|
+
|
|
|
|
|
+ res.data.forEach(record => {
|
|
|
|
|
+ const deviceCode = record.设备编号;
|
|
|
|
|
+ const deviceName = record.设备名称;
|
|
|
|
|
+ const repairHours = parseFloat(record.故障维修工时) || 0;
|
|
|
|
|
+
|
|
|
|
|
+ if (!deviceStats[deviceCode]) {
|
|
|
|
|
+ deviceStats[deviceCode] = {
|
|
|
|
|
+ deviceCode: deviceCode,
|
|
|
|
|
+ deviceName: deviceName,
|
|
|
|
|
+ totalHours: 0,
|
|
|
|
|
+ count: 0
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ deviceStats[deviceCode].totalHours += repairHours;
|
|
|
|
|
+ deviceStats[deviceCode].count += 1;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 2. 转换为表格数据
|
|
|
|
|
+ const tableData = Object.values(deviceStats).map(device => ({
|
|
|
|
|
+ '设备编号': device.deviceCode,
|
|
|
|
|
+ '设备名称': device.deviceName,
|
|
|
|
|
+ '故障工时': Number(device.totalHours.toFixed(1)), // 保留1位小数
|
|
|
|
|
+ '故障次数': device.count
|
|
|
|
|
+ }));
|
|
|
|
|
+
|
|
|
|
|
+ // 3. 创建Excel工作表
|
|
|
|
|
+ const ws = XLSX.utils.json_to_sheet(tableData);
|
|
|
|
|
+
|
|
|
|
|
+ // 4. 设置列宽和格式
|
|
|
|
|
+ ws['!cols'] = [
|
|
|
|
|
+ { wch: 10 }, // 设备编号
|
|
|
|
|
+ { wch: 40 }, // 设备名称(设备名称较长,设置更宽)
|
|
|
|
|
+ { wch: 10, t: 'n' }, // 故障工时 - 数字
|
|
|
|
|
+ { wch: 10, t: 'n' } // 故障次数 - 数字
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ // 5. 设置数字格式
|
|
|
|
|
+ const range = XLSX.utils.decode_range(ws['!ref']);
|
|
|
|
|
+ for (let row = range.s.r + 1; row <= range.e.r; row++) {
|
|
|
|
|
+ // 故障工时列(C列)
|
|
|
|
|
+ const hoursCell = ws[`C${row}`];
|
|
|
|
|
+ if (hoursCell) {
|
|
|
|
|
+ hoursCell.t = 'n';
|
|
|
|
|
+ hoursCell.z = '0.0'; // 保留1位小数
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 故障次数列(D列)
|
|
|
|
|
+ const countCell = ws[`D${row}`];
|
|
|
|
|
+ if (countCell) {
|
|
|
|
|
+ countCell.t = 'n';
|
|
|
|
|
+ countCell.z = '0'; // 整数格式
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 6. 创建工作簿并导出
|
|
|
|
|
+ const wb = XLSX.utils.book_new();
|
|
|
|
|
+ XLSX.utils.book_append_sheet(wb, ws, "设备维修统计");
|
|
|
|
|
+
|
|
|
|
|
+ const fileName = `设备维修统计_${dayjs(wxtjrq.value).format('YYYY年MM月')}.xlsx`;
|
|
|
|
|
+ XLSX.writeFile(wb, fileName);
|
|
|
|
|
+
|
|
|
|
|
+ wxtjDialog.value = false;
|
|
|
|
|
+ ElMessage.success('导出成功');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage.error(res.msg || '获取数据失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('导出失败:', error);
|
|
|
|
|
+ ElMessage.error('导出失败');
|
|
|
|
|
+ wxtjDialog.value = false;
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 导出月度维修
|
|
|
|
|
+const wxToExcel = () => {
|
|
|
|
|
+ const el = document.getElementById('wxtable');
|
|
|
|
|
+ const filename = '月度维修统计.xlsx'; // 修改文件名更符合内容
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 1. 获取原始表格数据
|
|
|
|
|
+ const wb = XLSX.utils.table_to_book(el, { raw: true });
|
|
|
|
|
+ const ws = wb.Sheets[wb.SheetNames[0]];
|
|
|
|
|
+
|
|
|
|
|
+ // 2. 定义需要转换为数字的列(基于原始列字母)
|
|
|
|
|
+ const numberColumns = {
|
|
|
|
|
+ 'F': 2, // 保留2位小数
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 3. 处理工作表数据
|
|
|
|
|
+ const range = XLSX.utils.decode_range(ws['!ref']);
|
|
|
|
|
+
|
|
|
|
|
+ // 复制原始工作表所有数据
|
|
|
|
|
+ const newWs = JSON.parse(JSON.stringify(ws));
|
|
|
|
|
+
|
|
|
|
|
+ // 4. 转换数字格式
|
|
|
|
|
+ Object.keys(newWs).forEach(address => {
|
|
|
|
|
+ if (!address.startsWith('!')) { // 跳过特殊属性
|
|
|
|
|
+ const col = address.charAt(0);
|
|
|
|
|
+
|
|
|
|
|
+ if (numberColumns[col] !== undefined) {
|
|
|
|
|
+ const cell = newWs[address];
|
|
|
|
|
+ const num = parseFloat(cell.v);
|
|
|
|
|
+
|
|
|
|
|
+ if (!isNaN(num)) {
|
|
|
|
|
+ cell.t = 'n'; // 设置为数字类型
|
|
|
|
|
+ cell.v = num; // 更新值为数字
|
|
|
|
|
+
|
|
|
|
|
+ // 设置数字格式
|
|
|
|
|
+ cell.z = numberColumns[col] === 0
|
|
|
|
|
+ ? '0'
|
|
|
|
|
+ : `0.${'0'.repeat(numberColumns[col])}`;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 5. 更新工作簿并导出
|
|
|
|
|
+ wb.Sheets[wb.SheetNames[0]] = newWs;
|
|
|
|
|
+
|
|
|
|
|
+ // 使用更现代的导出方式
|
|
|
|
|
+ XLSX.writeFile(wb, filename);
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.error('导出失败:', e);
|
|
|
|
|
+ ElMessage.error('导出失败,请重试');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+const selectedIds = ref('')
|
|
|
|
|
+
|
|
|
|
|
+// 维修表格选择变化
|
|
|
|
|
+const wxSelectionChange = (selection) => {
|
|
|
|
|
+ selectedIds.value = selection.map(item => item.UniqId).join(',')
|
|
|
|
|
+ console.log('选中的ID:', selectedIds.value)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 保养表格选择变化
|
|
|
|
|
+const bySelectionChange = (selection) => {
|
|
|
|
|
+ selectedIds.value = selection.map(item => item.UniqId).join(',')
|
|
|
|
|
+ console.log('选中的ID:', selectedIds.value)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 删除操作
|
|
|
|
|
+const onDelete = async () => {
|
|
|
|
|
+ console.log('维修or保养:', yearcode.value)
|
|
|
|
|
+ if (!selectedIds.value.length) {
|
|
|
|
|
+ ElMessage.warning('请先选择要删除的记录')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ await ElMessageBox.confirm('确定要删除选中的记录吗?', '提示', {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ // 调用删除API,假设是批量删除接口
|
|
|
|
|
+ const res = await MachineMaintainDelete({ UniqId: selectedIds.value,type:yearcode.value === 1 ? 0 : 1 })
|
|
|
|
|
+
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ ElMessage.success('删除成功')
|
|
|
|
|
+ // 删除成功后刷新表格数据
|
|
|
|
|
+ // 清空选中
|
|
|
|
|
+ selectedIds.value = []
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage.error(res.msg || '删除失败')
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ if (error !== 'cancel') {
|
|
|
|
|
+ console.error('删除失败:', error)
|
|
|
|
|
+ ElMessage.error('删除操作已取消')
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|