Newer
Older
Nanping_sponge_GCGL / src / views / project / projectConfiguration / xmjhpz / tableDalgo.vue
@liyingjing liyingjing on 25 Oct 2023 5 KB 海绵工程管理
<template>
  <div class="water-analysis-page" :calss="{ iconCLass: typeList.type == 2 }">
    <div class="top">
      <el-form
        label-width="auto"
        :rules="Formrules"
        ref="ruleForm"
        inline
        :model="FormList"
        :key="isKey"
      >
        <el-row>
          <el-form-item
            label="项目类型:"
            style="width: 45%"
            prop="projectTypeId"
            v-if="typeList.type != 4"
          >
            <el-select
              disabled
              clearable
              v-model="FormList.projectTypeId"
              class="m-2"
              placeholder="请选择所属类型"
              size="mini"
              style="width: 100%"
            >
              <el-option
                v-for="item in ownership"
                :key="item.value"
                :label="item.projectTypeName"
                :value="item.id"
              />
            </el-select>
          </el-form-item>
          <!-- <el-form-item label="节点编号:" style="width: 45%" prop="nodeCode">
            <el-input v-model="FormList.nodeCode" placeholder="节点名称" />
          </el-form-item> -->
          <el-form-item label="节点名称:" style="width: 45%" prop="nodeName">
            <el-input v-model="FormList.nodeName" placeholder="请输入节点名称" />
          </el-form-item>
          
          <el-form-item label="工作标准:" style="width: 94%" prop="jobStandard">
            <el-input
              style="width: 100%"
              v-model="FormList.jobStandard"
              type="textarea"
              placeholder="请输入工作标准"
            />
          </el-form-item>
          <el-form-item label="输出资料:" style="width: 45%" prop="outputData">
            <el-input
              style="width: 100%"
              v-model="FormList.outputData"
              placeholder="请输入输出资料"
            />
          </el-form-item>
          <el-form-item label="排序:" style="width: 45%" prop="sort">
            <el-input
              style="width: 100%"
              type="number"
              v-model="FormList.sort"
              placeholder="请输入排序"
            />
          </el-form-item>
          <el-form-item label="权重(%):" style="width: 45%" prop="weight">
            <el-input-number   style="width: 100%"  v-model="FormList.weight" :precision="2" :step="0.1" :max="100" />
          </el-form-item>
          
        </el-row>
      </el-form>
    </div>
  </div>
</template>
<script setup>
import { onMounted, toRefs, defineEmits, reactive, defineProps } from "vue";
import {
  projectInfoAdd,
  projectTypeList,
  projectCompany,
  getUserProfile,
  userList,
  projectInfoSubmit,
  projectInfoapprovet,
  projectPlanTemplatEdit,
} from "@/api/xmjhpz";

import { stateOption } from "@/utils/common";
import emgBox from "@/utils/ElMessageBox";
const { typeList, tableData } = defineProps(["typeList", "tableData"]);
const { proxy } = getCurrentInstance();
const { pro_project_type } = proxy.useDict("pro_project_type");
const emits = defineEmits();
const project_TypeId = ref([]);
const unit_list = ref([]);
const personList = ref([]);
let dataForm = reactive({});
const Formrules = reactive({
  ChildrednnodeName: [
    { required: true, message: "节点名称不能为空", trigger: "blur" },
  ],
  nodeCode: [{ required: true, message: "节点编码不能为空", trigger: "blur" }],
  nodeName: [{ required: true, message: "节点名称不能为空", trigger: "blur" }],
  projectTypeId: [{ required: true, message: "项目类型不能为空", trigger: "blur" }],
  sort: [{ required: true, message: "排序不能为空", trigger: "blur" }],
});
let FormList = ref({
  pageNum: 1,
  pageSize: 10,
});
function submit(v) {
  proxy.$refs.ruleForm.validate((valid) => {
    if (valid) {
      if (typeList.type == 3 || typeList.type == 4) {
        if (typeList.type == 4) {
          FormList.value.parentNodeCode = typeList.parentNodeCode;
          FormList.value.projectTypeId = typeList.projectTypeId;
          // FormList.value.nodeName= FormList.value.ChilldrednnodeName
          FormList.value.tier = 2;
        } else {
          FormList.value.tier = 1;
        }
        projectInfoAdd(FormList.value).then(({ code }) => {
          if (code == 200) {
            emits("onModalClose");
          }
        });
      } else {
        projectPlanTemplatEdit(FormList.value).then((res) => {
          emits("onModalClose");
        });
      }
    }
  });
}
defineExpose({ submit, resetFiled });
function resetFiled() {
  proxy.$refs.ruleForm.resetFields();
}
const ownership = ref([]);
const projectTypeListM = async () => {
  let { data } = await projectTypeList();
  nextTick(() => {
    ownership.value = data;
  });
};
onMounted(() => {
  console.log(typeList, 99990000);
  FormList.value = {  parentNodeCode: 0, tier: 1, ...typeList ,...tableData,};
  // FormList.value.projectTypeId=tableData?.name
  delete FormList.value?.name;
  console.log(FormList.value, "typeList123");
  if (typeList.type == 4) {
    console.log(2323);
  }
  projectTypeListM();
});
</script>
<style lang="scss" scoped>
.water-analysis-page {
  padding: 20px;

  .top {
   // margin-bottom: 15px;
  }
}

.pagination {
  float: right;
  margin-top: 10px;
}

.iconCLass {
  ::v-deep .el-input__wrapper {
    box-shadow: 0 0 0 0;
  }
}

.tabs {
  ::v-deep .el-input__wrapper {
    box-shadow: 0 0 0 0;
  }
}

// .action-span {
//
//     }
</style>