selectSupervisorDialog.vue
2.98 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
<template>
<d2-dialog :title="title"
:is-visible.sync="selectSupervisorVisible"
width="50%"
btn-ok-label="确定"
@confirmDialog="handleSelectSupervisorConfirm"
@closeDialog="handleSelectSupervisorClose"
class="selectSupervisor">
<d2-search ref="showSearch"
class="show-search"
:search-form="searchForm"
:label-width="'100px'"
:form-data="showFormData">
</d2-search>
<div class="up-btns">
<el-button @click="getList"
size="small"
type="primary">
查询
</el-button>
</div>
<d2-table ref="groundingIndexTable"
:has-num="false"
:has-page="false"
:search-form="searchForm"
:table-params="tableParams"
:table-data="tableData"
:before-search-fn="beforeSearchFn">
<template slot="select_btn"
slot-scope="scope">
<el-radio v-model="selectedRowId"
:label="scope.scope.id">{{ '' }}</el-radio>
</template>
</d2-table>
</d2-dialog>
</template>
<script>
import { getDudaoList } from '@api/teachingManage'
export default {
name: 'SelectSupervisorDialog',
props: {
title: {
type: String,
default: "选择督导"
},
selectSupervisorVisible: {
type: Boolean,
default: false
}
},
data() {
return {
// getListApi: getDudaoList,
tableData: [],
showFormData: [{
label: '督导名称',
name: 'staffName',
type: 'input',
maxlength: 50,
width: '250px',
isClear: true,
keyFn: this.keyDowmGetList
}],
searchForm: {
roleName: '飞行督导',
staffName: ''
},
baseData: {
},
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableColumns: [{
label: '',
width: '60',
addHtml: 'select_btn'
}, {
label: '督导名称',
prop: 'staffName'
}, {
label: '手机号',
prop: 'staffPhone'
}]
},
selectedRowId: ''
}
},
mounted() {
this.getList()
},
methods: {
getList() {
const params = this.searchForm
getDudaoList(params).then(res => {
this.tableData = res || []
})
},
beforeSearchFn() {
return new Promise(resolve => {
resolve()
})
},
handleSelectSupervisorConfirm() {
const selectData = this.tableData?.find(v => v.id == this.selectedRowId)
if (!selectData) return this.$message.warning('请选择督导')
this.$emit('handleSelectSupervisorConfirm', selectData)
},
handleSelectSupervisorClose() {
this.$emit('handleSelectSupervisorClose')
}
}
}
</script>
<style lang="scss" scoped>
.show-search {
::v-deep .d2-search-block {
padding: 0;
}
}
</style>