提交 | 用户 | 时间
|
f47bd7
|
1 |
<template> |
H |
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="100px" label="BOM编码" prop="bomCode"> |
|
5 |
<el-input |
|
6 |
v-model="queryParams.bomCode" |
|
7 |
placeholder="请输入BOM编码" |
|
8 |
clearable |
|
9 |
@keyup.enter.native="handleQuery" |
|
10 |
/> |
|
11 |
</el-form-item> |
|
12 |
<el-form-item label-width="100px" label="BOM名称" prop="bomName"> |
|
13 |
<el-input |
|
14 |
v-model="queryParams.bomName" |
|
15 |
placeholder="请输入BOM名称" |
|
16 |
clearable |
|
17 |
@keyup.enter.native="handleQuery" |
|
18 |
/> |
|
19 |
</el-form-item> |
|
20 |
<el-form-item label="产品编码" prop="productCode"> |
|
21 |
<el-input |
|
22 |
v-model="queryParams.productCode" |
|
23 |
placeholder="请输入产品编码" |
|
24 |
clearable |
|
25 |
@keyup.enter.native="handleQuery" |
|
26 |
/> |
|
27 |
</el-form-item> |
|
28 |
<el-form-item label="产品名称" prop="productName"> |
|
29 |
<el-input |
|
30 |
v-model="queryParams.productName" |
|
31 |
placeholder="请输入产品名称" |
|
32 |
clearable |
|
33 |
@keyup.enter.native="handleQuery" |
|
34 |
/> |
|
35 |
</el-form-item> |
|
36 |
<el-form-item style="float: right"> |
|
37 |
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> |
|
38 |
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> |
|
39 |
</el-form-item> |
|
40 |
</el-form> |
|
41 |
|
|
42 |
<el-row :gutter="10" class="mb8"> |
|
43 |
<el-col :span="1.5"> |
|
44 |
<el-button |
|
45 |
type="primary" |
|
46 |
plain |
|
47 |
icon="el-icon-plus" |
|
48 |
size="mini" |
|
49 |
@click="handleAdd" |
|
50 |
v-hasPermi="['bs:bomInfo:add']" |
|
51 |
>新增</el-button> |
|
52 |
</el-col> |
|
53 |
<el-col :span="1.5"> |
|
54 |
<el-button |
|
55 |
type="success" |
|
56 |
plain |
|
57 |
icon="el-icon-edit" |
|
58 |
size="mini" |
|
59 |
:disabled="single" |
|
60 |
@click="handleUpdate" |
|
61 |
v-hasPermi="['bs:bomInfo:edit']" |
|
62 |
>修改</el-button> |
|
63 |
</el-col> |
|
64 |
<el-col :span="1.5"> |
|
65 |
<el-button |
|
66 |
type="danger" |
|
67 |
plain |
|
68 |
icon="el-icon-delete" |
|
69 |
size="mini" |
|
70 |
:disabled="multiple" |
|
71 |
@click="handleDelete" |
|
72 |
v-hasPermi="['bs:bomInfo:remove']" |
|
73 |
>删除</el-button> |
|
74 |
</el-col> |
|
75 |
<el-col :span="1.5"> |
|
76 |
<el-button |
7737ed
|
77 |
plain |
H |
78 |
icon="el-icon-setting" |
|
79 |
size="mini" |
|
80 |
:disabled="multiple" |
|
81 |
@click="statusChange" |
|
82 |
v-hasPermi="['bs:bomInfo:remove']" |
|
83 |
>状态变更</el-button> |
|
84 |
</el-col> |
|
85 |
<el-col :span="1.5"> |
|
86 |
<el-button |
f47bd7
|
87 |
type="warning" |
H |
88 |
plain |
|
89 |
icon="el-icon-download" |
|
90 |
size="mini" |
|
91 |
@click="handleExport" |
|
92 |
v-hasPermi="['bs:bomInfo:export']" |
|
93 |
>导出</el-button> |
|
94 |
</el-col> |
|
95 |
</el-row> |
|
96 |
|
|
97 |
<el-table border v-loading="loading" :data="bomInfoList" @selection-change="handleSelectionChange" v-if="bomInfoList.length > 0"> |
|
98 |
<el-table-column type="selection" width="55" align="center" /> |
|
99 |
<el-table-column label="BOM编码" align="center" prop="bomCode" > |
|
100 |
<template slot-scope="scope"> |
|
101 |
<router-link :to="{path: '/main/bom-data/index/', query: {bomCode: scope.row.bomCode} }" class="link-type"> |
|
102 |
<span>{{ scope.row.bomCode }}</span> |
|
103 |
</router-link> |
|
104 |
</template> |
|
105 |
</el-table-column> |
|
106 |
<el-table-column show-overflow-tooltip="true" label="BOM名称" align="center" prop="bomName" /> |
|
107 |
<el-table-column show-overflow-tooltip="true" label="产品编码" align="center" prop="productCode"/> |
|
108 |
<el-table-column show-overflow-tooltip="true" label="产品名称" align="center" prop="productName" /> |
|
109 |
<el-table-column show-overflow-tooltip="true" label="版本" align="center" prop="version" /> |
3d0e64
|
110 |
<el-table-column label="状态" align="center" prop="status"> |
H |
111 |
<template slot-scope="scope"> |
|
112 |
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> |
|
113 |
</template> |
|
114 |
</el-table-column> |
f47bd7
|
115 |
<el-table-column show-overflow-tooltip="true" label="备注" align="center" prop="remark" /> |
H |
116 |
</el-table> |
|
117 |
|
|
118 |
<pagination |
|
119 |
v-show="total>0" |
|
120 |
:total="total" |
|
121 |
:page.sync="queryParams.pageNum" |
|
122 |
:limit.sync="queryParams.pageSize" |
|
123 |
@pagination="getList" |
|
124 |
/> |
|
125 |
|
|
126 |
<!-- 添加或修改基础BOM对话框 --> |
|
127 |
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
|
128 |
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
|
129 |
<el-form-item label="BOM编码" prop="bomCode"> |
|
130 |
<el-input v-model="form.bomCode" placeholder="请输入BOM编码" /> |
|
131 |
</el-form-item> |
|
132 |
<el-form-item label="BOM名称" prop="bomName"> |
|
133 |
<el-input v-model="form.bomName" placeholder="请输入BOM名称" /> |
|
134 |
</el-form-item> |
|
135 |
<el-form-item label="产品编码" prop="productCode"> |
|
136 |
<el-input v-model="form.productCode" placeholder="请输入产品编码" /> |
|
137 |
</el-form-item> |
|
138 |
<el-form-item label="产品名称" prop="productName"> |
|
139 |
<el-input v-model="form.productName" placeholder="请输入产品名称" /> |
|
140 |
</el-form-item> |
7737ed
|
141 |
<el-form-item label="状态" prop="status"> |
3d0e64
|
142 |
<el-radio-group v-model="form.status"> |
H |
143 |
<el-radio |
|
144 |
v-for="dict in dict.type.sys_normal_disable" |
|
145 |
:key="dict.value" |
|
146 |
:label="dict.value" |
|
147 |
>{{dict.label}}</el-radio> |
|
148 |
</el-radio-group> |
|
149 |
</el-form-item> |
f47bd7
|
150 |
<el-form-item label="备注" prop="remark"> |
H |
151 |
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> |
|
152 |
</el-form-item> |
|
153 |
</el-form> |
|
154 |
<div slot="footer" class="dialog-footer"> |
|
155 |
<el-button type="primary" @click="submitForm">确 定</el-button> |
|
156 |
<el-button @click="cancel">取 消</el-button> |
|
157 |
</div> |
|
158 |
</el-dialog> |
|
159 |
</div> |
|
160 |
</template> |
|
161 |
|
|
162 |
<script> |
7737ed
|
163 |
import { listBomInfo, getBomInfo, delBomInfo, addBomInfo, updateBomInfo,statusChange } from "@/api/main/bs/bomInfo"; |
f47bd7
|
164 |
|
H |
165 |
export default { |
|
166 |
name: "BomInfo", |
3d0e64
|
167 |
dicts: ['sys_normal_disable'], |
f47bd7
|
168 |
data() { |
H |
169 |
return { |
|
170 |
// 遮罩层 |
|
171 |
loading: true, |
|
172 |
// 选中数组 |
|
173 |
ids: [], |
|
174 |
// 非单个禁用 |
|
175 |
single: true, |
|
176 |
// 非多个禁用 |
|
177 |
multiple: true, |
|
178 |
// 显示搜索条件 |
|
179 |
showSearch: true, |
|
180 |
// 总条数 |
|
181 |
total: 0, |
|
182 |
// 基础BOM表格数据 |
|
183 |
bomInfoList: [], |
|
184 |
// 弹出层标题 |
|
185 |
title: "", |
|
186 |
// 是否显示弹出层 |
|
187 |
open: false, |
|
188 |
// 查询参数 |
|
189 |
queryParams: { |
|
190 |
pageNum: 1, |
|
191 |
pageSize: 10, |
|
192 |
bomCode: null, |
|
193 |
bomName: null, |
|
194 |
productCode: null, |
|
195 |
productName: null, |
|
196 |
version: null, |
|
197 |
status: null, |
|
198 |
createUser: null, |
|
199 |
updateUser: null, |
|
200 |
dataSource: null, |
7737ed
|
201 |
|
f47bd7
|
202 |
}, |
H |
203 |
// 表单参数 |
|
204 |
form: {}, |
|
205 |
// 表单校验 |
|
206 |
rules: { |
|
207 |
id: [ |
|
208 |
{ required: true, message: "主键id不能为空", trigger: "blur" } |
|
209 |
], |
|
210 |
} |
|
211 |
}; |
|
212 |
}, |
|
213 |
created() { |
|
214 |
this.getList(); |
|
215 |
}, |
|
216 |
methods: { |
|
217 |
/** 查询基础BOM列表 */ |
|
218 |
getList() { |
|
219 |
this.loading = true; |
|
220 |
listBomInfo(this.queryParams).then(response => { |
|
221 |
this.bomInfoList = response.rows; |
|
222 |
this.total = response.total; |
|
223 |
this.loading = false; |
|
224 |
|
|
225 |
}); |
|
226 |
}, |
|
227 |
// 取消按钮 |
|
228 |
cancel() { |
|
229 |
this.open = false; |
|
230 |
this.reset(); |
|
231 |
}, |
|
232 |
// 表单重置 |
|
233 |
reset() { |
|
234 |
this.form = { |
|
235 |
id: null, |
|
236 |
bomCode: null, |
|
237 |
bomName: null, |
|
238 |
productCode: null, |
|
239 |
productName: null, |
|
240 |
version: null, |
|
241 |
status: null, |
|
242 |
remark: null, |
|
243 |
createUser: null, |
|
244 |
createTime: null, |
|
245 |
updateUser: null, |
|
246 |
updateTime: null, |
|
247 |
dataSource: null, |
|
248 |
delFlag: null |
|
249 |
}; |
|
250 |
this.resetForm("form"); |
|
251 |
}, |
|
252 |
/** 搜索按钮操作 */ |
|
253 |
handleQuery() { |
|
254 |
this.queryParams.pageNum = 1; |
|
255 |
this.getList(); |
|
256 |
}, |
|
257 |
/** 重置按钮操作 */ |
|
258 |
resetQuery() { |
|
259 |
this.resetForm("queryForm"); |
|
260 |
this.handleQuery(); |
|
261 |
}, |
|
262 |
// 多选框选中数据 |
|
263 |
handleSelectionChange(selection) { |
|
264 |
this.ids = selection.map(item => item.id) |
|
265 |
this.single = selection.length!==1 |
|
266 |
this.multiple = !selection.length |
|
267 |
}, |
|
268 |
/** 新增按钮操作 */ |
|
269 |
handleAdd() { |
|
270 |
this.reset(); |
|
271 |
this.open = true; |
|
272 |
this.title = "添加基础BOM"; |
|
273 |
}, |
|
274 |
/** 修改按钮操作 */ |
|
275 |
handleUpdate(row) { |
|
276 |
this.reset(); |
|
277 |
const id = row.id || this.ids |
|
278 |
getBomInfo(id).then(response => { |
|
279 |
this.form = response.data; |
|
280 |
this.open = true; |
|
281 |
this.title = "修改基础BOM"; |
|
282 |
}); |
7737ed
|
283 |
console.log(this.from.status) |
H |
284 |
}, |
|
285 |
/** 状态变更按钮操作 */ |
|
286 |
statusChange(row) { |
|
287 |
this.reset(); |
|
288 |
const id = row.id || this.ids |
|
289 |
getBomInfo(id).then(response => { |
|
290 |
this.form = response.data; |
|
291 |
}); |
|
292 |
console.log(this.from) |
|
293 |
this.$refs["form"].validate(valid => { |
|
294 |
if(valid){ |
|
295 |
if(this.from.status==='1'){ |
|
296 |
this.from.status='0'; |
|
297 |
updateBomInfo(this.form).then(response => { |
|
298 |
this.$modal.msgSuccess("停用成功"); |
|
299 |
this.getList(); |
|
300 |
}); |
|
301 |
}else{ |
|
302 |
this.from.status='1'; |
|
303 |
updateBomInfo(this.form).then(response => { |
|
304 |
this.$modal.msgSuccess("启用成功"); |
|
305 |
this.getList(); |
|
306 |
}); |
|
307 |
} |
|
308 |
} |
|
309 |
}); |
f47bd7
|
310 |
}, |
H |
311 |
/** 提交按钮 */ |
|
312 |
submitForm() { |
|
313 |
this.$refs["form"].validate(valid => { |
|
314 |
if (valid) { |
|
315 |
if (this.form.id != null) { |
|
316 |
updateBomInfo(this.form).then(response => { |
|
317 |
this.$modal.msgSuccess("修改成功"); |
|
318 |
this.open = false; |
|
319 |
this.getList(); |
|
320 |
}); |
|
321 |
} else { |
|
322 |
addBomInfo(this.form).then(response => { |
|
323 |
this.$modal.msgSuccess("新增成功"); |
|
324 |
this.open = false; |
|
325 |
this.getList(); |
|
326 |
}); |
|
327 |
} |
|
328 |
} |
|
329 |
}); |
|
330 |
}, |
|
331 |
/** 删除按钮操作 */ |
|
332 |
handleDelete(row) { |
|
333 |
const ids = row.id || this.ids; |
|
334 |
this.$modal.confirm('是否确认删除').then(function() { |
|
335 |
return delBomInfo(ids); |
|
336 |
}).then(() => { |
|
337 |
this.getList(); |
|
338 |
this.$modal.msgSuccess("删除成功"); |
|
339 |
}).catch(() => {}); |
|
340 |
}, |
|
341 |
/** 导出按钮操作 */ |
|
342 |
handleExport() { |
|
343 |
this.download('bs/bomInfo/export', { |
|
344 |
...this.queryParams |
|
345 |
}, `bomInfo_${new Date().getTime()}.xlsx`) |
|
346 |
} |
|
347 |
} |
|
348 |
}; |
|
349 |
</script> |