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

优化代码

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