Newer
Older
KaiFengPC / src / views / floodSys / repair / eventYJ.vue
@zhangdeliang zhangdeliang on 23 May 14 KB 初始化项目
<template>
  <!-- 排水防涝子系统 长效运维  应急突发事件管理-->
  <div class="publicContainer">
    <!-- 搜索区域 -->
    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
      <el-form-item label="投诉意见" prop="eventName">
        <el-input v-model="queryParams.eventName" placeholder="请输入" clearable @keyup.enter="handleQuery" />
      </el-form-item>
      <el-form-item label="事件类型" prop="eventType">
        <el-select v-model="queryParams.eventType" placeholder="请选择" clearable>
          <el-option v-for="item in eventTypes" :key="item.value" :label="item.label" :value="item.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="事件状态" prop="eventStatus">
        <el-select v-model="queryParams.eventStatus" placeholder="请选择" clearable>
          <el-option v-for="item in eventStatusType" :key="item.value" :label="item.label" :value="item.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="紧急程度" prop="eventUrgency">
        <el-select v-model="queryParams.eventUrgency" placeholder="请选择" clearable>
          <el-option v-for="item in urgencyType" :key="item.value" :label="item.label" :value="item.value" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
        <el-button type="success" icon="Refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <!-- 按钮区域 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['floodSys:jing:add']">新增</el-button>
      </el-col>
      <right-toolbar v-model:showSearch="showSearch" @queryTable="getDataList"></right-toolbar>
    </el-row>
    <!-- 表格 -->
    <el-table v-loading="tableLoading" :data="tableData" max-height="600">
      <el-table-column label="投诉事件名称" prop="eventName" />
      <el-table-column label="处理状态" prop="eventStatus">
        <template #default="scope">
          <dict-tag :options="eventStatusType" :value="scope.row.eventStatus" />
        </template>
      </el-table-column>
      <el-table-column label="事件紧急程度" prop="eventUrgency">
        <template #default="scope">
          <dict-tag :options="urgencyType" :value="scope.row.eventUrgency" />
        </template>
      </el-table-column>
      <el-table-column label="事件要求" prop="eventRequirement" />
      <el-table-column label="事件地址" prop="eventHappenAddress" />
      <el-table-column label="事件发生时间" prop="eventHappenTime" />
      <el-table-column label="创建时间" prop="createTime" />
      <el-table-column label="操作" width="160" class-name="small-padding fixed-width">
        <template #default="scope">
          <el-button
            link
            type="primary"
            icon="Edit"
            @click="handleEdit(scope.row)"
            v-hasPermi="['floodSys:warn:edit']"
            v-if="scope.row.eventStatus == 'unprocess'"
          >
            修改
          </el-button>
          <el-button
            link
            type="warning"
            icon="Edit"
            @click="handleIgnore(scope.row)"
            v-hasPermi="['floodSys:warn:ignore']"
            v-if="scope.row.eventStatus == 'unprocess'"
          >
            忽略
          </el-button>
          <el-button
            link
            type="warning"
            icon="edit"
            @click="handleAnjian(scope.row)"
            v-hasPermi="['floodSys:warn:order']"
            v-if="scope.row.eventStatus == 'unprocess'"
          >
            转案件中心
          </el-button>
          <!-- <el-button
            link
            type="warning"
            icon="edit"
            @click="handleOrder(scope.row)"
            v-hasPermi="['floodSys:warn:order']"
            v-if="scope.row.eventStatus == 'unprocess'"
          >
            转现场核查工单
          </el-button> -->
          <el-button link type="primary" icon="check" @click="handleDetail(scope.row)" v-hasPermi="['floodSys:warn:AI']">详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <pagination
      v-show="total > 0"
      :total="total"
      v-model:page="queryParams.pageNum"
      v-model:limit="queryParams.pageSize"
      @pagination="getDataList"
    />

    <!-- 添加或修改弹窗 -->
    <el-dialog :title="dialogTitle" v-model="dialogShow" width="500px" append-to-body>
      <el-form ref="formRef" :model="formData" :rules="rulesForm" label-width="120px" class="publicForm">
        <el-form-item label="投诉意见" prop="eventName">
          <el-input type="textarea" v-model="formData.eventName" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="事件类型" prop="eventType">
          <el-select v-model="formData.eventType" placeholder="请选择" clearable>
            <el-option v-for="item in eventTypes" :key="item.value" :label="item.label" :value="item.value" />
          </el-select>
        </el-form-item>
        <el-form-item label="事件紧急程度" prop="eventUrgency">
          <el-select v-model="formData.eventUrgency" placeholder="请选择" clearable>
            <el-option v-for="item in urgencyType" :key="item.value" :label="item.label" :value="item.value" />
          </el-select>
        </el-form-item>
        <el-form-item label="事件发生时间" prop="eventHappenTime">
          <el-date-picker type="datetime" v-model="formData.eventHappenTime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="事件处理要求" prop="eventRequirement">
          <el-input type="textarea" v-model="formData.eventRequirement" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="事件发生位置" prop="eventHappenAddress">
          <el-input v-model="formData.eventHappenAddress" controls-position="right" placeholder="请输入">
            <template #append>
              <el-button type="primary" @click="showMap = true">获取经纬度</el-button>
            </template>
          </el-input>
        </el-form-item>
        <el-form-item label="现场照片" prop="scenePhotosFileList">
          <ImageFileUpload
            :limit="3"
            :saveFileArr="formData.scenePhotosFileList"
            :listType="'picture-card'"
            :refField="'scenePhotos'"
            :refType="'sceneCheckPhotosFileList'"
          ></ImageFileUpload>
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="info" @click="dialogShow = false">取 消</el-button>
          <el-button type="primary" @click="submitForm">确 定</el-button>
        </div>
      </template>
    </el-dialog>

    <!-- 地图选取位置 -->
    <el-dialog title="地图选取位置(可搜索可直接点击获取)" v-model="showMap" width="800px" append-to-body>
      <MapPosition v-if="showMap" :isShowSearch="true" :isShowTool="false" :isSelectAddress="true" @getPlace="getAddress"></MapPosition>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="showMap = false">确 定</el-button>
        </div>
      </template>
    </el-dialog>

    <!-- 详情 -->
    <el-dialog title="事件详情" v-model="dialogDetail" width="800px" append-to-body>
      <EventDetail :eventId="eventId" v-if="dialogDetail" />
    </el-dialog>

    <!-- 转现场核查 -->
    <el-dialog title="应急事件现场核查" v-model="dialogShowCheck" width="500px" append-to-body>
      <el-form ref="formRefCheck" :model="formDataCheck" :rules="rulesFormCheck" label-width="120px" class="publicForm">
        <el-form-item label="核查人员" prop="insUserNo">
          <el-select v-model="formDataCheck.insUserNo" placeholder="请选择" clearable>
            <el-option v-for="item in userList" :key="item.userName" :label="item.nickName" :value="item.userName" />
          </el-select>
        </el-form-item>
        <el-form-item label="事件紧急程度" prop="eventUrgency">
          <el-select v-model="formDataCheck.eventUrgency" placeholder="请选择" clearable>
            <el-option v-for="item in urgencyType" :key="item.value" :label="item.label" :value="item.value" />
          </el-select>
        </el-form-item>
        <el-form-item label="核查要求" prop="requirement">
          <el-input type="textarea" v-model="formDataCheck.requirement" placeholder="请输入" />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="info" @click="dialogShowCheck = false">取 消</el-button>
          <el-button type="primary" @click="submitFormCheck">确 定</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup name="应急突发事件管理">
