liding
2026-06-09 76302992e7bcb60682ee6d3ae9de6619b477b968
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<template>
  <div class="app-container">
    <!-- 标签页 -->
    <el-tabs v-model="activeTab" type="card" @tab-click="handleTabClick">
      <el-tab-pane label="高压电力电缆" name="highVoltage"></el-tab-pane>
      <el-tab-pane label="中压电力电缆" name="mediumVoltage"></el-tab-pane>
      <el-tab-pane label="低压线缆" name="lowVoltage"></el-tab-pane>
      <el-tab-pane label="主网号地线" name="mainNetwork"></el-tab-pane>
      <el-tab-pane label="配网号地线" name="distribution"></el-tab-pane>
      <el-tab-pane label="光缆" name="opticalFiber"></el-tab-pane>
      <el-tab-pane label="OPGW光缆" name="opgw"></el-tab-pane>
      <el-tab-pane label="ADSS光缆" name="adss"></el-tab-pane>
    </el-tabs>
 
    <!-- 查询区域 -->
    <div class="search-form">
      <el-form :model="searchForm" inline size="small">
        <el-form-item label="样品编号">
          <el-input v-model="searchForm.sampleCode" placeholder="请输入样品编号" clearable></el-input>
        </el-form-item>
        <el-form-item label="试验类型">
          <el-input v-model="searchForm.testType" placeholder="请输入试验类型" clearable></el-input>
        </el-form-item>
        <el-form-item label="试验时间">
          <el-date-picker v-model="searchForm.testDate" type="date" placeholder="选择日期" clearable></el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="searchList">查询</el-button>
          <el-button @click="resetSearch">重置</el-button>
          <el-button type="success" @click="syncData">同步EIP数据</el-button>
        </el-form-item>
      </el-form>
    </div>
 
    <!-- 数据表格 -->
    <el-table v-loading="tableLoading" :data="tableData" border>
      <el-table-column label="样品编号" prop="sampleCode" show-overflow-tooltip></el-table-column>
      <el-table-column label="产品名称" prop="productName" show-overflow-tooltip></el-table-column>
      <el-table-column label="规格型号" prop="specModel" show-overflow-tooltip></el-table-column>
      <el-table-column label="试验类型" prop="testType" show-overflow-tooltip></el-table-column>
      <el-table-column label="试验结果" prop="testResult" show-overflow-tooltip></el-table-column>
      <el-table-column label="原材料" prop="rawMaterial" show-overflow-tooltip></el-table-column>
      <el-table-column label="过程检" prop="processInspection" show-overflow-tooltip></el-table-column>
      <el-table-column label="成品检" prop="finalInspection" show-overflow-tooltip></el-table-column>
      <el-table-column label="试验时间" prop="testDate" show-overflow-tooltip></el-table-column>
      <el-table-column label="操作" width="100">
        <template slot-scope="scope">
          <el-button type="text" @click="viewDetail(scope.row)">查看</el-button>
        </template>
      </el-table-column>
    </el-table>
 
    <!-- 分页 -->
    <el-pagination
      :current-page="page.current"
      :page-size="page.size"
      :total="page.total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      layout="total, sizes, prev, pager, next, jumper">
    </el-pagination>
 
    <!-- 详情弹窗 -->
    <el-dialog title="试验数据详情" :visible.sync="detailVisible" width="600px">
      <el-form :model="detailData" label-width="120px" size="small" disabled>
        <el-form-item label="样品编号">
          <span>{{ detailData.sampleCode }}</span>
        </el-form-item>
        <el-form-item label="产品名称">
          <span>{{ detailData.productName }}</span>
        </el-form-item>
        <el-form-item label="规格型号">
          <span>{{ detailData.specModel }}</span>
        </el-form-item>
        <el-form-item label="试验类型">
          <span>{{ detailData.testType }}</span>
        </el-form-item>
        <el-form-item label="试验结果">
          <span>{{ detailData.testResult }}</span>
        </el-form-item>
        <el-form-item label="原材料">
          <span>{{ detailData.rawMaterial }}</span>
        </el-form-item>
        <el-form-item label="过程检">
          <span>{{ detailData.processInspection }}</span>
        </el-form-item>
        <el-form-item label="成品检">
          <span>{{ detailData.finalInspection }}</span>
        </el-form-item>
        <el-form-item label="试验时间">
          <span>{{ detailData.testDate }}</span>
        </el-form-item>
        <el-form-item label="备注">
          <span>{{ detailData.remark || "-" }}</span>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="detailVisible = false">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
import {
  pageHighVoltageCable,
  pageMediumVoltageCable,
  pageLowVoltageCable,
  pageMainNetworkGroundWire,
  pageDistributionGroundWire,
  pageOpticalFiber,
  pageOPGWOpticalFiber,
  pageADSSOpticalFiber,
  syncEIPData,
} from "@/api/quality/eipCable";
 
export default {
  name: "EipCable",
  data() {
    return {
      activeTab: "highVoltage",
      searchForm: {
        sampleCode: "",
        testType: "",
        testDate: "",
      },
      tableData: [],
      tableLoading: false,
      page: {
        current: 1,
        size: 20,
        total: 0,
      },
      detailVisible: false,
      detailData: {},
      syncLoading: false,
    };
  },
  mounted() {
    this.searchList();
  },
  methods: {
    getApi() {
      switch (this.activeTab) {
        case "highVoltage":
          return pageHighVoltageCable;
        case "mediumVoltage":
          return pageMediumVoltageCable;
        case "lowVoltage":
          return pageLowVoltageCable;
        case "mainNetwork":
          return pageMainNetworkGroundWire;
        case "distribution":
          return pageDistributionGroundWire;
        case "opticalFiber":
          return pageOpticalFiber;
        case "opgw":
          return pageOPGWOpticalFiber;
        case "adss":
          return pageADSSOpticalFiber;
        default:
          return pageHighVoltageCable;
      }
    },
    searchList() {
      this.tableLoading = true;
      const api = this.getApi();
      api({
        ...this.searchForm,
        page: this.page.current,
        size: this.page.size,
      }).then((res) => {
        this.tableData = res.data.records;
        this.page.total = res.data.total;
        this.tableLoading = false;
      }).catch((err) => {
        this.tableLoading = false;
        console.error(err);
      });
    },
    resetSearch() {
      this.searchForm = {
        sampleCode: "",
        testType: "",
        testDate: "",
      };
      this.searchList();
    },
    handleTabClick() {
      this.page.current = 1;
      this.searchList();
    },
    handleSizeChange(val) {
      this.page.size = val;
      this.searchList();
    },
    handleCurrentChange(val) {
      this.page.current = val;
      this.searchList();
    },
    viewDetail(row) {
      this.detailData = row;
      this.detailVisible = true;
    },
    syncData() {
      this.syncLoading = true;
      syncEIPData({ cableType: this.activeTab }).then((res) => {
        if (res.code === 200) {
          this.$message.success("同步成功");
          this.searchList();
        } else {
          this.$message.error(res.msg || "同步失败");
        }
        this.syncLoading = false;
      }).catch((err) => {
        this.syncLoading = false;
        console.error(err);
      });
    },
  },
};
</script>
 
<style scoped>
.search-form {
  margin-bottom: 15px;
}
 
.dialog-footer {
  text-align: right;
}
</style>