gaoluyang
2025-12-04 82c57894ad2118932a8775b6c8b94bc38b41698e
src/views/index.vue
@@ -13,9 +13,13 @@
                     <div class="company-meta">{{userStore.roleName}}</div>
                  </div>
                  <div style="display: flex;align-items: center;gap: 8px">
                     <el-icon color="#5053B5" size="22"><Clock /></el-icon>
                     <span>登陆日期:{{userStore.currentLoginTime}}</span>
                  </div>
                  <el-icon color="#5053B5" size="22"><Clock /></el-icon>
                  <span>登陆日期:{{userStore.currentLoginTime}}</span>
               </div>
               <div style="display: flex;align-items: center;gap: 8px">
                  <el-icon color="#5053B5" size="22"><Calendar /></el-icon>
                  <span>排班时间:{{scheduleTime}}</span>
               </div>
               </div>
            </div>
            <div class="data-cards">
@@ -68,11 +72,11 @@
               <li v-for="item in todoList" :key="item.id">
                  <div style="display: flex;flex-direction: column;justify-content: space-between;width: 100%;gap: 20px">
                     <div style="display: flex;justify-content: space-between;align-items: center;">
                        <div class="todo-title">流程编号:{{item.approveId}}</div>
                        <div class="todo-division">申请部门:{{item.approveDeptName}}</div>
                        <div class="todo-title">待办编号:{{item.approveId}}</div>
                        <div class="todo-division">部门:{{item.approveDeptName}}</div>
                        <div class="todo-time">{{item.approveTime}}</div>
                     </div>
                     <div class="todo-division">审批事由:{{item.approveReason}}</div>
                     <div class="todo-division">待办事由:{{item.approveReason}}</div>
                  </div>
               </li>
            </ul>
@@ -138,23 +142,23 @@
      
      <!-- 底部横向两栏 -->
      <div class="dashboard-row">
         <div class="main-panel">
            <div class="section-title">质量统计</div>
            <div class="quality-cards">
               <div class="quality-card one">原材料已检测数 <span>{{qualityStatisticsObject.supplierNum}}件</span></div>
               <div class="quality-card two">过程检验数量 <span>{{qualityStatisticsObject.processNum}}件</span></div>
               <div class="quality-card three">出厂已检数量 <span>{{qualityStatisticsObject.factoryNum}}件</span></div>
            </div>
            <Echarts ref="chart"
                         :chartStyle="chartStyle"
                         :grid="grid"
                         :legend="barLegend"
                         :series="barSeries1"
                         :tooltip="tooltip"
                         :xAxis="xAxis1"
                         :yAxis="yAxis1"
                         style="height: 260px"></Echarts>
         </div>
<!--         <div class="main-panel">-->
<!--            <div class="section-title">质量统计</div>-->
<!--            <div class="quality-cards">-->
<!--               <div class="quality-card one">原材料已检测数 <span>{{qualityStatisticsObject.supplierNum}}件</span></div>-->
<!--               <div class="quality-card two">过程检验数量 <span>{{qualityStatisticsObject.processNum}}件</span></div>-->
<!--               <div class="quality-card three">出厂已检数量 <span>{{qualityStatisticsObject.factoryNum}}件</span></div>-->
<!--            </div>-->
<!--            <Echarts ref="chart"-->
<!--                         :chartStyle="chartStyle"-->
<!--                         :grid="grid"-->
<!--                         :legend="barLegend"-->
<!--                         :series="barSeries1"-->
<!--                         :tooltip="tooltip"-->
<!--                         :xAxis="xAxis1"-->
<!--                         :yAxis="yAxis1"-->
<!--                         style="height: 260px"></Echarts>-->
<!--         </div>-->
         <div class="main-panel">
            <div class="section-title">回款与开票分析</div>
            <Echarts ref="chart" :chartStyle="chartStyle" :grid="grid" :legend="lineLegend" :series="lineSeries"
