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