Commit 2d13a7d7d0be3d71da746bc9ba467d7cde54c3da

Authored by
1 parent 1b441296

fix: 系统配置提成成本配置编辑表单逻辑修改

src/views/project/config/costEdit.vue
... ... @@ -32,25 +32,32 @@
32 32 const emit = defineEmits(['success']);
33 33  
34 34 const [register, { closeDrawer }] = useDrawerInner((data) => {
  35 + // 先重置所有字段
  36 + fixCost.value = '';
  37 + ratio.value = '';
  38 + spainRatio.value = '';
  39 + copyCommission.value = '';
  40 + year.value = '';
  41 +
  42 + // 再赋值新数据
35 43 listAll.value = data.data;
36 44 relationValue.value = JSON.parse(listAll.value.relationValue);
37   - fixCost.value = relationValue.value[0].relationValue;
38   - // 将小数转换为百分比格式显示
39   - ratio.value = relationValue.value[1].relationValue
40   - ? (parseFloat(relationValue.value[1].relationValue) * 100).toFixed(2) + '%'
  45 + fixCost.value = relationValue.value[0]?.relationValue || '';
  46 + ratio.value = relationValue.value[1]?.relationValue
  47 + ? (parseFloat(relationValue.value[1].relationValue) * 100).toFixed(2) + '%'
41 48 : '';
42   - spainRatio.value = relationValue.value[2].relationValue
43   - ? (parseFloat(relationValue.value[2].relationValue) * 100).toFixed(2) + '%'
  49 + spainRatio.value = relationValue.value[2]?.relationValue
  50 + ? (parseFloat(relationValue.value[2].relationValue) * 100).toFixed(2) + '%'
44 51 : '';
45   - copyCommission.value = relationValue.value[3].relationValue;
46   - year.value = listAll.value.relationName;
  52 + copyCommission.value = relationValue.value[3]?.relationValue || '';
  53 + year.value = listAll.value.relationName || '';
47 54 });
48 55 //获取现有的列表
49 56 const listAll = ref();
50 57 const fixCost = ref();
51 58 const ratio = ref();
52 59 const spainRatio = ref();
53   - const copyCommission = ref('');
  60 + const copyCommission = ref();
54 61 const relationValue = ref();
55 62 const year = ref();
56 63  
... ...