|
|
|
@ -13,12 +13,14 @@
|
|
|
|
|
</BasicModal>
|
|
|
|
|
</template>
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { unref, ref } from 'vue';
|
|
|
|
|
import { unref, ref, reactive } from 'vue';
|
|
|
|
|
import { FormSchema } from '@/components/Table';
|
|
|
|
|
import { BasicModal, useModalInner } from '@/components/Modal';
|
|
|
|
|
import { BasicForm, useForm } from '@/components/Form';
|
|
|
|
|
import { saveFormsData } from '@/api/formrender/index';
|
|
|
|
|
import { useMessage } from '@/hooks/web/useMessage';
|
|
|
|
|
import { useUserStore } from '@/store/modules/user';
|
|
|
|
|
import { create, saveDraft } from '@/api/sys/WFProcess';
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['success']);
|
|
|
|
|
const { createMessage } = useMessage();
|
|
|
|
@ -29,6 +31,14 @@
|
|
|
|
|
const primaryQuery = ref();
|
|
|
|
|
const addQuery: any = ref([]);
|
|
|
|
|
const formColumns: FormSchema[] = [];
|
|
|
|
|
const flowCode = ref('');
|
|
|
|
|
const userStore = useUserStore();
|
|
|
|
|
const userInfo: any = userStore.getUserInfo;
|
|
|
|
|
const formData = reactive({
|
|
|
|
|
userId: userInfo.id,
|
|
|
|
|
title: '',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const [registerModal, { setModalProps, closeModal }] = useModalInner((data: any) => {
|
|
|
|
|
console.log('daaaaa', data);
|
|
|
|
|
isUpdate.value = !!data?.isUpdate;
|
|
|
|
@ -45,6 +55,11 @@
|
|
|
|
|
}
|
|
|
|
|
formColumns.push(item);
|
|
|
|
|
});
|
|
|
|
|
data.btnList.forEach((element) => {
|
|
|
|
|
if (element.prop === 'Add' && element.isWFlow) {
|
|
|
|
|
flowCode.value = element.wFlowCode;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (!unref(isUpdate) && !unref(isDetail)) {
|
|
|
|
|
getTitle.value = '新增';
|
|
|
|
|
}
|
|
|
|
@ -123,8 +138,12 @@
|
|
|
|
|
const data = await saveFormsData(params);
|
|
|
|
|
if (data) {
|
|
|
|
|
setModalProps({ confirmLoading: true });
|
|
|
|
|
closeModal();
|
|
|
|
|
emit('success');
|
|
|
|
|
if (flowCode.value == '') {
|
|
|
|
|
closeModal();
|
|
|
|
|
} else {
|
|
|
|
|
handleCreateFlow(params.pkeyValue);
|
|
|
|
|
}
|
|
|
|
|
return createMessage.success('操作成功');
|
|
|
|
|
} else {
|
|
|
|
|
return createMessage.error('操作失败');
|
|
|
|
@ -133,4 +152,25 @@
|
|
|
|
|
setModalProps({ confirmLoading: false });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
async function handleCreateFlow(processId) {
|
|
|
|
|
var querys = {
|
|
|
|
|
schemeCode: flowCode.value,
|
|
|
|
|
userId: formData.userId,
|
|
|
|
|
title: formData.title,
|
|
|
|
|
processId: processId,
|
|
|
|
|
};
|
|
|
|
|
const draft = await saveDraft(querys);
|
|
|
|
|
if (draft) {
|
|
|
|
|
querys.schemeCode = '';
|
|
|
|
|
const data = await create(querys);
|
|
|
|
|
if (data) {
|
|
|
|
|
closeModal();
|
|
|
|
|
return createMessage.success('发起流程成功');
|
|
|
|
|
} else {
|
|
|
|
|
return createMessage.error('发起流程失败');
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return createMessage.error('保存草稿失败');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|