wyg
2024-06-18 1308d4d7a162d3cabd0fe4f639b6d7f5dd376584
提交 | 用户 | 时间
1308d4 1 <template>
W 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="库位组编号" prop="locationGroupNo">
5         <el-input
6           v-model="queryParams.locationGroupNo"
7           placeholder="请输入库位组编号"
8           clearable
9           @keyup.enter.native="handleQuery"
10         />
11       </el-form-item>
12       <el-form-item label="库位组名称" prop="locationGroupName">
13         <el-input
14           v-model="queryParams.locationGroupName"
15           placeholder="请输入库位组名称"
16           clearable
17           @keyup.enter.native="handleQuery"
18         />
19       </el-form-item>
20       <el-form-item label="仓库编号" prop="lgort">
21         <el-input
22           v-model="queryParams.lgort"
23           placeholder="请输入仓库编号"
24           clearable
25           @keyup.enter.native="handleQuery"
26         />
27       </el-form-item>
28       <el-form-item>
29         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
30         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
31       </el-form-item>
32     </el-form>
33
34     <el-row :gutter="10" class="mb8">
35       <el-col :span="1.5">
36         <el-button
37           type="primary"
38           plain
39           icon="el-icon-plus"
40           size="mini"
41           @click="handleAdd"
42           v-hasPermi="['system:locationGroup:add']"
43         >新增</el-button>
44       </el-col>
45       <el-col :span="1.5">
46         <el-button
47           type="success"
48           plain
49           icon="el-icon-edit"
50           size="mini"
51           :disabled="single"
52           @click="handleUpdate"
53           v-hasPermi="['system:locationGroup:edit']"
54         >修改</el-button>
55       </el-col>
56       <el-col :span="1.5">
57         <el-button
58           type="danger"
59           plain
60           icon="el-icon-delete"
61           size="mini"
62           :disabled="multiple"
63           @click="handleDelete"
64           v-hasPermi="['system:locationGroup:remove']"
65         >删除</el-button>
66       </el-col>
67       <el-col :span="1.5">
68         <el-button
69           type="warning"
70           plain
71           icon="el-icon-download"
72           size="mini"
73           @click="handleExport"
74           v-hasPermi="['system:locationGroup:export']"
75         >导出</el-button>
76       </el-col>
77       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
78     </el-row>
79
80     <el-table v-loading="loading" border :data="locationGroupList" @selection-change="handleSelectionChange">
81       <el-table-column type="selection" width="55" align="center" />
82         <el-table-column
83        label="序号"
84       type="index"
85       fixed
86       width="50" />
87       <!-- <el-table-column label="库位组ID" align="center" prop="locationGroupId" v-if="true"/> -->
88       <el-table-column label="库位组编号" align="center" prop="locationGroupNo" />
89       <el-table-column label="工厂" align="center" prop="werks" />
90       <el-table-column label="库位组名称" align="center" prop="locationGroupName" />
91       <el-table-column label="仓库编号" align="center" prop="lgort" />
92       <el-table-column label="描述" align="center" prop="description" />
93       <!-- <el-table-column label="状态" align="center" prop="state" /> -->
94       <el-table-column label="审核状态" align="center" prop="auditState" />
95       <el-table-column label="审核人ID" align="center" prop="auditUserId" />
96       <el-table-column label="审核人姓名" align="center" prop="auditUserName" />
97       <el-table-column label="审核日期时间" align="center" prop="auditDateTime" width="180">
98         <template slot-scope="scope">
99           <span>{{ parseTime(scope.row.auditDateTime, '{y}-{m}-{d}') }}</span>
100         </template>
101       </el-table-column>
102       <el-table-column label="审核意见" align="center" prop="auditOpinion" />
103       <el-table-column label="最后更新人id" align="center" prop="lastUpdatedUserId" />
104       <el-table-column label="最后更新人姓名" align="center" prop="lastUpdatedUserName" />
105       <el-table-column label="最后更新时间" align="center" prop="lastUpdatedDateTime" width="180">
106         <template slot-scope="scope">
107           <span>{{ parseTime(scope.row.lastUpdatedDateTime, '{y}-{m}-{d}') }}</span>
108         </template>
109       </el-table-column>
110       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
111         <template slot-scope="scope">
112           <el-button
113             size="mini"
114             type="text"
115             icon="el-icon-edit"
116             @click="handleUpdate(scope.row)"
117             v-hasPermi="['system:locationGroup:edit']"
118           >修改</el-button>
119           <el-button
120             size="mini"
121             type="text"
122             icon="el-icon-delete"
123             @click="handleDelete(scope.row)"
124             v-hasPermi="['system:locationGroup:remove']"
125           >删除</el-button>
126         </template>
127       </el-table-column>
128     </el-table>
129
130     <pagination
131       v-show="total>0"
132       :total="total"
133       :page.sync="queryParams.pageNum"
134       :limit.sync="queryParams.pageSize"
135       @pagination="getList"
136     />
137
138     <!-- 添加或修改库位组对话框 -->
139     <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
140       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
141         <el-form-item label="库位组编号" prop="locationGroupNo">
142           <el-input v-model="form.locationGroupNo" placeholder="请输入库位组编号" />
143         </el-form-item>
144         <el-form-item label="工厂" prop="werks">
145           <!-- <el-input v-model="form.werks" placeholder="请输入工厂" /> -->
146         </el-form-item>
147         <el-form-item label="库位组名称" prop="locationGroupName">
148           <el-input v-model="form.locationGroupName" placeholder="请输入库位组名称" />
149         </el-form-item>
150         <el-form-item label="仓库编号" prop="lgort">
151           <el-input v-model="form.lgort" placeholder="请输入仓库编号" />
152         </el-form-item>
153         <el-form-item label="描述" prop="description">
154           <el-input v-model="form.description" placeholder="请输入描述" />
155         </el-form-item>
156         <el-form-item label="状态" prop="state">
157           <el-input v-model="form.state" placeholder="请输入状态" />
158         </el-form-item>
159         <!-- <el-form-item label="最后更新人id" prop="lastUpdatedUserId">
160           <el-input v-model="form.lastUpdatedUserId" placeholder="请输入最后更新人id" />
161         </el-form-item>
162         <el-form-item label="最后更新人姓名" prop="lastUpdatedUserName">
163           <el-input v-model="form.lastUpdatedUserName" placeholder="请输入最后更新人姓名" />
164         </el-form-item>
165         <el-form-item label="最后更新时间" prop="lastUpdatedDateTime">
166           <el-date-picker clearable
167             v-model="form.lastUpdatedDateTime"
168             type="datetime"
169             value-format="yyyy-MM-dd HH:mm:ss"
170             placeholder="请选择最后更新时间">
171           </el-date-picker>
172         </el-form-item> -->
173       </el-form>
174       <div slot="footer" class="dialog-footer">
175         <el-button :loading="buttonLoading" 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 { listLocationGroup, getLocationGroup, delLocationGroup, addLocationGroup, updateLocationGroup } from "@/api/basicData/locationGroup";
184
185 export default {
186   name: "LocationGroup",
187   data() {
188     return {
189       // 按钮loading
190       buttonLoading: false,
191       // 遮罩层
192       loading: true,
193       // 选中数组
194       ids: [],
195       // 非单个禁用
196       single: true,
197       // 非多个禁用
198       multiple: true,
199       // 显示搜索条件
200       showSearch: true,
201       // 总条数
202       total: 0,
203       // 库位组表格数据
204       locationGroupList: [],
205       // 弹出层标题
206       title: "",
207       // 是否显示弹出层
208       open: false,
209       // 查询参数
210       queryParams: {
211         pageNum: 1,
212         pageSize: 10,
213         locationGroupNo: undefined,
214         locationGroupName: undefined,
215         lgort: undefined,
216       },
217       // 表单参数
218       form: {},
219       // 表单校验
220       rules: {
221         locationGroupId: [
222           { required: true, message: "库位组ID不能为空", trigger: "blur" }
223         ],
224         locationGroupNo: [
225           { required: true, message: "库位组编号不能为空", trigger: "blur" }
226         ],
227         werks: [
228           { required: true, message: "工厂不能为空", trigger: "blur" }
229         ],
230         locationGroupName: [
231           { required: true, message: "库位组名称不能为空", trigger: "blur" }
232         ],
233         lgort: [
234           { required: true, message: "仓库编号不能为空", trigger: "blur" }
235         ],
236         description: [
237           { required: true, message: "描述不能为空", trigger: "blur" }
238         ],
239         state: [
240           { required: true, message: "状态不能为空", trigger: "blur" }
241         ],
242         displayOrder: [
243           { required: true, message: "排序不能为空", trigger: "blur" }
244         ],
245         createdUserId: [
246           { required: true, message: "创建人id不能为空", trigger: "blur" }
247         ],
248         createdUserName: [
249           { required: true, message: "创建人姓名不能为空", trigger: "blur" }
250         ],
251         createdDateTime: [
252           { required: true, message: "创建日期时间不能为空", trigger: "blur" }
253         ],
254         auditState: [
255           { required: true, message: "审核状态不能为空", trigger: "blur" }
256         ],
257         auditUserId: [
258           { required: true, message: "审核人ID不能为空", trigger: "blur" }
259         ],
260         auditUserName: [
261           { required: true, message: "审核人姓名不能为空", trigger: "blur" }
262         ],
263         auditDateTime: [
264           { required: true, message: "审核日期时间不能为空", trigger: "blur" }
265         ],
266         auditOpinion: [
267           { required: true, message: "审核意见不能为空", trigger: "blur" }
268         ],
269         lastUpdatedUserId: [
270           { required: true, message: "最后更新人id不能为空", trigger: "blur" }
271         ],
272         lastUpdatedUserName: [
273           { required: true, message: "最后更新人姓名不能为空", trigger: "blur" }
274         ],
275         lastUpdatedDateTime: [
276           { required: true, message: "最后更新时间不能为空", trigger: "blur" }
277         ],
278         isDeleted: [
279           { required: true, message: "是否删除不能为空", trigger: "blur" }
280         ]
281       }
282     };
283   },
284   created() {
285     this.getList();
286   },
287   methods: {
288     /** 查询库位组列表 */
289     getList() {
290       this.loading = true;
291       listLocationGroup(this.queryParams).then(response => {
292         this.locationGroupList = response.rows;
293         this.total = response.total;
294         this.loading = false;
295       });
296     },
297     // 取消按钮
298     cancel() {
299       this.open = false;
300       this.reset();
301     },
302     // 表单重置
303     reset() {
304       this.form = {
305         locationGroupId: undefined,
306         locationGroupNo: undefined,
307         werks: undefined,
308         locationGroupName: undefined,
309         lgort: undefined,
310         description: undefined,
311         state: undefined,
312         displayOrder: undefined,
313         createdUserId: undefined,
314         createdUserName: undefined,
315         createdDateTime: undefined,
316         auditState: undefined,
317         auditUserId: undefined,
318         auditUserName: undefined,
319         auditDateTime: undefined,
320         auditOpinion: undefined,
321         lastUpdatedUserId: undefined,
322         lastUpdatedUserName: undefined,
323         lastUpdatedDateTime: undefined,
324         isDeleted: undefined
325       };
326       this.resetForm("form");
327     },
328     /** 搜索按钮操作 */
329     handleQuery() {
330       this.queryParams.pageNum = 1;
331       this.getList();
332     },
333     /** 重置按钮操作 */
334     resetQuery() {
335       this.resetForm("queryForm");
336       this.handleQuery();
337     },
338     // 多选框选中数据
339     handleSelectionChange(selection) {
340       this.ids = selection.map(item => item.locationGroupId)
341       this.single = selection.length!==1
342       this.multiple = !selection.length
343     },
344     /** 新增按钮操作 */
345     handleAdd() {
346       this.reset();
347       this.open = true;
348       this.title = "添加库位组";
349     },
350     /** 修改按钮操作 */
351     handleUpdate(row) {
352       this.loading = true;
353       this.reset();
354       const locationGroupId = row.locationGroupId || this.ids
355       getLocationGroup(locationGroupId).then(response => {
356         this.loading = false;
357         this.form = response.data;
358         this.open = true;
359         this.title = "修改库位组";
360       });
361     },
362     /** 提交按钮 */
363     submitForm() {
364       this.$refs["form"].validate(valid => {
365         if (valid) {
366           this.buttonLoading = true;
367           if (this.form.locationGroupId != null) {
368             updateLocationGroup(this.form).then(response => {
369               this.$modal.msgSuccess("修改成功");
370               this.open = false;
371               this.getList();
372             }).finally(() => {
373               this.buttonLoading = false;
374             });
375           } else {
376             addLocationGroup(this.form).then(response => {
377               this.$modal.msgSuccess("新增成功");
378               this.open = false;
379               this.getList();
380             }).finally(() => {
381               this.buttonLoading = false;
382             });
383           }
384         }
385       });
386     },
387     /** 删除按钮操作 */
388     handleDelete(row) {
389       const locationGroupIds = row.locationGroupId || this.ids;
390       this.$modal.confirm('是否确认删除库位组编号为"' + locationGroupIds + '"的数据项?').then(() => {
391         this.loading = true;
392         return delLocationGroup(locationGroupIds);
393       }).then(() => {
394         this.loading = false;
395         this.getList();
396         this.$modal.msgSuccess("删除成功");
397       }).catch(() => {
398       }).finally(() => {
399         this.loading = false;
400       });
401     },
402     /** 导出按钮操作 */
403     handleExport() {
404       this.download('system/locationGroup/export', {
405         ...this.queryParams
406       }, `locationGroup_${new Date().getTime()}.xlsx`)
407     }
408   }
409 };
410 </script>