最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

ElementUI嵌套頁(yè)面及關(guān)聯(lián)增刪查改實(shí)現(xiàn)示例

 更新時(shí)間:2022年07月24日 08:50:29   作者:folyh  
本文主要介紹了ElementUI嵌套頁(yè)面及關(guān)聯(lián)增刪查改實(shí)現(xiàn)示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧

前言

本文大概內(nèi)容:
例如:隨著ElementUI前后端交互的技術(shù)的更新,用戶的的體驗(yàn)越來(lái)越好。本文主要針對(duì)用戶在保持原頁(yè)面結(jié)構(gòu),再添加另一個(gè)頁(yè)面,并可以按需要調(diào)整兩個(gè)頁(yè)面之間的比例大小.

一、ElementUI如何在原有頁(yè)面添加另外一個(gè)頁(yè)面并實(shí)現(xiàn)關(guān)聯(lián)增刪查改?

示例:如下圖,我們?cè)谠瓉?lái)頁(yè)面增刪查改及基礎(chǔ)上,選中某一行,點(diǎn)擊該公司后,直接在該頁(yè)面展示關(guān)聯(lián)的所有企業(yè)客戶的頁(yè)面,并且實(shí)現(xiàn)查詢、批量刪除、分頁(yè)等功能。(注意:彈框也可以實(shí)現(xiàn),但是我們希望可以少去打開(kāi)及關(guān)閉彈框的操作步驟,而且同一頁(yè)面顯示更直接、方便)

如:要展示的頁(yè)面

二、實(shí)現(xiàn)步驟

1.ElementUI代碼

第1頁(yè)面的代碼如下(示例):

// 前面搜索框的代碼省略....
<el-table stripe style="width:100%;" ref="table" :data="tableData" :default-sort="defaultSort"
             height="600px"  row-key="id" highlight-current-row @row-click="companyClick"
             @selection-change="handleSelection" @sort-change="handleSort">
       <el-table-column  prop="id" label="ID" type="selection"></el-table-column>
       <el-table-column type="index" width="60px" label="行號(hào)"></el-table-column>
       <el-table-column  prop="name" label="單位名稱" width="300"></el-table-column>
       <el-table-column  prop="type" label="單位類型" width="100">
           <template slot-scope="scope">
               <el-tag v-if="scope.row.type === 'A'" size="small" type="warning">A類(收稅)</el-tag>
               <el-tag v-else size="small" type="success">B類(免稅)</el-tag>
           </template>
       </el-table-column>
// 中間省略若干....
       <el-table-column fixed="right" label="操作" width="100">
           <template slot-scope="scope">
               <el-button size="mini" type="success" icon="icon iconfont icon-jihuopeizhi"
                          @click="handleInvCo(scope.row)">修改
               </el-button>
           </template>
       </el-table-column>
   </el-table>

   <el-pagination background highlight-current-row
                  @size-change="handleSizeChange" @current-change="handleCurChange"
                  :current-page="curPage" :page-size="pageSize" :page-sizes="pageSizes" :total="total"
                  layout="prev, pager, next, total, sizes, jumper">
   </el-pagination>

第2頁(yè)面的代碼如下(示例):

<span slot="header">關(guān)聯(lián)企業(yè)</span>
       <el-form ref="companySearchForm" :model="filterParams" :inline="true"  >
           <el-form-item >
               <el-input v-model="filterParams.companyName" placeholder="企業(yè)名稱" size="mini"></el-input>
           </el-form-item>
           <el-form-item>
               <el-button type="primary" icon="el-icon-search" @click="getPageCompany" size="mini">查詢</el-button>
           </el-form-item>
       </el-form>
           <el-button type="danger" icon="el-icon-delete" @click="deleteAll" size="mini">刪除</el-button>
       <el-table ref="table" :data="companyTableData" height="540px"   @selection-change="handleSelection">
           <el-table-column prop="companyid" label="companyid" type="selection"  width="55"></el-table-column>
           <el-table-column prop="companyName" label="企業(yè)名稱"></el-table-column>
       </el-table>
       <el-pagination  background  layout="prev, pager, next" :total="pageTotal" @current-change="currentChange" >
       </el-pagination>

2.思路:很簡(jiǎn)單

1.1 首先通過(guò)el-row、el-col、el-card等將兩個(gè)頁(yè)面組合在一起。

1.2 其次在首頁(yè)el-table 欄內(nèi)設(shè)置 @row-click="companyClick"點(diǎn)擊事件,并且設(shè)置點(diǎn)擊時(shí)高亮,highlight-current-row

1.3 第2頁(yè)面其實(shí)跟第1頁(yè)面都差不多,但是要注意像表格數(shù)據(jù)映射名字要換一個(gè)名字ref="table" :data="companyTableData",及分頁(yè)也要換一個(gè)名字el-pagination :total="pageTotal" @current-change="currentChange"

