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
| <template>
| <el-button
| type="primary"
| class="el-button-custom"
| @click="dialogVisible = !dialogVisible"
| >
| 新建任务
| </el-button>
| <CardDialog v-model="dialogVisible" title="新建走航任务">
| <el-form
| :inline="false"
| :model="formObj"
| ref="formRef"
| :rules="rules"
| label-position="right"
| label-width="150px"
| >
| <slot name="form-item" :formObj="formObj"></slot>
| <el-form-item>
| <el-button
| :disabled="!edit"
| type="primary"
| @click="onSubmit"
| :loading="loading"
| >提交</el-button
| >
| <el-button v-if="useCancel" @click="onCancel">取消</el-button>
| </el-form-item>
| </el-form>
| </CardDialog>
| </template>
| <script setup>
| import { onActivated, onDeactivated, ref, reactive, watch } from 'vue';
| import missionApi from '@/api/missionApi';
| import { useFormConfirm } from '@/composables/formConfirm';
| import { useFetchData } from '@/composables/fetchData';
|
| const dialogVisible = ref(false);
| const { loading, fetchData } = useFetchData();
| const baseRules = reactive({
| _usertype: [
| {
| required: true,
| message: '用户类型不能为空',
| trigger: 'change'
| }
| ],
| _locations: [
| {
| required: true,
| message: '行政区划不能为空',
| trigger: 'change'
| }
| ],
| _scenetype: [
| {
| required: true,
| message: '场景类型不能为空',
| trigger: 'change'
| }
| ]
| });
| // 创建任务
| function createMission() {}
| const { formObj, formRef, edit, onSubmit, onCancel, onReset, clear } =
| useFormConfirm({
| submit: {
| do: createMission
| },
| cancel: {
| do: () => (dialogVisible.value = false)
| }
| });
| </script>
|
|