loulijun2021
2023-04-14 e2660740818a17f4b5d97df4c224affa87b95ebc
src/views/kb/cgdd.vue
@@ -1,6 +1,12 @@
<template>
  <div>
    <div class="kb_dashboard">
      <!--    星空背景-->
      <!--      <div ref="starsRef" class="stars">-->
      <!--        <div v-for="(item, index) in starsCount" :key="index" class="star" />-->
      <!--      </div>-->
      <div class="kb_header">
        <div class="flex_c_c kb_header_text">
          <div id="topBarLeft" style="width:600px;height:100%" />
@@ -43,7 +49,7 @@
                  <el-table-column
                    prop="PurchaseOrder"
                    label="采购订单"
                    width="207"
                    width="225"
                  >
                    <template slot-scope="{row}">
                      <div class="ellipsis">{{ row.PurchaseOrder }}</div>
@@ -52,7 +58,7 @@
                  <el-table-column
                    prop="suppername"
                    label="供应商"
                    width="163"
                    width="183"
                  >
                    <template slot-scope="{row}">
                      <div v-if="row.suppername" class="ellipsis">{{ row.suppername }}</div>
@@ -78,7 +84,7 @@
                  <el-table-column
                    prop="partname"
                    label="产品名称"
                    width="175"
                    width="215"
                  >
                    <template slot-scope="{row}">
                      <div v-if="row.partname" class="ellipsis">{{ row.partname }}</div>
@@ -98,37 +104,37 @@
                  <el-table-column
                    prop="quantity"
                    label="订单数量"
                    width="94"
                    width="114"
                  >
                    <template slot-scope="{row}">
                      <div v-if="row.quantity">{{ parseFloat(row.quantity) }}</div>
                      <div v-else>0</div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="checktype"
                    label="检验状态"
                    width="94"
                  >
                    <template slot-scope="{row}">
                      <div v-if="row.checktype===null">未检验</div>
                      <div v-else>已检验</div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="checkuser"
                    label="检验人员"
                    width="94"
                  >
                    <template slot-scope="{row}">
                      <div v-if="row.checkuser===null">/</div>
                      <div v-else>{{ row.checkuser }}</div>
                    </template>
                  </el-table-column>
                  <!--                  <el-table-column-->
                  <!--                    prop="checktype"-->
                  <!--                    label="检验状态"-->
                  <!--                    width="104"-->
                  <!--                  >-->
                  <!--                    <template slot-scope="{row}">-->
                  <!--                      <div v-if="row.checktype===null">未检验</div>-->
                  <!--                      <div v-else>已检验</div>-->
                  <!--                    </template>-->
                  <!--                  </el-table-column>-->
                  <!--                  <el-table-column-->
                  <!--                    prop="checkuser"-->
                  <!--                    label="检验人员"-->
                  <!--                    width="94"-->
                  <!--                  >-->
                  <!--                    <template slot-scope="{row}">-->
                  <!--                      <div v-if="row.checkuser===null">/</div>-->
                  <!--                      <div v-else>{{ row.checkuser }}</div>-->
                  <!--                    </template>-->
                  <!--                  </el-table-column>-->
                  <el-table-column
                    prop="quantity1"
                    label="已收数量"
                    width="94"
                    width="114"
                  >
                    <template slot-scope="{row}">
                      <div v-if="row.quantity1">{{ parseFloat(row.quantity1) }}</div>
@@ -137,7 +143,7 @@
                  </el-table-column>
                  <el-table-column
                    label="未收数量"
                    width="94"
                    width="114"
                  >
                    <template slot-scope="{row}">
                      <div v-if="row.quantity- row.quantity1">{{ parseFloat(row.quantity - row.quantity1) }}</div>
@@ -147,7 +153,7 @@
                  <el-table-column
                    prop="acceptDate"
                    label="预计交期"
                    width="115"
                    width="135"
                  >
                    <template slot-scope="{row}">
                      <div v-if="row.acceptDate">{{ row.acceptDate.substring(0, 10) }}</div>
