峰峰执法平台简易案件程序板块 pad端
yang
2022-10-17 4107256a8d1fa9a2db0969122bfc760994b12421
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
<template>
  <div class="webapp">
    <basic-container>
      <avue-form-design :options="option" @submit="handleSubmit"></avue-form-design>
    </basic-container>
  </div>
</template>
 
 
<script>
import AvueUeditor from "avue-plugin-ueditor";
import { getForm, postForm } from "@/api/gen/gen";
import { validatenull } from "@/util/validate";
 
export default {
  comments: {
    AvueUeditor,
  },
  data() {
    return {
      option: {
        column: [],
      },
    };
  },
  created() {
    this.getFormInfo();
  },
  methods: {
    handleSubmit(json) {
      let params = this.$route.query;
      if (validatenull(params)) {
        return false;
      }
      let result = JSON.stringify(json);
      postForm(result, params.tableName, params.dsName).then((response) => {
        this.$message.success("生成并保存成功");
      });
    },
    getFormInfo() {
      let params = this.$route.query;
      if (validatenull(params)) {
        return false;
      }
      getForm(params.tableName, params.dsName).then((response) => {
        if (!validatenull(response.data.data)) {
          this.option = JSON.parse(response.data.data);
        }
      });
    },
  },
};
</script>
<style lang="scss">
.webapp {
  background-color: #fff;
  position: relative;
  width: 100%;
  height: 100%;
 
  .form-designer {
    height: 800px;
    overflow-y: scroll;
  }
 
  .form-designer .widget-config-container .el-tabs__header {
    position: relative;
  }
}
</style>