import {
  eventManagePage,
  eventManageEdit,
  eventManageAdd,
  eventManageDetail,
  eventManageIgnore,
  eventManageCheck,
  eventManageCase,
} from '@/api/floodSys/repair';
import { listUser } from '@/api/system/user';
import EventDetail from './eventYJDetail.vue';
import { nextTick } from 'vue';
import MapPosition from '@/components/Map/index.vue'; //地图选点获取经纬度位置组件
import ImageFileUpload from '@/components/ImageFileUpload/index.vue'; //图片文件上传

const { proxy } = getCurrentInstance();

const showMap = ref(false);
const tableData = ref([]);
const tableLoading = ref(true);
const total = ref(0);
const dialogShow = ref(false);
const dialogShowCheck = ref(false);
const dialogDetail = ref(false);
const dialogTitle = ref('');
const showSearch = ref(true);
const eventId = ref('');
const eventStatusType = proxy.fixDict['eventStatusType']; //事件处理状态
const urgencyType = proxy.fixDict['urgencyType']; //事件紧急程度
const eventTypes = proxy.fixDict['eventTypes']; //事件类型
const userList = ref([]);

const allData = reactive({
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    eventName: undefined,
    eventStatus: undefined,
    eventType: undefined,
    eventUrgency: undefined,
  },
  formData: {},
  rulesForm: {
    eventHappenAddress: [{ required: true, message: '请输入', trigger: 'blur' }],
    eventName: [{ required: true, message: '请输入', trigger: 'blur' }],
    eventHappenTime: [{ required: true, message: '请选择', trigger: 'change' }],
    eventType: [{ required: true, message: '请选择', trigger: 'change' }],
    eventUrgency: [{ required: true, message: '请选择', trigger: 'change' }],
  },
  formDataCheck: {},
  rulesFormCheck: {
    eventUrgency: [{ required: true, message: '请选择', trigger: 'change' }],
    insUserName: [{ required: true, message: '请选择', trigger: 'change' }],
    insUserNo: [{ required: true, message: '请输入', trigger: 'blur' }],
  },
});
const { queryParams, formData, rulesForm, formDataCheck, rulesFormCheck } = toRefs(allData);

