Newer
Older
Nanping_sponge_GCGL / src / views / project / itemSecurity / AndEvaluationComponents / tableDalgo.vue
@liyingjing liyingjing on 25 Oct 2023 17 KB 海绵工程管理
<template>
  <div class="water-analysis-page" :calss="{ iconCLass: typeList.type == 2 }">
    <div class="top">
      <el-form
        ref="ruleForm"
        inline
        :model="FormList"
        :rules="AndEvaluationComponentsRules"
        :key="isKey"
       
        label-width="auto"
      >
        <el-row>
          <!-- <el-form-item label="隐患编号:" prop="reformRecordCode" style="width: 45%">
            <el-input
              v-model="FormList.reformRecordCode"
              placeholder="请输入隐患编号"
              class="readonlyClass"
            />
          </el-form-item> -->
          <el-form-item label="项目名称:" prop="projectNo" style="width: 45%">
            <el-select
              style="width: 100%"
              v-model="FormList.projectNo"
              placeholder="请选择项目名称"
              @change="ProjectChange"
              :disabled="typeList.type == 4 ||typeList.status=='examine'"
            >
              <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="检查人:" prop="checkUserName" style="width: 45%">
            <el-input
              v-model="FormList.checkUserName"
              placeholder="请输入检查人"
              :disabled="typeList.type == 4 ||typeList.status=='examine'"
            />
          </el-form-item>
          <el-form-item
            label="检查单位:"
            prop="checkUnitName"
            style="width: 45%"
          >
            <el-input v-model="FormList.checkUnitName" placeholder="检查单位" :disabled="typeList.type == 4 ||typeList.status=='examine'"  />
          </el-form-item>
          <el-form-item
            label="检查标识:"
            prop="checkIdentification"
            style="width: 45%"
          >
            <el-input
              v-model="FormList.checkIdentification"
            :disabled="typeList.type == 4 ||typeList.status=='examine'"
              placeholder="请输入检查标识"
            />
          </el-form-item>

          <el-form-item label="检查日期:" prop="checkTime" style="width: 45%">
            <el-date-picker
              style="width: 100%"
              clearable
              format="YYYY-MM-DD"
              value-format="YYYY-MM-DD"
              v-model="FormList.checkTime"
              type="date"
             
              range-separator="到"
              placeholder="请输入检查日期"
            :disabled="typeList.type == 4 ||typeList.status=='examine'"
            />
          </el-form-item>
          <el-form-item label="补充说明:" style="width: 92%" prop="description">
            <el-input
              v-model="FormList.description"
              type="textarea"
              placeholder="请输入补充说明"
              :disabled="typeList.type == 4 ||typeList.status=='examine'"
            />
          </el-form-item>
          <el-divider content-position="left">隐患说明</el-divider>
          <el-form-item
            label="隐患类型:"
            prop="hiddenTroubleType"
            style="width: 45%"
          >
            <el-input
              v-model="FormList.hiddenTroubleType"
            :disabled="typeList.type == 4 ||typeList.status=='examine'"
              placeholder="请输入隐患类型"
            />
          </el-form-item>
          <el-form-item
            label="隐患编号:"
            prop="reformRecordCode"
            style="width: 45%"
          >
            <el-input
              v-model="FormList.reformRecordCode"
            :disabled="typeList.type == 4 ||typeList.status=='examine'"
              placeholder="请输入隐患编号"
            />
          </el-form-item>
          <el-form-item
            label="隐患级别:"
            prop="hiddenTroubleLevel"
            style="width: 45%"
          >
            <el-select
              clearable
              v-model="FormList.hiddenTroubleLevel"
              class="m-2"
              placeholder="请选择隐患级别"
              size="mini"
            :disabled="typeList.type == 4 ||typeList.status=='examine'"
              style="width: 100%"
            >
              <el-option
                v-for="item in hidden_trouble_level"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item
            label="当前隐患措施:"
            style="width: 92%"
            prop="currentPreventHiddenTrouble"
          >
            <el-input
              v-model="FormList.currentPreventHiddenTrouble"
              type="textarea"
              :disabled="typeList.type == 4 ||typeList.status=='examine'"
              placeholder="请输入当前隐患措施"
            />
          </el-form-item>
          <el-form-item
            label="防患内容:"
            style="width: 92%"
            prop="preventHiddenTroubleContent"
          >
            <el-input
              v-model="FormList.preventHiddenTroubleContent"
              type="textarea"
            :disabled="typeList.type == 4 ||typeList.status=='examine'"
              placeholder="请输入防患内容"
            />
          </el-form-item>
          <el-form-item label="备注:" style="width: 92%" prop="remark">
            <el-input
              v-model="FormList.remark"
              type="textarea"
              placeholder="请输入备注"
              :disabled="typeList.type == 4 ||typeList.status=='examine'"
            />
          </el-form-item>
          <el-divider content-position="left">整改落实情况</el-divider>
          <el-form-item
            label="通知方式:"
            style="width: 45%"
            prop="notificationType"
          >
            <el-select
              clearable
              v-model="FormList.notificationType"
              class="m-2"
              placeholder="请选择通知方式"
            :disabled="typeList.type == 4 ||typeList.status=='examine'"
              size="mini"
              style="width: 100%"
            >
              <el-option
                v-for="item in notification_type"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item
            label="整改完成期限:"
            prop="abarbeitungDeadline"
            style="width: 45%"
          >
            <el-date-picker
              style="width: 100%"
              clearable
              format="YYYY-MM-DD"
              value-format="YYYY-MM-DD HH:mm:ss"
              v-model="FormList.abarbeitungDeadline"
              type="date"
            :disabled="typeList.type == 4 ||typeList.status=='examine'"
             
              range-separator="到"
              placeholder="整改完成期限"
            />
          </el-form-item>
          <el-form-item
            label="整改方案:"
            prop="changeScheme"
            style="width: 45%"
          >
            <el-input  :disabled="typeList.type == 4 ||typeList.status=='examine'" v-model="FormList.changeScheme" placeholder="请输入整改方案" />
          </el-form-item>
          <el-form-item
            label="实际完成日期:"
            prop="actualFinishDate"
            style="width: 45%"
          >
            <el-date-picker
              style="width: 100%"
            :disabled="typeList.type == 4 ||typeList.status=='examine'"
              clearable
              format="YYYY-MM-DD"
              value-format="YYYY-MM-DD HH:mm:ss"
              v-model="FormList.actualFinishDate"
              type="date"
             
              range-separator="到"
              placeholder="实际完成日期"
            />
          </el-form-item>
          <el-form-item
            label="整改责任人:"
            prop="abarbeitungDutyUserName"
            style="width: 45%"
          >
            <el-input
              style="width: 100%"
              v-model="FormList.abarbeitungDutyUserName"
            :disabled="typeList.type == 4 ||typeList.status=='examine'"
              placeholder="请输入整改责任人"
            />
          </el-form-item>

          <el-form-item
            label="整改单位:"
            prop="abarbeitungUnitName"
            style="width: 45%"
          >
            <el-input
              v-model="FormList.abarbeitungUnitName"
            :disabled="typeList.type == 4 ||typeList.status=='examine'"
              placeholder="请输入整改单位"
            />
          </el-form-item>
          <el-form-item
            label="复查/整改结果:"
            style="width: 92%"
            prop="rectificationResult"
          >
            <el-input
              v-model="FormList.rectificationResult"
              type="textarea"
            :disabled="typeList.type == 4 ||typeList.status=='examine'"
              placeholder="请输入复查/整改结果"
            />
          </el-form-item>

          <el-form-item label="指定处理人:" style="width: 45%" prop="dealUsers">
            <el-select
              clearable
              v-model="FormList.dealUsers"
              class="m-2"
              :disabled="typeList.type == 4 ||typeList.status=='examine'"
              placeholder="请选择指定处理人"
              size="mini"
              style="width: 100%"
            >
              <el-option
                v-for="item in personList"
                :key="item.userId"
                :label="item.nickName"
                :value="item.userId+''"
              />
            </el-select>
          </el-form-item>
          <el-form-item
            label="处理意见:"
            style="width: 92%"
            prop="approveComment"
            v-if="typeList.type == 6"
             disabled="false"
          >
            <el-input
              style="width: 100%"
              v-model="FormList.approveComment"
              type="textarea"
              placeholder="请输入处理意见"
            />
          </el-form-item>
          <el-form-item
            label="流程抄送:"
            style="width: 45%"
            prop="pushUsers"
          >
            <el-select
              clearable
              v-model="FormList.pushUsers"
              class="m-2"
            :disabled="typeList.type == 4 ||typeList.status=='examine'"
              placeholder="请选择流程抄送人"
              size="mini"
              style="width: 100%"
            >
              <el-option
                v-for="item in personList"
                :key="item.userId"
                :label="item.nickName"
                :value="item.userId+''"
              />
            </el-select>
          </el-form-item>

          <el-form-item
            v-if="typeList.type == 4 && stapesDate.length > 0"
            prop="pushUsers"
            style="width: 100%; margin: 10px 0"
          >
            <el-divider content-position="left">流程日志</el-divider>
              <el-steps direction="vertical" :active="stapesDate.length">
                <el-step v-for="i in stapesDate" :title="i.activityName" style="height: 50px;width: 300px;">
                  <template #description>
                    <div class="direction">时间:{{ i.endTime}}</div>
                    <div class="direction">
                      分配人:{{ i.assigneeName  }}
                    </div>
                    <div class="direction">
                      任务备注:{{ i.comment  }}
                    </div>
                  </template>
                </el-step>
              </el-steps>
          </el-form-item>
        </el-row>
      </el-form>
    </div>
  </div>
