riku
2025-03-25 642d31285d7aff59415a5eb37f87a79f41d308a8
src/views/fysp/evaluation/components/precheck/components/CompCheckSource.vue
@@ -1,69 +1,91 @@
<template>
  <el-card shadow="never">
    <template #header>
      <div><el-text tag="b" size="large">数据源检查</el-text></div>
      <el-text size="small" type="info">检查评估所需数据源是否完整</el-text>
      <el-text size="small" type="info">检查评估所需数据源是否完整</el-text>
    </template>
    <FormCol>
      <template v-for="(v, i) in checkResults" :key="i">
        <el-row class="h-small" align="middle">
          <el-col :span="14">
            <el-row align="middle">
              <el-text size="default" :class="v.required ? 'required' : 'not-required'">*</el-text>
              <el-text size="default" class="m-l-4">{{ v.name }}</el-text>
            </el-row>
          </el-col>
          <el-col :span="5">
            <el-row align="middle">
              <el-space>
                <template v-if="v.loading">
                  <el-icon class="is-loading"><Loading /></el-icon>
                  <el-text size="default" type="default">检查中...</el-text>
                </template>
                <template v-else-if="v.pass == true">
                  <el-icon color="var(--el-color-success)"><Check /></el-icon>
                  <el-text size="default" type="success">通过</el-text>
                </template>
                <template v-else-if="v.pass == false">
                  <el-icon color="var(--el-color-danger)"><Close /></el-icon>
                  <el-text size="default" type="danger">缺失</el-text>
                </template>
                <template v-else>
                  <el-icon color="var(--el-color-warning)"><Warning /></el-icon>
                  <el-text size="default" type="warning">暂略过</el-text>
                </template>
              </el-space>
            </el-row>
          </el-col>
          <el-col :span="5">
            <el-button
              v-show="!v.loading"
              :type="v.pass ? '' : 'danger'"
              size="small"
              @click="goto(v.path)"
              :disabled="v.path == ''"
            >
              {{ v.pass ? '去修改' : '去完善' }}
              <el-icon class="m-l-4"><Right /></el-icon>
            </el-button>
          </el-col>
        </el-row>
        <el-row align="middle" class="m-b-16">
          <el-text size="small" class="not-required">*</el-text>
          <el-text size="small" class="m-l-4 color-i">{{ v.des }}</el-text>
  <div>
    <el-card shadow="never">
      <template #header>
        <div><el-text tag="b" size="large">数据源检查</el-text></div>
        <el-text size="small" type="info">检查评估所需数据源是否完整</el-text>
      </template>
      <FormCol>
        <template v-for="(v, i) in checkResults" :key="i">
          <el-row class="h-small" align="middle">
            <el-col :span="14">
              <el-row align="middle">
                <el-text
                  size="default"
                  :class="v.required ? 'required' : 'not-required'"
                  >*</el-text
                >
                <el-text size="default" class="m-l-4">{{ v.name }}</el-text>
              </el-row>
            </el-col>
            <el-col :span="5">
              <el-row align="middle">
                <el-space>
                  <template v-if="v.loading">
                    <el-icon class="is-loading"><Loading /></el-icon>
                    <el-text size="default" type="default">检查中...</el-text>
                  </template>
                  <template v-else-if="v.pass == true">
                    <el-icon color="var(--el-color-success)"><Check /></el-icon>
                    <el-text size="default" type="success">通过</el-text>
                  </template>
                  <template v-else-if="v.pass == false">
                    <el-icon color="var(--el-color-danger)"><Close /></el-icon>
                    <el-text size="default" type="danger">缺失</el-text>
                  </template>
                  <template v-else>
                    <el-icon color="var(--el-color-warning)"
                      ><Warning
                    /></el-icon>
                    <el-text size="default" type="warning">暂略过</el-text>
                  </template>
                </el-space>
              </el-row>
            </el-col>
            <el-col :span="5">
              <el-button
                v-show="!v.loading"
                :type="v.pass ? '' : 'danger'"
                size="small"
                @click="goto(v.path)"
                :disabled="v.path == ''"
              >
                {{ v.pass ? '去修改' : '去完善' }}
                <el-icon class="m-l-4"><Right /></el-icon>
              </el-button>
            </el-col>
          </el-row>
          <el-row align="middle" class="m-b-16">
            <el-text size="small" class="not-required">*</el-text>
            <el-text size="small" class="m-l-4 color-i">{{ v.des }}</el-text>
          </el-row>
        </template>
      </FormCol>
      <template #footer>
        <el-row justify="space-around">
          <el-button type="primary" size="default" @click="lastStep"
            >上一步</el-button
          >
          <el-button
            :disabled="!checkPass"
            type="primary"
            size="default"
            @click="nextStep"
            >下一步</el-button
          >
        </el-row>
      </template>
    </FormCol>
    <template #footer>
      <el-row justify="space-around">
        <el-button type="primary" size="default" @click="lastStep">上一步</el-button>
        <el-button :disabled="!checkPass" type="primary" size="default" @click="nextStep"
          >下一步</el-button
        >
      </el-row>
    </template>
  </el-card>
    </el-card>
    <el-dialog
      title="扬尘监测数据月度统计管理"
      v-model="dialog1"
      destroy-on-close
      width="90%"
    >
      <CompDataResultEdit :areaInfo="areaInfo"></CompDataResultEdit>
      <template #footer> </template>
    </el-dialog>
  </div>
