copyConfig.vue
1.83 KB
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
<template>
<el-dialog v-model="show" title="复制流程" append-to-body width="300px">
<el-form ref="formRef" :model="form" :rules="rules" label-width="50px">
<el-form-item prop="classifys">
<el-checkbox-group v-model="form.classifys">
<div v-for="t in typeArr" :key="t.value">
<el-checkbox v-show="t.show" :label="t.value">{{ t.label }}</el-checkbox>
</div>
</el-checkbox-group>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup>
import { getCurrentInstance, ref, toRefs } from 'vue'
import { reactive } from '@vue/runtime-core'
import { copyWfConfig } from '@/api/workflow/config'
import _ from 'lodash'
const { proxy } = getCurrentInstance()
const show = ref(false)
const typeArr = ref([])
const data = reactive({
form: {},
rules: {
classifys: [{ required: true, message: '复制对象不能为空', trigger: 'change' }]
}
})
const { form, rules } = toRefs(data)
/** 提交按钮 */
function submitForm() {
proxy.$refs['formRef'].validate(valid => {
if (valid) {
copyWfConfig(form.value).then(() => {
proxy.$modal.msgSuccess('复制成功')
show.value = false
})
}
})
}
/** 取消按钮 */
function cancel() {
show.value = false
}
function open(wkId, approvalTypeArr, excludeType) {
proxy.resetForm('formRef')
form.value = {
id: wkId,
classifys: []
}
_.each(approvalTypeArr, (t) => {
t.show = true
if (t.value == excludeType) {
t.show = false
}
})
typeArr.value = approvalTypeArr
show.value = true
}
defineExpose({
open
})
</script>
<style scoped>
</style>