riku
2024-01-10 54b5fa2047324b81b6d2ee7f830693267f946c0a
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<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"
            :sourceInit="sceneOptionSourceInit"
            :type="formObj.sourceType"
            v-model:value="formObj._scenetype"
          ></FYOptionScene>
          <!-- 时间 -->
          <FYOptionTime
            prop="time"
            :initValue="true"
            type="month"
            v-model:value="formObj.time"
          ></FYOptionTime>
          <el-form-item label="主数据源" prop="sourceType">
            <!-- <el-switch v-model="formObj.sourceType" @change="sceneOptionSourceInit = true" /> -->
            <el-radio-group
              v-model="formObj.sourceType"
              size="small"
              @change="sceneOptionSourceInit = true"
            >
              <el-radio-button label="1">守法服务记录</el-radio-button>
              <el-radio-button label="2">现场巡查记录</el-radio-button>
            </el-radio-group>
            <!-- <span class="m-l-16">{{ formObj.sourceType ? '守法服务记录' : '现场巡查记录' }}</span> -->
            <el-tooltip placement="bottom-start" effect="light">
              <template #content>
                <!-- <el-text tag="b" size="default">说明</el-text><br /> -->
                <el-text tag="i" size="default" type="warning"
                  >该选项是用于决定评估主体对象的获取方式</el-text
                ><br />
                <el-text tag="b" size="small">守法服务记录:</el-text><br />
                <el-text size="small"
                  >表示在评估时,评估对象是从守法服务小程序系统中获取的当前可用的用户;<br />
                  一般情况下,当评估对象没有进行现场巡查,只有守法服务相关记录时,采用此选项;</el-text
                ><br />
                <el-text tag="b" size="small">现场巡查记录:</el-text><br />
                <el-text size="small"
                  >表示在评估时,评估对象是从现场巡查监管系统中获取的总任务下的所有监管场景;<br />
                  一般情况下,当评估对象有进行现场巡查,采用此选项; </el-text
                ><br />
              </template>
              <el-icon class="m-l-8 cursor-p" :size="16" color="var(--el-color-warning)"
                ><QuestionFilled
              /></el-icon>
            </el-tooltip>
          </el-form-item>
        </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', 'change'],
  data() {
    return {
      loading: false,
      evaConditionRules: {
        time: [
          {
            required: true,
            message: '时间不能为空',
            trigger: 'change'
          }
        ],
        sourceType: [
          {
            required: true,
            message: '主数据源必须选择',
            trigger: 'change'
          }
        ]
      },
      // 当场景选项切换数据源时,是否清空当前选项值
      sceneOptionSourceInit: true
    };
  },
  methods: {
    setOptions(param) {
      this.sceneOptionSourceInit = false;
      this.$refs.formRef.formObj._locations = param.locations;
      this.$refs.formRef.formObj._scenetype = param.scenetype;
      this.$refs.formRef.formObj.sourceType = param.sourceType;
    },
    submit() {
      this.$refs.formRef.onSubmit(false);
    },
    // 跳转下一步
    nextStep(formObj, success, fail) {
      // todo: 检查是否已有评估记录,提示用户可直接跳转查看或继续下一步
 
      this.loading = true;
      return new Promise((reslove, reject) => {
        setTimeout(() => {
          this.$emit('change', formObj);
          this.$emit('update:modelValue', this.modelValue + 1);
          this.loading = false;
          success();
          reslove();
        }, 1000);
      });
    }
  }
};
</script>