style;单选多选
Showing
5 changed files
with
121 additions
and
89 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Description: | 2 | * @Description: |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2024-01-17 08:43:05 | 4 | * @LastEditTime: 2024-01-17 11:16:21 |
| 5 | --> | 5 | --> |
| 6 | <template> | 6 | <template> |
| 7 | <div class="from-clues"> | 7 | <div class="from-clues"> |
| ... | @@ -369,8 +369,7 @@ | ... | @@ -369,8 +369,7 @@ |
| 369 | that.$refs[refs].toggleRowSelection(row, true); | 369 | that.$refs[refs].toggleRowSelection(row, true); |
| 370 | } | 370 | } |
| 371 | }) | 371 | }) |
| 372 | } | 372 | } else { |
| 373 | else { | ||
| 374 | this.$refs[refs].toggleRowSelection(row, true); | 373 | this.$refs[refs].toggleRowSelection(row, true); |
| 375 | } | 374 | } |
| 376 | }, | 375 | }, | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Description: | 2 | * @Description: |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2023-09-15 14:34:40 | 4 | * @LastEditTime: 2024-01-17 13:20:17 |
| 5 | --> | 5 | --> |
| 6 | <template> | 6 | <template> |
| 7 | <!-- 主体权利信息查询 --> | 7 | <!-- 主体权利信息查询 --> |
| ... | @@ -40,7 +40,7 @@ | ... | @@ -40,7 +40,7 @@ |
| 40 | <!-- 表格 --> | 40 | <!-- 表格 --> |
| 41 | <div class="from-clues-content loadingtext"> | 41 | <div class="from-clues-content loadingtext"> |
| 42 | <lb-table ref="table" @row-click="handleRowClick" :page-size="pageData.pageSize" :calcHeight="300" | 42 | <lb-table ref="table" @row-click="handleRowClick" :page-size="pageData.pageSize" :calcHeight="300" |
| 43 | :current-page.sync="pageData.currentPage" :total="tableData.total" @size-change="handleSizeChange" @select="select" | 43 | :current-page.sync="pageData.currentPage" :total="tableData.total" @size-change="handleSizeChange" |
| 44 | @p-current-change="handleCurrentChange" @selection-change="handleSelectionChange" :column="tableData.columns" | 44 | @p-current-change="handleCurrentChange" @selection-change="handleSelectionChange" :column="tableData.columns" |
| 45 | :data="tableData.data"> | 45 | :data="tableData.data"> |
| 46 | </lb-table> | 46 | </lb-table> |
| ... | @@ -68,6 +68,7 @@ | ... | @@ -68,6 +68,7 @@ |
| 68 | }, | 68 | }, |
| 69 | data () { | 69 | data () { |
| 70 | return { | 70 | return { |
| 71 | radioVal: '', | ||
| 71 | loading: false, | 72 | loading: false, |
| 72 | queryForm: defaultParameters.defaultParameters(), | 73 | queryForm: defaultParameters.defaultParameters(), |
| 73 | tableData: { | 74 | tableData: { |
| ... | @@ -80,6 +81,28 @@ | ... | @@ -80,6 +81,28 @@ |
| 80 | }, | 81 | }, |
| 81 | mounted () { | 82 | mounted () { |
| 82 | sendThis(this); | 83 | sendThis(this); |
| 84 | if (this.sqywInfo.sqywdylx == "1") { | ||
| 85 | this.tableData.columns = [{ | ||
| 86 | label: '选择', | ||
| 87 | width: '50px', | ||
| 88 | render: (h, scope) => { | ||
| 89 | return ( | ||
| 90 | <div class="orgColumn"> | ||
| 91 | <el-radio onChange={() => { this.handleChange(scope.row) }} v-model={this.radioVal} label={scope.row.bdcdyid}> | ||
| 92 |   | ||
| 93 | </el-radio> | ||
| 94 | </div> | ||
| 95 | ) | ||
| 96 | } | ||
| 97 | }].concat(datas.columns()) | ||
| 98 | } else { | ||
| 99 | this.tableData.columns = | ||
| 100 | [{ | ||
| 101 | type: 'selection', | ||
| 102 | label: '全选', | ||
| 103 | width: '50' | ||
| 104 | }].concat(datas.columns()) | ||
| 105 | } | ||
| 83 | }, | 106 | }, |
| 84 | methods: { | 107 | methods: { |
| 85 | /** | 108 | /** |
| ... | @@ -183,21 +206,9 @@ | ... | @@ -183,21 +206,9 @@ |
| 183 | this.bdcdysz = val; | 206 | this.bdcdysz = val; |
| 184 | } | 207 | } |
| 185 | }, | 208 | }, |
| 186 | /** | 209 | handleChange () { |
| 187 | * @description: select | 210 | let arr = this.tableData.data.filter(item => item.bdcdyid == this.radioVal) |
| 188 | * @param {*} selection | 211 | this.bdcdysz = arr |
| 189 | * @param {*} row | ||
| 190 | * @author: renchao | ||
| 191 | */ | ||
| 192 | select (selection, row) { | ||
| 193 | if (this.sqywInfo.sqywdylx == "1") { | ||
| 194 | // 清除 所有勾选项 | ||
| 195 | this.$refs.table.clearSelection() | ||
| 196 | // 当表格数据都没有被勾选的时候 就返回 | ||
| 197 | // 主要用于将当前勾选的表格状态清除 | ||
| 198 | if (selection.length == 0) return | ||
| 199 | this.$refs.table.toggleRowSelection(row, true); | ||
| 200 | } | ||
| 201 | }, | 212 | }, |
| 202 | /** | 213 | /** |
| 203 | * @description: handleRowClick | 214 | * @description: handleRowClick |
| ... | @@ -205,27 +216,34 @@ | ... | @@ -205,27 +216,34 @@ |
| 205 | * @author: renchao | 216 | * @author: renchao |
| 206 | */ | 217 | */ |
| 207 | handleRowClick (row) { | 218 | handleRowClick (row) { |
| 208 | // 如果状态是1,那就是单选 | 219 | // // 如果状态是1,那就是单选 |
| 220 | // if (this.sqywInfo.sqywdylx == "1") { | ||
| 221 | // const bdcdysz = this.bdcdysz | ||
| 222 | // this.$refs.table.clearSelection() | ||
| 223 | // if (bdcdysz.length == 1) { | ||
| 224 | // bdcdysz.forEach(item => { | ||
| 225 | // // 判断 如果当前的一行被勾选, 再次点击的时候就会取消选中 | ||
| 226 | // if (item == row) { | ||
| 227 | // this.$refs.table.toggleRowSelection(row, false); | ||
| 228 | // } | ||
| 229 | // // 不然就让当前的一行勾选 | ||
| 230 | // else { | ||
| 231 | // this.$refs.table.toggleRowSelection(row, true); | ||
| 232 | // } | ||
| 233 | // }) | ||
| 234 | // } | ||
| 235 | // else { | ||
| 236 | // this.$refs.table.toggleRowSelection(row, true); | ||
| 237 | // } | ||
| 238 | // } else { | ||
| 239 | // this.$refs.table.toggleRowSelection(row); | ||
| 240 | // } | ||
| 241 | let refs = 'table'; | ||
| 209 | if (this.sqywInfo.sqywdylx == "1") { | 242 | if (this.sqywInfo.sqywdylx == "1") { |
| 210 | const bdcdysz = this.bdcdysz | 243 | this.bdcdysz = [row] |
| 211 | this.$refs.table.clearSelection() | 244 | this.radioVal = row.bdcdyid |
| 212 | if (bdcdysz.length == 1) { | ||
| 213 | bdcdysz.forEach(item => { | ||
| 214 | // 判断 如果当前的一行被勾选, 再次点击的时候就会取消选中 | ||
| 215 | if (item == row) { | ||
| 216 | this.$refs.table.toggleRowSelection(row, false); | ||
| 217 | } | ||
| 218 | // 不然就让当前的一行勾选 | ||
| 219 | else { | ||
| 220 | this.$refs.table.toggleRowSelection(row, true); | ||
| 221 | } | ||
| 222 | }) | ||
| 223 | } | ||
| 224 | else { | ||
| 225 | this.$refs.table.toggleRowSelection(row, true); | ||
| 226 | } | ||
| 227 | } else { | 245 | } else { |
| 228 | this.$refs.table.toggleRowSelection(row); | 246 | this.$refs[refs].toggleRowSelection(row) |
| 229 | } | 247 | } |
| 230 | }, | 248 | }, |
| 231 | /** | 249 | /** |
| ... | @@ -250,8 +268,6 @@ | ... | @@ -250,8 +268,6 @@ |
| 250 | * @author: miaofang | 268 | * @author: miaofang |
| 251 | */ | 269 | */ |
| 252 | handleLpbClick (item) { | 270 | handleLpbClick (item) { |
| 253 | console.log("item", item); | ||
| 254 | console.log("this.sqywInfo", this.sqywInfo); | ||
| 255 | this.$popup('楼盘表', 'lpb/index', { | 271 | this.$popup('楼盘表', 'lpb/index', { |
| 256 | width: '85%', | 272 | width: '85%', |
| 257 | formData: { | 273 | formData: { |
| ... | @@ -264,7 +280,7 @@ | ... | @@ -264,7 +280,7 @@ |
| 264 | onlyShow: false | 280 | onlyShow: false |
| 265 | } | 281 | } |
| 266 | }) | 282 | }) |
| 267 | }, | 283 | } |
| 268 | } | 284 | } |
| 269 | } | 285 | } |
| 270 | </script> | 286 | </script> | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Description: | 2 | * @Description: |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2023-11-16 13:59:21 | 4 | * @LastEditTime: 2024-01-17 13:26:03 |
| 5 | --> | 5 | --> |
| 6 | <template> | 6 | <template> |
| 7 | <div class="from-clues"> | 7 | <div class="from-clues"> |
| ... | @@ -38,7 +38,7 @@ | ... | @@ -38,7 +38,7 @@ |
| 38 | <!-- 表格 --> | 38 | <!-- 表格 --> |
| 39 | <div class="from-clues-content loadingtext"> | 39 | <div class="from-clues-content loadingtext"> |
| 40 | <lb-table ref="table" @row-click="handleRowClick" :page-size="pageData.pageSize" :calcHeight="300" | 40 | <lb-table ref="table" @row-click="handleRowClick" :page-size="pageData.pageSize" :calcHeight="300" |
| 41 | :current-page.sync="pageData.currentPage" :total="tableData.total" @size-change="handleSizeChange" @select="select" | 41 | :current-page.sync="pageData.currentPage" :total="tableData.total" @size-change="handleSizeChange" |
| 42 | @p-current-change="handleCurrentChange" @selection-change="handleSelectionChange" :column="tableData.columns" | 42 | @p-current-change="handleCurrentChange" @selection-change="handleSelectionChange" :column="tableData.columns" |
| 43 | :data="tableData.data"> | 43 | :data="tableData.data"> |
| 44 | </lb-table> | 44 | </lb-table> |
| ... | @@ -67,6 +67,7 @@ | ... | @@ -67,6 +67,7 @@ |
| 67 | }, | 67 | }, |
| 68 | data () { | 68 | data () { |
| 69 | return { | 69 | return { |
| 70 | radioVal: '', | ||
| 70 | loading: false, | 71 | loading: false, |
| 71 | queryForm: defaultParameters.defaultParameters(), | 72 | queryForm: defaultParameters.defaultParameters(), |
| 72 | tableData: { | 73 | tableData: { |
| ... | @@ -79,6 +80,28 @@ | ... | @@ -79,6 +80,28 @@ |
| 79 | }, | 80 | }, |
| 80 | mounted () { | 81 | mounted () { |
| 81 | sendThis(this); | 82 | sendThis(this); |
| 83 | if (this.sqywInfo.sqywdylx == "1") { | ||
| 84 | this.tableData.columns = [{ | ||
| 85 | label: '选择', | ||
| 86 | width: '50px', | ||
| 87 | render: (h, scope) => { | ||
| 88 | return ( | ||
| 89 | <div class="orgColumn"> | ||
| 90 | <el-radio onChange={() => { this.handleChange(scope.row) }} v-model={this.radioVal} label={scope.row.bdcdyid}> | ||
| 91 |   | ||
| 92 | </el-radio> | ||
| 93 | </div> | ||
| 94 | ) | ||
| 95 | } | ||
| 96 | }].concat(datas.columns()) | ||
| 97 | } else { | ||
| 98 | this.tableData.columns = | ||
| 99 | [{ | ||
| 100 | type: 'selection', | ||
| 101 | label: '全选', | ||
| 102 | width: '50' | ||
| 103 | }].concat(datas.columns()) | ||
| 104 | } | ||
| 82 | }, | 105 | }, |
| 83 | methods: { | 106 | methods: { |
| 84 | /** | 107 | /** |
| ... | @@ -155,23 +178,10 @@ | ... | @@ -155,23 +178,10 @@ |
| 155 | this.bdcdysz = val; | 178 | this.bdcdysz = val; |
| 156 | } | 179 | } |
| 157 | }, | 180 | }, |
| 158 | /** | 181 | handleChange () { |
| 159 | * @description: select | 182 | let arr = this.tableData.data.filter(item => item.bdcdyid == this.radioVal) |
| 160 | * @param {*} selection | 183 | this.bdcdysz = arr |
| 161 | * @param {*} row | ||
| 162 | * @author: renchao | ||
| 163 | */ | ||
| 164 | select (selection, row) { | ||
| 165 | if (this.sqywInfo.sqywdylx == "1") { | ||
| 166 | // 清除 所有勾选项 | ||
| 167 | this.$refs.table.clearSelection() | ||
| 168 | // 当表格数据都没有被勾选的时候 就返回 | ||
| 169 | // 主要用于将当前勾选的表格状态清除 | ||
| 170 | if (selection.length == 0) return | ||
| 171 | this.$refs.table.toggleRowSelection(row, true); | ||
| 172 | } | ||
| 173 | }, | 184 | }, |
| 174 | |||
| 175 | /** | 185 | /** |
| 176 | * @description: handleRowClick | 186 | * @description: handleRowClick |
| 177 | * @param {*} row | 187 | * @param {*} row |
| ... | @@ -179,26 +189,33 @@ | ... | @@ -179,26 +189,33 @@ |
| 179 | */ | 189 | */ |
| 180 | handleRowClick (row) { | 190 | handleRowClick (row) { |
| 181 | // 如果状态是1,那就是单选 | 191 | // 如果状态是1,那就是单选 |
| 192 | // if (this.sqywInfo.sqywdylx == "1") { | ||
| 193 | // const bdcdysz = this.bdcdysz | ||
| 194 | // this.$refs.table.clearSelection() | ||
| 195 | // if (bdcdysz.length == 1) { | ||
| 196 | // bdcdysz.forEach(item => { | ||
| 197 | // // 判断 如果当前的一行被勾选, 再次点击的时候就会取消选中 | ||
| 198 | // if (item == row) { | ||
| 199 | // this.$refs.table.toggleRowSelection(row, false); | ||
| 200 | // } | ||
| 201 | // // 不然就让当前的一行勾选 | ||
| 202 | // else { | ||
| 203 | // this.$refs.table.toggleRowSelection(row, true); | ||
| 204 | // } | ||
| 205 | // }) | ||
| 206 | // } | ||
| 207 | // else { | ||
| 208 | // this.$refs.table.toggleRowSelection(row, true); | ||
| 209 | // } | ||
| 210 | // } else { | ||
| 211 | // this.$refs.table.toggleRowSelection(row); | ||
| 212 | // } | ||
| 213 | let refs = 'table'; | ||
| 182 | if (this.sqywInfo.sqywdylx == "1") { | 214 | if (this.sqywInfo.sqywdylx == "1") { |
| 183 | const bdcdysz = this.bdcdysz | 215 | this.bdcdysz = [row] |
| 184 | this.$refs.table.clearSelection() | 216 | this.radioVal = row.bdcdyid |
| 185 | if (bdcdysz.length == 1) { | ||
| 186 | bdcdysz.forEach(item => { | ||
| 187 | // 判断 如果当前的一行被勾选, 再次点击的时候就会取消选中 | ||
| 188 | if (item == row) { | ||
| 189 | this.$refs.table.toggleRowSelection(row, false); | ||
| 190 | } | ||
| 191 | // 不然就让当前的一行勾选 | ||
| 192 | else { | ||
| 193 | this.$refs.table.toggleRowSelection(row, true); | ||
| 194 | } | ||
| 195 | }) | ||
| 196 | } | ||
| 197 | else { | ||
| 198 | this.$refs.table.toggleRowSelection(row, true); | ||
| 199 | } | ||
| 200 | } else { | 217 | } else { |
| 201 | this.$refs.table.toggleRowSelection(row); | 218 | this.$refs[refs].toggleRowSelection(row) |
| 202 | } | 219 | } |
| 203 | }, | 220 | }, |
| 204 | /** | 221 | /** | ... | ... |
| 1 | /* | 1 | /* |
| 2 | * @Description: | 2 | * @Description: |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2024-01-17 09:59:04 | 4 | * @LastEditTime: 2024-01-17 11:07:55 |
| 5 | */ | 5 | */ |
| 6 | import filter from '@/utils/filter.js' | 6 | import filter from '@/utils/filter.js' |
| 7 | let vm = null | 7 | let vm = null |
| ... | @@ -15,10 +15,10 @@ class data extends filter { | ... | @@ -15,10 +15,10 @@ class data extends filter { |
| 15 | } | 15 | } |
| 16 | columns () { | 16 | columns () { |
| 17 | return [ | 17 | return [ |
| 18 | { | 18 | // { |
| 19 | type: 'selection', | 19 | // type: 'selection', |
| 20 | label: '全选', | 20 | // label: '全选', |
| 21 | }, | 21 | // }, |
| 22 | { | 22 | { |
| 23 | label: '序号', | 23 | label: '序号', |
| 24 | type: 'index', | 24 | type: 'index', | ... | ... |
| 1 | /* | 1 | /* |
| 2 | * @Description: | 2 | * @Description: |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2023-07-14 17:00:07 | 4 | * @LastEditTime: 2024-01-17 13:24:00 |
| 5 | */ | 5 | */ |
| 6 | import filter from '@/utils/filter.js' | 6 | import filter from '@/utils/filter.js' |
| 7 | let vm = null | 7 | let vm = null |
| ... | @@ -15,11 +15,11 @@ class data extends filter { | ... | @@ -15,11 +15,11 @@ class data extends filter { |
| 15 | } | 15 | } |
| 16 | columns () { | 16 | columns () { |
| 17 | return [ | 17 | return [ |
| 18 | { | 18 | // { |
| 19 | type: 'selection', | 19 | // type: 'selection', |
| 20 | label: '全选', | 20 | // label: '全选', |
| 21 | selectable: this.selected | 21 | // selectable: this.selected |
| 22 | }, | 22 | // }, |
| 23 | { | 23 | { |
| 24 | label: '序号', | 24 | label: '序号', |
| 25 | type: 'index', | 25 | type: 'index', | ... | ... |
-
Please register or sign in to post a comment