Newer
Older
KaiFengPC / src / views / floodSys / repair / anJian.vue
@鲁yixuan 鲁yixuan on 19 Aug 8 KB updata
<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 statusType" :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">
      <right-toolbar v-model:showSearch="showSearch" @queryTable="getDataList"></right-toolbar>
    </el-row>
    <!-- 表格 -->
    <el-table v-loading="tableLoading" :data="tableData" max-height="650">
      <el-table-column label="案件名称" prop="eventName" />
      <el-table-column label="案件类型" prop="eventType">
        <template #default="scope">
          <dict-tag :options="eventTypes" :value="scope.row.eventType" />
        </template>
      </el-table-column>
      <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="createTime" />
      <el-table-column label="操作" width="200" class-name="small-padding fixed-width">
        <template #default="scope">
          <el-button
            link
            type="warning"
            icon="edit"
            @click="handleRepair(scope.row)"
            v-hasPermi="['floodSys:warn:order']"
            v-if="scope.row.eventStatus == 'case_handling'"
          >
            转维修工单
          </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="转维修工单" 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="rpUserNo">
          <el-select v-model="formData.rpUserNo" 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="rpExpectTime">
          <el-date-picker type="datetime" v-model="formData.rpExpectTime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="事件紧急程度" prop="rpUrgency">
          <el-select v-model="formData.rpUrgency" 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="rpRequire">
          <el-input type="textarea" v-model="formData.rpRequire" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="维修类型" prop="rpType">
          <el-select v-model="formData.rpType" placeholder="请选择" clearable>
            <el-option v-for="item in repairType" :key="item.value" :label="item.label" :value="item.value" />
          </el-select>
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="info" @click="cancelForm">取 消</el-button>
          <el-button type="primary" @click="submitForm">确 定</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>
  </div>
</template>

<script setup name="案件管理">
import { anjianPage, anjianOrder } from '@/api/floodSys/repair';
import EventDetail from './eventYJDetail.vue';
import { listUser } from '@/api/system/user';

const { proxy } = getCurrentInstance();

const tableData = ref([]);
const tableLoading = ref(true);
const total = ref(0);
const dialogShow = ref(false);
const showSearch = ref(true);
const dialogDetail = ref(false);
const eventId = ref('');

const urgencyType = proxy.fixDict['urgencyType']; //事件紧急程度
const eventTypes = proxy.fixDict['eventTypes']; //事件类型
const eventStatusType = proxy.fixDict['eventStatusType']; //事件处理状态
const statusType = ref([
  { label: '转案件中心(待维修)', value: 'unrepair' },
  { label: '转案件中心(已维修完成)', value: 'repaired' },
]);
const repairType = ref([
  { label: '小修', value: 'minor' },
  { label: '专项维修', value: 'special' },
]);
const userList = ref([]);

const allData = reactive({
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    eventName: undefined,
    eventType: undefined,
    eventStatus: undefined,
    eventUrgency: undefined,
  },
  formData: {
    eventRelationId: '',
    rpUserName: '',
    rpUserNo: '',
    rpUrgency: '',
    rpType: '',
    rpRequire: '',
    rpExpectTime: '',
  },
  rulesForm: {
    rpUserNo: [{ required: true, message: '请输入', trigger: 'blur' }],
    rpUrgency: [{ required: true, message: '请输入', trigger: 'blur' }],
    postSort: [{ required: true, message: '请输入', trigger: 'blur' }],
  },
});
const { queryParams, formData, rulesForm } = toRefs(allData);

/** 搜索列表 */
function getDataList() {
  tableLoading.value = true;
  anjianPage(queryParams.value).then(response => {
    tableData.value = response.data;
    total.value = response.total;
    tableLoading.value = false;
  });
}
/** 转维修工单 */
function handleRepair(row) {
  proxy.resetForm('formRef'); //清空表单
  formData.value.eventRelationId = row.id;
  dialogShow.value = true;
}
/** 取消按钮 */
function cancelForm() {
  dialogShow.value = false;
}
/** 搜索按钮操作 */
function handleQuery() {
  queryParams.value.pageNum = 1;
  getDataList();
}
/** 重置按钮操作 */
function resetQuery() {
  proxy.resetForm('queryRef');
  handleQuery();
}
/** 提交按钮 */
function submitForm() {
  proxy.$refs['formRef'].validate(valid => {
    if (valid) {
      formData.value.rpUserName = userList.value.filter(item => item.userName == formData.value.rpUserNo)[0].nickName;
      anjianOrder(formData.value).then(response => {
        proxy.$modal.msgSuccess('转维修工单成功');
        dialogShow.value = false;
        getDataList();
      });
    }
  });
}
/** 详情 */
function handleDetail(row) {
  eventId.value = String(row.id);
  dialogDetail.value = true;
}
//搜索维修人员列表
function getUserList() {
  listUser().then(res => {
    userList.value = res.data;
  });
}

onMounted(() => {
  getDataList();
  getUserList();
});
</script>