136 lines
3.8 KiB
Vue
136 lines
3.8 KiB
Vue
<template>
|
||
<el-card shadow="never">
|
||
<div class="search">
|
||
|
||
<slot name="before"></slot>
|
||
|
||
<div class="search-item" v-if="has_year">
|
||
<div class="search-item-label">年度:</div>
|
||
<div class="search-item-option">
|
||
<el-date-picker
|
||
v-model="value.year"
|
||
type="year"
|
||
value-format="yyyy" style="width: 100%"
|
||
placeholder="选择年" @change="doSearch">
|
||
</el-date-picker>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="search-item">
|
||
<div class="search-item-option" style="width: 100%">
|
||
<el-input placeholder="请输入内容" clearable v-model="value.searchKeyword"
|
||
@keyup.enter.native="doSearch" style="width: 100%">
|
||
<el-select v-model="value.searchName" slot="prepend" style="width:100px;">
|
||
<el-option label="姓名" value="username"></el-option>
|
||
<el-option label="工号" value="loginname"></el-option>
|
||
</el-select>
|
||
</el-input>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="search-item">
|
||
<div class="search-item-label">在职状态:</div>
|
||
<div class="search-item-option">
|
||
<dict-select v-model="value.userState" style="width: 100%" clearable
|
||
placeholder="在职状态"
|
||
code="userState"></dict-select>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<template v-if="searchMore">
|
||
<div class="search-item">
|
||
<div class="search-item-label">人员类型:</div>
|
||
<div class="search-item-option">
|
||
<dict-select v-model="value.personType" style="width: 100%" clearable
|
||
placeholder="人员类型"
|
||
code="UserType"></dict-select>
|
||
</div>
|
||
</div>
|
||
<div class="search-item">
|
||
<div class="search-item-label">所属工会:</div>
|
||
<div class="search-item-option">
|
||
<el-select v-model="value.union" style="width: 100%" filterable clearable
|
||
placeholder="请选择" @change="getUnits">
|
||
<el-option
|
||
v-for="item in unions"
|
||
:key="item.id"
|
||
:label="item.unionname"
|
||
:value="item.id">
|
||
</el-option>
|
||
</el-select>
|
||
</div>
|
||
</div>
|
||
<div class="search-item">
|
||
<div class="search-item-label">所在单位:</div>
|
||
<div class="search-item-option">
|
||
<el-select v-model="value.unit" style="width: 100%" filterable clearable
|
||
placeholder="请选择">
|
||
<el-option
|
||
v-for="item in units"
|
||
:key="item.id"
|
||
:label="item.name"
|
||
:value="item.id">
|
||
</el-option>
|
||
</el-select>
|
||
</div>
|
||
</div>
|
||
|
||
<slot name="rear"></slot>
|
||
|
||
</template>
|
||
|
||
<div class="search-query">
|
||
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
|
||
<more v-model="searchMore"></more>
|
||
</div>
|
||
</div>
|
||
</el-card>
|
||
</template>
|
||
|
||
|
||
<script>
|
||
module.exports = {
|
||
components: {
|
||
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
|
||
},
|
||
props: {
|
||
value: {type: Object},
|
||
has_year: {
|
||
type: Boolean,
|
||
default: false
|
||
},
|
||
},
|
||
model: {
|
||
prop: 'value',
|
||
event: 'search'
|
||
},
|
||
data() {
|
||
return {
|
||
searchMore: false,
|
||
units: [],
|
||
unions: [],
|
||
}
|
||
},
|
||
methods: {
|
||
doSearch() {
|
||
|
||
this.$emit("search", this.value)
|
||
},
|
||
async getUnits() {
|
||
this.$set(this.value, "unit", "")
|
||
this.units = await getUnits(this.value.union)
|
||
},
|
||
},
|
||
async created() {
|
||
this.getUnits()
|
||
this.unions = await getUnions()
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
|
||
</style> |