feat:框架代码 关于流程信息变更的代码更新
This commit is contained in:
@ -22,12 +22,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, computed, defineAsyncComponent, reactive } from 'vue';
|
import { ref, onMounted, computed, defineAsyncComponent, reactive,inject } from 'vue';
|
||||||
import { FromPageType } from '/@/enums/workflowEnum';
|
import {ApproveCode, FromPageType} from '/@/enums/workflowEnum';
|
||||||
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
|
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
|
||||||
import { GeneratorConfig } from '/@/model/generator/generatorConfig';
|
import { GeneratorConfig } from '/@/model/generator/generatorConfig';
|
||||||
import { createFormEvent, loadFormEvent } from '/@/hooks/web/useFormEvent';
|
import { createFormEvent, loadFormEvent } from '/@/hooks/web/useFormEvent';
|
||||||
import { changeFormJson } from '/@/hooks/web/useWorkFlowForm';
|
import { changeFormJson } from '/@/hooks/web/useWorkFlowForm';
|
||||||
|
import {message} from "ant-design-vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
systemComponent: {
|
systemComponent: {
|
||||||
@ -63,6 +64,7 @@
|
|||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const approvalData = ref(null);
|
||||||
const SystemFormRef = ref();
|
const SystemFormRef = ref();
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
const formProps = ref({});
|
const formProps = ref({});
|
||||||
@ -129,6 +131,7 @@
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
|
approvalData.value = inject("approvalData");
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -168,11 +171,30 @@
|
|||||||
}
|
}
|
||||||
async function setFieldsValue(record) {
|
async function setFieldsValue(record) {
|
||||||
flowConfig.draftsFormData = record;
|
flowConfig.draftsFormData = record;
|
||||||
|
SystemFormRef.value?.setFieldsValue(record);
|
||||||
|
}
|
||||||
|
async function getFieldsValue(){
|
||||||
|
return SystemFormRef.value.getFieldsValue();
|
||||||
|
}
|
||||||
|
async function getValue(){
|
||||||
|
let values = null;
|
||||||
|
if(approvalData.value?.approvedResult === ApproveCode.FINISH){
|
||||||
|
//终止的单据不走校验逻辑直接更新
|
||||||
|
try{
|
||||||
|
//有些旧表单可能没有生成getFieldsValue
|
||||||
|
values = await SystemFormRef.value.getFieldsValue();
|
||||||
|
}catch (e){}
|
||||||
|
}
|
||||||
|
if(values === null){
|
||||||
|
values = await SystemFormRef.value.validate();
|
||||||
|
}
|
||||||
|
//添加一个flowAction标志用于合同单号回收
|
||||||
|
values.flowAction = approvalData.value?.approvedResult;
|
||||||
|
return values;
|
||||||
}
|
}
|
||||||
async function workflowSubmit(saveRowKey) {
|
async function workflowSubmit(saveRowKey) {
|
||||||
let values = {};
|
|
||||||
try {
|
try {
|
||||||
values = await SystemFormRef.value.validate();
|
let values = await getValue();
|
||||||
// 提交表单
|
// 提交表单
|
||||||
if (visible.value) {
|
if (visible.value) {
|
||||||
let id = await submit(saveRowKey);
|
let id = await submit(saveRowKey);
|
||||||
@ -189,6 +211,7 @@
|
|||||||
return values;
|
return values;
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function submit(saveRowKey) {
|
async function submit(saveRowKey) {
|
||||||
let saveValId = '';
|
let saveValId = '';
|
||||||
let values = await SystemFormRef.value.validate();
|
let values = await SystemFormRef.value.validate();
|
||||||
@ -215,23 +238,29 @@
|
|||||||
return SystemFormRef.value.setDisabledForm(isDisabled);
|
return SystemFormRef.value.setDisabledForm(isDisabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleDelete(id) {
|
async function resetFields(){
|
||||||
let ret;
|
return SystemFormRef.value.resetFields();
|
||||||
try {
|
}
|
||||||
ret = await SystemFormRef.value.handleDelete(id);
|
|
||||||
} catch (e) {
|
async function handleDelete(id) {
|
||||||
message.error('表单未配置删除');
|
let ret;
|
||||||
return null;
|
try {
|
||||||
|
ret = await SystemFormRef.value.handleDelete(id);
|
||||||
|
} catch (e) {
|
||||||
|
message.error('表单未配置删除');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
workflowSubmit,
|
workflowSubmit,
|
||||||
getRowKey,
|
getRowKey,
|
||||||
validate,
|
validate,
|
||||||
getUploadComponentIds,
|
getUploadComponentIds,
|
||||||
|
resetFields,
|
||||||
setFieldsValue,
|
setFieldsValue,
|
||||||
|
getFieldsValue,
|
||||||
getIsOldSystem,
|
getIsOldSystem,
|
||||||
setDisabledForm,
|
setDisabledForm,
|
||||||
handleDelete
|
handleDelete
|
||||||
|
|||||||
@ -467,16 +467,16 @@ function getTableItemConfig(tableName: string, element) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 辅助设置表单Disabled
|
// 辅助设置表单Disabled
|
||||||
export function changeSchemaDisabled(schemas) {
|
export function changeSchemaDisabled(schemas,isDisabled=true) {
|
||||||
const layoutComponents = ['tab', 'grid', 'card'];
|
const layoutComponents = ['tab', 'grid', 'card'];
|
||||||
schemas?.map((info) => {
|
schemas?.map((info) => {
|
||||||
if (layoutComponents.includes(info.type!)) {
|
if (layoutComponents.includes(info.type!)) {
|
||||||
info.children?.map((childInfo) => {
|
info.children?.map((childInfo) => {
|
||||||
childInfo.list.map((com) => {
|
childInfo.list.map((com) => {
|
||||||
if (layoutComponents.includes(com.type)) {
|
if (layoutComponents.includes(com.type)) {
|
||||||
changeSchemaDisabled(childInfo.list);
|
changeSchemaDisabled(childInfo.list,isDisabled);
|
||||||
} else {
|
} else {
|
||||||
com.dynamicDisabled = true;
|
com.dynamicDisabled = isDisabled;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -485,17 +485,24 @@ export function changeSchemaDisabled(schemas) {
|
|||||||
childInfo.list.map((com) => {
|
childInfo.list.map((com) => {
|
||||||
com.children.map((el) => {
|
com.children.map((el) => {
|
||||||
if (layoutComponents.includes(el.type) || el.type == 'table-layout') {
|
if (layoutComponents.includes(el.type) || el.type == 'table-layout') {
|
||||||
changeSchemaDisabled(com.children);
|
changeSchemaDisabled(com.children,isDisabled);
|
||||||
} else {
|
} else {
|
||||||
el.dynamicDisabled = true;
|
el.dynamicDisabled = isDisabled;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else if (info.type == 'one-for-one') {
|
} else if (info.type == 'one-for-one') {
|
||||||
changeSchemaDisabled(info.componentProps.childSchemas);
|
changeSchemaDisabled(info.componentProps.childSchemas,isDisabled);
|
||||||
|
} else if (info.type == 'form') {
|
||||||
|
info.dynamicDisabled = isDisabled;
|
||||||
|
info.componentProps.disabled = isDisabled;
|
||||||
|
info.componentProps.columns?.forEach((column) => {
|
||||||
|
column.dynamicDisabled = isDisabled;
|
||||||
|
if(column?.componentProps) column.componentProps.disabled = isDisabled
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
info.dynamicDisabled = true;
|
info.dynamicDisabled = isDisabled;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return schemas;
|
return schemas;
|
||||||
|
|||||||
@ -1745,8 +1745,8 @@ export function buildSimpleFormCode(model: GeneratorConfig, _tableInfo: TableInf
|
|||||||
await systemFormRef.value.resetFields();
|
await systemFormRef.value.resetFields();
|
||||||
}
|
}
|
||||||
// 设置表单数据全部为Disabled 【查看】
|
// 设置表单数据全部为Disabled 【查看】
|
||||||
async function setDisabledForm() {
|
async function setDisabledForm(isDisabled) {
|
||||||
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas));
|
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas),isDisabled);
|
||||||
}
|
}
|
||||||
// 获取行键值
|
// 获取行键值
|
||||||
function getRowKey() {
|
function getRowKey() {
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
|
|
||||||
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
|
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
|
||||||
|
|
||||||
<template #toolbar>
|
<template #toolbar>
|
||||||
<template v-for="button in tableButtonConfig" :key="button.code">
|
<template v-for="button in tableButtonConfig" :key="button.code">
|
||||||
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
|
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
|
||||||
@ -394,4 +393,4 @@ function getActions(record: Recordable): ActionItem[] {
|
|||||||
.hide {
|
.hide {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -110,8 +110,8 @@
|
|||||||
await systemFormRef.value.resetFields();
|
await systemFormRef.value.resetFields();
|
||||||
}
|
}
|
||||||
// 设置表单数据全部为Disabled 【查看】
|
// 设置表单数据全部为Disabled 【查看】
|
||||||
async function setDisabledForm() {
|
async function setDisabledForm(isDisabled) {
|
||||||
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas));
|
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas), isDisabled);
|
||||||
}
|
}
|
||||||
// 获取行键值
|
// 获取行键值
|
||||||
function getRowKey() {
|
function getRowKey() {
|
||||||
|
|||||||
@ -57,7 +57,11 @@
|
|||||||
</BasicTable>
|
</BasicTable>
|
||||||
|
|
||||||
<!-- 查看 -->
|
<!-- 查看 -->
|
||||||
<LookProcess ref="lookProcess" :taskId="taskId" :processId="processId" @close="reload"/>
|
<LookProcess ref="lookProcess"
|
||||||
|
:taskId="taskId"
|
||||||
|
:processId="processId"
|
||||||
|
:schemaId="schemaId"
|
||||||
|
@close="reload"/>
|
||||||
<!-- 指派审核人 -->
|
<!-- 指派审核人 -->
|
||||||
<ApproveProcessMonitorUser
|
<ApproveProcessMonitorUser
|
||||||
v-if="data.approvedUserVisible"
|
v-if="data.approvedUserVisible"
|
||||||
@ -407,6 +411,7 @@
|
|||||||
async function dbClickRow(record) {
|
async function dbClickRow(record) {
|
||||||
processId.value = record.processId;
|
processId.value = record.processId;
|
||||||
taskId.value = record.taskId;//改版 一个流程中可能有多个taskId 已不返回
|
taskId.value = record.taskId;//改版 一个流程中可能有多个taskId 已不返回
|
||||||
|
schemaId.value = record.schemaId;
|
||||||
await nextTick()
|
await nextTick()
|
||||||
await lookProcess.value.look();
|
await lookProcess.value.look();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
:taskRecords="data.taskRecords"
|
:taskRecords="data.taskRecords"
|
||||||
:predecessorTasks="selectedPredecessorTasks"
|
:predecessorTasks="selectedPredecessorTasks"
|
||||||
:processId="props.processId"
|
:processId="props.processId"
|
||||||
|
:schemaId="props.schemaId"
|
||||||
position="top"
|
position="top"
|
||||||
>
|
>
|
||||||
<FormInformation
|
<FormInformation
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
<a-button type="primary" class="clean-icon" @click.stop="close">{{ t('关闭') }}</a-button>
|
<a-button type="primary" class="clean-icon" @click.stop="close">{{ t('关闭') }}</a-button>
|
||||||
</template>
|
</template>
|
||||||
<template #full>
|
<template #full>
|
||||||
<LookTask v-if="visible" :taskId="props.taskId" :processId="props.processId" />
|
<LookTask v-if="visible" :taskId="props.taskId" :processId="props.processId" :schemaId="props.schemaId"/>
|
||||||
</template>
|
</template>
|
||||||
</ProcessLayout>
|
</ProcessLayout>
|
||||||
</span>
|
</span>
|
||||||
@ -22,20 +22,20 @@
|
|||||||
import { onActivated, onMounted, ref } from 'vue';
|
import { onActivated, onMounted, ref } from 'vue';
|
||||||
import { useI18n } from '/@/hooks/web/useI18n';
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
const props = withDefaults(
|
||||||
processId: {
|
defineProps<{
|
||||||
type: String,
|
processId: string;
|
||||||
default: ''
|
taskId: string;
|
||||||
},
|
schemaId: string;
|
||||||
taskId: {
|
visible?: boolean;
|
||||||
type: String,
|
}>(),
|
||||||
default: ''
|
{
|
||||||
},
|
processId: '',
|
||||||
visible: {
|
taskId: '',
|
||||||
type: Boolean,
|
schemaId: '',
|
||||||
default: false
|
visible: false,
|
||||||
},
|
},
|
||||||
})
|
);
|
||||||
let emits = defineEmits(['close']);
|
let emits = defineEmits(['close']);
|
||||||
let visible = ref(false);
|
let visible = ref(false);
|
||||||
let showLoading = ref(false);
|
let showLoading = ref(false);
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
:taskRecords="data.taskRecords"
|
:taskRecords="data.taskRecords"
|
||||||
:predecessorTasks="selectedPredecessorTasks"
|
:predecessorTasks="selectedPredecessorTasks"
|
||||||
:processId="props.processId"
|
:processId="props.processId"
|
||||||
|
:schemaId="props.schemaId"
|
||||||
position="top"
|
position="top"
|
||||||
>
|
>
|
||||||
<FormInformation
|
<FormInformation
|
||||||
|
|||||||
@ -19,8 +19,9 @@
|
|||||||
:class="activeIndex == index ? 'form-name actived' : 'form-name'"
|
:class="activeIndex == index ? 'form-name actived' : 'form-name'"
|
||||||
>
|
>
|
||||||
<span :class="item.validate ? 'dot' : 'dot validate'"></span>
|
<span :class="item.validate ? 'dot' : 'dot validate'"></span>
|
||||||
<div class="icon-box"> <IconFontSymbol icon="formItem" /> </div
|
<div class="icon-box">
|
||||||
><span @click="changeActiveIndex(index)" v-show="showPanel">{{ item.formName }}</span>
|
<IconFontSymbol icon="formItem" />
|
||||||
|
</div><span @click="changeActiveIndex(index)" v-show="showPanel">{{ item.formName }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -38,25 +39,11 @@
|
|||||||
<div id="approveExtendButton"></div>
|
<div id="approveExtendButton"></div>
|
||||||
<div id="approveRightButton"></div>
|
<div id="approveRightButton"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="top-toolbar">
|
<SystemForm class="form-box" v-if="item.formType == FormType.SYSTEM"
|
||||||
<SystemForm
|
:systemComponent="item.systemComponent" :isViewProcess="props.disabled" :formModel="item.formModel"
|
||||||
class="form-box"
|
:workflowConfig="item" :ref="setItemRef" />
|
||||||
v-if="item.formType == FormType.SYSTEM"
|
<SimpleForm v-else-if="item.formType == FormType.CUSTOM" class="form-box testClass" :ref="setItemRef"
|
||||||
:systemComponent="item.systemComponent"
|
:formProps="item.formProps" :formModel="item.formModel" :isWorkFlow="true" />
|
||||||
:isViewProcess="props.disabled"
|
|
||||||
:formModel="item.formModel"
|
|
||||||
:workflowConfig="item"
|
|
||||||
:ref="setItemRef"
|
|
||||||
/>
|
|
||||||
<SimpleForm
|
|
||||||
v-else-if="item.formType == FormType.CUSTOM"
|
|
||||||
class="form-box"
|
|
||||||
:ref="setItemRef"
|
|
||||||
:formProps="item.formProps"
|
|
||||||
:formModel="item.formModel"
|
|
||||||
:isWorkFlow="true"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -383,7 +370,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleCancel() {
|
function handleCancel() {
|
||||||
itemRefs.value[activeIndex.value].setDisabledForm(true);
|
itemRefs.value[activeIndex.value].setDisabledForm(true);
|
||||||
forms.modes[activeIndex.value] = 'view';
|
forms.modes[activeIndex.value] = 'view';
|
||||||
itemRefs.value[activeIndex.value].setFieldsValue(forms.formModels[activeIndex.value]);
|
itemRefs.value[activeIndex.value].setFieldsValue(forms.formModels[activeIndex.value]);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<FlowPanel
|
<FlowPanel
|
||||||
v-if="visible"
|
v-if="visible"
|
||||||
:tab-position="position ? position : 'top'"
|
:tab-position="position ? position : 'top'"
|
||||||
:xml="data.xml"
|
:xml="data.xml"
|
||||||
@ -7,7 +7,12 @@
|
|||||||
:predecessorTasks="[]"
|
:predecessorTasks="[]"
|
||||||
:processId="props.processId"
|
:processId="props.processId"
|
||||||
position="top"
|
position="top"
|
||||||
>
|
:currentTaskInfo="data.currentTaskInfo"
|
||||||
|
:currentTaskAssigneeNames="data.currentTaskAssigneeNames"
|
||||||
|
:currentTaskAssignees="data.currentTaskAssignees"
|
||||||
|
:schemaId="props.schemaId"
|
||||||
|
:formDataId="data.formInfos[0].formData.id"
|
||||||
|
:formInfos="data.formInfos">
|
||||||
<FormInformation
|
<FormInformation
|
||||||
:opinionsComponents="data.opinionsComponents"
|
:opinionsComponents="data.opinionsComponents"
|
||||||
:opinions="data.opinions"
|
:opinions="data.opinions"
|
||||||
@ -24,7 +29,7 @@
|
|||||||
import { getApprovalProcess } from '/@/api/workflow/task';
|
import { getApprovalProcess } from '/@/api/workflow/task';
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import userTaskItem from './../../hooks/userTaskItem';
|
import userTaskItem from './../../hooks/userTaskItem';
|
||||||
let props = defineProps(['position', 'processId', 'taskId']);
|
let props = defineProps(['position', 'processId', 'taskId', 'schemaId']);
|
||||||
let visible = ref(false);
|
let visible = ref(false);
|
||||||
const { data, initProcessData } = userTaskItem();
|
const { data, initProcessData } = userTaskItem();
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
@ -32,6 +37,7 @@
|
|||||||
let res = await getApprovalProcess(props.taskId, props.processId);
|
let res = await getApprovalProcess(props.taskId, props.processId);
|
||||||
initProcessData(res);
|
initProcessData(res);
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
|
console.error('555555', data)
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user