fuliqi
2025-02-11 c4ec0fac48c9bef59fadba87404ea3d4bf9e087c
src/views/system/report/index.vue
@@ -2,7 +2,7 @@
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
      <el-form-item label="关键字" prop="peopleId">
        <el-input v-model="queryParams.keyword" placeholder="请输入关键字" clearable @keyup.enter.native="handleQuery" />
        <el-input v-model="queryParams.keyword" placeholder="点位名搜索" clearable @keyup.enter.native="handleQuery" @clear="handleQuery"/>
      </el-form-item>
      <el-form-item label="报备类型" prop="reportType">
        <el-select v-model="queryParams.reportType" @change="handleQuery" placeholder="报备类型" clearable>
@@ -11,7 +11,7 @@
        </el-select>
      </el-form-item>
      <el-form-item label="故障类型" prop="errorTypeList">
        <el-select v-model="queryParams.errorTypeList" multiple @change="handleQuery" clearable @clear="handleQuery">
        <el-select v-model="queryParams.errorTypeList" multiple @change="handleQuery" clearable>
          <el-option v-for="dict in dict.type.report_error_type" :value="dict.value" :key="dict.value" :label="dict.label" />
        </el-select>
      </el-form-item>
@@ -35,7 +35,8 @@
          v-hasPermi="['system:report:add']">单次报备</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="success" plain icon="el-icon-upload" size="mini" @click="handleImport">批量报备</el-button>
        <el-button type="success" plain icon="el-icon-upload" size="mini" @click="handleImport"
                   v-hasPermi="['system:report:add']">批量报备</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
@@ -59,8 +60,17 @@
            <div class="info-item">
              <div class="info-label">报备材料</div>
              <div class="info-list">
                <div style="margin-bottom: 8px" v-for="file in formatFileList(scope.row.reportMaterials)" :key="file">
                  <el-link type="primary" @click="handleDownload(file)">
                <div style="margin-bottom: 8px" v-for="file in scope.row.reportMaterials!=null ? scope.row.reportMaterials.split(',') : scope.row.reportMaterials" :key="file">
                  <el-image
                    v-if="isImageFile(file)"
                    :src="getPreview(file)"
                    :preview-src-list="[getPreview(file)]"
                    fit="cover"
                    class="material-preview"
                    style="width: 100px; height: 100px; margin: 5px;"
                  >
                  </el-image>
                  <el-link v-else type="primary" @click="handleDownload(file)">
                    {{file.match(/\/([^\/]*)$/)[1]}}
                  </el-link>
                </div>
@@ -87,7 +97,7 @@
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
            v-hasPermi="['system:report:edit']" v-if="scope.row.status === 2 || scope.row.status === 0">修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleAuditing(scope.row)"
            v-hasPermi="['system:report:edit']" v-if="scope.row.status === 0 || scope.row.status === 2">审核</el-button>
            v-hasPermi="['system:report:auditing']" v-if="scope.row.status === 0 || scope.row.status === 2">审核</el-button>
          <el-button size="mini" type="text" icon="el-icon-s-check" @click="handleAuditingRecord(scope.row.id)"
            v-hasPermi="['system:report:record']">审核记录</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
@@ -136,7 +146,10 @@
              </el-select>
            </el-form-item>
            <el-form-item label="报备时间" prop="daterangeCreateTime">
              <el-date-picker v-model="form.daterangeCreateTime" type="datetimerange" value-format="yyyy-MM-dd HH:mm:ss"
              <el-date-picker v-model="form.daterangeCreateTime"
                              type="datetimerange"
                              value-format="yyyy-MM-dd HH:mm:ss"
                              format="yyyy-MM-dd HH:mm:ss"
                              range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
                              ></el-date-picker>
            </el-form-item>
