Newer
Older
Nanping_sponge_GCGL / src / views / project / projectInformation / index1.vue
@liyingjing liyingjing on 25 Oct 2023 8 KB 海绵工程管理
<template>
  <div class="water-analysis-page" :key="isFlag">
    <div class="top">
      <el-form ref="ruleForm" inline :model="tableData" v-show="showSearch">
        <el-form-item label="项目名称:" prop="projectName">
          <el-input
            v-model="tableData.projectName"
            placeholder="请输入项目名称"
            style="width: 240px"
            clearable
          ></el-input>
        </el-form-item>
        <el-form-item label="项目运作模式:" prop="projectOperationPattern">
          <el-select
            v-model="tableData.projectOperationPattern"
            clearable
            placeholder="请选择项目运作模式"
          >
            <el-option
              v-for="dict in project_operation_pattern"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="建设单位:" prop="constructUnit">
          <el-input
            v-model="tableData.constructUnit"
            style="width: 240px"
            clearable
            placeholder="请输入建设单位"
          ></el-input>
        </el-form-item>
        <el-form-item label="责任人:" prop="chargeUser">
          <el-input
            v-model="tableData.chargeUser"
            style="width: 240px"
            clearable
            placeholder="请输入责任人"
          ></el-input>
        </el-form-item>
        <!-- <el-form-item label="流程步骤:" prop="status">
          <el-select
            clearable
            v-model="tableData.status"
            placeholder="请选择流程步骤"
          >
            <el-option
              v-for="dict in dangerous_status"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item> -->
        <el-form-item>
          <el-button
            type="primary"
            plain
            icon="Plus"
            @click="onCheck(4)"
            v-hasPermi="['system:post:add']"
            >新增</el-button
          >
          <!-- <el-button type="primary" plain icon="DArrowRight" @click="onCheck(5)"
            >转交</el-button
          > -->
          <el-button type="primary" plain icon="Download" @click="onCheck(6)"
            >导出</el-button
          >
          <el-button type="primary" icon="Search" @click="searchForm">
            查询</el-button
          >
          <el-button icon="Refresh" @click="resetQuery">重置</el-button>
        </el-form-item>
      </el-form>
      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button type="primary">项目总数: {{ groupTotal.total }}</el-button>
        </el-col>
        <el-col :span="1.5">
          <el-button type="success"
            >完成项目总投资:
            {{ groupTotal.completeProjectInvest }}(万元)</el-button
          >
        </el-col>
        <el-col :span="1.5">
          <el-button type="warning"
            >完成海绵相关总投资:
            {{ groupTotal.completeSpongeInvest }}(万元)</el-button
          >
        </el-col>

        <el-col :span="1.5" v-for="i in groupTotal.yearGroup">
          <el-button
            :type="typeShow == i ? 'primary' : ''"
            @click="clickYear(i)"
            @dblclick.prevent="dbclickYear(i)"
            >{{ i.name }}年: {{ i.count }}(个)</el-button
          >
        </el-col>
        <el-col :span="1.5" v-for="i in groupTotal.typeGroup">
          <el-button
            @click="clickType(i)"
            @dblclick.prevent="dbclickType(i)"
            :type="yearShow == i ? 'primary' : ''"
          >
            {{ i.name }}: {{ i.count }}(个)</el-button
          >
        </el-col>
        <right-toolbar
          v-model:showSearch="showSearch"
          @queryTable="searchForm"
        ></right-toolbar>
      </el-row>
    </div>

    <el-tabs
      v-model="activeName"
      class="demo-tabs"
      @tab-click="handleClick"
      style="margin-top: -10px"
      type="border-card"
    >
      <el-tab-pane label="我创建的项目" name="1"> </el-tab-pane>
      <el-tab-pane label="我参与的项目" name="2"> </el-tab-pane>
      <todoDon ref="todoDonRef"></todoDon>
    </el-tabs>
    <el-dialog
      v-model="visible"
      title="项目信息新增"
      :modal-append-to-body="false"
      :close-on-click-modal="false"
      width="80%"
    >
      <addDalg
        ref="tableDalgoRef"
        :typeList="typeList"
        @onModalClose="onModalClose"
      ></addDalg>
      <template #footer>
        <div class="dialog-footer">
          <el-button v-show="typeList.type != 2" type="primary" @click="submit"
            >保存</el-button
          >
          <el-button @click="submitClict" type="success">提 交</el-button>
          <el-button @click="visible = false">关闭</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>
