265 lines
11 KiB
Vue
265 lines
11 KiB
Vue
<template>
|
|
<a-spin :spinning="loading">
|
|
<a-form-model :model="formInline" :rules="rules" ref="ruleForm">
|
|
<div class="form-flex-box">
|
|
<!-- 企标编号 -->
|
|
<div class="box-title-text form-flex-item">
|
|
<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="standardNumber">
|
|
<standard-selection :source="StandardSource.ENTERPRISE.value"
|
|
:placeholder="$t('pleaseSelect') + $t('workCenter.enterpriseInitChangePlan.enterpriseStandardNum')"
|
|
:disabled="disabled"
|
|
:disabledSourceSearch="true"
|
|
type="radio"
|
|
:selectOnly="true"
|
|
:filters="{standardState: '1,2,3,4,5,6,7,8'}"
|
|
v-model="formInline.standardNumber"
|
|
@listChange="listChange" />
|
|
</a-form-model-item>
|
|
</div>
|
|
<!-- 企标名称 -->
|
|
<div class="box-title-text form-flex-item">
|
|
<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="standardName">
|
|
<a-input class="box-input"
|
|
v-model="formInline.standardName"
|
|
:maxLength="200"
|
|
disabled
|
|
:placeholder="$t('pleaseEnter')+$t('workCenter.enterpriseInitChangePlan.enterpriseStandardName')" />
|
|
</a-form-model-item>
|
|
</div>
|
|
<!-- 标准英文名称 -->
|
|
<div class="box-title-text form-flex-item">
|
|
<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="englishName">
|
|
<a-input class="box-input"
|
|
disabled
|
|
v-model="formInline.englishName"
|
|
:maxLength="500"
|
|
:placeholder="isGetDataAfter ? '' : $t('pleaseEnter')+$t('workCenter.enterpriseInitChangePlan.standardEnglishName')" />
|
|
</a-form-model-item>
|
|
</div>
|
|
<!-- 标准类型 -->
|
|
<div class="box-title-text form-flex-item">
|
|
<div class="title-text">
|
|
<span class="title-text-text" :title="$t('workCenter.enterpriseInitChangePlan.standardType')">
|
|
{{ $t('workCenter.enterpriseInitChangePlan.standardType') }}
|
|
</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" prop="standardCategory">
|
|
<j-dict-select-tag class="box-input"
|
|
disabled
|
|
v-model="formInline.standardCategory"
|
|
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.standardType')"
|
|
:type="'select'"
|
|
:triggerChange="false"
|
|
dictCode="esp_standard_type" />
|
|
</a-form-model-item>
|
|
</div>
|
|
<!-- 代替企标编号 -->
|
|
<div class="box-title-text form-flex-item">
|
|
<div class="title-text">
|
|
<span class="title-text-text" :title="$t('workCenter.enStandardAnnul.substituteStandardNumber')">
|
|
{{ $t('workCenter.enStandardAnnul.substituteStandardNumber') }}
|
|
</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" prop="substituteStandardNumber">
|
|
<a-input class="box-input"
|
|
disabled
|
|
v-model="formInline.substituteStandardNumber"
|
|
:maxLength="50"
|
|
:placeholder="isGetDataAfter ? '' : $t('pleaseEnter')+$t('workCenter.enStandardAnnul.substituteStandardNumber')" />
|
|
</a-form-model-item>
|
|
</div>
|
|
<!-- 被代替企标编号 -->
|
|
<div class="box-title-text form-flex-item">
|
|
<div class="title-text">
|
|
<span class="title-text-text" :title="$t('workCenter.enStandardAnnul.replacedByEnStandardNumber')">
|
|
{{ $t('workCenter.enStandardAnnul.replacedByEnStandardNumber') }}
|
|
</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" prop="replacedByStandardNumber">
|
|
<a-input class="box-input"
|
|
disabled
|
|
v-model="formInline.replacedByStandardNumber"
|
|
:maxLength="50"
|
|
:placeholder="isGetDataAfter ? '' : $t('pleaseEnter')+$t('workCenter.enStandardAnnul.replacedByEnStandardNumber')" />
|
|
</a-form-model-item>
|
|
</div>
|
|
<!-- 发布日期 -->
|
|
<div class="box-title-text form-flex-item">
|
|
<div class="title-text">
|
|
<span class="title-text-text" :title="$t('workCenter.enStandardChange.releaseDate')">
|
|
{{ $t('workCenter.enStandardChange.releaseDate') }}
|
|
</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" prop="releaseDate">
|
|
<a-date-picker
|
|
v-model="formInline.releaseDate"
|
|
:placeholder="isGetDataAfter ? '' : $t('pleaseSelectDate')"
|
|
:showTime="false"
|
|
disabled
|
|
value-format="YYYY-MM-DD">
|
|
</a-date-picker>
|
|
</a-form-model-item>
|
|
</div>
|
|
<!-- 实施日期 -->
|
|
<div class="box-title-text form-flex-item">
|
|
<div class="title-text">
|
|
<span class="title-text-text" :title="$t('workCenter.enStandardChange.materialDate')">
|
|
{{ $t('workCenter.enStandardChange.materialDate') }}
|
|
</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" prop="implementationDate">
|
|
<a-date-picker
|
|
v-model="formInline.implementationDate"
|
|
:placeholder="isGetDataAfter ? '' : $t('pleaseSelectDate')"
|
|
:showTime="false"
|
|
disabled
|
|
value-format="YYYY-MM-DD">
|
|
</a-date-picker>
|
|
</a-form-model-item>
|
|
</div>
|
|
<!-- 封存理由 -->
|
|
<div class="box-title-text form-flex-item">
|
|
<div class="title-text">
|
|
<span class="required">*</span>
|
|
<span class="title-text-text" :title="$t('workCenter.enStandardSealSave.sealSaveReason')">
|
|
{{ $t('workCenter.enStandardSealSave.sealSaveReason') }}
|
|
</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" prop="archiveReason">
|
|
<a-textarea :placeholder="$t('pleaseEnter')+$t('workCenter.enStandardSealSave.sealSaveReason')"
|
|
:disabled="disabled"
|
|
:maxLength="500"
|
|
v-model="formInline.archiveReason" :rows="4" />
|
|
</a-form-model-item>
|
|
</div>
|
|
</div>
|
|
</a-form-model>
|
|
</a-spin>
|
|
</template>
|
|
|
|
<script>
|
|
import { StandardSource } from '@/enums/commonEnums'
|
|
import StandardSelection from '@/components/selection/StandardSelection'
|
|
import { getEnterpriseStandardInfoById } from '@/api/enterpriseStandardLibraryApi'
|
|
import { getStandardTypeByNum } from '@/api/workCenter'
|
|
|
|
export default {
|
|
name: 'BaseInfoForm',
|
|
components: { StandardSelection },
|
|
props: {
|
|
disabled: {
|
|
type: Boolean,
|
|
required: false,
|
|
default: false
|
|
}
|
|
},
|
|
data () {
|
|
return {
|
|
StandardSource,
|
|
loading: false,
|
|
formInline: {},
|
|
rules: {
|
|
// 企标编号
|
|
standardNumber: [
|
|
{
|
|
required: true,
|
|
message: this.$t('workCenter.enterpriseInitChangePlan.enterpriseStandardNum') + this.$t('cannotEmpty'),
|
|
trigger: 'change'
|
|
}
|
|
],
|
|
// 封存理由
|
|
archiveReason: [
|
|
{
|
|
required: true,
|
|
message: this.$t('workCenter.enStandardSealSave.sealSaveReason') + this.$t('cannotEmpty'),
|
|
trigger: 'blur'
|
|
}
|
|
]
|
|
},
|
|
isGetDataAfter: false // 是否获取完数据了,获取完数据有的字段不显示placeholder
|
|
}
|
|
},
|
|
methods: {
|
|
// 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了
|
|
initData (data) {
|
|
// 给表单赋值
|
|
this.formInline = Object.assign({}, data)
|
|
this.isGetDataAfter = true
|
|
},
|
|
// 外层要获取数据
|
|
getData () {
|
|
// 把数据抛出,在线编辑不知道要不要抛
|
|
const data = {}
|
|
data.formInline = this.formInline
|
|
return data
|
|
},
|
|
// 外层获取数据要过校验,返回false表示没有通过校验
|
|
async getDataValidate () {
|
|
let data = {}
|
|
await this.$refs.ruleForm.validate(valid => {
|
|
if (valid) {
|
|
data.formInline = this.formInline
|
|
} else {
|
|
data = false
|
|
}
|
|
})
|
|
return data
|
|
},
|
|
// 选完企标编号了,需要回显内容,返回流程名称
|
|
listChange (value) {
|
|
console.log(value)
|
|
this.loading = true
|
|
// 企标名称
|
|
this.formInline.standardName = value[0].standardName
|
|
// 根据返回的id查询企标数据
|
|
getEnterpriseStandardInfoById({ id: value[0].id, type: '2' }).then(async res => {
|
|
if (res.success) {
|
|
const result = res.result
|
|
// 标准英文名称
|
|
this.formInline.englishName = result.standard_english_name
|
|
// 代替企标编号
|
|
this.formInline.substituteStandardNumber = result.substitute_standard_number
|
|
// 被代替企标编号
|
|
this.formInline.replacedByStandardNumber = result.replaced_by_standard_number
|
|
// 发布日期
|
|
this.formInline.releaseDate = result.release_date
|
|
// 实施日期
|
|
this.formInline.implementationDate = result.implementation_date
|
|
// 标准类型
|
|
this.formInline.standardCategory = res.result.standard_class
|
|
this.formInline = Object.assign({}, this.formInline)
|
|
this.isGetDataAfter = true
|
|
}
|
|
}).finally(() => {
|
|
this.loading = false
|
|
})
|
|
this.$emit('processNameChange', (this.formInline.standardNumber || '') + '-' + (this.formInline.standardName || '') + '-' + '封存')
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
@import '~@assets/less/common.less';
|
|
|
|
/deep/ .ant-form-item-children > * {
|
|
width: 100%;
|
|
}
|
|
</style>
|