柏杨
authored
12 months ago
1
2
3
4
5
<template>
<template>
<BasicDrawer
@register="register"
v-bind="$attrs"
柏杨
authored
11 months ago
6
title="跟单编辑"
柏杨
authored
12 months ago
7
8
9
10
width="30%"
:isDetail="true"
@ok="handleSubmit"
:showDetailBack="false"
11
@visible-change="handleShow"
柏杨
authored
12 months ago
12
13
14
15
16
okText="保存"
showFooter
:destroyOnClose="true"
>
<div>
17
<div style="font-size: 15px">生产科扣款金额¥</div>
18
<a-input v-model:value="input1" placeholder="请输入" :disabled="status === 10" auto-size />
柏杨
authored
12 months ago
19
20
<div style="margin: 16px 0"></div>
<div style="font-size: 15px">扣款责任部门</div>
21
22
23
24
25
26
27
28
29
30
31
32
<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"
/> -->
33
34
35
36
37
38
<!-- <a-select
ref="select"
style="width: 100%"
v-model:value="productionDepartment"
:options="productDepartmentOptions"
/> -->
柏杨
authored
12 months ago
39
40
41
42
43
<div style="margin: 16px 0"></div>
<div>上传扣款单</div
><a-space direction="vertical" style="width: 100%" size="large">
<a-upload
v-model:file-list="fileList"
柏杨
authored
11 months ago
44
:beforeUpload="beforeUpload"
柏杨
authored
12 months ago
45
46
list-type="picture"
:max-count="1"
47
:disabled="status === 10"
柏杨
authored
11 months ago
48
49
:action="updateDeductUrl"
@change="handleChange"
柏杨
authored
12 months ago
50
>
柏杨
authored
11 months ago
51
<a-button> 上传扣款单 </a-button>
柏杨
authored
12 months ago
52
53
54
55
56
57
58
59
60
61
62
63
</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';
64
import { defineComponent, ref, computed, unref, toRaw, reactive, onMounted } from 'vue';
柏杨
authored
12 months ago
65
66
67
import { getEmailList } from '/@/api/sys/config';
import { UploadOutlined } from '@ant-design/icons-vue';
import type { UploadProps } from 'ant-design-vue';
柏杨
authored
11 months ago
68
import { updateDeductInfo } from '@/api/project/invoice';
柏杨
authored
10 months ago
69
import { useMessage } from '/@/hooks/web/useMessage';
70
71
import { useOrderInfo } from '/@/hooks/component/order';
import { useOrderStoreWithOut } from '/@/store/modules/order';
柏杨
authored
12 months ago
72
柏杨
authored
11 months ago
73
const emit = defineEmits(['success']);
柏杨
authored
12 months ago
74
const fileList = ref<UploadProps['fileList']>([]);
75
76
77
78
79
80
81
// const orderStore = useOrderStoreWithOut();
// const { productionDepartment: productionDepartmentOptions } = useOrderInfo(orderStore);
// console.log(productionDepartmentOptions.value, '565656565665orderStore');
// onMounted(() => {
// const { productionDepartment } = useOrderInfo(orderStore);
// console.log(productionDepartment.value, '565656565665orderStore1');
// });
82
83
84
85
const orderStore = useOrderStoreWithOut();
const { productionDepartment: productDepartmentOptions } = useOrderInfo(orderStore);
const productionDepartment = ref();
const input1 = ref(0);
柏杨
authored
11 months ago
86
87
88
const deductUrl = ref();
const id = ref();
const checkNo = ref();
89
const deductDept = ref();
90
91
92
93
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('');
柏杨
authored
10 months ago
94
const deductUrlOld = ref();
95
const selectedProductionDepartment = ref(); // 新增: 用于存储选中的生产科
柏杨
authored
10 months ago
96
97
const { createMessage } = useMessage();
const { error } = createMessage;
98
const status = ref();
柏杨
authored
12 months ago
99
100
const [register, { setDrawerProps, closeDrawer }] = useDrawerInner((data) => {
101
status.value = data.data.status;
柏杨
authored
11 months ago
102
103
104
105
106
id.value = data.data.id;
checkNo.value = data.data.checkNo;
input1.value = data.data.deductAmount;
deductDept.value = data.data.deductDept;
deductUrl.value = data.data.deductUrl;
柏杨
authored
10 months ago
107
deductUrlOld.value = data.data.deductUrl;
柏杨
authored
12 months ago
108
});
柏杨
authored
11 months ago
109
110
111
112
113
function handleChange(info) {
if (info.file.status == 'done') {
updateDeductUrl.value = info.file.response.data.fileUrl;
deductUrl.value = updateDeductUrl.value;
}
柏杨
authored
10 months ago
114
115
116
117
if (info.fileList.length == 0) {
info.file = null;
deductUrl.value = '';
}
柏杨
authored
11 months ago
118
119
120
}
function beforeUpload(info) {
updateDeductUrl.value = uploadUrl.value + info.name;
柏杨
authored
12 months ago
121
}
122
function handleShow() {
123
124
125
126
127
// input1.value = '';
// deductUrl.value = '';
// deductDept.value = '';
// updateDeductUrl.value = '';
// fileList.value = [];
128
}
柏杨
authored
12 months ago
129
130
//完成编辑
async function handleSubmit() {
131
if (!input1.value || !deductDept.value) {
柏杨
authored
10 months ago
132
133
error('选项不能为空');
} else {
134
135
136
137
138
139
140
141
142
143
144
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();
柏杨
authored
10 months ago
145
}
柏杨
authored
12 months ago
146
147
}
</script>