-
admin
2024-11-21 5773fa29e070fe3d8a60be63c14e871e1138dfc9
提交 | 用户 | 时间
4d458e 1 <template>
A 2   <div class="app-container">
3     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
92837a 4       <el-form-item label-width="120" label="总成序列号" prop="sfcCode">
4d458e 5         <el-input
A 6           v-model="queryParams.sfcCode"
7           placeholder="请输入总成序列号"
8           clearable
9           @keyup.enter.native="handleQuery"
10         />
11       </el-form-item>
5773fa 12      <el-form-item label-width="120" label="采集时间" prop="timeQuery">
A 13         <el-date-picker
14           v-model="queryParams.timeQuery"
15           type="datetimerange"
16           range-separator="至"
17           value-format="yyyy-MM-dd HH:mm:ss"
18           start-placeholder="开始日期"
19           end-placeholder="结束日期">
20         </el-date-picker>
21       </el-form-item>
92837a 22       <el-form-item style="float: right">
A 23         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
24         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
25             <el-button icon="el-icon-setting" size="mini" @click="toggleAdvancedSearch">高级查询</el-button>
26       </el-form-item>
27      <transition name="fade">
28         <div v-if="advancedSearchVisible" class="advanced-search">
29           <el-form-item label="工位编码" prop="locationCode">
4d458e 30         <el-input
A 31           v-model="queryParams.locationCode"
32           placeholder="请输入工位编码"
33           clearable
34           @keyup.enter.native="handleQuery"
35         />
36       </el-form-item>
37       <el-form-item label="参数编码" prop="paramCode">
38         <el-input
39           v-model="queryParams.paramCode"
40           placeholder="请输入参数编码"
41           clearable
42           @keyup.enter.native="handleQuery"
43         />
44       </el-form-item>
92837a 45           <el-form-item label="参数名称" prop="paramName">
A 46             <el-input
47               v-model="queryParams.paramName"
48               placeholder="请输入参数名称"
49               clearable
50               @keyup.enter.native="handleQuery"
51             />
52           </el-form-item>
5773fa 53 <!--          <el-form-item label="采集时间" prop="collectTime">-->
A 54 <!--            <el-date-picker-->
55 <!--              v-model="queryParams.collectTime"-->
56 <!--              type="datetime"-->
57 <!--              placeholder="请选择采集时间"-->
58 <!--              value-format="yyyy-MM-dd HH:mm:ss"-->
59 <!--            />-->
60 <!--          </el-form-item>-->
92837a 61           <!-- 可以继续添加其他高级查询条件 -->
A 62           <el-row>
63             <el-col :span="24" style="text-align: right;">
64               <el-button type="primary" icon="el-icon-close" size="mini" @click="toggleAdvancedSearch">关闭</el-button>
65             </el-col>
66           </el-row>
67         </div>
68       </transition>
4d458e 69     </el-form>
A 70
71     <el-row :gutter="10" class="mb8">
72       <el-col :span="1.5">
73         <el-button
74           type="primary"
75           plain
76           icon="el-icon-plus"
77           size="mini"
78           @click="handleAdd"
79           v-hasPermi="['da:paramCollection:add']"
80         >新增</el-button>
81       </el-col>
82       <el-col :span="1.5">
83         <el-button
84           type="success"
85           plain
86           icon="el-icon-edit"
87           size="mini"
88           :disabled="single"
89           @click="handleUpdate"
90           v-hasPermi="['da:paramCollection:edit']"
91         >修改</el-button>
92       </el-col>
93       <el-col :span="1.5">
94         <el-button
95           type="danger"
96           plain
97           icon="el-icon-delete"
98           size="mini"
99           :disabled="multiple"
100           @click="handleDelete"
101           v-hasPermi="['da:paramCollection:remove']"
102         >删除</el-button>
103       </el-col>
104       <el-col :span="1.5">
105         <el-button
106           type="warning"
107           plain
108           icon="el-icon-download"
109           size="mini"
110           @click="handleExport"
111           v-hasPermi="['da:paramCollection:export']"
112         >导出</el-button>
113       </el-col>
114       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
115     </el-row>
116
92837a 117     <el-table v-loading="loading" border :data="paramCollectionList" @selection-change="handleSelectionChange">
4d458e 118       <el-table-column type="selection" width="55" align="center" />
92837a 119 <!--      <el-table-column label="主键id" align="center" prop="id" />-->
4d458e 120       <el-table-column label="总成序列号" align="center" prop="sfcCode" />
A 121       <el-table-column label="工位编码" align="center" prop="locationCode" />
122       <el-table-column label="参数编码" align="center" prop="paramCode" />
123       <el-table-column label="参数名称" align="center" prop="paramName" />
124       <el-table-column label="参数值" align="center" prop="paramValue" />
125       <el-table-column label="采集时间" align="center" prop="collectTime" width="180">
126       </el-table-column>
127       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
128         <template slot-scope="scope">
129           <el-button
130             size="mini"
131             type="text"
132             icon="el-icon-edit"
133             @click="handleUpdate(scope.row)"
134             v-hasPermi="['da:paramCollection:edit']"
135           >修改</el-button>
136           <el-button
137             size="mini"
138             type="text"
139             icon="el-icon-delete"
140             @click="handleDelete(scope.row)"
141             v-hasPermi="['da:paramCollection:remove']"
142           >删除</el-button>
143         </template>
144       </el-table-column>
145     </el-table>
146
147     <pagination
148       v-show="total>0"
149       :total="total"
150       :page.sync="queryParams.pageNum"
151       :limit.sync="queryParams.pageSize"
152       @pagination="getList"
153     />
154
155     <!-- 添加或修改参数采集对话框 -->
156     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
92837a 157       <el-form ref="form" :model="form" :rules="rules" label-width="95px">
4d458e 158         <el-form-item label="总成序列号" prop="sfcCode">
A 159           <el-input v-model="form.sfcCode" placeholder="请输入总成序列号" />
160         </el-form-item>
161         <el-form-item label="工位编码" prop="locationCode">
162           <el-input v-model="form.locationCode" placeholder="请输入工位编码" />
163         </el-form-item>
164         <el-form-item label="参数编码" prop="paramCode">
165           <el-input v-model="form.paramCode" placeholder="请输入参数编码" />
166         </el-form-item>
167         <el-form-item label="参数名称" prop="paramName">
168           <el-input v-model="form.paramName" placeholder="请输入参数名称" />
169         </el-form-item>
170         <el-form-item label="参数值" prop="paramValue">
171           <el-input v-model="form.paramValue" placeholder="请输入参数值" />
172         </el-form-item>
173       </el-form>
174       <div slot="footer" class="dialog-footer">
175         <el-button type="primary" @click="submitForm">确 定</el-button>
176         <el-button @click="cancel">取 消</el-button>
177       </div>
178     </el-dialog>
179   </div>
180 </template>
181
182 <script>
183 import { listParamCollection, getParamCollection, delParamCollection, addParamCollection, updateParamCollection } from "@/api/main/da/paramCollection";
184
185 export default {
186   name: "ParamCollection",
187   data() {
188     return {
5773fa 189       value1: "",
92837a 190       advancedSearchVisible: false,
4d458e 191       // 遮罩层
A 192       loading: true,
193       // 选中数组
194       ids: [],
195       // 非单个禁用
196       single: true,
197       // 非多个禁用
198       multiple: true,
199       // 显示搜索条件
200       showSearch: true,
201       // 总条数
202       total: 0,
203       // 参数采集表格数据
204       paramCollectionList: [],
205       // 弹出层标题
206       title: "",
207       // 是否显示弹出层
208       open: false,
209       // 查询参数
210       queryParams: {
211         pageNum: 1,
212         pageSize: 10,
213         sfcCode: null,
214         locationCode: null,
215         paramCode: null,
216         paramName: null,
5773fa 217         timeQuery: []
4d458e 218       },
A 219       // 表单参数
220       form: {},
221       // 表单校验
222       rules: {
223         sfcCode: [
92837a 224           { required: true, message: "总成序列号不能为空", trigger: "blur" },
A 225           { pattern: /^[a-zA-Z0-9]*$/, message: "总成序列号不能包含中文字符", trigger: "blur" }
4d458e 226         ],
A 227         locationCode: [
92837a 228           { required: true, message: "工位编码不能为空", trigger: "blur" },
A 229           { pattern: /^[a-zA-Z0-9]*$/, message: "总成序列号不能包含中文字符", trigger: "blur" }
4d458e 230         ],
A 231         paramCode: [
92837a 232           { required: true, message: "参数编码不能为空", trigger: "blur" },
A 233           { pattern: /^[a-zA-Z0-9]*$/, message: "总成序列号不能包含中文字符", trigger: "blur" }
4d458e 234         ],
A 235         paramValue: [
92837a 236           { required: true, message: "参数值不能为空", trigger: "blur" },
A 237           { pattern: /^[a-zA-Z0-9]*$/, message: "总成序列号不能包含中文字符", trigger: "blur" }
4d458e 238         ],
A 239       }
240     };
241   },
242   created() {
243     this.getList();
244   },
245   methods: {
92837a 246     toggleAdvancedSearch() {
A 247       this.advancedSearchVisible = !this.advancedSearchVisible;
248
249     },
4d458e 250     /** 查询参数采集列表 */
A 251     getList() {
252       this.loading = true;
253       listParamCollection(this.queryParams).then(response => {
254         this.paramCollectionList = response.rows;
255         this.total = response.total;
256         this.loading = false;
257       });
258     },
259     // 取消按钮
260     cancel() {
261       this.open = false;
262       this.reset();
263     },
264     // 表单重置
265     reset() {
266       this.form = {
267         id: null,
268         sfcCode: null,
269         locationCode: null,
270         paramCode: null,
271         paramName: null,
272         paramValue: null,
273         collectTime: null
274       };
92837a 275
A 276
4d458e 277       this.resetForm("form");
A 278     },
279     /** 搜索按钮操作 */
280     handleQuery() {
5773fa 281       console.log(this.value1)
4d458e 282       this.queryParams.pageNum = 1;
A 283       this.getList();
92837a 284       this.advancedSearchVisible = false
4d458e 285     },
A 286     /** 重置按钮操作 */
287     resetQuery() {
92837a 288       this.clearQueryParams()
4d458e 289       this.resetForm("queryForm");
A 290       this.handleQuery();
92837a 291     },
A 292     clearQueryParams(){
293       this.queryParams.paramName = null
294       this.queryParams.locationCode = null
295       this.queryParams.paramCode = null
4d458e 296     },
A 297     // 多选框选中数据
298     handleSelectionChange(selection) {
299       this.ids = selection.map(item => item.id)
300       this.single = selection.length!==1
301       this.multiple = !selection.length
302     },
303     /** 新增按钮操作 */
304     handleAdd() {
305       this.reset();
306       this.open = true;
307       this.title = "添加参数采集";
308     },
309     /** 修改按钮操作 */
310     handleUpdate(row) {
311       this.reset();
312       const id = row.id || this.ids
313       getParamCollection(id).then(response => {
314         this.form = response.data;
315         this.open = true;
316         this.title = "修改参数采集";
317       });
318     },
319     /** 提交按钮 */
320     submitForm() {
321       this.$refs["form"].validate(valid => {
322         if (valid) {
323           if (this.form.id != null) {
324             updateParamCollection(this.form).then(response => {
325               this.$modal.msgSuccess("修改成功");
326               this.open = false;
327               this.getList();
328             });
329           } else {
330             addParamCollection(this.form).then(response => {
331               this.$modal.msgSuccess("新增成功");
332               this.open = false;
333               this.getList();
334             });
335           }
336         }
337       });
338     },
339     /** 删除按钮操作 */
340     handleDelete(row) {
341       const ids = row.id || this.ids;
342       this.$modal.confirm('是否确认删除参数采集编号为"' + ids + '"的数据项?').then(function() {
343         return delParamCollection(ids);
344       }).then(() => {
345         this.getList();
346         this.$modal.msgSuccess("删除成功");
347       }).catch(() => {});
348     },
349     /** 导出按钮操作 */
350     handleExport() {
351       this.download('da/paramCollection/export', {
352         ...this.queryParams
353       }, `paramCollection_${new Date().getTime()}.xlsx`)
354     }
355   }
356 };
357 </script>
92837a 358 <style scoped>.fade-enter-active, .fade-leave-active {
A 359   transition: opacity 0.3s;
360 }
361 .fade-enter, .fade-leave-to /* .fade-leave-active in <2.1.8 */ {
362   opacity: 0;
363 }
364
365 .advanced-search {
366   position: absolute;
367   background: #FFFFFF; /* 设置为与页面背景色相同或相近的颜色 */
368   border-left: 1px solid #dcdfe6;
369   border-right: 1px solid #dcdfe6;
370   border-bottom: 1px solid #dcdfe6;
371   /*border: none;*/
372   box-shadow: none; /* 移除阴影 */
373   padding: 10px;
374   z-index: 1000; /* 确保浮动在其他元素之上 */
375   top: 70px; /* 调整顶部位置,使其与页面其他元素更协调 */
376   left: 20px; /* 调整左侧位置 */
377   width: 97%; /* 调整宽度 */
378   /*max-width: 1296px; !* 最大宽度 *!*/
379   /*max-width: 1296px; !* 最大宽度 *!*/
380   margin: 0 auto; /* 居中对齐 */
381 }
382 </style>