riku
2023-12-27 bb7ae31d7066a838bd177bf21c20f13ef044950b
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<template>
  <el-card shadow="never">
    <template #header>
      <div><el-text tag="b" size="large">选择评估范围</el-text></div>
      <el-text size="small" type="info">包括区县、场景类型以及月份</el-text>
    </template>
    <FormCol>
      <FYForm ref="formRef" :rules="evaConditionRules" :showButtons="false" @submit="nextStep">
        <template #form-item="{ formObj }">
          <CompQuickSet @quick-set="setOptions"></CompQuickSet>
          <!-- 区县 -->
          <FYOptionLocation
            :allOption="false"
            :level="3"
            :initValue="false"
            :checkStrictly="false"
            v-model:value="formObj._locations"
          ></FYOptionLocation>
          <!-- 场景类型 -->
          <FYOptionScene
            :allOption="false"
            :initValue="false"
            :type="2"
            v-model:value="formObj._scenetype"
          ></FYOptionScene>
          <!-- 时间 -->
          <FYOptionTime
            prop="time"
            :initValue="true"
            type="month"
            v-model:value="formObj.time"
          ></FYOptionTime>
        </template>
      </FYForm>
    </FormCol>
    <template #footer>
      <el-row justify="space-around">
        <el-button type="primary" size="default" :loading="loading" @click="submit"
          >下一步</el-button
        >
      </el-row>
    </template>
  </el-card>
</template>
 
<script>
import CompQuickSet from '../CompQuickSet.vue';
 
/**
 * 评估范围合规性检查
 */
export default {
  components: { CompQuickSet },
  props: {
    // 步骤下标
    modelValue: Number
  },
  emits: ['update:modelValue'],
  data() {
    return {
      loading: false,
      evaConditionRules: {
        time: [
          {
            required: true,
            message: '时间不能为空',
            trigger: 'change'
          }
        ]
      }
    };
  },
  methods: {
    setOptions(param) {
      this.$refs.formRef.formObj._locations = param.locations;
      this.$refs.formRef.formObj._scenetype = param.scenetype;
    },
    submit() {
      this.$refs.formRef.onSubmit(false);
    },
    // 跳转下一步
    nextStep() {
      // todo: 检查是否已有评估记录,提示用户可直接跳转查看或继续下一步
 
      
      this.loading = true;
      return new Promise((reslove, reject) => {
        setTimeout(() => {
          this.$emit('update:modelValue', this.modelValue + 1);
          this.loading = false;
          reslove();
        }, 1000);
      });
    }
  }
};
</script>