Commit 9ae5a6c7e686f7910abc3e156399f363eb8cf1e4

Authored by 张红振
1 parent 0851365b

fix bug

src/views/community/housekeeper/changeAdmin.vue
... ... @@ -67,10 +67,26 @@ const emit = defineEmits<{
67 67 /**
68 68 * 表格选择回调
69 69 */
70   -const handleSelectionChange = (val: Array) => {
71   - data.selectList = val.map((val: any) => {
72   - return val.id;
73   - });
  70 +// const handleSelectionChange = (val: Array) => {
  71 +// console.log(val);
  72 +// data.selectList = val.map((val: any) => {
  73 +// return val.id;
  74 +// });
  75 +// };
  76 +
  77 +const dialogCheck = (selection, row) => {
  78 + console.log(selection);
  79 + multipleTableRef.value!.clearSelection();
  80 + if (selection.length === 0) {
  81 + // 判断selection是否有值存在
  82 + return;
  83 + }
  84 + if (row) {
  85 + console.log(row);
  86 + data.selectList.splice(0, 1, row);
  87 + console.log(data.selectList);
  88 + multipleTableRef.value!.toggleRowSelection(row, true);
  89 + }
74 90 };
75 91 /**
76 92 * 数据提交
... ... @@ -89,7 +105,7 @@ const submit = () => {
89 105 .then(() => {
90 106 addOrUpBuildingHouseKeeper({
91 107 buildingId: props.buildingId,
92   - houseKeeperIds: data.selectList[0],
  108 + houseKeeperIds: data.selectList[0].id,
93 109 originalIds: props.originalIds,
94 110 }).then((res) => {
95 111 multipleTableRef.value!.clearSelection();
... ... @@ -138,9 +154,10 @@ watchEffect(() => {
138 154 border
139 155 :data="data.tableList"
140 156 @selection-change="handleSelectionChange"
  157 + @select="dialogCheck"
141 158 ref="multipleTableRef"
142 159 >
143   - <el-table-column type="selection" width="55" />
  160 + <el-table-column type="selection" width="55"/>
144 161 <el-table-column label="姓名" prop="name"></el-table-column>
145 162 <el-table-column label="手机号" prop="mobile"></el-table-column>
146 163 <el-table-column label="身份证号" prop="idcard"></el-table-column>
... ... @@ -162,4 +179,10 @@ watchEffect(() =&gt; {
162 179 </div>
163 180 </template>
164 181  
165   -<style></style>
  182 +<style scoped lang="scss">
  183 +::v-deep .has-gutter {
  184 + .el-checkbox {
  185 + display: none;
  186 + }
  187 +}
  188 +</style>
... ...