|
|
@@ -7,7 +7,10 @@
|
|
|
<el-form ref="elSearchFormRef" class="demo-form-inline" :rules="searchRule" >
|
|
|
<el-form-item>
|
|
|
<el-input v-model="searchInfo" placeholder="搜索工单编号" clearable style="width: 200px;margin: 5px"></el-input>
|
|
|
- <el-button type="primary" class="bt" icon="download" @click="hzToExcel" >导出到Excel(汇总)</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="search" @click="search">搜索</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
|
|
|
@@ -20,7 +23,7 @@
|
|
|
<!-- 左侧树侧形结构-->
|
|
|
<layout-sider :resize-directions="['right']" :width="190" style="margin-right: 10px;">
|
|
|
<div class="JKWTree-tree" style="height: 200px">
|
|
|
- <h3>生产进程查询</h3>
|
|
|
+ <h3>设备维修保养记录</h3>
|
|
|
<el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick" @node-expand="handleNodeExpand">
|
|
|
</el-tree>
|
|
|
</div>
|
|
|
@@ -31,38 +34,113 @@
|
|
|
<el-main>
|
|
|
<div class="gva-table-box">
|
|
|
<!-- 表格数据 -->
|
|
|
- <el-table ref="multipleTable" style="width: 100%;height: 75vh" tooltip-effect="dark"
|
|
|
- :row-style="{ height: '25px' }" :header-cell-style="{ padding: '0px' }"
|
|
|
- :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
|
|
|
- :data="hztableData" border row-key="ID"
|
|
|
- size="small"
|
|
|
- :cell-class-name="gxbgCellClass"
|
|
|
- highlight-current-row="true" @row-dblclick="updateCompanyFunc"
|
|
|
- @row-click="tableRowClick" :show-overflow-tooltip="true"
|
|
|
- @selection-change="handleSelectionChange">
|
|
|
- <el-table-column sortable align="center" label="工单编号" prop="工单编号" width="120" />
|
|
|
- <el-table-column sortable align="center" label="领用日期" prop="领用日期" width="130" />
|
|
|
- <el-table-column align="center" label="卷宽" prop="卷宽" width="60" />
|
|
|
- <el-table-column align="center" label="卷长" prop="卷长" width="70" />
|
|
|
- <el-table-column align="center" label="领用宽度" prop="领用宽度" width="90" />
|
|
|
- <el-table-column align="center" label="领用数量" prop="领用数量" width="90" />
|
|
|
- <el-table-column align="center" label="机台" prop="机台" width="90" />
|
|
|
- <el-table-column align="center" label="采购单号" prop="采购单号" width="110" />
|
|
|
- <el-table-column align="center" label="供方批次" prop="供方批次" width="110" />
|
|
|
- <el-table-column align="center" label="物料代码" prop="物料代码" width="140" />
|
|
|
- <el-table-column align="center" label="物料名称" prop="物料名称" width="200" />
|
|
|
- <el-table-column align="center" label="备注" prop="备注" width="110" />
|
|
|
- <el-table-column align="center" label="成品代号" prop="成品代号" width="200" />
|
|
|
- <el-table-column align="center" label="成品名称" prop="成品名称" width="200" />
|
|
|
- <el-table-column align="center" label="创建用户" prop="创建用户" width="200" />
|
|
|
- <el-table-column align="center" label="创建时间" prop="创建时间" width="200" />
|
|
|
- </el-table>
|
|
|
-
|
|
|
- <!-- 分页 -->
|
|
|
- <div class="gva-pagination">
|
|
|
- <el-pagination layout="total" :current-page="page" :page-size="pageSize"
|
|
|
- :total="total" @current-change="handleCurrentChange" @size-change="handleSizeChange" />
|
|
|
- </div>
|
|
|
+ <el-table ref="multipleTable"
|
|
|
+ v-if="isyear"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ @selection-change="selectionChange($event)"
|
|
|
+ :row-style="{ height: '20px' }" :selectable="checkboxT"
|
|
|
+ :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
|
|
|
+ :header-cell-style="{ padding: '0px' }" @row-click="pchzRowClick"
|
|
|
+ :row-class-name="pchzrowClassStyle"
|
|
|
+ highlight-current-row="true" @row-dblclick="gytableDatadoubleClick" id="pchztable"
|
|
|
+ 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="130" />
|
|
|
+ <el-table-column align="center" label="设备名称" prop="设备名称" width="60" />
|
|
|
+ <el-table-column v-if="yearcode === 1" align="center" label="维修次数" prop="维修次数" width="70" />
|
|
|
+ <el-table-column v-else-if="yearcode === 2" align="center" label="保养次数" prop="保养次数" width="70" />
|
|
|
+ <el-table-column align="center" label="1月" prop="1月" width="90" />
|
|
|
+ <el-table-column align="center" label="2月" prop="2月" width="90" />
|
|
|
+ <el-table-column align="center" label="3月" prop="3月" width="90" />
|
|
|
+ <el-table-column align="center" label="4月" prop="4月" width="110" />
|
|
|
+ <el-table-column align="center" label="5月" prop="5月" width="110" />
|
|
|
+ <el-table-column align="center" label="6月" prop="6月" width="140" />
|
|
|
+ <el-table-column align="center" label="7月" prop="7月" width="200" />
|
|
|
+ <el-table-column align="center" label="8月" prop="8月" width="110" />
|
|
|
+ <el-table-column align="center" label="9月" prop="9月" width="200" />
|
|
|
+ <el-table-column align="center" label="10月" prop="10月" width="200" />
|
|
|
+ <el-table-column align="center" label="11月" prop="11月" width="200" />
|
|
|
+ <el-table-column align="center" label="12月" prop="12月" width="200" />
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <el-table ref="JPmultipleTable"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ @selection-change="selectionChange($event)"
|
|
|
+ :row-style="{ height: '20px' }" :row-class-name="totalClassName" :cell-class-name="tableDataCellClass"
|
|
|
+ :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
|
|
|
+ :header-cell-style="{ padding: '0px' }" @row-click="getUid"
|
|
|
+ highlight-current-row="true" @row-dblclick="JPgytableDatadoubleClick" id="pcmxtable"
|
|
|
+ style="width: 100%;height: 45vh" border tooltip-effect="dark" :data="pcmxtableData" row-key="ID" >
|
|
|
+ <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="70"/>
|
|
|
+ <el-table-column align="left" label="机台编号" prop="机台编号" width="90"/>
|
|
|
+ <el-table-column align="left" label="仓库编号" prop="仓库编号" width="70"/>
|
|
|
+ <el-table-column align="left" label="仓库名称" prop="仓库名称" width="120"/>
|
|
|
+ <el-table-column align="left" label="物料编号" prop="物料编号" width="70"/>
|
|
|
+ <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="110"/>
|
|
|
+ <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"/>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+
|
|
|
+ <el-table ref="multipleTable"
|
|
|
+ v-if="!isyear && iscode"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ @selection-change="selectionChange($event)"
|
|
|
+ :row-style="{ height: '20px' }" :selectable="checkboxT"
|
|
|
+ :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"
|
|
|
+ style="width: 100%;height: 30vh" border tooltip-effect="dark" :data="sbhztableData" row-key="ID" >
|
|
|
+ <el-table-column fixed align="left" label="设备编号" prop="设备编号" width="90"/>
|
|
|
+ <el-table-column fixed align="left" label="设备名称" prop="设备名称" width="70"/>
|
|
|
+ <el-table-column align="left" label="报障时间" prop="报障时间" width="85"/>
|
|
|
+ <el-table-column align="left" label="维修受理时间" prop="维修受理时间" width="85"/>
|
|
|
+ <el-table-column align="left" label="修复时间" prop="修复时间" width="85"/>
|
|
|
+ <el-table-column align="left" label="故障维修工时" prop="故障维修工时" width="85"/>
|
|
|
+ <el-table-column align="left" label="非故障微信工时" prop="非故障微信工时" width="95"/>
|
|
|
+ <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="110"/>
|
|
|
+ <el-table-column align="left" label="修改时间" prop="修改时间" width="110"/>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <el-table ref="JPmultipleTable"
|
|
|
+ v-if="!isyear && !iscode"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ @selection-change="selectionChange($event)"
|
|
|
+ :row-style="{ height: '20px' }" :cell-class-name="tableDataCellClass"
|
|
|
+ :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
|
|
|
+ :header-cell-style="{ padding: '0px' }" @row-click="sbmxRowClick"
|
|
|
+ :row-class-name="sbmxrowClassStyle"
|
|
|
+ highlight-current-row="true" @row-dblclick="JPgytableDatadoubleClick" id="sbmxtable"
|
|
|
+ style="width: 100%;height: 45vh" border tooltip-effect="dark" :data="sbmxtableData" row-key="ID" >
|
|
|
+ <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="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="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="100" />
|
|
|
+ <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>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
@@ -81,16 +159,136 @@
|
|
|
import {ref, reactive} from 'vue'
|
|
|
import { exportExcelFile } from '@/utils/excel'
|
|
|
import {ElMessage} from "element-plus";
|
|
|
+ import {getMaintenanceTab,YearMaintenanceList,YearAccessoriesList,YearMaintainList,MonthAccessoriesList,MouthMaintainList} from "@/api/mes/job.js"
|
|
|
+
|
|
|
defineOptions({name: 'Company'})
|
|
|
// =========== 获取左侧树侧形结构 ===========
|
|
|
-
|
|
|
+ const treeData = ref([])
|
|
|
|
|
|
+ const getTreeData = async () => {
|
|
|
+ try {
|
|
|
+ const res = await getMaintenanceTab();
|
|
|
+
|
|
|
+ if (res.code === 0 && res.data) {
|
|
|
+ treeData.value = Object.entries(res.data).map(([label, childrenData]) => {
|
|
|
+ // 根据父节点label确定code值
|
|
|
+ let parentCode = '';
|
|
|
+ if (label.includes('年度维修统计')) {
|
|
|
+ parentCode = '年度维修';
|
|
|
+ } else if (label.includes('月度维修记录')) {
|
|
|
+ parentCode = '月度维修';
|
|
|
+ } else if (label.includes('年度保养统计')) {
|
|
|
+ parentCode = '年度保养';
|
|
|
+ } else if (label.includes('月度保养记录')) {
|
|
|
+ parentCode = '月度保养';
|
|
|
+ }
|
|
|
+
|
|
|
+ const children = [];
|
|
|
+ // 获取所有 keys
|
|
|
+ const keys = Object.keys(childrenData);
|
|
|
+ // 按时间降序排序
|
|
|
+ const sortedKeys = keys.sort((a, b) => b.localeCompare(a));
|
|
|
+
|
|
|
+ sortedKeys.forEach(key => {
|
|
|
+ children.push({
|
|
|
+ label: key,
|
|
|
+ code: parentCode,
|
|
|
+ rq: key,
|
|
|
+ children: childrenData[key].map(item => ({
|
|
|
+ label: item,
|
|
|
+ code: parentCode,
|
|
|
+ rq: key
|
|
|
+ }))
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ return {
|
|
|
+ label,
|
|
|
+ code: parentCode,
|
|
|
+ children
|
|
|
+ };
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ console.error('获取数据失败:', res.msg);
|
|
|
+ treeData.value = [];
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('请求出错:', error);
|
|
|
+ treeData.value = [];
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
|
|
|
-
|
|
|
+getTreeData()
|
|
|
|
|
|
+const yearcode = ref(0)//判断年度维修or年度保养
|
|
|
+const isyear = ref(false)//判断年度
|
|
|
+const iscode = ref(false)//判断月度
|
|
|
+const wxmonthtableData = ref([]) // 月度维修
|
|
|
+const bymonthtableData = ref([]) // 月度保养
|
|
|
+const yeartableData = ref([]);
|
|
|
|
|
|
+// 定义不同 code 对应的处理函数
|
|
|
+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 = 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], month: 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 = 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], month: nodeData.rq });
|
|
|
+ isyear.value = false;
|
|
|
+ iscode.value = false;
|
|
|
+ bymonthtableData.value = res.data;
|
|
|
+ } catch (error) {
|
|
|
+ console.error('月度保养数据获取失败:', error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+// 点击节点时的处理函数
|
|
|
+const handleNodeClick = async (nodeData) => {
|
|
|
+ console.log('当前点击节点:', nodeData);
|
|
|
|
|
|
+ if (!nodeData.children) { // 确保是叶子节点(如"检验车间(10台次)")
|
|
|
+ const action = actionMap[nodeData.code];
|
|
|
+ if (action) {
|
|
|
+ await action(nodeData); // 执行对应的函数,并传入 nodeData
|
|
|
+ } else {
|
|
|
+ console.warn('未知节点类型:', nodeData.code);
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
|
|
|
|