Selaa lähdekoodia

添加超期分析

qinhb 4 kuukautta sitten
vanhempi
commit
577069d529

+ 7 - 0
src/api/report/index.ts

@@ -32,3 +32,10 @@ export function getOperationInfo(data: string) {
     data,
     data,
   });
   });
 }
 }
+export function outTimeInfo(data: string) {
+  return request({
+    url: "/api/v1/process/census/outTime/info",
+    method: "post",
+    data: {}
+  });
+}

+ 2 - 2
src/views/device/instance/index.vue

@@ -382,7 +382,7 @@ option.value = Object.assign(option.value, {
         }
         }
       },
       },
     },
     },
-    {
+    /*{
       label: "连接状态",
       label: "连接状态",
       prop: "collectState",
       prop: "collectState",
       width: 100,
       width: 100,
@@ -395,7 +395,7 @@ option.value = Object.assign(option.value, {
           return '<b class="el-tag el-tag--warning el-tag--light">未连接</b>';
           return '<b class="el-tag el-tag--warning el-tag--light">未连接</b>';
         }
         }
       },
       },
-    },
+    },*/
     {
     {
       label: "负责人",
       label: "负责人",
       prop: "head",
       prop: "head",

+ 99 - 0
src/views/report/statistics/outTime/components/PieChart1.vue

@@ -0,0 +1,99 @@
+<!-- 饼图 -->
+<template>
+  <el-card>
+    <div :id="id" :class="className" :style="{ height, width }"></div>
+  </el-card>
+</template>
+
+<script setup lang="ts">
+import * as echarts from "echarts";
+import {defineProps, ref} from "vue";
+
+const props = defineProps({
+  id: {
+    type: String,
+    default: "pieChart",
+  },
+  className: {
+    type: String,
+    default: "",
+  },
+  width: {
+    type: String,
+    default: "200px",
+    required: true,
+  },
+  height: {
+    type: String,
+    default: "200px",
+    required: true,
+  },
+  list: {
+    type: Array,
+    default: [],
+    required: true
+  }
+});
+const options = {
+  title : {
+    text: '订单准时完成率',
+    x:'center'
+  },
+  tooltip : {
+    trigger: 'item',
+    formatter: "{b} : {c} ({d}%)"
+  },
+  legend: {
+    orient : 'vertical',
+    x : 'left',
+    data:['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
+  },
+  calculable : true,
+  series : [
+    {
+      name:'访问来源',
+      type:'pie',
+      radius : '75%',
+      center: ['50%', '50%'],
+      data:[
+        { name:'直接访问',value:70},
+        {value:30, name:'邮件营销'},
+      ]
+    }
+  ]
+};
+
+const chart = ref<any>("");
+watch?.(
+    () => props.list,
+    (newVal) => {
+      options.series[0].data = props.list
+      options.legend.data = []
+      props.list.forEach(item=>{
+        options.legend.data.push(item.name)
+      })
+      handle()
+    }
+);
+
+const handle=()=>{
+  chart.value = markRaw(
+      echarts.init(document.getElementById(props.id) as HTMLDivElement)
+  );
+
+  chart.value.setOption(options);
+
+  window.addEventListener("resize", () => {
+    chart.value.resize();
+  });
+}
+onMounted(() => {
+ handle();
+});
+
+onActivated(() => {
+  if (chart.value) {
+    chart.value.resize();
+  }
+});
+</script>

+ 99 - 0
src/views/report/statistics/outTime/components/PieChart2.vue

@@ -0,0 +1,99 @@
+<!-- 饼图 -->
+<template>
+  <el-card>
+    <div :id="id" :class="className" :style="{ height, width }"></div>
+  </el-card>
+</template>
+
+<script setup lang="ts">
+import * as echarts from "echarts";
+import {defineProps, ref} from "vue";
+
+const props = defineProps({
+  id: {
+    type: String,
+    default: "pieChart",
+  },
+  className: {
+    type: String,
+    default: "",
+  },
+  width: {
+    type: String,
+    default: "200px",
+    required: true,
+  },
+  height: {
+    type: String,
+    default: "200px",
+    required: true,
+  },
+  list: {
+    type: Array,
+    default: [],
+    required: true
+  }
+});
+const options = {
+  title : {
+    text: '工单准时完成率',
+    x:'center'
+  },
+  tooltip : {
+    trigger: 'item',
+    formatter: "{b} : {c} ({d}%)"
+  },
+  legend: {
+    orient : 'vertical',
+    x : 'left',
+    data:['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
+  },
+  calculable : true,
+  series : [
+    {
+      name:'访问来源',
+      type:'pie',
+      radius : '75%',
+      center: ['50%', '50%'],
+      data:[
+        { name:'直接访问',value:70},
+        {value:30, name:'邮件营销'},
+      ]
+    }
+  ]
+};
+
+const chart = ref<any>("");
+watch?.(
+    () => props.list,
+    (newVal) => {
+      options.series[0].data = props.list
+      options.legend.data = []
+      props.list.forEach(item=>{
+        options.legend.data.push(item.name)
+      })
+      handle()
+    }
+);
+
+const handle=()=>{
+  chart.value = markRaw(
+      echarts.init(document.getElementById(props.id) as HTMLDivElement)
+  );
+
+  chart.value.setOption(options);
+
+  window.addEventListener("resize", () => {
+    chart.value.resize();
+  });
+}
+onMounted(() => {
+  handle();
+});
+
+onActivated(() => {
+  if (chart.value) {
+    chart.value.resize();
+  }
+});
+</script>

+ 99 - 0
src/views/report/statistics/outTime/components/PieChart3.vue

@@ -0,0 +1,99 @@
+<!-- 饼图 -->
+<template>
+  <el-card>
+    <div :id="id" :class="className" :style="{ height, width }"></div>
+  </el-card>
+</template>
+
+<script setup lang="ts">
+import * as echarts from "echarts";
+import {defineProps, ref} from "vue";
+
+const props = defineProps({
+  id: {
+    type: String,
+    default: "pieChart",
+  },
+  className: {
+    type: String,
+    default: "",
+  },
+  width: {
+    type: String,
+    default: "200px",
+    required: true,
+  },
+  height: {
+    type: String,
+    default: "200px",
+    required: true,
+  },
+  list: {
+    type: Array,
+    default: [],
+    required: true
+  }
+});
+const options = {
+  title : {
+    text: '超期原因分析',
+    x:'center'
+  },
+  tooltip : {
+    trigger: 'item',
+    formatter: "{b} : {c} ({d}%)"
+  },
+  legend: {
+    orient : 'vertical',
+    x : 'left',
+    data:['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
+  },
+  calculable : true,
+  series : [
+    {
+      name:'访问来源',
+      type:'pie',
+      radius : '75%',
+      center: ['50%', '50%'],
+      data:[
+        { name:'直接访问',value:70},
+        {value:30, name:'邮件营销'},
+      ]
+    }
+  ]
+};
+
+const chart = ref<any>("");
+watch?.(
+    () => props.list,
+    (newVal) => {
+      options.series[0].data = props.list
+      options.legend.data = []
+      props.list.forEach(item=>{
+        options.legend.data.push(item.name)
+      })
+      handle()
+    }
+);
+
+const handle=()=>{
+  chart.value = markRaw(
+      echarts.init(document.getElementById(props.id) as HTMLDivElement)
+  );
+
+  chart.value.setOption(options);
+
+  window.addEventListener("resize", () => {
+    chart.value.resize();
+  });
+}
+onMounted(() => {
+  handle();
+});
+
+onActivated(() => {
+  if (chart.value) {
+    chart.value.resize();
+  }
+});
+</script>

+ 148 - 0
src/views/report/statistics/outTime/index.vue

@@ -0,0 +1,148 @@
+<template>
+  <div class="dashboard-container">
+    <!-- 数据卡片 -->
+    <el-row :gutter="10" class="mt-3">
+      <el-col :xs="24" :sm="12" :lg="12">
+        <el-card shadow="never">
+          <template #header>
+            <div class="flex items-center justify-between">
+              <span class="text-[var(--el-text-color-secondary)]">总订单数</span>
+              <el-tag type="success">{{ amount1 }}</el-tag>
+            </div>
+          </template>
+
+          <div
+            class="flex items-center justify-between mt-5 text-sm text-[var(--el-text-color-secondary)]"
+          >
+            <span> 超期订单 </span>
+            <el-tag type="error">{{outAmount1}}</el-tag>
+          </div>
+        </el-card>
+      </el-col>
+
+      <!--消息数-->
+      <el-col :xs="24" :sm="12" :lg="12">
+        <el-card shadow="never">
+          <template #header>
+            <div class="flex items-center justify-between">
+              <span class="text-[var(--el-text-color-secondary)]">总工单数</span>
+              <el-tag type="success">{{amount2}}</el-tag>
+            </div>
+          </template>
+
+
+          <div
+            class="flex items-center justify-between mt-5 text-sm text-[var(--el-text-color-secondary)]"
+          >
+            <span> 超期工单 </span>
+            <el-tag type="error">{{outAmount2}}</el-tag>
+          </div>
+        </el-card>
+      </el-col>
+    </el-row>
+
+    <!-- Echarts 图表 -->
+    <el-row :gutter="10" class="mt-3">
+      <el-col :xs="24" :sm="12" :lg="8" class="mb-2">
+        <PieChart1
+            id="pieChart1"
+            height="400px"
+            width="100%"
+            class="bg-[var(--el-bg-color-overlay)]"
+            :list="list1"
+        />
+      </el-col>
+      <el-col :xs="24" :sm="12" :lg="8" class="mb-2">
+        <PieChart2
+          id="pieChart2"
+          height="400px"
+          width="100%"
+          class="bg-[var(--el-bg-color-overlay)]"
+          :list="list2"
+        />
+      </el-col>
+
+      <el-col :xs="24" :sm="12" :lg="8" class="mb-2">
+        <PieChart3
+            id="pieChart3"
+            height="400px"
+            width="100%"
+            class="bg-[var(--el-bg-color-overlay)]"
+            :list="list3"
+        />
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+defineOptions({
+  name: "Dashboard",
+  inheritAttrs: false,
+});
+import { useUserStore } from "@/store/modules/user";
+import {outTimeInfo} from "@/api/report"
+const userStore = useUserStore();
+const date: Date = new Date();
+
+const duration = 5000;
+
+const list1 = ref([])
+const list2 = ref([])
+const list3 = ref([])
+// 销售额
+const amount1 = ref(0);
+const amount2 = ref(0);
+
+
+const outAmount1 = ref(0);
+const outAmount2 = ref(0);
+
+onMounted(() => {
+  outTimeInfo("").then((res)=>{
+    amount1.value = res.data.orderNum;
+    amount2.value = res.data.workOrderNum;
+    outAmount1.value = res.data.outOrder;
+    outAmount2.value = res.data.outWorkOrder;
+    list1.value = res.data.orderRate;
+    list2.value = res.data.workOrderRate;
+    list3.value = res.data.reasons;
+  });
+});
+</script>
+
+<style lang="scss" scoped>
+.dashboard-container {
+  position: relative;
+  padding: 24px;
+
+  .user-avatar {
+    width: 40px;
+    height: 40px;
+    border-radius: 50%;
+  }
+
+  .github-corner {
+    position: absolute;
+    top: 0;
+    right: 0;
+    z-index: 1;
+    border: 0;
+  }
+
+  .data-box {
+    display: flex;
+    justify-content: space-between;
+    padding: 20px;
+    font-weight: bold;
+    color: var(--el-text-color-regular);
+    background: var(--el-bg-color-overlay);
+    border-color: var(--el-border-color);
+    box-shadow: var(--el-box-shadow-dark);
+  }
+
+  .svg-icon {
+    fill: currentcolor !important;
+  }
+}
+</style>