Przeglądaj źródła

展示缺少资质的表格合并相同准入编码的行

白承飞 5 lat temu
rodzic
commit
50c72f7bfb

+ 11 - 13
src/dashoo.cn/frontend_web/src/components/oilsupplier/goodslist.vue

@@ -3,7 +3,7 @@
     <el-card class="box-card">
       <div slot="header"
            class="clearfix">
-        <span style="font-weight: bold">准入范围1</span>
+        <span style="font-weight: bold">准入范围</span>
         <span style="float: right;">
           <el-button style="float: right; padding: 3px 0px"
                      type="text"
@@ -418,12 +418,12 @@ export default {
           console.error(err)
         })
     },
-    type_change(val,canadd,newcanadd){
+    type_change (val, canadd, newcanadd) {
       if (canadd == true || newcanadd == true) {
-        if (val.IsManufacturer == 2){
+        if (val.IsManufacturer == 2) {
           this.tableloading = true
           let IsManufacturer = 2
-          this.$axios.get('suppliercertsub/updatemanufacturer/' + parseInt(val.Id) +'/'+parseInt(val.SupplierId) + '/' + IsManufacturer + '', {}).then(res => {
+          this.$axios.get('suppliercertsub/updatemanufacturer/' + parseInt(val.Id) + '/' + parseInt(val.SupplierId) + '/' + IsManufacturer + '', {}).then(res => {
             if (res.data.code === 0) {
               this.$message({
                 type: 'success',
@@ -443,10 +443,10 @@ export default {
             .catch(err => {
               console.error(err)
             })
-        } else if (val.IsManufacturer == 1){ // ---------------转换供应商与非供应商
+        } else if (val.IsManufacturer == 1) { // ---------------转换供应商与非供应商
           this.tableloading = true
           let IsManufacturer = 1
-          this.$axios.get('suppliercertsub/updatemanufacturer/' + parseInt(val.Id) +'/'+parseInt(val.SupplierId) + '/' + IsManufacturer + '', {}).then(res => {
+          this.$axios.get('suppliercertsub/updatemanufacturer/' + parseInt(val.Id) + '/' + parseInt(val.SupplierId) + '/' + IsManufacturer + '', {}).then(res => {
             if (res.data.code === 0) {
               this.$message({
                 type: 'success',
@@ -567,7 +567,7 @@ export default {
         return
       }
       _this.loading = true
-        _this.$axios.post('/suppliercertsub/add-goods-certsub-filter', params)
+      _this.$axios.post('/suppliercertsub/add-goods-certsub-filter', params)
         .then(res => {
           if (res.data.code === 0) {
             _this.$message({
@@ -649,15 +649,14 @@ export default {
           _this.Ids = []
         })
     },
-    setManufacturer(index){
-       if (this.Ids.length == 0) {
+    setManufacturer (index) {
+      if (this.Ids.length == 0) {
         this.$message({
           type: 'warning',
           message: '请先选择设置的条目'
         })
         return
       }
-
       let _this = this
       _this.$confirm('是否确定此操作, 是否继续?', '提示', {
         confirmButtonText: '确定',
@@ -669,13 +668,13 @@ export default {
             lock: true,
             text: '正在设置请稍后...'
           })
-           let postData = {
+          let postData = {
             CertSubIdList: [],
             SupplierId: parseInt(this.SupplierId),
             SupplierCertId: parseInt(this.SupplierCertId),
             IsManufacturer: index
           }
-          _this.$axios.post('suppliercertsub/modify-manufacturer/' + this.Ids.join(),postData)
+          _this.$axios.post('suppliercertsub/modify-manufacturer/' + this.Ids.join(), postData)
             .then(function (response) {
               if (response.data.code === 0) {
                 _this.$message({
@@ -757,7 +756,6 @@ export default {
       if (!value) return true
       return data.CodeName.indexOf(value) !== -1
     },
-
     handleSizeChange (value) {
       this.size = value
       this.currentPage = 1

+ 85 - 50
src/dashoo.cn/frontend_web/src/components/oilsupplier/goodslist2.vue

@@ -179,6 +179,7 @@
                 row-class-name="warning-row"
                 highlight-current-row
                 :data="lostTableData"
+                :span-method="objectSpanMethod"
                 border
                 size="mini"
                 style="width: 100%; margin-top:20px">
@@ -324,7 +325,7 @@
       return {
         IsCompanyUser: '',
         loading: false,
-        tableloading:false,
+        tableloading: false,
         keyword: '',
         Ids: [],
         SupplierId: 0,
@@ -405,53 +406,53 @@
             console.error(err)
           })
       },
-    setManufacturer (operTag){
-      let _this = this
-      _this.$confirm('是否确定此操作, 是否继续?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      })
-        .then(() => {
-          const delload = this.$loading({
-            lock: true,
-            text: '正在设置请稍后...'
-          })
-           let postData = {
-            CertSubIdList: [],
-            SupplierId: parseInt(this.SupplierId),
-            SupplierCertId: parseInt(this.SupplierCertId),
-            IsManufacturer: operTag
-          }
-          _this.$axios.post('suppliercertsub/modify-manufacturers/' + this.SupplierCertId, postData)
-            .then(function (response) {
-              if (response.data.code === 0) {
-                _this.$message({
-                  type: 'success',
-                  message: response.data.message
-                })
-                delload.close()
-                _this.Ids = []
-                _this.initData()
-              } else {
-                delload.close()
-                _this.Ids = []
-                _this.$message({
-                  type: 'warning',
-                  message: response.data.message
-                })
-              }
-            })
-            .catch(function (error) {
-              console.log(error)
-            })
-        })
-        .catch((ex) => {
-          console.error(ex)
-          _this.Ids = []
+      setManufacturer (operTag) {
+        let _this = this
+        _this.$confirm('是否确定此操作, 是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         })
-    },
-      type_change(row,canadd,newcanadd){
+          .then(() => {
+            const delload = this.$loading({
+              lock: true,
+              text: '正在设置请稍后...'
+            })
+            let postData = {
+              CertSubIdList: [],
+              SupplierId: parseInt(this.SupplierId),
+              SupplierCertId: parseInt(this.SupplierCertId),
+              IsManufacturer: operTag
+            }
+            _this.$axios.post('suppliercertsub/modify-manufacturers/' + this.SupplierCertId, postData)
+              .then(function (response) {
+                if (response.data.code === 0) {
+                  _this.$message({
+                    type: 'success',
+                    message: response.data.message
+                  })
+                  delload.close()
+                  _this.Ids = []
+                  _this.initData()
+                } else {
+                  delload.close()
+                  _this.Ids = []
+                  _this.$message({
+                    type: 'warning',
+                    message: response.data.message
+                  })
+                }
+              })
+              .catch(function (error) {
+                console.log(error)
+              })
+          })
+          .catch((ex) => {
+            console.error(ex)
+            _this.Ids = []
+          })
+      },
+      type_change (row, canadd, newcanadd) {
         if (canadd == true || newcanadd == true) {
           this.tableloading = true
           let postData = {
@@ -765,15 +766,49 @@
           return
         }
         _this.$axios.post('/suppliercertsub/check-certsub-lost', params).then(res => {
-          _this.lostTableData = res.data
+          _this.lostTableData = _this.mergeTableRow(res.data, ['Code'])
           this.loading = false
         }).catch(err => {
           this.loading = false
           console.error(err)
         })
-
       },
-
+      objectSpanMethod ({ row, column, rowIndex, columnIndex }) {
+        console.log('没有啊')
+        const span = column['property'] + '-span'
+        if (row[span]) {
+          return row[span]
+        }
+      },
+      /**
+       *  table合并行通用 */
+      mergeTableRow (data, merge) {
+        if (!merge || merge.length === 0) {
+          return data
+        }
+        merge.forEach((m) => {
+          const mList = {}
+          data = data.map((v, index) => {
+            const rowVal = v[m]
+            if (mList[rowVal]) {
+              mList[rowVal]++
+              data[index - (mList[rowVal] - 1)][m + '-span'].rowspan++
+              v[m + '-span'] = {
+                rowspan: 0,
+                colspan: 0
+              }
+            } else {
+              mList[rowVal] = 1
+              v[m + '-span'] = {
+                rowspan: 1,
+                colspan: 1
+              }
+            }
+            return v
+          })
+        })
+        return data
+      },
       handleSizeChange (value) {
         this.size = value
         this.currentPage = 1