春风项目四线(合箱线、总装线)
wujian
5 天以前 ea3c33c8561df39d4f123d1424fda99dd0f0c51d
提交 | 用户 | 时间
fd2207 1 <template>
2   <div class="app-container">
3     <el-card class ="box-card">
4     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
5       <el-form-item label="物料编号" prop="materialCode">
6         <el-input
7           v-model="queryParams.materialCode"
8           placeholder="请输入物料编号"
9           clearable
10           @keyup.enter.native="handleQuery"
11         />
12       </el-form-item>
13       <el-form-item label="物料名称" prop="materialName">
14         <el-input
15           v-model="queryParams.materialName"
16           placeholder="请输入物料名称"
17           clearable
18           @keyup.enter.native="handleQuery"
19         />
20       </el-form-item>
21       <el-form-item label="状态" prop="status">
22         <el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
23           <el-option
24             v-for="dict in dict.type.sys_normal_disable"
25             :key="dict.value"
26             :label="dict.label"
27             :value="dict.value"
28           />
29         </el-select>
30       </el-form-item>
31       <el-form-item style="float: right">
32         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
33         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
34       </el-form-item>
35     </el-form>
36     </el-card>
37     <el-card style="margin-top: 10px" class="box-card">
38     <el-row :gutter="10" class="mb8">
39       <el-col :span="1.5">
40         <el-button
41           type="primary"
42           plain
43           icon="el-icon-plus"
44           size="mini"
45           @click="handleAdd"
46           v-hasPermi="['bs:material:add']"
47         >新增</el-button>
48       </el-col>
49       <el-col :span="1.5">
50         <el-button
51           type="success"
52           plain
53           icon="el-icon-edit"
54           size="mini"
55           :disabled="single"
56           @click="handleUpdate"
57           v-hasPermi="['bs:material:edit']"
58         >修改</el-button>
59       </el-col>
60       <el-col :span="1.5">
61         <el-button
62           type="danger"
63           plain
64           icon="el-icon-delete"
65           size="mini"
66           :disabled="multiple"
67           @click="handleDelete"
68           v-hasPermi="['bs:material:remove']"
69         >删除</el-button>
70       </el-col>
71       <el-col :span="1.5">
72         <el-button
73           type="warning"
74           plain
75           icon="el-icon-download"
76           size="mini"
77           @click="handleExport"
78           v-hasPermi="['bs:material:export']"
79         >导出</el-button>
80       </el-col>
81       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
82     </el-row>
83
84     <el-table v-loading="loading" border :data="materialList" @selection-change="handleSelectionChange" v-if="materialList.length > 0">
85       <el-table-column type="selection" width="55" align="center" />
86       <el-table-column label="物料编号"  align="center" prop="materialCode" width="180">
87       </el-table-column>
e2f155 88       <el-table-column label="物料名称" align="center" prop="materialName" width="220">
fd2207 89       </el-table-column>
e2f155 90 <!--      <el-table-column label="视图" align="center" prop="materialView" width="180">
C 91       </el-table-column>-->
92
8876c2 93 <!--      <el-table-column label="车型" align="center" prop="carType" width="120">-->
W 94 <!--      </el-table-column>-->
e2f155 95       <el-table-column label="物料类型" align="center" prop="typeL">
fd2207 96         <template slot-scope="scope">
97           <dict-tag :options="dict.type.material_type" :value="scope.row.typeL"/>
98         </template>
99       </el-table-column>
100
a5f938 101       <el-table-column label="机型" align="center" prop="typeZ" width="150">
fd2207 102       </el-table-column>
e2f155 103       <el-table-column label="特殊代码" align="center" prop="mark" width="120">
C 104       </el-table-column>
fd2207 105       <el-table-column label="单位" align="center" prop="unit" width="80">
106         <template slot-scope="scope">
107           <dict-tag :options="dict.type.unit" :value="scope.row.unit"/>
108         </template>
109       </el-table-column>
110 <!--      <el-table-column label="ERP规格" align="center" prop="erpSpec">-->
111 <!--      </el-table-column>-->
112
113       <el-table-column label="状态" align="center" prop="status" width="80">
114         <template slot-scope="scope">
115           <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
116         </template>
117       </el-table-column>
118
119 <!--      <el-table-column label="厂商" align="center" prop="supplier">
120       </el-table-column>-->
121       <el-table-column label="备注" align="center" prop="remarks" width="180">
122       </el-table-column>
123       <el-table-column label="创建人" align="center" prop="createUser" width="150">
124       </el-table-column>
125       <el-table-column label="创建时间" align="center" prop="createTime" width="170">
126       </el-table-column>
8876c2 127 <!--      <el-table-column label="更新人" align="center" prop="updateUser" width="150">-->
W 128 <!--      </el-table-column>-->
129 <!--      <el-table-column label="更新时间" align="center" prop="updateTime" width="170">-->
130 <!--      </el-table-column>-->
131 <!--      <el-table-column label="数据来源" align="center" prop="dataSource">-->
132 <!--      </el-table-column>-->
fd2207 133       <el-table-column fixed="right" label="操作" width="200" align="center" class-name="small-padding fixed-width">
134         <template slot-scope="scope">
135           <el-button
136             size="mini"
137             type="success"
138             plain
139             style="width: 72px"
140             icon="el-icon-edit"
141             @click="handleUpdate(scope.row)"
142             v-hasPermi="['bs:material:edit']"
143           >修改</el-button>
144           <el-button
145             size="mini"
146             plain
147             style="width: 72px"
148             type="danger"
149             icon="el-icon-delete"
150             @click="handleDelete(scope.row)"
151             v-hasPermi="['bs:material:remove']"
152           >删除</el-button>
153         </template>
154       </el-table-column>
155     </el-table>
156       <el-empty v-else>
157         <span slot="description">暂无数据</span>
158       </el-empty>
159     </el-card>
160     <pagination
161       v-show="total>0"
162       :total="total"
163       :page.sync="queryParams.pageNum"
164       :limit.sync="queryParams.pageSize"
165       @pagination="getList"
166     />
167
168     <!-- 添加或修改物料信息对话框 -->
169     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="700px" append-to-body>
170       <span slot="title">
171         <i class="el-icon-s-order"></i>
172         {{titleName}}
173       </span>
174       <el-form ref="form" inline :model="form" :rules="rules" label-width="80px">
175         <el-form-item label="物料编号" prop="materialCode">
176           <el-input v-model="form.materialCode" placeholder="请输入物料编号" />
177         </el-form-item>
33485d 178         <el-form-item label="特殊代码" prop="mark">
H 179           <el-input v-model="form.mark" placeholder="请输入特殊代码" />
b26334 180         </el-form-item>
H 181         <el-form-item label="车型" prop="carType">
182           <el-input v-model="form.carType" placeholder="请输入特殊代码" />
33485d 183         </el-form-item>
fd2207 184         <el-form-item label="物料名称" prop="materialName">
185           <el-input v-model="form.materialName" placeholder="请输入物料名称" />
186         </el-form-item>
8876c2 187 <!--        <el-form-item label="物料类型" prop="typeL">-->
W 188 <!--          &lt;!&ndash;          <el-input v-model="form.typeL" placeholder="请输入类型" />&ndash;&gt;-->
189 <!--          <el-select v-model="form.typeL"  placeholder="请选择单位" >-->
190 <!--            <el-option-->
191 <!--              v-for="dict in dict.type.material_type"-->
192 <!--              :key="dict.value"-->
193 <!--              :label="dict.label"-->
194 <!--              :value="dict.value"-->
195 <!--            />-->
196 <!--          </el-select>-->
197 <!--        </el-form-item>-->
fd2207 198         <el-form-item label="物料型号" prop="typeZ">
199           <el-input v-model="form.typeZ" placeholder="请输入种类" />
200         </el-form-item>
201         <el-form-item label="视图" prop="materialView">
202           <el-input v-model="form.materialView" placeholder="请输入视图" />
203         </el-form-item>
204         <el-form-item label="单位" prop="unit">
205 <!--          <el-input v-model="form.unit" placeholder="请输入单位" />-->
206           <el-select v-model="form.unit" style="width: 204px;" placeholder="请选择单位" clearable>
207             <el-option
208               v-for="dict in dict.type.unit"
209               :key="dict.value"
210               :label="dict.label"
211               :value="dict.value"
212             />
213           </el-select>
214         </el-form-item>
215         <el-form-item label="备注" prop="remarks">
216           <el-input v-model="form.remarks" placeholder="请输入备注" />
217         </el-form-item>
218 <!--        <el-form-item label="ERP规格" prop="erpSpec">
219           <el-input v-model="form.erpSpec" placeholder="请输入ERP规格" />
220         </el-form-item>-->
221 <!--        <el-form-item label="厂商" prop="supplier">
222           <el-input v-model="form.supplier" placeholder="请输入厂商" />
223         </el-form-item>-->
224         <el-form-item label="状态" prop="status">
225           <el-radio-group v-model="form.status">
226             <el-radio
227               v-for="dict in dict.type.sys_normal_disable"
228               :key="dict.value"
229               :label="dict.value"
230             >{{dict.label}}</el-radio>
231           </el-radio-group>
232         </el-form-item>
233
234       </el-form>
235       <div slot="footer" class="dialog-footer">
236         <el-button type="primary" @click="submitForm">确 定</el-button>
237         <el-button @click="cancel">取 消</el-button>
238       </div>
239     </el-dialog>
240   </div>
241 </template>
242
243 <script>
244 import { listMaterial, getMaterial, delMaterial, addMaterial, updateMaterial } from "@/api/main/bs/material/material";
245
246 export default {
247   name: "Material",
248   dicts: ['sys_normal_disable','unit','material_type'],
249   data() {
250     return {
251       // 遮罩层
252       loading: true,
253       titleName: 'test',
254       // 选中数组
255       ids: [],
256       // 非单个禁用
257       single: true,
258       // 非多个禁用
259       multiple: true,
260       // 显示搜索条件
261       showSearch: true,
262       // 总条数
263       total: 0,
264       // 物料信息表格数据
265       materialList: [],
266       // 弹出层标题
267       title: "",
268       // 是否显示弹出层
269       open: false,
270       // 查询参数
271       queryParams: {
272         pageNum: 1,
273         pageSize: 10,
274         materialCode: null,
b26334 275         carType:null,
fd2207 276         materialName: null,
277         materialView: null,
278         typeZ: null,
279         typeL: null,
280         unit: null,
281         matterVersion: null,
282         remarks: null,
283         createUser: null,
284         createTime: null,
285         updateUser: null,
286         erpSpec: null,
287         dataSource: null,
288         version: null,
289         status: null,
2e964f 290         mark: null,
fd2207 291         supplier: null
292       },
293       // 表单参数
294       form: {},
295       // 表单校验
296       rules: {
297         id: [
298           { required: true, message: "主键id不能为空", trigger: "blur" }
299         ],
300         materialCode: [
301           { required: true, message: "物料编码不能为空", trigger: "blur" }
302         ],
8876c2 303         mark: [
W 304           { required: true, message: "特殊代码不能为空", trigger: "blur" }
305         ],
fd2207 306         materialName: [
307           { required: true, message: "物料名称不能为空", trigger: "blur" }
308         ],
8876c2 309         // typeL: [
W 310         //   { required: true, message: "类型不能为空", trigger: "blur" }
311         // ],
fd2207 312       }
313     };
314   },
315   created() {
316     this.getList();
317   },
318   methods: {
319     /** 查询物料信息列表 */
320     getList() {
321       this.loading = true;
322       listMaterial(this.queryParams).then(response => {
323         this.materialList = response.rows;
324         this.total = response.total;
325         this.loading = false;
326       });
327     },
328     // 取消按钮
329     cancel() {
330       this.open = false;
331       this.reset();
332     },
333     // 表单重置
334     reset() {
335       this.form = {
336         id: null,
337         materialCode: null,
338         materialName: null,
339         materialView: null,
340         typeZ: null,
b26334 341         carType:null,
fd2207 342         typeL: null,
343         unit: null,
344         matterVersion: null,
345         remarks: null,
346         createUser: null,
347         createTime: null,
348         updateUser: null,
349         updateTime: null,
350         erpSpec: null,
351         dataSource: null,
352         version: null,
353         status: '0',
2e964f 354         mark: null,
fd2207 355         supplier: null
356       };
357       this.resetForm("form");
358     },
359     /** 搜索按钮操作 */
360     handleQuery() {
361       this.queryParams.pageNum = 1;
362       this.getList();
363     },
364     /** 重置按钮操作 */
365     resetQuery() {
366       this.resetForm("queryForm");
367       this.handleQuery();
368     },
369     // 多选框选中数据
370     handleSelectionChange(selection) {
371       this.ids = selection.map(item => item.id)
372       this.single = selection.length!==1
373       this.multiple = !selection.length
374     },
375     /** 新增按钮操作 */
376     handleAdd() {
377       this.reset();
378       this.open = true;
379       this.titleName = "添加物料信息";
380     },
381     /** 修改按钮操作 */
382     handleUpdate(row) {
383       this.reset();
384       const id = row.id || this.ids
385       getMaterial(id).then(response => {
386         this.form = response.data;
387         this.open = true;
388         this.titleName = "修改物料信息";
389       });
390     },
391     /** 提交按钮 */
392     submitForm() {
393       this.$refs["form"].validate(valid => {
394         if (valid) {
395           if (this.form.id != null) {
396             updateMaterial(this.form).then(response => {
397               this.$modal.msgSuccess("修改成功");
398               this.open = false;
399               this.getList();
400             });
401           } else {
402             addMaterial(this.form).then(response => {
403               this.$modal.msgSuccess("新增成功");
404               this.open = false;
405               this.getList();
406             });
407           }
408         }
409       });
410     },
411     /** 删除按钮操作 */
412     handleDelete(row) {
413       const ids = row.id || this.ids;
414       this.$modal.confirm('是否确认删除物料信息编号为"' + ids + '"的数据项?').then(function() {
415         return delMaterial(ids);
416       }).then(() => {
417         this.getList();
418         this.$modal.msgSuccess("删除成功");
419       }).catch(() => {});
420     },
421     /** 导出按钮操作 */
422     handleExport() {
423       this.download('bs/material/export', {
424         ...this.queryParams
425       }, `material_${new Date().getTime()}.xlsx`)
426     }
427   }
428 };
429 </script>