<script setup lang="ts">
import ConfigTemplate from '../../ConfigTemplate.vue'

const props = defineProps<{ node: any }>()

const role = inject('role') as string

const form = reactive({
  a: 60,
  b: 40
})
watchEffect(() => {
  Object.assign(form, props.node.data[role])
})

watchEffect(() => {
  form.b = 100 - (form.a || 0)
})
</script>

<template>
  <ConfigTemplate :model="form" :node="node">
    <el-form-item label="A路径">
      <el-input-number v-model="form.a" :max="100" :min="0" :controls="false" style="width: 100%" />
    </el-form-item>
    <el-form-item label="B路径">
      <el-input-number v-model="form.b" :controls="false" disabled style="width: 100%" />
    </el-form-item>
  </ConfigTemplate>
</template>
