RateModal.vue
2.16 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
<template>
<BasicModal
v-bind="$attrs"
destroyOnClose
@register="register"
title="比重计算"
width="600px"
@visible-change="handleShow"
:footer="null"
>
<Space>
<span>
设计师:
<Select :options="manualPreform" placeholder="请选择" v-model:value="activeUser" />
</span>
<a-button type="primary" @click="handleCalc" className="ml-4">计算</a-button>
</Space>
<div className="mt-2">比重结果:{{ info }}</div>
</BasicModal>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { orderGravity } from '/@/api/project/order';
import { Select, Space } from 'ant-design-vue';
import { useOrderStoreWithOut } from '/@/store/modules/order';
import { useOrderInfo } from '/@/hooks/component/order';
export default defineComponent({
components: { BasicModal, Select, Space },
setup() {
const orderStore = useOrderStoreWithOut();
const { manualPreform, exchangeRate } = useOrderInfo(orderStore);
const loading = ref(true);
const activeUser = ref();
const info = ref();
const searchData = ref({});
const [register, { setModalProps }] = useModalInner(async (data) => {
searchData.value = data.data || {};
activeUser.value = undefined;
info.value = '';
});
function handleShow(visible: boolean) {
if (visible) {
loading.value = true;
// setModalProps({ loading: true, confirmLoading: true });
setModalProps({ loading: false, confirmLoading: false });
}
}
async function handleCalc() {
const res = await orderGravity({
...searchData.value,
designer: activeUser.value,
});
info.value = (res?.rate || 0).toFixed(2);
}
return {
register,
loading,
handleShow,
info,
manualPreform,
handleCalc,
activeUser,
exchangeRate,
};
},
});
</script>
<style scoped>
.empty-tips {
height: 100px;
line-height: 100px;
text-align: center;
}
</style>