Newer
Older
Nanping_sponge_GCGL / src / views / project / itemSecurity / environmentalMonitoringComponents / tableDalgo.vue
@liyingjing liyingjing on 25 Oct 2023 10 KB 海绵工程管理
<template>
  <div class="water-analysis-page" :calss="{ iconCLass: typeList.type == 2 }">
    <div class="top">
      <el-form
        label-width="auto"
        :rules="Formrules"
        ref="ruleForm"
        :disabled="typeList.type == 2"
        inline
        :model="FormList"
        :key="isKey"
      >
        <el-row>
          <el-divider content-position="left">基本信息</el-divider>
          <el-form-item label="项目名称:" prop="projectNo" style="width: 45%">
            <el-select
              style="width: 100%"
              v-model="FormList.projectNo"
              placeholder="请选择项目名称"
              @change="ProjectChange"
              clearable
            >
              <el-option
                v-for="dict in ProjectListData"
                :key="dict.projectNo"
                :label="dict.projectName"
                :value="dict.projectNo"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="项目编号:" prop="projectNo" style="width: 45%">
            <el-input
              disabled
              v-model="FormList.projectNo"
              placeholder="请输入项目编号"
              readonly
              class="readonlyClass"
            />
          </el-form-item>
          <el-form-item
            label="识别日期:"
            style="width: 45%"
            prop="identificationDate"
          >
            <el-date-picker
              style="width: 100%"
              clearable
              format="YYYY-MM-DD"
              value-format="YYYY-MM-DD HH:mm:ss"
              v-model="FormList.identificationDate"
              type="date"
             
              range-separator="到"
              placeholder="请选择识别日期"
            />
          </el-form-item>

          <el-form-item
            label="环境因素:"
            style="width: 45%"
            prop="environmentElement"
          >
            <el-input
              v-model="FormList.environmentElement"
              placeholder="请输入环境因素"
            />
          </el-form-item>

          <el-form-item
            label="活动点:"
            style="width: 45%"
            prop="activePoint"
          >
            <el-input
              v-model="FormList.activePoint"
              placeholder="请输入活动点"
            />
          </el-form-item>
          <el-form-item
            label="识别内容:"
            style="width: 93%"
            prop="identifyContent"
          >
            <el-input
              type="textarea"
              v-model="FormList.identifyContent"
              placeholder="请输入识别内容"
            />
          </el-form-item>
          <el-form-item label="排放量:" style="width: 45%" prop="discharge">
            <el-input v-model="FormList.discharge" placeholder="请输入排放量" />
          </el-form-item>

          <el-form-item label="标准要求:" style="width: 45%" prop="standardRequire">
            <el-input v-model="FormList.standardRequire" placeholder="请输入标准要求" />
          </el-form-item>

          
      
          <el-form-item label="处置方式:" style="width: 45%" prop="disposalWay">
            <el-input v-model="FormList.disposalWay" placeholder="请输入处置方式" />
          </el-form-item>

          <el-form-item label="控制方式:" style="width: 45%" prop="controlWay">
            <el-input v-model="FormList.controlWay" placeholder="请输入控制方式" />
          </el-form-item>
          <el-form-item
            label="相关法律法规:"
            style="width: 93%"
            prop="legal"
          >
            <el-input
              type="textarea"
              v-model="FormList.legal"
              placeholder="请输入相关法律法规"
            />
          </el-form-item>
          
          <el-form-item
            label="评价结果:"
            style="width: 93%"
            prop="evaluationResult"
          >
            <el-input
              type="textarea"
              v-model="FormList.evaluationResult"
              placeholder="请输入评价结果"
            />
          </el-form-item>
          <el-form-item label="附件:"  style="width: 93%">
              <el-upload
              v-model:file-list="fileList1"
              style="width: 100%"
              class="upload-demo"
              action="/prod-api/system/upload"
              :headers="uploadHeader"
              multiple
              :on-preview="handlePreview"
              :before-remove="beforeRemove"
            >
              <el-button type="primary">选择文件</el-button>
              <template #tip>
                <div class="el-upload__tip">
                  支持CSV格式,可一次性上传多个文件
                </div>
              </template>
            </el-upload>
        </el-form-item>
          <!-- <el-form-item label="负责人:" style="width: 45%" prop="chargeUser">
            <el-input v-model="FormList.chargeUser" placeholder="请输入负责人" />
          </el-form-item> -->
        </el-row>
      </el-form>
      <!-- <div style="text-align: right">
                <el-button v-show="typeList.type != 2" type="primary" @click="submit">保存
              </el-button>
                <el-button @click="closed">关闭</el-button>
            </div> -->
    </div>
    <!-- <pagination :total="dataForm.total" v-model:page="FormList.page" v-model:limit="FormList.limit"
            @pagination="Getreportlist(FormList)" /> -->
  </div>
