jinlin
2023-11-07 e9d51762bf342f3f9b542ef0214ed41a6ff7d679
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
<template>
  <zt-dialog ref="dialog" #if($columns.size() > 10)column="2"#end @confirm="formSubmit">
    <el-form :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="120px">
#foreach($column in $columns)
      <zt-form-item label="${column.comments}" prop="${column.attrName}" rules="required">
          #if($column.dictType != 'null' &&  $column.dictType != '')
              <zt-dict v-model="dataForm.${column.attrName}" dict="$column.dictType"></zt-dict>
          #else
              <el-input v-model="dataForm.${column.attrName}"></el-input>
          #end
      </zt-form-item>
#end
    </el-form>
  </zt-dialog>
</template>
 
<script>
  export default {
    data() {
      return {
        dataForm: {
          id: '',
#foreach($column in $columns)
          ${column.attrName}: ''#if($velocityCount != $columns.size()),#end
 
#end
        }
      }
    },
    methods: {
      // 获取信息
      async getInfo() {
        let res = await #[[this.$http.get(]]#`/${moduleName}/${pathName}/#[[${]]#this.dataForm.id}`)
        this.dataForm = {
          ...this.dataForm,
          ...res.data
        }
      },
      // 表单提交
      async formSubmit() {
        let res = await #[[this.$http]]#[!this.dataForm.id ? 'post' : 'put']('/${moduleName}/${pathName}/', this.dataForm)
        if (res.success) {
          await this.$tip.success()
          this.$refs.dialog.close()
          this.$emit('refreshDataList')
        }
      }
    }
  }
</script>