assign.vue
2.02 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
<template>
<div class="">
<el-tabs v-model="activeTabs">
<el-tab-pane label="选择数据" name="1">
<select-info ref="selectInfoCom" :id="id" :key="id"></select-info>
</el-tab-pane>
<el-tab-pane label="导入数据" name="2">
<import-vehicle ref="importVehicleCom" :id="id" :key="id" @monitorFlag="monitorFlag" @monitorChangeFlag="monitorChangeFlag"></import-vehicle>
</el-tab-pane>
<el-tab-pane label="按组织授权" name="3">
<authorization-info ref="authorizationInfoCom" :id="id" :key="id"></authorization-info>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import SelectInfo from "./select.vue";
import ImportVehicle from "./import.vue";
import AuthorizationInfo from "./authorization";
export default {
name: "AssignInfo",
components: {
SelectInfo,
ImportVehicle,
AuthorizationInfo,
},
props: {
id: {
type: [String, Number],
default: "",
},
},
data() {
return {
activeTabs: "1",
userId: "",
randomKey: "",
monitorFlags: false,
showBtnFlag: true
};
},
watch: {
id: {
handler: function () {
console.log("key:", Math.random());
this.randomKey = Math.random();
},
},
},
mounted() {
this.userId = this.id;
},
methods: {
// 保存数据
saveInfo() {
let _id = this.activeTabs;
if (_id == 1) {
this.$refs.selectInfoCom.saveInfo();
return false;
}
if (_id == 3) {
this.$refs.authorizationInfoCom.saveInfo();
return false;
}
this.$refs.importVehicleCom.saveInfo();
},
monitorFlag(val) {
this.monitorFlags = val
},
monitorChangeFlag(val) {
if (val && !this.monitorFlags) {
this.showBtnFlag = true
}
if (this.monitorFlags) {
this.showBtnFlag = false
this.monitorFlags = !this.monitorFlags
}
this.$emit('showBtnFlags', this.showBtnFlag)
}
},
};
</script>
<style lang="scss" scoped>
</style>