1.3 最后兩個(gè)頁(yè)面的elementui代碼如下:

 <el-row :gutter="24">
                    <el-col :span="16">
                        <el-card>
                            <span slot="header">開(kāi)票單位</span>
                            <div>
                                <el-row>
                                    <el-button size="mini"  type="primary" icon="el-icon-circle-plus-outline" @click="addInvCo()">添加</el-button>
                                    <el-button type="warning" icon="el-icon-delete" size="mini" @click="handleDeletes()">刪除</el-button>
                                </el-row>


                                <el-table stripe style="width:100%;" ref="table" :data="tableData" :default-sort="defaultSort"
                                          height="600px"  row-key="id" highlight-current-row @row-click="companyClick"
                                          @selection-change="handleSelection" @sort-change="handleSort">
                                    <el-table-column  prop="id" label="ID" type="selection"></el-table-column>
                                    <el-table-column type="index" width="60px" label="行號(hào)"></el-table-column>
                                    <el-table-column  prop="name" label="單位名稱" width="300"></el-table-column>
                                    <el-table-column  prop="type" label="單位類型" width="100">
                                        <template slot-scope="scope">
                                            <el-tag v-if="scope.row.type === 'A'" size="small" type="warning">A類(收稅)</el-tag>
                                            <el-tag v-else size="small" type="success">B類(免稅)</el-tag>
                                        </template>
                                    </el-table-column>
                                    <el-table-column  prop="license" label="執(zhí)照編號(hào)" width="300"></el-table-column>
                                    <el-table-column  prop="legalPerson" label="法人" width="150"></el-table-column>

                                    <el-table-column fixed="right" label="操作" width="100">
                                        <template slot-scope="scope">
                                            <el-button size="mini" type="success" icon="icon iconfont icon-jihuopeizhi"
                                                       @click="handleInvCo(scope.row)">修改
                                            </el-button>
                                        </template>
                                    </el-table-column>
                                </el-table>
                                <el-row style="text-align: right;margin-top: 10px">
                                    <el-pagination background highlight-current-row
                                                   @size-change="handleSizeChange" @current-change="handleCurChange"
                                                   :current-page="curPage" :page-size="pageSize" :page-sizes="pageSizes" :total="total"
                                                   layout="prev, pager, next, total, sizes, jumper">
                                    </el-pagination>
                                </el-row>
                            </div>
                        </el-card>
                    </el-col>
                    <el-col :span="8">
                        <el-card>
                            <span slot="header">關(guān)聯(lián)企業(yè)</span>
                            <div>
                                <el-form ref="companySearchForm" :model="filterParams" :inline="true"  >
                                    <el-form-item >
                                        <el-input v-model="filterParams.companyName" placeholder="企業(yè)名稱" size="mini"></el-input>
                                    </el-form-item>
                                    <el-form-item>
                                        <el-button type="primary" icon="el-icon-search" @click="getPageCompany" size="mini">查詢</el-button>
                                    </el-form-item>
                                </el-form>
                                <el-row>
                                    <el-button type="danger" icon="el-icon-delete" @click="deleteAll" size="mini">刪除</el-button>
                                </el-row>
                                <el-table ref="table" :data="companyTableData" height="540px"   @selection-change="handleSelection">
                                    <el-table-column prop="companyid" label="companyid" type="selection"  width="55"></el-table-column>
                                    <el-table-column prop="companyName" label="企業(yè)名稱"></el-table-column>
                                </el-table>
                                <el-row style="text-align: right;margin-top: 10px">
                                    <el-pagination  background  layout="prev, pager, next" :total="pageTotal" @current-change="currentChange" >
                                    </el-pagination>
                                </el-row>
                            </div>
                        </el-card>
                    </el-col>
                </el-row>

js代碼:主要是以下方法調(diào)用理清關(guān)系

上述方法代碼如下:

	// 點(diǎn)擊開(kāi)票單位獲取相關(guān)公司客戶
	companyClick: function(row){
              var _this = this;
              _this.filterParams.current = 1;
              _this.filterParams.invoiceCompanyid = row.id;
              _this.getPageCompany();
          },
      // 第2頁(yè)面根據(jù)不同頁(yè)面查詢結(jié)果
     currentChange: function (current) {
                this.filterParams.current = current;
                this.getPageCompany();
            },
       // 第2頁(yè)面查詢公司客戶的方法(上述點(diǎn)擊查詢方法也是這個(gè))
      getPageCompany: function(){
               var _this = this;
               _this.doGetData(_this.companyBindListUrl,_this.filterParams,function (r) {
                   if(r.success){
                       _this.companyTableData = r.data;
                       _this.pageTotal = r.total;
                   }
               })
           },
           

3.最后的頁(yè)面如下:

 到此這篇關(guān)于ElementUI嵌套頁(yè)面及關(guān)聯(lián)增刪查改實(shí)現(xiàn)示例的文章就介紹到這了,更多相關(guān)Element嵌套頁(yè)面及關(guān)聯(lián)增刪查改內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論

青州市| 南开区| 岚皋县| 普陀区| 河源市| 浙江省| 临城县| 岑巩县| 吴川市| 彰化县| 江永县| 天峨县| 鄂托克旗| 普宁市| 辽阳县| 彭山县| 保德县| 封丘县| 册亨县| 托里县| 新闻| 北票市| 阿勒泰市| 凤翔县| 苏尼特左旗| 福安市| 迁西县| 潞西市| 明溪县| 江北区| 宿松县| 临武县| 莫力| 武陟县| 宜州市| 修文县| 红安县| 孝义市| 宝丰县| 凌海市| 恩平市|