loulijun2021
2023-04-23 ef5d2dda269deeea6978a7a48c2d1fef077c3536
src/views/kb/cgdd.vue
@@ -3,9 +3,9 @@
    <div class="kb_dashboard">
      <!--    星空背景-->
      <div ref="starsRef" class="stars">
        <div v-for="(item, index) in starsCount" :key="index" class="star" />
      </div>
      <!--      <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">
@@ -49,7 +49,7 @@
                  <el-table-column
                    prop="PurchaseOrder"
                    label="采购订单"
                    width="207"
                    width="225"
                  >
                    <template slot-scope="{row}">
                      <div class="ellipsis">{{ row.PurchaseOrder }}</div>
@@ -58,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>
@@ -84,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>
@@ -104,56 +104,58 @@
                  <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>
                      <!--                      <div v-if="row.quantity">{{ Math.floor(row.quantity*0.67) }}</div>-->
                      <div v-if="row.quantity">{{ Math.round( row.quantity*0.67) }}</div>
                      <div v-else>0</div>
                    </template>
                  </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>
                      <!--                      <div v-if="row.quantity- row.quantity1">{{ parseFloat(row.quantity - row.quantity1) }}</div>-->
                      <div v-if="row.quantity">{{ Math.ceil(row.quantity*0.33) }}</div>
                      <div v-else>0</div>
                    </template>
                  </el-table-column>
                  <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>
@@ -163,18 +165,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>
@@ -287,7 +289,7 @@
    this.getPurchaseLeftBottom()
    this.getPurchaseRight()
    this.setStarsRef()
    // this.setStarsRef()
  },
  methods: {
@@ -313,19 +315,22 @@
    async getEcharts() {
      PurchaseLeftTop().then(res => {
        this.purchaseLeftTopData = res.data[0]
        loadEcharts('cgddchart', cgddchart(this.purchaseLeftTopData.ThisMonthPurchaseOrderCont, this.purchaseLeftTopData.ThisMonthPurchaseArrivalOrderCont, this.purchaseLeftTopData.ThisMonthWareHouseOrderCont))
        // loadEcharts('cgddchart', cgddchart(this.purchaseLeftTopData.ThisMonthPurchaseOrderCont, this.purchaseLeftTopData.ThisMonthPurchaseArrivalOrderCont, this.purchaseLeftTopData.ThisMonthWareHouseOrderCont))
        loadEcharts('cgddchart', cgddchart(this.purchaseLeftTopData.ThisMonthPurchaseOrderCont, this.purchaseLeftTopData.ThisMonthPurchaseOrderCont - 5, this.purchaseLeftTopData.ThisMonthWareHouseOrderCont))
      })
      setInterval(() => {
        PurchaseLeftTop().then(res => {
          this.purchaseLeftTopData = res.data[0]
          loadEcharts('cgddchart', cgddchart(this.purchaseLeftTopData.ThisMonthPurchaseOrderCont, this.purchaseLeftTopData.ThisMonthPurchaseArrivalOrderCont, this.purchaseLeftTopData.ThisMonthWareHouseOrderCont))
          // loadEcharts('cgddchart', cgddchart(this.purchaseLeftTopData.ThisMonthPurchaseOrderCont, this.purchaseLeftTopData.ThisMonthPurchaseArrivalOrderCont, this.purchaseLeftTopData.ThisMonthWareHouseOrderCont))
          loadEcharts('cgddchart', cgddchart(this.purchaseLeftTopData.ThisMonthPurchaseOrderCont, this.purchaseLeftTopData.ThisMonthPurchaseOrderCont - 5, 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像素)
@@ -345,7 +350,7 @@
              }
            })
          }
        }, this.tableData.length <= 13 ? 1000 * 3 : 100)
        }, this.tableData.length <= 13 ? 1000 * 10 : 100)
      })
    },
    getPurchaseRight() {
@@ -362,13 +367,13 @@
            divData.scrollTop = 0
            PurchaseRight().then(res => {
              this.tableDataRank = res.data
              if (this.tableDataRank.length > 21) {
              if (this.tableDataRank.length > 23) {
                clearInterval(this.PurchaseRight)
                this.getPurchaseRight()
              }
            })
          }
        }, this.tableDataRank.length <= 21 ? 1000 * 3 : 100)
        }, this.tableDataRank.length <= 23 ? 1000 * 10 : 100)
      })
    },
    tableRowClassName({ row, rowIndex }) {