干燥机配套车间生产管理系统/云平台服务端
baoshiwei
2024-05-27 fa3ac93010bea3805438ee3ab0a182bfbf7423da
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
<template>
  <Progress :class="clazz" :percent="innerValue" size="small" v-bind="cellProps" />
</template>
 
<script lang="ts">
  import { computed, defineComponent } from 'vue';
  import { Progress } from 'ant-design-vue';
  import { JVxeComponent } from '/@/components/jeecg/JVxeTable/types';
  import { useJVxeComponent, useJVxeCompProps } from '/@/components/jeecg/JVxeTable/hooks';
 
  export default defineComponent({
    name: 'JVxeCheckboxCell',
    components: { Progress },
    props: useJVxeCompProps(),
    setup(props: JVxeComponent.Props) {
      const { innerValue, cellProps, scrolling } = useJVxeComponent(props);
      const clazz = computed(() => {
        return {
          'j-vxe-progress': true,
          'no-animation': scrolling.value,
        };
      });
      return { innerValue, cellProps, clazz };
    },
    // 【组件增强】注释详见::JVxeComponent.Enhanced
    enhanced: {
      switches: {
        editRender: false,
      },
      setValue(value) {
        try {
          if (typeof value !== 'number') {
            return Number.parseFloat(value);
          } else {
            return value;
          }
        } catch {
          return 0;
        }
      },
    } as JVxeComponent.EnhancedPartial,
  });
</script>
 
<style scoped lang="less">
  // 关闭进度条的动画,防止滚动时动态赋值出现问题
  .j-vxe-progress.no-animation {
    :deep(.ant-progress-bg) {
      transition: none !important;
    }
  }
</style>