浏览代码

2022.7.11 项目列表后台排序

ggooalice 2 年之前
父节点
当前提交
404abeac91
共有 1 个文件被更改,包括 31 次插入7 次删除
  1. 31 7
      fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

+ 31 - 7
fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

@@ -107,7 +107,7 @@
         </el-col>
         </el-col>
 
 
         <!--列表-->
         <!--列表-->
-        <el-table ref="projectlistOfWudulist" :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;" @selection-change="checkedWudulist">
+        <el-table ref="projectlistOfWudulist" :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;" @selection-change="checkedWudulist" @sort-change="tableSort">
             <el-table-column type="selection" width="60" :selectable="isSelectable">
             <el-table-column type="selection" width="60" :selectable="isSelectable">
                 <!-- creator 项目创建人    incharger 项目负责人 -->
                 <!-- creator 项目创建人    incharger 项目负责人 -->
             </el-table-column>
             </el-table-column>
@@ -140,7 +140,7 @@
                      </div>
                      </div>
                 </template>
                 </template>
             </el-table-column>
             </el-table-column>
-            <el-table-column prop="inchargerName" label="负责人" sortable min-width="150">
+            <el-table-column prop="inchargerName" label="负责人" sortable="custom" min-width="150">
                 <template slot-scope="scope">
                 <template slot-scope="scope">
                     <el-link type="primary" :underline="false" @click="showUser(scope.row.inchargerId)">{{scope.row.inchargerName}}</el-link>
                     <el-link type="primary" :underline="false" @click="showUser(scope.row.inchargerId)">{{scope.row.inchargerName}}</el-link>
                 </template>
                 </template>
@@ -171,7 +171,7 @@
                 </template>
                 </template>
             </el-table-column>
             </el-table-column>
             <!-- 客户管理 -->
             <!-- 客户管理 -->
-            <el-table-column prop="customerName" label="客户" min-width="190"   v-if="user.company.packageCustomer == 1">
+            <el-table-column prop="customerName" label="客户" min-width="190"   v-if="user.company.packageCustomer == 1" sortable="custom">
             <template slot-scope="scope">
             <template slot-scope="scope">
                 <el-popover placement="top" width="250" trigger="hover" v-if="scope.row.customerName&&scope.row.customerName.length > 12">
                 <el-popover placement="top" width="250" trigger="hover" v-if="scope.row.customerName&&scope.row.customerName.length > 12">
                     <div slot="reference" class="kans">
                     <div slot="reference" class="kans">
@@ -905,7 +905,9 @@ a {
                 deleteVif: null,
                 deleteVif: null,
                 isAddGroupPerson: true,
                 isAddGroupPerson: true,
                 projectMainId: '',
                 projectMainId: '',
-                supplierList: ''
+                supplierList: '',
+                sortProp: '',
+                sortOrder: null
             };
             };
         },
         },
         // 过滤器
         // 过滤器
@@ -938,6 +940,13 @@ a {
             }
             }
         },
         },
         methods: {
         methods: {
+            tableSort({column, prop, order}){
+                if(prop == 'inchargerName' || prop == 'customerName'){
+                    this.sortOrder = order
+                    this.sortProp = prop
+                    this.getList()
+                }
+            },
             //获取项目列表
             //获取项目列表
             getSupplierList() {
             getSupplierList() {
                 this.http.post('/provider-info/list', {
                 this.http.post('/provider-info/list', {
@@ -2282,7 +2291,7 @@ a {
             //获取项目列表
             //获取项目列表
             getList() {
             getList() {
                 this.listLoading = true;
                 this.listLoading = true;
-                this.http.post(this.port.project.listPage, {
+                let parameter = {
                     pageIndex: this.page,
                     pageIndex: this.page,
                     pageSize: this.size,
                     pageSize: this.size,
                     keyword:this.keyword,
                     keyword:this.keyword,
@@ -2290,8 +2299,23 @@ a {
                     status: this.status,
                     status: this.status,
                     category: this.statusClf,
                     category: this.statusClf,
                     projectMainId: this.projectMainId
                     projectMainId: this.projectMainId
-                    // 
-                },
+                }
+                if(this.sortOrder == 'descending'){
+                    if(this.sortProp == 'inchargerName'){
+                        parameter.sortProp = "incharger_id"
+                    }else{
+                        parameter.sortProp = "customer_id"
+                    }
+                    parameter.sortOrder = 0
+                }else if(this.sortOrder == 'ascending'){
+                    if(this.sortProp == 'inchargerName'){
+                        parameter.sortProp = "incharger_id"
+                    }else{
+                        parameter.sortProp = "customer_id"
+                    }
+                    parameter.sortOrder = 1
+                }
+                this.http.post(this.port.project.listPage, parameter,
                 res => {
                 res => {
                     this.listLoading = false;
                     this.listLoading = false;
                     if (res.code == "ok") {
                     if (res.code == "ok") {