|
|
|
@ -1,9 +1,14 @@
@@ -1,9 +1,14 @@
|
|
|
|
|
PushThirdPartyModal<template> |
|
|
|
|
<template> |
|
|
|
|
<BasicModal v-bind="$attrs" |
|
|
|
|
width="720px" |
|
|
|
|
:showCancelBtn="false" |
|
|
|
|
okText="通过" |
|
|
|
|
@register="registerModal" |
|
|
|
|
@ok="handleSubmit" |
|
|
|
|
> |
|
|
|
|
<template #centerFooter> |
|
|
|
|
<a-button danger type="primary" @click="handleReject">驳回</a-button> |
|
|
|
|
</template> |
|
|
|
|
<BasicForm @register="registerForm"/> |
|
|
|
|
</BasicModal> |
|
|
|
|
</template> |
|
|
|
@ -14,17 +19,17 @@ PushThirdPartyModal<template>
@@ -14,17 +19,17 @@ PushThirdPartyModal<template>
|
|
|
|
|
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
|
|
|
|
* author entfrm开发团队-王翔 |
|
|
|
|
*/ |
|
|
|
|
import { ref, unref } from 'vue'; |
|
|
|
|
import { BasicForm, useForm } from '/@/components/Form/index'; |
|
|
|
|
import { formSchema } from './thirdParty.data'; |
|
|
|
|
import { addPushThirdParty, editPushThirdParty, getPushThirdParty } from '/@/api/platform/common/controller/pushThirdParty'; |
|
|
|
|
import { editPushThirdParty, getPushThirdParty, delPushThirdParty } from '/@/api/platform/common/controller/pushThirdParty'; |
|
|
|
|
import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal'; |
|
|
|
|
import { ref } from 'vue'; |
|
|
|
|
import {useMessage} from '/@/hooks/web/useMessage'; |
|
|
|
|
|
|
|
|
|
/** 通用变量统一声明区域 */ |
|
|
|
|
const tag = ref<Nullable<string>>(''); |
|
|
|
|
/** https://v3.cn.vuejs.org/api/options-data.html#emits */ |
|
|
|
|
const { createMessage } = useMessage(); |
|
|
|
|
const id = ref<string>(''); |
|
|
|
|
const emit = defineEmits(['success', 'register']); |
|
|
|
|
const [registerForm, { resetFields, setFieldsValue, validate, clearValidate, updateSchema }] = useForm({ |
|
|
|
|
const [registerForm, { resetFields, setFieldsValue, validate, clearValidate, updateSchema, setProps }] = useForm({ |
|
|
|
|
labelWidth: 100, |
|
|
|
|
schemas: formSchema, |
|
|
|
|
showActionButtonGroup: false, |
|
|
|
@ -35,41 +40,31 @@ PushThirdPartyModal<template>
@@ -35,41 +40,31 @@ PushThirdPartyModal<template>
|
|
|
|
|
await resetFields(); |
|
|
|
|
await clearValidate(); |
|
|
|
|
// 处理设置数据 |
|
|
|
|
tag.value = data._tag; |
|
|
|
|
const refId = data.record?.id; |
|
|
|
|
id.value = data.record?.id; |
|
|
|
|
const props: Partial<ModalProps> = { confirmLoading: false }; |
|
|
|
|
// 采用tag标签区分操作 |
|
|
|
|
switch (unref(tag)) { |
|
|
|
|
case 'add': |
|
|
|
|
props.title = '新增第三方申请'; |
|
|
|
|
break; |
|
|
|
|
case 'edit': |
|
|
|
|
props.title = '编辑第三方申请'; |
|
|
|
|
await setFieldsValue(await getPushThirdParty(refId)); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
props.title = '审批企业申请'; |
|
|
|
|
await setFieldsValue(await getPushThirdParty(id.value)); |
|
|
|
|
await setProps({ disabled: true }); |
|
|
|
|
// 尾部:设置处理后的最终配置数据 |
|
|
|
|
setModalProps(props); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
/** 处理弹出框提交 */ |
|
|
|
|
async function handleReject() { |
|
|
|
|
await delPushThirdParty(id.value); |
|
|
|
|
closeModal(); |
|
|
|
|
createMessage.info('审核驳回!'); |
|
|
|
|
emit('success'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async function handleSubmit() { |
|
|
|
|
try { |
|
|
|
|
// 提取验证数据 |
|
|
|
|
const formData = await validate(); |
|
|
|
|
// 处理提交之前逻辑 |
|
|
|
|
formData.status = '1'; |
|
|
|
|
setModalProps({ confirmLoading: true }); |
|
|
|
|
// 采用tag标签区分操作 |
|
|
|
|
switch (unref(tag)) { |
|
|
|
|
case 'add': |
|
|
|
|
await addPushThirdParty(formData); |
|
|
|
|
break; |
|
|
|
|
case 'edit': |
|
|
|
|
await editPushThirdParty(formData); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
// 处理提交完成之后逻辑 |
|
|
|
|
await editPushThirdParty(formData); |
|
|
|
|
closeModal(); |
|
|
|
|
createMessage.success('审核通过!'); |
|
|
|
|
emit('success'); |
|
|
|
|
} finally { |
|
|
|
|
setModalProps({ confirmLoading: false }); |
|
|
|
|