zhuguifei
2025-04-28 442928123f63ee497d766f9a7a14f0a6ee067e25
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<template>
 
  <a-modal
    :title="title"
    :width="600"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
    switchFullscreen
  >
    <a-spin :spinning="confirmLoading">
      <a-form-model
        :model="dataForm"
        :rules="dataRule"
        ref="dataForm"
        label-width="180px">
        <a-row :gutter="20">
          <a-col :span="24">
            <a-form-model-item label="模型名称" prop="name">
              <a-input v-model="dataForm.name" :disabled="disaform" placeholder="模型名称"></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="20">
          <a-col :span="24">
            <a-form-model-item label="模型标识" prop="key">
              <a-input v-model="dataForm.key" :disabled="disaform" placeholder="模型标识"></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="20">
          <a-col :span="24">
            <a-form-model-item label="模型描述" prop="description">
              <a-input v-model="dataForm.description" :disabled="disaform" placeholder="模型描述"></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </a-spin>
  </a-modal>
</template>
 
<script>
  import { postAction } from '@/api/manage'
 
  export default {
    name: 'ActivitiModelModal',
    components: { },
    data() {
      return {
        title: '新增',
        visible: false,
        dataForm: {},
        confirmLoading: false,
        disaform: false,
        dataRule: {
          name: [{ required: true, message: '请输入模型名称!' }],
          key: [{ required: true, message: '请输入模型key!' }]
          }
      }
    },
    computed: {
 
    },
    created() {
    },
    mounted() {
 
    },
    methods: {
 
      add () {
          this.visible = true
        },
        edit (record) {
          this.visible = true
          this.dataForm = Object.assign({}, record)
        },
        close () {
          this.$emit('close')
          this.visible = false
        },
        // 确定
        handleOk() {
          console.log('确定', this.dataForm)
          this.$refs.dataForm.validate(valid => {
            if (valid) {
              let url = 'act/remodel/save'
              postAction(url, this.dataForm).then(res => {
                console.log('res', res)
                if (res.success) {
                  this.$message.success(res.message)
                } else {
                  this.$message.error(res.message)
                }
                 this.visible = false
                 this.$emit('getModels')
              })
          } else {
              return false
            }
          })
        },
        // 关闭
        handleCancel() {
          this.close()
        }
 
    }
}
</script>
 
<style>
</style>