xiejun
2023-06-15 235560b9d7cff1d7dce1f90a08df56d6ef8dd682
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
<template>
    <el-dialog :title="title" :visible.sync="dialogVisible" append-to-body="true" width="30%">
        <el-tag v-for="tag in tags" :key="tag" closable effect="dark" @click="handleClickTag(tag)"
            @close="handleCloseTag(tag)">
            <span> {{ tag }}</span>
        </el-tag>
        <el-divider></el-divider>
        <el-form :model="formInline" class="demo-form-inline" label-position="left">
            <el-form-item :label="item.taskName" v-for="(item,index) in initFrom" :key="index">
                <el-select v-model="formInline[index].userId" :placeholder="item.taskName">
                    <el-option label="区域一" value="shanghai"></el-option>
                    <el-option label="区域二" value="beijing"></el-option>
                </el-select>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="handleCancel">取 消</el-button>
            <el-button type="primary" @click="handleConfirm">确 定</el-button>
        </div>
    </el-dialog>
</template>
<script>
import { personnelInit, personnelCollect, cancelCollect, personnelSave } from '@/api/template/setPersonnel.js'
export default {
    name: 'SetPersonnel',
    props: {
        // 是否打开
        visible: {
            typeof: Boolean,
            default: false
        },
        title: {
            typeof: String,
            default: '人员设置'
        },
        code:{
            typeof: String,
            default: ''
        }
    },
    watch: {
        visible(n) {
            this.dialogVisible = n;
        },
        dialogVisible(n) {
            this.$emit('update:visible', n)
        },
    },
    data() {
        return {
            dialogVisible: this.visible,
            initFrom: [],
            tags: ['标签1', '标签2', '标签3', '标签4'],
            formInline: []
 
        }
    },
    mounted() {
        this.apiInit()
    },
    methods: {
        async apiInit() {
            const response = await personnelInit({type:'PUBLIC',templateId:'8b5e2017-990f-454a-9c39-4c4eeeb57553'})
            if (response.status === 200) {
                console.log(response)
                this.initFrom = response.data.data.user
                this.formInline = response.data.data.user
            }
        },
        async apiCollect() {
            const response = await personnelCollect()
            if (response.status === 200) {
                console.log(response)
            }
        },
        async canCollect(id) {
            const response = await cancelCollect()
            if (response.status === 200) {
                console.log(response)
            }
        },
        async apiSave() {
            const response = await personnelSave()
            if (response.status === 200) {
                console.log(response)
            }
        },
        handleClickTag(event) {
            console.log(event)
        },
        handleCloseTag(event) {
            console.log(event)
            this.canCollect(event)
        },
        done() {
            this.dialogVisible = false
        },
        handleCancel() {
            this.done()
        },
        handleConfirm() {
            // this.done()
            console.log(this.formInline)
        }
    }
}
</script>
<style lang="scss">
.el-tag+.el-tag {
    margin-left: 10px;
}
 
.button-new-tag {
    margin-left: 10px;
    height: 32px;
    line-height: 30px;
    padding-top: 0;
    padding-bottom: 0;
}
 
.input-new-tag {
    width: 90px;
    margin-left: 10px;
    vertical-align: bottom;
}
</style>