zhouwenxuan
2024-03-18 38af7850e2c62b28ccb6f990140ac17c4bc21419
src/views/specialWorkSystem/specialIndex/index.vue
@@ -64,7 +64,7 @@
      <div class="chart-item">
        <dv-border-box10 v-if="isFull==true" class="item-bg"></dv-border-box10>
        <div class="chart-tit">
          <span class="tit">异常警报关联人</span>
          <span class="tit">作业警报记录</span>
          <div class="filter-part">
            <el-switch
                v-model="chartSearch4.type"
@@ -252,14 +252,15 @@
      </div>
    </div>
    <el-dialog v-model="dialogDetails" title="作业申请详情" center>
      <fire v-if="dialogType == 1" :details = details></fire>
      <space v-else-if="dialogType == 2" :details = details></space>
      <hoist v-else-if="dialogType == 3" :details = details></hoist>
      <ground v-else-if="dialogType == 4" :details = details></ground>
      <broken v-else-if="dialogType == 5" :details = details></broken>
      <height v-else-if="dialogType == 6" :details = details></height>
      <power v-else-if="dialogType == 7" :details = details></power>
      <plate v-else :details = details></plate>
<!--      <fire v-if="dialogType == 1" :details = details></fire>-->
<!--      <space v-else-if="dialogType == 2" :details = details></space>-->
<!--      <hoist v-else-if="dialogType == 3" :details = details></hoist>-->
<!--      <ground v-else-if="dialogType == 4" :details = details></ground>-->
<!--      <broken v-else-if="dialogType == 5" :details = details></broken>-->
<!--      <height v-else-if="dialogType == 6" :details = details></height>-->
<!--      <power v-else-if="dialogType == 7" :details = details></power>-->
<!--      <plate v-else :details = details></plate>-->
<!--      <detail-log :type=dialogType :statusList=statusList :details = details></detail-log>-->
      <template #footer>
              <span class="dialog-footer">
                <el-button type="primary" @click="dialogDetails = false"
