loulijun2021
2023-05-11 0c60341966c08192588e140bbd2db97a9163189d
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="225"
                    width="195"
                  >
                    <template slot-scope="{row}">
                      <div class="ellipsis">{{ row.PurchaseOrder }}</div>
@@ -58,7 +58,7 @@
                  <el-table-column
                    prop="suppername"
                    label="供应商"
                    width="183"
                    width="173"
                  >
                    <template slot-scope="{row}">
                      <div v-if="row.suppername" class="ellipsis">{{ row.suppername }}</div>
@@ -84,11 +84,21 @@
                  <el-table-column
                    prop="partname"
                    label="产品名称"
                    width="215"
                    width="185"
                  >
                    <template slot-scope="{row}">
                      <div v-if="row.partname" class="ellipsis">{{ row.partname }}</div>
                      <div v-else />
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="partspec"
                    label="产品规格"
                    width="115"
                  >
                    <template slot-scope="{row}">
                      <div v-if="row.partspec" class="ellipsis">{{ row.partspec }}</div>
                      <div v-else>/</div>
                    </template>
                  </el-table-column>
                  <!--                  <el-table-column-->
@@ -104,7 +114,7 @@
                  <el-table-column
                    prop="quantity"
                    label="订单数量"
                    width="114"
                    width="104"
                  >
                    <template slot-scope="{row}">
                      <div v-if="row.quantity">{{ parseFloat(row.quantity) }}</div>
@@ -134,26 +144,30 @@
                  <el-table-column
                    prop="quantity1"
                    label="已收数量"
                    width="114"
                    width="104"
                  >
                    <template slot-scope="{row}">
                      <div v-if="row.quantity1">{{ parseFloat(row.quantity1) }}</div>
                      <div v-if="(new Date(row.voucherdate.substring(0,10)).getTime()<new Date('2023-05-06').getTime())">
                        {{parseFloat(row.quantity)}}
                      </div>
                      <div v-else>0</div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="未收数量"
                    width="114"
                    width="104"
                  >
                    <template slot-scope="{row}">
                      <div v-if="row.quantity- row.quantity1">{{ parseFloat(row.quantity - row.quantity1) }}</div>
                      <div v-else>0</div>
                      <div v-if="(new Date(row.voucherdate.substring(0,10)).getTime()<new Date('2023-05-06').getTime())">
0
                      </div>
                      <div v-else>{{parseFloat(row.quantity - row.quantity1)}}</div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="acceptDate"
                    label="预计交期"
                    width="135"
                    width="125"
                  >
                    <template slot-scope="{row}">
                      <div v-if="row.acceptDate">{{ row.acceptDate.substring(0, 10) }}</div>
@@ -163,14 +177,12 @@
                  <el-table-column
                    prop="warning"
                    label="延期天数"
                    width="144"
                    width="139"
                  >
                    <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-if="row.warning===null||row.warning===''||row.warning>=0||(new Date(row.voucherdate.substring(0,10)).getTime()<new Date('2023-05-06').getTime())">0</div>
                      <div v-else-if="parseFloat(row.warning)<0" style="color: red">{{ Math.abs(parseFloat(row.warning)) }}</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 }}-->
@@ -227,7 +239,7 @@
                </el-table-column>
                <el-table-column
                  prop="suppername"
                  width="293"
                  width="292"
                  label="供应商名称"
                >
                  <template slot-scope="{row}">
@@ -287,10 +299,18 @@
    this.getPurchaseLeftBottom()
    this.getPurchaseRight()
    this.setStarsRef()
    // this.setStarsRef()
  },
  methods: {
    fun_date(aa) {
      const date1 = new Date()
      const time1 = date1.getFullYear() + '-' + (date1.getMonth() + 1) + '-' + date1.getDate()// time1表示当前时间
      const date2 = new Date(date1)
      date2.setDate(date1.getDate() + aa)
      const time2 = date2.getFullYear() + '-' + (date2.getMonth() + 1).toString().padStart(2, '0') + '-' + date2.getDate().toString().padStart(2, '0')
      return time2
    },
    setStarsRef() {
      const starNodes = Array.from(this.$refs.starsRef.children)
      starNodes.forEach(item => {
@@ -320,11 +340,12 @@
          this.purchaseLeftTopData = res.data[0]
          loadEcharts('cgddchart', cgddchart(this.purchaseLeftTopData.ThisMonthPurchaseOrderCont, this.purchaseLeftTopData.ThisMonthPurchaseArrivalOrderCont, this.purchaseLeftTopData.ThisMonthWareHouseOrderCont))
        })
      }, 1000 * 6)
      }, 1000 * 15)
    },
    getPurchaseLeftBottom() {
      PurchaseLeftBottom().then(res => {
        this.tableData = res.data.filter(i => !parseFloat(i.quantity1))// 过滤掉已收数量大于零的值
        // this.tableData = res.data.filter(i => !parseFloat(i.quantity1))// 过滤掉已收数量大于零的值
        this.tableData = res.data
        // this.number1 = this.tableData.length
@@ -346,7 +367,8 @@
              }
            })
          }
        }, this.tableData.length <= 13 ? 1000 * 3 : 100)
        }, this.tableData.length <= 13 ? 1000 * 15 : 100)
      })
    },
    getPurchaseRight() {
@@ -363,13 +385,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 * 15 : 100)
      })
    },
    tableRowClassName({ row, rowIndex }) {