progress.vue 1.43 KB
<template>
  <div>
    <el-progress :percentage="num" :format="format" />
  </div>
</template>

<script setup >
import { ref, watch } from 'vue'
const props = defineProps({
  row: {
    type: Object,
    default: () => {
      return {}
    }
  }
})

const num = ref(0)
const format = ref()
watch(() => props.row, (newV) => {
  if (newV) {
    num.value = newV.schedule
    if (newV.type == 1) {
      // 省外调动
      if (num.value == 0) {
        format.value = (percentage) => {
          percentage = 0 + '/' + 2 
          return percentage
        }
      }
      if (num.value == 50) {
        format.value = (percentage) => {
          percentage = 1 + '/' + 2 
          return percentage
        }
      }
      if (num.value == 100) {
        format.value = (percentage) => {
          percentage = 2 + '/' + 2 
          return percentage
        }
      }
    } else {
      if (num.value == 0) {
        format.value = (percentage) => {
          percentage = 0 + '/' + 1 
          return percentage
        }
      }
      // if (num.value == 50) {
      //   format.value = (percentage) => {
      //     percentage = 1 + '/' + 1
      //     return percentage
      //   }
      // }
      if (num.value == 100) {
        format.value = (percentage) => {
          percentage = 1 + '/' + 1 
          return percentage
        }
      }
    }
  }
}, { deep: true, immediate: true })


defineExpose({
  open

})
</script>

<style scope>

</style>