1
Showing
2 changed files
with
39 additions
and
42 deletions
1 | <!-- | 1 | <!-- |
2 | * @Description: | 2 | * @Description: |
3 | * @Autor: renchao | 3 | * @Autor: renchao |
4 | * @LastEditTime: 2024-01-17 17:25:09 | 4 | * @LastEditTime: 2024-01-18 15:56:28 |
5 | --> | 5 | --> |
6 | <template> | 6 | <template> |
7 | <div class="from-clues"> | 7 | <div class="from-clues"> |
... | @@ -33,7 +33,7 @@ | ... | @@ -33,7 +33,7 @@ |
33 | </el-input> | 33 | </el-input> |
34 | </el-form-item> | 34 | </el-form-item> |
35 | </el-col> | 35 | </el-col> |
36 | <el-col :span="8" class="btnColRight"> | 36 | <el-col :span="24" class="btnColRight"> |
37 | <el-form-item> | 37 | <el-form-item> |
38 | <el-button type="primary" @click="handleSearch">查询</el-button> | 38 | <el-button type="primary" @click="handleSearch">查询</el-button> |
39 | <el-button type="primary" @click="resetForm(true)">重置</el-button> | 39 | <el-button type="primary" @click="resetForm(true)">重置</el-button> |
... | @@ -45,7 +45,7 @@ | ... | @@ -45,7 +45,7 @@ |
45 | <!-- 表格 --> | 45 | <!-- 表格 --> |
46 | <div class="from-clues-content loadingtext"> | 46 | <div class="from-clues-content loadingtext"> |
47 | <lb-table ref="table" @row-click="handleRowClick" :page-size="pageData.pageSize" :calcHeight="300" | 47 | <lb-table ref="table" @row-click="handleRowClick" :page-size="pageData.pageSize" :calcHeight="300" |
48 | :current-page.sync="pageData.currentPage" :total="tableData.total" @size-change="handleSizeChange" @select="select" | 48 | :current-page.sync="pageData.currentPage" :total="tableData.total" @size-change="handleSizeChange" |
49 | @p-current-change="handleCurrentChange" @selection-change="handleSelectionChange" :column="tableData.columns" | 49 | @p-current-change="handleCurrentChange" @selection-change="handleSelectionChange" :column="tableData.columns" |
50 | :data="tableData.data"> | 50 | :data="tableData.data"> |
51 | </lb-table> | 51 | </lb-table> |
... | @@ -74,6 +74,7 @@ | ... | @@ -74,6 +74,7 @@ |
74 | }, | 74 | }, |
75 | data () { | 75 | data () { |
76 | return { | 76 | return { |
77 | radioVal: '', | ||
77 | loading: false, | 78 | loading: false, |
78 | queryForm: defaultParameters.defaultParameters(), | 79 | queryForm: defaultParameters.defaultParameters(), |
79 | tableData: { | 80 | tableData: { |
... | @@ -86,6 +87,28 @@ | ... | @@ -86,6 +87,28 @@ |
86 | }, | 87 | }, |
87 | mounted () { | 88 | mounted () { |
88 | sendThis(this); | 89 | sendThis(this); |
90 | if (this.sqywInfo.sqywdylx == "1") { | ||
91 | this.tableData.columns = [{ | ||
92 | label: '选择', | ||
93 | width: '50px', | ||
94 | render: (h, scope) => { | ||
95 | return ( | ||
96 | <div class="orgColumn"> | ||
97 | <el-radio onChange={() => { this.handleChange(scope.row) }} v-model={this.radioVal} label={scope.row.bdcdyid}> | ||
98 |   | ||
99 | </el-radio> | ||
100 | </div> | ||
101 | ) | ||
102 | } | ||
103 | }].concat(datas.columns()) | ||
104 | } else { | ||
105 | this.tableData.columns = | ||
106 | [{ | ||
107 | type: 'selection', | ||
108 | label: '全选', | ||
109 | width: '50' | ||
110 | }].concat(datas.columns()) | ||
111 | } | ||
89 | }, | 112 | }, |
90 | methods: { | 113 | methods: { |
91 | /** | 114 | /** |
... | @@ -158,21 +181,9 @@ | ... | @@ -158,21 +181,9 @@ |
158 | this.bdcdysz = val; | 181 | this.bdcdysz = val; |
159 | } | 182 | } |
160 | }, | 183 | }, |
161 | /** | 184 | handleChange () { |
162 | * @description: select | 185 | let arr = this.tableData.data.filter(item => item.bdcdyid == this.radioVal) |
163 | * @param {*} selection | 186 | this.bdcdysz = arr |
164 | * @param {*} row | ||
165 | * @author: renchao | ||
166 | */ | ||
167 | select (selection, row) { | ||
168 | if (this.sqywInfo.sqywdylx == "1") { | ||
169 | // 清除 所有勾选项 | ||
170 | this.$refs.table.clearSelection() | ||
171 | // 当表格数据都没有被勾选的时候 就返回 | ||
172 | // 主要用于将当前勾选的表格状态清除 | ||
173 | if (selection.length == 0) return | ||
174 | this.$refs.table.toggleRowSelection(row, true); | ||
175 | } | ||
176 | }, | 187 | }, |
177 | /** | 188 | /** |
178 | * @description: handleRowClick | 189 | * @description: handleRowClick |
... | @@ -181,26 +192,12 @@ | ... | @@ -181,26 +192,12 @@ |
181 | */ | 192 | */ |
182 | handleRowClick (row) { | 193 | handleRowClick (row) { |
183 | // 如果状态是1,那就是单选 | 194 | // 如果状态是1,那就是单选 |
195 | let refs = 'table'; | ||
184 | if (this.sqywInfo.sqywdylx == "1") { | 196 | if (this.sqywInfo.sqywdylx == "1") { |
185 | const bdcdysz = this.bdcdysz | 197 | this.bdcdysz = [row] |
186 | this.$refs.table.clearSelection() | 198 | this.radioVal = row.bdcdyid |
187 | if (bdcdysz.length == 1) { | ||
188 | bdcdysz.forEach(item => { | ||
189 | // 判断 如果当前的一行被勾选, 再次点击的时候就会取消选中 | ||
190 | if (item == row) { | ||
191 | this.$refs.table.toggleRowSelection(row, false); | ||
192 | } | ||
193 | // 不然就让当前的一行勾选 | ||
194 | else { | ||
195 | this.$refs.table.toggleRowSelection(row, true); | ||
196 | } | ||
197 | }) | ||
198 | } | ||
199 | else { | ||
200 | this.$refs.table.toggleRowSelection(row, true); | ||
201 | } | ||
202 | } else { | 199 | } else { |
203 | this.$refs.table.toggleRowSelection(row); | 200 | this.$refs[refs].toggleRowSelection(row) |
204 | } | 201 | } |
205 | }, | 202 | }, |
206 | /** | 203 | /** | ... | ... |
1 | /* | 1 | /* |
2 | * @Description: | 2 | * @Description: |
3 | * @Autor: renchao | 3 | * @Autor: renchao |
4 | * @LastEditTime: 2023-09-21 16:18:47 | 4 | * @LastEditTime: 2024-01-18 15:57:18 |
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