hdy
昨天 1c50cb5546715fa21496fbdf2bdacb7ae8836b8a
提交 | 用户 | 时间
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" />
e973ff 76     </el-table>
6dbe12 77
e973ff 78     <pagination
A 79       v-show="total>0"
80       :total="total"
81       :page.sync="queryParams.pageNum"
82       :limit.sync="queryParams.pageSize"
83       @pagination="getList"
84     />
85
86     <!-- 添加或修改产线信息对话框 -->
87     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
88       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
89         <el-form-item label="产线编号" prop="lineCode">
90           <el-input v-model="form.lineCode" placeholder="请输入产线编号" />
91         </el-form-item>
92         <el-form-item label="产线名称" prop="lineName">
93           <el-input v-model="form.lineName" placeholder="请输入产线名称" />
94         </el-form-item>
95         <el-form-item label="备注" prop="remarks">
96           <el-input v-model="form.remarks" placeholder="请输入备注" />
97         </el-form-item>
98       </el-form>
99       <div slot="footer" class="dialog-footer">
100         <el-button type="primary" @click="submitForm">确 定</el-button>
101         <el-button @click="cancel">取 消</el-button>
102       </div>
103     </el-dialog>
104   </div>
105 </template>
106
107 <script>
108 import { listLineInfo, getLineInfo, delLineInfo, addLineInfo, updateLineInfo } from "@/api/main/bs/lineInfo";
109
110 export default {
111   name: "LineInfo",
112   data() {
113     return {
114       // 遮罩层
115       loading: true,
116       // 选中数组
117       ids: [],
118       // 非单个禁用
119       single: true,
120       // 非多个禁用
121       multiple: true,
122       // 显示搜索条件
123       showSearch: true,
124       // 总条数
125       total: 0,
126       // 产线信息表格数据
127       lineInfoList: [],
128       // 弹出层标题
129       title: "",
130       // 是否显示弹出层
131       open: false,
132       // 查询参数
133       queryParams: {
134         pageNum: 1,
135         pageSize: 10,
136         lineCode: null,
137         lineName: null,
138         status: null,
139       },
140       // 表单参数
141       form: {},
142       // 表单校验
143       rules: {
144         lineCode: [
145           { required: true, message: "产线编号不能为空", trigger: "blur" }
146         ],
147       }
148     };
149   },
150   created() {
151     this.getList();
152   },
153   methods: {
154     /** 查询产线信息列表 */
155     getList() {
156       this.loading = true;
157       listLineInfo(this.queryParams).then(response => {
158         this.lineInfoList = response.rows;
159         this.total = response.total;
160         this.loading = false;
161       });
162     },
163     // 取消按钮
164     cancel() {
165       this.open = false;
166       this.reset();
167     },
168     // 表单重置
169     reset() {
170       this.form = {
171         id: null,
172         lineCode: null,
173         lineName: null,
174         remarks: null,
175         createBy: null,
176         createTime: null,
177         updateBy: null,
178         updateTime: null,
179         status: null,
180         delFlag: null
181       };
182       this.resetForm("form");
183     },
184     /** 搜索按钮操作 */
185     handleQuery() {
186       this.queryParams.pageNum = 1;
187       this.getList();
188     },
189     /** 重置按钮操作 */
190     resetQuery() {
191       this.resetForm("queryForm");
192       this.handleQuery();
193     },
194     // 多选框选中数据
195     handleSelectionChange(selection) {
196       this.ids = selection.map(item => item.id)
197       this.single = selection.length!==1
198       this.multiple = !selection.length
199     },
200     /** 新增按钮操作 */
201     handleAdd() {
202       this.reset();
203       this.open = true;
204       this.title = "添加产线信息";
205     },
206     /** 修改按钮操作 */
207     handleUpdate(row) {
208       this.reset();
209       const id = row.id || this.ids
210       getLineInfo(id).then(response => {
211         this.form = response.data;
212         this.open = true;
213         this.title = "修改产线信息";
214       });
215     },
216     /** 提交按钮 */
217     submitForm() {
218       this.$refs["form"].validate(valid => {
219         if (valid) {
220           if (this.form.id != null) {
221             updateLineInfo(this.form).then(response => {
222               this.$modal.msgSuccess("修改成功");
223               this.open = false;
224               this.getList();
225             });
226           } else {
227             addLineInfo(this.form).then(response => {
228               this.$modal.msgSuccess("新增成功");
229               this.open = false;
230               this.getList();
231             });
232           }
233         }
234       });
235     },
236     /** 删除按钮操作 */
237     handleDelete(row) {
238       const ids = row.id || this.ids;
239       this.$modal.confirm('是否确认删除').then(function() {
240         return delLineInfo(ids);
241       }).then(() => {
242         this.getList();
243         this.$modal.msgSuccess("删除成功");
244       }).catch(() => {});
245     },
246     /** 导出按钮操作 */
247     handleExport() {
248       this.download('bs/lineInfo/export', {
249         ...this.queryParams
250       }, `lineInfo_${new Date().getTime()}.xlsx`)
251     }
252   }
253 };
254 </script>