luobang 2 years ago
parent
commit
1de67465d0

+ 2 - 2
build/utils.js

@@ -16,9 +16,9 @@ const devPathSrc = path.resolve(__dirname, '../../../src') // node_modules应用
 //       统计报表       组织机构/系统管理 采购  仓储
 //  'statisticalReport','systemConfig','TMS','WMS','workFlow','ADMINISTRATORS']
 
-let devModules = ['all']
-// let devModules = ['index', 'statisticalReport']
 // let devModules = ['all']
+// let devModules = ['index', 'statisticalReport', 'sale']
+let devModules = ['all']
 
 // let devModules = ['index', 'ADMINISTRATORS']
 

+ 280 - 161
src/views/sale/components/transportFreight/saleTruckSettlement/bmsTruckDetailsOrderNew.vue

@@ -67,7 +67,7 @@
             style="width:150px"
           >
           </el-date-picker>
-          <el-button type="primary" class="btn" @click="getSteelReport">
+          <el-button type="primary" class="btn" @click="onclick()">
             <i class="el-icon-search"></i>
           </el-button>
         </el-form-item>
@@ -109,6 +109,14 @@
             ><i class="el-icon-circle-check"></i>确认执行价</el-button
           >
         </el-form-item>
+        <el-form-item v-show="activeName == 'second'">
+          <el-button
+            type="primary"
+            @click="cancelMakeSure"
+            v-if="!notRoutList.includes('capacityNo')"
+            ><i class="el-icon-circle-check"></i>取消确认</el-button
+          >
+        </el-form-item>
         <el-form-item v-show="activeName == 'second'">
           <el-button type="primary" @click="openStatement">
             <i class="el-icon-circle-check"></i>生成账单
@@ -492,7 +500,7 @@
               >
               </el-table-column>
               <el-table-column
-                prop="actualAddress"
+                prop="addressPlace"
                 label="下货地点"
                 width="300px"
                 sortable
@@ -1274,6 +1282,58 @@ export default {
       let endPageNum = this.currentPage * this.currentPageSize
       this.priceList = this.priceAllList.slice(startPageNum, endPageNum)
     },
