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