|
|
@@ -351,6 +351,7 @@ const FormUtil = {
|
|
|
},
|
|
|
getCurrentDataValue({ selectorType, bindId, fieldName, storeType }) {
|
|
|
const userInfo = store.getters.userInfo
|
|
|
+ const { level = {} } = store.getters
|
|
|
// 缓存用户
|
|
|
if (userInfo.employee && userInfo.employee.id) {
|
|
|
const selectors = [{
|
|
|
@@ -359,7 +360,12 @@ const FormUtil = {
|
|
|
}]
|
|
|
this.CACHE_CURRENT_USER_DATA['user'] = selectors
|
|
|
}
|
|
|
-
|
|
|
+ // 当前层级
|
|
|
+ if (selectorType === 'currentPosition') {
|
|
|
+ const t = level.second || level.first
|
|
|
+ const selectors = t ? t.split(',').map(str => ({ id: str })) : ''
|
|
|
+ this.CACHE_CURRENT_USER_DATA['currentPosition'] = selectors
|
|
|
+ }
|
|
|
// 当前组织
|
|
|
if (userInfo.org && userInfo.org.id) {
|
|
|
const selectors = [{
|
|
|
@@ -473,9 +479,14 @@ const FormUtil = {
|
|
|
result = response.data
|
|
|
}).catch(() => {})
|
|
|
}
|
|
|
- } else if (fieldType === 'currentUser' || fieldType === 'currentOrg') { // 当前用户、组织
|
|
|
+ } else if (fieldType === 'currentUser' || fieldType === 'currentOrg' || fieldType === 'currentPosition') { // 当前用户、组织
|
|
|
+ const types = {
|
|
|
+ currentUser: 'user',
|
|
|
+ currentOrg: 'org',
|
|
|
+ currentPosition: 'position'
|
|
|
+ }
|
|
|
result = this.getCurrentDataValue({
|
|
|
- selectorType: fieldType === 'currentUser' ? 'user' : 'org',
|
|
|
+ selectorType: types[fieldType],
|
|
|
bindId: fieldOptions.bind_id,
|
|
|
name: fieldName,
|
|
|
storeType: fieldOptions.store
|
|
|
@@ -487,9 +498,9 @@ const FormUtil = {
|
|
|
}
|
|
|
// ================= 预设值 =================
|
|
|
} else if (defaultValueType === 'present') {
|
|
|
- if (fieldType === 'selector' || fieldType === 'currentUser' || fieldType === 'currentOrg') { // 当前用户、组织
|
|
|
+ if (fieldType === 'selector' || fieldType === 'currentUser' || fieldType === 'currentOrg' || fieldType === 'currentPosition') { // 当前用户、组织
|
|
|
result = this.getCurrentDataValue({
|
|
|
- selectorType: fieldOptions.selector_type || 'user',
|
|
|
+ selectorType: fieldType === 'currentPosition' ? 'currentPosition' : fieldOptions.selector_type || 'user',
|
|
|
bindId: fieldOptions.bind_id,
|
|
|
storeType: fieldOptions.store,
|
|
|
fieldName: fieldName
|