<script setup>
import { projectInfoGroup } from "@/api/projectInformation";
import addDalg from "./addDalg.vue";
import todoDon from "./todoDon.vue";
import { userList } from "@/api/projectInformation";
const todoDonRef = ref(null);
const { proxy } = getCurrentInstance();
const { project_operation_pattern, dangerous_status } = proxy.useDict(
  "project_operation_pattern",
  "dangerous_status"
);
const typeShow = ref("");
const yearShow = ref("");
const ruleForm = ref(null);
const groupTotal = ref({});
const typeList = reactive({});
const showSearch = ref(true);
const projectContent = ref(false);
const tableDalgoRef = ref();
const activeName = ref("1");
const visible = ref(false);
const zjtdialgo = ref(false);
const isFlag = ref(1);
const personList = ref([]);
//动态组件
let dataForm = reactive({
  tableData: { belong: 1 },
  tableDateTwo: "",
  tableLoading: true,
});
let { tableData } = toRefs(dataForm);
//切换table
const handleClick = ({ props }, event) => {
  tableData.value.belong = props.name;
  todoDonRef.value.getInfoList(tableData.value);
};
//搜索
const searchForm = () => {
  todoDonRef.value.getInfoList(tableData.value);
};
// 重置
const resetQuery = () => {
  tableData.value = {
    pageNum: 1,
    pageSize: 10,
    belong: tableData.value.belong,
  };
  typeShow.value = "";
  yearShow.value = "";
  todoDonRef.value.getInfoList(tableData.value);
};
// 操作
const onCheck = (v) => {
  typeList.type = v;
  if (v == 4) {
    visible.value = true;
    nextTick(() => {
      tableDalgoRef.value.closeds();
    });
    zjtdialgo.value = true;
  } else if (v == 7) {
    projectContent.value = true;
  }
};
async function projectInfoGroupM() {
  let { data } = await projectInfoGroup();
  groupTotal.value = data;
}
const userListM = async () => {
  let { data } = await userList();
  personList.value = data;
};
function submit() {
  tableDalgoRef.value.submit();
}
//新增提交
function submitClict() {
  tableDalgoRef.value.submit(6);
}
function onModalClose() {
  visible.value = false;
  todoDonRef.value.getInfoList(tableData.value);
}
let timer = null;
function clickYear(v) {
  clearTimeout(timer);
  timer = setTimeout(function () {
    typeShow.value = v;
    tableData.value.year = v.name;
    todoDonRef.value.getInfoList(tableData.value);
  }, 400);
}
function dbclickYear() {
  clearTimeout(timer);
  typeShow.value = "";
  tableData.value.year = "";
  todoDonRef.value.getInfoList(tableData.value);
}
function clickType(v) {
  clearTimeout(timer);
  timer = setTimeout(function () {
    yearShow.value = v;
    tableData.value.projectTypeId = v.projectTypeId;
    todoDonRef.value.getInfoList(tableData.value);
  }, 400);
}
function dbclickType() {
  clearTimeout(timer);
  yearShow.value = "";
  tableData.value.projectTypeId = "";
  todoDonRef.value.getInfoList(tableData.value);
}
onMounted(() => {
  projectInfoGroupM();
  userListM();
  todoDonRef.value.getInfoList(tableData.value);
});
</script>
<style lang="scss" scoped>
.water-analysis-page {
  padding: 20px;
  height: 90vh;
  .top {
    margin-bottom: 15px;
  }
}
:deep(.el-dialog__body) {
  background-color: #eef1fb;
  height: 650px;
  overflow: auto;
}
</style>