TrackEditCheck.vue
4.41 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
<template>
<template>
<BasicDrawer
@register="register"
v-bind="$attrs"
title="跟单编辑"
width="30%"
:isDetail="true"
@ok="handleSubmit"
:showDetailBack="false"
@visible-change="handleShow"
okText="保存"
showFooter
:destroyOnClose="true"
>
<div>
<div style="font-size: 15px">生产科扣款金额¥</div>
<a-input v-model:value="input1" placeholder="请输入" :disabled="status === 10" auto-size />
<div style="margin: 16px 0"></div>
<div style="font-size: 15px">扣款责任部门</div>
<a-input
v-model:value="deductDept"
placeholder="请输入"
:disabled="status === 10"
auto-size
/>
<!-- <a-select
ref="select"
style="width: 60%"
v-model:value="selectedProductionDepartment"
:options="productionDepartmentOptions"
/> -->
<!-- <a-select
ref="select"
style="width: 100%"
v-model:value="productionDepartment"
:options="productDepartmentOptions"
/> -->
<div style="margin: 16px 0"></div>
<div>上传扣款单</div
><a-space direction="vertical" style="width: 100%" size="large">
<a-upload
v-model:file-list="fileList"
:beforeUpload="beforeUpload"
list-type="picture"
:max-count="1"
:disabled="status === 10"
:action="updateDeductUrl"
@change="handleChange"
>
<a-button> 上传扣款单 </a-button>
</a-upload>
</a-space>
</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 { defineComponent, ref, computed, unref, toRaw, reactive, onMounted } from 'vue';
import { getEmailList } from '/@/api/sys/config';
import { UploadOutlined } from '@ant-design/icons-vue';
import type { UploadProps } from 'ant-design-vue';
import { updateDeductInfo } from '@/api/project/invoice';
import { useMessage } from '/@/hooks/web/useMessage';
const emit = defineEmits(['success']);
const fileList = ref<UploadProps['fileList']>([]);
const input1 = ref(0);
const deductUrl = ref();
const id = ref();
const checkNo = ref();
const deductDept = ref();
const uploadUrl = ref('http://47.104.8.35:80/api/localStorage/upload_file_oss?name=');
const updateDeductUrl = ref('http://47.104.8.35:80/api/localStorage/upload_file_oss?name=');
// const uploadUrl = ref('');
// const updateDeductUrl = ref('');
const deductUrlOld = ref();
const { createMessage } = useMessage();
const { error } = createMessage;
const status = ref();
const [register, { setDrawerProps, closeDrawer }] = useDrawerInner((data) => {
status.value = data.data.checkPayStatus;
id.value = data.data.checkId;
checkNo.value = data.data.checkNo;
input1.value = data.data.checkDeductAmount;
deductDept.value = data.data.checkDeductDept;
deductUrl.value = data.data.checkDeductUrl;
deductUrlOld.value = data.data.checkDeductUrl;
});
function handleChange(info) {
if (info.file.status == 'done') {
updateDeductUrl.value = info.file.response.data.fileUrl;
deductUrl.value = updateDeductUrl.value;
}
if (info.fileList.length == 0) {
info.file = null;
deductUrl.value = '';
}
}
function beforeUpload(info) {
updateDeductUrl.value = uploadUrl.value + info.name;
}
function handleShow() {
// input1.value = '';
// deductUrl.value = '';
// deductDept.value = '';
// updateDeductUrl.value = '';
// fileList.value = [];
}
//完成编辑
async function handleSubmit() {
if (!input1.value || !deductDept.value) {
error('选项不能为空');
} else {
await updateDeductInfo({
id: id.value,
checkNo: checkNo.value,
deductAmount: input1.value,
deductDept: deductDept.value,
deductUrl: deductUrl.value,
});
// productionDepartment: selectedProductionDepartment.value,
fileList.value = [];
emit('success');
closeDrawer();
}
}
</script>