@@ -165,10 +169,11 @@
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { ref, reactive, onMounted } from 'vue'
import Echarts from "@/components/Echarts/echarts.vue";
import * as echarts from 'echarts';
import useUserStore from "@/store/modules/user.js";
import { Clock, Calendar } from '@element-plus/icons-vue'
import {
   analysisCustomerContractAmounts, getAmountHalfYear,
   getBusiness,
@@ -176,6 +181,8 @@
   qualityStatistics,
   statisticsReceivablePayable
} from "@/api/viewIndex.js";
import { getCurrentUserLatestScheduling } from "@/api/personnelManagement/scheduling.js";
import dayjs from "dayjs";
const userStore = useUserStore()
@@ -277,7 +284,7 @@
}])
const yAxis = [{
   type: 'category',
   data: ['预付账款', '应付账款', '预收账款', '应收账款',]
   data: [ '应付账款', '应收账款',]
}]
const yAxis1 = [{
   type: 'value'
@@ -337,19 +344,13 @@
   }
])
// 合同金额分析数据
const contractList = [
   { name: '深圳科技有限公司', percent: 36, value: 4544, color: '#4fc3f7' },
   { name: '北京科技有限公司', percent: 20, value: 4000, color: '#81c784' },
   { name: '广州科技有限公司', percent: 16, value: 3113, color: '#ffb74d' },
   { name: '上海科技有限公司', percent: 10, value: 2341, color: '#ba68c8' },
   { name: '南京科技有限公司', percent: 9, value: 1231, color: '#e57373' },
   { name: '北京未来科技有限公司', percent: 9, value: 1231, color: '#64b5f6' }
]
// 待办事项
const todoList = ref([])
const radio1 = ref(1)
// 排班时间
const scheduleTime = ref('')
const scheduleInfo = ref({})
// 图表引用
const barChart = ref(null)
@@ -368,6 +369,7 @@
   statisticsReceivable()
   qualityStatisticsInfo()
   getAmountHalfYearNum()
   getCurrentUserSchedule()
})
// 数据统计
const getBusinessData = () => {
@@ -396,13 +398,12 @@
}
// 应付应收统计
const statisticsReceivable = (type) => {
   console.log(type)
   statisticsReceivablePayable({type: radio1.value}).then((res) => {
      barSeries.value[0].data = [
         { value: res.data.prepayMoney, itemStyle: { color: barColors2[0] } },
         { value: res.data.payableMoney, itemStyle: { color: barColors2[1] } },
         { value: res.data.advanceMoney, itemStyle: { color: barColors2[2] } },
         { value: res.data.receivableMoney, itemStyle: { color: barColors2[3] } }
         // { value: res.data.prepayMoney, itemStyle: { color: barColors2[0] } },
         { value: res.data.payableMoney, itemStyle: { color: barColors2[0] } },
         // { value: res.data.advanceMoney, itemStyle: { color: barColors2[2] } },
         { value: res.data.receivableMoney, itemStyle: { color: barColors2[1] } }
      ]
   })
}
@@ -420,6 +421,35 @@
      qualityStatisticsObject.value.factoryNum = res.data.factoryNum
   })
}
// 获取当前用户排班信息
const getCurrentUserSchedule = async () => {
  try {
    const res = await getCurrentUserLatestScheduling()
    if (res.data) {
      const currentSchedule = res.data
      scheduleInfo.value = currentSchedule
      // 格式化排班时间显示
      if (currentSchedule.startTime && currentSchedule.endTime) {
        scheduleTime.value = `${currentSchedule.startTime} - ${currentSchedule.endTime}`
      } else if (currentSchedule.workStartTime && currentSchedule.workEndTime) {
        const startTime = dayjs(currentSchedule.workStartTime).format('HH:mm')
        const endTime = dayjs(currentSchedule.workEndTime).format('HH:mm')
        scheduleTime.value = `${startTime} - ${endTime}`
      } else {
        scheduleTime.value = '今日无排班'
      }
    } else {
      scheduleTime.value = '今日无排班'
      scheduleInfo.value = {}
    }
  } catch (error) {
    console.error('获取排班信息失败:', error)
    scheduleTime.value = '获取排班信息失败'
  }
}
const getAmountHalfYearNum = async () => {
   const res = await getAmountHalfYear()
   console.log(res)
@@ -754,15 +784,18 @@
   color: #666;
   list-style: none;
   padding: 0;
   height: 190px;
   overflow-y: auto;
   width: 460px;
}
.line {
   position: relative;
   width: 250px;
   width: 230px;
}
.line::after {
   content: '';
   position: absolute;
   right: 12px;
   right: 2px;
   top: 0;
   bottom: 0;
   width: 1px;