1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<template>
<div slot="header" class="clearfix">
<el-button :loading="false" icon="el-icon-edit" @click="saveTableData()" plain>
修改保存
</el-button>
<el-button :loading="false" icon="el-icon-refresh" @click="reflush()" >
刷新
</el-button>
<el-button :loading="false" icon="el-icon-success" @click="selectAll('Y')" >
全选
</el-button>
<el-button :loading="false" icon="el-icon-error" @click="selectAll('N')" >
全不选
</el-button>
<div class="currentPage">
<c-table :list="tableData" :border="true" height="calc(100vh - 350px)" ref="refTable">
<el-table-column label="机构号" prop="accbch">
<template slot-scope="scope">{{scope.row.accbch}}</template>
</el-table-column>
<el-table-column label="机构名称" prop="bchname">
<template slot-scope="scope">{{scope.row.bchname}}</template>
</el-table-column>
<el-table-column label="试点机构" prop="ispilot">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.ispilot" true-label="Y" false-label="N" ></el-checkbox>
</template>
</el-table-column>
</c-table>
</div>
<!-- <span>共{{this.tableData.length}}条</span> -->
</div>
</template>
<script>
import PilotbchModel from "./PilotbchModel.js";
import Utils from "~/utils";
import { queryList, updateBatch } from "~/service/manage/pilotbch.js";
import commonFunctions from "~/mixin/commonFunctions.js";
export default {
mixins: [commonFunctions],
props:{
},
data(){
return{
tableData:null,
}
},
mounted(){
this.searchTable()
},
methods:{
// 列表查询
searchTable(){
const loading = this.loading();
queryList()
.then((res)=>{
this.tableData = res.data;
loading.close();
})
.catch((err)=>{
this.$notify.error("查询失败!");
loading.close();
});
},
reflush(){
this.searchTable()
},
selectAll(a){
for(let i = 0; i < this.tableData.length; i++){
this.tableData[i].ispilot = a
}
},
// 批量更新
saveTableData(){
const loading = this.loading();
updateBatch(this.tableData)
.then((res)=>{
this.$notify.success("更新成功!");
this.searchTable();
loading.close();
})
.catch((err)=>{
this.$notify.error("更新失败!");
loading.close();
});
},
}
}
</script>
<style lang="less" scoped>
.currentPage{
.el-table--enable-row-hover {
.el-table__body {
tr:hover>td {
background-color: #c694dc !important;
}
}
}
::v-deep .el-checkbox {
float: none;
}
}
</style>