[update] 修改bug80883
This commit is contained in:
+106
-4
@@ -405,8 +405,10 @@
|
||||
</div>
|
||||
<a-form-model-item class="item-model" prop="authDept">
|
||||
<j-select-depart v-model="formInline.authDept"
|
||||
:disabled="disabled"
|
||||
:disabled="disabled || authDeptDisabled"
|
||||
@back="authDeptBack"
|
||||
:select-range="authDeptSelectRange"
|
||||
:multi="true"
|
||||
:backDepart="true" />
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
@@ -509,11 +511,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { StandardSource, ProjectType, ApplicationCategory } from '@/enums/commonEnums'
|
||||
import { StandardSource, ProjectType, ApplicationCategory, StandardGradeClassify } from '@/enums/commonEnums'
|
||||
import UserSelection from '@/components/selection/UserSelection'
|
||||
import StandardSelection from '@/components/selection/StandardSelection'
|
||||
import UploadFile from '@/components/UploadFile'
|
||||
import { getTreeList } from '@/api/enterpriseStandardLibraryApi'
|
||||
import { getTreeList, getStandardGradeClassification } from '@/api/enterpriseStandardLibraryApi'
|
||||
import Vue from 'vue'
|
||||
import { USER_INFO } from '@/store/mutation-types'
|
||||
import { getEnStandardNo } from '@/api/workCenter'
|
||||
@@ -743,7 +745,12 @@ export default {
|
||||
}
|
||||
]
|
||||
},
|
||||
isLook: false // 是否是查看
|
||||
isLook: false, // 是否是查看
|
||||
standardGradeClassification: [], // 企标级别映射数据
|
||||
isEditSetData: false, // 是否正在初始化数据
|
||||
authDeptDisabled: false, // 授权部门是否可以更改
|
||||
authDeptSelectRange: [], // 授权部门可选范围
|
||||
oldMainDraftingUnit: '' // 上一次的主起草单位
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -752,6 +759,79 @@ export default {
|
||||
}
|
||||
},
|
||||
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)
|
||||
}
|
||||
},
|
||||
// 主起草单位改变后,需要将选中的主起草单位增加到授权部门
|
||||
'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()
|
||||
@@ -765,6 +845,10 @@ export default {
|
||||
// this.getEnStandardNo()
|
||||
// }
|
||||
},
|
||||
created () {
|
||||
// 获取企标级别映射数据
|
||||
this.getStandardGradeClassification()
|
||||
},
|
||||
mounted () {
|
||||
this.initStandardSystemOptions()
|
||||
if (this.source === 'tableBaseInfo') {
|
||||
@@ -786,6 +870,8 @@ export default {
|
||||
formInline.mainDraftingUser_dictText = userInfo.realname
|
||||
// 初始化主起草单位信息
|
||||
formInline.mainDraftingUnit = userInfo.departIds
|
||||
// 设置上一次主起草单位,留存记录
|
||||
this.oldMainDraftingUnit = formInline.mainDraftingUnit
|
||||
// 初始化起草单位负责人 todo: 看怎么获取当前登录人的上级
|
||||
// 初始化年代号
|
||||
formInline.decadeCode = new Date().getFullYear() + ''
|
||||
@@ -793,6 +879,7 @@ export default {
|
||||
},
|
||||
edit (record) {
|
||||
this.visible = true
|
||||
this.isEditSetData = true
|
||||
this.model = Object.assign({}, record)
|
||||
const formInline = Object.assign({}, record)
|
||||
// 三个日期,如果标准化填写了,主起草人不能修改,标准化未填写,联络人必填
|
||||
@@ -858,10 +945,14 @@ export default {
|
||||
return { value: item }
|
||||
}) : []
|
||||
this.formInline = Object.assign({}, formInline)
|
||||
setTimeout(() => {
|
||||
this.isEditSetData = false
|
||||
}, 500)
|
||||
},
|
||||
look (record) {
|
||||
this.isLook = true
|
||||
this.visible = true
|
||||
this.isEditSetData = true
|
||||
this.model = Object.assign({}, record)
|
||||
this.formInline = Object.assign({}, record)
|
||||
// 没有申请类型就设置为立项
|
||||
@@ -872,6 +963,17 @@ export default {
|
||||
return { value: item }
|
||||
}) : []
|
||||
this.disabled = true
|
||||
setTimeout(() => {
|
||||
this.isEditSetData = false
|
||||
}, 500)
|
||||
},
|
||||
// 获取企标级别映射数据
|
||||
getStandardGradeClassification () {
|
||||
getStandardGradeClassification().then(res => {
|
||||
if (res.success) {
|
||||
this.standardGradeClassification = res.result
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取标准体系下拉框数据
|
||||
initStandardSystemOptions () {
|
||||
|
||||
Reference in New Issue
Block a user