admin
2024-11-22 20c287a2d82d0e28a3f5ec6e6235a95b21f48907
提交 | 用户 | 时间
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>
20c287 25         <el-button icon="el-icon-setting" size="mini" @click="toggleAdvancedSearch">高级查询</el-button>
92837a 26       </el-form-item>
A 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     },
4d458e 249     /** 查询参数采集列表 */
A 250     getList() {
251       this.loading = true;
252       listParamCollection(this.queryParams).then(response => {
253         this.paramCollectionList = response.rows;
254         this.total = response.total;
255         this.loading = false;
256       });
257     },
258     // 取消按钮
259     cancel() {
260       this.open = false;
261       this.reset();
262     },
263     // 表单重置
264     reset() {
265       this.form = {
266         id: null,
267         sfcCode: null,
268         locationCode: null,
269         paramCode: null,
270         paramName: null,
271         paramValue: null,
272         collectTime: null
273       };
92837a 274
A 275
4d458e 276       this.resetForm("form");
A 277     },
278     /** 搜索按钮操作 */
279     handleQuery() {
5773fa 280       console.log(this.value1)
4d458e 281       this.queryParams.pageNum = 1;
A 282       this.getList();
92837a 283       this.advancedSearchVisible = false
4d458e 284     },
A 285     /** 重置按钮操作 */
286     resetQuery() {
92837a 287       this.clearQueryParams()
4d458e 288       this.resetForm("queryForm");
A 289       this.handleQuery();
92837a 290     },
A 291     clearQueryParams(){
292       this.queryParams.paramName = null
293       this.queryParams.locationCode = null
294       this.queryParams.paramCode = null
4d458e 295     },
A 296     // 多选框选中数据
297     handleSelectionChange(selection) {
298       this.ids = selection.map(item => item.id)
299       this.single = selection.length!==1
300       this.multiple = !selection.length
301     },
302     /** 新增按钮操作 */
303     handleAdd() {
304       this.reset();
305       this.open = true;
306       this.title = "添加参数采集";
307     },
308     /** 修改按钮操作 */
309     handleUpdate(row) {
310       this.reset();
311       const id = row.id || this.ids
312       getParamCollection(id).then(response => {
313         this.form = response.data;
314         this.open = true;
315         this.title = "修改参数采集";
316       });
317     },
318     /** 提交按钮 */
319     submitForm() {
320       this.$refs["form"].validate(valid => {
321         if (valid) {
322           if (this.form.id != null) {
323             updateParamCollection(this.form).then(response => {
324               this.$modal.msgSuccess("修改成功");
325               this.open = false;
326               this.getList();
327             });
328           } else {
329             addParamCollection(this.form).then(response => {
330               this.$modal.msgSuccess("新增成功");
331               this.open = false;
332               this.getList();
333             });
334           }
335         }
336       });
337     },
338     /** 删除按钮操作 */
339     handleDelete(row) {
340       const ids = row.id || this.ids;
341       this.$modal.confirm('是否确认删除参数采集编号为"' + ids + '"的数据项?').then(function() {
342         return delParamCollection(ids);
343       }).then(() => {
344         this.getList();
345         this.$modal.msgSuccess("删除成功");
346       }).catch(() => {});
347     },
348     /** 导出按钮操作 */
349     handleExport() {
350       this.download('da/paramCollection/export', {
351         ...this.queryParams
352       }, `paramCollection_${new Date().getTime()}.xlsx`)
353     }
354   }
355 };
356 </script>
92837a 357 <style scoped>.fade-enter-active, .fade-leave-active {
A 358   transition: opacity 0.3s;
359 }
360 .fade-enter, .fade-leave-to /* .fade-leave-active in <2.1.8 */ {
361   opacity: 0;
362 }
363
364 .advanced-search {
365   position: absolute;
366   background: #FFFFFF; /* 设置为与页面背景色相同或相近的颜色 */
367   border-left: 1px solid #dcdfe6;
368   border-right: 1px solid #dcdfe6;
369   border-bottom: 1px solid #dcdfe6;
370   /*border: none;*/
371   box-shadow: none; /* 移除阴影 */
372   padding: 10px;
373   z-index: 1000; /* 确保浮动在其他元素之上 */
374   top: 70px; /* 调整顶部位置,使其与页面其他元素更协调 */
375   left: 20px; /* 调整左侧位置 */
376   width: 97%; /* 调整宽度 */
377   /*max-width: 1296px; !* 最大宽度 *!*/
378   /*max-width: 1296px; !* 最大宽度 *!*/
379   margin: 0 auto; /* 居中对齐 */
380 }
381 </style>