马宇豪
2024-03-25 9673c181dd7b3882cbde386422ffb9a2b1949693
src/views/specialWorkSystem/specialIndex/index.vue
@@ -66,20 +66,20 @@
        <div class="chart-tit">
          <span class="tit">作业警报记录</span>
          <div class="filter-part">
            <el-switch
                v-model="chartSearch4.type"
                inline-prompt
                style="--el-switch-on-color: #13ce66; --el-switch-off-color: #13ce66"
                active-text="作业人"
                inactive-text="监护人"
            />
            <el-select :teleported="false" 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-switch-->
<!--                v-model="chartSearch4.type"-->
<!--                inline-prompt-->
<!--                style="&#45;&#45;el-switch-on-color: #13ce66; &#45;&#45;el-switch-off-color: #13ce66"-->
<!--                active-text="作业人"-->
<!--                inactive-text="监护人"-->
<!--            />-->
            <el-select :teleported="false" v-model="chartSearch4.days" size="small" @change="(value)=>changeTime4(value)">
              <el-option label="近7天" :value="7"/>
              <el-option label="近30天" :value="30"/>
              <el-option label="近90天" :value="90"/>
              <el-option label="近1年" :value="365"/>
            </el-select>
            <el-select :teleported="false" v-model="chartSearch4.workType" size="small">
            <el-select :teleported="false" v-model="chartSearch4.workType" size="small" @change="changeType4()">
              <el-option
                  v-for="item in workType1"
                  :key="item.id"
@@ -91,17 +91,17 @@
        </div>
        <div class="chart">
          <el-table ref="multipleTableRef" :data="warningData" style="width: 100%" stripe border :header-cell-style="{ background: '#fafafa' }">
            <el-table-column property="name" label="姓名" align="center"/>
            <el-table-column property="dep" label="所属部门" align="center"/>
            <el-table-column property="warning" label="异常报警次数" align="center"/>
            <el-table-column property="role" label="角色" align="center"/>
            <el-table-column property="isCard" label="是否持证" align="center">
              <template #default="scope">
                <span>{{scope.row.isCard == 1?'是':'否'}}</span>
              </template>
            </el-table-column>
            <el-table-column property="operatorUname" label="姓名" align="center"/>
            <el-table-column property="deptName" label="所属部门" align="center"/>
            <el-table-column property="warningCount" label="异常报警次数" align="center"/>
<!--            <el-table-column property="role" label="角色" align="center"/>-->
<!--            <el-table-column property="isCard" label="是否持证" align="center">-->
<!--              <template #default="scope">-->
<!--                <span>{{scope.row.isCard == 1?'是':'否'}}</span>-->
<!--              </template>-->
<!--            </el-table-column>-->
          </el-table>
          <el-button type="text" size="small" style="margin-top: 10px">所有记录>></el-button>
<!--          <el-button type="text" size="small" style="margin-top: 10px">所有记录>></el-button>-->
        </div>
        <!--            <div class="chart" :id="slfx"></div>-->
      </div>
@@ -423,9 +423,9 @@
        depId: 1
      },
      chartSearch4: {
        searchDep: null,
        startTime: '',
        days: 30
        days: 30,
        workType: 1
      },
      searchDep2: null,
      searchDep: null,
@@ -485,29 +485,7 @@
      ],
      pieData: [],
      squareData: [],
      warningData: [
        {
          name: '黄公子',
          dep: '有机事业部',
          warning: 69,
          role: '作业人',
          isCard: 1
        },
        {
          name: '李飞飞',
          dep: '有机事业部',
          warning: 51,
          role: '监护人',
          isCard: 0
        },
        {
          name: '黄公子',
          dep: '有机事业部',
          warning: 69,
          role: '作业人',
          isCard: 1
        }
      ],
      warningData: [],
      reviewForm: {
        advice: ''
      },
