qa-prevention-gwj-vue/src/views/util/selectPosition.vue

114 lines
2.6 KiB
Vue

<template>
<el-dialog
v-loading = "loading"
v-if="dialogVisible"
:visible.sync="dialogVisible"
:before-close="handleClose"
:title="title"
:append-to-body="appendToBody"
width="60%">
<el-input v-if="false" v-model="filterText" placeholder="输入关键字进行过滤"/>
<el-scrollbar class="information" style="height: 500px; margin-top: 10px">
<el-table
ref="table"
:data="data"
border
style="width: 100%">
<el-table-column type="selection" width="55"/>
<el-table-column prop="NAME" label="适合岗位"/>
</el-table>
</el-scrollbar>
<span slot="footer" class="dialog-footer">
<el-button @click="closeWindow">取 消</el-button>
<el-button type="primary" @click="save"> </el-button>
</span>
</el-dialog>
</template>
<script>
import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包
import { requestFN } from '@/utils/request'
import waves from '@/directive/waves' // waves directive
export default {
components: { Pagination },
directives: { waves },
props: {
title: {
type: String,
default: ''
},
appendToBody: {
type: Boolean,
default: false
}
},
data() {
return {
dialogVisible: false,
loading: false,
e: {},
root: {},
data: [],
filterText: ''
}
},
watch: {
filterText(val) {
this.data = this.data.filter(data => !val || data.name.includes(val))
}
},
methods: {
init(e) {
console.log(e)
this.dialogVisible = true
this.e = e.e
this.root = e.root
this.getData()
},
handleClose() {
this.dialogVisible = false
},
getData() {
this.loading = true
let id = null
if (this.e.departmentInfo) {
id = this.e.departmentInfo.id
} else {
id = this.e.DICTIONARIES_ID
}
requestFN(
'/post/getInfo',
{ id: JSON.stringify([{ id: id }]) }
).then((data) => {
this.loading = false
this.data = data.postList
}).catch((e) => {
this.loading = false
this.$message.error(e)
})
},
filterNode(value, data) {
if (!value) return true
return data.name.indexOf(value) !== -1
},
closeWindow() {
this.dialogVisible = false
},
clear() {
this.tree = []
},
save() {
this.$emit('getResult', { info: this.$refs.table.selection, e: this.$refs.table.selection, root: this.root, post_flag: true })
this.dialogVisible = false
}
}
}
</script>
<style scoped>
.information >>> .el-scrollbar__wrap {
overflow-x: hidden;
}
</style>