[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
@@ -132,7 +132,6 @@ export default {
// 筛选出只有在选择范围里的数据
filterTreeDataOnlySelectRange (arr) {
for (const item of arr) {
console.log('可选范围是否包括', item.departName, this.selectRange.includes(item.key))
if (!this.selectRange.includes(item.key)) {
item.disabled = true
item.selectable = false
@@ -425,8 +425,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>
@@ -530,12 +532,12 @@
</template>
<script>
import { StandardSource, ProjectType, ApplicationCategory } from '@/enums/commonEnums'
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 } 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'
@@ -718,7 +720,11 @@ export default {
}
]
},
isLook: false // 是否是查看
isLook: false, // 是否是查看
authDeptSelectRange: [], // 授权部门可选项
authDeptDisabled: false, // 授权部门不可修改
isEditSetData: false, // 是否正在初始化数据
oldMainDraftingUnit: '' // 上一次的主起草单位
}
},
computed: {
@@ -727,6 +733,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()
@@ -740,6 +819,10 @@ export default {
// this.getEnStandardNo()
// }
},
created () {
// 获取企标级别映射数据
this.getStandardGradeClassification()
},
mounted () {
this.getWorkGroupTree()
this.initStandardSystemOptions()
@@ -754,6 +837,8 @@ export default {
// 初始化主起草单位信息,需要翻译当前登录用户的部门,因为表格回显
formInline.mainDraftingUnit = userInfo.departIds
formInline.mainDraftingUnit_dictText = userInfo.departIds_dictText
// 设置上一次主起草单位,留存记录
this.oldMainDraftingUnit = formInline.mainDraftingUnit
// 初始化起草单位负责人 todo: 看怎么获取当前登录人的上级
// 初始化年代号
formInline.decadeCode = new Date().getFullYear() + ''
@@ -761,6 +846,7 @@ export default {
},
edit (record) {
this.visible = true
this.isEditSetData = true
this.model = Object.assign({}, record)
const formInline = Object.assign({}, record)
// 没有年代号就设置为当前年份
@@ -780,8 +866,12 @@ export default {
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)
@@ -797,6 +887,9 @@ export default {
return { value: item }
}) : []
this.disabled = true
setTimeout(() => {
this.isEditSetData = false
}, 500)
},
// watch监视年代号会滞后
// decadeCodeChange (value) {
@@ -832,6 +925,14 @@ export default {
// }
// }
// },
// 获取企标级别映射数据
getStandardGradeClassification () {
getStandardGradeClassification().then(res => {
if (res.success) {
this.standardGradeClassification = res.result
}
})
},
// 获取标准体系下拉框数据
initStandardSystemOptions () {
getTreeList({ option: 1 }).then(res => {
@@ -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 () {
@@ -587,9 +587,13 @@ export default {
// 是立项
this.$nextTick(() => {
this.$nextTick(() => {
this.$refs.approvalBaseInfo.isEditSetData = true
const param = this.model.dataList[0]
param.enStandardSystem = param.enStandardSystem ? param.enStandardSystem.split(',').map(item => { return { value: item } }) : []
this.$refs.approvalBaseInfo.formInline = param
setTimeout(() => {
this.$refs.approvalBaseInfo.isEditSetData = false
}, 500)
})
})
} else if (this.formInline.applicationCategory === ApplicationCategory.CHANGE.value &&
@@ -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 () {
// 正在初始化数据,不获取新企标编号