Explorar el Código

:sparkles: 添加新特性。 终端管理可选配,支持手机号脱敏

冷冷 hace 6 años
padre
commit
aaa42b6674

+ 10 - 2
src/api/gen/gen.js

@@ -77,16 +77,24 @@ export function handleDown(table) {
     data: table,
     responseType: 'arraybuffer'
   }).then((response) => { // 处理返回的文件流
-    const blob = new Blob([response.data], { type: 'application/zip' })
+    const blob = new Blob([response.data], {type: 'application/zip'})
     const filename = table.tableName + '.zip'
     const link = document.createElement('a')
     link.href = URL.createObjectURL(blob)
     link.download = filename
     document.body.appendChild(link)
     link.click()
-    window.setTimeout(function() {
+    window.setTimeout(function () {
       URL.revokeObjectURL(blob)
       document.body.removeChild(link)
     }, 0)
   })
 }
+
+
+export function getForm(tableName) {
+  return request({
+    url: '/gen/form/info/' + tableName,
+    method: 'get'
+  })
+}

+ 1 - 1
src/permission.js

@@ -32,7 +32,7 @@ router.beforeEach((to, from, next) => {
     } else {
       if (store.getters.roles.length === 0) {
         store.dispatch('GetUserInfo').then(() => {
-          next({ ...to, replace: true })
+          next()
         }).catch(() => {
           store.dispatch('FedLogOut').then(() => {
             next({ path: '/login' })

+ 1 - 15
src/router/page/index.js

@@ -87,18 +87,4 @@ export default [{
     isTab: false,
     isAuth: false
   }
-},
-{
-  path: '/formdesigner',
-  name: '表单设计',
-  component: () =>
-    import(/* webpackChunkName: "page" */ '@/views/formdesigner'),
-  meta: {
-    keepAlive: true,
-    isTab: false,
-    isAuth: false
-  }
-}
-
-
-]
+}]

+ 0 - 43
src/views/formdesigner.vue

@@ -1,43 +0,0 @@
-<template>
-
-  <div class="webapp">
-    <avue-formdesigner :option="option"
-                       @submit="handleSubmit"></avue-formdesigner>
-  </div>
-
-</template>
-
-<script>
-export default {
-  data () {
-    return {
-      box: true,
-      option: {
-        column: [{
-          label: '姓名',
-          prop: 'name'
-        }]
-      }
-    }
-  },
-  computed: {},
-  watch: {},
-  created () {
-  },
-  methods: {
-    handleSubmit (json) {
-      console.log(json)
-    }
-  }
-}
-</script>
-<style lang="scss">
-.webapp {
-  background-color: #fff;
-  position: fixed;
-  left: 0;
-  top: 0;
-  width: 100%;
-  height: 100%;
-}
-</style>

+ 50 - 0
src/views/gen/design.vue

@@ -0,0 +1,50 @@
+<template>
+  <div class="webapp">
+    <basic-container>
+      <avue-formdesigner :option="option"
+                         @submit="handleSubmit"></avue-formdesigner>
+    </basic-container>
+  </div>
+</template>
+
+
+<script>
+  import {getForm} from '@/api/gen/gen'
+  import {validatenull} from "../../util/validate";
+
+  export default {
+    data() {
+      return {
+        box: true,
+        option: {}
+      }
+    },
+    created() {
+      this.getFormInfo()
+    },
+    methods: {
+      handleSubmit(json) {
+        console.log(json)
+      },
+      getFormInfo() {
+        let params = this.$route.query;
+        getForm(params.tableName).then(response => {
+          if (!validatenull(response.data.data)) {
+            this.option = JSON.parse(response.data.data.formInfo)
+          }
+        })
+      }
+    }
+  }
+</script>
+<style lang="scss">
+  .webapp {
+    background-color: #fff;
+    position: fixed;
+    left: 0;
+    top: 0;
+
+    width: 100%;
+    height: 100%;
+  }
+</style>

+ 3 - 2
src/views/gen/index.vue

@@ -134,8 +134,9 @@
         })
       },
       handleDown: function (row) {
-        this.formData.tableName = row.tableName
-        this.box = true
+        this.$router.push({path: '/gen/design', query: {tableName: row.tableName}})
+        // this.formData.tableName = row.tableName
+        // this.box = true
       },
       refreshChange() {
         this.getList(this.page)