@@ -163,35 +176,52 @@
    <!-- 查看审核记录 -->
    <el-dialog title="报备审核记录" :visible.sync="recordOpen" :close-on-click-modal="false" width="900px">
      <div slot="footer" class="dialog-footer" style="max-height: 500px;overflow-y: auto;">
        <el-timeline v-for="record in auditingRecordList" :key="record.id">
          <el-timeline-item :timestamp="record.auditingTime" placement="top">
            <el-card>
              <el-descriptions title="提交数据" :column="3" border>
                <el-descriptions-item label="点位" label-class-name="my-label" content-class-name="my-content">{{
      record.pointName }}</el-descriptions-item>
                <el-descriptions-item label="报备类型">{{ record.reportType }}</el-descriptions-item>
                <el-descriptions-item label="审核结果"><el-tag :type="record.result ? 'success' : 'danger'">{{ record.result ? "通过" : "未通过" }}</el-tag></el-descriptions-item>
                <el-descriptions-item label="审核意见">{{ record.resultRemark ? record.resultRemark : "无" }}</el-descriptions-item>
                <el-descriptions-item label="报备内容">
                  <div class="content" v-html="getHtmlContent(record.reportContent)"></div>
                </el-descriptions-item>
                <el-descriptions-item label="报备材料">
                  <el-link
                    v-for="item in record.reportMaterials != null ? record.reportMaterials.split(',') : record.reportMaterials"
                    :underline="false" type="primary" :key="item" @click="handleDownload(item)">
                    {{ item.substring(item.lastIndexOf("/") + 1) }}
                  </el-link>
                </el-descriptions-item>
              </el-descriptions>
            </el-card>
          </el-timeline-item>
        </el-timeline>
        <div v-if="auditingRecordList && auditingRecordList.length > 0">
          <el-timeline v-for="record in auditingRecordList" :key="record.id">
            <el-timeline-item :timestamp="record.auditingTime" placement="top">
              <el-card>
                <el-descriptions title="提交数据" :column="3" border>
                  <el-descriptions-item label="点位" label-class-name="my-label" content-class-name="my-content">{{
                      record.pointName }}</el-descriptions-item>
                  <el-descriptions-item label="报备类型">{{ record.reportType }}</el-descriptions-item>
                  <el-descriptions-item label="审核结果"><el-tag :type="record.result ? 'success' : 'danger'">{{ record.result ? "通过" : "未通过" }}</el-tag></el-descriptions-item>
                  <el-descriptions-item label="审核意见">{{ record.resultRemark ? record.resultRemark : "无" }}</el-descriptions-item>
                  <el-descriptions-item label="报备内容">
                    <div class="content" v-html="getHtmlContent(record.reportContent)"></div>
                  </el-descriptions-item>
                  <el-descriptions-item label="报备材料">
                    <div
                      v-for="item in record.reportMaterials != null ? record.reportMaterials.split(',') : record.reportMaterials"
                      :key="item">
                      <el-image
                        v-if="isImageFile(item)"
                        :src="getPreview(item)"
                        :preview-src-list="[getPreview(item)]"
                        fit="cover"
                        style="width: 100px; height: 100px; margin: 5px;">
                      </el-image>
                      <el-link
                        v-else
                        :underline="false" type="primary" @click="handleDownload(item)">
                        {{ item.substring(item.lastIndexOf("/") + 1) }}
                      </el-link>
                    </div>
                  </el-descriptions-item>
                </el-descriptions>
              </el-card>
            </el-timeline-item>
          </el-timeline>
        </div>
        <div v-else>
          <el-empty description="无审核记录"></el-empty>
        </div>
        <el-button type="primary" @click="recordOpen = false">关闭</el-button>
      </div>
    </el-dialog>
    <!-- 审核报备 -->
    <el-dialog title="报备审核" :visible.sync="auditingOpen" :close-on-click-modal="false" width="800px" append-to-body>
    <el-dialog title="报备审核" :visible.sync="auditingOpen" :close-on-click-modal="false" width="1100px" append-to-body>
      <div style="display: flex;flex-direction: row">
        <div style="flex: 6; border-right: 1px solid #d2d1d1; padding-right: 20px">
          <el-form ref="form" :model="auditingForm" :rules="auditingRules" label-width="80px">
@@ -208,13 +238,13 @@
            <el-input v-model="auditingForm.reportType" disabled />
          </el-form-item>
          <el-form-item label="故障类型">
            <el-input v-model="auditingForm.errorTypeList" disabled />
            <el-input v-model="auditingForm.errorType" disabled />
          </el-form-item>
          <el-form-item label="生效时间">
            <el-date-picker v-model="auditingForm.beginCreateTime" disabled />
            <el-date-picker v-model="auditingForm.beginCreateTime" format="yyyy-MM-dd HH:mm:ss" disabled />
          </el-form-item>
          <el-form-item label="失效时间">
            <el-date-picker v-model="auditingForm.endCreateTime" disabled />
            <el-date-picker v-model="auditingForm.endCreateTime" format="yyyy-MM-dd HH:mm:ss" disabled />
          </el-form-item>
          <el-form-item label="审核结果">
            <el-radio-group v-model="auditingForm.auditingResult">
@@ -227,12 +257,13 @@
          </el-form-item>
        </el-form>
        </div>
        <div style="flex: 6; border-right: 1px solid #d2d1d1; padding-right: 20px">
          <div>批量审核同一批次号的报备</div>
          <div>
            <el-checkbox-group v-model="selectedTo">
        <div style="flex: 5; border-right: 1px solid #d2d1d1; padding-right: 20px; padding-left: 20px">
          <div>同一批次号的报备</div>
          <div style="margin-top: 20px">
            <el-checkbox-group v-if="togetherList && togetherList.length > 0" v-model="selectedTo">
              <el-checkbox v-for="item in togetherList" :label="item.id">{{item.pointName}}</el-checkbox>
            </el-checkbox-group>
            <span v-else>无</span>
          </div>
        </div>
        <div style="flex: 5; padding-left: 20px">
