Newer
Older
KaiFengPC / src / views / project / projectManage / projectDrawings.vue
@鲁yixuan 鲁yixuan on 19 Aug 6 KB updata
<template>
  <!-- 项目施工图纸设计管理 -->
  <div class="publicContainer">
    <!-- 搜索区域 -->
    <el-form :model="queryParams" ref="queryRef" :inline="true">
      <el-form-item label="项目名称" prop="projectNo">
        <el-select v-model="queryParams.projectNo" placeholder="请选择" clearable filterable>
          <el-option v-for="dict in projectList" :key="dict.projectNo" :label="dict.projectName" :value="dict.projectNo" />
        </el-select>
      </el-form-item>
      <el-form-item label="项目类型" prop="projectLibraryType">
        <el-select v-model="queryParams.projectLibraryType" placeholder="请选择" clearable>
          <el-option label="全部" value="" />
          <el-option v-for="dict in project_library_type" :key="dict.value" :label="dict.label" :value="dict.value" />
        </el-select>
      </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-form-item>
    </el-form>

    <!-- 表格 -->
    <el-table v-loading="tableLoading" :data="tableData" max-height="650">
      <el-table-column label="项目名称" prop="projectName" />
      <el-table-column label="项目库类型" prop="projectLibraryType">
        <template #default="scope">
          <dict-tag :options="project_library_type" :value="scope.row.projectLibraryType" />
        </template>
      </el-table-column>
      <el-table-column label="审核状态" prop="reviewStatus">
        <template #default="scope">
          <span :class="[scope.row.reviewStatus == '1' || scope.row.reviewStatus == '2' ? 'green' : 'red']">
            {{
              scope.row.reviewStatus == '1'
                ? '审核通过'
                : scope.row.reviewStatus == '3'
                ? '审核拒绝'
                : scope.row.reviewStatus == '2'
                ? '已提交市规划局'
                : '未审核'
            }}
          </span>
        </template>
      </el-table-column>
      <el-table-column label="施工图纸" prop="sysFileList">
        <template #default="scope">
          <span class="filePreview" @click="previewPdf(scope.row.sysFileList)">
            {{ scope.row.sysFileList.length > 0 ? scope.row.sysFileList[0].name : '--' }}
          </span>
        </template>
      </el-table-column>
      <el-table-column label="备注" prop="remark" />
      <el-table-column label="发布时间" prop="updateTime" />
      <el-table-column label="操作" width="160" class-name="small-padding fixed-width">
        <template #default="scope">
          <el-button
            link
            type="warning"
            @click="handleAudit(scope.row)"
            v-if="scope.row.reviewStatus == '' || scope.row.reviewStatus == '0'"
          >
            审核
          </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="getTableList"
    />

    <!-- 审核弹窗 -->
    <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="reviewStatus">
          <el-select v-model="formData.reviewStatus" filterable clearable placeholder="请选择">
            <el-option label="通过" value="1" />
            <el-option label="拒绝" value="3" />
          </el-select>
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input type="textarea" v-model="formData.remark" placeholder="请输入" />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="info" @click="dialogShow = false">取 消</el-button>
          <el-button type="primary" @click="submitAudit">确 定</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup>
import { getProjectInfoNewList, projectFileReviewPage, projectFileReviewEdit } from '@/api/document/projectTransfer';

const { proxy } = getCurrentInstance();
const projectList = ref([]);
const dialogShow = ref(false);
const tableData = ref([]);
const tableLoading = ref(false);
const total = ref(0);
const allData = reactive({
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    fileType: 'sgsjtz', //施工设计图纸
    projectNo: '',
    projectLibraryType: '',
  },
  formData: {
    remark: '',
    fileType: 'sgsjtz', //施工设计图纸
    reviewStatus: '1',
  },
  rulesForm: {
    reviewStatus: [{ required: true, message: '请输入', trigger: 'blur' }],
  },
});
const { queryParams, formData, rulesForm } = toRefs(allData);
const { project_library_type } = proxy.useDict('project_library_type');

//搜索
function handleQuery() {
  queryParams.value.pageNum = 1;
  getTableList();
}
//重置
function resetQuery() {
  proxy.resetForm('queryRef');
  handleQuery();
}

/** 搜索 */
function getTableList() {
  tableLoading.value = true;
  projectFileReviewPage(queryParams.value).then(res => {
    tableData.value = res.data || [];
    total.value = res.total;
    tableLoading.value = false;
  });
}

// 审核
const handleAudit = row => {
  proxy.resetForm('formRef'); //清空表单
  dialogShow.value = true;
  formData.value = { ...row };
};
// 审核提交
function submitAudit() {
  proxy.$refs['formRef'].validate(valid => {
    if (valid) {
      formData.value.fileType = 'sgsjtz';
      projectFileReviewEdit(formData.value).then(response => {
        proxy.$modal.msgSuccess('审核成功');
        dialogShow.value = false;
        getTableList();
      });
    }
  });
}

// 获取项目列表
const getProjectList = async () => {
  const res = await getProjectInfoNewList();
  if (res?.code !== 200) return;
  projectList.value = res.data || [];
};

// 文件预览
function previewPdf(item) {
  if (item.length > 0) {
    window.open(item[0].url);
  }
}

onMounted(() => {
  getProjectList(); // 获取项目列表
  handleQuery();
});
</script>

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