@@ -346,6 +347,8 @@
  isFull:boolean;
  themeColor:string;
  endTime:string
  pieData: Array<status>
  squareData: Array<status>
}
interface type {
  id: number | null;
@@ -369,24 +372,24 @@
  components: {
    VideoDetail,
    WorkRecord,
    fire: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/wdsq/components/fireLog.vue')),
    space: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/wdsq/components/spaceLog.vue')),
    hoist: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/wdsq/components/hoistLog.vue')),
    ground: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/wdsq/components/groundLog.vue')),
    broken: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/wdsq/components/brokenLog.vue')),
    height: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/wdsq/components/heightLog.vue')),
    power: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/wdsq/components/powerLog.vue')),
    plate: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/wdsq/components/plateLog.vue'))
    // fire: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/fireLog.vue')),
    // space: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/spaceLog.vue')),
    // hoist: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/hoistLog.vue')),
    // ground: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/groundLog.vue')),
    // broken: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/brokenLog.vue')),
    // height: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/heightLog.vue')),
    // power: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/powerLog.vue')),
    // plate: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/plateLog.vue'))
  },
  setup() {
    const userInfo = useUserInfo();
    const { userInfos } = storeToRefs(userInfo);
    const router = useRouter();
    const userInfo = useUserInfo()
    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 videoRef = ref();
    const videoRef = ref()
    const recordRef = ref()
    const state = reactive<stateType>({
      pageIndex: 1,
@@ -413,7 +416,7 @@
      },
      chartSearch2: {
        depId: 1,
        startTime: '',
        // startTime: '',
        type: null
      },
      chartSearch3: {
@@ -480,6 +483,8 @@
          value: 2
        }
      ],
      pieData: [],
      squareData: [],
      warningData: [
        {
          name: '黄公子',
@@ -518,9 +523,6 @@
      getTypePie()
      getWorkDep()
      getDepMonth()
      initZyfb()
      initSlfx()
      initZyqs()
    });
    const initTime =()=>{
      state.chartSearch1.startTime = getPeriod(30)
@@ -570,10 +572,12 @@
      }else{
        state.themeColor = '#333'
      }
      initZyfb()
      initSlfx()
      initZyqs()
      initTime()
      getMydepList()
      getAllDepartment();
      getTypePie()
      getWorkDep()
      getDepMonth()
    }
    const getTypePie = async ()=>{
      const data = {
@@ -583,7 +587,9 @@
      }
      let res = await specialIndexApi().analyseType(data);
      if (res.data.code === '200') {
        console.log('饼图数据>>>', res.data.data)
        // console.log('饼图数据>>>', res.data.data)
        state.pieData = JSON.parse(JSON.stringify(res.data.data))
        initZyfb()
      } else {
        ElMessage({
          type: 'warning',
@@ -593,14 +599,17 @@
    }
    const getWorkDep = async ()=>{
      const data = {
        startTime: state.chartSearch2.startTime,
        endTime: state.endTime,
        // startTime: state.chartSearch2.startTime,
        // endTime: state.endTime,
        depId:state.chartSearch2.depId,
        type: state.chartSearch2.type
      }
      let res = await specialIndexApi().analyseAllWork(data);
      if (res.data.code === '200') {
        console.log('条形图数据>>>', res.data.data)
        state.squareData = JSON.parse(JSON.stringify(res.data.data))
        let names = state.squareData.map(i=>i.name)
        let vals = state.squareData.map(i=>i.value)
        initSlfx(names,vals)
      } else {
        ElMessage({
          type: 'warning',
@@ -611,7 +620,10 @@
    const getDepMonth = async ()=>{
      let res = await specialIndexApi().analyseDepMonth(state.chartSearch3.depId);
      if (res.data.code === '200') {
        console.log('折线图数据>>>', res.data.data)
        state.squareData = JSON.parse(JSON.stringify(res.data.data))
        let names = state.squareData.map(i=>i.name)
        let vals = state.squareData.map(i=>i.value)
        initZyqs(names,vals)
      } else {
        ElMessage({
          type: 'warning',
@@ -695,16 +707,7 @@
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              },
            },
            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: '盲板抽堵作业' }
            ]
            data: state.pieData
          }
        ]
      }
@@ -714,7 +717,7 @@
        myChart.resize();
      });
    }
    const initSlfx =()=>{
    const initSlfx =(names:Array<string>,vals:Array<any>)=>{
      let dom = document.getElementById(slfx.value);
      let myChart = echarts.init(dom);
      let option: EChartsOption;
@@ -734,7 +737,7 @@
        xAxis: [
          {
            type: 'category',
            data: ['事业部1', '事业部2', '事业部3', '事业部4', '事业部5', '事业部6', '事业部7'],
            data: names,
            axisTick: {
              alignWithLabel: true
            },
@@ -753,7 +756,7 @@
            name: 'Direct',
            type: 'bar',
            barWidth: '60%',
            data: [10, 52, 200, 334, 390, 330, 220]
            data: vals,
          }
        ]
      }
@@ -763,14 +766,14 @@
        myChart.resize();
      });
    }
    const initZyqs =()=>{
    const initZyqs =(names:Array<string>,vals:Array<any>)=>{
      let dom = document.getElementById(zyqs.value);
      let myChart = echarts.init(dom);
      let option: EChartsOption;
      option = {
        xAxis: {
          type: 'category',
          data: ['四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月', '一月', '二月', '三月'],
          data: names,
          axisLabel: {
            color: state.themeColor
          }
@@ -794,7 +797,7 @@
        },
        series: [
          {
            data: [150, 230, 224, 218, 135, 147, 230, 224, 218, 135, 147, 260],
            data: vals,
            type: 'line',
            label:{
              show: true
@@ -887,44 +890,44 @@
    };
    // 查看记录
    const viewDetail = (row: any) => {
      state.dialogType = row.workType
      state.details = JSON.parse(JSON.stringify(row));
      if(state.details.workDetail.otherSpecialWork == '' || !state.details.workDetail.otherSpecialWork){
        state.details.workDetail.otherSpecialWork=[]
      }
      else {
        const a = state.details.workDetail.otherSpecialWork
        state.details.workDetail.otherSpecialWork = a.split(',').map((item) => {
          return state.workTypeList.find((i: { id: number }) => i.id === Number(item))?.name;
        });
      }
      if(state.details.workDetail.involvedDepIds == '' || !state.details.workDetail.involvedDepIds){
        state.details.workDetail.involvedDepIds=[]
      }
      else {
        const a = state.details.workDetail.involvedDepIds
        state.details.workDetail.involvedDepIds = a.split(',').map((item) => {
          return state.departmentRecursionList.find((i: { depId: number }) => i.depId === Number(item))?.depName;
        });
      }
      if(state.details.workDetail.csDepId){
        state.details.workDetail.csDepId = state.departmentRecursionList.find((i: { depId: number }) => i.depId === Number(state.details.workDetail.csDepId))?.depName;
      }
      if(state.details.workDetail.operationDepId){
        state.details.workDetail.operationDepId = state.departmentRecursionList.find((i: { depId: number }) => i.depId === Number(state.details.workDetail.operationDepId))?.depName;
      }
      if(state.details.workDetail.gbPath){
        state.details.workDetail.gbPath = state.details.workDetail.gbPath.split(',')
      }
      if(state.details.workDetail.bcPath){
        state.details.workDetail.bcPath = state.details.workDetail.bcPath.split(',')
      }
      if(state.details.workDetail.bpLocationMapPath){
        state.details.workDetail.bpLocationMapPath = state.details.workDetail.bpLocationMapPath.split(',')
      }
      state.dialogDetails = true;
    };
    // const viewDetail = (row: any) => {
    //   state.dialogType = row.workType
    //   state.details = JSON.parse(JSON.stringify(row));
    //   if(state.details.workDetail.otherSpecialWork == '' || !state.details.workDetail.otherSpecialWork){
    //     state.details.workDetail.otherSpecialWork=[]
    //   }
    //   else {
    //     const a = state.details.workDetail.otherSpecialWork
    //     state.details.workDetail.otherSpecialWork = a.split(',').map((item) => {
    //       return state.workTypeList.find((i: { id: number }) => i.id === Number(item))?.name;
    //     });
    //   }
    //   if(state.details.workDetail.involvedDepIds == '' || !state.details.workDetail.involvedDepIds){
    //     state.details.workDetail.involvedDepIds=[]
    //   }
    //   else {
    //     const a = state.details.workDetail.involvedDepIds
    //     state.details.workDetail.involvedDepIds = a.split(',').map((item) => {
    //       return state.departmentRecursionList.find((i: { depId: number }) => i.depId === Number(item))?.depName;
    //     });
    //   }
    //   if(state.details.workDetail.csDepId){
    //     state.details.workDetail.csDepId = state.departmentRecursionList.find((i: { depId: number }) => i.depId === Number(state.details.workDetail.csDepId))?.depName;
    //   }
    //   if(state.details.workDetail.operationDepId){
    //     state.details.workDetail.operationDepId = state.departmentRecursionList.find((i: { depId: number }) => i.depId === Number(state.details.workDetail.operationDepId))?.depName;
    //   }
    //   if(state.details.workDetail.gbPath){
    //     state.details.workDetail.gbPath = state.details.workDetail.gbPath.split(',')
    //   }
    //   if(state.details.workDetail.bcPath){
    //     state.details.workDetail.bcPath = state.details.workDetail.bcPath.split(',')
    //   }
    //   if(state.details.workDetail.bpLocationMapPath){
    //     state.details.workDetail.bpLocationMapPath = state.details.workDetail.bpLocationMapPath.split(',')
    //   }
    //   state.dialogDetails = true;
    // };
    // const handleReview = (row: object)=>{
    //   state.dialogReview = true
@@ -1042,7 +1045,7 @@
      toApply,
      searchRecord,
      clearSearch,
      viewDetail,
      // viewDetail,
      viewRecord,
      viewTicket,
      downLoadTicket,