Browse Source

feat(projectinfo): 增加项目排序功能

duy 1 month ago
parent
commit
2af597a5b2

+ 12 - 4
src/views/manager/projectinfo/ContractSort.vue

@@ -8,13 +8,14 @@
     class="project-dialog"
   >  
   <span slot="title">
-            <i class="el-icon-sort" style="color: #2550A2;"></i>合同段排序
+            <i class="el-icon-sort" style="color: #2550A2;"></i>{{ title }}
     </span>
     <div class="sort-container">
       <!-- 提示信息 -->
       <div class="tip-box">
         <i class="el-icon-info"></i>
-        拖动项目可调整顺序,或者使用箭头按钮、输入序号进行排序
+             拖动项目可调整顺序,或者使用箭头按钮、输入序号进行排序
+
       </div>
 
       <!-- 排序列表 -->
@@ -30,7 +31,7 @@
         >
           <i class="el-icon-rank drag-handle"></i>
           <div class="item-content">
-            <span>{{ item.contractName }}</span>
+            <span>{{ item.contractName||item.projectAlias }}</span>
 
             <div class="item-actions">
                 <div class="move-btns">
@@ -80,7 +81,14 @@ export default {
   components: {
     draggable
   },
-  
+  props: {
+    // 添加 props
+    title: {
+      type: String,
+      default: '排序'
+    },
+   
+  },
   data() {
     return {
       sortList: [],

+ 14 - 4
src/views/manager/projectinfo/list.vue

@@ -29,7 +29,7 @@
       </el-select>
     </div>
     <div class="ml-10">
-      <el-button type="warning" icon="el-icon-sort" size="small">排序</el-button>
+      <el-button type="warning" icon="el-icon-sort" size="small" @click="sortPro">排序</el-button>
     </div>
     <div class="ml-10">
       <el-button type="warning" icon="el-icon-star-off" size="small" class="custom-primary-btn">收藏夹</el-button>
@@ -226,7 +226,8 @@
         <!-- 合同段排序弹窗 -->
         <ContractSort 
          ref="contractSortRef"
-       
+         :title="sortTitle"
+
         @confirm="handleSortConfirm"
       />
 </el-container>
@@ -335,6 +336,7 @@ export default {
     ],
       sortContractVisible: false, // 合同段排序弹窗
       sortContractList: [],
+      sortTitle: '合同段排序',
 
     }
   },
@@ -595,8 +597,8 @@ export default {
     sortContract(){
       // this.sortContractVisible = true;
       this.sortContractList = JSON.parse(JSON.stringify(this.contractList));
-      console.log( this.$refs.contractSortRef,' this.$refs.contractSortRef');
-      
+     this.sortTitle = '合同段排序';
+
       this.$nextTick(() => {
         this.$refs.contractSortRef.show(this.sortContractList);
       });
@@ -608,6 +610,14 @@ export default {
       // TODO: 调用接口保存排序结果
       this.contractList = [...sortedList];
       this.$message.success('排序成功');
+    },
+    sortPro(){
+        this.sortContractList = JSON.parse(JSON.stringify(this.projectList));
+        this.sortTitle = '项目排序';
+
+      this.$nextTick(() => {
+        this.$refs.contractSortRef.show(this.sortContractList);
+      });
     }
   }
 };