/** 查询列表 */
function getDataList() {
  tableLoading.value = true;
  eventManagePage(queryParams.value).then(response => {
    tableData.value = response.data;
    total.value = response.total;
    tableLoading.value = false;
  });
}
/** 搜索按钮操作 */
function handleQuery() {
  queryParams.value.pageNum = 1;
  getDataList();
}
/** 重置按钮操作 */
function resetQuery() {
  proxy.resetForm('queryRef');
  handleQuery();
}
/** 新增按钮操作 */
function handleAdd() {
  proxy.resetForm('formRef'); //清空表单
  dialogTitle.value = '新增投诉事件';
  dialogShow.value = true;
}
// 修改
function handleEdit(row) {
  eventManageDetail(row.id).then(response => {
    dialogShow.value = true;
    dialogTitle.value = '修改投诉事件';
    nextTick(() => {
      let datas = response.data;
      formData.value = datas;
    });
  });
}
/** 忽略按钮操作 */
function handleIgnore(row) {
  proxy.$modal
    .confirm('确定忽略该投诉事件?')
    .then(() => {
      eventManageIgnore(row.id).then(res => {
        proxy.$modal.msgSuccess('忽略成功');
        getDataList();
      });
    })
    .catch(() => {});
}
/** 新增修改提交按钮 */
function submitForm() {
  proxy.$refs['formRef'].validate(valid => {
    if (valid) {
      if (dialogTitle.value == '修改投诉事件') {
        eventManageEdit(formData.value).then(response => {
          proxy.$modal.msgSuccess('修改事件成功');
          dialogShow.value = false;
          getDataList();
        });
      } else {
        eventManageAdd(formData.value).then(response => {
          proxy.$modal.msgSuccess('新增事件成功');
          dialogShow.value = false;
          getDataList();
        });
      }
    }
  });
}
/** 转现场核查提交按钮 */
function submitFormCheck() {
  proxy.$refs['formRefCheck'].validate(valid => {
    if (valid) {
      formDataCheck.value.insUserName = userList.value.filter(item => item.userName == formDataCheck.value.insUserNo)[0].nickName;
      eventManageCheck(formDataCheck.value).then(response => {
        proxy.$modal.msgSuccess('转现场核查工单成功');
        dialogShowCheck.value = false;
        getDataList();
      });
    }
  });
}
/** 转现场核查工单 */
function handleOrder(row) {
  proxy.resetForm('formRefCheck'); //清空表单
  formDataCheck.value.eventId = row.id;
  dialogShowCheck.value = true;
}
/** 转案件中心 */
function handleAnjian(row) {
  proxy.$modal
    .confirm('确定生成案件处理?')
    .then(() => {
      eventManageCase(row.id).then(res => {
        proxy.$modal.msgSuccess('生成案件成功');
        getDataList();
      });
    })
    .catch(() => {});
}
/** 详情 */
function handleDetail(row) {
  eventId.value = String(row.id);
  dialogDetail.value = true;
}
// 获取位置
function getAddress(val) {
  formData.value.eventHappenAddress = val.caseAddress;
  formData.value.longitude = val.lonLat[0];
  formData.value.latitude = val.lonLat[1];
}
//查询负责人列表
function getUserList() {
  listUser().then(res => {
    userList.value = res.data;
  });
}
onMounted(() => {
  getUserList();
  getDataList();
});
</script>