Browse Source

chore: Support multiple selection methods

master
wangxiang 2 years ago
parent
commit
921aed6ae7
No known key found for this signature in database
GPG Key ID: 1BA7946AB6B232E4
  1. 35
      src/views/workflow/task/TaskForm.vue
  2. 2
      src/views/workflow/task/popups/UserPicker/index.vue

35
src/views/workflow/task/TaskForm.vue

@ -57,6 +57,7 @@
:labelCol="{ style: { width: '90px' } }" :labelCol="{ style: { width: '90px' } }"
:wrapperCol="{ style: { width: '100%' } }" :wrapperCol="{ style: { width: '100%' } }"
:model="state.auditForm" :model="state.auditForm"
:rules="state.rulesRef"
:scrollToFirstError="true" :scrollToFirstError="true"
> >
<ACol :span="16"> <ACol :span="16">
@ -83,7 +84,6 @@
<AFormItem v-if="state.isCC" <AFormItem v-if="state.isCC"
label="抄送给" label="抄送给"
name="userIds" name="userIds"
:rules="[{required: true, message: '用户不能为空', validateTrigger: 'blur'}]"
> >
<AInputGroup compact> <AInputGroup compact>
<ApiSelect v-model:value="state.auditForm.userIds" <ApiSelect v-model:value="state.auditForm.userIds"
@ -114,7 +114,6 @@
<AFormItem v-if="state.isAssign" <AFormItem v-if="state.isAssign"
label="指定" label="指定"
name="assignee" name="assignee"
:rules="[{required: true, message: '用户不能为空', validateTrigger: 'blur'}]"
> >
<AInputGroup compact> <AInputGroup compact>
<ApiSelect v-model:value="state.auditForm.assignee" <ApiSelect v-model:value="state.auditForm.assignee"
@ -140,7 +139,7 @@
</a-card> </a-card>
</ALayoutContent> </ALayoutContent>
<footer class="workflow-form__footer" :style="getWrapFormFooterStyle"> <footer class="workflow-form__footer" :style="getWrapFormFooterStyle">
<a-button size="large" type="primary">审批</a-button> <a-button size="large" type="primary" @click="test">审批</a-button>
<a-button size="large" type="primary" danger>驳回</a-button> <a-button size="large" type="primary" danger>驳回</a-button>
</footer> </footer>
<UserPicker @register="registerModal" @success="handleTransferTask"/> <UserPicker @register="registerModal" @success="handleTransferTask"/>
@ -226,10 +225,11 @@
mesCode: string, mesCode: string,
mesName: string, mesName: string,
// ID // ID
userIds: string, userIds: string[],
// ID // ID
assignee: string, assignee: string,
}, },
rulesRef: Recordable;
} }
/** 通用变量统一声明区域 */ /** 通用变量统一声明区域 */
@ -272,8 +272,12 @@
message: '', message: '',
mesCode: '', mesCode: '',
mesName: '', mesName: '',
userIds: '', userIds: [],
assignee: '' assignee: ''
},
rulesRef: {
assignee: [{ required: true, whitespace: true, message: '用户不能为空', validateTrigger: 'blur' }],
userIds: [{ required: true, type: 'array', message: '用户不能为空', validateTrigger: 'blur' }]
} }
}); });
const { currentRoute, push } = useRouter(); const { currentRoute, push } = useRouter();
@ -282,6 +286,7 @@
const { close } = useTabs(); const { close } = useTabs();
const formPreview = ref(); const formPreview = ref();
const workflowChart = ref(); const workflowChart = ref();
const auditForm = ref();
const [registerModal, { openModal }] = useModal(); const [registerModal, { openModal }] = useModal();
const [registerRollBackTask , { openModal: openRollBackTask }] = useModal(); const [registerRollBackTask , { openModal: openRollBackTask }] = useModal();
onActivated(() => { onActivated(() => {
@ -340,8 +345,8 @@
state.formReadOnly = query.formReadOnly === 'true'; state.formReadOnly = query.formReadOnly === 'true';
state.isCC = false; state.isCC = false;
state.isAssign = false; state.isAssign = false;
state.auditForm.assignee = ''; state.auditForm.assignee = '1510539584287346688';
state.auditForm.userIds = ''; state.auditForm.userIds = ['1510539584287346688'];
state.auditForm.message = ''; state.auditForm.message = '';
} }
@ -350,7 +355,7 @@
if (state.isCC && state.auditForm.userIds) { if (state.isCC && state.auditForm.userIds) {
//this.$refs['auditForm'].validate((valid) => { //this.$refs['auditForm'].validate((valid) => {
//if (valid) { //if (valid) {
saveWorkflowCopy(state.auditForm.userIds, { saveWorkflowCopy(state.auditForm.userIds.join(','), {
processDefId: state.processDefId, processDefId: state.processDefId,
processInsId: data.processInsId, processInsId: data.processInsId,
processDefName: '', processDefName: '',
@ -613,6 +618,10 @@
} }
} }
function test() {
auditForm.value.validate();
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@prefix-cls: ~'@{namespace}-task-form'; @prefix-cls: ~'@{namespace}-task-form';
@ -643,4 +652,14 @@
margin-bottom: 15px; margin-bottom: 15px;
} }
} }
:deep(.ant-select) {
&-disabled {
&.ant-select:not(.ant-select-customize-input) {
.ant-select-selector {
background: transparent;
}
}
}
}
</style> </style>

2
src/views/workflow/task/popups/UserPicker/index.vue

@ -68,7 +68,7 @@
fieldMapToTime: [['dateRange', ['beginTime', 'endTime'], 'YYYY-MM-DD']] fieldMapToTime: [['dateRange', ['beginTime', 'endTime'], 'YYYY-MM-DD']]
}, },
maxHeight: 450, maxHeight: 450,
rowSelection: { type: 'checkbox' }, rowSelection: { type: props.limit == 1 ? 'radio' : 'checkbox' },
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
bordered: true, bordered: true,

Loading…
Cancel
Save