</template>
<script setup>
import {
  onMounted,
  toRefs,
  defineEmits,
  reactive,
  defineProps,
  defineExpose,
} from "vue";
import {
  projectInfoAdd,
  projectTypeList,
  projectCompany,
  getUserProfile,
  userList,
  projectInfoSubmit,
  projectInfoapprovet,
} from "@/api/environmentalMonitoring";
import { projectInfoList } from "@/api/project/tenderReview";

import { getToken } from "@/utils/auth";
import { stateOption } from "@/utils/common";
import emgBox from "@/utils/ElMessageBox";
const { typeList } = defineProps(["typeList"]);
const { proxy } = getCurrentInstance();
const {
  build_category,
  project_status,
  project_operation_pattern,
  build_status,
  drainage_partition,
} = proxy.useDict(
  "build_category",
  "project_status",
  "project_operation_pattern",
  "build_status",
  "drainage_partition"
);
const uploadHeader = ref({
  Authorization: "Bearer " + getToken(),
});
const emits = defineEmits();
const project_TypeId = ref([]);
const unit_list = ref([]);
const personList = ref([]);
let dataForm = reactive({});
const Formrules = reactive({
  measurTime: [
    { required: true, message: "测量时间不能为空", trigger: "blur" },
  ],
  environmentElement: [
    { required: true, message: "环境因素不能为空", trigger: "blur" },
  ],

  projectNo: [{ required: true, message: "项目名称/编号不能为空", trigger: ["blur",'change'] }],
  projectName: [
    { required: true, message: "项目名称不能为空", trigger: "blur" },
  ],
});

let FormList = ref({
  pageNum: 1,
  pageSize: 10,
});
const fileList1 = ref([]);
function handlePreview(file) {
  return ElMessageBox.confirm(`下载此文件: ${file.name}?`).then(
    () => window.open(file.url),
    () => false
  );
}
function beforeRemove(file) {
  return true
}
const ProjectListData = ref([]);
/**获取所有的项目数据 */
function loadProjerctListData() {
  projectInfoList().then((response) => {
    ProjectListData.value = response.data;
  });
}

function submit(v) {
  proxy.$refs.ruleForm.validate((valid) => {
    if (valid) {
      FormList.value.fileSaveRequestList = [];
      fileList1.value.forEach((element) => {
        if (element.hasOwnProperty("response")) {
          element.response.data.refType = "proEnvironmentComment";
          FormList.value.fileSaveRequestList.push(element.response.data);
        } else {
          FormList.value.fileSaveRequestList.push(element);
        }
      });
      let { dealUsers, workflowUserId } = FormList.value;
      if (dealUsers?.length > 0 && Array.isArray(dealUsers)) {
        FormList.value.dealUsers = dealUsers?.join(",");
      }
      if (workflowUserId?.length > 0 && Array.isArray(workflowUserId)) {
        FormList.value.workflowUserId = workflowUserId.join(",");
      }
      FormList.value.approveFlag = v == 1 ? true : false;
      if (typeList.type == 4) {
        projectInfoAdd(FormList.value).then(({ code }) => {
          if (code == 200) {
            emits("onModalClose");
          }
        });
      } else if (v == 1) {
        emgBox(FormList.value, projectInfoapprovetM, "您确定通过吗?");
      } else if (v == 2) {
        emgBox(FormList.value, projectInfoapprovetM, "您确定驳回吗?");
      } else {
        projectInfoSubmit(FormList.value).then(({ code }) => {
          if (code == 200) {
            emits("onModalClose");
          }
        });
      }
    }
  });
}
function desertFilds(){ 
    fileList1.value=[]
    proxy.$refs.ruleForm.resetFields()
}
defineExpose({ submit ,desertFilds});
function closed() {
  FormList.value = {};
  emits("onModalClose");
}
const projectInfoapprovetM = async (p) => {
  let { data } = await projectInfoapprovet(p);
  emits("onModalClose");
};
const projectTypeListM = async () => {
  let { data } = await projectTypeList();
  project_TypeId.value = data;
};
const projectCompanyM = async () => {
  let { data } = await projectCompany();
  unit_list.value = data;
};
const getUserProfileM = async () => {
  let { data } = await getUserProfile();
};
const userListM = async () => {
  let { data } = await userList();
  personList.value = data;
};
onMounted(() => {
  FormList.value = typeList;
  fileList1.value = typeList.fileList1;
  // let array = [];
  // let arri = [];
  // if (FormList.value?.dealUsers) {
  //   array = FormList.value?.dealUsers.split(",");
  // }
  // if (array.length > 0) {
  //   array.forEach((i) => {
  //     arri.push(Number(i));
  //   });
  // }
  // FormList.value.dealUsers = arri;
  console.log(typeList, "typeList123");
  projectTypeListM();
  projectCompanyM();
  getUserProfileM();
  userListM()
  loadProjerctListData()
});
</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>