yxk-20260513-党委会流程表单
实现点击办理之前,自动保存基础信息(业务表单数据)和流程信息功能(是否办结、部门经办人)
This commit is contained in:
@@ -146,7 +146,7 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item :wrapperCol="wideActionWrapperCol">
|
<a-form-item :wrapperCol="wideActionWrapperCol">
|
||||||
<a-button type="primary" :loading="savingSubApproveUser" @click="saveSubApproveUserVariable">保存</a-button>
|
<a-button type="primary" :loading="savingSubApproveUser" @click="saveSubApproveUserVariable()">保存</a-button>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
@@ -154,6 +154,7 @@
|
|||||||
<TaskHandleInnerContent
|
<TaskHandleInnerContent
|
||||||
:form-data="formData"
|
:form-data="formData"
|
||||||
:claim="claim"
|
:claim="claim"
|
||||||
|
:beforeHandle="saveMainFormBeforeProcessHandle"
|
||||||
@success="handleProcessSuccess"
|
@success="handleProcessSuccess"
|
||||||
@claimSuccess="handleClaimSuccess"
|
@claimSuccess="handleClaimSuccess"
|
||||||
/>
|
/>
|
||||||
@@ -317,6 +318,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function submitForm() {
|
async function submitForm() {
|
||||||
|
return saveMainForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function saveMainForm(options: { showMessage?: boolean; emitOk?: boolean } = {}) {
|
||||||
|
const { showMessage = true, emitOk = true } = options;
|
||||||
savingMain.value = true;
|
savingMain.value = true;
|
||||||
try {
|
try {
|
||||||
const processInstanceId = processInfo.value.processInstanceId;
|
const processInstanceId = processInfo.value.processInstanceId;
|
||||||
@@ -327,16 +333,37 @@
|
|||||||
formData: { ...mainForm },
|
formData: { ...mainForm },
|
||||||
});
|
});
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
createMessage.success(res.message || '保存成功');
|
if (showMessage) {
|
||||||
emit('ok');
|
createMessage.success(res.message || '保存成功');
|
||||||
} else {
|
}
|
||||||
createMessage.warning(res.message || '保存失败');
|
if (emitOk) {
|
||||||
|
emit('ok');
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
createMessage.warning(res.message || '保存失败');
|
||||||
|
return false;
|
||||||
|
} catch (error) {
|
||||||
|
createMessage.warning('保存失败');
|
||||||
|
return false;
|
||||||
} finally {
|
} finally {
|
||||||
savingMain.value = false;
|
savingMain.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function saveMainFormBeforeProcessHandle() {
|
||||||
|
if (!mainDisabled.value) {
|
||||||
|
const mainSaved = await saveMainForm({ showMessage: false, emitOk: false });
|
||||||
|
if (!mainSaved) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (showSubApproveUser.value) {
|
||||||
|
return saveSubApproveUserVariable({ showSuccessMessage: false });
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
function openFeedbackModal() {
|
function openFeedbackModal() {
|
||||||
if (!mainForm.id) {
|
if (!mainForm.id) {
|
||||||
createMessage.warning('主表数据不存在,无法新增反馈');
|
createMessage.warning('主表数据不存在,无法新增反馈');
|
||||||
@@ -350,17 +377,18 @@
|
|||||||
feedbackModalRef.value?.open(mainForm.id, mainForm.secretLevel, processInstanceId);
|
feedbackModalRef.value?.open(mainForm.id, mainForm.secretLevel, processInstanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveSubApproveUserVariable() {
|
async function saveSubApproveUserVariable(options: { showSuccessMessage?: boolean } = {}) {
|
||||||
|
const { showSuccessMessage = true } = options;
|
||||||
const processInstanceId = processInfo.value.processInstanceId;
|
const processInstanceId = processInfo.value.processInstanceId;
|
||||||
const isEndValue = String(isEnd.value);
|
const isEndValue = String(isEnd.value);
|
||||||
const usernameValue = normalizeUsernameList(subApproveUser.value);
|
const usernameValue = normalizeUsernameList(subApproveUser.value);
|
||||||
if (!processInstanceId) {
|
if (!processInstanceId) {
|
||||||
createMessage.warning('流程实例ID不能为空');
|
createMessage.warning('流程实例ID不能为空');
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (isEndValue !== '1' && !usernameValue) {
|
if (isEndValue !== '1' && !usernameValue) {
|
||||||
createMessage.warning('请选择部门经办人');
|
createMessage.warning('请选择部门经办人');
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
savingSubApproveUser.value = true;
|
savingSubApproveUser.value = true;
|
||||||
@@ -368,17 +396,23 @@
|
|||||||
const isEndResult = await saveProcessVariable('isEnd', isEndValue);
|
const isEndResult = await saveProcessVariable('isEnd', isEndValue);
|
||||||
if (!isEndResult?.success) {
|
if (!isEndResult?.success) {
|
||||||
createMessage.warning(isEndResult.message || '保存失败');
|
createMessage.warning(isEndResult.message || '保存失败');
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEndValue !== '1') {
|
if (isEndValue !== '1') {
|
||||||
const subApproveUserResult = await saveProcessVariable('subApproveUser', usernameValue);
|
const subApproveUserResult = await saveProcessVariable('subApproveUser', usernameValue);
|
||||||
if (!subApproveUserResult?.success) {
|
if (!subApproveUserResult?.success) {
|
||||||
createMessage.warning(subApproveUserResult.message || '保存失败');
|
createMessage.warning(subApproveUserResult.message || '保存失败');
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
createMessage.success('保存成功');
|
if (showSuccessMessage) {
|
||||||
|
createMessage.success('保存成功');
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
createMessage.warning('保存失败');
|
||||||
|
return false;
|
||||||
} finally {
|
} finally {
|
||||||
savingSubApproveUser.value = false;
|
savingSubApproveUser.value = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,6 +172,10 @@
|
|||||||
selnextUserStatus:{
|
selnextUserStatus:{
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
|
},
|
||||||
|
beforeHandle: {
|
||||||
|
type: Function,
|
||||||
|
default: undefined,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emits: ['success'],
|
emits: ['success'],
|
||||||
@@ -372,6 +376,11 @@
|
|||||||
params.fileList = isString(params.fileList) ? params.fileList : JSON.stringify(params.fileList);
|
params.fileList = isString(params.fileList) ? params.fileList : JSON.stringify(params.fileList);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
const canHandle = await runBeforeHandle();
|
||||||
|
if (!canHandle) {
|
||||||
|
loading.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
console.log('流程提交->params', params);
|
console.log('流程提交->params', params);
|
||||||
let json = await taskComplete(params);
|
let json = await taskComplete(params);
|
||||||
console.log('流程提交-result', json);
|
console.log('流程提交-result', json);
|
||||||
@@ -383,6 +392,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function runBeforeHandle() {
|
||||||
|
if (typeof props.beforeHandle !== 'function') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const result = await props.beforeHandle();
|
||||||
|
return result !== false;
|
||||||
|
}
|
||||||
|
|
||||||
async function initDict() {
|
async function initDict() {
|
||||||
const dictData = await initDictOptions('approval_remarks');
|
const dictData = await initDictOptions('approval_remarks');
|
||||||
console.log('dic', dictData);
|
console.log('dic', dictData);
|
||||||
|
|||||||
+5
@@ -19,6 +19,7 @@
|
|||||||
:allowAddSign="allowAddSign"
|
:allowAddSign="allowAddSign"
|
||||||
:allowCounterSignAddUser="allowCounterSignAddUser"
|
:allowCounterSignAddUser="allowCounterSignAddUser"
|
||||||
:allowReject="allowReject"
|
:allowReject="allowReject"
|
||||||
|
:beforeHandle="beforeHandle"
|
||||||
:currentTaskName="currentNode.taskName">
|
:currentTaskName="currentNode.taskName">
|
||||||
</my-handle-content>
|
</my-handle-content>
|
||||||
|
|
||||||
@@ -55,6 +56,10 @@
|
|||||||
claim:{
|
claim:{
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
beforeHandle: {
|
||||||
|
type: Function,
|
||||||
|
default: undefined
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emits: ['success', 'claimSuccess'],
|
emits: ['success', 'claimSuccess'],
|
||||||
|
|||||||
Reference in New Issue
Block a user