@@ -157,18 +163,18 @@
                  <el-table-column
                    prop="warning"
                    label="延期天数"
                    width="114"
                    width="144"
                  >
                    <template slot-scope="{row}">
                      <div v-if="parseFloat(row.warning)<0" style="color: red">{{
                        Math.abs(parseFloat(row.warning))
                      }}
                      </div>
                      <div v-else-if="row.warning===null||row.warning===''||row.warning===0">0</div>
                      <div v-else-if="parseFloat(row.warning)>3">{{ row.warning }}</div>
                      <div v-else-if="parseFloat(row.warning)>0&&parseFloat(row.warning)<=3" style="color:yellow;">
                        {{ row.warning }}
                      </div>
                      <div v-else-if="row.warning===null||row.warning===''||row.warning>=0">0</div>
                      <!--                      <div v-else-if="parseFloat(row.warning)>3">{{ row.warning }}</div>-->
                      <!--                      <div v-else-if="parseFloat(row.warning)>0&&parseFloat(row.warning)<=3" style="color:yellow;">-->
                      <!--                        {{ row.warning }}-->
                      <!--                      </div>-->
                    </template>
                  </el-table-column>
                </el-table>
@@ -259,7 +265,10 @@
      tableDataRank: [],
      PurchaseRight: null,
      PurchaseLeftBottom: null
      PurchaseLeftBottom: null,
      starsCount: 800, // 星星数量
      distance: 900 // 间距
    }
  },
@@ -277,10 +286,24 @@
    this.getEcharts()
    this.getPurchaseLeftBottom()
    this.getPurchaseRight()
    // this.setStarsRef()
  },
  methods: {
    setStarsRef() {
      const starNodes = Array.from(this.$refs.starsRef.children)
      starNodes.forEach(item => {
        const speed = 0.2 + Math.random() * 1
        const thisDistance = this.distance + Math.random() * 300
        item.style.transformOrigin = `0 0 ${thisDistance}px`
        item.style.transform = `
        translate3d(0,0,-${thisDistance}px)
        rotateY(${Math.random() * 360}deg)
        rotateX(${Math.random() * -50}deg)
        scale(${speed},${speed})`
      })
    },
    // 获取topEcharts
    getTopBar() {
      loadEcharts('topBarLeft', kbTop())
@@ -297,12 +320,13 @@
          this.purchaseLeftTopData = res.data[0]
          loadEcharts('cgddchart', cgddchart(this.purchaseLeftTopData.ThisMonthPurchaseOrderCont, this.purchaseLeftTopData.ThisMonthPurchaseArrivalOrderCont, this.purchaseLeftTopData.ThisMonthWareHouseOrderCont))
        })
      }, 1000 * 6)
      }, 1000 * 30)
    },
    getPurchaseLeftBottom() {
      PurchaseLeftBottom().then(res => {
        this.tableData = res.data.filter(i => !parseFloat(i.quantity1))// 过滤掉已收数量大于零的值
        this.number1 = this.tableData.length
        // this.number1 = this.tableData.length
        const divData = this.$refs.tableData.bodyWrapper
        // 拿到元素后,对元素进行定时增加距离顶部距离,实现滚动效果(此配置为每100毫秒移动1像素)
@@ -322,7 +346,7 @@
              }
            })
          }
        }, this.tableData.length <= 13 ? 1000 * 3 : 100)
        }, this.tableData.length <= 13 ? 1000 * 10 : 100)
      })
    },
    getPurchaseRight() {
@@ -345,7 +369,7 @@
              }
            })
          }
        }, this.tableDataRank.length <= 21 ? 1000 * 3 : 100)
        }, this.tableDataRank.length <= 23 ? 1000 * 10 : 100)
      })
    },
    tableRowClassName({ row, rowIndex }) {
@@ -419,3 +443,37 @@
  font-size: 18px;
}
</style>
<!--星空-->
<style lang="css" scoped>
@keyframes rotate {
  0% {
    transform: perspective(400px) rotateZ(20deg) rotateX(-40deg) rotateY(0);
  }
  100% {
    transform: perspective(400px) rotateZ(20deg) rotateX(-40deg) rotateY(-360deg);
  }
}
.stars {
  transform: perspective(500px);
  transform-style: preserve-3d;
  position: absolute;
  perspective-origin: 50% 100%;
  left: 45%;
  animation: rotate 90s infinite linear;
  bottom: 0;
  z-index: 102;
}
.star {
  width: 2px;
  height: 2px;
  /*background: #f7f7b6;*/
  background: #8edffc;
  position: absolute;
  left: 0;
  top: 0;
  backface-visibility: hidden;
  z-index: 102;
}
</style>