ProduCostCreate.vue
3.56 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
<template>
<BasicModal
v-bind="$attrs"
destroyOnClose
@register="register"
title="创建配置"
width="600px"
@visible-change="handleShow"
@ok="handleOk"
>
<a-space direction="vertical" style="width: 100%">
<div
><span style="margin-right: 8px">客户编码:</span>
<a-select
ref="select"
style="width: 100%"
v-model:value="customerCode"
:options="customerCodeOptions"
/></div>
<div
><span style="margin-right: 8px; width: 80%">固定成本:</span>
<a-input v-model:value="fixCost"
/></div>
<div
><span style="margin-right: 8px; width: 80%">提成单价:</span>
<a-input v-model:value="ratio" />
</div>
</a-space>
</BasicModal>
</template>
<script lang="ts">
import { defineComponent, ref, defineEmits } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { orderGravity } from '/@/api/project/order';
import { useOrderStoreWithOut } from '/@/store/modules/order';
import { useOrderInfo } from '/@/hooks/component/order';
import { BasicForm, useForm } from '/@/components/Form/index';
import { addConfig } from '/@/api/sys/config';
export default defineComponent({
components: { BasicModal, BasicForm },
props: {
column: { type: Number },
},
emits: ['modal-success'],
setup(props, { emit }) {
const orderStore = useOrderStoreWithOut();
const loading = ref(true);
const activeUser = ref();
const info = ref();
const [register, { setModalProps, closeModal }] = useModalInner(async (data) => {
listAll.value = data;
});
//获取现有的列表
const listAll = ref();
const fixCost = ref();
const ratio = ref();
// const relationValue = ref();
const customerCode = ref();
const relationValue = ref([
{
relationCode: 'fixCost',
relationName: '固定成本',
relationValue: '',
},
{
relationCode: 'ratio',
relationName: '提成比例',
relationValue: '',
},
]);
// const loading = ref(true);
const { customerCode: customerCodeOptions } = useOrderInfo(orderStore);
function handleShow(visible: boolean) {
if (visible) {
loading.value = true;
// setModalProps({ loading: true, confirmLoading: true });
setModalProps({ loading: false, confirmLoading: false });
}
}
async function handleOk() {
try {
relationValue.value[0].relationValue = fixCost.value;
relationValue.value[1].relationValue = ratio.value;
await addConfig({
settingCode: 'customerCode',
settingName: '生产提成成本配置',
settingValue: customerCode.value,
settingType: 4,
relationCode: 'ProduceSettingItem',
relationName: '成本配置项集合',
costSettingItemVOS: relationValue.value,
});
emit('modal-success');
closeModal();
} catch (error) {
console.log('%c [ error ]-108', 'font-size:13px; background:pink; color:#bf2c9f;', error);
}
}
return {
register,
loading,
handleShow,
info,
activeUser,
fixCost,
ratio,
customerCode,
customerCodeOptions,
handleOk,
};
},
});
</script>
<style scoped>
.empty-tips {
height: 100px;
line-height: 100px;
text-align: center;
}
</style>