Newer
Older
KaiFengPC / src / views / document / projectTransfer / index.vue
@zhangdeliang zhangdeliang on 23 May 5 KB 初始化项目
<template>
  <div class="handOver">
    <div class="top">
      <el-form ref="ruleForm" inline :model="form">
        <el-form-item label="项目:" prop="projectId">
          <el-select v-model="form.projectId" placeholder="请选择项目" style="width: 100%">
            <el-option v-for="dict in projectList" :key="dict.id" :label="dict.projectName" :value="dict.id" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="Search" @click="search"> 查询</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="buildStatus" show-overflow-tooltip>
        <template #default="{ row }">
          <dict-tag :options="build_status" :value="row.buildStatus" />
        </template>
      </el-table-column>
      <el-table-column label="建设单位" prop="chargeDepartment" show-overflow-tooltip />
      <el-table-column label="设计单位" prop="designUnit" show-overflow-tooltip />
      <el-table-column label="运营单位" prop="operationUnit" show-overflow-tooltip />
      <el-table-column label="实施单位" prop="constructUnit" show-overflow-tooltip />
      <el-table-column label="资料合计" prop="fileNum" show-overflow-tooltip>
        <template #default="{ row }">
          <el-button type="primary" link @click="openDialog3(row)">{{ row.fileNum }}</el-button>
        </template>
      </el-table-column>
      <el-table-column label="移交状态" prop="status" show-overflow-tooltip>
        <template #default="{ row }">
          <el-tag v-if="statusMap.get(row.status)" :type="statusMap.get(row.status).type">{{ statusMap.get(row.status).text }}</el-tag>
          <span v-else></span>
        </template>
      </el-table-column>
      <el-table-column label="操作" show-overflow-tooltip width="120">
        <template #default="{ row }">
          <el-button type="primary" link @click="openDialog(row, 'view')">详情</el-button>
          <el-button type="primary" link @click="openDialog(row, 'transfer')" v-if="!row.status">移交</el-button>
          <el-button type="primary" link @click="openDialog(row, 'audit')" v-if="row.status === 'approve'">审核</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination :total="total" v-model:page="pageNum" v-model:limit="pageSize" @pagination="getTableList" />

    <el-dialog
      v-model="visible"
      :title="`工程项目移交${opts.text}`"
      :close-on-click-modal="false"
      width="40%"
      :before-close="close"
      class="dialog"
    >
      <operate v-if="visible" ref="operateRef" :cur-row="curRow" :opts="opts" @close="close"></operate>
      <template #footer>
        <div class="dialog-footer" v-if="opts.type !== 'view'">
          <el-button type="primary" @click="submit">{{ opts.type === 'transfer' ? '移交' : '同意' }}</el-button>
          <el-button @click="close">取消</el-button>
        </div>
      </template>
    </el-dialog>

    <el-dialog v-model="visible2" title="工程项目移交-查询进度" :close-on-click-modal="false" width="20%" class="dialog">
      <step />
    </el-dialog>

    <el-dialog v-model="visible3" title="工程文件列表" :close-on-click-modal="false" width="60%" class="dialog" :before-close="close3">
      <tableList v-if="visible3" :cur-row="curRow" />
    </el-dialog>
  </div>
</template>

<script setup>
import { reactive, ref, onMounted, shallowRef } from 'vue';
import { usePagination } from '@/hooks';
import { getProjectTransferPage, getProjectInfoNewList } from '@/api/document/projectTransfer';
import operate from './operate.vue';
import tableList from './tableList.vue';
import step from './step.vue';
const { proxy } = getCurrentInstance();
const { build_status } = proxy.useDict('build_status');

const statusMap = new Map([
  ['', { type: 'danger', text: '未移交' }],
  ['approve', { type: 'danger', text: '待审核' }],
  ['end', { type: 'success', text: '已移交' }],
]);

const form = reactive({
  projectId: '',
});
const opts = reactive({
  text: '',
  type: '',
});
const projectList = ref([]);
const visible = ref(false);
const curRow = shallowRef(null);
const visible2 = ref(false);
const visible3 = ref(false);

const { pageNum, pageSize, tableData, total, loading, getTableList } = usePagination(getProjectTransferPage, { value: form });

const search = () => {
  pageNum.value = 1;
  getTableList();
};

const resetQuery = () => {
  proxy.$refs.ruleForm.resetFields();
  search();
};

const openDialog = (data, type) => {
  visible.value = true;
  curRow.value = data;
  opts.type = type;
  if (type === 'audit') {
    opts.text = '审核';
  }
};

const close = result => {
  if (result.isRefresh) getTableList();
  visible.value = false;
  curRow.value = null;
};

const openDialog2 = row => {
  visible2.value = true;
  curRow.value = row;
};

const close2 = () => {
  visible2.value = false;
  curRow.value = null;
};

const openDialog3 = row => {
  visible3.value = true;
  curRow.value = row;
};

const close3 = () => {
  visible3.value = false;
  curRow.value = null;
};

const submit = () => {
  proxy.$refs.operateRef.submit();
};

const getProjectInfoNewListFn = async () => {
  const res = await getProjectInfoNewList();
  if (res?.code !== 200) return;
  projectList.value = res.data || [];
};

onMounted(() => {
  getProjectInfoNewListFn();
  getTableList();
});
</script>

<style lang="scss" scoped>
.handOver {
  padding: 20px;
  height: 90vh;
  overflow-y: hidden;
  .top {
    margin-bottom: 15px;
  }
}

:deep(.dialog) {
  .el-dialog__body {
    padding-bottom: 20px !important;
  }
  .el-dialog__footer {
    padding-top: 0 !important;
  }
}
</style>