hdy
4 天以前 51eb318f6df9ebc7d1ff47522e33b2ee7cea1ba8
提交 | 用户 | 时间
9d822f 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">
4       <el-form-item label-width="100" label="总成序列号" prop="sfcCode">
5         <el-input
6           v-model="queryParams.sfcCode"
7           placeholder="请输入总成序列号"
8           clearable
9           @keyup.enter.native="handleQuery"
10         />
11       </el-form-item>
7933a5 12       <el-form-item label-width="120" label="采集时间">
A 13         <el-date-picker
14           v-model="dateRange"
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>
9d822f 21       </el-form-item>
7933a5 22 <!--      <el-form-item label="工位编码" prop="locationCode">-->
A 23 <!--        <el-input-->
24 <!--          v-model="queryParams.locationCode"-->
25 <!--          placeholder="请输入工位编码"-->
26 <!--          clearable-->
27 <!--          @keyup.enter.native="handleQuery"-->
28 <!--        />-->
29 <!--      </el-form-item>-->
9d822f 30 <!--      <el-form-item label="参数编码" prop="paramCode">-->
A 31 <!--        <el-input-->
32 <!--          v-model="queryParams.paramCode"-->
33 <!--          placeholder="请输入参数编码"-->
34 <!--          clearable-->
35 <!--          @keyup.enter.native="handleQuery"-->
36 <!--        />-->
37 <!--      </el-form-item>-->
38 <!--      <el-form-item label="参数名称" prop="paramName">-->
39 <!--        <el-input-->
40 <!--          v-model="queryParams.paramName"-->
41 <!--          placeholder="请输入参数名称"-->
42 <!--          clearable-->
43 <!--          @keyup.enter.native="handleQuery"-->
44 <!--        />-->
45 <!--      </el-form-item>-->
46       <el-form-item style="float: right">
47         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
48         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
49       </el-form-item>
50     </el-form>
51
52     <el-row :gutter="10" class="mb8">
e973ff 53 <!--      <el-col :span="1.5">-->
A 54 <!--        <el-button-->
55 <!--          type="primary"-->
56 <!--          plain-->
57 <!--          icon="el-icon-plus"-->
58 <!--          size="mini"-->
59 <!--          @click="handleAdd"-->
60 <!--          v-hasPermi="['da:materialCollection:add']"-->
61 <!--        >新增</el-button>-->
62 <!--      </el-col>-->
63 <!--      <el-col :span="1.5">-->
64 <!--        <el-button-->
65 <!--          type="success"-->
66 <!--          plain-->
67 <!--          icon="el-icon-edit"-->
68 <!--          size="mini"-->
69 <!--          :disabled="single"-->
70 <!--          @click="handleUpdate"-->
71 <!--          v-hasPermi="['da:materialCollection:edit']"-->
72 <!--        >修改</el-button>-->
73 <!--      </el-col>-->
74 <!--      <el-col :span="1.5">-->
75 <!--        <el-button-->
76 <!--          type="danger"-->
77 <!--          plain-->
78 <!--          icon="el-icon-delete"-->
79 <!--          size="mini"-->
80 <!--          :disabled="multiple"-->
81 <!--          @click="handleDelete"-->
82 <!--          v-hasPermi="['da:materialCollection:remove']"-->
83 <!--        >删除</el-button>-->
84 <!--      </el-col>-->
9d822f 85       <el-col :span="1.5">
A 86         <el-button
87           type="warning"
88           plain
89           icon="el-icon-download"
90           size="mini"
91           @click="handleExport"
92           v-hasPermi="['da:materialCollection:export']"
93         >导出</el-button>
94       </el-col>
95     </el-row>
96
97     <el-table border v-loading="loading" :data="materialCollectionList" @selection-change="handleSelectionChange">
98       <el-table-column show-overflow-tooltip="true" type="selection" width="55" align="center" />
e973ff 99 <!--      <el-table-column label="主键id" align="center" prop="id" />-->
9d822f 100       <el-table-column label="总成序列号" align="center" prop="sfcCode" />
A 101       <el-table-column label="工位编码" align="center" prop="locationCode" />
102       <el-table-column label="参数编码" align="center" prop="paramCode" />
103       <el-table-column label="参数名称" align="center" prop="paramName" />
104       <el-table-column label="参数值" align="center" prop="paramValue" />
105       <el-table-column label="采集时间" align="center" prop="collectTime" width="180">
106       </el-table-column>
107     </el-table>
108
109     <pagination
110       v-show="total>0"
111       :total="total"
112       :page.sync="queryParams.pageNum"
113       :limit.sync="queryParams.pageSize"
114       @pagination="getList"
115     />
116
117     <!-- 添加或修改物料采集对话框 -->
118     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
119       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
120         <el-form-item label="总成序列号" prop="sfcCode">
121           <el-input v-model="form.sfcCode" placeholder="请输入总成序列号" />
122         </el-form-item>
123         <el-form-item label="工位编码" prop="locationCode">
124           <el-input v-model="form.locationCode" placeholder="请输入工位编码" />
125         </el-form-item>
126         <el-form-item label="参数编码" prop="paramCode">
127           <el-input v-model="form.paramCode" placeholder="请输入参数编码" />
128         </el-form-item>
129         <el-form-item label="参数名称" prop="paramName">
130           <el-input v-model="form.paramName" placeholder="请输入参数名称" />
131         </el-form-item>
132         <el-form-item label="参数值" prop="paramValue">
133           <el-input v-model="form.paramValue" placeholder="请输入参数值" />
134         </el-form-item>
135       </el-form>
136       <div slot="footer" class="dialog-footer">
137         <el-button type="primary" @click="submitForm">确 定</el-button>
138         <el-button @click="cancel">取 消</el-button>
139       </div>
140     </el-dialog>
141   </div>
142 </template>
143
144 <script>
145 import { listMaterialCollection, getMaterialCollection, delMaterialCollection, addMaterialCollection, updateMaterialCollection } from "@/api/main/da/materialCollection";
146
147 export default {
148   name: "MaterialCollection",
149   data() {
150     return {
7933a5 151       // 日期范围
A 152       dateRange: [],
9d822f 153       // 遮罩层
A 154       loading: true,
155       // 选中数组
156       ids: [],
157       // 非单个禁用
158       single: true,
159       // 非多个禁用
160       multiple: true,
161       // 显示搜索条件
162       showSearch: true,
163       // 总条数
164       total: 0,
165       // 物料采集表格数据
166       materialCollectionList: [],
167       // 弹出层标题
168       title: "",
169       // 是否显示弹出层
170       open: false,
171       // 查询参数
172       queryParams: {
173         pageNum: 1,
174         pageSize: 10,
175         sfcCode: null,
176         locationCode: null,
177         paramCode: null,
178         paramName: null,
179       },
180       // 表单参数
181       form: {},
182       // 表单校验
183       rules: {
184       }
185     };
186   },
187   created() {
188     this.getList();
189   },
190   methods: {
191     /** 查询物料采集列表 */
192     getList() {
193       this.loading = true;
7933a5 194       listMaterialCollection(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
9d822f 195         this.materialCollectionList = response.rows;
A 196         this.total = response.total;
197         this.loading = false;
198       });
199     },
200     // 取消按钮
201     cancel() {
202       this.open = false;
203       this.reset();
204     },
205     // 表单重置
206     reset() {
207       this.form = {
208         id: null,
209         sfcCode: null,
210         locationCode: null,
211         paramCode: null,
212         paramName: null,
213         paramValue: null,
214         collectTime: null
215       };
216       this.resetForm("form");
217     },
218     /** 搜索按钮操作 */
219     handleQuery() {
7933a5 220       this.dateRange = [];
9d822f 221       this.queryParams.pageNum = 1;
A 222       this.getList();
223     },
224     /** 重置按钮操作 */
225     resetQuery() {
226       this.resetForm("queryForm");
227       this.handleQuery();
228     },
229     // 多选框选中数据
230     handleSelectionChange(selection) {
231       this.ids = selection.map(item => item.id)
232       this.single = selection.length!==1
233       this.multiple = !selection.length
234     },
235     /** 新增按钮操作 */
236     handleAdd() {
237       this.reset();
238       this.open = true;
239       this.title = "添加物料采集";
240     },
241     /** 修改按钮操作 */
242     handleUpdate(row) {
243       this.reset();
244       const id = row.id || this.ids
245       getMaterialCollection(id).then(response => {
246         this.form = response.data;
247         this.open = true;
248         this.title = "修改物料采集";
249       });
250     },
251     /** 提交按钮 */
252     submitForm() {
253       this.$refs["form"].validate(valid => {
254         if (valid) {
255           if (this.form.id != null) {
256             updateMaterialCollection(this.form).then(response => {
257               this.$modal.msgSuccess("修改成功");
258               this.open = false;
259               this.getList();
260             });
261           } else {
262             addMaterialCollection(this.form).then(response => {
263               this.$modal.msgSuccess("新增成功");
264               this.open = false;
265               this.getList();
266             });
267           }
268         }
269       });
270     },
271     /** 删除按钮操作 */
272     handleDelete(row) {
273       const ids = row.id || this.ids;
274       this.$modal.confirm('是否确认删除物料采集编号为"' + ids + '"的数据项?').then(function() {
275         return delMaterialCollection(ids);
276       }).then(() => {
277         this.getList();
278         this.$modal.msgSuccess("删除成功");
279       }).catch(() => {});
280     },
281     /** 导出按钮操作 */
282     handleExport() {
283       this.download('da/materialCollection/export', {
284         ...this.queryParams
285       }, `materialCollection_${new Date().getTime()}.xlsx`)
286     }
287   }
288 };
289 </script>