| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- <template>
- <div>
- <layout>
- <layout-header>
- <div class="">
- <!-- 按钮部分-->
- <el-form ref="elSearchFormRef" class="demo-form-inline" :rules="searchRule" >
- <el-form-item>
- </el-form-item>
- </el-form>
-
-
-
- </div>
- </layout-header>
-
- <layout>
- <!-- 左侧树侧形结构-->
- <layout-sider :resize-directions="['right']" :width="190" style="margin-right: 10px;">
- <div class="JKWTree-tree" style="height: 200px">
- <h3>近期设备点检统计</h3>
- <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick" @node-expand="handleNodeExpand">
- </el-tree>
- </div>
- </layout-sider>
-
- <!-- 右侧区域 -->
- <layout-content >
- <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="djtableData" 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" />
- <!-- 年月列表 -->
- <template v-for="item in dateDatas">
- <el-table-column align="left" sortable :label=item :prop=item width="80"/>
- </template>
- </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>
- </div>
-
- </el-main>
- </layout-content>
- </layout>
- </layout>
- </div>
- </template>
- <script setup>
- // 全量引入格式化工具 请按需保留
- import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
- import {getMITab,InspectionDetail} from "@/api/mes/job.js"
- import {ref, reactive} from 'vue'
- import { exportExcelFile } from '@/utils/excel'
- import {ElMessage} from "element-plus";
- defineOptions({name: 'Company'})
- // =========== 获取左侧树侧形结构 ===========
- const treeData = ref([])
- const defaultProps = {
- children: 'children',
- label: 'label'
- }
- const getTreeData = async () => {
- try {
- const res = await getMITab();
- if (res.code === 0 && res.data) {
- // 将接口数据转换为树形结构
- treeData.value = Object.entries(res.data).map(([workshopName, groups]) => ({
- label: workshopName, // 车间名称,如"检验车间"
- children: Object.entries(groups).map(([groupName, machines]) => ({
- label: groupName, // 机组名称,如"检品机组"
- children: machines.map(machine => ({
- label: machine, // 提取设备编号,如"JP01"
- fullName: machine.split('【')[0], // 保留完整设备名称备用
- }))
- }))
- }));
- } else {
- console.error('获取树形数据失败:', res.msg);
- treeData.value = []; // 出错时清空数据
- }
- } catch (error) {
- console.error('请求树形数据时出错:', error);
- treeData.value = []; // 出错时清空数据
- }
- };
- // 初始化加载数据
- getTreeData();
- // =========== 表格数据 ===========
- const djtableData = ref('')
- const dateDatas = reactive([])
- const handleNodeClick = async (node) => {
- console.log(node)
- if(!node.children){
- const res = await InspectionDetail({machineID:node.fullName})
- console.log(res)
- if(res.code === 0 && res.data){
- dateDatas.splice(0,res.data.日期.length,...res.data.日期);
- djtableData.value = res.data.项目;
- console.log(djtableData.value)
- }
- }
- }
- const handleNodeExpand = (data, expanded, node) => {
-
- }
-
-
-
-
-
-
-
-
-
-
- </script>
-
- <style scoped>
- .form-container {
- display: flex;
- flex-wrap: wrap;
- }
-
- .form-column {
- /*flex: 1;*/
- margin-right: 15px; /* 调整列之间的间距 */
- }
-
- /* 左侧输入框宽度调整 */
- .form-column .el-form-item .el-input {
- width: 150px; /* 调整左侧输入框的宽度 */
- }
-
- :deep(.hui-plan-usage-lows div) {
- color: #8c939d !important;
- }
- :deep(.lan-plan-usage-lows div) {
- color: blue !important;
- font-weight: bold;
- }
-
- /* 媒体查询,根据需要调整断点 */
- @media screen and (max-width: 768px) {
- .form-column {
- flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
- margin-right: 0;
- }
- }
- /*:deep(.el-table td .cell) {*/
- /* line-height: 30px !important;*/
- /*}*/
- .JKWTree-container {
- display: flex;
- }
- .JKWTree-tree {
- /*width: 300px;*/
- background-color: #fff;
- padding: 10px;
- margin-right: 20px;
- }
- .JKWTree-tree h3 {
- font-size: 15px;
- font-weight: 700;
- margin: 10px 0;
- }
- .JKWTree-content {
- flex: 1;
- }
-
- /* 选中某行时的背景色 */
- :deep(.el-table__body tr.current-row) > td {
- background: #ff80ff !important;
- }
- </style>
- <style scoped>
- :deep(.el-table td .cell) {
- line-height: 20px !important;
- }
- :deep(.el-tabs__header){
- margin-bottom: 0;
- }
- .search{
- margin-left: 0px !important;
- margin-right: 10px !important;
- }
- .bt{
- margin-left: 2px !important;
- padding: 3px !important;
- font-size: 12px;
- }
- .el-tabs__header{
- margin: 0px !important;
- }
- .gva-table-box{
- padding: 0px !important;
- }
- .mab{
- margin-bottom: 5px;
- }
- </style>
-
|