春风项目四线(合箱线、总装线)
wujian
5 天以前 ea3c33c8561df39d4f123d1424fda99dd0f0c51d
提交 | 用户 | 时间
fd2207 1 <template>
2   <div class="app-container">
3     <el-card class="box-card">
131e8c 4     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
W 5       <el-form-item label="发动机编码" prop="sfcCode">
fd2207 6         <el-input
131e8c 7           v-model="queryParams.sfcCode"
W 8           placeholder="请输入发动机编码"
fd2207 9           clearable
10           @keyup.enter.native="handleQuery"
11         />
12       </el-form-item>
131e8c 13       <el-form-item label="工位编号" prop="locationCode">
fd2207 14         <el-input
131e8c 15           v-model="queryParams.locationCode"
W 16           placeholder="请输入工位编号"
fd2207 17           clearable
18           @keyup.enter.native="handleQuery"
19         />
20       </el-form-item>
2c65c3 21       <el-form-item label="日期范围" prop="dateConditions">
W 22         <el-date-picker
23           v-model="queryParams.dateConditions"
24           type="daterange"
25           align="right"
26           unlink-panels
27           range-separator="至"
28           start-placeholder="开始日期"
29           end-placeholder="结束日期"
30           value-format="yyyy-MM-dd"
31           @change="handleDateChange">
32         </el-date-picker>
33       </el-form-item>
fd2207 34       <el-form-item style="float: right">
35         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
36         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
37       </el-form-item>
38     </el-form>
39     </el-card>
40     <el-card style="margin-top: 10px" class="box-card">
41     <el-row :gutter="10" class="mb8">
42       <el-col :span="1.5">
43         <el-button
44           type="primary"
45           plain
46           icon="el-icon-plus"
47           size="mini"
48           @click="handleAdd"
49           v-hasPermi="['main:paramCollection:add']"
50         >新增</el-button>
51       </el-col>
52       <el-col :span="1.5">
53         <el-button
54           type="success"
55           plain
56           icon="el-icon-edit"
57           size="mini"
58           :disabled="single"
59           @click="handleUpdate"
60           v-hasPermi="['main:paramCollection:edit']"
61         >修改</el-button>
62       </el-col>
63       <el-col :span="1.5">
64         <el-button
65           type="danger"
66           plain
67           icon="el-icon-delete"
68           size="mini"
69           :disabled="multiple"
70           @click="handleDelete"
71           v-hasPermi="['main:paramCollection:remove']"
72         >删除</el-button>
73       </el-col>
74       <el-col :span="1.5">
75         <el-button
76           type="warning"
77           plain
78           icon="el-icon-download"
79           size="mini"
80           @click="handleExport"
81           v-hasPermi="['main:paramCollection:export']"
82         >导出</el-button>
83       </el-col>
84       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
85     </el-row>
86
87     <el-table v-loading="loading" border :data="paramCollectionList" @selection-change="handleSelectionChange" v-if="paramCollectionList.length > 0">
88       <el-table-column type="selection" width="55" align="center" />
131e8c 89 <!--      <el-table-column label="工单编号" align="center" prop="workOrderNo"></el-table-column>-->
W 90       <el-table-column label="发动机编码" align="center" width="160" prop="sfcCode" ></el-table-column>
91 <!--      <el-table-column label="产品编号" align="center" prop="productCode"></el-table-column>-->
92 <!--      <el-table-column label="产线编号" align="center" prop="productionLine"></el-table-column>-->
93 <!--      <el-table-column label="设备编号" align="center" prop="equipmentNo"></el-table-column>-->
2c65c3 94       <el-table-column label="参数名称" align="center" prop="paramName" width="150" ></el-table-column>
b51361 95       <el-table-column label="参数值" align="center" prop="paramValue"></el-table-column>
2c65c3 96       <el-table-column label="工位编号" align="center" prop="locationCode"></el-table-column>
b51361 97       <el-table-column label="参数上限" align="center" prop="paramUpper"></el-table-column>
W 98       <el-table-column label="参数下限" align="center" prop="paramLower"></el-table-column>
629c9f 99       <el-table-column label="采集时间" align="center" prop="collectionTime" width="160">
fd2207 100         <template slot-scope="scope">
629c9f 101           <span>{{ parseTime(scope.row.collectionTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
fd2207 102         </template>
103       </el-table-column>
b51361 104       <el-table-column label="状态" align="center" prop="state"></el-table-column>
2c65c3 105       <el-table-column label="参数编码" align="center" prop="paramCode"></el-table-column>
b51361 106       <el-table-column label="单位" align="center" prop="unit"></el-table-column>
W 107       <el-table-column label="类型" align="center" prop="type"></el-table-column>
db8f36 108       <el-table-column fixed="right" width="200" label="操作" align="center" class-name="small-padding fixed-width" >
fd2207 109         <template slot-scope="scope">
110           <el-button
111             size="mini"
db8f36 112             type="success"
H 113             plain
114             style="width: 72px"
fd2207 115             icon="el-icon-edit"
116             @click="handleUpdate(scope.row)"
117             v-hasPermi="['main:paramCollection:edit']"
118           >修改</el-button>
119           <el-button
120             size="mini"
db8f36 121             type="danger"
H 122             plain
123             style="width: 72px"
fd2207 124             icon="el-icon-delete"
125             @click="handleDelete(scope.row)"
126             v-hasPermi="['main:paramCollection:remove']"
127           >删除</el-button>
128         </template>
129       </el-table-column>
130     </el-table>
131       <el-empty v-else>
132         <span slot="description">暂无数据</span>
133       </el-empty>
134     </el-card>
135
136     <pagination
137       v-show="total>0"
138       :total="total"
139       :page.sync="queryParams.pageNum"
140       :limit.sync="queryParams.pageSize"
141       @pagination="getList"
142     />
143
144     <!-- 添加或修改设备产品过程参数采集对话框 -->
145     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
146       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
131e8c 147 <!--        <el-form-item label="工单编号" prop="workOrderNo">-->
W 148 <!--          <el-input v-model="form.workOrderNo" type="textarea" placeholder="请输入内容" />-->
149 <!--        </el-form-item>-->
150         <el-form-item label="发动机编码" prop="sfcCode">
fd2207 151           <el-input v-model="form.sfcCode" type="textarea" placeholder="请输入内容" />
152         </el-form-item>
153         <el-form-item label="产品编号" prop="productCode">
154           <el-input v-model="form.productCode" type="textarea" placeholder="请输入内容" />
155         </el-form-item>
131e8c 156 <!--        <el-form-item label="产线编号" prop="productionLine">-->
W 157 <!--          <el-input v-model="form.productionLine" type="textarea" placeholder="请输入内容" />-->
158 <!--        </el-form-item>-->
fd2207 159         <el-form-item label="工位编号" prop="locationCode">
160           <el-input v-model="form.locationCode" type="textarea" placeholder="请输入内容" />
161         </el-form-item>
131e8c 162 <!--        <el-form-item label="设备编号" prop="equipmentNo">-->
W 163 <!--          <el-input v-model="form.equipmentNo" type="textarea" placeholder="请输入内容" />-->
164 <!--        </el-form-item>-->
fd2207 165         <el-form-item label="参数编码" prop="paramCode">
166           <el-input v-model="form.paramCode" type="textarea" placeholder="请输入内容" />
167         </el-form-item>
168         <el-form-item label="参数值" prop="paramValue">
169           <el-input v-model="form.paramValue" type="textarea" placeholder="请输入内容" />
170         </el-form-item>
171         <el-form-item label="参数上限" prop="paramUpper">
172           <el-input v-model="form.paramUpper" type="textarea" placeholder="请输入内容" />
173         </el-form-item>
174         <el-form-item label="参数下限" prop="paramLower">
175           <el-input v-model="form.paramLower" type="textarea" placeholder="请输入内容" />
176         </el-form-item>
177         <el-form-item label="标准值" prop="paramStandard">
178           <el-input v-model="form.paramStandard" type="textarea" placeholder="请输入内容" />
179         </el-form-item>
180         <el-form-item label="状态" prop="state">
181           <el-input v-model="form.state" placeholder="请输入状态" />
182         </el-form-item>
183         <el-form-item label="参数名称" prop="paramName">
184           <el-input v-model="form.paramName" placeholder="请输入参数名称" />
185         </el-form-item>
186         <el-form-item label="单位" prop="unit">
187           <el-input v-model="form.unit" placeholder="请输入单位" />
188         </el-form-item>
189         <el-form-item label="类型" prop="type">
190           <el-select v-model="form.type" placeholder="请选择类型">
191           </el-select>
192         </el-form-item>
193       </el-form>
194       <div slot="footer" class="dialog-footer">
195         <el-button type="primary" @click="submitForm">确 定</el-button>
196         <el-button @click="cancel">取 消</el-button>
197       </div>
198     </el-dialog>
199   </div>
200 </template>
201
202 <script>
203 import { listParamCollection, getParamCollection, delParamCollection, addParamCollection, updateParamCollection } from "@/api/main/da/paramCollection/paramCollection";
2c65c3 204 import {queryDaParamCollectionListForSearch} from "../../../../api/main/da/paramCollection/paramCollection";
fd2207 205
206 export default {
207   name: "ParamCollection",
208   data() {
209     return {
2c65c3 210       maxDate: '',
fd2207 211       // 遮罩层
212       loading: true,
213       // 选中数组
214       ids: [],
215       // 非单个禁用
216       single: true,
217       // 非多个禁用
218       multiple: true,
219       // 显示搜索条件
220       showSearch: true,
221       // 总条数
222       total: 0,
223       // 设备产品过程参数采集表格数据
224       paramCollectionList: [],
225       // 弹出层标题
226       title: "",
227       // 是否显示弹出层
228       open: false,
229       // 查询参数
230       queryParams: {
2c65c3 231         dateConditions: [],
fd2207 232         pageNum: 1,
233         pageSize: 10,
234         workOrderNo: null,
235         sfcCode: null,
236         productCode: null,
237         productionLine: null,
238         locationCode: null,
239         equipmentNo: null,
240         paramCode: null,
241       },
242       // 表单参数
243       form: {},
244       // 表单校验
245       rules: {
246         id: [
247           { required: true, message: "主键id不能为空", trigger: "blur" }
248         ],
131e8c 249         // workOrderNo: [
W 250         //   { required: true, message: "工单编号不能为空", trigger: "blur" }
251         // ],
fd2207 252         sfcCode: [
253           { required: true, message: "总成序列号不能为空", trigger: "blur" }
254         ],
255         productCode: [
256           { required: true, message: "产品编号不能为空", trigger: "blur" }
257         ],
131e8c 258         // productionLine: [
W 259         //   { required: true, message: "产线编号不能为空", trigger: "blur" }
260         // ],
fd2207 261         locationCode: [
262           { required: true, message: "工位编号不能为空", trigger: "blur" }
263         ],
264         paramCode: [
265           { required: true, message: "参数编码不能为空", trigger: "blur" }
266         ],
267         paramValue: [
268           { required: true, message: "参数值不能为空", trigger: "blur" }
269         ],
270       }
271     };
272   },
273   created() {
a4c4c1 274     // this.getList();
fd2207 275   },
276   methods: {
2c65c3 277     handleDateChange(value) {
W 278       if (value && value.length === 2) {
279         const startDate = value[0];
280         const endDate = value[1];
281         const dayCount = this.daysBetween(startDate, endDate);
ea3c33 282         if (dayCount + 1 > 3) {
W 283           this.$message.error('请选择连续的3天!');
2c65c3 284           this.queryParams.dateConditions = []; // 重置日期范围
W 285         }
286       }
287     },
288     daysBetween(startDate, endDate) {
289       const oneDay = 24 * 60 * 60 * 1000; // 每天的毫秒数
290       const startTime = new Date(startDate).getTime();
291       const endTime = new Date(endDate).getTime();
292       return Math.round(Math.abs((startTime - endTime) / oneDay));
293     },
fd2207 294     /** 查询设备产品过程参数采集列表 */
295     getList() {
296       this.loading = true;
2c65c3 297       if ((this.queryParams.sfcCode == null || this.queryParams.sfcCode === '') && this.queryParams.dateConditions.length === 0){
2d1514 298         this.$message({
2c65c3 299           message: '请输入发动机号码或者选择查询日期',
2d1514 300           type: 'info'
W 301         });
302       } else {
2c65c3 303         queryDaParamCollectionListForSearch(this.queryParams).then(response => {
2d1514 304           this.paramCollectionList = response.rows;
W 305           this.total = response.total;
306           this.loading = false;
307         });
308       }
309
fd2207 310     },
311     // 取消按钮
312     cancel() {
313       this.open = false;
314       this.reset();
315     },
316     // 表单重置
317     reset() {
318       this.form = {
319         id: null,
320         workOrderNo: null,
321         sfcCode: null,
322         productCode: null,
323         productionLine: null,
324         locationCode: null,
325         equipmentNo: null,
326         paramCode: null,
327         paramValue: null,
328         paramUpper: null,
329         paramLower: null,
330         paramStandard: null,
331         collectionTime: null,
332         spareField1: null,
333         spareField2: null,
334         createUser: null,
335         createTime: null,
336         updateUser: null,
337         updateTime: null,
338         state: null,
339         paramName: null,
340         unit: null,
341         type: null
342       };
343       this.resetForm("form");
344     },
345     /** 搜索按钮操作 */
346     handleQuery() {
347       this.queryParams.pageNum = 1;
348       this.getList();
349     },
350     /** 重置按钮操作 */
351     resetQuery() {
352       this.resetForm("queryForm");
353       this.handleQuery();
354     },
355     // 多选框选中数据
356     handleSelectionChange(selection) {
357       this.ids = selection.map(item => item.id)
358       this.single = selection.length!==1
359       this.multiple = !selection.length
360     },
361     /** 新增按钮操作 */
362     handleAdd() {
363       this.reset();
364       this.open = true;
365       this.title = "添加设备产品过程参数采集";
366     },
367     /** 修改按钮操作 */
368     handleUpdate(row) {
369       this.reset();
370       const id = row.id || this.ids
371       getParamCollection(id).then(response => {
372         this.form = response.data;
373         this.open = true;
374         this.title = "修改设备产品过程参数采集";
375       });
376     },
377     /** 提交按钮 */
378     submitForm() {
379       this.$refs["form"].validate(valid => {
380         if (valid) {
381           if (this.form.id != null) {
382             updateParamCollection(this.form).then(response => {
383               this.$modal.msgSuccess("修改成功");
384               this.open = false;
385               this.getList();
386             });
387           } else {
388             addParamCollection(this.form).then(response => {
389               this.$modal.msgSuccess("新增成功");
390               this.open = false;
391               this.getList();
392             });
393           }
394         }
395       });
396     },
397     /** 删除按钮操作 */
398     handleDelete(row) {
399       const ids = row.id || this.ids;
400       this.$modal.confirm('是否确认删除设备产品过程参数采集编号为"' + ids + '"的数据项?').then(function() {
401         return delParamCollection(ids);
402       }).then(() => {
403         this.getList();
404         this.$modal.msgSuccess("删除成功");
405       }).catch(() => {});
406     },
407     /** 导出按钮操作 */
408     handleExport() {
409       this.download('main/paramCollection/export', {
410         ...this.queryParams
411       }, `paramCollection_${new Date().getTime()}.xlsx`)
412     }
413   }
414 };
415 </script>