[update] 修改bug80883

This commit is contained in:
lideqin
2024-01-17 13:34:47 +08:00
parent b5c99ad26f
commit 93d5a70c65
5 changed files with 313 additions and 13 deletions
@@ -388,7 +388,9 @@
</div>
<a-form-model-item class="item-model" prop="authDept">
<j-select-depart v-model="formInline.authDept"
:disabled="disabled"
:disabled="disabled || authDeptDisabled"
:selectRange="authDeptSelectRange"
:multi="true"
:backDepart="true" />
</a-form-model-item>
</div>
@@ -601,13 +603,17 @@
<script>
import Vue from 'vue'
import { USER_INFO } from '@/store/mutation-types'
import { StandardSource, ProjectType } from '@/enums/commonEnums.js'
import { StandardSource, ProjectType, StandardGradeClassify } from '@/enums/commonEnums.js'
import StandardSelection from '@/components/selection/StandardSelection'
import UserSelection from '@/components/selection/UserSelection'
import UploadFile from '@/components/UploadFile'
import TreeSelection from '@/components/selection/TreeSelection'
import { getEnStandardNo } from '@/api/workCenter'
import { getEnterpriseStandardInfoById, getTreeList } from '@/api/enterpriseStandardLibraryApi'
import {
getEnterpriseStandardInfoById,
getTreeList,
getStandardGradeClassification
} from '@/api/enterpriseStandardLibraryApi'
export default {
name: 'ApprovalBaseInfo',
@@ -663,6 +669,79 @@ export default {
// 原企标编号改变,新企标编号随之改变
'formInline.originEnStandardNo' (value) {
this.getEnStandardNo()
},
// 标准等级分类改变后授权部门需要自动带出
'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)
}
},
// 主起草单位改变后,需要将选中的主起草单位增加到授权部门
'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
}
}
},
computed: {
@@ -841,12 +920,19 @@ export default {
rangeOfApplication: true, // 适用范围部分
projectStatement: true // 立项说明部分
},
uploadName: ''
uploadName: '',
standardGradeClassification: [], // 企标级别映射数据
isEditSetData: false, // 是否正在初始化数据
authDeptDisabled: false, // 授权部门不可修改
authDeptSelectRange: [], // 授权部门的可选项
oldMainDraftingUnit: '' // 上一次的主起草单位
}
},
created () {
// 获取标准体系下拉框数据
this.initStandardSystemOptions()
// 获取企标级别映射数据
this.getStandardGradeClassification()
},
mounted () {
console.log(this.$route.query.processId)
@@ -880,6 +966,14 @@ export default {
const processName = (this.formInline.newEnStandardNo || '') + '-' + (this.formInline.newEnStandardName || '') + '-' + '立项'
this.$emit('processNameChange', processName)
},
// 获取企标级别映射数据
getStandardGradeClassification () {
getStandardGradeClassification().then(res => {
if (res.success) {
this.standardGradeClassification = res.result
}
})
},
// 根据三个代号和一个年代号获取企标编号
getEnStandardNo () {
// 正在初始化数据,不获取新企标编号