马宇豪
2023-03-10 e5e9b84b800f1623f85be45a3565689917898c78
src/views/specialWorkSystem/specialIndex/index.vue
@@ -1,145 +1,57 @@
<template>
    <div class="home-container">
        <div class="topChart">
          <div class="chart-item">
            <div class="chart-tit">
              <span class="tit">八大作业各分类分布图</span>
              <div class="filter-part filter-part2">
                <el-cascader v-model="chartSearch1.searchDep" :options="departmentList" :props="casProps" :show-all-levels="false" size="small"/>
              </div>
            </div>
            <div class="chart" :id="zyfb"></div>
            <el-radio-group v-model="chartSearch1.period" size="small">
              <el-radio label="week" border>近7天</el-radio>
              <el-radio label="month" border>近30天</el-radio>
              <el-radio label="season" border>近90天</el-radio>
              <el-radio label="year" border>近一年</el-radio>
            </el-radio-group>
          </div>
          <div class="chart-item">
            <div class="chart-tit">
              <span class="tit">各事业部关联作业分析</span>
              <div class="filter-part">
                <el-cascader v-model="chartSearch2.searchDep" :options="departmentList" :props="casProps" :show-all-levels="false" size="small"/>
                <el-select v-model="chartSearch2.type" size="small">
                  <el-option
                      v-for="item in workType1"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id"
                  />
                </el-select>
              </div>
            </div>
            <div class="chart" :id="slfx"></div>
          </div>
        </div>
        <div class="topChart">
          <div class="chart-item">
            <div class="chart-tit">
              <span class="tit">关联作业趋势图</span>
              <div class="filter-part filter-part2">
                <el-cascader v-model="chartSearch3.searchDep" :options="departmentList" :props="casProps" :show-all-levels="false" size="small"/>
              </div>
            </div>
            <div class="chart" :id="zyqs"></div>
          </div>
          <div class="chart-item">
            <div class="chart-tit">
              <span class="tit">异常警报关联人</span>
              <div class="filter-part">
                <el-switch
                    v-model="chartSearch4.type"
                    class="ml-2"
                    inline-prompt
                    style="--el-switch-on-color: #13ce66; --el-switch-off-color: #13ce66"
                    active-text="作业人"
                    inactive-text="监护人"
                />
                <el-select v-model="chartSearch4.period" size="small">
                  <el-option label="近7天" value="week"/>
                  <el-option label="近30天" value="month"/>
                  <el-option label="近90天" value="season"/>
                  <el-option label="近1年" value="year"/>
                </el-select>
                <el-select v-model="chartSearch4.workType" size="small">
                  <el-option
                      v-for="item in workType1"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id"
                  />
                </el-select>
              </div>
            </div>
            <div class="chart">
              <el-table ref="multipleTableRef" :data="warningData" style="width: 100%" :header-cell-style="{ background: '#fafafa' }">
                <el-table-column property="name" label="姓名" width="180" align="center"/>
                <el-table-column property="depName" label="所属部门" align="center"/>
                <el-table-column property="applyUname" label="异常报警次数" align="center"/>
                <el-table-column property="operators" label="角色" align="center"/>
                <el-table-column label="是否持证" align="center" width="180">
                  <template #default="scope">
                    <el-tag :type="scope.row.status==2?'success':(scope.row.status==8||scope.row.status==9)?'warning':'danger'">{{ scope.row.statusDesc }}</el-tag>
                  </template>
                </el-table-column>
              </el-table>
            </div>
