提交 | 用户 | 时间
|
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-col :span="1.5"> |
|
15 |
<el-button |
|
16 |
type="danger" |
|
17 |
plain |
|
18 |
icon="el-icon-delete" |
|
19 |
size="mini" |
|
20 |
:disabled="multiple" |
|
21 |
@click="handleDelete" |
|
22 |
v-hasPermi="['mes:dv:checkplan:remove']" |
|
23 |
>删除</el-button> |
|
24 |
</el-col> |
|
25 |
</el-row> |
406ad2
|
26 |
<MachinerySelect ref="machinerySelect" @onSelected="onMachineryAdd" ></MachinerySelect> |
b5450a
|
27 |
<el-table v-loading="loading" :data="checkmachineryList" @selection-change="handleSelectionChange"> |
H |
28 |
<el-table-column label="设备编码" align="center" prop="equipmentCode" /> |
|
29 |
<el-table-column label="设备名称" align="center" prop="equipmentName" /> |
|
30 |
<el-table-column label="品牌" align="center" prop="equipmentBrand" /> |
|
31 |
<el-table-column label="规格型号" align="center" prop="equipmentSpec" /> |
|
32 |
<el-table-column label="备注" align="center" prop="remark" /> |
521803
|
33 |
<el-table-column label="操作" align="center" > |
H |
34 |
<template slot-scope="scope"> |
|
35 |
<el-button |
|
36 |
size="mini" |
|
37 |
type="danger" |
|
38 |
icon="el-icon-delete" |
|
39 |
@click="handleDelete(scope.row)" |
|
40 |
>删除</el-button> |
|
41 |
</template> |
|
42 |
</el-table-column> |
b5450a
|
43 |
</el-table> |
H |
44 |
|
|
45 |
<pagination |
|
46 |
v-show="total>0" |
|
47 |
:total="total" |
|
48 |
:page.sync="queryParams.pageNum" |
|
49 |
:limit.sync="queryParams.pageSize" |
|
50 |
@pagination="getList" |
|
51 |
/> |
|
52 |
</div> |
|
53 |
</template> |
|
54 |
|
|
55 |
<script> |
|
56 |
import { listInspectionPlanArchives, delInspectionPlanArchives, addInspectionPlanArchives} from "@/api/main/em/inspectionPlanArchives/inspectionPlanArchives"; |
|
57 |
import MachinerySelect from "@/components/inspectionPlanArchives/index.vue"; |
|
58 |
export default { |
|
59 |
name: "Checkmachinery", |
|
60 |
components:{MachinerySelect}, |
|
61 |
props:{ |
|
62 |
planId: null, |
|
63 |
optType: null |
|
64 |
}, |
|
65 |
data() { |
|
66 |
return { |
|
67 |
// 遮罩层 |
|
68 |
loading: true, |
|
69 |
|
|
70 |
// 选中数组 |
|
71 |
ids: [], |
|
72 |
// 非单个禁用 |
|
73 |
single: true, |
|
74 |
// 非多个禁用 |
|
75 |
multiple: true, |
|
76 |
// 显示搜索条件 |
|
77 |
showSearch: true, |
|
78 |
// 总条数 |
|
79 |
total: 0, |
|
80 |
// 点检设备表格数据 |
|
81 |
checkmachineryList: [], |
|
82 |
// 弹出层标题 |
|
83 |
title: "", |
|
84 |
// 是否显示弹出层 |
|
85 |
open: false, |
|
86 |
// 查询参数 |
|
87 |
queryParams: { |
|
88 |
pageNum: 1, |
|
89 |
pageSize: 10, |
|
90 |
planId: this.planId, |
|
91 |
equipmentId: null, |
|
92 |
equipmentCode: null, |
|
93 |
equipmentName: null, |
|
94 |
equipmentBrand: null, |
|
95 |
equipmentSpec: null, |
|
96 |
}, |
|
97 |
// 表单参数 |
|
98 |
form: {}, |
|
99 |
}; |
|
100 |
}, |
|
101 |
created() { |
|
102 |
this.getList(); |
|
103 |
}, |
|
104 |
methods: { |
|
105 |
/** 查询点检设备列表 */ |
|
106 |
getList() { |
|
107 |
this.loading = true; |
|
108 |
listInspectionPlanArchives(this.queryParams).then(response => { |
521803
|
109 |
// this.checkmachineryList = response.rows; |
b5450a
|
110 |
this.total = response.total; |
H |
111 |
this.loading = false; |
|
112 |
}); |
|
113 |
}, |
|
114 |
|
|
115 |
// 多选框选中数据 |
|
116 |
handleSelectionChange(selection) { |
|
117 |
this.ids = selection.map(item => item.recordId) |
|
118 |
this.single = selection.length!==1 |
|
119 |
this.multiple = !selection.length |
|
120 |
}, |
|
121 |
/** 新增按钮操作 */ |
|
122 |
handleAdd() { |
|
123 |
this.$refs.machinerySelect.showFlag = true; |
|
124 |
}, |
|
125 |
//设备资源选择回调 |
406ad2
|
126 |
// onMachineryAdd(rows){ |
H |
127 |
// if(rows !=null && rows.length >0){ |
|
128 |
// rows.forEach(row => { |
|
129 |
// row.planId = this.planId; |
|
130 |
// addInspectionPlanArchives(row).then(response =>{ |
|
131 |
// this.getList(); |
|
132 |
// }); |
|
133 |
// }); |
|
134 |
// } |
|
135 |
// }, |
|
136 |
onMachineryAdd(selectedRows){ |
|
137 |
if(selectedRows !=null && selectedRows.length >0){ |
|
138 |
this.checkmachineryList = selectedRows |
b5450a
|
139 |
} |
521803
|
140 |
this.$emit('inSelected',this.checkmachineryList); |
H |
141 |
console.log(this.checkmachineryList) |
b5450a
|
142 |
}, |
H |
143 |
/** 删除按钮操作 */ |
|
144 |
handleDelete(row) { |
|
145 |
const recordIds = row.recordId || this.ids; |
|
146 |
this.$modal.confirm('是否确认删除点检设备编号为"' + recordIds + '"的数据项?').then(function() { |
|
147 |
return delInspectionPlanArchives(recordIds); |
|
148 |
}).then(() => { |
|
149 |
this.getList(); |
|
150 |
this.$modal.msgSuccess("删除成功"); |
|
151 |
}).catch(() => {}); |
|
152 |
} |
|
153 |
} |
|
154 |
}; |
|
155 |
</script> |