Newer
Older
DH_Apicture / src / views / pictureOnMap / page / FloodControlAndDrainage / Fuzhujuece / AuxiliaryResearchAndJudgmentLeft / component / Beonduty.vue
@ZZJ ZZJ 1 day ago 11 KB update
<template>
  <!-- 值班 -->
  <div class="Beonduty">
    <EachModuleTitle title="辅助研判" :isTab="false"></EachModuleTitle>
    <!-- <div
        class="flex-1 tab"
        :class="tabActive == i.value ? 'active' : ''"
        v-for="i in tabData"
        :key="i.value"
        @click="tabClickFun(i)"
      >
        {{ i.label }}
      </div> -->
    <!-- <div class="typeList flex">

      <div
        class="flex-1 tab"
      >
        防汛值班{{ ZBTJData?.fbDutySignUserNum||0 }}/{{ZBTJData?.fbDutyUserNum||0}}
      </div>
      <div
        class="flex-1 tab"
      >
        泵站值班{{ ZBTJData?.pumpDutySignNum||0 }}/{{ZBTJData?.pumpDutyNum||0}}
      </div>
      <div
        class="flex-1 tab"
      >
        排涝车辆{{ ZBTJData?.carOnlineNum||0 }}/{{ZBTJData?.carNum||0}}
      </div>
    </div> -->
    <div class="yjBtn flex flex-align-center">
      预警建议
      <div class="blue pointer" @click="startEmergencyResponse">{{ yjtj?.recommendGrade }}</div>
    </div>
    <!-- 防汛值班 -->
    <div class="dutyBox">
      <div class="text">防汛值班</div>
      <div class="showDuty">
        <div class="eachdutyInfo">
          <div class="imgBox jrzbimg"></div>
          <el-popover :visible="visible" placement="top" :width="100">
            <div>
              <el-checkbox-group v-model="checkedCities">
                <el-checkbox v-for="item in jrzbText" :key="item.dutyUserId" :label="item.dutyUserId" :value="item.dutyUserId">
                  {{ item.dutyUserName }}
                </el-checkbox>
              </el-checkbox-group>
            </div>
            <div style="text-align: right; margin: 0">
              <el-button size="small" text @click="visible = false">关闭</el-button>
              <el-button size="small" type="primary" @click="confirmClick(1)"> 签到 </el-button>
            </div>
            <template #reference>
              <div style="cursor: pointer" @click="zhiban(1)">
                <div class="typeText">今日值班</div>
                <div class="name jrzbName" v-for="item in jrzbText" :key="item">
                  <span :title="item.dutyUserName + '' + item.dutyUserPhone">{{ item.dutyUserName }}&nbsp; </span>
                </div>
              </div>
            </template>
          </el-popover>
        </div>
        <div class="eachdutyInfo">
          <div class="imgBox dbldimg"></div>
          <el-popover :visible="visible2" placement="top" :width="100">
            <div>
              <el-checkbox-group v-model="checkedCities">
                <el-checkbox v-for="item in zbldText" :key="item.dutyUserId" :label="item.dutyUserId" :value="item.dutyUserId">
                  {{ item.dutyUserName }}
                </el-checkbox>
              </el-checkbox-group>
            </div>
            <div style="text-align: right; margin: 0">
              <el-button size="small" text @click="visible2 = false">关闭</el-button>
              <el-button size="small" type="primary" @click="confirmClick(2)"> 签到 </el-button>
            </div>
            <template #reference>
              <div style="cursor: pointer" @click="zhiban(2)">
                <div class="typeText">带班领导</div>
                <div class="name jrzbName" v-for="item in zbldText" :key="item">
                  <span :title="item.dutyUserName + '' + item.dutyUserPhone">{{ item.dutyUserName }}&nbsp; </span>
                </div>
              </div>
            </template>
          </el-popover>
        </div>
      </div>
    </div>
    <!-- 排涝值守 -->
    <div class="dutyBox">
      <div class="text">排涝值守</div>
      <div class="showDuty">
        <div class="eachdutyInfo">
          <div class="imgBox jrxcimg"></div>
          <div>
            <div class="typeText">今日巡查人数</div>
            <div class="name jrzbName">{{ PLZSData?.watchUserNum || 0 }}</div>
          </div>
        </div>
        <div class="eachdutyInfo">
          <div class="imgBox plddimg"></div>
          <div>
            <div class="typeText">排涝调度次数</div>
            <div class="name dbldName">{{ PLZSData?.dispatchNum || 0 }}次</div>
          </div>
        </div>
      </div>
    </div>
    <!-- 启动应急响应弹框 -->
    <el-dialog
      title="发布响应"
      style="height: 670px"
      append-to-body
      modal-class="pmpSitNewDialog"
      v-model="floodDialogRelease"
      v-if="floodDialogRelease"
      width="1200px"
      :before-close="floodReleaseClose"
    >
      <FloodReleaseForm @floodReleaseClose="floodReleaseClose" :fxType="1" :fxLeve="3" />
    </el-dialog>
  </div>
