提交 | 用户 | 时间
|
b51361
|
1 |
<template> |
W |
2 |
<div class="app-container"> |
|
3 |
<el-card class="box-card" > |
|
4 |
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px" > |
|
5 |
<el-form-item label-width="120" label="箱体编码:" prop="sfcCode"> |
|
6 |
<el-input clearable |
|
7 |
v-model="queryParams.sfcCode" |
|
8 |
placeholder="请输入箱体编码" |
|
9 |
@keyup.enter.native="handleQuery"/> |
|
10 |
</el-form-item> |
|
11 |
<el-form-item label-width="120" label="工位号:" prop="locationCode"> |
|
12 |
<el-input clearable |
|
13 |
v-model="queryParams.locationCode" |
|
14 |
placeholder="请输入工位号" |
|
15 |
@keyup.enter.native="handleQuery"/> |
|
16 |
</el-form-item> |
|
17 |
|
|
18 |
<el-form-item label-width="120" label="采集时间" prop="startDate"> |
|
19 |
<el-date-picker |
|
20 |
v-model="dateRange" |
|
21 |
type="daterange" |
|
22 |
range-separator="至" |
|
23 |
start-placeholder="开始日期" |
|
24 |
end-placeholder="结束日期"> |
|
25 |
</el-date-picker> |
|
26 |
<button @click="fetchData">查询</button> |
|
27 |
</el-form-item> |
|
28 |
<el-form-item style="float: right"> |
|
29 |
<el-button type="primary" icon="el-icon-refresh" @click="handleQuery">查询</el-button> |
|
30 |
<el-button type="" icon="el-icon-refresh" @click="resetQuery">重置</el-button> |
|
31 |
</el-form-item> |
|
32 |
</el-form> |
|
33 |
</el-card> |
|
34 |
|
|
35 |
<el-card style="margin-top: 10px" class="box-card"> |
|
36 |
<el-table v-loading="loading" border :data="tightenReportList" @selection-change="handleSelectionChange" v-if="tightenReportList.length > 0"> |
|
37 |
<el-table-column type="selection" width="55" align="center" /> |
|
38 |
<el-table-column label="箱体编码" align="center" width="200" prop="sfcCode"></el-table-column> |
|
39 |
<el-table-column label="工位" align="center" prop="locationCode"></el-table-column> |
|
40 |
<el-table-column label="参数编码" align="center" prop="paramCode"></el-table-column> |
|
41 |
<el-table-column label="参数名称" align="center" prop="paramName"></el-table-column> |
|
42 |
<el-table-column label="参数值" align="center" prop="paramValue"></el-table-column> |
|
43 |
<el-table-column label="采集时间" align="center" prop="collectionTime" width="180"> |
|
44 |
<template slot-scope="scope"> |
|
45 |
<span>{{ parseTime(scope.row.collectionTime, '{y}-{m}-{d}') }}</span> |
|
46 |
</template> |
|
47 |
</el-table-column> |
|
48 |
<el-table-column label="状态" align="center" prop="state"></el-table-column> |
|
49 |
<el-table-column label="单位" align="center" prop="unit"></el-table-column> |
|
50 |
</el-table> |
|
51 |
<el-empty v-else> |
|
52 |
<span slot="description">暂无数据</span> |
|
53 |
</el-empty> |
|
54 |
</el-card> |
|
55 |
|
|
56 |
<pagination |
|
57 |
v-show="total>0" |
|
58 |
:total="total" |
|
59 |
:page.sync="queryParams.pageNum" |
|
60 |
:limit.sync="queryParams.pageSize" |
|
61 |
@pagination="getList" |
|
62 |
/> |
|
63 |
|
|
64 |
</div> |
|
65 |
</template> |
|
66 |
<script> |
|
67 |
import { listParamCollection, getParamCollection, delParamCollection, addParamCollection, updateParamCollection } from "@/api/main/da/paramCollection/paramCollection"; |
|
68 |
export default { |
|
69 |
name: "index", |
|
70 |
computed: { |
|
71 |
}, |
|
72 |
dicts: ['sys_normal_disable','order_scheduling_produce_status','print_status'], |
|
73 |
components: { |
|
74 |
}, |
|
75 |
data(){ |
|
76 |
return{ |
|
77 |
dateRange: '', |
|
78 |
// 用于存储选择的日期范围 |
|
79 |
total: 0, |
|
80 |
ids: [], |
|
81 |
tightenReportList: [], |
|
82 |
loading: true, |
|
83 |
single: true, |
|
84 |
// 非多个禁用 |
|
85 |
multiple: true, |
|
86 |
// 显示搜索条件 |
|
87 |
showSearch: true, |
|
88 |
// 查询参数 |
|
89 |
queryParams: { |
|
90 |
pageNum: 1, |
|
91 |
pageSize: 10, |
|
92 |
workOrderNo: null, |
|
93 |
sfcCode: null, |
|
94 |
productCode: null, |
|
95 |
productionLine: null, |
|
96 |
locationCode: null, |
|
97 |
equipmentNo: null, |
|
98 |
paramCode: null, |
|
99 |
paramValue: null, |
|
100 |
paramUpper: null, |
|
101 |
paramLower: null, |
|
102 |
paramStandard: null, |
|
103 |
collectionTime: null, |
|
104 |
spareField1: null, |
|
105 |
spareField2: null, |
|
106 |
createUser: null, |
|
107 |
createTime: null, |
|
108 |
updateUser: null, |
|
109 |
updateTime: null, |
|
110 |
state: null, |
|
111 |
paramName: null, |
|
112 |
unit: null, |
|
113 |
type: '拧紧数据', |
|
114 |
startDate: null, |
|
115 |
endDate: null |
|
116 |
}, |
|
117 |
} |
|
118 |
}, |
|
119 |
created() { |
|
120 |
this.getList(); |
|
121 |
}, |
|
122 |
methods:{ |
|
123 |
|
|
124 |
async fetchData() { |
|
125 |
// 构建API请求的URL,使用选择的日期范围作为查询参数 |
|
126 |
const url = `@/api/main/da/paramCollection/paramCollection?startDate=${this.dateRange[0]}&endDate=${this.dateRange[1]}`; |
|
127 |
|
|
128 |
try { |
|
129 |
// 发送API请求,获取查询结果 |
|
130 |
const response = await fetch(url); |
|
131 |
const data = await response.json(); |
|
132 |
console.log(data); // 处理查询结果,比如在控制台输出或显示在页面上 |
|
133 |
} catch (error) { |
|
134 |
console.error('Error fetching data:', error); |
|
135 |
} |
|
136 |
}, |
|
137 |
}, |
|
138 |
|
|
139 |
reset() { |
|
140 |
this.form = { |
|
141 |
id: null, |
|
142 |
workOrderNo: null, |
|
143 |
sfcCode: null, |
|
144 |
productCode: null, |
|
145 |
productionLine: null, |
|
146 |
locationCode: null, |
|
147 |
equipmentNo: null, |
|
148 |
paramCode: null, |
|
149 |
paramValue: null, |
|
150 |
paramUpper: null, |
|
151 |
paramLower: null, |
|
152 |
paramStandard: null, |
|
153 |
collectionTime: null, |
|
154 |
spareField1: null, |
|
155 |
spareField2: null, |
|
156 |
createUser: null, |
|
157 |
createTime: null, |
|
158 |
updateUser: null, |
|
159 |
updateTime: null, |
|
160 |
state: null, |
|
161 |
paramName: null, |
|
162 |
unit: null, |
|
163 |
type: '拧紧数据', |
|
164 |
}; |
|
165 |
this.resetForm("form"); |
|
166 |
}, |
|
167 |
/** 搜索按钮操作 */ |
|
168 |
handleQuery() { |
|
169 |
this.queryParams.pageNum = 1; |
|
170 |
this.getList(); |
|
171 |
}, |
|
172 |
/** 重置按钮操作 */ |
|
173 |
resetQuery() { |
|
174 |
this.resetForm("queryForm"); |
|
175 |
this.handleQuery(); |
|
176 |
}, |
|
177 |
// 多选框选中数据 |
|
178 |
handleSelectionChange(selection) { |
|
179 |
this.ids = selection.map(item => item.id) |
|
180 |
this.single = selection.length!==1 |
|
181 |
this.multiple = !selection.length |
|
182 |
}, |
|
183 |
|
|
184 |
getList() { |
|
185 |
this.loading = true; |
|
186 |
// const startDate = new Date(this.queryParams.startDate); |
|
187 |
// const endDate = new Date(this.queryParams.endDate); |
|
188 |
// const resultList = []; |
|
189 |
// // 构建查询条件,使用ParamCollection表的createtime作为判断条件 |
|
190 |
// const query = { |
|
191 |
// createTime: date // 使用当前日期作为查询条件 |
|
192 |
// }; |
|
193 |
// for (let date = startDate; date <= endDate; date.setDate(date.getDate() + 1)) { |
|
194 |
// // 根据当前日期执行查询操作,并将结果添加到结果数组中 |
|
195 |
// listParamCollection(query).then(response => { |
|
196 |
// resultList.push(...response.rows); |
|
197 |
// // 判断是否是最后一个日期,如果是,则更新页面数据 |
|
198 |
// if (date.getTime() === endDate.getTime()) { |
|
199 |
// this.tightenReportList = resultList; |
|
200 |
// this.total = resultList.length; |
|
201 |
// this.loading = false; |
|
202 |
// } |
|
203 |
// }); |
|
204 |
// } |
|
205 |
listParamCollection(this.queryParams).then(response => { |
|
206 |
this.tightenReportList = response.rows; |
|
207 |
this.total = response.total; |
|
208 |
this.loading = false; |
|
209 |
}); |
|
210 |
}, |
|
211 |
|
|
212 |
|
|
213 |
} |
|
214 |
</script> |
|
215 |
|
|
216 |
<style scoped> |
|
217 |
::v-deep .el-form-item__label{ |
|
218 |
font-size: large; |
|
219 |
} |
|
220 |
::v-deep .el-card__body{ |
|
221 |
padding: 15px 20px 0px 20px; |
|
222 |
} |
|
223 |
</style> |