Newer
Older
Nanping_sponge_GCGL / src / views / project / projectEstimate / todoDon.vue
@liyingjing liyingjing on 25 Oct 2023 5 KB 海绵工程管理
<template>
  <div class="water-analysis-page">
    <el-table
      :key="isFlag"
      :data="tableData"
      v-loading="tableLoading"
      stripe
      max-height="500"
    >
      <el-table-column type="index" width="55" label="序号" align="center" />
      <el-table-column
        :label="i.lable"
        align="center"
        :prop="i.value"
        show-overflow-tooltip
        v-for="i in projectEstimateCloum"
      >
        <template #default="{ row }" v-if="i.value == 'projectName'">
          <span @click="onCheck(row, 1, '详情')" class="projectName">
            {{ row.projectName }}</span
          >
        </template>
        <template #default="{ row }" v-if="i.value == 'fundSource'">
          <dict-tag :options="fund_source" :value="row.fundSource" />
        </template>
        <template #default="{ row }" v-if="i.value == 'budget'">
          {{ row.budget || 0 }}(万元)
        </template>
        <template #default="{ row }" v-if="i.value == 'contactPhone'">
          <span :title="row.contactPhone">{{
            row.contactPhone.replace(/^(.{3})(?:\d+)(.{4})$/, "$1****$2")
          }}</span>
        </template>
        <template #default="{ row }" v-if="i.value == 'techPhone'">
          <span :title="row.techPhone">{{
            row.techPhone.replace(/^(.{3})(?:\d+)(.{4})$/, "$1****$2")
          }}</span>
        </template>
      
      </el-table-column>
      <el-table-column fixed="right" label="操作" width="230" align="center">
        <template #default="{ row }">
          <el-button
            link
            type="primary"
            icon="View"
            @click="onCheck(row, 1, '详情')"
            >详情</el-button
          >
          <el-button
            link
            icon="Edit"
            type="warning"
            @click="onCheck(row, 2, '修改')"
            >修改</el-button
          >
          <el-button link icon="Delete" type="danger" @click="onCheck(row, 3)"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="FormList.totals > 0"
      :total="FormList.totals"
      v-model:page="FormList.pageNum"
      v-model:limit="FormList.pageSize"
      @pagination="getInfoList(FormList)"
    />
  </div>
  <el-dialog
    v-model="visible"
    :title="'项目概算' + FormList.title"
    :modal-append-to-body="false"
    :close-on-click-modal="false"
    width="51%"
  >
    <tableDalgo
      ref="tableDalgoRef"
      v-if="visible"
      @onModalClose="onModalClose"
      :typeList="typeList"
      :key="isFlag"
    ></tableDalgo>
    <template #footer>
      <div class="dialog-footer">
        <el-button v-show="typeList.type == '2'" @click="open2" type="primary"
          >保存</el-button
        >
        <el-button @click="visible = false">关闭</el-button>
      </div>
    </template>
  </el-dialog>
</template>
<script setup>
import { defineExpose } from "vue";
import {
  getInfo,
  projectInfoDelete,
  projectInfoGet,
} from "@/api/projectEstimate";
import { FileSystemList } from "@/api/project/tenderReview";
import tableDalgo from "./tableDalgo.vue";
import emgBox from "@/utils/ElMessageBox";
import { projectEstimateCloum } from "@/utils/cloums";
const { proxy } = getCurrentInstance();
const { fund_source,unit_list } = proxy.useDict("fund_source",'unit_list');
import { reactive } from "vue";
let visible = ref(false);
let isFlag = ref(1);
const tableDalgoRef = ref();
const FormList = ref({
  pageNum: 1,
  pageSize: 10,
  title: "",
});
//动态组件
let dataForm = reactive({
  tableData: "",
  tableDateTwo: "",
  tableLoading: true,
});
let { date, tableData, tableDateTwo, tableLoading } = toRefs(dataForm);
//获取列表数据
const getInfoList = async (prams) => {
  tableLoading.value = true;
  let { data, total } = await getInfo(prams);
  tableData.value = data;
  FormList.value.totals = total;
  setTimeout(() => {
    tableLoading.value = false;
  }, 1000);
};
//搜索
const search = (p) => {
  getInfoList(p);
  isFlag.value++;
};
defineExpose({ search });
// 查看上报数据
let typeList = ref({});
const onCheck = (row, ty, t) => {
  FormList.value.title = t;
  if (ty == 1 || ty == 2) {
    projectInfoGet(row.id).then(({ code, data }) => {
      if (code == 200) {
        typeList.value = { ...data, type: ty };
        FileSystemList({
          refId: row.id,
          refType: "proProjectBudget",
        }).then(({ data }) => {
          typeList.value.fileList1 = data;
          visible.value = true;
        });
      }
    });
    // 获取文件列表
  } else if (ty == 3) {
    emgBox(row.id, projectInfoDeleteM, "您确定删除吗?");
  }
};
//删除
const projectInfoDeleteM = async (id) => {
  let { code } = await projectInfoDelete(id);
  getInfoList();
};
//撤回操作
const Returncnfiorm = async (id) => {
  let { code } = await projectInfoDelete(id);
};
function onModalClose() {
  visible.value = false;
  getInfoList();
}

function open2() {
  tableDalgoRef.value.submit();
}
onMounted(() => {
  getInfoList();
});
</script>
<style lang="scss" scoped>
:deep(.el-dialog__body) {
  background-color: #eef1fb;
  height: 520px;
  overflow: auto;
}
</style>