@@ -241,10 +272,24 @@
              <span v-html="auditingForm.reportContent"></span>
            </el-form-item>
            <el-form-item label="报备材料">
              <el-link
                <!-- 添加空行 -->
                <div class="material-spacer">{{''}}</div>
              <div
                v-for="item in auditingForm.reportMaterials != null ? auditingForm.reportMaterials.split(',') : auditingForm.reportMaterials"
                :underline="false" type="primary" :key="item" @click="handleDownload(item)">{{ item.substring(item.lastIndexOf("/") + 1)
                }}</el-link>
                :key="item">
                <el-image
                  v-if="isImageFile(item)"
                  :src="getPreview(item)"
                  :preview-src-list="[getPreview(item)]"
                  fit="cover"
                  style="width: 100px; height: 100px; margin: 5px;">
                </el-image>
                <el-link
                  v-else
                  :underline="false" type="primary" @click="handleDownload(item)">
                  {{ item.substring(item.lastIndexOf("/") + 1) }}
                </el-link>
              </div>
            </el-form-item>
          </el-form>
        </div>
@@ -252,10 +297,9 @@
      <div slot="footer" class="dialog-footer">
        <el-button @click="auditingCancel">取 消</el-button>
        <el-button type="primary" @click="auditingSubmit">确 定</el-button>
        <el-button type="primary" @click="auditingSubmit">审 核</el-button>
      </div>
    </el-dialog>
  </div>
</template>
@@ -362,6 +406,16 @@
    this.getList();
  },
  methods: {
    getPreview(url) {
      // 使用全局配置的图片前缀
      return this.$img + url;
    },
    isImageFile(url) {
      const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.webp'];
      return imageExtensions.some(ext =>
        url.toLowerCase().endsWith(ext)
      );
    },
    getHtmlContent(content) {
      if (content) {
        return content
@@ -373,9 +427,9 @@
      if (item.result === 0) {
        return '审核中'
      } else if (item.status === 1) {
        return '审核通过'
        return '通过'
      } else if (item.status === 2) {
        return '审核未通过'
        return '未通过'
      }
    },
    auditingCancel() {
@@ -394,7 +448,7 @@
          this.togetherList = res.data;
          if (this.togetherList && this.togetherList.length > 0) {
            this.togetherList = this.togetherList.filter(item => item.id != row.id)
            this.selectedTo = this.togetherList.map(item => item.pointId)
            this.selectedTo = this.togetherList.map(item => item.id)
          }
        })
      }
@@ -432,13 +486,13 @@
    /** 查询报备列表 */
    getList() {
      this.loading = true;
      if (this.form.daterangeCreateTime && this.form.daterangeCreateTime.length > 0) {
        this.queryParams["beginCreateTime"] = this.form.daterangeCreateTime[0];
        this.queryParams["endCreateTime"] = this.form.daterangeCreateTime[1];
      } else {
        this.queryParams["beginCreateTime"] = null;
        this.queryParams["endCreateTime"] = null;
      }
      // if (this.form.daterangeCreateTime && this.form.daterangeCreateTime.length > 0) {
      //   this.queryParams["beginCreateTime"] = this.form.daterangeCreateTime[0];
      //   this.queryParams["endCreateTime"] = this.form.daterangeCreateTime[1];
      // } else {
      //   this.queryParams["beginCreateTime"] = null;
      //   this.queryParams["endCreateTime"] = null;
      // }
      listReport(this.queryParams).then(response => {
        this.reportList = response.data.records;
        this.total = response.total;
@@ -521,17 +575,26 @@
    /** 审核按钮操作 */
    auditingSubmit() {
      this.auditingForm.auditingTime = new Date();
      let data = {
        id: this.auditingForm.id,
        togetherList: this.selectedTo
        auditOpinion: this.auditingForm.auditOpinion,
        auditingResult: this.auditingForm.auditingResult
      }
      this.auditingForm.togetherList = this.selectedTo
      audit(this.auditingForm).then(response => {
        this.$modal.msgSuccess("审核成功");
        this.auditingOpen = false
        this.getList();
        this.auditingForm = {}
        this.auditingForm = {
          id: null,
          unitName: "",
          pointName: "",
          peopleName: "",
          errorTypeList: [],
          reportContent: "",
          auditing: "",
          auditOpinion: "",
          reportType: "",
          beginCreateTime: null,
          endCreateTime: null,
          auditingResult: false,
          daterangeCreateTime: []
        }
      });
    },
    /** 提交按钮 */
@@ -611,6 +674,9 @@
</script>
<style lang="scss" scoped>
.material-spacer {
  height: 50px; /* 可以调整空行的高度 */
}
.content {
  height: 100px;
  max-height: 300px;