Newer
Older
KaiFengPC / src / views / floodSys / repair / repairManage.vue
@zhangdeliang zhangdeliang on 23 May 8 KB 初始化项目
<template>
  <!-- 排水防涝子系统 长效运维  维修管理-->
  <div class="publicContainer">
    <!-- 搜索区域 -->
    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
      <el-form-item label="工单描述" prop="rpOrderDesc">
        <el-input v-model="queryParams.rpOrderDesc" placeholder="请输入" clearable @keyup.enter="handleQuery" />
      </el-form-item>
      <el-form-item label="维修状态" prop="rpStatus">
        <el-select v-model="queryParams.rpStatus" 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="rpOrderType">
        <el-select v-model="queryParams.rpOrderType" placeholder="请选择" clearable>
          <el-option v-for="item in orderType" :key="item.value" :label="item.label" :value="item.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="是否逾期" prop="isOverdue">
        <el-select v-model="queryParams.isOverdue" placeholder="请选择" clearable>
          <el-option v-for="item in yqType" :key="item.value" :label="item.label" :value="item.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="创建时间" prop="daterange">
        <el-date-picker
          type="daterange"
          v-model="daterange"
          value-format="YYYY-MM-DD"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          placeholder="请选择日期"
          clearable
        >
        </el-date-picker>
      </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="500">
      <el-table-column label="维修工单名称" prop="rpOrderName" />
      <el-table-column label="维修工单描述" prop="rpOrderDesc" />
      <el-table-column label="维修工单类型" prop="rpOrderType">
        <template #default="scope">
          <dict-tag :options="orderType" :value="scope.row.rpOrderType" />
        </template>
      </el-table-column>
      <el-table-column label="维修状态" prop="rpStatus">
        <template #default="scope">
          <dict-tag :options="statusType" :value="scope.row.rpStatus" />
        </template>
      </el-table-column>
      <el-table-column label="任务开始时间" prop="rpStartTime" width="160" />
      <el-table-column label="任务结束时间" prop="rpEndTime" width="160" />
      <el-table-column label="是否逾期" prop="isOverdue">
        <template #default="scope">
          {{ scope.row.isOverdue ? '是' : '否' }}
        </template>
      </el-table-column>
      <el-table-column label="派发人" prop="createUserName" />
      <el-table-column label="维修人员" prop="rpUserName" />
      <el-table-column label="创建时间" prop="createTime" width="160" />
      <el-table-column label="操作" width="200" class-name="small-padding fixed-width">
        <template #default="scope">
          <el-button link type="warning" icon="edit" @click="handleRate(scope.row)" v-hasPermi="['floodSys:warn:order']">
            审核评价
          </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="130px" class="publicForm">
        <el-form-item label="审核意见" prop="emResult">
          <el-select v-model="formData.emResult" placeholder="请选择" clearable>
            <el-option v-for="item in auditType" :key="item.value" :label="item.label" :value="item.value" />
          </el-select>
        </el-form-item>
        <el-form-item label="维修质量评分" prop="emQualityScore">
          <el-rate v-model="formData.emQualityScore" />
        </el-form-item>
        <el-form-item label="维修工作时间饱和度评分" prop="emSaturationScore">
          <el-rate v-model="formData.emSaturationScore" />
        </el-form-item>
        <el-form-item label="维修工作响应度评分" prop="emTimelinessScore">
          <el-rate v-model="formData.emTimelinessScore" />
        </el-form-item>
        <el-form-item label="评价意见" prop="emAppraise">
          <el-input type="textarea" v-model="formData.emAppraise" placeholder="请输入" />
        </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>
      <RepairDetail :eventId="eventId" v-if="dialogDetail" />
    </el-dialog>
  </div>
</template>

<script setup name="维修管理">
import { repairPage, repairOrder } from '@/api/floodSys/repair';
import RepairDetail from './repairDetail.vue';
import Cookies from 'js-cookie';

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 statusType = ref([
  { label: '待处理', value: 'unprocess' },
  { label: '处理中', value: 'ongoing' },
  { label: '已处理待评价', value: 'completed' },
  { label: '已审核评价', value: 'examined' },
]);
const orderType = ref([
  { label: '电话投诉事件', value: 'phone' },
  { label: '网上投诉事件', value: 'internet' },
  { label: '微信公众投诉事件', value: 'weChat' },
  { label: '设备故障维修工单', value: 'device_fault' },
]);
const yqType = ref([
  { label: '是', value: true },
  { label: '否', value: false },
]);
const auditType = ref([
  { label: '不通过', value: 'no_pass' },
  { label: '通过', value: 'special' },
]);
const daterange = ref([]);

const allData = reactive({
  formData: {
    emAppraise: '',
    emQualityScore: 5,
    emResult: '',
    emSaturationScore: 5,
    emTimelinessScore: 5,
    repairOrderId: '',
    rpUserName: '',
  },
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    isOverdue: undefined,
    rpOrderType: undefined,
    rpStatus: undefined,
    rpOrderDesc: undefined,
  },
  rulesForm: {
    emResult: [{ required: true, message: '请选择', trigger: 'change' }],
  },
});
const { queryParams, formData, rulesForm } = toRefs(allData);

/** 查询列表 */
function getDataList() {
  tableLoading.value = true;
  queryParams.value.createStartTime = daterange.value[0] ? daterange.value[0] + ' 00:00:00' : '';
  queryParams.value.createEndTime = daterange.value[1] ? daterange.value[1] + ' 23:59:59' : '';
  repairPage(queryParams.value).then(response => {
    tableData.value = response.data;
    total.value = response.total;
    tableLoading.value = false;
  });
}
/** 详情操作 */
function handleDetail(row) {
  eventId.value = String(row.id);
  dialogDetail.value = true;
}
/** 审核评价 */
function handleRate(row) {
  proxy.resetForm('formRef'); //清空表单
  formData.value.repairOrderId = row.id;
  formData.value.rpUserName = Cookies.get('usernameXG'); //操作人
  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) {
      repairOrder(formData.value).then(response => {
        proxy.$modal.msgSuccess('评价成功');
        dialogShow.value = false;
        getDataList();
      });
    }
  });
}

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