|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<template>
<BasicModal
v-bind="$attrs"
@register="register"
title="提交审核"
width="500px"
:bodyStyle="{ height: '240px' }"
@ok="handleOk"
>
请选择日期:
<a-date-picker v-model:value="date" />
<div style="height: 10px"></div>
请选择收款单位:
|
|
14
|
<a-select v-model:value="payee" style="width: 100%; padding: 5px; border-radius: 4px">
|
|
15
16
17
18
19
20
21
22
23
|
<option value="翱特建行城阳支行-美元(5107)">翱特建行城阳支行-美元(5107)</option>
<option value="吉庆建行城阳支行-美元(4820)">吉庆建行城阳支行-美元(4820)</option>
</a-select>
</BasicModal>
</template>
<script lang="ts" setup>
import { BasicModal, useModalInner } from '@/components/Modal';
import { ref } from 'vue';
import { commit } from '@/api/project/invoice';
|
|
24
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
25
26
27
28
|
const id = ref();
const payee = ref();
const date = ref();
|
|
29
|
const emit = defineEmits(['success']);
|
|
30
31
|
const { createMessage } = useMessage();
const { error } = createMessage;
|
|
32
|
const [register, { closeModal }] = useModalInner(async (data) => {
|
|
33
|
id.value = data.checkedKeys;
|
|
34
35
36
37
38
39
40
41
42
43
44
45
46
|
});
function formatDate(input: string): string {
// 创建一个 Date 对象
const date = new Date(input);
// 获取年月日
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,所以要加 1
const day = String(date.getDate()).padStart(2, '0');
// 返回格式化后的日期字符串
return `${year}-${month}-${day}`;
}
|
|
47
|
const isDisabled = ref(false);
|
|
48
|
async function handleOk() {
|
|
49
50
51
52
|
if (isDisabled.value) {
error('请勿连续点击生成按钮,需要等待三秒再点击生成');
return;
}
|
|
53
|
const formattedDate = formatDate(date.value);
|
|
54
55
56
57
|
isDisabled.value = true;
setTimeout(() => {
isDisabled.value = false;
}, 3000);
|
|
58
|
commit({ id: id.value, actualRefundDate: formattedDate, payee: payee.value });
|
|
59
|
emit('success');
|
|
60
61
62
|
closeModal();
}
</script>
|