admin
2024-11-26 f6290cf3aa9794fea7edb882ca034063c5afb919
提交 | 用户 | 时间
e973ff 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="产线编号" prop="lineCode">
5         <el-input
6           v-model="queryParams.lineCode"
7           placeholder="请输入产线编号"
8           clearable
9           @keyup.enter.native="handleQuery"
10         />
11       </el-form-item>
12       <el-form-item label="产线名称" prop="lineName">
13         <el-input
14           v-model="queryParams.lineName"
15           placeholder="请输入产线名称"
16           clearable
17           @keyup.enter.native="handleQuery"
18         />
19       </el-form-item>
20       <el-form-item style="float: right">
21         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
22         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
23       </el-form-item>
24     </el-form>
25
26     <el-row :gutter="10" class="mb8">
27       <el-col :span="1.5">
28         <el-button
29           type="primary"
30           plain
31           icon="el-icon-plus"
32           size="mini"
33           @click="handleAdd"
34           v-hasPermi="['bs:lineInfo:add']"
35         >新增</el-button>
36       </el-col>
37       <el-col :span="1.5">
38         <el-button
39           type="success"
40           plain
41           icon="el-icon-edit"
42           size="mini"
43           :disabled="single"
44           @click="handleUpdate"
45           v-hasPermi="['bs:lineInfo:edit']"
46         >修改</el-button>
47       </el-col>
48       <el-col :span="1.5">
49         <el-button
50           type="danger"
51           plain
52           icon="el-icon-delete"
53           size="mini"
54           :disabled="multiple"
55           @click="handleDelete"
56           v-hasPermi="['bs:lineInfo:remove']"
57         >删除</el-button>
58       </el-col>
59       <el-col :span="1.5">
60         <el-button
61           type="warning"
62           plain
63           icon="el-icon-download"
64           size="mini"
65           @click="handleExport"
66           v-hasPermi="['bs:lineInfo:export']"
67         >导出</el-button>
68       </el-col>
69     </el-row>
70
71     <el-table border v-loading="loading" :data="lineInfoList" @selection-change="handleSelectionChange">
dc1b03 72       <el-table-column type="selection" width="55" align="center" />
f6290c 73       <el-table-column :show-overflow-tooltip="true" label="产线编号" align="center" prop="lineCode" />
A 74       <el-table-column :show-overflow-tooltip="true" label="产线名称" align="center" prop="lineName" />
75       <el-table-column :show-overflow-tooltip="true" label="备注" align="center" prop="remarks" />
76       <el-table-column :show-overflow-tooltip="true" label="创建用户" align="center" prop="createBy" />
6dbe12 77       <el-table-column label="创建时间" align="center" prop="createTime" width="180">
A 78       </el-table-column>
f6290c 79       <el-table-column :show-overflow-tooltip="true" label="更改用户" align="center" prop="updateBy" />
6dbe12 80       <el-table-column label="更改时间" align="center" prop="updateTime" width="180">
A 81       </el-table-column>
f6290c 82       <el-table-column :show-overflow-tooltip="true" label="状态" align="center" prop="status" />
e973ff 83     </el-table>
6dbe12 84
e973ff 85     <pagination
A 86       v-show="total>0"
87       :total="total"
88       :page.sync="queryParams.pageNum"
89       :limit.sync="queryParams.pageSize"
90       @pagination="getList"
91     />
92
93     <!-- 添加或修改产线信息对话框 -->
94     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
95       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
96         <el-form-item label="产线编号" prop="lineCode">
97           <el-input v-model="form.lineCode" placeholder="请输入产线编号" />
98         </el-form-item>
99         <el-form-item label="产线名称" prop="lineName">
100           <el-input v-model="form.lineName" placeholder="请输入产线名称" />
101         </el-form-item>
102         <el-form-item label="备注" prop="remarks">
103           <el-input v-model="form.remarks" placeholder="请输入备注" />
104         </el-form-item>
105       </el-form>
106       <div slot="footer" class="dialog-footer">
107         <el-button type="primary" @click="submitForm">确 定</el-button>
108         <el-button @click="cancel">取 消</el-button>
109       </div>
110     </el-dialog>
111   </div>
112 </template>
113
114 <script>
115 import { listLineInfo, getLineInfo, delLineInfo, addLineInfo, updateLineInfo } from "@/api/main/bs/lineInfo";
116
117 export default {
118   name: "LineInfo",
119   data() {
120     return {
121       // 遮罩层
122       loading: true,
123       // 选中数组
124       ids: [],
125       // 非单个禁用
126       single: true,
127       // 非多个禁用
128       multiple: true,
129       // 显示搜索条件
130       showSearch: true,
131       // 总条数
132       total: 0,
133       // 产线信息表格数据
134       lineInfoList: [],
135       // 弹出层标题
136       title: "",
137       // 是否显示弹出层
138       open: false,
139       // 查询参数
140       queryParams: {
141         pageNum: 1,
142         pageSize: 10,
143         lineCode: null,
144         lineName: null,
145         status: null,
146       },
147       // 表单参数
148       form: {},
149       // 表单校验
150       rules: {
151         lineCode: [
152           { required: true, message: "产线编号不能为空", trigger: "blur" }
153         ],
154       }
155     };
156   },
157   created() {
158     this.getList();
159   },
160   methods: {
161     /** 查询产线信息列表 */
162     getList() {
163       this.loading = true;
164       listLineInfo(this.queryParams).then(response => {
165         this.lineInfoList = response.rows;
166         this.total = response.total;
167         this.loading = false;
168       });
169     },
170     // 取消按钮
171     cancel() {
172       this.open = false;
173       this.reset();
174     },
175     // 表单重置
176     reset() {
177       this.form = {
178         id: null,
179         lineCode: null,
180         lineName: null,
181         remarks: null,
182         createBy: null,
183         createTime: null,
184         updateBy: null,
185         updateTime: null,
186         status: null,
187         delFlag: null
188       };
189       this.resetForm("form");
190     },
191     /** 搜索按钮操作 */
192     handleQuery() {
193       this.queryParams.pageNum = 1;
194       this.getList();
195     },
196     /** 重置按钮操作 */
197     resetQuery() {
198       this.resetForm("queryForm");
199       this.handleQuery();
200     },
201     // 多选框选中数据
202     handleSelectionChange(selection) {
203       this.ids = selection.map(item => item.id)
204       this.single = selection.length!==1
205       this.multiple = !selection.length
206     },
207     /** 新增按钮操作 */
208     handleAdd() {
209       this.reset();
210       this.open = true;
211       this.title = "添加产线信息";
212     },
213     /** 修改按钮操作 */
214     handleUpdate(row) {
215       this.reset();
216       const id = row.id || this.ids
217       getLineInfo(id).then(response => {
218         this.form = response.data;
219         this.open = true;
220         this.title = "修改产线信息";
221       });
222     },
223     /** 提交按钮 */
224     submitForm() {
225       this.$refs["form"].validate(valid => {
226         if (valid) {
227           if (this.form.id != null) {
228             updateLineInfo(this.form).then(response => {
229               this.$modal.msgSuccess("修改成功");
230               this.open = false;
231               this.getList();
232             });
233           } else {
234             addLineInfo(this.form).then(response => {
235               this.$modal.msgSuccess("新增成功");
236               this.open = false;
237               this.getList();
238             });
239           }
240         }
241       });
242     },
243     /** 删除按钮操作 */
244     handleDelete(row) {
245       const ids = row.id || this.ids;
246       this.$modal.confirm('是否确认删除').then(function() {
247         return delLineInfo(ids);
248       }).then(() => {
249         this.getList();
250         this.$modal.msgSuccess("删除成功");
251       }).catch(() => {});
252     },
253     /** 导出按钮操作 */
254     handleExport() {
255       this.download('bs/lineInfo/export', {
256         ...this.queryParams
257       }, `lineInfo_${new Date().getTime()}.xlsx`)
258     }
259   }
260 };
261 </script>