国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

vxe-table 表格多選框回顯

這篇具有很好參考價值的文章主要介紹了vxe-table 表格多選框回顯。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

1.彈框表格結(jié)構(gòu)

vxe-table 表格多選框回顯

?文章來源地址http://www.zghlxwxcb.cn/news/detail-460753.html

<a-modal

? ? ? ? ? ? ? v-if="visibleQuality"

? ? ? ? ? ? ? title="請選擇需要提高的能力素質(zhì)要求"

? ? ? ? ? ? ? :maskClosable="false"

? ? ? ? ? ? ? :visible="visibleQuality && switchStatus"

? ? ? ? ? ? ? @ok="handleOkQuality"

? ? ? ? ? ? ? @cancel="handleCancelQuality"

? ? ? ? ? ? ? cancelText="取消"

? ? ? ? ? ? ? okText="確定"

? ? ? ? ? ? ? width="600px"

? ? ? ? ? ? >

? ? ? ? ? ? ? <a-spin :spinning="quaLoading" tip="加載中...">

? ? ? ? ? ? ? ? <vxe-table

? ? ? ? ? ? ? ? ? ref="qualityTable"

? ? ? ? ? ? ? ? ? row-id="id"

? ? ? ? ? ? ? ? ? :row-config="{ keyField: 'id', isHover: true }"

? ? ? ? ? ? ? ? ? :data="rowsQuality"

? ? ? ? ? ? ? ? ? :checkbox-config="checkboxConfig"

? ? ? ? ? ? ? ? ? width="600px"

? ? ? ? ? ? ? ? ? @checkbox-change="checkboxChange"

? ? ? ? ? ? ? ? ? @checkbox-all="checkBoxAll"

? ? ? ? ? ? ? ? >

? ? ? ? ? ? ? ? ? <vxe-column type="checkbox" width="60"></vxe-column>

? ? ? ? ? ? ? ? ? <vxe-column

? ? ? ? ? ? ? ? ? ? field="abilityContent"

? ? ? ? ? ? ? ? ? ? title="能力素質(zhì)要求"

? ? ? ? ? ? ? ? ? ? width="240"

? ? ? ? ? ? ? ? ? >

? ? ? ? ? ? ? ? ? ? <template #header>

? ? ? ? ? ? ? ? ? ? ? <span><span style="color: #f5222d">* </span> 能力素質(zhì)要求</span>

? ? ? ? ? ? ? ? ? ? </template>

? ? ? ? ? ? ? ? ? </vxe-column>

? ? ? ? ? ? ? ? ? <vxe-column

? ? ? ? ? ? ? ? ? ? field="explain"

? ? ? ? ? ? ? ? ? ? title="能力素質(zhì)要求說明"

? ? ? ? ? ? ? ? ? ? width="240"

? ? ? ? ? ? ? ? ? ></vxe-column>

? ? ? ? ? ? ? ? </vxe-table>

? ? ? ? ? ? ? </a-spin>

? ? ? ? ? ? </a-modal>

2. 數(shù)據(jù)?

data() {

? ?return {

? ? ? ?checkboxConfig: {}, // 默認(rèn)選中

? ? ?}

}

3. 實現(xiàn)方法,首先要異步處理,等待數(shù)據(jù)加載完畢,再去回顯

3.1 第一種方法:

ps:(重要提示)設(shè)置checkboxConfig默認(rèn)選中第一次有效,第二次無效,處理:請求數(shù)據(jù)點擊人員時候提前請求拿到數(shù)據(jù),給能力素質(zhì)彈框加v-if重新創(chuàng)建

? ? ? ? let arr = []

? ? ? ? this.qualityRows.map(v => {

? ? ? ? ? arr.push(v.abilityCode)

? ? ? ? })

? ? ? ? this.$nextTick(() => {

? ? ? ? ? this.checkboxConfig = {

? ? ? ? ? ? checkRowKeys: arr

? ? ? ? ? }

? ? ? ? ? this.checkboxConfig.checkRowKeys = arr

? ? ? ? ? // this.$set(this.checkboxConfig, 'checkRowKeys', arr)

? ? ? ? })

3.2?第二種方法:

// 第二種方法過濾得到新數(shù)組arr

? ? ? ? let arr = []

? ? ? ? if (this.rowsQuality && this.qualityRows) {

? ? ? ? ? this.rowsQuality.map(v => {

? ? ? ? ? ? this.qualityRows.map(item => {

? ? ? ? ? ? ? if (item.abilityCode === v.id) {

? ? ? ? ? ? ? ? arr.push(v)

? ? ? ? ? ? ? }

? ? ? ? ? ? })

? ? ? ? ? })

? ? ? ? }

? ? ? ? this.$nextTick(() => {

? ? ? ? ? this.$refs.qualityTable.clearCheckboxRow()

? ? ? ? ? this.$refs.qualityTable.setCheckboxRow(arr, true)

? ? ? ? })

