[update] 画年度制修订计划(标准化发起)

This commit is contained in:
lideqin
2023-10-18 18:19:44 +08:00
parent 447fe783f9
commit 7bba0b1bb6
26 changed files with 2615 additions and 693 deletions
@@ -0,0 +1,887 @@
<template>
<a-drawer
:title="$t('standardSelect.standardSelection')"
: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 v-if="rules.applicationType[0].required" 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"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.applicationType')">
<a-select-option :value="1">{{ $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 v-if="rules.itemCategory[0].required" 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="itemCategory">
<a-select v-model="formInline.itemCategory"
@change="itemCategoryChange"
:disabled="disabled"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.itemCategory')">
<a-select-option :value="1">{{ $t('workCenter.enterpriseInitChangePlan.formulate') }}</a-select-option>
<a-select-option :value="2">{{ $t('workCenter.enterpriseInitChangePlan.revise') }}</a-select-option>
</a-select>
</a-form-model-item>
</div>
<!-- 标准立项-制定 -->
<template v-if="formInline.itemCategory && formInline.itemCategory === 1">
<!-- 企标编号 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span v-if="rules.enterpriseStandardNum[0].required" 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="enterpriseStandardNum">
<a-input class="box-input"
v-model="formInline.enterpriseStandardNum"
:maxLength="50"
disabled
: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 v-if="rules.enterpriseStandardName[0].required" 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="enterpriseStandardName">
<a-input class="box-input"
v-model="formInline.enterpriseStandardName"
:maxLength="50"
: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 v-if="rules.enterpriseStandardCode[0].required" 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="enterpriseStandardCode">
<j-dict-select-tag class="box-input"
v-model="formInline.enterpriseStandardCode"
: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 v-if="rules.enterpriseNameCode[0].required" 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="enterpriseNameCode">
<j-dict-select-tag class="box-input"
v-model="formInline.enterpriseNameCode"
: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 v-if="rules.standardCategoryCode[0].required" 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 v-if="rules.yearNumber[0].required" 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="yearNumber">
<j-date show-type="year"
v-model="formInline.yearNumber"
: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.itemCategory && formInline.itemCategory === 2">
<!-- 企标编号 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.enterpriseStandardNum')">
{{ $t('workCenter.enterpriseInitChangePlan.enterpriseStandardNum') }}
</span>
</div>
<a-form-model-item class="item-model" prop="enterpriseStandardNum">
<standard-selection :source="StandardSource.ENTERPRISE.value"
:disabledSourceSearch="true"
type="radio"
:disabled="disabled"
v-model="formInline.enterpriseStandardNum"
@nameChange="nameChange"/>
</a-form-model-item>
</div>
<!-- 企标名称 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text">
<span v-if="rules.enterpriseStandardName[0].required" 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="enterpriseStandardName">
<a-input class="box-input"
v-model="formInline.enterpriseStandardName"
:maxLength="50"
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="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.newEnterpriseStandardNum')">
{{ $t('workCenter.enterpriseInitChangePlan.newEnterpriseStandardNum') }}
</span>
</div>
<a-form-model-item class="item-model" prop="newEnterpriseStandardNum">
<a-input class="box-input"
v-model="formInline.newEnterpriseStandardNum"
:maxLength="50"
disabled
: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 v-if="rules.newEnterpriseStandardName[0].required" 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="newEnterpriseStandardName">
<a-input class="box-input"
v-model="formInline.newEnterpriseStandardName"
:maxLength="50"
: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="standardEnglishName">
<a-input class="box-input"
v-model="formInline.standardEnglishName"
:maxLength="50"
: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 v-if="rules.standardSystem[0].required" 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="standardSystem">
<a-tree-select
v-model="formInline.standardSystem"
: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 v-if="rules.standardType[0].required" 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 v-if="rules.standardGradeClassification[0].required" class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.standardGradeClassification')">
{{ $t('workCenter.enterpriseInitChangePlan.standardGradeClassification') }}
</span>
</div>
<a-form-model-item class="item-model" prop="standardGradeClassification">
<j-dict-select-tag class="box-input"
v-model="formInline.standardGradeClassification"
: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="compilationIllustration">
<a-button type="primary" class="button-text" @click="clickButtonToUpload('compilationIllustration')">
{{
(formInline.compilationIllustration === 'null' || formInline.compilationIllustration === ''
|| formInline.compilationIllustration === null || formInline.compilationIllustration === undefined)
? $t('uploadFile.clickUpload')
: $t('uploadFile.viewUploadedFiles')
}}
</a-button>
</a-form-model-item>
</div>
<!-- 3个日期如果标准化填写了主起草人不能修改标准化未填写联络人必填 -->
<!-- 草稿计划完成日期 -->
<div class="box-title-text form-flex-item-half">
<div class="title-text title-text-long">
<span v-if="rules.draftPlanFinishDate[0].required" 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="draftPlanFinishDate">
<a-date-picker
v-model="formInline.draftPlanFinishDate"
:showTime="false"
:disabled="editRole === 'contact' ? draftPlanFinishDateDisabled : (disabled || draftPlanFinishDateDisabled)"
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 v-if="rules.exposureDraftPlanFinishDate[0].required" 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="exposureDraftPlanFinishDate">
<a-date-picker
v-model="formInline.exposureDraftPlanFinishDate"
:showTime="false"
:disabled="editRole === 'contact' ? exposureDraftPlanFinishDateDisabled : (disabled || exposureDraftPlanFinishDateDisabled)"
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 v-if="rules.planSubmissionDate[0].required" 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="planSubmissionDate">
<a-date-picker
v-model="formInline.planSubmissionDate"
:showTime="false"
:disabled="editRole === 'contact' ? planSubmissionDateDisabled : (disabled || planSubmissionDateDisabled)"
value-format="YYYY-MM-DD">
</a-date-picker>
</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="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.partName')">
{{ $t('workCenter.enterpriseInitChangePlan.partName') }}
</span>
</div>
<a-form-model-item class="item-model" prop="partName">
<a-tree-select v-model="formInline.partName"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
style="width: 100%"
:tree-data="partNameOptions"
:label-in-value="false"
:disabled="disabled"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.partName')" />
</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.authorizationDepart')">
{{ $t('workCenter.enterpriseInitChangePlan.authorizationDepart') }}
</span>
</div>
<a-form-model-item class="item-model" prop="authorizationDepart">
<j-select-depart v-model="formInline.authorizationDepart"
:disabled="disabled"
: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="principalDrafter">
<user-selection :placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.principalDrafter')"
v-model="formInline.principalDrafter"
filedName="principalDrafter"
@nameChange="userSelectNameChange"
:nameStr="formInline.principalDrafter_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="mainDraftUnit">
<j-select-depart v-model="formInline.mainDraftUnit"
:disabled="disabled"
: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="headOfMainDraftingUnit">
<user-selection :placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.headOfMainDraftingUnit')"
v-model="formInline.headOfMainDraftingUnit"
filedName="headOfMainDraftingUnit"
@nameChange="userSelectNameChange"
:nameStr="formInline.headOfMainDraftingUnit_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="standardPusher">
<user-selection :placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.standardPusher')"
v-model="formInline.standardPusher"
filedName="standardPusher"
@nameChange="userSelectNameChange"
:nameStr="formInline.standardPusher_dictText"
:disabled="disabled"
type="radio" />
</a-form-model-item>
</div>
</div>
</a-form-model>
</a-spin>
</div>
<div 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 } from '@/enums/commonEnums'
import { getFormDictTreeList } from '@/api/api'
import UserSelection from '@/components/selection/UserSelection'
import StandardSelection from '@/components/selection/StandardSelection'
import UploadFile from '@/components/UploadFile'
import { getTreeList } from '@/api/enterpriseStandardLibraryApi'
import Vue from 'vue'
import { USER_INFO } from '@/store/mutation-types'
export default {
name: 'BaseInfoTableModal',
components: { UserSelection, StandardSelection, UploadFile },
props: {
/**
* 编辑角色,是主起草人的话三个日期标准化填了的,主起草人不能修改;是联络人的话标准化未填写,联络人必填
* drafter: 主起草人
* contact: 联络人
*/
editRole: {
type: String,
required: false,
default: ''
},
/**
* 来源:是tableBaseInfo的话必填项不一样
*/
source: {
type: String,
required: false,
default: ''
}
},
data () {
return {
StandardSource,
ProjectType,
partNameOptions: [], // 零部件名称下拉框数据
standardSystemOptions: [], // 企标体系下拉框数据
visible: false,
confirmLoading: false,
disabled: false,
draftPlanFinishDateDisabled: false, // 草稿计划完成日期是否不可修改
exposureDraftPlanFinishDateDisabled: false, // 征求意见稿计划完成日期是否不可修改
planSubmissionDateDisabled: false, // 计划报批日期是否不可修改
model: {},
formInline: {},
rules: {
// 申请类型
applicationType: [
{
required: false,
message: this.$t('workCenter.enterpriseInitChangePlan.applicationType') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 项目类别
itemCategory: [
{
required: false,
message: this.$t('workCenter.enterpriseInitChangePlan.itemCategory') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 企标编号
enterpriseStandardNum: [
{
required: false,
message: this.$t('workCenter.enterpriseInitChangePlan.enterpriseStandardNum') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 企业标准代号
enterpriseStandardCode: [
{
required: false,
message: this.$t('workCenter.enterpriseInitChangePlan.enterpriseStandardCode') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 标准类别代号
standardCategoryCode: [
{
required: false,
message: this.$t('workCenter.enterpriseInitChangePlan.standardCategoryCode') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 企标名称
enterpriseStandardName: [
{
required: false,
message: this.$t('workCenter.enterpriseInitChangePlan.enterpriseStandardName') + this.$t('cannotEmpty'),
trigger: 'blur'
}
],
// 企业名称代号
enterpriseNameCode: [
{
required: false,
message: this.$t('workCenter.enterpriseInitChangePlan.enterpriseNameCode') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 年代号
yearNumber: [
{
required: false,
message: this.$t('workCenter.enterpriseInitChangePlan.yearNumber') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 新企标名称
newEnterpriseStandardName: [
{
required: false,
message: this.$t('workCenter.enterpriseInitChangePlan.newEnterpriseStandardName') + this.$t('cannotEmpty'),
trigger: 'blur'
}
],
// 标准类型
standardType: [
{
required: false,
message: this.$t('workCenter.enterpriseInitChangePlan.standardType') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 标准体系
standardSystem: [
{
required: false,
message: this.$t('workCenter.enterpriseInitChangePlan.standardSystem') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 标准等级分类
standardGradeClassification: [
{
required: false,
message: this.$t('workCenter.enterpriseInitChangePlan.standardGradeClassification') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 草稿计划完成日期
draftPlanFinishDate: [
{
required: false,
message: this.$t('workCenter.enterpriseInitChangePlan.draftPlanFinishDate') + this.$t('cannotEmpty'),
trigger: ['change', 'blur']
}
],
// 征求意见稿计划完成日期
exposureDraftPlanFinishDate: [
{
required: false,
message: this.$t('workCenter.enterpriseInitChangePlan.exposureDraftPlanFinishDate') + this.$t('cannotEmpty'),
trigger: ['change', 'blur']
}
],
// 计划报批日期
planSubmissionDate: [
{
required: false,
message: this.$t('workCenter.enterpriseInitChangePlan.planSubmissionDate') + this.$t('cannotEmpty'),
trigger: ['change', 'blur']
}
],
// 零部件名称
partName: [
{
required: false,
message: this.$t('workCenter.enterpriseInitChangePlan.partName') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 授权部门
authorizationDepart: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.authorizationDepart') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 主起草人
principalDrafter: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.principalDrafter') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 主起草单位
mainDraftUnit: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.mainDraftUnit') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 起草单位负责人
headOfMainDraftingUnit: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.headOfMainDraftingUnit') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 标准推进人
standardPusher: [
{
required: true,
message: this.$t('workCenter.enterpriseInitChangePlan.standardPusher') + this.$t('cannotEmpty'),
trigger: 'change'
}
]
}
}
},
computed: {
yearNumberDefaultValue () {
return new Date().getFullYear() + ''
}
},
mounted () {
this.initPartNameOptions()
this.initStandardSystemOptions()
if (this.source === 'tableBaseInfo') {
for (const item of Object.values(this.rules)) {
item[0].required = true
}
this.rules = Object.assign({}, this.rules)
console.log(this.rules)
}
},
methods: {
add () {
const userInfo = Vue.ls.get(USER_INFO)
const formInline = {}
// 初始化主起草人信息
formInline.principalDrafter = userInfo.id
formInline.principalDrafter_dictText = userInfo.realname
// 初始化主起草单位信息
formInline.mainDraftUnit = userInfo.departIds
// 初始化起草单位负责人 todo: 看怎么获取当前登录人的上级
// 初始化年代号
formInline.yearNumber = new Date().getFullYear() + ''
this.edit(formInline)
},
edit (record) {
this.visible = true
this.model = Object.assign({}, record)
this.formInline = Object.assign({}, record)
// 三个日期,如果标准化填写了,主起草人不能修改,标准化未填写,联络人必填
if (this.editRole === 'drafter') {
// 是主起草人的编辑
// 草稿计划完成日期的处理
if (this.formInline.draftPlanFinishDate) {
// 草稿计划完成日期已经填写了, 主起草人不能修改
this.draftPlanFinishDateDisabled = true
}
// 征求意见稿计划完成日期
if (this.formInline.exposureDraftPlanFinishDate) {
// 征求意见稿计划完成日期已经填写了, 主起草人不能修改
this.exposureDraftPlanFinishDateDisabled = true
}
// 计划报批日期
if (this.formInline.planSubmissionDate) {
// 计划报批日期已经填写了, 主起草人不能修改
this.planSubmissionDateDisabled = true
}
} else if (this.editRole === 'contact') {
// 是联络人的编辑,只能编辑3个日期,如果标准化填过了不能修改,未填的话必填
this.disabled = true
// 草稿计划完成日期的处理
if (!this.formInline.draftPlanFinishDate) {
// 草稿计划完成日期没有填写, 联络人必填
this.rules.draftPlanFinishDate[0].required = true
} else {
// 填写了,不能修改
this.draftPlanFinishDateDisabled = true
}
// 征求意见稿计划完成日期
if (!this.formInline.exposureDraftPlanFinishDate) {
// 征求意见稿计划完成日期没有填写, 联络人必填
this.rules.exposureDraftPlanFinishDate[0].required = true
} else {
// 填写了,不能修改
this.exposureDraftPlanFinishDateDisabled = true
}
// 计划报批日期
if (!this.formInline.planSubmissionDate) {
// 计划报批日期没有填写, 联络人必填
this.rules.planSubmissionDate[0].required = true
} else {
// 填写了,不能修改
this.planSubmissionDateDisabled = true
}
}
},
look (record) {
this.visible = true
this.model = Object.assign({}, record)
this.formInline = Object.assign({}, record)
this.disabled = true
},
// 获取零部件名称下拉框数据
initPartNameOptions () {
getFormDictTreeList({ dictId: '1696821512600637441' }).then(res => {
if (res.success) {
this.partNameOptions = res.result
}
})
},
// 获取标准体系下拉框数据
initStandardSystemOptions () {
getTreeList({ option: 1 }).then(res => {
if (res.success) {
this.standardSystemOptions = res.result
}
})
},
// 标准选择组件返回标准名称的回调
nameChange (value) {
this.formInline.enterpriseStandardName = value
},
// 项目类别改变
itemCategoryChange (value) {
if (value === this.ProjectType.ENACT.value) {
// 是制定
this.formInline.decadeCode = new Date().getFullYear() + ''
}
},
// 选择用户得到用户名
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.$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))
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%;
}
</style>