소스 검색

委托查询合并单元格

wyh 2 년 전
부모
커밋
f7a8a8d288
1개의 변경된 파일116개의 추가작업 그리고 14개의 파일을 삭제
  1. 116 14
      itdmWeb/src/views/module-iTDM/weituochaxun/ItdmWeituoYangpinList.vue

+ 116 - 14
itdmWeb/src/views/module-iTDM/weituochaxun/ItdmWeituoYangpinList.vue

@@ -154,24 +154,37 @@
         description: '委托样品管理页面',
         // 表头
         columns: [
+          // {
+          //   title: '#',
+          //   dataIndex: '',
+          //   key:'rowIndex',
+          //   width:60,
+          //   align:"center",
+          //   customRender:function (t,r,index) {
+          //     return parseInt(index)+1;
+          //   }
+          // },
           {
             title:'委托单位名称',
             align:"center",
             dataIndex: 'weituoClient',
-            customRender: (value, row, index) => {
-              console.log(value, row, index);
-              const obj = {
-                children: value,
-                attrs: {},
-              };
-              if(index === 0){   // 第一行数据开始,跨行合并的长度为数据data的长度
-                obj.attrs.rowSpan = this.dataSource.length;
-              }
-              if (index >= 1) {   // 从第一行往后的所有行表格均合并
-                obj.attrs.rowSpan = 0;
-              }
-              return obj;
-            }
+            // customRender:function (t,r,index) {
+            //   return {children: t,attrs: {rowSpan:r.rowSpan}};
+            // },
+            // customRender: (value, row, index) => {
+            //   console.log(value, row, index);
+            //   const obj = {
+            //     children: value,
+            //     attrs: {},
+            //   };
+            //   if(index === 0){   // 第一行数据开始,跨行合并的长度为数据data的长度
+            //     obj.attrs.rowSpan = this.dataSource.length;
+            //   }
+            //   if (index >= 1) {   // 从第一行往后的所有行表格均合并
+            //     obj.attrs.rowSpan = 0;
+            //   }
+            //   return obj;
+            // }
           },
           {
             title:'样品名称',
@@ -247,6 +260,7 @@
     created() {
       this.init();
       this.getSuperFieldList();
+      // this.getList();
     },
     computed: {
       importExcelUrl: function(){
@@ -267,7 +281,95 @@
         })
 
       },
+// 
+      // getList(){
+      //   let that = this
+      //   getAction(this.url.list,this.queryParam).then((res) => {
+      //     console.log(111111111,res)
+      //     if (res.success) {
+      //       this.dataSource = res.result.records
+      //       //判断跨行
+      //       let rowSpan = 0
+      //       let weituoClient = ''
+      //       // let sampleName = ''
+      //       for (let i = that.dataSource.length-1; i >= 0; i--) {
+      //         if (weituoClient == '') {
+      //           that.dataSource[i].rowSpan = 0
+      //           weituoClient = that.dataSource[i].weituoClient
+      //         } else {
+      //           if(weituoClient == that.dataSource[i].weituoClient){
+      //             that.dataSource[i].rowSpan = 0
+      //             rowSpan++
+      //           }else{
+      //             that.dataSource[i+1].rowSpan = rowSpan
+      //             that.dataSource[i].rowSpan = 0
+      //             rowSpan = 1
+      //             weituoClient = that.dataSource[i].weituoClient
+      //           }
+                
+      //         }
+      //       }
+      //       that.dataSource[0].rowSpan = rowSpan
+      //       console.log(22222222222,that.dataSource)
+
+      //     }
+      //   })
+      // },
       
+
+      loadData(arg) {
+        let that = this
+      if(!this.url.list){
+        this.$message.error("请设置url.list属性!")
+        return
+      }
+      //加载数据 若传入参数1则加载第一页的内容
+      if (arg === 1) {
+        this.ipagination.current = 1;
+      }
+      var params = this.getQueryParams();//查询条件
+      this.loading = true;
+      getAction(this.url.list, params).then((res) => {
+        if (res.success) {
+          //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
+          this.dataSource = res.result.records||res.result;
+          //判断跨行
+            let rowSpan = 0
+            let weituoClient = ''
+            // let sampleName = ''
+            for (let i = that.dataSource.length-1; i >= 0; i--) {
+              if (weituoClient == '') {
+                that.dataSource[i].rowSpan = 0
+                weituoClient = that.dataSource[i].weituoClient
+              } else {
+                if(weituoClient == that.dataSource[i].weituoClient){
+                  that.dataSource[i].rowSpan = 0
+                  rowSpan++
+                }else{
+                  that.dataSource[i+1].rowSpan = rowSpan
+                  that.dataSource[i].rowSpan = 0
+                  rowSpan = 1
+                  weituoClient = that.dataSource[i].weituoClient
+                }
+                
+              }
+            }
+            that.dataSource[0].rowSpan = rowSpan
+            console.log(22222222222,that.dataSource)
+          if(res.result.total)
+          {
+            this.ipagination.total = res.result.total;
+          }else{
+            this.ipagination.total = 0;
+          }
+          //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
+        }else{
+          this.$message.warning(res.message)
+        }
+      }).finally(() => {
+        this.loading = false
+      })
+    },
       // handlewcChange(data){
 
       // var weituoClient={weituoClient:data}