分支自 SuZhouGuanHong/TaiYuanTaiZhong

PCS
dengjunjie
2023-12-13 113d1d4262d8f9e78a9d92123713c41669ad6c87
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
<template>
  <div class="flow-demo">
    <el-divider>发起流程</el-divider>
 
    <vol-form
      style="margin-top:20px;"
      ref="form"
      :load-key="true"
      :label-width="60"
      :formRules="options"
      :formFields="fields"
    ></vol-form>
    <div style="text-align:center">
      <el-button @click="submit" type="primary">提交</el-button>
    </div>
  </div>
</template>
<script>
import {
  defineComponent,
  ref,
  reactive,
  toRefs,
  getCurrentInstance
} from 'vue';
import { useRouter, useRoute } from 'vue-router';
import http from '@/../src/api/http.js';
import VolForm from '@/components/basic/VolForm.vue';
export default {
  components: {
    VolForm
  },
  setup() {
    const fields = reactive({
      ExpertName: '',
      Enable: '',
      City: '',
      IDNumber: '',
      PhoneNo: '',
      CreateDate: '',
      Resume: '',
      HeadImageUrl: ''
    });
    const options = reactive([
      [{ title: '名称', field: 'ExpertName' }],
      [
        {
          dataKey: 'enable',
          data: [],
          title: '状态',
          required: true,
          field: 'Enable',
          type: 'select'
        }
      ],
      [
        {
          dataKey: 'city',
          data: [],
          title: '地区',
          field: 'City',
          type: 'select'
        }
      ],
      [{ title: '日期', field: 'CreateDate', type:"date" }],
      [{ title: '备注', field: 'Resume', colSize: 12, type: 'textarea' }]
    ]);
    let appContext = getCurrentInstance().appContext;
    let $message = appContext.config.globalProperties.$message;
    const form = ref(null);
 
    const submit = () => {
      form.value.validate(() => {
        http
          .post('api/App_Expert/add', { mainData: fields }, true)
          .then((result) => {
            if (!result.status) {
              return $message.error(result.message);
            }
            form.value.reset();
            $message.success(result.message);
          });
      });
    };
 
    return {
      options,
      fields,
      submit,
      form
    };
  }
};
</script>
<style scoped lang="less">
.flow-demo {
  position: absolute;
  width: 600px;
  left: 0;
  right: 0;
  margin: 0 auto;
  margin-top: 20px;
}
</style>