多选重试对接完成

This commit is contained in:
xiayuping666
2024-05-31 09:43:37 +08:00
parent 8357146548
commit 9d82c89c66
3 changed files with 60 additions and 14 deletions
@@ -1,14 +1,17 @@
<template> <template>
<div> <div>
<el-button @click="newlyClick" type="primary" size="mini" icon="el-icon-plus" <!-- <el-button @click="newlyClick" type="primary" size="mini" icon="el-icon-plus"
>新增</el-button >新增</el-button
> > -->
<el-button @click="resetClick" type="info" size="mini" icon="iconfont icon-biaodan" <!-- <el-button @click="resetClick" type="info" size="mini" icon="iconfont icon-biaodan"
>重置</el-button >重置</el-button
> > -->
<el-button @click="afreshClick" type="warning" size="mini" icon="el-icon-refresh-left" <el-button @click="afreshClick" type="warning" size="mini" icon="el-icon-refresh-left"
>重试</el-button >重试</el-button
> >
<el-button @click="refreshClick" type="primary" size="mini" icon="el-icon-refresh-right"
>刷新</el-button
>
<el-input <el-input
v-if="false" v-if="false"
v-model="searchData" v-model="searchData"
@@ -38,8 +41,12 @@ export default {
this.$emit("reset-data"); this.$emit("reset-data");
}, },
afreshClick() { afreshClick() {
this.$emit("afresh-data", this.searchData); this.$emit("afresh-data");
}, },
refreshClick () {
this.$emit("refresh-data");
}
}, },
}; };
</script> </script>
@@ -1,5 +1,6 @@
<template> <template>
<el-table <el-table
@selection-change="handleSelectionChange"
ref="table" ref="table"
border border
:header-cell-style="{ :header-cell-style="{
@@ -10,8 +11,10 @@
height="650" height="650"
size="mini" size="mini"
:row-key="getRowKeys" :row-key="getRowKeys"
> >
<el-table-column <el-table-column
:selectable="selectable"
type="selection" type="selection"
width="55"> width="55">
</el-table-column> </el-table-column>
@@ -26,7 +29,7 @@
></el-table-column> ></el-table-column>
<el-table-column align="left" prop="zip" label="操作" width="160"> <el-table-column align="left" prop="zip" label="操作" width="160">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <!-- <el-button
@click="handleEdit(scope.row)" @click="handleEdit(scope.row)"
class="el-icon-edit" class="el-icon-edit"
type="text" type="text"
@@ -43,11 +46,11 @@
size="small" size="small"
>删除</el-button >删除</el-button
> >
</el-popconfirm> </el-popconfirm> -->
<el-button <el-button
v-if="scope.row.success == '失败'" v-if="scope.row.success == '失败'"
@click="afreshClick(scope.row)" @click="afreshClick(multipleSelection)"
style="margin-left: 10px;" style="margin-left: 10px;"
class="el-icon-refresh-left" class="el-icon-refresh-left"
type="text" type="text"
@@ -82,12 +85,24 @@ export default {
type: Function, type: Function,
default: () => {}, default: () => {},
}, },
afreshAllFunc: {
type: Function,
default: () => {},
},
}, },
name: "CommonTables", name: "CommonTables",
data() { data() {
return {}; return {
multipleSelection: []
};
}, },
methods: { methods: {
handleSelectionChange(val) {
this.multipleSelection = val.map(item =>{
return item.id
})
this.afreshAllFunc(this.multipleSelection)
},
// 删除事件 // 删除事件
handleDelete(row) { handleDelete(row) {
this.deleteFunc(row); this.deleteFunc(row);
@@ -104,11 +119,11 @@ export default {
return row.id return row.id
}, },
selectable(row, index) { selectable(row, index) {
if (row.success == 0 || row.status == 1) { if (row.success == '失败' ) {
return true; return true;
} else { } else {
return false; return false;
} }
}, },
}, },
computed: { computed: {
@@ -8,6 +8,8 @@
@search-data="searchForm" @search-data="searchForm"
@reset-data="reset" @reset-data="reset"
@newly-data="add" @newly-data="add"
@afresh-data="afreshClickAll"
@refresh-data="refreshClick"
></CommonHead> ></CommonHead>
<!-- newly-data删除所选事件 --> <!-- newly-data删除所选事件 -->
<!-- reset-data重置表单内容 --> <!-- reset-data重置表单内容 -->
@@ -20,6 +22,7 @@
:delete-func="deleteData" :delete-func="deleteData"
:edit-func="editData" :edit-func="editData"
:afreshFunc ="afreshClick" :afreshFunc ="afreshClick"
:afreshAllFunc="afreshAllFunc"
:columns="columns" :columns="columns"
:data="equipmentList" :data="equipmentList"
></CommonTables> ></CommonTables>
@@ -128,6 +131,7 @@ export default {
label: [{ required: true, message: "请输入标签", trigger: "change" }], label: [{ required: true, message: "请输入标签", trigger: "change" }],
welcome: [{ required: true, message: "请输入欢迎词", trigger: "change" }], welcome: [{ required: true, message: "请输入欢迎词", trigger: "change" }],
}, },
multipleSelection: []
}; };
}, },
components: { components: {
@@ -139,6 +143,22 @@ export default {
this.deviceList() this.deviceList()
}, },
methods: { methods: {
// 点击刷新
refreshClick() {
this.getAttendanceFormData();
},
// 多选重试
afreshClickAll(item) {
console.log(this.multipleSelection)
putRetry(this.multipleSelection).then(res => {
this.$message({
message: "重试成功",
type: "success",
});
this.getAttendanceFormData();
})
},
// 单选重试
afreshClick(item) { afreshClick(item) {
console.log(item) console.log(item)
putRetry([item.id]).then(res => { putRetry([item.id]).then(res => {
@@ -149,6 +169,10 @@ export default {
this.getAttendanceFormData(); this.getAttendanceFormData();
}) })
}, },
// 选中的表单数据
afreshAllFunc(selectableArr) {
this.multipleSelection = selectableArr
},
// 搜索按钮 // 搜索按钮
searchForm() { searchForm() {
this.$message("正在搜索"); this.$message("正在搜索");