</template>
<script>
@@ -71,14 +93,16 @@
import taskApi from '@/api/fysp/taskApi';
import userMapApi from '@/api/fysp/userMapApi';
import problemApi from '@/api/fysp/problemApi';
import monitordataApi from '@/api/fysp/monitordataApi';
import complaintApi from '@/api/fytz/complaintApi';
import CompDataResultEdit from '../../CompDataResultEdit.vue';
/**
 * 生成一项数据源检查记录
 * @param {*} _name
 * @param {*} _path
 * @param {*} _fetch
 * @param {*} _required
 * 生成一项数据源检查条目
 * @param {*} _name 条目名称
 * @param {*} _path 跳转页面URL
 * @param {*} _fetch 条目的网络请求函数
 * @param {*} _required 是否必选
 */
function baseCheckItem(_name, _path, _fetch, _required) {
  return {
@@ -91,10 +115,24 @@
    async fetch() {
      this.loading = true;
      setTimeout(async () => {
        const res = await _fetch();
        this.pass = res ? res.pass : undefined;
        this.des = res ? res.des : undefined;
        this.loading = false;
        if (typeof _fetch === 'function') {
          _fetch()
            .then((res) => {
              this.pass = res ? res.pass : undefined;
              this.des = res ? res.des : undefined;
            })
            .catch(() => {
              this.pass = false;
              this.des = '网络链接错误';
            })
            .finally(() => {
              this.loading = false;
            });
        } else {
          this.pass = undefined;
          this.des = undefined;
          this.loading = false;
        }
      }, 1000);
    }
  };
@@ -104,6 +142,9 @@
 * 评估数据源完整性检查
 */
export default {
  components: {
    CompDataResultEdit
  },
  props: {
    // 步骤下标
    modelValue: Number
@@ -160,7 +201,26 @@
          });
        }),
        // 区域范围内的监测数据是否存在、数据时间跨度是否完整、数据的初步分析是否完成
        baseCheckItem('现场监测数据', '', () => {}),
        baseCheckItem(
          '现场监测数据',
          () => {
            this.dialog1 = true;
          },
          () => {
            return monitordataApi
              .fetchDustDataResult(this.areaInfo)
              .then((res) => {
                const pass = res.data.length > 0;
                let des = '';
                if (pass) {
                  des = `找到月度统计共${res.data.length}条`;
                } else {
                  des = '未找到相关记录';
                }
                return { pass, des };
              });
          }
        ),
        // 区域范围内的每个监管点位与监测仪器的匹配记录是否存在,缺失情况等
        baseCheckItem('监管点位与监测点匹配', '', () => {
          return userMapApi.fetchDeviceMap(this.areaInfo).then((res) => {
@@ -192,15 +252,14 @@
            return { pass, des };
          });
        }),
        // complaintApi.fetchComplaints();
        // 区域范围内的信访投诉记录是否存在,可随时补充
        baseCheckItem('信访投诉', '', () => {
          // complaintApi.fetchComplaints();
        }),
        baseCheckItem('信访投诉', ''),
        // complaintApi.fetchPunishment();
        // 区域范围内的行政处罚记录是否存在,可随时补充
        baseCheckItem('行政处罚', '', () => {
          // complaintApi.fetchPunishment();
        })
      ]
        baseCheckItem('行政处罚', '')
      ],
      dialog1: false
    };
  },
  computed: {
@@ -232,8 +291,10 @@
    },
    // 跳转检查项的链接
    goto(path) {
      if (path && path != '') {
      if (typeof path === 'string' && path != '') {
        this.$router.push(path);
      } else if (typeof path === 'function') {
        path();
      }
    },
    // 开始检查任务
@@ -253,7 +314,7 @@
      //   online: true,
      //   sourceType: v.sourceType
      // };
      this.areaInfo = value
      this.areaInfo = value;
      this.checkResults.forEach((e) => {
        e.fetch();