FinanceEditCheck.vue
4.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<template>
<template>
<BasicDrawer
@register="register"
v-bind="$attrs"
title="编辑"
width="30%"
:isDetail="true"
@ok="handleSubmit"
:showDetailBack="false"
okText="保存"
showFooter
:destroyOnClose="true"
>
<!-- <div>
<BasicForm @register="registerForm" />
</div> -->
<div style="font-size: 15px">实际付款金额1¥</div>
<a-input v-model:value="input1" placeholder="请输入" :disabled="status === 10" auto-size />
<div style="margin: 16px 0"></div>
<div style="font-size: 15px">实际付款金额2¥</div>
<a-input v-model:value="input2" placeholder="请输入" :disabled="status === 10" auto-size />
<div style="margin: 16px 0"></div>
<div style="font-size: 15px">实际付款金额3¥</div>
<a-input v-model:value="input3" placeholder="请输入" :disabled="status === 10" auto-size />
<div style="margin: 16px 0"></div>
<!-- <template #titleToolbar> <a-button type="primary"> 申请编辑权限 </a-button></template> -->
<template #appendFooter>
<!-- <a-button type="primary" @click="onGoCheckDetail"> 申请权限</a-button> -->
</template>
</BasicDrawer>
</template>
</template>
<script lang="ts" setup>
import { BasicDrawer, useDrawerInner } from '@/components/Drawer';
import { BasicForm, FormSchema, useForm } from '@/components/Form';
import { defineComponent, ref, computed, unref, toRaw, reactive } from 'vue';
import { getEmailList } from '/@/api/sys/config';
import { updateAmountInfo } from '@/api/project/invoice';
import { useMessage } from '/@/hooks/web/useMessage';
const emit = defineEmits(['success']);
const schemas: FormSchema[] = [
// {
// field: 'actualPayedAmount',
// component: 'InputNumber',
// labelWidth: 250,
// colProps: {
// span: 23,
// },
// label: '生产科实际应付金额',
// },
{
field: 'actualPayedAmount1',
component: 'InputNumber',
labelWidth: 250,
colProps: {
span: 23,
},
label: '实际应付金额1¥',
componentProps: () => ({
disabled: status.value === 10,
}),
},
{
field: 'actualPayedAmount2',
component: 'InputNumber',
labelWidth: 250,
colProps: {
span: 23,
},
label: '实际应付金额2¥',
componentProps: () => ({
disabled: status.value === 10,
}),
},
{
field: 'actualPayedAmount3',
component: 'InputNumber',
labelWidth: 250,
colProps: {
span: 23,
},
label: '实际应付金额3¥',
componentProps: () => ({
disabled: status.value === 10,
}),
},
];
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
labelWidth: 120,
schemas,
layout: 'vertical',
showActionButtonGroup: false,
actionColOptions: {
span: 24,
},
});
const { createMessage } = useMessage();
const { error } = createMessage;
const update = ref();
const status = ref();
const input1 = ref();
const input2 = ref();
const input3 = ref();
const id = ref();
const [register, { setDrawerProps, closeDrawer }] = useDrawerInner((data) => {
// 方式1
resetFields();
status.value = data.data.status;
id.value = data.data.id;
input1.value = data.data.actualPayedAmount1;
input2.value = data.data.actualPayedAmount2;
input3.value = data.data.actualPayedAmount3;
setDrawerProps({ confirmLoading: false });
// 将金额格式化为两位小数
// setFieldsValue({
// actualPayedAmount1:
// data.data.actualPayedAmount1 !== null ? data.data.actualPayedAmount1.toFixed(2) : undefined,
// actualPayedAmount2:
// data.data.actualPayedAmount2 !== null ? data.data.actualPayedAmount2.toFixed(2) : undefined,
// actualPayedAmount3:
// data.data.actualPayedAmount3 !== null ? data.data.actualPayedAmount3.toFixed(2) : undefined,
// ...toRaw(data.data), // 其他字段
// });
setFieldsValue({
...toRaw(data.data),
});
update.value = data;
});
//完成编辑
async function handleSubmit() {
// const values = await validate();
// const updatedValues = {
// ...values,
// id: update.value.data.id,
// };
if (!input1.value || !input2.value || !input3.value) {
error('选项不能为空');
} else {
await updateAmountInfo({
id: id.value,
actualPayedAmount1: input1.value,
actualPayedAmount2: input2.value,
actualPayedAmount3: input3.value,
});
emit('success');
closeDrawer();
}
}
</script>