PersonGroupMover.vue
2.35 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<template>
<a-modal
title="人员移动"
v-if='isVisible'
v-model:visible="isVisible"
width="520px"
height='50%'
class="detail-modal"
>
<a-form :model="formData">
<a-form-item label="分组">
<a-select v-model:value="formData.personUnid" placeholder="请选择分组id">
<a-select-option
v-for="item in dataList"
:key="item.person_unid"
:value="item.person_unid"
>人id:{{item.person_unid}}</a-select-option>
</a-select>
</a-form-item>
</a-form>
<template #footer>
<a-button type="primary" @click="onSave">保存</a-button>
<a-button @click="onCancel">返回</a-button>
</template>
</a-modal>
</template>
<script>
import { ref } from "vue";
import clusterResultApi from '@/views/SnapshotCluster/ClusterResult/ClusterResultApi'
import { ElMessage } from "element-plus";
export default {
name: 'PersonGroupEditor',
props: {
dataList: {
type: Array,
default: () => [],
},
},
setup(props, { emit }) {
const isVisible = ref(false);
// 表单
function getInitialFormData() {
return {
personUnid: '',
unidList: [],
}
}
const formData = ref(getInitialFormData())
const initDialog = (data, selectedList) => {
console.log('initDialog', data, selectedList)
formData.value = getInitialFormData()
formData.value.unidList = selectedList.map(item => item.unid)
isVisible.value = true;
};
const onCancel = () => {
isVisible.value = false;
};
const onSave = () => {
const params = {
unid: formData.value.unidList.join(','),
personUnid: formData.value.personUnid,
}
clusterResultApi.updateRecognition(params).then(
(r) => {
if(r.msg_code==200){
ElMessage({
message: `保存成功`,
type: 'success'
})
// 刷新列表
emit('refresh')
onCancel()
} else {
ElMessage({
message: `保存失败`,
type: 'error'
})
}
}
)
};
return {
isVisible,
formData,
onSave,
onCancel,
initDialog,
};
},
};
</script>
<style lang="less" scoped>
</style>