-
admin
2024-05-14 616f9896be815a60b5c4063116b7d138892dcfaf
提交 | 用户 | 时间
b5450a 1 <template>
H 2   <div class="app-container">
3     <el-row :gutter="10" class="mb8">
4       <el-col :span="1.5">
5         <el-button
6           type="primary"
7           plain
8           icon="el-icon-plus"
9           size="mini"
10           @click="handleAdd"
11           v-hasPermi="['mes:dv:checkplan:add']"
12         >新增</el-button>
13       </el-col>
14     </el-row>
406ad2 15     <MachinerySelect ref="machinerySelect" @onSelected="onMachineryAdd" ></MachinerySelect>
c92f19 16     <el-table v-loading="loading" :data="checkmachineryList" >
b5450a 17       <el-table-column label="设备编码" align="center" prop="equipmentCode" />
H 18       <el-table-column label="设备名称" align="center" prop="equipmentName" />
19       <el-table-column label="品牌" align="center" prop="equipmentBrand" />
20       <el-table-column label="规格型号" align="center" prop="equipmentSpec" />
21       <el-table-column label="备注" align="center" prop="remark" />
521803 22       <el-table-column label="操作" align="center" >
H 23         <template slot-scope="scope">
24           <el-button
25             size="mini"
26             type="danger"
27             icon="el-icon-delete"
c92f19 28             @click="deleteSelectedColumns(scope.row)"
521803 29           >删除</el-button>
H 30         </template>
31       </el-table-column>
b5450a 32     </el-table>
H 33
34     <pagination
35       v-show="total>0"
36       :total="total"
37       :page.sync="queryParams.pageNum"
38       :limit.sync="queryParams.pageSize"
39       @pagination="getList"
40     />
41   </div>
42 </template>
43
44 <script>
45 import { listInspectionPlanArchives, delInspectionPlanArchives, addInspectionPlanArchives} from "@/api/main/em/inspectionPlanArchives/inspectionPlanArchives";
46 import MachinerySelect from "@/components/inspectionPlanArchives/index.vue";
47 export default {
48   name: "Checkmachinery",
49   components:{MachinerySelect},
21508c 50   props:{ id: null,
H 51           optType: null,
52           planCode: null,
53         },
b5450a 54   data() {
H 55     return {
56       // 遮罩层
57       loading: true,
58
59       // 选中数组
60       ids: [],
61       // 非单个禁用
62       single: true,
63       // 非多个禁用
64       multiple: true,
65       // 显示搜索条件
66       showSearch: true,
67       // 总条数
68       total: 0,
69       // 点检设备表格数据
70       checkmachineryList: [],
c92f19 71         // 弹出层标题
b5450a 72       title: "",
H 73       // 是否显示弹出层
74       open: false,
75       // 查询参数
76       queryParams: {
77         pageNum: 1,
78         pageSize: 10,
79         planId: this.planId,
80         equipmentId: null,
81         equipmentCode: null,
82         equipmentName: null,
83         equipmentBrand: null,
84         equipmentSpec: null,
85       },
86       // 表单参数
87       form: {},
88     };
89   },
90   created() {
91     this.getList();
92   },
93   methods: {
21508c 94     clearCheckmachineryList() {
H 95       this.checkmachineryList = [];
96     },
c92f19 97     deleteSelectedColumns(row) {
H 98       const index = this.checkmachineryList.findIndex(item => item.id === row.id);
99       if (index !== -1) {
100         this.checkmachineryList.splice(index, 1);
101       } else {
102         this.$message({
103           message: '未找到具有该ID的项目',
104           type: 'warning'
105         });
106       }
107       this.$emit('inSelected',this.checkmachineryList);
108
109     },
110   /** 查询点检设备列表 */
b5450a 111     getList() {
H 112       this.loading = true;
21508c 113       this.checkmachineryList =this.machineryList;
b5450a 114       listInspectionPlanArchives(this.queryParams).then(response => {
521803 115         // this.checkmachineryList = response.rows;
b5450a 116         this.total = response.total;
H 117         this.loading = false;
118       });
119     },
120     /** 新增按钮操作 */
21508c 121     handleAdd(){
b5450a 122       this.$refs.machinerySelect.showFlag = true;
H 123     },
406ad2 124     onMachineryAdd(selectedRows){
H 125       if(selectedRows !=null && selectedRows.length >0){
126         this.checkmachineryList = selectedRows
b5450a 127       }
521803 128       this.$emit('inSelected',this.checkmachineryList);
H 129       console.log(this.checkmachineryList)
b5450a 130     },
c92f19 131
b5450a 132   }
H 133 };
134 </script>