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
<template>
<div>
<el-select v-model="weight" size="mini" @change="changeWeight(row)">
<el-option label="1" :value="1">
</el-option>
<el-option label="2" :value="2">
</el-option>
<el-option label="3" :value="3">
</el-option>
<el-option label="无法成为意向" :value="100">
</el-option>
</el-select>
</div>
</template>
<script>
import {editUserWeightApi} from "../../service/api";
export default {
name: "userWeight",
props:[
'row'
],
data(){
return {
weight:this.row.weight
}
},
methods:{
changeWeight(data){
this.$prompt('标记意向或非意向的原因', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
}).then(({ value }) => {
editUserWeightApi(data.id,this.weight,{desc:value}).then(()=>{
this.$message({
type:'success',
message:'数据更改成功'
});
this.$emit('onSuccess');
this.weight = this.row.weight
})
}).catch(() => {
this.weight = this.row.weight
})
},
},
watch:{
'row.weight'(value){
this.weight = value
}
}
}
</script>
<style scoped>
</style>