Newer
Older
KaiFengPC / src / views / project / projectManage / projectDrawings.vue
@zhangdeliang zhangdeliang on 29 Jul 5 KB update
<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.id" :label="dict.projectName" :value="dict.id" />
        </el-select>
      </el-form-item>
      <el-form-item label="项目类型" prop="projectType">
        <el-select v-model="queryParams.projectType" placeholder="请选择" clearable>
          <el-option label="库内" value="1" />
          <el-option label="库外" value="2" />
        </el-select>
      </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-table v-loading="tableLoading" :data="tableData">
      <el-table-column label="项目名称" prop="projectName" />
      <el-table-column label="审核状态" prop="reviewStatus">
        <template #default="scope">
          {{
            scope.row.reviewStatus == '1'
              ? '审核通过'
              : scope.row.reviewStatus == '2'
              ? '提交市规划局'
              : scope.row.reviewStatus == '3'
              ? '审核拒绝'
              : '未审核'
          }}
        </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="createTime" />
      <el-table-column label="操作" width="160" class-name="small-padding fixed-width">
        <template #default="scope">
          <el-button link type="primary" icon="Edit" @click="handleAudit(scope.row)">审核</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="120px" class="publicForm">
        <el-form-item label="审核意见" prop="ggType">
          <el-select v-model="formData.ggType" filterable clearable placeholder="请选择">
            <el-option label="通过" value="1" />
            <el-option label="拒绝" value="2" />
          </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 } 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,
    projectNo: '',
    projectType: '',
  },
  formData: {
    remark: null,
    ggType: '1',
  },
  rulesForm: {
    ggType: [{ required: true, message: '请输入', trigger: 'blur' }],
  },
});
const { queryParams, formData, rulesForm } = toRefs(allData);

//搜索
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;
};
// 审核提交
function submitAudit() {
  proxy.$refs['formRef'].validate(valid => {
    if (valid) {
      // orderRemindAdd(formData.value).then(response => {
      //   proxy.$modal.msgSuccess('审核成功');
      //   dialogShow.value = false;
      //   getDataList();
      // });
    }
  });
}

// 获取项目列表
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(); // 获取项目列表
});
</script>

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