</template>
<script setup nama="Beonduty">
import { ref, reactive, onMounted } from 'vue';
import EachModuleTitle from '@/views/pictureOnMap/page/components/EachModuleTitle.vue';
import FloodReleaseForm from './FloodReleaseForm/index.vue';
import {
  drainageDispatchGetDutyCount,
  drainageDispatchGetFbTodayDutyUserShift,
  drainageDispatchGetWatchCount,
  getResponseRecommend,
  dutyRecordInfobatchAdd,
} from '@/api/FloodControlAndDrainage.js';
import bus from '@/bus';

const { proxy } = getCurrentInstance();

const tabData = [
  { label: '防汛值班(2/2)', value: '1' },
  { label: '泵站值班(10/10)', value: '2' },
  { label: '排涝车辆(10/18)', value: '3' },
];
const tabActive = ref(1);
const tabClickFun = item => {
  tabActive.value = item.value;
};
const floodDialogRelease = ref(false);
const startEmergencyResponse = () => {
  floodDialogRelease.value = true;
};
function floodReleaseClose() {
  floodDialogRelease.value = false;
}
// 获取数据
const loading1 = ref(false);
const loading2 = ref(false);
const loading3 = ref(false);
const ZBTJData = ref(null); //值班统计
const JRZBData = ref(null); //今日防汛值班
const PLZSData = ref(null); //排涝值守
function gitDataFunZBTJ() {
  loading1.value = true;
  drainageDispatchGetDutyCount().then(
    res => {
      console.log('获取值班统计', res);
      loading1.value = false;
      if (res && res.code == 200) {
        ZBTJData.value = res.data;
      }
    },
    error => {
      loading1.value = false;
    }
  );
}
const jrzbText = ref([]);
const zbldText = ref([]);
function gitDataFunJRZB() {
  loading2.value = true;
  drainageDispatchGetFbTodayDutyUserShift().then(
    res => {
      console.log('获取今日防汛值班', res);
      loading2.value = false;
      if (res && res.code == 200) {
        res.data.map(item => {
          if (item.dutyUserList && item.dutyUserList.length) {
            item.dutyUserList.map(p => {
              p.dutyShiftId = item.dutyShiftId;
              p.dutyShiftName = item.dutyShiftName;
            });
          }
        });

        JRZBData.value = res.data;
        let arr = [];
        let arr2 = [];
        arr = JRZBData.value.filter(item => {
          return item.dutyShiftName == '领导值班';
        });
        if (arr && arr.length) {
          zbldText.value = arr[0].dutyUserList;
        }
        arr2 = JRZBData.value.filter(item => {
          return item.dutyShiftName == '今日值班';
        });

        if (arr2 && arr2.length) {
          jrzbText.value = arr2[0].dutyUserList;
        }

        console.log('获取到的数据', jrzbText.value, zbldText.value);
      }
    },
    error => {
      loading2.value = false;
    }
  );
}
function gitDataFunPLZS() {
  loading3.value = true;
  drainageDispatchGetWatchCount().then(
    res => {
      console.log('获取排涝值守', res);
      loading3.value = false;
      if (res && res.code == 200) {
        PLZSData.value = res.data;
      }
    },
    error => {
      loading3.value = false;
    }
  );
}
const yjtj = ref(null);
// 获取预警推荐等级
function gitDataFunYJTJ() {
  getResponseRecommend().then(
    res => {
      console.log('获取警情建议', res);
      if (res && res.code == 200) {
        yjtj.value = res.data;
      }
    },
    error => {}
  );
}