3.3? 異步處理和回顯完整方法:(try,catch 配合async,await 異步處理)

async addQuality () {

? ? ? this.visibleQuality = true

? ? ? this.rowsQuality = []

? ? ? // 放在點擊人員時候請求,這里注釋掉

? ? ? this.quaLoading = true

? ? ? try {

? ? ? ? let params = {

? ? ? ? ? userId: this.currentRow.userId

? ? ? ? }

? ? ? ? let w = await Api.getAbility(params)

? ? ? ? this.rowsQuality = w.data // 需要選擇的能力項彈框的表格數(shù)據(jù)

? ? ? ? this.quaLoading = false

? ? ? ? this.$nextTick(() => {

? ? ? ? ? if (this.rowsQuality.length === 0) {

? ? ? ? ? ? this.demandPersonRows[this.currentRowIndex].improveAbility = false

? ? ? ? ? }

? ? ? ? })

? ? ? } catch (err) {

? ? ? ? this.quaLoading = false

? ? ? }

? ? ? if (this.rowsQuality.length === 0) {

? ? ? ? this.$message.warning('未設(shè)置能力素質(zhì)信息請聯(lián)系管理員!')

? ? ? } else {

? ? ? ? // 設(shè)置checkboxConfig默認(rèn)選中第一次有效,第二次無效,處理:請求數(shù)據(jù)點擊人員時候提前請求拿到數(shù)據(jù),給能力素質(zhì)彈框加v-if重新創(chuàng)建

? ? ? ? // let arr = []

? ? ? ? // this.qualityRows.map(v => {

? ? ? ? // ? arr.push(v.abilityCode)

? ? ? ? // })

? ? ? ? // this.$nextTick(() => {

? ? ? ? // ? this.checkboxConfig = {

? ? ? ? // ? ? checkRowKeys: arr

? ? ? ? // ? }

? ? ? ? // ? this.checkboxConfig.checkRowKeys = arr

? ? ? ? // ? // this.$set(this.checkboxConfig, 'checkRowKeys', arr)

? ? ? ? // })

? ? ? ? // rowsQuality:需要選擇的能力項彈框的表格數(shù)據(jù)(id),qualityRows:第三個表格能力素質(zhì)項表格數(shù)據(jù)(abilityCode)

? ? ? ? // 第一種方法過濾 得到條件item.abilityCode === v.id 為true 的新數(shù)組arr

? ? ? ? // let arr = this.rowsQuality.filter(v => {

? ? ? ? // ? let flag = false

? ? ? ? // ? this.qualityRows.map(item => {

? ? ? ? // ? ? if (item.abilityCode === v.id) {

? ? ? ? // ? ? ? return (flag = true)

? ? ? ? // ? ? }

? ? ? ? // ? });

? ? ? ? // ? if (flag) {

? ? ? ? // ? ? return true;

? ? ? ? // ? }

? ? ? ? // })

? ? ? ? // 第二種方法過濾得到新數(shù)組arr

? ? ? ? let arr = []

? ? ? ? if (this.rowsQuality && this.qualityRows) {

? ? ? ? ? this.rowsQuality.map(v => {

? ? ? ? ? ? this.qualityRows.map(item => {

? ? ? ? ? ? ? if (item.abilityCode === v.id) {

? ? ? ? ? ? ? ? arr.push(v)

? ? ? ? ? ? ? }

? ? ? ? ? ? })

? ? ? ? ? })

? ? ? ? }

? ? ? ? this.$nextTick(() => {

? ? ? ? ? this.$refs.qualityTable.clearCheckboxRow()

? ? ? ? ? this.$refs.qualityTable.setCheckboxRow(arr, true)

? ? ? ? })

? ? ? }

? ? }

vxe-table 表格多選框回顯

?