<!--            <div class="chart" :id="slfx"></div>-->
          </div>
        </div>
        <div style="height: 100%">
            <div class="homeCard">
                <el-row>
                  <el-col :span="5" style="display:flex;align-items: center">
            <el-row class="homeCard">
                <el-col :span="5" style="display:flex;align-items: center">
                    <span style="white-space: nowrap">作业类型:</span>
                    <div class="grid-content topInfo">
                      <el-select v-model="searchWord">
                        <el-option
                            v-for="item in workType"
                            :key="item.id"
                            :label="item.name"
                            :value="item.id"
                        />
                      </el-select>
                        <el-select v-model="searchWord">
                            <el-option
                                    v-for="item in workType"
                                    :key="item.id"
                                    :label="item.name"
                                    :value="item.id"
                            />
                        </el-select>
                    </div>
                  </el-col>
                  <el-col :span="5" style="display:flex;align-items: center">
                    <span style="white-space: nowrap">作业状态:</span>
                    <div class="grid-content topInfo">
                      <el-select v-model="searchStatus">
                        <el-option
                            v-for="item in workStatus"
                            :key="item.value"
                            :label="item.name"
                            :value="item.value"
                        />
                      </el-select>
                    </div>
                  </el-col>
                  <el-col :span="5" style="display:flex;align-items: center">
                </el-col>
                <el-col :span="5" style="display:flex;align-items: center">
                  <span style="white-space: nowrap">作业状态:</span>
                  <div class="grid-content topInfo">
                    <el-select v-model="searchStatus">
                      <el-option
                          v-for="item in workStatus"
                          :key="item.value"
                          :label="item.name"
                          :value="item.value"
                      />
                    </el-select>
                  </div>
                </el-col>
                <el-col :span="5" style="display:flex;align-items: center">
                    <span style="white-space: nowrap">作业部门:</span>
                    <div class="grid-content topInfo">
                      <el-cascader v-model="searchDep" :options="departmentList" :props="casProps" :show-all-levels="false"/>
                        <el-cascader v-model="searchDep" :options="departmentList" :props="casProps" :show-all-levels="false"/>
                    </div>
                  </el-col>
                  <el-col :span="6" style="display:flex;align-items: center;">
                </el-col>
                <el-col :span="6" style="display:flex;align-items: center;">
                    <span style="white-space: nowrap;margin-left: 20px">申请时间:</span>
                    <div class="grid-content topInfo">
                      <el-date-picker
                          v-model="searchDate"
                          type="daterange"
                          unlink-panels
                          range-separator="至"
                          start-placeholder="开始日期"
                          end-placeholder="结束日期"
                          format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss"
                      />
                        <el-date-picker
                                v-model="searchDate"
                                type="daterange"
                                unlink-panels
                                range-separator="至"
                                start-placeholder="开始日期"
                                end-placeholder="结束日期"
                                format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss"
                        />
                    </div>
                  </el-col>
                  <el-button type="primary" style="margin-left: 20px" @click="searchRecord">查询</el-button>
                  <el-button plain @click="clearSearch">重置</el-button>
                </el-row>
                </el-col>
                <el-button type="primary" style="margin-left: 20px" @click="searchRecord">查询</el-button>
                <el-button plain @click="clearSearch">重置</el-button>
            </el-row>
            <div class="homeCard">
                <div class="main-card">
                    <el-row class="cardTop" style="justify-content: space-between">
                        <el-col :span="2" class="mainCardBtn">
@@ -163,7 +75,7 @@
                          <el-button type="primary" :icon="Refresh" size="default" @click="reLoadData()" />
                        </el-col>
                    </el-row>
                    <el-table ref="multipleTableRef" :data="applyData" style="width: 100%" :header-cell-style="{ background: '#fafafa' }">
                    <el-table ref="multipleTableRef" :data="applyData" style="width: 100%" height="calc(100% - 100px)" :header-cell-style="{ background: '#fafafa' }">
                        <el-table-column property="workPermitNo" label="作业证编号" width="180" align="center"/>
                      <el-table-column property="depName" label="部门" align="center"/>
                        <el-table-column property="applyUname" label="申请人" align="center"/>
