Newer
Older
Nanping_sponge_GCGL / src / views / project / projectConfiguration / xmjhpz / todoDon.vue
@liyingjing liyingjing on 25 Oct 2023 4 KB 海绵工程管理
<template>
  <div class="water-analysis-page">
    <el-table
      :data="tableData"
      v-loading="tableLoading"
      stripe
      max-height="500"
      default-expand-all
      row-key="id"
    >
    <el-table-column type="index" width="55" label="序号" align="center" />
      <el-table-column
        label="节点名称"
        align="left"
        prop="nodeName"
        show-overflow-tooltip
      />
      <el-table-column
        label="输出资料"
        align="center"
        prop="outputData"
        show-overflow-tooltip
      />
      <el-table-column
        label="层级"
        align="center"
        prop="tier"
        show-overflow-tooltip
      >
      </el-table-column>
      <el-table-column
        label="权重"
        align="center"
        prop="weight"
        show-overflow-tooltip
      >
      <template #default="{ row }">
        {{ row.weight }}%
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="操作" width="270" align="center">
        <template #default="{ row }">
          <el-button link icon="Plus" type="primary" @click="onCheck(row, 4,'项目计划配置子节点新增')"
            >新增子节点</el-button
          >
          <el-button link   icon="Edit" type="warning" @click="onCheck(row, 2,'项目计划配置节点修改')"
            >修改</el-button
          >
          <!-- </div> -->
          <!-- <el-button v-else link type="success" @click="onCheck(row, 2)">详情</el-button> -->
          <el-button link  icon="Delete"  type="danger" @click="onCheck(row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
<!--   
    <pagination
      v-show="FormList.totals > 0"
      :total="FormList.totals"
      v-model:page="queryParams.pageNum"
      v-model:limit="queryParams.pageSize"
      @pagination="getInfoList(queryParams)"
    /> -->
  </div>
  <el-dialog
    v-model="visible"
    :title="title"
    :modal-append-to-body="false"
    :close-on-click-modal="false"
    width="50%"
  >
    <tableDalgo
      ref="tableDalgoRef"
      @onModalClose="onModalClose"
      :typeList="typeList"
      v-if='visible'
    ></tableDalgo>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="submit">保存</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/xmjhpz";
// import projectTable from "./projectTable.vue";
import tableDalgo from "./tableDalgo.vue";
import { downloadBlob, formatDate, formatMonths } from "@/utils/projectTable";
import emgBox from "@/utils/ElMessageBox";
const { proxy } = getCurrentInstance();
const { project_operation_pattern, unit_property, credit_line } = proxy.useDict(
  "project_operation_pattern",
  "unit_property",
  "credit_line"
);
let visible = ref(false);
let tableDalgoRef = ref();
const FormList = ref({
  workFlag: 1,
});
const queryParams=ref({
    pageNum: 1,
    pageSize: 10})
let tableData = ref([]);
const title=ref('')
let tableLoading = ref(false);
//获取列表数据
const getInfoList = async (prams) => {
  FormList.value = prams;
  tableLoading.value = true;
  let { data, total } = await getInfo(prams);
  tableData.value = data;
  // FormList.value.totals = total;
  FormList.value.totals = data.length;
  setTimeout(() => {
    tableLoading.value = false;
  }, 500);
};
//搜索
defineExpose({ getInfoList });
// 查看上报数据
let typeList = ref({});
const onCheck = (row, v,t) => {
  title.value=t
  if (v == 2 || v == 4) {
    typeList.value = {
      projectTypeId: row.projectTypeId,
      type: v,
      parentNodeCode: row.nodeCode,
      ...row
    } 
    visible.value = true;
    // nextTick(() => {
    //   tableDalgoRef.value.resetFiled();
    // });
    if(v == 4){ 
      typeList.value = {
      projectTypeId: row.projectTypeId,
      nodeName: row.nodeName,
      type: v,
      parentNodeCode: row.nodeCode,
      }
      typeList.value.nodeName=''
    }
  } else {
    emgBox(row.id, projectInfoDeleteM, "您确定删除吗?");
  }
};
//删除
const projectInfoDeleteM = async (id) => {
  let { code } = await projectInfoDelete(id);
  getInfoList(FormList.value);
};
function onModalClose() {
  visible.value = false;
  getInfoList(FormList.value);
}
function submit() {
  tableDalgoRef.value.submit(typeList.value);
}
onMounted(() => {
  // getInfoList()
  // getInfoList(FormList.value)
});
</script>
<style lang="scss" scoped>
.water-analysis-page {
  padding: 20px;
  // border: 1px solid #ddd;
  height: 90vh;
  .top {
   // margin-bottom: 15px;
  }
  .el-input__inner {
    // color: #fff;//
  }
  ::v-deep .el-tabs--border-card > .el-tabs__header .el-tabs__item.is-active {
    font-size: 18px;
    color: rgb(255, 255, 255);
    background-color: rgb(22, 132, 252);
    border-left: 1px solid rgb(22, 132, 252);
  }
}
:deep(.el-dialog__body) {
  background-color: #eef1fb;
  height: 550px;
  overflow: hidden;
}
</style>