Newer
Older
KaiFengPC / src / views / document / projectTransfer / index.vue
@鲁yixuan 鲁yixuan on 19 Aug 2 KB updata
<template>
  <!-- 项目移交管理 -->
  <div class="publicContainer">
    <div class="top">
      <el-form ref="ruleForm" inline :model="queryParams">
        <el-form-item label="项目名称:" prop="projectName">
          <el-input v-model="queryParams.projectName" placeholder="请输入项目名称" clearable @keyup.enter="handleQuery" />
        </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>
    </div>
    <el-table :data="tableData" v-loading="loading" stripe :max-height="600">
      <el-table-column type="index" width="55" label="序号" />
      <el-table-column label="项目名称" prop="projectName" show-overflow-tooltip width="200" />
      <el-table-column label="项目编码" prop="projectNo" />
      <el-table-column label="责任人" prop="chargeUser" />
      <el-table-column label="联系方式" prop="phone" />
      <el-table-column label="建设单位" prop="chargeDepartment" show-overflow-tooltip />
      <el-table-column label="设计单位" prop="designUnitName" show-overflow-tooltip />
      <el-table-column label="施工单位" prop="supervisorUnitName" show-overflow-tooltip />
      <el-table-column label="操作" show-overflow-tooltip width="180">
        <template #default="{ row }">
          <el-button type="primary" link @click="downloadFile(row)">项目资料分类打包导出</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getTableList" />
  </div>
</template>

<script setup>
import { getProjectCompletionAcceptanceMyPage } from '@/api/project/completionAcceptance';

const { proxy } = getCurrentInstance();
const queryParams = ref({
  projectName: '',
  pageNum: 1,
  pageSize: 10,
});
const total = ref(0);
const tableData = ref([]);
const loading = ref(true);

// 搜索
const handleQuery = () => {
  queryParams.value.pageNum = 1;
  getTableList();
};

// 重置
const resetQuery = () => {
  proxy.$refs.ruleForm.resetFields();
  handleQuery();
};

// 获取数据
async function getTableList() {
  loading.value = true;
  const res = await getProjectCompletionAcceptanceMyPage(queryParams.value);
  if (res?.code === 200) {
    tableData.value = res?.data || [];
    total.value = res?.total || 0;
    loading.value = false;
  }
}

// 导出下载数据
function downloadFile(row) {
  queryParams.value.projectId = row.projectId;
  proxy.download(
    '/business/projectInfoNew/fileExport',
    {
      ...queryParams.value,
    },
    `项目移交_${new Date().getTime()}.zip`,
    { type: 'POST' }
  );
}

onMounted(() => {
  handleQuery();
});
</script>

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