@@ -249,7 +161,6 @@
import {teamManageApi} from "/@/api/systemManage/basicDateManage/personShiftManage/teamManage";
import Cookies from 'js-cookie';
import axios from 'axios';
import * as echarts from "echarts";
// 定义接口来定义对象的类型
interface stateType {
@@ -265,23 +176,16 @@
    chosenIndex: null | number;
    searchWord: number | null;
    searchStatus: number | null;
    chartSearch1: object;
    chartSearch2: object;
    chartSearch3: object;
    chartSearch4: object;
    searchDep2: number | null;
    searchDep: number | null;
    searchDate: Array<any>,
    totalSize1: number;
    details: {};
    workType: Array<type>;
    workType1: Array<type>;
    dialogType: number | null;
    departmentList: Array<any>;
    departmentRecursionList: Array<DepartmentState>;
    workStatus: Array<status>;
    reviewForm: object;
    reviewRules: object;
    reviewForm: object
}
interface type {
    id: number;
@@ -317,9 +221,6 @@
        const { userInfos } = storeToRefs(userInfo);
        const router = useRouter();
        const reviewFormRef = ref<FormInstance>()
        const zyfb = ref("eChartZyfb" + Date.now() + Math.random())
        const slfx = ref("eChartSlfx" + Date.now() + Math.random())
        const zyqs = ref("eChartZyqs" + Date.now() + Math.random())
        const state = reactive<stateType>({
            pageIndex1: 1,
            pageSize1: 10,
@@ -331,21 +232,6 @@
            chosenIndex: null,
            searchWord: null,
            searchStatus: null,
            chartSearch1: {
              searchDep: null,
              period: 'month'
            },
            chartSearch2: {
              searchDep: null,
              type: 0
            },
            chartSearch3: {
              searchDep: null
            },
            chartSearch4: {
              searchDep: null
            },
            searchDep2: null,
            searchDep: null,
            searchDate: [],
            applyData: [],
@@ -364,17 +250,6 @@
            },
            dialogDetails: false,
            details: {},
            workType1: [
              { id: 0, name: '所有作业' },
              { id: 1, name: '动火作业' },
              { id: 2, name: '受限空间作业' },
              { id: 3, name: '吊装作业' },
              { id: 4, name: '动土作业' },
              { id: 5, name: '断路作业' },
              { id: 6, name: '高处作业' },
              { id: 7, name: '临时用电作业' },
              { id: 8, name: '盲板抽堵作业' }
            ],
            workType: [
                { id: 1, name: '动火作业' },
                { id: 2, name: '受限空间作业' },
@@ -405,153 +280,12 @@
            ],
            reviewForm: {
              advice: ''
            },
            reviewRules:{
              advice: [{ required: true, message: '请填写验收意见', trigger: 'blur' }]
            }
        });
      // 页面载入时执行方法
      onMounted(() => {
        getListByPage();
        getAllDepartment();
        initZyfb()
        initSlfx()
        initZyqs()
      });
      type EChartsOption = echarts.EChartsOption
      const initZyfb =()=>{
        let dom = document.getElementById(zyfb.value);
        let myChart = echarts.init(dom);
        let option: EChartsOption;
        option = {
          tooltip: {
            trigger: 'item'
          },
          legend: {
            orient: 'vertical',
            left: 'left',
            top: 'center'
          },
          series: [
            {
              name: 'Access From',
              type: 'pie',
              radius: ['40%', '70%'],
              avoidLabelOverlap: false,
              itemStyle: {
                borderRadius: 1,
                borderColor: '#fff',
                borderWidth: 2
              },
              label: {
                show: false,
                position: 'center'
              },
              emphasis: {
                label: {
                  show: true,
                  fontSize: 40,
                  fontWeight: 'bold'
                }
              },
              labelLine: {
                show: true
              },
              data: [
                { value: 1048, name: '动火作业' },
                { value: 735, name: '受限空间作业' },
                { value: 580, name: '吊装作业' },
                { value: 484, name: '动土作业' },
                { value: 735, name: '断路作业' },
                { value: 580, name: '高处作业' },
                { value: 484, name: '临时用电作业' },
                { value: 300, name: '盲板抽堵作业' }
              ]
            }
          ]
        }
        option && myChart.setOption(option);
        window.addEventListener("resize",function (){
          myChart.resize();
        });
      }
      const initSlfx =()=>{
        let dom = document.getElementById(slfx.value);
        let myChart = echarts.init(dom);
        let option: EChartsOption;
        option = {
          tooltip: {
            trigger: 'axis',
            axisPointer: {
              type: 'shadow'
            }
          },
          grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
          },
          xAxis: [
            {
              type: 'category',
              data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
              axisTick: {
                alignWithLabel: true
              }
            }
          ],
          yAxis: [
            {
              type: 'value'
            }
          ],
          series: [
            {
              name: 'Direct',
              type: 'bar',
              barWidth: '60%',
              data: [10, 52, 200, 334, 390, 330, 220]
            }
          ]
        }
        option && myChart.setOption(option);
        window.addEventListener("resize",function (){
          myChart.resize();
        });
      }
      const initZyqs =()=>{
        let dom = document.getElementById(zyqs.value);
        let myChart = echarts.init(dom);
        let option: EChartsOption;
        option = {
          xAxis: {
            type: 'category',
            data: ['四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月', '一月', '二月', '三月']
          },
          yAxis: {
            type: 'value'
          },
          grid: {
            top: '8%',
            bottom: '8%'
          },
          series: [
            {
              data: [150, 230, 224, 218, 135, 147, 230, 224, 218, 135, 147, 260],
              type: 'line'
            }
          ]
        }
        option && myChart.setOption(option);
        window.addEventListener("resize",function (){
          myChart.resize();
        });
      }
      const reviewRules = reactive<FormRules>({
        advice: [{ required: true, message: '请填写验收意见', trigger: 'blur' }]
      })
        // 刷新
        const reLoadData = async () => {
            getListByPage();
@@ -710,6 +444,12 @@
            await initBackEndControlRoutes();
        };
        // 页面载入时执行方法
        onMounted(() => {
            getListByPage();
            getAllDepartment()
        });
        return {
            View,
            Edit,
@@ -720,9 +460,7 @@
            Download,
            FolderChecked,
            reviewFormRef,
            zyfb,
            slfx,
            zyqs,
            reviewRules,
            handleReview,
            submitReview,
            reLoadData,
@@ -757,88 +495,6 @@
        .el-tab-pane {
            height: 100%;
        }
    }
    .topChart{
      width: 100%;
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      margin-bottom: 20px;
      height: 40%;
      .chart-item{
        width: calc(50% - 10px);
        height: 100%;
        margin-right: 10px;
        position: relative;
        background: #fff;
        padding: 20px;
        &:last-of-type{
          margin-right: 0;
        }
        .chart-tit{
          width: 100%;
          display: flex;
          align-items: flex-start;
          justify-content: space-between;
          .tit{
            font-size: 16px;
            font-weight: bolder;
          }
          .filter-part{
            display: flex;
            align-items: center;
            justify-content: right;
            :deep(.el-cascader){
              width: 35% !important;
            }
            .el-select{
              width: 35% !important;
              margin-left: 10px;
            }
            .el-switch{
              width: 25% !important;
              :deep(.el-switch__core){
                width: 100% !important;
              }
            }
          }
          .filter-part2{
            :deep(.el-cascader){
              width: 100% !important;
            }
          }
        }
        .chart{
          width: 100%;
          height: 88%;
        }
        .el-radio-group{
          width: 20%;
          display: flex;
          flex-flow: column nowrap;
          align-items: flex-start;
          position: absolute;
          right: 10px;
          top: 50%;
          transform: translateY(-30%);
          .el-radio{
            width: 100%;
            margin-bottom: 4px;
          }
        }
        :deep(.active-ring-info){
          .active-ring-name{
            font-size: 1.5rem !important;
            text-align: center;
          }
        }
      }
    }
    .homeCard {
        width: 100%;
@@ -900,6 +556,9 @@
                }
            }
        }
        &:last-of-type {
            height: calc(100% - 100px);
        }
    }
    .stepItem {
        display: flex;