Newer
Older
Nanping_sponge_GCGL / src / views / project / itemSecurity / hazardCopmonents / tableDalgo.vue
@liyingjing liyingjing on 25 Oct 2023 8 KB 海绵工程管理
<template>
  <div class="water-analysis-page" :calss="{ iconCLass: typeList.type == 2 }">
    <div class="top">
      <!-- <el-steps :active="active" finish-status="success">
                <el-step title="提交申请" />
                <el-step title="立项人员" />
            </el-steps> -->
      <el-form
        label-width="auto"
        :rules="Formrules"
        ref="ruleForm"
        :disabled="typeList.type == 2"
        inline
        :model="FormList"
        :key="isKey"
      >
        <el-row>
          <el-form-item label="项目名称:" prop="projectNo" style="width: 45%">
            <el-select
              style="width: 100%"
              v-model="FormList.projectNo"
              placeholder="请选择项目名称"
              @change="ProjectChange"
            >
              <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="measurTime">
            <el-date-picker
              style="width: 100%"
              clearable
              format="YYYY-MM-DD"
              value-format="YYYY-MM-DD"
              v-model="FormList.measurTime"
              type="date"
             
              range-separator="到"
              placeholder="测量日期"
            />
          </el-form-item>

          <el-form-item
            label="仪器名称:"
            style="width: 45%"
            prop="instrumentName"
          >
            <el-input
              v-model="FormList.instrumentName"
              placeholder="请输入仪器名称"
            />
          </el-form-item>
          <el-form-item
            label="仪器编码:"
            style="width: 45%"
            prop="instrumentNumber"
          >
            <el-input
              v-model="FormList.instrumentNumber"
              placeholder="请输入仪器编码"
            />
          </el-form-item>
          <el-form-item
            label="测量人:"
            style="width: 45%"
            prop="measurUserName"
          >
            <el-input v-model="FormList.measurUserName" placeholder="请输入测量人" />
          </el-form-item>
          <el-form-item
            label="测量负责人:"
            style="width: 45%"
            prop="measurDutyUserName"
          >
            <el-input
              v-model="FormList.measurDutyUserName"
              placeholder="请输入测量负责人"
            />
          </el-form-item>

          <!-- <el-form-item label="附件:">
              <el-upload
              v-model:file-list="fileList1"
              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-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/hazardRectificationAndReview";
import { projectInfoList } from "@/api/project/tenderReview";

import { stateOption } from "@/utils/common";
import { getToken } from "@/utils/auth";
import emgBox from "@/utils/ElMessageBox";
const { typeList } = defineProps(["typeList"]);
const { proxy } = getCurrentInstance();
const uploadHeader = ref({
  Authorization: "Bearer " + getToken(),
});
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 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" },
  ],
  instrumentName: [
    { required: true, message: "仪器名称不能为空", trigger: "blur" },
  ],

  projectNo: [{ required: true, message: "项目名称/编号不能为空", trigger: "blur" }],
  projectName: [
    { required: true, message: "项目名称不能为空", trigger: "blur" },
  ],
});
let FormList = ref({
  pageNum: 1,
  pageSize: 10,
});
const fileList1 = ref([]);
const ProjectListData = ref([]);
/**获取所有的项目数据 */
function loadProjerctListData() {
  projectInfoList().then((response) => {
    ProjectListData.value = response.data;
  });
}

function handlePreview(file) {
  return ElMessageBox.confirm(`下载此文件: ${file.name}?`).then(
    () => window.open(file.url),
    () => false
  );
}
function beforeRemove(file) {
  return true
}
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(){ 
    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;
  console.log(typeList, "typeList123");
  projectTypeListM();
  projectCompanyM();
  getUserProfileM();
  userListM();
  loadProjerctListData()
});
</script>
<style lang="scss" scoped>
.water-analysis-page {
  padding: 20px;
}
.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>