懒羊羊
2023-12-25 1012bc149a6209feef5582893c151f85d38ec89d
提交 | 用户 | 时间
83806e 1 <template>
2   <div class="app-container">
79a2ad 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>
53b67e 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>
79a2ad 30         </el-form-item>
10bfb5 31         <el-form-item style="float: right">
79a2ad 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>
83806e 37
79a2ad 38     <el-card style="margin-top: 10px" class="box-card">
39       <el-row :gutter="10" class="mb8">
40         <el-col :span="1.5">
83806e 41           <el-button
79a2ad 42             type="primary"
43             plain
44             icon="el-icon-plus"
83806e 45             size="mini"
79a2ad 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
83806e 54             icon="el-icon-edit"
79a2ad 55             size="mini"
56             :disabled="single"
57             @click="handleUpdate"
83806e 58             v-hasPermi="['bs:technologyRoute:edit']"
59           >修改</el-button>
79a2ad 60         </el-col>
61         <el-col :span="1.5">
83806e 62           <el-button
79a2ad 63             type="danger"
64             plain
83806e 65             icon="el-icon-delete"
79a2ad 66             size="mini"
67             :disabled="multiple"
68             @click="handleDelete"
83806e 69             v-hasPermi="['bs:technologyRoute:remove']"
70           >删除</el-button>
79a2ad 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
a04319 85       <el-table border v-loading="loading" :data="technologyRouteList" @selection-change="handleSelectionChange" v-if="technologyRouteList.length > 0">
79a2ad 86         <el-table-column type="selection" width="55" align="center" />
28c5e2 87         <el-table-column :show-overflow-tooltip='true' label="工艺流程编码" width="130" align="center">
79a2ad 88           <template slot-scope="scope">
03bb7a 89             <router-link :to="{path: '/main/route-data/index/', query: {routeCode: scope.row.routeCode,routeId: scope.row.id} }" class="link-type">
79a2ad 90               <span>{{ scope.row.routeCode }}</span>
91             </router-link>
92           </template>
93         </el-table-column>
effa74 94         <el-table-column  :show-overflow-tooltip='true' label="工艺流程名称" width="130" align="center" prop="routeName">
79a2ad 95         </el-table-column>
10bfb5 96         <el-table-column label="产品编码" width="130" align="center" prop="productCode">
79a2ad 97         </el-table-column>
10bfb5 98         <el-table-column label="产品名称" width="160" align="center" prop="productName">
79a2ad 99         </el-table-column>
900ee1 100         <el-table-column label="版本" align="center" prop="version">
79a2ad 101         </el-table-column>
10bfb5 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>
79a2ad 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>
53b67e 111         <el-table-column label="创建用户" width="160" align="center" prop="createUser">
79a2ad 112         </el-table-column>
10bfb5 113         <el-table-column label="创建时间" width="160" align="center" prop="createTime">
79a2ad 114         </el-table-column>
53b67e 115         <el-table-column label="更改用户" width="160" align="center" prop="updateUser">
79a2ad 116         </el-table-column>
10bfb5 117         <el-table-column label="更改时间" width="160" align="center" prop="updateTime">
79a2ad 118         </el-table-column>
03bb7a 119         <el-table-column fixed="right" label="操作" width="200" align="center" class-name="small-padding fixed-width">
79a2ad 120           <template slot-scope="scope">
121             <el-button
122               size="mini"
a04319 123               type="success"
H 124               plain
125               style="width: 72px"
79a2ad 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"
a04319 132               plain
H 133               style="width: 72px"
134               type="danger"
79a2ad 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>
a04319 142       <el-empty v-else>
H 143         <span slot="description">暂无数据</span>
144       </el-empty>
79a2ad 145     </el-card>
83806e 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     <!-- 添加或修改工艺流程对话框 -->
45a2ee 156     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
a04319 157       <span slot="title">
H 158         <i class="el-icon-s-order"></i>
159         {{titleName}}
160       </span>
83806e 161       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
1012bc 162         <el-form-item label="流程编码" prop="routeCode">
83806e 163           <el-input v-model="form.routeCode" placeholder="请输入工艺流程编码" />
164         </el-form-item>
1012bc 165         <el-form-item label="流程名称" prop="routeName">
83806e 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>
10bfb5 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>
83806e 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>
03bb7a 199 import { updateTechnologyRouteAndChild, listTechnologyRoute, getTechnologyRoute, delTechnologyRoute, addTechnologyRoute, updateTechnologyRoute } from "@/api/main/bs/technologyRoute/technologyRoute";
83806e 200
201 export default {
202   name: "TechnologyRoute",
10bfb5 203   dicts: ['sys_normal_disable'],
204
83806e 205   data() {
206     return {
207       // 遮罩层
208       loading: true,
a04319 209       titleName: 'test',
83806e 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,
230         routeCode: null,
231         routeName: null,
232         productCode: null,
233         productName: null,
234         status: null,
235         dataSource: null,
236       },
237       // 表单参数
238       form: {},
239       // 表单校验
240       rules: {
241         id: [
242           { required: true, message: "主键id不能为空", trigger: "blur" }
243         ],
244         routeCode: [
245           { required: true, message: "工艺流程编码不能为空", trigger: "blur" }
246         ],
247         productCode: [
248           { required: true, message: "产品编码不能为空", trigger: "blur" }
249         ],
250       }
251     };
252   },
253   created() {
254     this.getList();
255   },
256   methods: {
257     /** 查询工艺流程列表 */
258     getList() {
259       this.loading = true;
260       listTechnologyRoute(this.queryParams).then(response => {
5d5153 261         console.log(response.rows)
83806e 262         this.technologyRouteList = response.rows;
263         console.log(this.technologyRouteList)
264         this.total = response.total;
265         this.loading = false;
266       });
267     },
268     // 取消按钮
269     cancel() {
270       this.open = false;
271       this.reset();
272     },
273     // 表单重置
274     reset() {
275       this.form = {
276         id: null,
277         routeCode: null,
278         routeName: null,
279         productCode: null,
280         productName: null,
281         version: null,
10bfb5 282         status: "0",
83806e 283         dataSource: null,
284         remark: null,
285         createUser: null,
286         createTime: null,
287         updateUser: null,
288         updateTime: null,
289         spareField1: null,
290         spareField2: null,
291         spareField3: null,
292         spareField4: null
293       };
294       this.resetForm("form");
295     },
296     /** 搜索按钮操作 */
297     handleQuery() {
298       this.queryParams.pageNum = 1;
299       this.getList();
300     },
301     /** 重置按钮操作 */
302     resetQuery() {
303       this.resetForm("queryForm");
304       this.handleQuery();
305     },
306     // 多选框选中数据
307     handleSelectionChange(selection) {
308       this.ids = selection.map(item => item.id)
309       this.single = selection.length!==1
310       this.multiple = !selection.length
311     },
312     /** 新增按钮操作 */
313     handleAdd() {
314       this.reset();
315       this.open = true;
a04319 316       this.titleName = "添加工艺流程";
83806e 317     },
318     /** 修改按钮操作 */
319     handleUpdate(row) {
320       this.reset();
321       const id = row.id || this.ids
322       getTechnologyRoute(id).then(response => {
323         this.form = response.data;
324         this.open = true;
a04319 325         this.titleName = "修改工艺流程";
83806e 326       });
327     },
328     /** 提交按钮 */
329     submitForm() {
330       this.$refs["form"].validate(valid => {
331         if (valid) {
332           if (this.form.id != null) {
03bb7a 333             // updateTechnologyRoute(this.form).then(response => {
334             updateTechnologyRouteAndChild(this.form).then(response => {
83806e 335               this.$modal.msgSuccess("修改成功");
336               this.open = false;
337               this.getList();
338             });
339           } else {
340             addTechnologyRoute(this.form).then(response => {
341               this.$modal.msgSuccess("新增成功");
342               this.open = false;
343               this.getList();
344             });
345           }
346         }
347       });
348     },
349     /** 删除按钮操作 */
350     handleDelete(row) {
351       const ids = row.id || this.ids;
352       this.$modal.confirm('是否确认删除工艺流程编号为"' + ids + '"的数据项?').then(function() {
353         return delTechnologyRoute(ids);
354       }).then(() => {
355         this.getList();
356         this.$modal.msgSuccess("删除成功");
357       }).catch(() => {});
358     },
359     /** 导出按钮操作 */
360     handleExport() {
361       this.download('main/technologyRoute/export', {
362         ...this.queryParams
363       }, `technologyRoute_${new Date().getTime()}.xlsx`)
364     }
365   }
366 };
367 </script>