parent
7ca161ed75
commit
2e4ae78ee0
@ -0,0 +1,26 @@
|
|||||||
|
<!-- 审批终止 Modal弹窗的content属性专用 用于填写审批意见 -->
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { Textarea } from 'ant-design-vue';
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'ApprovalContent',
|
||||||
|
inheritAttrs: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
defineProps<{ description: string; value: string }>();
|
||||||
|
|
||||||
|
defineEmits<{ 'update:value': [string] }>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flex flex-col gap-2">
|
||||||
|
<div>{{ description }}</div>
|
||||||
|
<Textarea
|
||||||
|
:allow-clear="true"
|
||||||
|
:auto-size="true"
|
||||||
|
:value="value"
|
||||||
|
placeholder="审批意见(可选)"
|
||||||
|
@change="(e) => $emit('update:value', e.target.value!)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
import { defineComponent, h, ref } from 'vue';
|
||||||
|
|
||||||
|
import { Modal } from 'ant-design-vue';
|
||||||
|
|
||||||
|
import ApprovalContent from './approval-content.vue';
|
||||||
|
|
||||||
|
export interface ApproveWithReasonModalProps {
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
onOk: (reason: string) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 带审批意见的confirm
|
||||||
|
* @param props props
|
||||||
|
*/
|
||||||
|
export function approveWithReasonModal(props: ApproveWithReasonModalProps) {
|
||||||
|
const { onOk, title, description } = props;
|
||||||
|
const content = ref('');
|
||||||
|
Modal.confirm({
|
||||||
|
title,
|
||||||
|
content: h(
|
||||||
|
defineComponent({
|
||||||
|
setup() {
|
||||||
|
return () =>
|
||||||
|
h(ApprovalContent, {
|
||||||
|
description,
|
||||||
|
value: content.value,
|
||||||
|
'onUpdate:value': (v) => (content.value = v),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
centered: true,
|
||||||
|
okButtonProps: { danger: true },
|
||||||
|
onOk: () => onOk(content.value),
|
||||||
|
});
|
||||||
|
}
|
||||||
Loading…
Reference in new issue