ソースを参照

Merge branch 'dev' into 'test'

渠道商盲票列表新增排序

See merge request quanshu/mp-ui-pc!178
hunagwb 3 年 前
コミット
2325b5522b
2 ファイル変更41 行追加15 行削除
  1. 20 8
      src/views/business/channel/childs.vue
  2. 21 7
      src/views/business/channel/index.vue

+ 20 - 8
src/views/business/channel/childs.vue

@@ -85,8 +85,8 @@
           <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
         </el-row>
 
-        <el-table v-loading="loading" :data="channelList">
-          <el-table-column label="渠道编号" prop="channelId" width="100px" />
+        <el-table v-loading="loading" :data="channelList" @sort-change="sortChannelId">
+          <el-table-column label="渠道编号" sortable="custom" prop="channelId" width="100px" />
           <el-table-column label="渠道名称" prop="name" show-overflow-tooltip  width="180px">
             <template slot-scope="scope">
               <el-button
@@ -101,7 +101,7 @@
             </template>
           </el-table-column>
           <el-table-column label="手机号码" prop="mobile" show-overflow-tooltip  width="120px"/>
-          <el-table-column label="佣金比例" prop="commRate">
+          <el-table-column label="佣金比例" sortable="custom" prop="commRate">
             <template slot-scope="scope">
               {{scope.row.commRate}}%
             </template>
@@ -111,8 +111,8 @@
               {{scope.row.level}}级渠道
             </template>
           </el-table-column>
-          <el-table-column label="经销商数" prop="siteCnt"  />
-          <el-table-column label="用户数" prop="userCnt"  />
+          <el-table-column label="经销商数" sortable="custom" prop="siteCnt"  />
+          <el-table-column label="用户数" sortable="custom" prop="userCnt"  />
           <el-table-column label="状态" key="statusV">
            <template slot-scope="{ row, column }">
                <el-tag :type="JSON.parse(row.status).value == '1' ? 'success' : 'info'">{{ JSON.parse(row.status).desc }}</el-tag>
@@ -251,7 +251,9 @@ export default {
       },
       pageParams: {
         pageNum: 1,
-        pageSize: 10
+        pageSize: 10,
+        orderByColumn: 'channelId',
+        isAsc: 'desc',
       }
     };
   },
@@ -268,7 +270,7 @@ export default {
     this.parentId = parentId
     this.queryParams.parentId = parentId
     this.queryParams.parentName = title
-    console.log("parentId == "+parentId+  "title == "+title)
+    // console.log("parentId == "+parentId+  "title == "+title)
    // this.$route.meta.title = title + " - 子渠道管理"
     if(parentId){
         this.initList();
@@ -284,7 +286,7 @@ export default {
     /** 查询用户列表 */
     getList() {
       this.loading = true;
-      listChannel('pageNum='+this.pageParams.pageNum + '&pageSize='+this.pageParams.pageSize+'&', this.queryParams).then(response => {
+      listChannel('pageNum='+this.pageParams.pageNum + '&pageSize='+this.pageParams.pageSize+'&orderByColumn='+ this.pageParams.orderByColumn +'&isAsc='+ this.pageParams.isAsc +'&', this.queryParams).then(response => {
           this.channelList = response.rows;
           this.channelList.forEach(item => {
               item.statusV = JSON.parse(item.status).value+""
@@ -295,6 +297,16 @@ export default {
       );
     },
 
+    //切换排序
+    sortChannelId(row){
+      if (row){
+        let prop =  row.prop == 'commRate' ? ('t1.'+ row.prop) : row.prop;
+        this.pageParams.orderByColumn = prop
+        this.pageParams.isAsc = row.order=='ascending'?"asc":"desc";
+        this.getList()
+      }
+    },
+
     // 省
    /* getProvinceList(){
       this.cityList = []

+ 21 - 7
src/views/business/channel/index.vue

@@ -113,8 +113,8 @@
           <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
         </el-row>
 
-        <el-table v-loading="loading" :data="channelList">
-          <el-table-column label="渠道编号" prop="channelId" width="100px" />
+        <el-table v-loading="loading" :data="channelList" @sort-change="sortChannelId" >
+          <el-table-column label="渠道编号" sortable="custom" prop="channelId" width="100px" />
           <el-table-column label="渠道名称" prop="name" show-overflow-tooltip  width="180px">
             <template slot-scope="scope">
               <el-button
@@ -129,7 +129,7 @@
             </template>
           </el-table-column>
           <el-table-column label="手机号码" prop="mobile" show-overflow-tooltip  width="120px"/>
-          <el-table-column label="佣金比例" prop="commRate">
+          <el-table-column label="佣金比例" prop="commRate" sortable="custom">
             <template slot-scope="scope">
               {{scope.row.commRate}}%
             </template>
@@ -139,8 +139,8 @@
               {{scope.row.level}}级渠道
             </template>
           </el-table-column>
-          <el-table-column label="经销商数" prop="siteCnt"  />
-          <el-table-column label="用户数" prop="userCnt"  />
+          <el-table-column label="经销商数" sortable="custom" prop="siteCnt"  />
+          <el-table-column label="用户数" sortable="custom" prop="userCnt"  />
           <el-table-column label="状态" key="statusV">
            <template slot-scope="{ row, column }">
              <el-tag :type="JSON.parse(row.status).value == '1' ? 'success' : 'info'">{{ JSON.parse(row.status).desc }}</el-tag>
@@ -282,7 +282,10 @@ export default {
       },
       pageParams: {
         pageNum: 1,
-        pageSize: 10
+        pageSize: 10,
+        orderByColumn: 'channelId',
+        isAsc: 'desc',
+
       }
     };
   },
@@ -303,7 +306,7 @@ export default {
     /** 查询用户列表 */
     getList() {
       this.loading = true;
-      listChannel('pageNum='+this.pageParams.pageNum + '&pageSize='+this.pageParams.pageSize+'&', this.queryParams).then(response => {
+      listChannel('pageNum='+this.pageParams.pageNum + '&pageSize='+this.pageParams.pageSize+'&orderByColumn='+ this.pageParams.orderByColumn +'&isAsc='+ this.pageParams.isAsc +'&', this.queryParams).then(response => {
           this.channelList = response.rows;
           this.channelList.forEach(item => {
               item.statusV = JSON.parse(item.status).value+""
@@ -334,6 +337,17 @@ export default {
       }
     },
 
+    //切换排序
+    sortChannelId(row){
+      if (row){
+        let prop =  row.prop == 'commRate' ? ('t1.'+ row.prop) : row.prop;
+        this.pageParams.orderByColumn = prop
+        this.pageParams.isAsc = row.order=='ascending'?"asc":"desc";
+        this.getList()
+      }
+
+    },
+
     refreshChannelTree(){
       treeChannel({}).then(response => {
          this.channelOptions = response.data