Newer
Older
KaiFengPC / src / views / longoPeration / ProblemStatistics.vue
@zhangdeliang zhangdeliang on 5 Sep 6 KB update
<template>
  <!-- 项目问题统计 -->
  <div class="publicContainer">
    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
      <el-form-item label="项目名称:" prop="projectNo">
        <el-select clearable filterable v-model="queryParams.projectNo" style="width: 180px" placeholder="请选择项目名称">
          <el-option v-for="proj in projectTList" :key="proj.projectNo" :label="proj.projectName" :value="proj.projectNo" />
        </el-select>
      </el-form-item>
      <el-form-item label="整改状态:" prop="isRectification">
        <el-select clearable v-model="queryParams.isRectification" style="width: 180px" placeholder="请选择整改状态">
          <el-option v-for="item in case_level" :key="item.value" :label="item.label" :value="item.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="巡查类型:" prop="uploadType">
        <el-select clearable v-model="queryParams.uploadType" style="width: 180px" placeholder="请选择巡查类型">
          <el-option v-for="item in patrol_Stype" :key="item.value" :label="item.label" :value="item.value" />
        </el-select>
      </el-form-item>

      <el-form-item label="上报时间:" prop="timer">
        <el-date-picker
          style="width: 280px"
          format="YYYY-MM-DD"
          value-format="YYYY-MM-DD"
          v-model="queryParams.timer"
          type="daterange"
          unlink-panels
          range-separator="至"
          start-placeholder="开始时间"
          end-placeholder="结束时间"
        />
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
        <el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>
      </el-form-item>
    </el-form>

    <!-- 按钮区域 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <!-- <el-button type="primary" icon="Plus" @click="handleAdd">新增</el-button> -->
      </el-col>
      <right-toolbar v-model:showSearch="showSearch" @queryTable="getDataList"></right-toolbar>
    </el-row>
    <!-- 表格 -->
    <el-table :data="dataList" v-loading="loading" :max-height="580">
      <el-table-column type="index" width="55" label="序号" />
      <el-table-column label="项目名称" prop="projectName" />
      <el-table-column label="巡查人员" prop="userName"> </el-table-column>
      <el-table-column label="巡查类型" prop="uploadType">
        <template #default="scope">
          <span>
            {{ scope.row.uploadType == '1' ? '计划巡查' : scope.row.uploadType == '2' ? '临时巡查' : '' }}
          </span>
        </template>
      </el-table-column>

      <el-table-column label="项目整改状态" prop="isRectification">
        <template #default="scope">
          <span :class="scope.row.isRectification == '1' ? 'green' : 'red'">
            {{ scope.row.isRectification == '1' ? '无需整改' : scope.row.isRectification == '2' ? '需要整改' : '' }}
          </span>
        </template>
      </el-table-column>

      <el-table-column label="检查项" prop="checkItem">
        <template #default="scope">
          <dict-tag :options="inspection_items" :value="String(scope.row.checkItem)" />
        </template>
      </el-table-column>
      <el-table-column label="问题描述" prop="problemContent" />
      <el-table-column label="上报地址" prop="problemAddress" />
      <el-table-column label="问题图片" prop="sysFileList" width="300">
        <template #default="scope">
          <el-image
            style="width: 60px; height: 60px; margin: 5px"
            v-for="i in scope.row.sysFileList"
            :src="i.url"
            :preview-src-list="[i.url]"
          >
          </el-image>
          <span v-if="scope.row.sysFileList.length == ''">暂无照片</span>
        </template>
      </el-table-column>
      <el-table-column label="上报时间" prop="createTime" width="160" />
    </el-table>
    <!-- 分页 -->
    <pagination
      v-show="total > 0"
      :total="total"
      v-model:page="queryParams.pageNum"
      v-model:limit="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>
<script setup name="CaseIssues">
import { patrolProblempage, patrolProblemRectifyedit, projectCompanyList, upreplyfile } from '@/api/longoPeration/CaseIssues';
import { getProjectInfoList } from '@/api/preassess/targetManage';
const { proxy } = getCurrentInstance();
const { problem_type, inspection_items } = proxy.useDict('problem_type', 'inspection_items'); //  巡查类型的字典
const showSearch = ref(true);
const case_level = ref([
  {
    value: '1',
    label: '无需整改',
  },
  {
    value: '2',
    label: '需要整改',
  },
]);
const patrol_Stype = ref([
  {
    value: '1',
    label: '计划巡查',
  },
  {
    value: '2',
    label: '临时巡查',
  },
]);
const projectTList = ref([]);
const ConstructionUnit = ref([]);
const loading = ref(true);
const total = ref(0);
const dataList = ref([]);
const AllData = reactive({
  queryParams: {
    pageNum: 1,
    pageSize: 10,
  },
});
const { queryParams } = toRefs(AllData);

//搜索
function handleQuery() {
  getList();
}
//重置
function resetQuery() {
  queryParams.value.timer = [];
  proxy.resetForm('queryRef');
  handleQuery();
}
// 下拉框
async function DropDown() {
  let { data } = await projectCompanyList();
  ConstructionUnit.value = data;
}
// 项目接口
async function projectTypeListM() {
  let { data } = await getProjectInfoList();
  projectTList.value = data;
}

/** 搜索列表 */
const getList = async () => {
  if (queryParams.value.timer) {
    queryParams.value.startTime = queryParams.value.timer[0];
    queryParams.value.endTime = queryParams.value.timer[1];
  } else {
    queryParams.value.startTime = '';
    queryParams.value.endTime = '';
  }
  loading.value = true;
  let res = await patrolProblempage(queryParams.value);
  dataList.value = res.data;
  total.value = res.total;
  loading.value = false;
};

/** 导出按钮操作 */
function handleExport() {
  proxy.download(
    'business/patrolProblem/export',
    {
      ...queryParams.value,
    },
    `项目问题统计 ${new Date().getTime()}.xlsx`
  );
}

onMounted(() => {
  getList();
  DropDown();
  projectTypeListM();
});
</script>

<style scoped lang="scss"></style>