</template>
<script setup>
import {
  onMounted,
  defineEmits,
  reactive,
  defineProps,
  defineExpose,
} from "vue";
import {
  projectTypeList,
  projectCompany,
  getUserProfile,
  userList,
  projectInfoapprovet,
  projectPatrolProblemPage,
  projectQualityReformRecordAdd,
  projectQualityReformRecordEdit,
  projectQualityReformRecordSubmit,
  projectQualityReformRecordapprove,
} from "@/api/environmentalIdentificationAndEvaluation";
import { projectInfoList } from "@/api/project/tenderReview";
import { workflowProcess } from "@/api/project/qualityRectificationDetails";
import { ElMessage, ElMessageBox } from "element-plus";
const { typeList } = defineProps(["typeList"]);
console.log(typeList, "typeList");
import {AndEvaluationComponentsRules} from '@/utils/rules'
const { proxy } = getCurrentInstance();
const {
  hidden_trouble_level,
  notification_type,
  abarbeitung_type,
  project_status,
  project_operation_pattern,
  build_status,
  drainage_partition,
} = proxy.useDict(
  "abarbeitung_type",
  "project_status",
  "project_operation_pattern",
  "build_status",
  "drainage_partition",
  "hidden_trouble_level",
  "notification_type"
);
const emits = defineEmits();
const project_TypeId = ref([]);
const unit_list = ref([]);
const personList = ref([]);
const projectList = ref([]);
const ProjectListData = ref([]);
defineExpose({ closed, submit });
let FormList = ref({
  pageNum: 1,
  pageSize: 10,
});
const stapesDate = ref([]);
function submit(v) {
  proxy.$refs.ruleForm.validate((valid) => {
    if (valid) {
      FormList.value.projectQualityReformDetailSaveRequestList =
        projectList.value;
      let { dealUsers, pushUsers } = FormList.value;
      if (pushUsers?.length > 0 && Array.isArray(pushUsers)) {
        FormList.value.pushUsers = pushUsers.join(",");
      }
      if (dealUsers?.length > 0 && Array.isArray(dealUsers)) {
        FormList.value.dealUsers = dealUsers?.join(",");
      }
      FormList.value.approveFlag = v == 1 ? true : false;
      if (v == 1 ||v==2) {
        ElMessageBox.confirm(`您确定${v==1? '通过':'驳回'}吗?`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
             })
    .then(() => {
      projectInfoapprovetM(FormList.value)
    })
    .catch(() => { });
      } 
      // 编辑
      else  if (FormList.value.type == 5) {
        projectQualityReformRecordEdit(FormList.value).then(({ code }) => {
          if (code == 200) {
            emits("onModalClose");
          }
        });
      } else if (FormList.value.type == 6) {
        projectQualityReformRecordapprove(FormList.value).then(({ code }) => {
          if (code == 200) {
            emits("onModalClose");
          }
        });
      } else if (FormList.value.type == 3|| v == 6) {
        if (!FormList.value.dealUsers) {
          ElMessage({
            message: "请您选择指定处理人",
            type: "warning",
          });
        } else {
        projectQualityReformRecordSubmit(FormList.value).then(({ code }) => {
          if (code == 200) {
            emits("onModalClose");
          }
        });
      }
      } else {
        projectQualityReformRecordAdd(FormList.value).then(({ code }) => {
          if (code == 200) {
            emits("onModalClose");
          }
        });
      }
    }
  });
}
function closed() {
  proxy.$refs.ruleForm.resetFields()
  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;
  console.log(personList, "personListpersonList");
  FormList.value = typeList;
  projectList.value = typeList.projectQualityReformDetailSaveRequestList || [];
};
/**获取所有的项目数据 */
function loadProjerctListData() {
  projectInfoList().then((response) => {
    ProjectListData.value = response.data;
  });
}

//根据项目获取项目清单
function ProjectChange(projectId) {
  projectPatrolProblemPage(projectId).then(({ data: { chargeUser } }) => {
    FormList.value.chargeUser = chargeUser;
  });
}

const workflowProcessM = async () => {
  let params = {
    businessKey: typeList.id,
    workflowKey: "proProblemReformRecord",
    workflowUserId: "",
  };
  let { data } = await workflowProcess(params);
  stapesDate.value = data;
};
onMounted(() => {
  projectTypeListM();
  projectCompanyM();
  getUserProfileM();
  userListM();
  loadProjerctListData();
  if(typeList?.projectNo){ 
    ProjectChange(typeList.projectNo);
    if(typeList.status!='start'&&typeList.type != "add"){ 
        workflowProcessM();
    }
  }
});
</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>