<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>
|