jinlin
2024-07-15 134c06beb2b6b7f7025fb030a9e52bcceebbfc98
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
<template>
 
  <zt-dialog ref="dialog" :hasConfirm="false" append-to-body :title="title" @close="close()">
    <el-form :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="120px">
      <zt-form-item label="ID" prop="id" rules="required">
        <el-input v-model="dataForm.id" @change="idd" placeholder="请输入数字"></el-input>
      </zt-form-item>
      <zt-form-item label="名称" prop="name" rules="required">
        <el-input v-model="dataForm.name"></el-input>
      </zt-form-item>
      <zt-form-item label="编码" prop="code" rules="required">
        <el-input v-model="dataForm.code"></el-input>
      </zt-form-item>
      <zt-form-item label="类型" prop="type">
        <el-select v-model="dataForm.type" value-key="value" style="width: 100%">
          <el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.value"></el-option>
        </el-select>
      </zt-form-item>
      <zt-form-item label="数据库表" prop="tableName" rules="required">
        <el-input v-model="dataForm.tableName"></el-input>
      </zt-form-item>
      <zt-form-item label="备注" prop="remark">
        <el-input v-model="dataForm.remark"></el-input>
      </zt-form-item>
      <zt-form-item label="获取业务信息Sql" prop="bizSql">
        <textarea v-model="dataForm.bizSql" style="width: 803px;height:200px"></textarea>
      </zt-form-item>
      <el-form-item>
        <el-button type="primary" v-show="!dataForm.disabled" @click="onSubmit">提交</el-button>
      </el-form-item>
    </el-form>
  </zt-dialog>
 
</template>
 
<script>
export default {
  data() {
    return {
      dataForm: {
        id: '',
        name: '',
        code: '',
        type: '',
        status: '1',
        tableName: '',
        remark: '',
        bizSql: '',
      },
      typeList: [{id: '0', value: '0', name: '无'}, {id: '1', value: '1', name: '整体'}, {
        id: '2',
        value: '2',
        name: '单个'
      }],
    }
  },
  methods: {
    init() {
      this.dataForm = {}
    },
    async onSubmit() {
      // this.dataForm.wfDefId = this.wfDefId
      // let ress = await this.$http.get(`/WfDef/id?id=${this.dataForm.id}`)
      // console.log(ress)
      // if (ress.data > 0) {
      //   console.log(ress)
      //   return this.$tip.alert('id已存在');
      // }
      // let resss = await this.$http.get(`/WfDef/code?code=${this.dataForm.code}`)
      // console.log(resss)
      // if (resss.data > 0) {
      //   console.log(resss)
      //   return this.$tip.alert('编码已存在');
      // }
      let res = await this.$http [!this.dataForm.id ? 'post' : 'put']('/WfDef', this.dataForm)
      if (res.success) {
        await this.$tip.success()
        this.$refs.dialog.close()
        this.$emit('refreshDataList')
      }
    },
    idd() {
      if (/[^\d]/g.test(this.dataForm.id))
        this.dataForm.id = '';
    },
    close() {
      this.title = '新增'
    },
 
  }
}
</script>
 
<style scoped>
 
</style>