+    cancelMakeSure() {
+      if (this.$refs.tableRef1.selection.length == 0) {
+        this.$message({
+          type: 'error',
+          offset: '250',
+          message: '请勾选'
+        })
+        return
+      }
+      let orderList = this.$refs.tableRef1.selection.map(e => {
+        return e.orderId
+      })
+      let map = {
+        orderList: orderList,
+        updateStatus: 1
+      }
+      this.$confirm('是否将勾选住的单据取消确认', '提示', {
+        cancelButtonText: '取消',
+        confirmButtonText: '确定',
+        center: true
+      })
+        .then(() => {
+          this.axios.post('/api/v1/bms/updateDetailsStatus', map).then(res => {
+            if (res.data.code == '200') {
+              this.$refs.tableRef.clearSelection()
+              this.getSteelReport()
+              this.makeSurePriceOrderList = []
+              this.$message({
+                type: 'success',
+                message: '取消确认执行价成功',
+                duration: 2000,
+                offset: '250'
+              })
+            } else {
+              this.$message({
+                type: 'error',
+                message: '修改失败,联系管理员',
+                duration: 2000,
+                offset: '250'
+              })
+            }
+          })
+        })
+        .catch(e => {
+          this.$message({
+            type: 'error',
+            message: '取消操作',
+            duration: 2000,
+            offset: '250'
+          })
+        })
+    },
     makeSurePrice() {
       let map = {
         orderList: this.makeSurePriceOrderList,
@@ -3015,167 +3075,226 @@ export default {
     //查询,输入查询条件
     onclick(obj) {
       this.isRowClick = 0
-      const loading = this.$loading({
-        lock: true,
-        text: '正在获取数据',
-        spinner: 'el-icon-loading',
-        background: 'rgba(0, 0, 0, 0.7)'
-      })
-      let startTime = null
-      let endTime = null
-      let carrierSsoId = null
-      let carrierName = null
-      let consigneeName = null
-      let capacityNo = null
-      let remark = null
-      let saler = null
-      let easPrimaryId = null
-      let consigneeSsoId = null
-      let consigneeLoginName = null
-      if (this.startTime && this.endTime) {
-        startTime = sjTime(this.startTime)
-        endTime = sjTime(this.endTime)
-      }
-      if (getCookie('orgCode') == 'chengyunshang') {
-        carrierSsoId = getCookie('userId')
-      }
-      if (getCookie('orgCode') == 'xiaoshouyewuyuan') {
-        saler = getCookie('loginName')
-      }
-      if (getCookie('orgCode') == 'shouhuokehu') {
-        consigneeLoginName =
-          JSON.parse(getCookie('userInfo')).userCode || getCookie('loginName')
-        obj.consigneeLoginName = consigneeLoginName
-      }
-      if (this.screen == '客户') {
-        consigneeName = this.input
-      } else if (this.screen == '承运商') {
-        carrierName = this.input
-      } else if (this.screen == '车号') {
-        capacityNo = this.input
-      } else if (this.screen == '分录ID') {
-        console.log('进入了分录')
-        easPrimaryId = this.input
-      } else {
-        remark = this.input
-      }
-      if (this.screen1 == '客户' && this.input1 != null && this.input1 != '') {
-        consigneeName = this.input1
-      } else if (
-        this.screen1 == '承运商' &&
-        this.input1 != null &&
-        this.input1 != ''
-      ) {
-        carrierName = this.input1
-      } else if (
-        this.screen1 == '车号' &&
-        this.input1 != null &&
-        this.input1 != ''
-      ) {
-        capacityNo = this.input1
-      } else if (this.input1 != null && this.input1 != '') {
-        remark = this.input1
-      }
-      debugger
-      this.axios
-        .post(
-          '/api/v1/tms/getSaleSteelReportNew?startTime=' +
-            startTime +
-            '&endTime=' +
-            endTime +
-            '&carrierSsoId=' +
-            carrierSsoId +
-            '&i=' +
-            new Date() +
-            '&remark=' +
-            remark +
-            '&consigneeName=' +
-            consigneeName +
-            '&carrierName=' +
-            carrierName +
-            '&capacityNo=' +
-            capacityNo +
-            '&saler=' +
-            saler +
-            '&easPrimaryId=' +
-            easPrimaryId,
-          obj
-        )
-        .then(res => {
-          this.tableData = res.data.data
-          this.getNodeNum(this.tableData)
-          //遍历保留两位小数
-          // this.tableData.forEach(e=>{
-          //     try {
-          //         if(e.priceValue){
-          //           e.priceValue=e.priceValue.toFixed(2);
-          //         }
-          //         if(e.detailsAmount){
-          //           e.detailsAmount=e.detailsAmount.toFixed(2);
-          //         }
-          //     } catch (error) {
-
-          //     }
-          // })
-          this.maxHeight =
-            window.innerHeight -
-            document.querySelector('.tableTop').offsetHeight -
-            40
-          this.visibleList = []
-          this.visibleList = this.tableData.slice(
-            0,
-            Math.floor(this.maxHeight / this.itemHeight) + 1
-          )
-          console.log(this.visibleList)
-          console.log(this.visibleList, 'this.visibleList')
-          this.getSpanArr(this.visibleList)
-          this.getTotalNum(this.tableData)
-          console.log(this.visibleList)
-          loading.close()
-        })
-        .catch(() => {
-          loading.close()
+      if (this.activeName == 'first') {
+        const loading = this.$loading({
+          lock: true,
+          text: '正在获取数据',
+          spinner: 'el-icon-loading',
+          background: 'rgba(0, 0, 0, 0.7)'
         })
-      this.axios
-        .post(
-          '/api/v1/tms/getSettledSaleSteelReportNew?startTime=' +
-            startTime +
-            '&endTime=' +
-            endTime +
-            '&carrierSsoId=' +
-            carrierSsoId +
-            '&i=' +
-            new Date() +
-            '&remark=' +
-            remark +
-            '&consigneeName=' +
-            consigneeName +
-            '&carrierName=' +
-            carrierName +
-            '&capacityNo=' +
-            capacityNo +
-            '&saler=' +
-            saler +
-            '&easPrimaryId=' +
-            easPrimaryId,
-          obj
-        )
-        .then(res => {
-          this.tableData1 = res.data.data
-          this.getNodeNum(this.tableData1)
-          this.maxHeight =
-            window.innerHeight -
-            document.querySelector('.tableTop').offsetHeight -
-            40
-          this.visibleList1 = []
-          this.visibleList1 = this.tableData1.slice(
-            0,
-            Math.floor(this.maxHeight / this.itemHeight) + 1
+        let startTime = null
+        let endTime = null
+        let carrierSsoId = null
+        let carrierName = null
+        let consigneeName = null
+        let capacityNo = null
+        let remark = null
+        let saler = null
+        let easPrimaryId = null
+        let consigneeLoginName = null
+        if (this.startTime && this.endTime) {
+          startTime = sjTime(this.startTime)
+          endTime = sjTime(this.endTime)
+        }
+        if (getCookie('orgCode') == 'chengyunshang') {
+          carrierSsoId = getCookie('userId')
+        }
+        if (getCookie('orgCode') == 'xiaoshouyewuyuan') {
+          saler = getCookie('loginName')
+        }
+        if (getCookie('orgCode') == 'shouhuokehu') {
+          consigneeLoginName =
+            JSON.parse(getCookie('userInfo')).userCode || getCookie('loginName')
+          obj.consigneeLoginName = consigneeLoginName
+        }
+        if (this.screen == '客户') {
+          consigneeName = this.input
+        } else if (this.screen == '承运商') {
+          carrierName = this.input
+        } else if (this.screen == '车号') {
+          capacityNo = this.input
+        } else if (this.screen == '分录ID') {
+          console.log('进入了分录')
+          easPrimaryId = this.input
+        } else {
+          remark = this.input
+        }
+        if (
+          this.screen1 == '客户' &&
+          this.input1 != null &&
+          this.input1 != ''
+        ) {
+          consigneeName = this.input1
+        } else if (
+          this.screen1 == '承运商' &&
+          this.input1 != null &&
+          this.input1 != ''
+        ) {
+          carrierName = this.input1
+        } else if (
+          this.screen1 == '车号' &&
+          this.input1 != null &&
+          this.input1 != ''
+        ) {
+          capacityNo = this.input1
+        } else if (this.input1 != null && this.input1 != '') {
+          remark = this.input1
+        }
+        this.axios
+          .post(
+            '/api/v1/tms/getSaleSteelReportNew?startTime=' +
+              startTime +
+              '&endTime=' +
+              endTime +
+              '&carrierSsoId=' +
+              carrierSsoId +
+              '&i=' +
+              new Date() +
+              '&remark=' +
+              remark +
+              '&consigneeName=' +
+              consigneeName +
+              '&carrierName=' +
+              carrierName +
+              '&capacityNo=' +
+              capacityNo +
+              '&saler=' +
+              saler +
+              '&easPrimaryId=' +
+              easPrimaryId,
+            obj
           )
-          console.log(this.visibleList1, 'this.visibleList1')
-          this.getSpanArr1(this.visibleList1)
-          this.getTotalNum(this.tableData1)
+          .then(res => {
+            this.tableData = res.data.data
+            this.getNodeNum(this.tableData)
+            this.maxHeight =
+              window.innerHeight -
+              document.querySelector('.tableTop').offsetHeight -
+              40
+            this.visibleList = []
+            this.visibleList = this.tableData.slice(
+              0,
+              Math.floor(this.maxHeight / this.itemHeight) + 1
+            )
+            this.getSpanArr(this.visibleList)
+            this.getTotalNum(this.tableData)
+            loading.close()
+          })
+          .catch(() => {
+            loading.close()
+          })
+      } else {
+        console.log('执行')
+        const loading = this.$loading({
+          lock: true,
+          text: '正在获取数据',
+          spinner: 'el-icon-loading',
+          background: 'rgba(0, 0, 0, 0.7)'
         })
+        let startTime = null
+        let endTime = null
+        let carrierSsoId = null
+        let carrierName = null
+        let consigneeName = null
+        let capacityNo = null
+        let remark = null
+        let saler = null
+        let easPrimaryId = null
+        let consigneeLoginName = null
+        if (this.startTime && this.endTime) {
+          startTime = sjTime(this.startTime)
+          endTime = sjTime(this.endTime)
+        }
+        if (getCookie('orgCode') == 'chengyunshang') {
+          carrierSsoId = getCookie('userId')
+        }
+        if (getCookie('orgCode') == 'xiaoshouyewuyuan') {
+          saler = getCookie('loginName')
+        }
+        if (getCookie('orgCode') == 'shouhuokehu') {
+          consigneeLoginName =
+            JSON.parse(getCookie('userInfo')).userCode || getCookie('loginName')
+          obj.consigneeLoginName = consigneeLoginName
+        }
+        console.log(this.screen1, this.input1, 'here')
+        if (this.screen == '客户') {
+          consigneeName = this.input
+        } else if (this.screen == '承运商') {
+          carrierName = this.input
+        } else if (this.screen == '车号') {
+          capacityNo = this.input
+        } else if (this.screen == '分录ID') {
+          console.log('进入了分录')
+          easPrimaryId = this.input
+        } else {
+          remark = this.input
+        }
+        if (
+          this.screen1 == '客户' &&
+          this.input1 != null &&
+          this.input1 != ''
+        ) {
+          consigneeName = this.input1
+        } else if (
+          this.screen1 == '承运商' &&
+          this.input1 != null &&
+          this.input1 != ''
+        ) {
+          carrierName = this.input1
+        } else if (
+          this.screen1 == '车号' &&
+          this.input1 != null &&
+          this.input1 != ''
+        ) {
+          capacityNo = this.input1
+        } else if (this.input1 != null && this.input1 != '') {
+          remark = this.input1
+        }
+        this.axios
+          .post(
+            '/api/v1/tms/getSettledSaleSteelReportNew?startTime=' +
+              startTime +
+              '&endTime=' +
+              endTime +
+              '&carrierSsoId=' +
+              carrierSsoId +
+              '&i=' +
+              new Date() +
+              '&remark=' +
+              remark +
+              '&consigneeName=' +
+              consigneeName +
+              '&carrierName=' +
+              carrierName +
+              '&capacityNo=' +
+              capacityNo +
+              '&saler=' +
+              saler +
+              '&easPrimaryId=' +
+              easPrimaryId,
+            obj
+          )
+          .then(res => {
+            this.tableData1 = res.data.data
+            this.getNodeNum(this.tableData1)
+            this.maxHeight =
+              window.innerHeight -
+              document.querySelector('.tableTop').offsetHeight -
+              40
+            this.visibleList1 = []
+            this.visibleList1 = this.tableData1.slice(
+              0,
+              Math.floor(this.maxHeight / this.itemHeight) + 1
+            )
+            console.log(this.visibleList1, 'this.visibleList1')
+            this.getSpanArr1(this.visibleList1)
+            this.getTotalNum(this.tableData1)
+            loading.close()
+          })
+          .catch(() => {
+            loading.close()
+          })
+      }
     },
     //重新获取表格数据
     refresh() {
@@ -3260,7 +3379,6 @@ export default {
       let carrierSsoId = null
       let carrierName = null
       let consigneeName = null
-      let consigneeSsoId = null
       let consigneeLoginName = null
       let capacityNo = null
       let remark = null
@@ -3375,6 +3493,7 @@ export default {
           this.filterMap
         )
         .then(res => {
+          loading.close()
           this.tableData1 = res.data.data
           this.getNodeNum(this.tableData1)
           this.maxHeight =

+ 3 - 294
src/views/statisticalReport/components/salesLogisticsStatistics/steelTransportReport.vue

@@ -231,14 +231,15 @@ export default {
   },
   watch: {
     startTime() {
-      this.titleTXT = `${this.startTime.getFullYear()}年${this.startTime.getMonth() +
+      ;(this.titleTXT = `${this.startTime.getFullYear()}年${this.startTime.getMonth() +
         1}月${this.startTime.getDate()}日08:00 - ${new Date(
         sjTime(this.startTime) + 86400000
       ).getFullYear()}年${new Date(
         sjTime(this.startTime) + 86400000
       ).getMonth() + 1}月${new Date(
         sjTime(this.startTime) + 86400000
-      ).getDate()}日08:00`
+      ).getDate()}日08:00`),
+        this.steelTransportReport()
     }
     // tableData: {
     //   immediate: true,
@@ -260,299 +261,7 @@ export default {
   mounted() {},
   methods: {
     // exportAllReportToExcel() {},
-    exportAllReportToExcel() {
-      let tableTitle = this.titleTXT
-      //let tables = this.$refs.ship;//此处是拿表格document元素,也可以取父div的ref
-      let tables = document.getElementById('excelDom')
-      let table_book = XLSX.utils.table_to_book(tables)
-      console.log('table_book:', table_book)
-      console.log('sheet:', table_book.Sheets.Sheet1)
-      //限制单元格样式范围
-      let rangeList = [
-        'A',
-        'B',
-        'C',
-        'D',
-        'E',
-        'F',
-        'G',
-        'H',
-        'I',
-        'J',
-        'K',
-        'L',
-        'M',
-        'N',
-        'O',
-        'P',
-        'Q',
-        ,
-        'R',
-        'S',
-        'T',
-        'U'
-      ]
-      //得到自定义过滤数组
-      // let filterList = this.exportFilter(table_book.Sheets.Sheet1)
-      // console.log('filterList:', filterList)
-      let flag = true
-      //这里遍历单元格给单元格对象设置属性,s为控制样式的属性
-      Object.keys(table_book.Sheets.Sheet1).forEach(key => {
-        if (key.indexOf('!') < 0 && rangeList.indexOf(this.getCol(key)) >= 0) {
-          table_book.Sheets.Sheet1[key].s = {
-            font: {
-              name: '宋体',
-              sz: 10
-            },
-            alignment: {
-              //对齐方式
-              horizontal: 'center', //水平居中
-              vertical: 'center', //竖直居中
-              wrapText: true //自动换行
-            },
-            border: {
-              // 设置边框
-              top: { style: 'thin' },
-              bottom: { style: 'thin' },
-              left: { style: 'thin' },
-              right: { style: 'thin' }
-            }
-          }
-          //更改数字格式
-          if (flag && table_book.Sheets.Sheet1[key].t == 'n') {
-            table_book.Sheets.Sheet1[key].s.numFmt = '0.00'
-          }
-          //库存三列特殊对待
-          if (
-            table_book.Sheets.Sheet1[key].t == 's' &&
-            table_book.Sheets.Sheet1[key].v &&
-            (table_book.Sheets.Sheet1[key].v.includes('下游港口库存') ||
-              table_book.Sheets.Sheet1[key].v.includes('万港库存') ||
-              table_book.Sheets.Sheet1[key].v.includes('在途货物'))
-          ) {
-            flag = false //标识为不允许更改数字格式
-            table_book.Sheets.Sheet1[key].s = {
-              font: {
-                name: '宋体',
-                sz: 10
-              },
-              alignment: {
-                vertical: 'center',
-                wrapText: true
-              },
-              border: {
-                top: { style: 'thin' },
-                bottom: { style: 'thin' },
-                left: { style: 'thin' },
-                right: { style: 'thin' }
-              }
-            }
-          }
-        }
-      })
-      //表头字体重新设置
-      table_book.Sheets.Sheet1['A1'].s.font = {
-        name: '宋体',
-        sz: 16,
-        bold: true
-      }
-      //画一个简报
-      this.drawExcel(table_book.Sheets.Sheet1)
-      //处理合并行样式
-      this.addRangeBorder(
-        table_book.Sheets.Sheet1['!merges'],
-        table_book.Sheets.Sheet1
-      )
-      console.log('sheet:', table_book.Sheets.Sheet1)
-      //导出
-      let table_write = XLSXStyle.write(table_book, {
-        type: 'binary',
-        bookType: 'xlsx'
-      })
-      try {
-        FileSaver.saveAs(
-          new Blob([this.bta(table_write)], {
-            type: 'application/octet-stream'
-          }),
-          tableTitle + '.xlsx'
-        )
-      } catch (e) {
-        if (typeof console !== 'undefined') console.log(e, table_write)
-      }
-      return table_write
-    },
 
-    onclick() {
-      this.axios
-        .post(
-          '/api/v1/tms/steelTransportReport?startTime=' +
-            sjTime(this.startTime) +
-            '&endTime=' +
-            sjTime(this.startTime)
-        )
-        .then(res => {
-          this.tableData = res.data.data
-        })
-    },
-    drawExcel(sheet) {
-      //画一个进口矿水联运情况简报
-      let style = {
-        font: {
-          name: '宋体',
-          sz: 10
-        },
-        alignment: {
-          //对齐方式
-          horizontal: 'center', //水平居中
-          vertical: 'center', //竖直居中
-          wrapText: true //自动换行
-        },
-        border: {
-          // 设置边框
-          top: { style: 'thin' },
-          bottom: { style: 'thin' },
-          left: { style: 'thin' },
-          right: { style: 'thin' }
-        }
-      }
-      Object.keys(sheet).forEach(key => {
-        if (key.indexOf('!') < 0 && sheet[key].v == '万州港发货信息') {
-          let row = this.getRow(key)
-          console.log('万州港发货信息:', row)
-          //第一行表头
-          sheet['I' + row] = {
-            t: 's',
-            v: '进口矿水联运情况简报',
-            s: style
-          }
-          for (let i = row + 1; i < this.loadTable.length + row + 3; i++) {
-            sheet['I' + i] = {
-              t: 's',
-              v: '',
-              s: style
-            }
-          }
-          //表格合并
-          for (let i = row - 1; i < this.loadTable.length + row + 2; i++) {
-            sheet['!merges'].push({
-              s: {
-                r: i,
-                c: 8
-              },
-              e: {
-                r: i,
-                c: 15
-              }
-            })
-          }
-          return
-        }
-      })
-    },
-    exportFilter(sheet) {
-      //导出过滤方法
-      let keys = []
-      Object.keys(sheet).forEach(key => {
-        if (key.indexOf('!') < 0 && sheet[key].v == '万州港发货信息') {
-          let row = this.getRow(key)
-          console.log('万州港发货信息:', row)
-          for (let i = row; i < this.loadTable.length + row + 3; i++) {
-            keys.push('F' + i)
-          }
-        } else if (
-          key.indexOf('!') < 0 &&
-          sheet[key].v == '控制线等闸船舶动态'
-        ) {
-          let row = this.getRow(key)
-          console.log('控制线等闸船舶动态:', row)
-          for (let i = row; i < row + 2; i++) {
-            keys.push('Q' + i)
-          }
-        }
-      })
-      return keys
-    },
-    addRangeBorder(range, ws) {
-      let cols = [
-        'A',
-        'B',
-        'C',
-        'D',
-        'E',
-        'F',
-        'G',
-        'H',
-        'I',
-        'J',
-        'K',
-        'L',
-        'M',
-        'N',
-        'O',
-        'P',
-        'Q',
-        'R',
-        'S',
-        'T',
-        'U',
-        'V'
-      ]
-      range.forEach(item => {
-        let style = {
-          s: {
-            border: {
-              top: { style: 'thin' },
-              left: { style: 'thin' },
-              bottom: { style: 'thin' },
-              right: { style: 'thin' }
-            }
-          }
-        }
-        // 处理合并行
-        for (let i = item.s.c; i <= item.e.c; i++) {
-          ws[`${cols[i]}${Number(item.e.r) + 1}`] =
-            ws[`${cols[i]}${Number(item.e.r) + 1}`] || style
-          // 处理合并列
-          for (let k = item.s.r + 2; k <= item.e.r + 1; k++) {
-            ws[cols[i] + k] = ws[cols[k] + item.e.r] || style
-          }
-        }
-      })
-      return ws
-    },
-    getRow(key) {
-      return parseInt(key.replace(/[^0-9]/gi, ''))
-    },
-    getCol(key) {
-      let row = key.replace(/[^0-9]/gi, '')
-      return key.replace(row, '')
-    },
-    appendOne(Sheet, row) {
-      //从后面新增1行,并行合并
-      let seArr = Sheet['!fullref'].split(':')
-      let length = parseInt(seArr[1].replace(/[^0-9]/gi, ''))
-      let endCol = seArr[1].replace(length, '')
-      //新增行
-      length++
-      Sheet['A' + length] = {
-        t: 's',
-        v: row
-      }
-      Sheet['!fullref'] = seArr[0] + ':' + endCol + length
-      Sheet['!ref'] = seArr[0] + ':' + endCol + length
-      //行合并
-      Sheet['!merges'].push({
-        s: {
-          c: 0,
-          r: length - 1
-        },
-        e: {
-          c: 21,
-          r: length - 1
-        }
-      })
-      return Sheet
-    },
     steelTransportReport() {
       this.axios
         .post(