costEdit.vue
2.44 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
<template>
<BasicDrawer
v-cloakv-bind="$attrs"
@register="register"
title="编辑"
width="35%"
showFooter
@ok="handleSubmit"
ref="formRef"
okText="保存"
:destroyOnClose="true"
:isDetail="true"
:showDetailBack="false"
:mask="false"
class="z-20"
>
<a-space direction="vertical" style="width: 100%">
<a-input v-model:value="fixCost" addonBefore="固定成本 " />
<a-input v-model:value="ratio" addonBefore="提成比例 " />
<a-input v-model:value="spainRatio" addonBefore="西班牙提成比例 " />
<a-input v-model:value="price" addonBefore="生产提成单价" />
</a-space>
</BasicDrawer>
</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, onMounted } from 'vue';
import { saveConfig } from '/@/api/sys/config';
// const emit = defineEmits(['success']);
// const isUpdate = ref(true);
const emit = defineEmits(['success']);
const [register, { closeDrawer }] = useDrawerInner((data) => {
listAll.value = data.data;
console.log(listAll.value, '5656listAll.value');
relationValue.value = JSON.parse(listAll.value.relationValue);
fixCost.value = relationValue.value[0].relationValue;
ratio.value = relationValue.value[1].relationValue;
spainRatio.value = relationValue.value[2].relationValue;
price.value = relationValue.value[3].relationValue;
});
//获取现有的列表
const listAll = ref();
const fixCost = ref();
const ratio = ref();
const spainRatio = ref();
const price = ref();
const relationValue = ref();
//完成编辑
async function handleSubmit() {
relationValue.value[0].relationValue = fixCost.value;
relationValue.value[1].relationValue = ratio.value;
relationValue.value[2].relationValue = spainRatio.value;
relationValue.value[3].relationValue = price.value;
console.log(relationValue.value, '5656relationValue.value');
await saveConfig({
id: listAll.value.id,
settingCode: 'customerCode',
settingName: '客户提成成本配置',
settingValue: listAll.value.settingValue,
settingType: 3,
relationCode: 'costSettingItem',
relationName: '成本配置项集合',
costSettingItemVOS: relationValue.value,
});
emit('success');
closeDrawer();
}
</script>