到了這里,關(guān)于vxe-table 表格多選框回顯的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • vxe-table實現(xiàn)表格行拖拽

    1.插件文檔 vex-table:https://vxetable.cn/v3/#/table/base/basic sortablejs: http://www.sortablejs.com/ 2.引入插件 vxe-table: sortablejs: 3.核心拖拽函數(shù) 渲染問題解決方法鏈接:sortablejs拖拽列表渲染問題 4.全代碼 全代碼

    2024年02月16日
    瀏覽(22)
  • vxe-table表格合并單元格和編輯

    vxe-table表格合并單元格和編輯

    //這是在vue上面引用vxe-table插件實現(xiàn)的,主要方法都設(shè)置在table中,mergeCells,tableData都是在vue頁面的data初使化數(shù)據(jù), :footer-method=“footerMethod”:尾部數(shù)據(jù),:merge-footer-items=“mergeCells”:尾部合并單元格。vxe-table網(wǎng)址:https://vxetable.cn/#/table/advanced/footerSpan

    2023年04月09日
    瀏覽(39)
  • vue表格插件vxe-table導(dǎo)出 excel

    vxe-table 默認(rèn)支持導(dǎo)出 CSV、HTML、XML、TXT格式的文件,不支持 xlsx 文件 要想導(dǎo)出 xlsx 文件,需要使用 vxe-table-plugin-export-xlsx 依賴 ?參考:https://cnpmjs.org/package/vxe-table-plugin-export-xlsx/v/2.1.0-beta 1.安裝 ?例子: 如果用最新版的,依賴,這樣使用就會報錯 Uncaught (in promise) 親測2.2.2版

    2024年01月22日
    瀏覽(29)
  • vxe-table 小眾但功能齊全的vue表格組件

    vxe-table 小眾但功能齊全的vue表格組件

    一個基于 vue 的 PC 端表格組件,除了一般表格支持的增刪改查、排序、篩選、對比、樹形結(jié)構(gòu)、數(shù)據(jù)分頁等,它還支持虛擬滾動、懶加載、打印導(dǎo)出、虛擬列表、虛擬滾動、模態(tài)窗口、自定義模板、渲染器、賊靈活的配置項、擴展接口等,特別是能支持類似excel表格操作方式

    2024年02月08日
    瀏覽(24)
  • vxe-table中<vxe-grid>組件中表格數(shù)據(jù)排序問題sort-change

    vxe-table中<vxe-grid>組件中表格數(shù)據(jù)排序問題sort-change

    問題描述,首先使用vxe-grid虛擬列表為了同時渲染大批量數(shù)據(jù)的,但是從iview ui里的table和element ui 里table都是只能渲染少量數(shù)據(jù),達不到大批量數(shù)據(jù)渲染,所以改用vxe-grid。 但是有個排序的問題在iview ui和element ui 里table都不會存在排序混亂的問題,而vxe-grid里的排序會有問題,

    2024年02月16日
    瀏覽(36)
  • el-table(type=“selection“)多選框兩種回顯

    el-table(type=“selection“)多選框兩種回顯

    目錄 一、前端數(shù)據(jù)回顯(頁面間數(shù)據(jù)展示) 1、圖片幫助理解 2、描述: 3、代碼 4、兩個API,一個v-model 二、數(shù)據(jù)庫數(shù)據(jù)回顯 ?1、描述: 2、核心代碼: 3、比較完整代碼:(這是element ui官方文檔上的) 4、改動過的,更加適應(yīng)現(xiàn)實場景的代碼: ? ? 幾個注意點: 1、圖片幫助理解

    2024年02月02日
    瀏覽(19)
  • el-table select 多選框如何實現(xiàn)選中數(shù)據(jù)回顯

    el-table select 多選框如何實現(xiàn)選中數(shù)據(jù)回顯

    現(xiàn)象描述: 將用戶勾選的內(nèi)容添加到表格,當(dāng)頁面還未關(guān)閉時,選項還是正常勾選,但是只要退出該頁面,再進來就會發(fā)現(xiàn)勾選被取消了 需求描述: 已選擇項默認(rèn)勾選,且表格內(nèi)容更改,勾選項也同步更改 效果如下:

    2024年02月14日
    瀏覽(22)
  • el-table 多個表格切換多選框顯示bug

    el-table 多個表格切換多選框顯示bug

    今天寫了個功能,點擊左側(cè)的樹做判斷,一級樹節(jié)點顯示系統(tǒng)頁面,二級樹節(jié)點顯示數(shù)據(jù)庫頁面,三級樹節(jié)點顯示表頁面。 數(shù)據(jù)庫頁面和表頁面分別有2個el-table? ,上面的沒有多選框,下面的有多選框 ?現(xiàn)在出現(xiàn)bug,在點擊樹節(jié)點,代碼: // 點擊節(jié)點 ? ? nodeClick(data) { ? ?

    2024年02月11日
    瀏覽(20)
  • vxe-table中樹形結(jié)構(gòu)

    vxe-table中樹形結(jié)構(gòu)

    如圖,同事讓幫忙實現(xiàn)一個需求 ?從二級樹節(jié)點開始,同時選中的只能有一個二級樹節(jié)點,選中的二級樹節(jié)點之下的子節(jié)點都可以被選中。否則不能被選中 直接上代碼 需要注意的是,文中樹狀圖傳遞的數(shù)據(jù)是打平的數(shù)據(jù),設(shè)置代碼是下圖,而不是樹狀圖!! ?上述的這一點非常

    2024年02月10日
    瀏覽(31)
  • element-ui的el-table表格復(fù)選框只能單選,不可多選

    element-ui的el-table表格復(fù)選框只能單選,不可多選

    element的el-table表格復(fù)選框只能選中一條,選擇下一條,上一條去掉勾選。使用文檔中select方法,el-table綁定一個ref。具體代碼實現(xiàn)如下 toggleRowSelection:用于多選表格,切換某一行的選中狀態(tài),如果使用了第二個參數(shù),則是設(shè)置這一行選中與否(selected 為 true 則選中)?

    2024年02月11日
    瀏覽(29)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包