addPerson.vue
4.13 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
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
<template>
<a-modal
:title="type=='add'?'新增注册人员':'编辑注册人员'"
v-if="isVisible"
v-model:visible="isVisible"
width="800px"
class="detail-modal"
>
<div>
<a-form :model="formObj" :label-col="{ style: { width: '100px' } }">
<a-form-item label="姓名:">
<a-input v-model:value="formObj.name" style="width: 500px">
</a-input>
</a-form-item>
<a-form-item label="描述:">
<a-input v-model:value="formObj.dec" style="width: 500px">
</a-input>
</a-form-item>
</a-form>
</div>
<template #footer>
<a-button @click="onCancel">返回</a-button>
<a-button @click="onConfirm" type="primary">确定</a-button>
</template>
</a-modal>
</template>
<script>
import { reactive, ref,toRaw } from "vue";
import FeatureMatchingAccuracyApi from '@/views/FeatureMatchingAccuracy/FeatureMatchingAccuracyApi'
import {filterEmptyValueInObject, formatDate, formatTime, getPagedList} from '@/PublicUtil/PublicUtil'
import {ElMessage} from 'element-plus'
export default {
setup(props,context) {
const isVisible = ref(false);
const pageNum = ref(1)
const pageSize = ref(10)
const total = ref()
// 暂时选中目标,但没提交
const checkList = ref([])
const formObj = reactive({
name: '',
dec: '',
})
const isLoading = ref(false)
const accountId = ref('');
const mallId = ref('');
const type = ref('')
const initDialog = function(parmas) {
accountId.value = parmas.account_id;
mallId.value = parmas.plaza_id;
type.value = parmas.type;
formObj.name = parmas.name||'';
formObj.dec = parmas.description||'';
if(parmas.type=='edit'){
formObj.id = parmas.id
}
isVisible.value = true;
};
const onCancel = () => {
isVisible.value = false;
};
const refreshParentTable = function(){
context.emit('refreshParentTable')
}
const onConfirm = function(){
if(type.value=='add'){
const data = filterEmptyValueInObject(
{
accountId: accountId.value,
mallId: mallId.value,
name: formObj.name,
description: formObj.dec,
}
)
FeatureMatchingAccuracyApi.addMatch(data).then(
(r) => {
if(r.msg_code==200){
ElMessage({
message: r.msg_info,
type: 'success'
})
refreshParentTable()
isVisible.value = false
}else{
ElMessage({
message: r.msg_info,
type: 'error'
})
return false;
}
}
)
}else{
const data = filterEmptyValueInObject(
{
accountId: accountId.value,
mallId: mallId.value,
name: formObj.name,
description: formObj.dec,
id: formObj.id,
}
)
FeatureMatchingAccuracyApi.editMatch(data).then(
(r) => {
if(r.msg_code==200){
ElMessage({
message: r.msg_info,
type: 'success'
})
refreshParentTable()
isVisible.value = false
}else{
ElMessage({
message: r.msg_info,
type: 'error'
})
return false;
}
}
)
}
}
return {
isVisible,
formObj,
onCancel,
onConfirm,
initDialog,
isLoading,
type
};
},
};
</script>
<style lang="less" scoped>
</style>