|
@@ -0,0 +1,97 @@
|
|
|
|
|
+// 选择企业
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <div @click="showModel">
|
|
|
|
|
+ <a-space>
|
|
|
|
|
+ <home-outlined/>
|
|
|
|
|
+ <slot name="text"></slot>
|
|
|
|
|
+ </a-space>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <a-modal v-model:visible="visible" title="选择企业" :bodyStyle="{padding:'10px'}" width="900px" :footer="null" :afterClose="handleCancel">
|
|
|
|
|
+ <a-input class="search-panel" v-model:value="search" placeholder="搜索内容" @keyup.enter="searchData" allowClear></a-input>
|
|
|
|
|
+ <a-table class="ant-table-striped" :row-class-name="(_record, index) => (index % 2 === 1 ? 'table-striped' : null)" :scroll="{x:'max-content',y:'500px'}" :dataSource="dataSource" :columns="props.columns || columns" size="small" :pagination="{defaultPageSize:20,total:total}" @change="onChange">
|
|
|
|
|
+ <template #bodyCell="{ column,record }">
|
|
|
|
|
+ <slot name="tb_cell" :data="{column, record}"></slot>
|
|
|
|
|
+ <template v-if="column.dataIndex === 'operation'">
|
|
|
|
|
+ <a @click="onSelect(column,record)">选 择</a>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </a-table>
|
|
|
|
|
+ </a-modal>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script setup>
|
|
|
|
|
+import {ref,defineProps,defineEmits,defineExpose} from 'vue'
|
|
|
|
|
+import { HomeOutlined } from '@ant-design/icons-vue';
|
|
|
|
|
+import Api from '@/api/api'
|
|
|
|
|
+const props = defineProps({
|
|
|
|
|
+ param: Object,
|
|
|
|
|
+ columns:Array
|
|
|
|
|
+})
|
|
|
|
|
+const emit = defineEmits(['onSelect'])
|
|
|
|
|
+const visible = ref(false)
|
|
|
|
|
+const search = ref('')
|
|
|
|
|
+const total = ref(0)
|
|
|
|
|
+const dataSource = ref([])
|
|
|
|
|
+const columns = ref([{
|
|
|
|
|
+ title: '企业名称',
|
|
|
|
|
+ dataIndex: 'enterprisename',
|
|
|
|
|
+ key: 'enterprisename',
|
|
|
|
|
+ width:250
|
|
|
|
|
+},
|
|
|
|
|
+{
|
|
|
|
|
+ title: '联系人',
|
|
|
|
|
+ dataIndex: 'contact',
|
|
|
|
|
+ key: 'contact',
|
|
|
|
|
+},
|
|
|
|
|
+{
|
|
|
|
|
+ title: '联系电话',
|
|
|
|
|
+ dataIndex: 'phonenumber',
|
|
|
|
|
+ key: 'phonenumber',
|
|
|
|
|
+},{
|
|
|
|
|
+ title: '操作',
|
|
|
|
|
+ dataIndex: 'operation',
|
|
|
|
|
+ key: 'operation',
|
|
|
|
|
+}])
|
|
|
|
|
+const showModel = ()=>{
|
|
|
|
|
+ visible.value = true
|
|
|
|
|
+ tableData()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const onChange = (pagination, filters, sorter, { currentDataSource })=>{
|
|
|
|
|
+ props.param.content.pageNumber = pagination.current
|
|
|
|
|
+ props.param.content.pageSize = pagination.pageSize
|
|
|
|
|
+ tableData()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const tableData = async ()=>{
|
|
|
|
|
+ const res = await Api.requested(props.param)
|
|
|
|
|
+ dataSource.value = res.data
|
|
|
|
|
+ total.value = res.total
|
|
|
|
|
+}
|
|
|
|
|
+const searchData = ()=>{
|
|
|
|
|
+ props.param.content.where.condition = search.value
|
|
|
|
|
+ props.param.content.pageNumber = 1
|
|
|
|
|
+ tableData()
|
|
|
|
|
+}
|
|
|
|
|
+const onSelect = (val,record)=>{
|
|
|
|
|
+ emit('onSelect',record)
|
|
|
|
|
+ visible.value = false
|
|
|
|
|
+}
|
|
|
|
|
+const handleCancel = () =>{
|
|
|
|
|
+ search.value = ''
|
|
|
|
|
+}
|
|
|
|
|
+defineExpose({
|
|
|
|
|
+ visible
|
|
|
|
|
+})
|
|
|
|
|
+</script>
|
|
|
|
|
+<style scoped>
|
|
|
|
|
+.search-panel{
|
|
|
|
|
+ width: 300px;
|
|
|
|
|
+ margin-bottom:10px;
|
|
|
|
|
+}
|
|
|
|
|
+.ant-table-striped :deep td{
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|