Files
laws-sinotruk-client/src/views/workCenter/annualRevisionPlanActivelyReport/modules/ContactEnterSendTaskModal.vue
T
2024-03-05 11:01:55 +08:00

1121 lines
51 KiB
Vue

<template>
<a-drawer
:title="title"
:maskClosable="false"
:width="1000"
placement="right"
:closable="true"
@close="handleCancel"
:visible="visible"
class="custom-drawer-style">
<div class="custom-drawer-style-scroll">
<a-spin :spinning="confirmLoading">
<a-form-model :model="formInline" class="form-add" :rules="rules" ref="ruleForm">
<!-- 基础信息 -->
<div class="header-text">{{ $t('basicInformation') }}</div>
<div class="form-flex-box">
<!-- 申请类型 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.applicationType')">
{{ $t('workCenter.enterpriseInitChangePlan.applicationType') }}
</span>
</div>
<a-form-model-item class="item-model" prop="applicationType">
<a-select v-model="formInline.applicationType"
:disabled="disabled"
:defaultValue="ApplicationCategory.INITIATION.value"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.applicationType')">
<a-select-option :value="ApplicationCategory.INITIATION.value">{{ $t('workCenter.enterpriseInitChangePlan.standardProjectEstablishment') }}</a-select-option>
</a-select>
</a-form-model-item>
</div>
<!-- 项目类别 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.itemCategory')">
{{ $t('workCenter.enterpriseInitChangePlan.itemCategory') }}
</span>
</div>
<a-form-model-item class="item-model" prop="projectType">
<a-select v-model="formInline.projectType"
@change="projectTypeChange"
:disabled="disabled"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.itemCategory')">
<a-select-option :value="ProjectType.ENACT.value">{{ $t('workCenter.enterpriseInitChangePlan.formulate') }}</a-select-option>
<a-select-option :value="ProjectType.MODIFY.value">{{ $t('workCenter.enterpriseInitChangePlan.revise') }}</a-select-option>
</a-select>
</a-form-model-item>
</div>
<!-- 标准立项-制定 -->
<template v-if="formInline.projectType && formInline.projectType === ProjectType.ENACT.value">
<!-- 企标编号-新企标编号 流程结束才生成企标编号 -->
<!--<div class="box-title-text form-flex-item-half">-->
<!-- <div class="title-text">-->
<!-- &lt;!&ndash;<span class="required">*</span>&ndash;&gt;-->
<!-- <span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.enterpriseStandardNum')">-->
<!-- {{ $t('workCenter.enterpriseInitChangePlan.enterpriseStandardNum') }}-->
<!-- </span>-->
<!-- </div>-->
<!-- <a-form-model-item class="item-model" prop="newEnStandardNo">-->
<!-- <a-input class="box-input"-->
<!-- v-model="formInline.newEnStandardNo"-->
<!-- :maxLength="50"-->
<!-- disabled-->
<!-- @change="event => event.target.value = event.target.value.trim()"-->
<!-- :placeholder="$t('pleaseEnter')+$t('workCenter.enterpriseInitChangePlan.enterpriseStandardNum')" />-->
<!-- </a-form-model-item>-->
<!--</div>-->
<!-- 企标名称-新企标名称 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.enterpriseStandardName')">
{{ $t('workCenter.enterpriseInitChangePlan.enterpriseStandardName') }}
</span>
</div>
<a-form-model-item class="item-model" prop="newEnStandardName">
<a-input class="box-input"
v-model="formInline.newEnStandardName"
:maxLength="200"
:disabled="disabled"
:placeholder="$t('pleaseEnter')+$t('workCenter.enterpriseInitChangePlan.enterpriseStandardName')" />
</a-form-model-item>
</div>
<!-- 企业标准代号 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.enterpriseStandardCode')">
{{ $t('workCenter.enterpriseInitChangePlan.enterpriseStandardCode') }}
</span>
</div>
<a-form-model-item class="item-model" prop="enStandardCode">
<j-dict-select-tag class="box-input"
ref="enStandardCodeRef"
v-model="formInline.enStandardCode"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.enterpriseStandardCode')"
:type="'select'"
:triggerChange="false"
:disabled="disabled"
dictCode="enterprise_standard_code" />
</a-form-model-item>
</div>
<!-- 企业名称代号 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.enterpriseNameCode')">
{{ $t('workCenter.enterpriseInitChangePlan.enterpriseNameCode') }}
</span>
</div>
<a-form-model-item class="item-model" prop="enNameCode">
<j-dict-select-tag class="box-input"
v-model="formInline.enNameCode"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.enterpriseNameCode')"
:type="'select'"
:triggerChange="false"
:disabled="disabled"
dictCode="enterprise_name_code" />
</a-form-model-item>
</div>
<!-- 标准类别代号 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.standardCategoryCode')">
{{ $t('workCenter.enterpriseInitChangePlan.standardCategoryCode') }}
</span>
</div>
<a-form-model-item class="item-model" prop="standardCategoryCode">
<j-dict-select-tag class="box-input"
v-model="formInline.standardCategoryCode"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.standardCategoryCode')"
:type="'select'"
:triggerChange="false"
:disabled="disabled"
dictCode="standard_category_code" />
</a-form-model-item>
</div>
<!-- 年代号 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.yearNumber')">
{{ $t('workCenter.enterpriseInitChangePlan.yearNumber') }}
</span>
</div>
<a-form-model-item class="item-model" prop="decadeCode">
<!--@change="decadeCodeChange"-->
<j-date show-type="year"
v-model="formInline.decadeCode"
:default-value="yearNumberDefaultValue"
date-format="YYYY"
:disabled="disabled"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.yearNumber')" />
</a-form-model-item>
</div>
</template>
<!-- 标准立项-修订 -->
<template v-else-if="formInline.projectType && formInline.projectType === ProjectType.MODIFY.value">
<!-- 企标编号-原企标编号 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.enterpriseStandardNum')">
{{ $t('workCenter.enterpriseInitChangePlan.enterpriseStandardNum') }}
</span>
</div>
<a-form-model-item class="item-model" prop="originEnStandardNo">
<standard-selection :source="StandardSource.ENTERPRISE.value"
:disabledSourceSearch="true"
type="radio"
:selectOnly="true"
:disabled="disabled"
v-model="formInline.originEnStandardNo"
@nameChange="nameChange"/>
</a-form-model-item>
</div>
<!-- 企标名称-原企标名称 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.enterpriseStandardName')">
{{ $t('workCenter.enterpriseInitChangePlan.enterpriseStandardName') }}
</span>
</div>
<a-form-model-item class="item-model" prop="originEnStandardName">
<a-input class="box-input"
v-model="formInline.originEnStandardName"
:maxLength="200"
disabled
:placeholder="$t('pleaseEnter')+$t('workCenter.enterpriseInitChangePlan.enterpriseStandardName')" />
</a-form-model-item>
</div>
<!-- 新企标编号 审批结束后才回显?? -->
<!--<div class="box-title-text form-flex-item-half">-->
<!-- <div class="title-text">-->
<!-- <span class="required">*</span>-->
<!-- <span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.newEnterpriseStandardNum')">-->
<!-- {{ $t('workCenter.enterpriseInitChangePlan.newEnterpriseStandardNum') }}-->
<!-- </span>-->
<!-- </div>-->
<!-- <a-form-model-item class="item-model" prop="newEnStandardNo">-->
<!-- <a-input class="box-input"-->
<!-- v-model="formInline.newEnStandardNo"-->
<!-- :maxLength="50"-->
<!-- disabled-->
<!--@change="event => event.target.value = event.target.value.trim()"-->
<!-- :placeholder="$t('pleaseEnter')+$t('workCenter.enterpriseInitChangePlan.newEnterpriseStandardNum')" />-->
<!-- </a-form-model-item>-->
<!--</div>-->
<!-- 新企标名称 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.newEnterpriseStandardName')">
{{ $t('workCenter.enterpriseInitChangePlan.newEnterpriseStandardName') }}
</span>
</div>
<a-form-model-item class="item-model" prop="newEnStandardName">
<a-input class="box-input"
v-model="formInline.newEnStandardName"
:maxLength="200"
:disabled="disabled"
:placeholder="$t('pleaseEnter')+$t('workCenter.enterpriseInitChangePlan.newEnterpriseStandardName')" />
</a-form-model-item>
</div>
</template>
<!-- 标准英文名称 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.standardEnglishName')">
{{ $t('workCenter.enterpriseInitChangePlan.standardEnglishName') }}
</span>
</div>
<a-form-model-item class="item-model" prop="enStandardEnglishName">
<a-input class="box-input"
v-model="formInline.enStandardEnglishName"
:maxLength="500"
:disabled="disabled"
:placeholder="$t('pleaseEnter')+$t('workCenter.enterpriseInitChangePlan.standardEnglishName')" />
</a-form-model-item>
</div>
<!-- 标准体系 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.standardSystem')">
{{ $t('workCenter.enterpriseInitChangePlan.standardSystem') }}
</span>
</div>
<a-form-model-item class="item-model" prop="enStandardSystem">
<a-tree-select
v-model="formInline.enStandardSystem"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
style="width: 100%"
:tree-data="standardSystemOptions"
tree-checkable
treeCheckStrictly
:label-in-value="false"
:disabled="disabled"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.standardSystem')" />
</a-form-model-item>
</div>
<!-- 标准类型 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.standardType')">
{{ $t('workCenter.enterpriseInitChangePlan.standardType') }}
</span>
</div>
<a-form-model-item class="item-model" prop="standardType">
<j-dict-select-tag class="box-input"
v-model="formInline.standardType"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.standardType')"
:type="'select'"
:triggerChange="false"
:disabled="disabled"
dictCode="esp_standard_type" />
</a-form-model-item>
</div>
<!-- 标准等级分类 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.standardGradeClassification')">
{{ $t('workCenter.enterpriseInitChangePlan.standardGradeClassification') }}
</span>
</div>
<a-form-model-item class="item-model" prop="enStandardClassification">
<j-dict-select-tag class="box-input"
v-model="formInline.enStandardClassification"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.standardGradeClassification')"
:type="'select'"
:triggerChange="false"
:disabled="disabled"
dictCode="standard_grade_classify" />
</a-form-model-item>
</div>
<!-- 编制说明 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.compilationIllustration')">
{{ $t('workCenter.enterpriseInitChangePlan.compilationIllustration') }}
</span>
</div>
<a-form-model-item class="item-model" prop="compilationDescription">
<a-button type="primary" class="button-text" @click="clickButtonToUpload('compilationDescription')">
{{
(formInline.compilationDescription === 'null' || formInline.compilationDescription === ''
|| formInline.compilationDescription === null || formInline.compilationDescription === undefined)
? $t('uploadFile.clickUpload')
: $t('uploadFile.viewUploadedFiles')
}}
</a-button>
</a-form-model-item>
</div>
<!-- 草稿计划完成日期 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text title-text-long">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.draftPlanFinishDate')">
{{ $t('workCenter.enterpriseInitChangePlan.draftPlanFinishDate') }}
</span>
</div>
<a-form-model-item class="item-model" prop="draftPlannedCompleteDate">
<a-date-picker
v-model="formInline.draftPlannedCompleteDate"
:showTime="false"
:disabled="disabled"
value-format="YYYY-MM-DD">
</a-date-picker>
</a-form-model-item>
</div>
<!-- 征求意见稿计划完成日期 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text title-text-long">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.exposureDraftPlanFinishDate')">
{{ $t('workCenter.enterpriseInitChangePlan.exposureDraftPlanFinishDate') }}
</span>
</div>
<a-form-model-item class="item-model" prop="solicitationDraftPlanCompleteDate">
<a-date-picker
v-model="formInline.solicitationDraftPlanCompleteDate"
:showTime="false"
:disabled="disabled"
value-format="YYYY-MM-DD">
</a-date-picker>
</a-form-model-item>
</div>
<!-- 计划报批日期 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text title-text-long">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.planSubmissionDate')">
{{ $t('workCenter.enterpriseInitChangePlan.planSubmissionDate') }}
</span>
</div>
<a-form-model-item class="item-model" prop="planApprovalDate">
<a-date-picker
v-model="formInline.planApprovalDate"
:showTime="false"
:disabled="disabled"
value-format="YYYY-MM-DD">
</a-date-picker>
</a-form-model-item>
</div>
<!-- 隶属工作组 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text title-text-long">
<span class="title-text-text" :title="$t('workCenter.revisionPlanActivelyReport.affiliatedWorkingGroup')">
{{ $t('workCenter.revisionPlanActivelyReport.affiliatedWorkingGroup') }}
</span>
</div>
<a-form-model-item class="item-model" prop="workGroup">
<a-tree-select
tree-node-filter-prop="title"
v-model="formInline.workGroup"
:maxTagCount="1"
:show-search="true"
labelInValue
:getPopupContainer="triggerNode=> triggerNode.parentNode"
style="width: 100%"
:tree-data="workingGroupTreeList"
:disabled="disabled"
:placeholder="$t('pleaseSelect')"
/>
</a-form-model-item>
</div>
</div>
<!-- 适用范围 -->
<div class="header-text">{{ $t('rangeOfApplication') }}</div>
<div class="form-flex-box">
<!-- 零部件分类 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.partName')">
{{ $t('workCenter.enterpriseInitChangePlan.partName') }}
</span>
</div>
<a-form-model-item class="item-model" prop="componentName">
<tree-selection :placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.partName')"
v-model="formInline.componentName"
@nameChange="treeSelectNameChange"
filedName="componentName"
type="checkbox"
:nameStr="formInline.componentName_dictText"
options-href="/laws/standard/partName/"
:disabled="disabled" />
</a-form-model-item>
</div>
<!-- 授权部门 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.authorizationDepart')">
{{ $t('workCenter.enterpriseInitChangePlan.authorizationDepart') }}
</span>
</div>
<a-form-model-item class="item-model" prop="authDept">
<j-select-depart v-model="formInline.authDept"
:disabled="disabled || authDeptDisabled"
@back="authDeptBack"
:select-range="authDeptSelectRange"
:multi="true"
:backDepart="true" />
</a-form-model-item>
</div>
<!-- 主起草人 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.principalDrafter')">
{{ $t('workCenter.enterpriseInitChangePlan.principalDrafter') }}
</span>
</div>
<a-form-model-item class="item-model" prop="mainDraftingUser">
<user-selection :placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.principalDrafter')"
v-model="formInline.mainDraftingUser"
filedName="mainDraftingUser"
@nameChange="userSelectNameChange"
:nameStr="formInline.mainDraftingUser_dictText"
:disabled="disabled"
type="radio" />
</a-form-model-item>
</div>
<!-- 主起草单位 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.mainDraftUnit')">
{{ $t('workCenter.enterpriseInitChangePlan.mainDraftUnit') }}
</span>
</div>
<a-form-model-item class="item-model" prop="mainDraftingUnit">
<j-select-depart v-model="formInline.mainDraftingUnit"
:disabled="disabled"
@back="mainDraftingUnitBack"
:backDepart="true" />
</a-form-model-item>
</div>
<!-- 起草单位负责人 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.headOfMainDraftingUnit')">
{{ $t('workCenter.enterpriseInitChangePlan.headOfMainDraftingUnit') }}
</span>
</div>
<a-form-model-item class="item-model" prop="mainDraftingUnitResponsiblePerson">
<user-selection :placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.headOfMainDraftingUnit')"
v-model="formInline.mainDraftingUnitResponsiblePerson"
filedName="mainDraftingUnitResponsiblePerson"
@nameChange="userSelectNameChange"
:nameStr="formInline.mainDraftingUnitResponsiblePerson_dictText"
:disabled="disabled"
type="radio" />
</a-form-model-item>
</div>
<!-- 标准推进人 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.standardPusher')">
{{ $t('workCenter.enterpriseInitChangePlan.standardPusher') }}
</span>
</div>
<a-form-model-item class="item-model" prop="standardPromoter">
<user-selection :placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.standardPusher')"
v-model="formInline.standardPromoter"
filedName="standardPromoter"
@nameChange="userSelectNameChange"
:nameStr="formInline.standardPromoter_dictText"
:disabled="disabled"
type="radio" />
</a-form-model-item>
</div>
<!-- 配合单位 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.suitUnit')">
{{ $t('workCenter.enterpriseInitChangePlan.suitUnit') }}
</span>
</div>
<a-form-model-item class="item-model" prop="cooperationUnit">
<j-select-depart v-model="formInline.cooperationUnit"
:disabled="disabled"
:multi="true"
@back="cooperationUnitBack"
:backDepart="true" />
</a-form-model-item>
</div>
</div>
</a-form-model>
</a-spin>
</div>
<!-- 查看不显示操作栏 -->
<div v-if="!isLook" class="custom-drawer-style-bottom-btn">
<a-button @click="handleCancel">{{ $t('cancel') }}</a-button>
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{ $t('submit') }}</a-button>
</div>
<!-- 文件上传弹框 -->
<upload-file ref="uploadFile" @change="uploadFileChange" :return-url="false" :disabled="disabled"></upload-file>
</a-drawer>
</template>
<script>
import { StandardSource, ProjectType, ApplicationCategory, StandardGradeClassify } from '@/enums/commonEnums'
import { getWorkGroupTreeList } from '@/api/api'
import UserSelection from '@/components/selection/UserSelection'
import StandardSelection from '@/components/selection/StandardSelection'
import UploadFile from '@/components/UploadFile'
import { getTreeList, getStandardGradeClassification } from '@/api/enterpriseStandardLibraryApi'
import Vue from 'vue'
import { USER_INFO } from '@/store/mutation-types'
// import { getEnStandardNo } from '@/api/workCenter'
import TreeSelection from '@/components/selection/TreeSelection'
export default {
name: 'ContactEnterSendTaskModal',
components: { UserSelection, StandardSelection, UploadFile, TreeSelection },
data () {
return {
StandardSource,
ProjectType,
ApplicationCategory,
workingGroupTreeList: [], // 隶属工作组下拉框数据
standardSystemOptions: [], // 企标体系下拉框数据
visible: false,
confirmLoading: false,
disabled: false,
title: '',
model: {},
formInline: {},
rules: {
// 申请类型
applicationType: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.applicationType') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 项目类别
projectType: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.itemCategory') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 企标编号-新企标编号(制定-企标编号,修订新企标编号)
// newEnStandardNo: [
// {
// required: true,
// message: this.$t('workCenter.enterpriseInitChangePlan.enterpriseStandardNum') + this.$t('cannotEmpty'),
// trigger: 'change'
// }
// ],
// 企标编号-原企标编号(修订-企标编号)
originEnStandardNo: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.enterpriseStandardNum') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 企业标准代号
enStandardCode: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.enterpriseStandardCode') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 标准类别代号
standardCategoryCode: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.standardCategoryCode') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 企标名称-新企标名称(制定-企标名称,修订-新企标名称)
newEnStandardName: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.enterpriseStandardName') + this.$t('cannotEmpty'),
trigger: 'blur'
}
],
// 企业名称代号
enNameCode: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.enterpriseNameCode') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 年代号
decadeCode: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.yearNumber') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 新企标名称
newEnterpriseStandardName: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.newEnterpriseStandardName') + this.$t('cannotEmpty'),
trigger: 'blur'
}
],
// 标准类型
standardType: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.standardType') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 标准体系
enStandardSystem: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.standardSystem') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 草稿计划完成日期
draftPlannedCompleteDate: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.draftPlanFinishDate') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 征求意见稿计划完成日期
solicitationDraftPlanCompleteDate: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.exposureDraftPlanFinishDate') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 计划报批日期
planApprovalDate: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.planSubmissionDate') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 主起草人
mainDraftingUser: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.principalDrafter') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 主起草单位
mainDraftingUnit: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.mainDraftUnit') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 起草单位负责人
mainDraftingUnitResponsiblePerson: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.headOfMainDraftingUnit') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 标准推进人
standardPromoter: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.standardPusher') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 配合单位
cooperationUnit: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.suitUnit') + this.$t('cannotEmpty'),
trigger: 'change'
}
]
},
isLook: false, // 是否是查看
authDeptSelectRange: [], // 授权部门可选项
authDeptDisabled: false, // 授权部门不可修改
isEditSetData: false, // 是否正在初始化数据
oldMainDraftingUnit: '' // 上一次的主起草单位
}
},
computed: {
yearNumberDefaultValue () {
return new Date().getFullYear() + ''
}
},
watch: {
// 标准等级分类改变后授权部门需要自动带出
'formInline.enStandardClassification' (val) {
if (val && !this.isEditSetData) {
if (val === StandardGradeClassify.ZERO_LEVEL.value) {
// 选的是0级,授权部门带出不可编辑
this.formInline.authDept = this.standardGradeClassification.find(item => item.level + '' === '0').deptIds
this.authDeptDisabled = true
} else if (val === StandardGradeClassify.ONE_LEVEL.value) {
// 选的是1级
// 带出主起草单位
this.formInline.authDept = this.formInline.mainDraftingUnit
// 设置可选择项
this.authDeptSelectRange = this.standardGradeClassification.find(item => item.level + '' === '1').deptIds.split(',')
this.formInline = JSON.parse(JSON.stringify(this.formInline))
// 设置授权部门可编辑
this.authDeptDisabled = false
} else if (val === StandardGradeClassify.TWO_LEVEL.value) {
// 选的是2级
// 带出主起草单位
this.formInline.authDept = this.formInline.mainDraftingUnit
// 设置可选择项
this.authDeptSelectRange = this.standardGradeClassification.find(item => item.level + '' === '2').deptIds.split(',')
this.formInline = JSON.parse(JSON.stringify(this.formInline))
// 设置授权部门可编辑
this.authDeptDisabled = false
} else if (val === StandardGradeClassify.THREE_LEVEL.value) {
// 选的是3级,带出主起草单位,不可编辑
this.formInline.authDept = this.formInline.mainDraftingUnit
this.authDeptDisabled = true
}
} else if (val && this.isEditSetData) {
// 使用定时器是因为有可能授权部门组件还没有获取完部门列表
setTimeout(() => {
if (val === StandardGradeClassify.ZERO_LEVEL.value) {
// 选的是0级,授权部门带出不可编辑
this.authDeptDisabled = true
} else if (val === StandardGradeClassify.ONE_LEVEL.value) {
// 选的是1级
// 设置可选择项
this.authDeptSelectRange = this.standardGradeClassification.find(item => item.level + '' === '1').deptIds.split(',')
// 设置授权部门可编辑
this.authDeptDisabled = false
} else if (val === StandardGradeClassify.TWO_LEVEL.value) {
// 选的是2级
// 设置可选择项
this.authDeptSelectRange = this.standardGradeClassification.find(item => item.level + '' === '2').deptIds.split(',')
// 设置授权部门可编辑
this.authDeptDisabled = false
} else if (val === StandardGradeClassify.THREE_LEVEL.value) {
// 选的是3级,授权部门带出不可编辑
this.authDeptDisabled = true
}
}, 500)
} else if (!val) {
// 清空授权部门的可选项
this.authDeptSelectRange = []
// 设置授权部门可编辑
this.authDeptDisabled = false
// 清空授权部门
this.formInline.authDept = ''
}
},
// 主起草单位改变后,需要将选中的主起草单位增加到授权部门
'formInline.mainDraftingUnit' (val) {
if (val && !this.isEditSetData) {
if (this.formInline.enStandardClassification === StandardGradeClassify.ONE_LEVEL.value ||
this.formInline.enStandardClassification === StandardGradeClassify.TWO_LEVEL.value) {
// 标准等级分类是1级或者2级需要,把主起草单位追加到授权部门
let authDeptArr = (this.formInline.authDept || '').split(',')
// 把旧的主起草部门刨出去,否则每换一次企标编号都会把其主起草单位累计
authDeptArr = authDeptArr.filter(item => item !== this.oldMainDraftingUnit)
authDeptArr.push(val)
this.formInline.authDept = authDeptArr.join(',')
} else if (this.formInline.enStandardClassification === StandardGradeClassify.THREE_LEVEL.value) {
// 标准等级分类是3级,把授权部门替换成主起草单位
this.formInline.authDept = val
}
this.oldMainDraftingUnit = val
}
}
// // 企业标准代号
// 'formInline.enStandardCode' (value) {
// this.getEnStandardNo()
// },
// // 企业名称代号
// 'formInline.enNameCode' (value) {
// this.getEnStandardNo()
// },
// // 标准类别代号
// 'formInline.standardCategoryCode' (value) {
// this.getEnStandardNo()
// }
},
created () {
// 获取企标级别映射数据
this.getStandardGradeClassification()
},
mounted () {
this.getWorkGroupTree()
this.initStandardSystemOptions()
},
methods: {
add () {
const userInfo = Vue.ls.get(USER_INFO)
const formInline = {}
// 初始化主起草人信息
formInline.mainDraftingUser = userInfo.id
formInline.mainDraftingUser_dictText = userInfo.realname + '(' + userInfo.username + ')'
// 初始化主起草单位信息,需要翻译当前登录用户的部门,因为表格回显
if (userInfo.departIds && userInfo.departIds.split(',').length === 1) {
formInline.mainDraftingUnit = userInfo.departIds
formInline.mainDraftingUnit_dictText = userInfo.departIds_dictText
}
// 初始化起草单位负责人 todo: 看怎么获取当前登录人的上级
// 初始化年代号
formInline.decadeCode = new Date().getFullYear() + ''
this.edit(formInline)
},
edit (record) {
this.visible = true
this.isEditSetData = true
this.model = Object.assign({}, record)
const formInline = Object.assign({}, record)
// 设置上一次主起草单位,留存记录
this.oldMainDraftingUnit = formInline.mainDraftingUnit
// 没有年代号就设置为当前年份
// if (!formInline.decadeCode) {
// formInline.decadeCode = new Date().getFullYear() + ''
// }
// 处理隶属工作组格式
if (formInline.workGroup) {
formInline.workGroup = { value: formInline.workGroup, label: formInline.workGroup_dictText }
}
// 没有申请类型就设置为立项
if (!formInline.applicationType) {
formInline.applicationType = this.ApplicationCategory.INITIATION.value
}
// 处理标准体系数据格式
formInline.enStandardSystem = formInline.enStandardSystem ? formInline.enStandardSystem.split(',').map(item => {
return { value: item }
}) : []
this.formInline = Object.assign({}, formInline)
setTimeout(() => {
this.isEditSetData = false
}, 500)
},
look (record) {
this.isEditSetData = true
this.visible = true
this.isLook = true
this.model = Object.assign({}, record)
this.formInline = Object.assign({}, record)
// 没有申请类型就设置为立项
if (!this.formInline.applicationType) {
this.formInline.applicationType = this.ApplicationCategory.INITIATION.value
}
if (this.formInline.workGroup) {
this.formInline.workGroup = { value: this.formInline.workGroup, label: this.formInline.workGroup_dictText }
}
this.formInline.enStandardSystem = this.formInline.enStandardSystem ? this.formInline.enStandardSystem.split(',').map(item => {
return { value: item }
}) : []
this.disabled = true
setTimeout(() => {
this.isEditSetData = false
}, 500)
},
// watch监视年代号会滞后
// decadeCodeChange (value) {
// this.getEnStandardNo()
// },
// 根据三个代号和一个年代号获取企标编号
// getEnStandardNo () {
// // 如果是制定根据填的三个代号和一个年代号获取
// if (this.formInline.projectType === ProjectType.ENACT.value) {
// if (!this.formInline.enStandardCode || !this.formInline.enNameCode ||
// !this.formInline.standardCategoryCode || !this.formInline.decadeCode) {
// return
// }
// const param = {}
// param.enStandardCode = this.formInline.enStandardCode
// param.enNameCode = this.formInline.enNameCode
// param.standardCategoryCode = this.formInline.standardCategoryCode
// param.decadeCode = this.formInline.decadeCode
// getEnStandardNo(param).then(res => {
// if (res.success) {
// this.$set(this.formInline, 'newEnStandardNo', res.message)
// this.$forceUpdate()
// }
// })
// } else {
// // 是修订,通过选中的企标编号和年代号拼接新企标编号
// if (this.formInline.originEnStandardNo && this.formInline.decadeCode) {
// const standardNo = this.formInline.originEnStandardNo.split('-')[0] + '-' + this.formInline.decadeCode
// this.$set(this.formInline, 'newEnStandardNo', standardNo)
// this.$forceUpdate()
// // 返回流程名称
// this.returnProcessName()
// }
// }
// },
// 获取企标级别映射数据
getStandardGradeClassification () {
getStandardGradeClassification().then(res => {
if (res.success) {
this.standardGradeClassification = res.result
}
})
},
// 获取标准体系下拉框数据
initStandardSystemOptions () {
getTreeList({ option: 1 }).then(res => {
if (res.success) {
this.standardSystemOptions = res.result
}
})
},
// 获取内部工作组树
getWorkGroupTree () {
getWorkGroupTreeList().then((res) => {
if (res.success) {
this.workingGroupTreeList = this.dealTreeData(res.result)
} else {
this.workingGroupTreeList = []
}
})
},
// 处理内部工作组数据结构
dealTreeData (treeData) {
return treeData.map(item => {
item.label = item.name
item.value = item.id
item.children = this.dealTreeData(item.subset)
return item
})
},
// 零部件分类选择完成的回调
treeSelectNameChange (value, fieldName) {
this.formInline[fieldName + '_dictText'] = value
},
// 授权部门返回参数
authDeptBack (value) {
this.formInline.authDept_dictText = value.map(item => item.text).join(',')
},
// 主起草单位返回参数
mainDraftingUnitBack (value) {
this.formInline.mainDraftingUnit_dictText = value.map(item => item.text).join(',')
},
// 配合单位返回参数
cooperationUnitBack (value) {
this.formInline.cooperationUnit_dictText = value.map(item => item.text).join(',')
},
// 标准选择组件返回标准名称的回调
nameChange (value) {
this.formInline.originEnStandardName = value
},
// 项目类别改变
projectTypeChange (value) {
console.log(value)
this.formInline.decadeCode = new Date().getFullYear() + ''
if (value && value === ProjectType.ENACT.value) {
// 是制定,原企标编号和原企标名称置空
this.formInline.originEnStandardNo = ''
this.formInline.originEnStandardName = ''
this.formInline = Object.assign({}, this.formInline)
} else if (value && value === ProjectType.MODIFY.value) {
// 是修订,三个代号置空
this.formInline.enStandardCode = undefined
this.formInline.enNameCode = undefined
this.formInline.standardCategoryCode = undefined
this.formInline = Object.assign({}, this.formInline)
}
},
// 选择用户得到用户名
userSelectNameChange (value, fieldName) {
this.formInline[fieldName + '_dictText'] = value
},
// 点击文件上传
clickButtonToUpload (fieldName) {
this.$refs.uploadFile.open(this.formInline[fieldName])
this.uploadName = fieldName
},
// 文件上传改变后的回调
uploadFileChange (data) {
const attIdList = []
if (data && data.length > 0) {
data.map(item => {
attIdList.push(item.id)
})
}
/** 赋值给当前对应的表单文件 */
this.formInline[this.uploadName] = attIdList.join(',')
this.formInline = { ...this.formInline }
},
// 取消
handleCancel () {
this.close()
},
close () {
this.model = {}
this.formInline = {}
this.visible = false
this.isLook = false
this.$refs.ruleForm.clearValidate()
},
// 提交
handleSubmit () {
if (this.confirmLoading) return
this.$refs.ruleForm.validate(valid => {
if (valid) {
this.confirmLoading = true
const formInline = JSON.parse(JSON.stringify(this.formInline))
if (formInline.projectType) {
// 翻译项目类别
formInline.projectType_dictText = formInline.projectType === ProjectType.ENACT.value ? ProjectType.ENACT.text : ProjectType.MODIFY.text
// 设置变更状态
formInline.changeStatus = 1
formInline.changeStatus_dictText = '新增'
}
console.log(1)
// 翻译隶属工作组
if (formInline.workGroup) {
formInline.workGroup_dictText = formInline.workGroup.label
formInline.workGroup = formInline.workGroup.value
}
console.log(2)
// 翻译企业标准代号
if (formInline.enStandardCode) {
formInline.enStandardCode_dictText = this.$refs.enStandardCodeRef.dictOptions.find(item => item.value === formInline.enStandardCode).text
}
console.log(3)
// 处理标准体系
if (formInline.enStandardSystem && formInline.enStandardSystem.length > 0) {
formInline.enStandardSystem = formInline.enStandardSystem.map(item => item.value).join(',')
} else {
formInline.enStandardSystem = ''
}
console.log(4)
// 设置创建人
const currentUser = Vue.ls.get(USER_INFO)
formInline.contactUser_dictText = currentUser.realname + '(' + currentUser.username + ')'
// 主起草单位如果没有翻译字段,说明就是当前登录人没有重新选
if (!formInline.mainDraftingUnit_dictText) {
formInline.mainDraftingUnit_dictText = currentUser.departIds_dicText
}
console.log(formInline)
this.$emit('ok', formInline)
this.close()
this.confirmLoading = false
}
})
}
}
}
</script>
<style scoped lang="less">
/deep/ .ant-form-item-children {
width: 100%;
display: inline-block;
}
.form-flex-box {
display: flex;
flex-wrap: wrap;
}
.form-flex-item-half {
width: 50%;
}
.form-flex-item-line {
width: 100%;
}
.form-flex-item-long {
width: 100%;
}
.title-text {
width: 200px;
}
/deep/ .ant-form-item-children > * {
width: 100% !important;
}
</style>