提交 85d38cf5 authored 作者: kxjia's avatar kxjia

优化代码

上级 4f037ffa
......@@ -6,7 +6,7 @@
<span class="form-title">当前待办<font color="red">[{{ editableNode?.name || '无' }}]</font></span>
<a-space>
<a-button v-show="props.showApprovalPanel" type="primary" ghost @click="handleApproval">审批</a-button>
<a-button v-show="!props.showApprovalPanel" type="primary" ghost @click="handleSend">保存</a-button>
<a-button v-show="!props.showApprovalPanel" type="primary" ghost @click="handleSave">保存</a-button>
<a-button v-show="!props.showApprovalPanel" type="primary" ghost @click="handleSend">保存并发送</a-button>
<a-button v-show="!props.showApprovalPanel" type="primary" ghost @click="handleReject">驳回</a-button>
<a-button type="primary" ghost @click="handleTransmit">转办</a-button>
......@@ -98,11 +98,25 @@ function handleApproval() {
function handleSend() {
taskOpenModal(true, {
taskTitle: '发送', isUpdate: false, showFooter: true, taskType: 'send',
deployId: props.deployId, taskId: props.taskId, procInsId: props.procInsId, dataId: props.dataId, assignee: props.assignee, userType: props.userType,
taskTitle: '发送并保存',
isUpdate: false,
showFooter: true,
taskType: 'send',
deployId: props.deployId,
taskId: props.taskId,
procInsId: props.procInsId, dataId: props.dataId, assignee: props.assignee, userType: props.userType,
});
}
const handleSave = async () => {
const curFormData = await getFormData()
formData.value = { ...curFormData}
if (formComponentRef.value?.saveForm){
await formComponentRef.value.saveForm(formData.value);
}
emit('update:form-data', formData.value)
}
function handleReject() {
taskOpenModal(true, {
taskTitle: '驳回', isUpdate: false, showFooter: true, taskType: 'reject',
......
......@@ -25,7 +25,7 @@
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ confirmLoading: false, showCancelBtn: !!data?.showFooter, showOkBtn: !!data?.showFooter });
approvalPanelRef.value?.initFormData?.(data);
approvalPanelRef.value?.handleRefresh?.();
});
function handleOk() {
......@@ -40,6 +40,7 @@
}
function handleApprovalFail(data: any) {
emit('approval-fail', data)
closeModal()
}
</script>
......@@ -102,7 +102,7 @@
},
];
const [registerForm, { validate, updateSchema, setFieldsValue,setProps }] = useForm({
const [registerForm, { validate, updateSchema, setFieldsValue,setProps,resetFields }] = useForm({
schemas: formSchemas,
showActionButtonGroup: false,
labelWidth: '120px',
......@@ -230,12 +230,18 @@
dataId.value = data.dataId || ''
nextTick(async () => {
updateField(userType.value);
})
}
const handleRefresh = async (data) => {
resetFields()
}
defineExpose({
handleSaveApp,
initFormData,
handleRefresh
})
</script>
......
......@@ -74,7 +74,6 @@
await rejectTask(submitData)
}
const handleReadTask = async (submitData: any) => {
alert(JSON.stringify(submitData))
await assignRead(submitData)
}
const handleTransmitTask = async (submitData: any) => {
......
......@@ -15,13 +15,14 @@
import { columns } from './StProblemCheck.data';
import { list, problemArchive } from './StProblemCheck.api';
const { createConfirm } = useMessage();
import { useMessage } from '/@/hooks/web/useMessage';
const { createConfirm } = useMessage();
const props = defineProps({
currentFlowNode: { type: Object, default: () => ({}) },
});
const emit = defineEmits(['callback', 'openMultiForm']);
const emit = defineEmits(['callback', 'openMultiForm', 'sendWorkFlow']);
const { tableContext } = useListPage({
tableProps: {
......@@ -41,10 +42,16 @@
function handleArchive(record: Recordable) {
createConfirm({
title: '确认归档问题吗?',
iconType: 'warning',
okText: '确认',
okType: 'danger',
onOk: () => {
problemArchive({ id: record.id }).then(handleSuccess);
problemArchive({ id: record.id })
.then(() => {
emit('sendWorkFlow', record);
handleSuccess()
}
);
},
});
}
......
......@@ -100,7 +100,7 @@
function getTableAction(record) {
return [
{ label: '编辑', onClick: handleEdit.bind(null, record) },
{ label: '发送任务', onClick: handleFlow.bind(null, record) },
{ label: '发送', onClick: handleFlow.bind(null, record) },
];
}
......
......@@ -91,6 +91,10 @@
activeTab.value = key;
currentMultiFormIndex.value = key - 1;
currentNode.value = workflowNodes.value[currentMultiFormIndex.value];
const currentFormComponent = getCurrentFormComponent();
if (currentFormComponent?.handleRefresh) {
currentFormComponent.handleRefresh();
}
}
function loadComponent(url: string) {
......@@ -187,7 +191,12 @@
};
const handleDrawerClose = () => { drawerVisible.value = false; };
const handleMultiFormDataUpdate = (_data: any) => {};
const handleMultiFormDataUpdate = (_data: any) => {
const currentFormComponent = getCurrentFormComponent();
if (currentFormComponent?.handleRefresh) {
currentFormComponent.handleRefresh();
}
};
function handlSendSuccess(dataId: any) {
const currentFormComponent = getCurrentFormComponent();
......
......@@ -64,7 +64,11 @@
handleSuccess();
}
defineExpose({ handleUpdate });
defineExpose({
handleUpdate,
handleRefresh: handleSuccess,
});
</script>
<style scoped></style>
<template>
<div style="min-height: 400px">
<BasicForm @register="registerForm" />
<div style="width: 100%; text-align: center" v-if="!formDisabled">
<!-- <div style="width: 100%; text-align: center" v-if="!formDisabled">
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button>
</div>
</div> -->
</div>
</template>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论