feat(bpm): 新增任务分配规则支持自定义用户选择
- 在任务分配规则中增加 userSelects 类型支持 - 新增 TaskSelectAssigneeForm 组件用于选择任务候选人 - 更新 UserSelect 组件导出 Column 接口- 调整任务分配表单逻辑以适配新的用户选择类型- 优化任务分配规则获取与展示逻辑
This commit is contained in:
@@ -32,22 +32,22 @@
|
||||
</ContentWrap>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import {DICT_TYPE, getIntDictOptions} from '@/utils/dict'
|
||||
import * as TaskAssignRuleApi from '@/api/bpm/taskAssignRule'
|
||||
import * as RoleApi from '@/api/system/role'
|
||||
import * as PostApi from '@/api/system/post'
|
||||
import * as UserGroupApi from '@/api/bpm/userGroup'
|
||||
import { setUserAndDeptName } from '@/components/LowDesign/src/utils/getName'
|
||||
import { useLowStoreWithOut } from '@/store/modules/low'
|
||||
import {setUserAndDeptName} from '@/components/LowDesign/src/utils/getName'
|
||||
import {useLowStoreWithOut} from '@/store/modules/low'
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
const { getCurrPermi } = useCrudPermi()
|
||||
const {t} = useI18n() // 国际化
|
||||
const {getCurrPermi} = useCrudPermi()
|
||||
const lowStore = useLowStoreWithOut()
|
||||
|
||||
defineOptions({ name: 'BpmTaskAssignRule' })
|
||||
defineOptions({name: 'BpmTaskAssignRule'})
|
||||
|
||||
const { query } = useRoute() // 查询参数
|
||||
const {query} = useRoute() // 查询参数
|
||||
|
||||
const loading = ref(true)
|
||||
const getRules = (label) => {
|
||||
@@ -65,6 +65,7 @@ const getUserKey = (val) => {
|
||||
else if ([20, 21].includes(val)) key = 'deptIds'
|
||||
else if (val == 22) key = 'postIds'
|
||||
else if ([30, 31, 32].includes(val)) key = 'userIds'
|
||||
else if (val == 35) key = 'userSelects'
|
||||
else if (val == 40) key = 'userGroupIds'
|
||||
else if (val == 50) key = 'scripts'
|
||||
return key
|
||||
@@ -81,8 +82,8 @@ const tableOption = reactive({
|
||||
delBtn: false,
|
||||
calcHeight: 20,
|
||||
column: {
|
||||
taskDefinitionName: { label: '任务名', disabled: true },
|
||||
taskDefinitionKey: { label: '任务标识', disabled: true },
|
||||
taskDefinitionName: {label: '任务名', disabled: true},
|
||||
taskDefinitionKey: {label: '任务标识', disabled: true},
|
||||
type: {
|
||||
label: '规则类型',
|
||||
type: 'select',
|
||||
@@ -90,12 +91,13 @@ const tableOption = reactive({
|
||||
rules: getRules('规则类型'),
|
||||
control: (val) => {
|
||||
const columnObj = {
|
||||
roleIds: { display: false },
|
||||
deptIds: { display: false },
|
||||
postIds: { display: false },
|
||||
userIds: { display: false },
|
||||
userGroupIds: { display: false },
|
||||
scripts: { display: false }
|
||||
roleIds: {display: false},
|
||||
deptIds: {display: false},
|
||||
postIds: {display: false},
|
||||
userIds: {display: false},
|
||||
userGroupIds: {display: false},
|
||||
scripts: {display: false},
|
||||
userSelects: {display: false},
|
||||
}
|
||||
const key = getUserKey(val)
|
||||
if (key) columnObj[key].display = true
|
||||
@@ -112,6 +114,7 @@ const tableOption = reactive({
|
||||
let arr = row.options.map((id) => {
|
||||
if (key == 'deptIds') return lowStore.dicObj.deptSelect?.[id] || id
|
||||
else if (key == 'userIds') return lowStore.dicObj.userSelect?.[id] || id
|
||||
else if (key == 'userSelects') return ''
|
||||
else return dicObj.value[key][id]
|
||||
})
|
||||
|
||||
@@ -198,7 +201,7 @@ const rowUpdate = async (form, index, done, loading) => {
|
||||
const delKey = ['roleIds', 'deptIds', 'postIds', 'userIds', 'userGroupIds', 'scripts']
|
||||
if (key) {
|
||||
if (typeof form[key] == 'number') form[key] = form[key] + ''
|
||||
const value = form[key]
|
||||
const value = key === 'userSelects' ? '' : form[key]
|
||||
form.options = typeof value == 'string' ? value.split(',') : value
|
||||
}
|
||||
delKey.forEach((prop) => delete form[prop])
|
||||
@@ -228,14 +231,14 @@ const getDicData = () => {
|
||||
const id = item.id + ''
|
||||
const name = item.name
|
||||
dicObj.value[key][id] = name
|
||||
return { label: name, value: id }
|
||||
return {label: name, value: id}
|
||||
})
|
||||
})
|
||||
dicObj.value.scripts = {}
|
||||
tableOption.column.scripts.dicData = getIntDictOptions(DICT_TYPE.BPM_TASK_ASSIGN_SCRIPT).map(
|
||||
(item) => {
|
||||
dicObj.value.scripts[item.value] = item.label
|
||||
return { value: item.value + '', label: item.label }
|
||||
return {value: item.value + '', label: item.label}
|
||||
}
|
||||
) as never[]
|
||||
dicObj.value.type = {}
|
||||
@@ -262,7 +265,7 @@ const formattingTableData = (data): Promise<any[]> => {
|
||||
}
|
||||
return item
|
||||
})
|
||||
await setUserAndDeptName({ userIdList, deptIdList })
|
||||
await setUserAndDeptName({userIdList, deptIdList})
|
||||
resolve(data)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user