const visible = ref(false);
const visible2 = ref(false);
const checkedCities = ref([]);

function zhiban(type) {
  visible.value = false;
  visible2.value = false;
  checkedCities.value = [];
  if (type == 1 && jrzbText.value.length) {
    visible.value = true;
    jrzbText.value.map(e => {
      if (e.clockStatus) {
        checkedCities.value.push(e.dutyUserId);
      }
    });
  }
  if (type == 2 && zbldText.value.length) {
    visible2.value = true;
    zbldText.value.map(e => {
      if (e.clockStatus) {
        checkedCities.value.push(e.dutyUserId);
      }
    });
  }
}

async function confirmClick(type) {
  console.log(type);
  console.log('checkedCities', checkedCities.value);

  if (checkedCities.value.length > 0) {
    let pushArr = [];

    if (type == 1) {
      jrzbText.value.map(e => {
        if (checkedCities.value.includes(e.dutyUserId)) {
          pushArr.push(e);
        }
      });
    }
    if (type == 2) {
      zbldText.value.map(e => {
        if (checkedCities.value.includes(e.dutyUserId)) {
          pushArr.push(e);
        }
      });
    }

    console.log('pushArr', pushArr);
    // let params = {
    //   request: pushArr,
    // };

    let res = await dutyRecordInfobatchAdd(pushArr);
    if (res && res.code == 200) {
      proxy.$modal.msgSuccess('签到成功');
      visible.value = false;
      visible2.value = false;
    }
  }
}

onMounted(() => {
  gitDataFunZBTJ();
  gitDataFunJRZB();
  gitDataFunPLZS();
  gitDataFunYJTJ();
});
onMounted(() => {});
</script>
<style lang="scss" scoped>
.Beonduty {
  .dutyBox {
    background: linear-gradient(0deg, #00134f 0%, #003065 100%);
    border-radius: 6px;
    border: 1px solid #163f80;
    display: flex;
    height: 100px;
    margin-top: 8px;
    .text {
      width: 50px;
      height: 100%;
      background: linear-gradient(0deg, rgba(0, 98, 183, 0.9) 0%, rgba(0, 98, 183, 0.3) 100%);
      border-radius: 6px;
      writing-mode: vertical-rl;
      text-align: center;
      padding-right: 14px;
      font-weight: bold;
      font-size: 16px;
      color: #ffffff;
    }
    .showDuty {
      display: flex;
      flex: 1;
      justify-content: space-around;
      align-items: center;
      .eachdutyInfo {
        display: flex;
        font-weight: 500;
        font-size: 14px;
        color: #ccdfff;
      }
      .imgBox {
        width: 90px;
        height: 84px;
      }
      .jrzbimg {
        background: url('@/assets/images/pictureOnMap/jrzb.png') no-repeat center;
        background-size: 100% 100%;
      }
      .dbldimg {
        background: url('@/assets/images/pictureOnMap/dbld.png') no-repeat center;
        background-size: 100% 100%;
      }
      .jrxcimg {
        background: url('@/assets/images/pictureOnMap/jrxc.png') no-repeat center;
        background-size: 100% 100%;
      }
      .plddimg {
        background: url('@/assets/images/pictureOnMap/pldd.png') no-repeat center;
        background-size: 100% 100%;
      }
      .typeText {
        width: 95px;
        padding-top: 10px;
        padding-bottom: 5px;
      }
      .name {
        font-weight: bold;
        font-size: 16px;
        line-height: 25px;
      }
      .jrzbName {
        color: #2cb7ff;
      }
      .dbldName {
        color: #00fcff;
      }
    }
  }
  .typeList {
    .tab {
      cursor: auto;
    }
  }
}
</style>