schangxiang@126.com
2024-08-16 65bd2dc1d4c1fb136af853c7ede93a338431be29
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<template>
  <div class="nomalstyle">
    <a-form-model
      ref="ruleForm"
      :model="infodata"
      :label-col="{ span: 5 }"
      :wrapper-col="{ span: 12 }"
      @submit="handleSubmit"
      :rules="rules">
      <a-form-model-item label="标题" prop="title">
        <a-input
          placeholder="请输入标题"
          v-model="infodata.title"
        />
      </a-form-model-item>
      <a-form-model-item label="图标">
        <a-input placeholder="请选择图标" disabled="disabled" v-model="infodata.icon">
          <a-icon slot="addonAfter" @click="openIconSele()" type="setting" />
        </a-input>
      </a-form-model-item>
      <a-form-model-item label="绑定表单">
        <a-select placeholder="请选择表单" v-model="infodata.formId">
          <a-select-option v-for="formDesign in formDataSource" :value="formDesign.id" :key="formDesign.id">
            {{ formDesign.name }}</a-select-option>
        </a-select>
      </a-form-model-item>
      <a-form-model-item label="分组">
        <a-select placeholder="请选择分组" v-model="infodata.group">
          <a-select-option v-for="(group, index) in groupDataSource" :value="group.code" :key="index">
            {{ group.value }}</a-select-option>
        </a-select>
      </a-form-model-item>
      <a-form-model-item label="描述">
        <a-textarea
          v-model="infodata.description"
          placeholder="请填写流程描述"
          :auto-size="{ minRows: 3, maxRows: 5 }"
        />
      </a-form-model-item>
    </a-form-model>
    <a-modal
      :width="850"
      :visible="visibleIcon"
      @cancel="handleCancelIcon"
      footer=""
      :mask="false"
      :closable="false"
      :destroyOnClose="true">
      <icon-selector v-model="currentSelectedIcon" @change="handleIconChange" />
    </a-modal>
  </div>
</template>
 
<script>
import { sysDictTypeDropDown } from '@/api/modular/system/dictManage'
import { getformList } from '@/api/modular/system/formDesignmanage'
import IconSelector from '@/components/IconSelector'
export default {
  name: 'Nomalflow',
  components: { IconSelector },
   props: {
    // 活动页
    data: {
      type: Object,
      default: null
    }
  },
  data() {
    return {
       rules: {
        title: [{ required: true, message: '请输入标题', trigger: 'change' }]
      },
      // infodata: {
      //   icon: null,
      //   title: null,
      //   group: null,
      //   description: null
      // },
      infodata: this.data,
      nomalinfo: null,
      groupDataSource: [],
      formDataSource: [],
      formLayout: 'horizontal',
      form: this.$form.createForm(this, { name: 'coordinated' }),
      currentSelectedIcon: 'pause-circle',
      visibleIcon: false
    }
  },
  created() {
    this.getSysDict()
    this.getformList()
   },
   activated() {
  },
   mounted() {
  },
  methods: {
   async datainit() {
     await this.form.setFieldsValue({
        icon: this.infodata.icon,
        title: this.infodata.title,
        group: this.infodata.group,
        description: this.infodata.description
      })
    },
    getnomalinfo() {
       this.$refs.ruleForm.validate(valid => {
        if (valid) {
          this.$emit('getflownomalinfo', true, this.infodata)
        } else {
          this.$emit('getflownomalinfo', false, this.infodata)
          return false
        }
      })
    },
    /**
    * 获取字典数据
    */
    getSysDict() {
        sysDictTypeDropDown({
          code: 'workflow_group'
        }).then((res) => {
          this.groupDataSource = res.data
      })
    },
    getformList() {
      getformList().then(res => {
        res.data.forEach(element => {
          var el = { id: element.id, name: element.title }
          this.formDataSource.push(el)
        })
      })
    },
    handleIconChange(icon) {
        this.infodata.icon = icon
        this.visibleIcon = false
      },
    handleSubmit(e) {
      e.preventDefault()
      this.form.validateFields((err, values) => {
        if (!err) {
        }
      })
    },
    handleSelectChange(value) {
      this.form.setFieldsValue({
        note: `Hi, ${value === 'male' ? 'man' : 'lady'}!`
      })
    },
    handleCancelIcon() {
        this.visibleIcon = false
      },
    openIconSele() {
        this.visibleIcon = true
      }
  }
}
</script>
 
<style scoped>
.nomalstyle{
  margin-top: 100px;
  margin-left: 10%;
  text-align: center;
}
</style>