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