干燥机配套车间生产管理系统/云平台服务端
baoshiwei
2023-03-10 1fb197352b6a263646e4ccd3ed1c7854ede031dd
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
<template>
  <BasicForm
    :labelWidth="200"
    :schemas="schemas"
    :showResetButton="false"
    :showSubmitButton="false"
    :actionColOptions="{ span: 24 }"
    @submit="handleSubmit"
    @reset="handleReset"
    style="height: 800px"
  >
    <template #jCodeEdit="{ model, field }">
      <JCodeEditor v-model:value="model[field]" mode="js" height="300px" :fullScreen="true" />
    </template>
  </BasicForm>
</template>
<script lang="ts">
  import { computed, defineComponent, unref, ref } from 'vue';
  import { BasicForm, FormSchema, JCodeEditor } from '/@/components/Form';
  import { useMessage } from '/@/hooks/web/useMessage';
  import { optionsListApi } from '/@/api/demo/select';
  import { useDebounceFn } from '@vueuse/core';
 
  const schemas: FormSchema[] = [
    {
      field: 'field1',
      component: 'JCodeEditor',
      label: '代码编辑器',
      required: true,
      slot: 'jCodeEdit',
      colProps: {
        span: 15,
      },
      defaultValue: 'Hello JeecgBoot',
    },
  ];
 
  export default defineComponent({
    components: { BasicForm, JCodeEditor },
    setup() {
      const check = ref(null);
      const { createMessage } = useMessage();
      const keyword = ref<string>('');
      const searchParams = computed<Recordable>(() => {
        return { keyword: unref(keyword) };
      });
 
      function onSearch(value: string) {
        keyword.value = value;
      }
 
      return {
        schemas,
        optionsListApi,
        onSearch: useDebounceFn(onSearch, 300),
        searchParams,
        handleReset: () => {
          keyword.value = '';
        },
        handleSubmit: (values: any) => {
          createMessage.success('click search,values:' + JSON.stringify(values));
        },
        check,
      };
    },
  });
</script>