parent
6e1233cbc2
commit
2a85fae4da
@ -0,0 +1,104 @@
|
||||
<template>
|
||||
<div>
|
||||
<Modal :value="isShow" :title="title" @on-visible-change="$emit('update:isShow',$event)">
|
||||
<div class="searchPolicies">
|
||||
<el-input
|
||||
type="text"
|
||||
@keyup.enter.native="searchPolicies"
|
||||
v-model="keyword"
|
||||
placeholder="请输入关键词查找政策"
|
||||
></el-input>
|
||||
<el-button type="primary" @click="searchPolicies">查询</el-button>
|
||||
</div>
|
||||
|
||||
<Table
|
||||
size="small"
|
||||
highlight-row
|
||||
:columns="policyTable"
|
||||
:data="policies"
|
||||
@on-current-change="policySelect"
|
||||
/>
|
||||
|
||||
<Page
|
||||
:current="pageIndex"
|
||||
:total="total"
|
||||
simple
|
||||
style="padding-top: 14px;display: flex;justify-content: center;"
|
||||
@on-change="pageChange"
|
||||
/>
|
||||
</Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { index as policyIndex } from '@/api/policy'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
isShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: '政策选择'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyword: '',
|
||||
pageIndex: 1,
|
||||
total: 0,
|
||||
policies: [],
|
||||
policyTable: [
|
||||
{ title: '政策名称', key: 'name', align: 'left' }
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getPolicies() {
|
||||
const res = await policyIndex({
|
||||
page_size: 10,
|
||||
page: this.pageIndex,
|
||||
keyword: this.keyword
|
||||
})
|
||||
this.total = res.total || 0
|
||||
this.policies = res.data || res.rows || []
|
||||
},
|
||||
searchPolicies() {
|
||||
this.pageIndex = 1
|
||||
this.getPolicies()
|
||||
},
|
||||
pageChange(e) {
|
||||
this.pageIndex = e
|
||||
this.getPolicies()
|
||||
},
|
||||
policySelect(row) {
|
||||
if (!row) return
|
||||
this.$emit('select', row)
|
||||
this.$emit('update:isShow', false)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
isShow(newVal) {
|
||||
if (newVal) {
|
||||
this.keyword = ''
|
||||
this.pageIndex = 1
|
||||
this.getPolicies()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.searchPolicies{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom:16px;
|
||||
.el-input{
|
||||
width:80%
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
Reference in new issue