zouyu
6 天以前 2d54d85fe641e3468c644f5854b1ea9b9311f514
代码调整4
已修改2个文件
439 ■■■■■ 文件已修改
src/views/contractor/assets/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/index.vue 437 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/contractor/assets/index.vue
@@ -430,7 +430,7 @@
]);
// 模拟资产数据
const mockAssets = [
const mockAssets = ref([
  {
    assetId: 1,
    assetName: "挖掘机",
src/views/index.vue
@@ -5,11 +5,11 @@
            <!-- 左:系统概览+数据卡片 -->
            <div class="top-left">
                <div class="system-info">
                    <div class="section-title">工艺报警优化管理系统</div>
          <div class="section-title">承包商管理系统</div>
                    <div style="display: flex;align-items: center;gap: 20px">
                        <div class="system-card">
                            <div class="system-name">工艺报警优化管理系统</div>
                            <div class="system-meta">实时监控 · 智能分析 · 高效处理</div>
              <div class="system-name">承包商管理系统</div>
              <div class="system-meta">资质审核 · 合同管理 · 绩效评估</div>
                        </div>
                        <div style="display: flex;align-items: center;gap: 8px">
                            <el-icon color="#5053B5" size="22"><Clock /></el-icon>
@@ -19,41 +19,75 @@
                </div>
                <div class="data-cards">
                    <div class="data-card total">
                        <div class="data-title">总报警数</div>
                        <div class="data-value">{{ alarmStats.total }}</div>
                        <div class="data-desc">已处理 {{ alarmStats.handled }} | 未处理 {{ alarmStats.pending }}</div>
            <div class="data-title">总承包商数</div>
            <div class="data-value">{{ contractorStats.total }}</div>
            <div class="data-desc">
              已审核 {{ contractorStats.approved }} | 待审核
              {{ contractorStats.pending }}
            </div>
                    </div>
                    <div class="data-card pending">
                        <div class="data-title">未处理报警</div>
                        <div class="data-value">{{ alarmStats.pending }}</div>
                        <div class="data-desc">严重 {{ alarmStats.severePending }} | 中等 {{ alarmStats.moderatePending }} | 轻微 {{ alarmStats.minorPending }}</div>
            <div class="data-title">待审核承包商</div>
            <div class="data-value">{{ contractorStats.pending }}</div>
            <div class="data-desc">
              A级 {{ contractorStats.aPending }} | B级
              {{ contractorStats.bPending }} | C级
              {{ contractorStats.cPending }}
            </div>
                    </div>
                    <div class="data-card today">
                        <div class="data-title">今日报警</div>
                        <div class="data-value">{{ alarmStats.today }}</div>
                        <div class="data-desc">同比 {{ alarmStats.today同比 }}% | 环比 {{ alarmStats.today环比 }}%</div>
            <div class="data-title">本月新增</div>
            <div class="data-value">{{ contractorStats.monthly }}</div>
            <div class="data-desc">
              同比 {{ contractorStats.monthly同比 }}% | 环比
              {{ contractorStats.monthly环比 }}%
            </div>
                    </div>
                </div>
            </div>
            <!-- 右:待处理报警列表 -->
            <div class="alarm-panel">
                <div class="section-title">待处理报警</div>
                <ul class="alarm-list" v-if="pendingAlarms.length > 0">
                    <li v-for="item in pendingAlarms" :key="item.id">
                        <div style="display: flex;flex-direction: column;justify-content: space-between;width: 100%;gap: 10px">
                            <div style="display: flex;justify-content: space-between;align-items: center;">
                                <div class="alarm-title">{{ item.equipmentName }} - {{ item.parameter }}</div>
                                <el-tag :type="getAlarmLevelType(item.alarmLevel)">{{ item.alarmLevel }}</el-tag>
        <div class="section-title">待审核承包商</div>
        <ul class="alarm-list" v-if="pendingContractors.length > 0">
          <li v-for="item in pendingContractors" :key="item.id">
            <div
              style="
                display: flex;
                flex-direction: column;
                justify-content: space-between;
                width: 100%;
                gap: 10px;
              "
            >
              <div
                style="
                  display: flex;
                  justify-content: space-between;
                  align-items: center;
                "
              >
                <div class="alarm-title">{{ item.name }} - {{ item.type }}</div>
                <el-tag :type="getContractorLevelType(item.level)"
                  >{{ item.level }}级</el-tag
                >
                            </div>
                            <div style="display: flex;justify-content: space-between;align-items: center;">
                                <div class="alarm-value">报警值: {{ item.alarmValue }} | 阈值: {{ item.threshold }}</div>
                                <div class="alarm-time">{{ item.alarmTime }}</div>
              <div
                style="
                  display: flex;
                  justify-content: space-between;
                  align-items: center;
                "
              >
                <div class="alarm-value">
                  联系人: {{ item.contact }} | 注册时间: {{ item.registerDate }}
                </div>
                <div class="alarm-time">{{ item.applyDate }}</div>
                            </div>
                        </div>
                    </li>
                </ul>
                <div v-else style="text-align: center; color: #909399; padding: 20px;">
                    暂无待处理报警
        <div v-else style="text-align: center; color: #909399; padding: 20px">
          暂无待审核承包商
                </div>
            </div>
        </div>
@@ -61,21 +95,54 @@
        <!-- 中部横向两栏 -->
        <div class="dashboard-row">
            <div class="main-panel">
                <div class="section-title">报警趋势分析</div>
                <Echarts ref="chart" :chartStyle="chartStyle" :grid="grid" :legend="lineLegend" :series="lineSeries" :tooltip="tooltipLine" :xAxis="xAxis" :yAxis="yAxis" style="height: 300px;"></Echarts>
        <div class="section-title">承包商增长趋势</div>
        <Echarts
          ref="chart"
          :chartStyle="chartStyle"
          :grid="grid"
          :legend="lineLegend"
          :series="lineSeries"
          :tooltip="tooltipLine"
          :xAxis="xAxis"
          :yAxis="yAxis"
          style="height: 300px"
        ></Echarts>
            </div>
            <div class="main-panel">
                <div class="section-title">报警级别分布</div>
                <div style="display: flex;align-items: center;gap: 20px;justify-content: space-evenly;height: 300px;">
                    <div style="width: 50%;">
                        <Echarts ref="chart" :legend="pieLegend" :chartStyle="chartStylePie" :series="levelPieSeries" :tooltip="pieTooltip"></Echarts>
        <div class="section-title">承包商资质分布</div>
        <div
          style="
            display: flex;
            align-items: center;
            gap: 20px;
            justify-content: space-evenly;
            height: 300px;
          "
        >
          <div style="width: 50%">
            <Echarts
              ref="chart"
              :legend="pieLegend"
              :chartStyle="chartStylePie"
              :series="levelPieSeries"
              :tooltip="pieTooltip"
            ></Echarts>
                    </div>
                    <ul class="level-list" style="width: 50%;">
          <ul class="level-list" style="width: 50%">
                        <li v-for="item in levelPieSeries[0].data" :key="item.name">
                            <div style="display: flex;align-items: center;justify-content: space-between;width: 100%">
                                <div class="line" :style="{color: item.itemStyle.color}">●{{ item.name }}</div>
                                <div style="width: 60px;">{{ item.value }}次</div>
                                <div style="width: 60px;">{{ item.rate }}%</div>
              <div
                style="
                  display: flex;
                  align-items: center;
                  justify-content: space-between;
                  width: 100%;
                "
              >
                <div class="line" :style="{ color: item.itemStyle.color }">
                  ●{{ item.name }}
                </div>
                <div style="width: 60px">{{ item.value }}家</div>
                <div style="width: 60px">{{ item.rate }}%</div>
                            </div>
                        </li>
                    </ul>
@@ -86,268 +153,292 @@
        <!-- 底部横向两栏 -->
        <div class="dashboard-row">
            <div class="main-panel">
                <div class="section-title">设备报警统计</div>
                <Echarts ref="chart" :color="barColors" :chartStyle="chartStyle" :grid="grid" :series="equipmentBarSeries" :tooltip="tooltip" :xAxis="equipmentXAxis" :yAxis="yAxis" style="height: 300px;"></Echarts>
        <div class="section-title">承包商类型分布</div>
        <Echarts
          ref="chart"
          :color="barColors"
          :chartStyle="chartStyle"
          :grid="grid"
          :series="equipmentBarSeries"
          :tooltip="tooltip"
          :xAxis="equipmentXAxis"
          :yAxis="yAxis"
          style="height: 300px"
        ></Echarts>
            </div>
            <div class="main-panel">
                <div class="section-title">报警处理时效分析</div>
                <Echarts ref="chart" :color="barColors" :chartStyle="chartStyle" :grid="grid" :series="handlingTimeSeries" :tooltip="tooltip" :xAxis="handlingTimeXAxis" :yAxis="yAxis" style="height: 300px;"></Echarts>
        <div class="section-title">承包商审核时效</div>
        <Echarts
          ref="chart"
          :color="barColors"
          :chartStyle="chartStyle"
          :grid="grid"
          :series="handlingTimeSeries"
          :tooltip="tooltip"
          :xAxis="handlingTimeXAxis"
          :yAxis="yAxis"
          style="height: 300px"
        ></Echarts>
            </div>
        </div>
    </div>
</template>
<script setup>
import { ref, onMounted, reactive, computed } from 'vue'
import { ref, onMounted, reactive, computed } from "vue";
import Echarts from "@/components/Echarts/echarts.vue";
import { Clock } from '@element-plus/icons-vue';
import { Clock } from "@element-plus/icons-vue";
// 当前时间
const currentTime = computed(() => {
    const now = new Date();
    return now.toLocaleString('zh-CN');
  return now.toLocaleString("zh-CN");
});
// 报警统计数据
const alarmStats = reactive({
    total: 425,
    handled: 398,
    pending: 27,
    severePending: 8,
    moderatePending: 12,
    minorPending: 7,
    today: 35,
    today同比: '+12.5',
    today环比: '-8.3'
// 承包商统计数据
const contractorStats = reactive({
  total: 156,
  approved: 132,
  pending: 24,
  aPending: 8,
  bPending: 12,
  cPending: 4,
  monthly: 28,
  monthly同比: "+18.5",
  monthly环比: "+5.2",
});
// 待处理报警列表
const pendingAlarms = ref([
// 待审核承包商列表
const pendingContractors = ref([
    {
        id: 1,
        equipmentName: '反应釜A',
        parameter: '温度',
        alarmValue: '185°C',
        threshold: '≤180°C',
        alarmLevel: '严重',
        alarmTime: '2025-12-16 14:30:23'
    name: "建筑工程有限公司",
    type: "建筑施工",
    contact: "张三",
    registerDate: "2025-01-15",
    applyDate: "2025-12-16 14:30:23",
    level: "A",
    },
    {
        id: 2,
        equipmentName: '离心机B',
        parameter: '振动',
        alarmValue: '0.8mm/s',
        threshold: '≤0.5mm/s',
        alarmLevel: '中等',
        alarmTime: '2025-12-16 14:28:15'
    name: "机电安装工程公司",
    type: "机电安装",
    contact: "李四",
    registerDate: "2025-03-20",
    applyDate: "2025-12-16 14:28:15",
    level: "B",
    },
    {
        id: 3,
        equipmentName: '反应釜D',
        parameter: 'pH值',
        alarmValue: '4.2',
        threshold: '5.0-7.0',
        alarmLevel: '中等',
        alarmTime: '2025-12-16 14:22:18'
    name: "装饰装修工程公司",
    type: "装饰装修",
    contact: "王五",
    registerDate: "2025-05-10",
    applyDate: "2025-12-16 14:22:18",
    level: "B",
    },
    {
        id: 4,
        equipmentName: '干燥机E',
        parameter: '湿度',
        alarmValue: '15%',
        threshold: '≤10%',
        alarmLevel: '轻微',
        alarmTime: '2025-12-16 14:18:55'
    }
    name: "绿化工程有限公司",
    type: "园林绿化",
    contact: "赵六",
    registerDate: "2025-08-05",
    applyDate: "2025-12-16 14:18:55",
    level: "C",
  },
]);
// 图表样式
const chartStyle = {
    width: '100%',
    height: '100%'
  width: "100%",
  height: "100%",
};
const chartStylePie = {
    width: '100%',
    height: '100%'
  width: "100%",
  height: "100%",
};
const grid = {
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
  left: "3%",
  right: "4%",
  bottom: "3%",
  containLabel: true,
};
// 报警趋势分析 - 折线图
// 承包商增长趋势 - 折线图
const lineLegend = {
    show: true,
    data: ['严重', '中等', '轻微']
  data: ["A级", "B级", "C级"],
};
const tooltipLine = {
    trigger: 'axis',
  trigger: "axis",
    axisPointer: {
        type: 'cross'
    }
    type: "cross",
  },
};
const xAxis = ref({
    type: 'category',
    data: ['12-01', '12-02', '12-03', '12-04', '12-05', '12-06', '12-07']
  type: "category",
  data: ["12-01", "12-02", "12-03", "12-04", "12-05", "12-06", "12-07"],
});
const yAxis = ref({
    type: 'value',
    name: '报警数量'
  type: "value",
  name: "承包商数量",
});
const lineSeries = ref([
    {
        name: '严重',
        type: 'line',
        data: [8, 12, 9, 15, 11, 13, 10],
    name: "A级",
    type: "line",
    data: [15, 18, 20, 22, 25, 28, 30],
        itemStyle: {
            color: '#f56c6c'
      color: "#f56c6c",
        },
        lineStyle: {
            width: 2
      width: 2,
        },
        showSymbol: true
    showSymbol: true,
    },
    {
        name: '中等',
        type: 'line',
        data: [22, 25, 20, 28, 24, 26, 23],
    name: "B级",
    type: "line",
    data: [45, 52, 58, 65, 70, 75, 80],
        itemStyle: {
            color: '#e6a23c'
      color: "#e6a23c",
        },
        lineStyle: {
            width: 2
      width: 2,
        },
        showSymbol: true
    showSymbol: true,
    },
    {
        name: '轻微',
        type: 'line',
        data: [35, 38, 32, 40, 36, 39, 34],
    name: "C级",
    type: "line",
    data: [30, 35, 40, 45, 50, 55, 60],
        itemStyle: {
            color: '#67c23a'
      color: "#67c23a",
        },
        lineStyle: {
            width: 2
      width: 2,
        },
        showSymbol: true
    }
    showSymbol: true,
  },
]);
// 报警级别分布 - 饼图
// 承包商资质分布 - 饼图
const pieLegend = {
    show: false
  show: false,
};
const pieTooltip = {
    trigger: 'item',
    formatter: '{b}: {c}次 ({d}%)'
  trigger: "item",
  formatter: "{b}: {c}家 ({d}%)",
};
const levelPieSeries = ref([
    {
        type: 'pie',
        radius: ['60%', '80%'],
    type: "pie",
    radius: ["60%", "80%"],
        avoidLabelOverlap: false,
        itemStyle: {
            borderColor: '#fff',
            borderWidth: 2
      borderColor: "#fff",
      borderWidth: 2,
        },
        label: {
            show: false
      show: false,
        },
        data: [
            {
                name: '严重',
                value: 78,
                rate: 18.35,
                itemStyle: { color: '#f56c6c' }
        name: "A级",
        value: 45,
        rate: 28.85,
        itemStyle: { color: "#f56c6c" },
            },
            {
                name: '中等',
                value: 178,
                rate: 41.88,
                itemStyle: { color: '#e6a23c' }
        name: "B级",
        value: 70,
        rate: 44.87,
        itemStyle: { color: "#e6a23c" },
            },
            {
                name: '轻微',
                value: 169,
                rate: 39.76,
                itemStyle: { color: '#67c23a' }
            }
        ]
    }
        name: "C级",
        value: 41,
        rate: 26.28,
        itemStyle: { color: "#67c23a" },
      },
    ],
  },
]);
// 设备报警统计 - 柱状图
const barColors = ['#409eff', '#67c23a', '#e6a23c', '#f56c6c', '#909399'];
// 承包商类型分布 - 柱状图
const barColors = ["#409eff", "#67c23a", "#e6a23c", "#f56c6c", "#909399"];
const tooltip = {
    trigger: 'axis',
  trigger: "axis",
    axisPointer: {
        type: 'shadow'
    }
    type: "shadow",
  },
};
const equipmentXAxis = ref({
    type: 'category',
    data: ['反应釜', '离心机', '输送泵', '干燥机', '压缩机']
  type: "category",
  data: ["建筑施工", "机电安装", "装饰装修", "园林绿化", "其他"],
});
const equipmentBarSeries = ref([
    {
        name: '报警数量',
        type: 'bar',
        data: [125, 85, 78, 65, 72],
    name: "承包商数量",
    type: "bar",
    data: [45, 35, 25, 20, 31],
        itemStyle: {
            color: function(params) {
                return barColors[params.dataIndex % barColors.length];
            }
      },
        },
        label: {
            show: true,
            position: 'top'
        }
    }
      position: "top",
    },
  },
]);
// 报警处理时效分析 - 柱状图
// 承包商审核时效分析 - 柱状图
const handlingTimeXAxis = ref({
    type: 'category',
    data: ['0-30分钟', '30-60分钟', '1-2小时', '2小时以上']
  type: "category",
  data: ["0-1天", "1-3天", "3-7天", "7天以上"],
});
const handlingTimeSeries = ref([
    {
        name: '处理数量',
        type: 'bar',
        data: [280, 75, 45, 25],
    name: "审核数量",
    type: "bar",
    data: [85, 45, 20, 10],
        itemStyle: {
            color: function(params) {
                return barColors[params.dataIndex % barColors.length];
            }
      },
        },
        label: {
            show: true,
            position: 'top'
        }
    }
      position: "top",
    },
  },
]);
// 获取报警级别样式
const getAlarmLevelType = (level) => {
// 获取承包商级别样式
const getContractorLevelType = (level) => {
    switch(level) {
        case '严重': return 'danger';
        case '中等': return 'warning';
        case '轻微': return 'info';
        default: return 'info';
    case "A":
      return "danger";
    case "B":
      return "warning";
    case "C":
      return "info";
    default:
      return "info";
    }
};
@@ -376,7 +467,7 @@
    gap: 8px;
    padding: 20px;
    min-width: 0;
    background-color: #EFF2FB;
  background-color: #eff2fb;
    border-radius: 12px;
    height: 138px;
}
@@ -392,7 +483,7 @@
.system-name {
    font-weight: 600;
    font-size: 18px;
    color: #161A9A;
  color: #161a9a;
}
.system-meta {
@@ -547,7 +638,7 @@
    position: absolute;
    left: 0;
    top: 4px;
    content: '';
  content: "";
    width: 4px;
    height: 18px;
    background-color: #409eff;