提交 | 用户 | 时间
|
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}, |
|
50 |
props:{ |
|
51 |
planId: null, |
|
52 |
optType: null |
|
53 |
}, |
|
54 |
data() { |
|
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: { |
c92f19
|
94 |
|
H |
95 |
deleteSelectedColumns(row) { |
|
96 |
const index = this.checkmachineryList.findIndex(item => item.id === row.id); |
|
97 |
if (index !== -1) { |
|
98 |
this.checkmachineryList.splice(index, 1); |
|
99 |
} else { |
|
100 |
this.$message({ |
|
101 |
message: '未找到具有该ID的项目', |
|
102 |
type: 'warning' |
|
103 |
}); |
|
104 |
} |
|
105 |
this.$emit('inSelected',this.checkmachineryList); |
|
106 |
|
|
107 |
}, |
|
108 |
/** 查询点检设备列表 */ |
b5450a
|
109 |
getList() { |
H |
110 |
this.loading = true; |
|
111 |
listInspectionPlanArchives(this.queryParams).then(response => { |
521803
|
112 |
// this.checkmachineryList = response.rows; |
b5450a
|
113 |
this.total = response.total; |
H |
114 |
this.loading = false; |
|
115 |
}); |
|
116 |
}, |
|
117 |
|
c92f19
|
118 |
|
b5450a
|
119 |
/** 新增按钮操作 */ |
H |
120 |
handleAdd() { |
|
121 |
this.$refs.machinerySelect.showFlag = true; |
|
122 |
}, |
|
123 |
//设备资源选择回调 |
406ad2
|
124 |
// onMachineryAdd(rows){ |
H |
125 |
// if(rows !=null && rows.length >0){ |
|
126 |
// rows.forEach(row => { |
|
127 |
// row.planId = this.planId; |
|
128 |
// addInspectionPlanArchives(row).then(response =>{ |
|
129 |
// this.getList(); |
|
130 |
// }); |
|
131 |
// }); |
|
132 |
// } |
|
133 |
// }, |
|
134 |
onMachineryAdd(selectedRows){ |
|
135 |
if(selectedRows !=null && selectedRows.length >0){ |
|
136 |
this.checkmachineryList = selectedRows |
b5450a
|
137 |
} |
521803
|
138 |
this.$emit('inSelected',this.checkmachineryList); |
H |
139 |
console.log(this.checkmachineryList) |
b5450a
|
140 |
}, |
c92f19
|
141 |
|
b5450a
|
142 |
} |
H |
143 |
}; |
|
144 |
</script> |