@@ -523,28 +501,34 @@
      getTypePie()
      getWorkDep()
      getDepMonth()
      getWarningList()
    });
    const initTime =()=>{
      state.chartSearch1.startTime = getPeriod(30)
      state.chartSearch2.startTime = getPeriod(30)
      state.chartSearch4.startTime = getPeriod(30)
      state.endTime = formatDate(new Date())
    }
    const getPeriod =(num)=> {
      const currentDate = new Date();
      const startTime = new Date();
      startTime.setDate(currentDate.getDate() - num);
      startTime.setDate(currentDate.getDate() - num - 1);
      return formatDate(startTime)
    }
    const formatDate =(date)=> {
      const year = date.getFullYear().toString();
      const month = ('0' + (date.getMonth() + 1)).slice(-2);
      const day = ('0' + date.getDate()).slice(-2);
      return `${year}-${month}-${day} 00:00:00`;
      return `${year}-${month}-${day} 23:59:59`;
    }
    const changeTime1=(value:number)=>{
      state.chartSearch1.startTime = getPeriod(value)
      console.log(state.chartSearch1.startTime,state.endTime,'结束段')
      getTypePie()
    }
    const changeTime4=(value:number)=>{
      state.chartSearch4.startTime = getPeriod(value)
      console.log(state.chartSearch4.startTime,state.endTime,'结束段')
      getWarningList()
    }
    const changeDep1=()=>{
      getTypePie()
@@ -555,6 +539,9 @@
    }
    const changeType2=()=>{
      getWorkDep()
    }
    const changeType4=()=>{
      getWarningList()
    }
    const changeDep3=()=>{
      getDepMonth()
@@ -645,6 +632,22 @@
      if (res.data.code === '200') {
        state.workData = JSON.parse(JSON.stringify(res.data.data))
        state.totalSize = res.data.total
      } else {
        ElMessage({
          type: 'warning',
          message: res.data.msg
        });
      }
    }
    const getWarningList = async()=>{
      const data = {
        startTime: state.chartSearch4.startTime,
        endTime: state.endTime,
        workType:state.chartSearch4.workType
      }
      let res = await specialIndexApi().getWorkWarning(data)
      if (res.data.code === '200') {
        state.warningData = JSON.parse(JSON.stringify(res.data.data))
      } else {
        ElMessage({
          type: 'warning',
@@ -1033,9 +1036,11 @@
      slfx,
      zyqs,
      changeTime1,
      changeTime4,
      changeDep1,
      changeDep2,
      changeType2,
      changeType4,
      changeDep3,
      toFullscreen,
      // handleReview,
@@ -1156,57 +1161,57 @@
      .chart{
        width: 100%;
        height: 85%;
        overflow-y: scroll;
        .el-table{
          height: 90% !important;
          :deep(.el-table__inner-wrapper){
            height: 100% !important;
            .el-table__header-wrapper {
              height: 20% !important;
              .el-table__header{
                height: 100% !important;
                th{
                  height: 100% !important;
                  padding: 0 0 !important;
                  .cell{
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                  }
                }
              }
            }
            .el-table__body-wrapper {
              height: 80% !important;
              .el-scrollbar__view{
                height: 100% !important;
                .el-table__body{
                  height: 100% !important;
                  tbody{
                    height: 100% !important;
                    .el-table__row{
                      height: 25% !important;
                      td{
                        height: 25% !important;
                        padding: 0 0 !important;
                        .left-info{
                          display: flex;
                          align-items: center;
                        }
                        .cell{
                          white-space: nowrap;
                          overflow: hidden;
                          text-overflow: ellipsis;
                        }
                        .el-button{
                          padding: 0 !important;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
          //:deep(.el-table__inner-wrapper){
          //  height: 100% !important;
          //  .el-table__header-wrapper {
          //    height: 20% !important;
          //    .el-table__header{
          //      height: 100% !important;
          //      th{
          //        height: 100% !important;
          //        padding: 0 0 !important;
          //        .cell{
          //          white-space: nowrap;
          //          overflow: hidden;
          //          text-overflow: ellipsis;
          //        }
          //      }
          //    }
          //  }
          //  .el-table__body-wrapper {
          //    height: 80% !important;
          //    .el-scrollbar__view{
          //      height: 100% !important;
          //      .el-table__body{
          //        height: 100% !important;
          //        tbody{
          //          height: 100% !important;
          //          .el-table__row{
          //            height: 25% !important;
          //            td{
          //              height: 25% !important;
          //              padding: 0 0 !important;
          //              .left-info{
          //                display: flex;
          //                align-items: center;
          //              }
          //              .cell{
          //                white-space: nowrap;
          //                overflow: hidden;
          //                text-overflow: ellipsis;
          //              }
          //              .el-button{
          //                padding: 0 !important;
          //              }
          //            }
          //          }
          //        }
          //      }
          //    }
          //  }
          //}
        }
      }
      .el-radio-group{