emis-frontend/src/views/emis/EmisBaseTools/AddressSelectPicker.vue

151 lines
4.2 KiB
Vue
Raw Normal View History

2024-05-07 04:53:57 +00:00
<template>
<div >
<search-form :model="queryParams" ref="queryForm" size="mini" :maxShow="3" label-width="68px" v-show="showSearch" @search="handleQuery" @reset="resetQuery">
<el-form-item label="" prop="name" >
<el-input
v-model="queryParams.searchValue"
:placeholder="$t('搜索名称电话或公司')"
clearable
@keyup.enter.native="handleQuery"
@input="handleQuery"
/>
</el-form-item>
<el-form-item label="" prop="country">
<CountryPicker :placeholder="$t('所属国家')" v-model="queryParams.country" @onChange="handleQuery"></CountryPicker>
</el-form-item>
</search-form>
<xd-table v-loading="loading"
border stripe
size="mini"
:data="emisCustomerAddressList"
:showSearch.sync="showSearch"
:queryParams="queryParams"
:total="total"
:showOperateButton="false"
@queryTable="getList"
@selection-change="handleSelectionChange"
@sort-change="handleSortChange"
style="overflow:auto;height:400px;"
@row-click="handleSelect"
>
<el-table-column :label="$t('名称')" align="left" prop="name" width="100" />
<el-table-column :label="$t('电话')" align="left" prop="phone" width="100" />
<el-table-column :label="$t('地址')" align="left" prop="country" min-width="100" >
<template slot-scope="scope">
<div>{{scope.row.countryName}}{{scope.row.provinceName}}{{scope.row.cityName}}{{scope.row.countyName}} {{scope.row.address}}</div>
</template>
</el-table-column>
<el-table-column :label="$t('公司')" align="left" prop="company" width="100" />
</xd-table>
</div>
</template>
<script>
import { listSimpleEmisCustomerAddress } from "@/api/emis/emisCustomerAddress";
import CountryPicker from '@/views/emis/EmisBaseTools/CountryPicker.vue';
export default {
name: "AddressSelectPicker",
props:{
addressType:{
type:[String,Number]
},
},
components: { CountryPicker },
dicts: [
],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 创建时间搜索
dateTimeRange:[],
// 总条数
total: 0,
// 客户收寄件地址表格数据
emisCustomerAddressList: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
addressType: this.addressType,
searchValue:null,
},
};
},
watch: {
addressType(newVal){
this.queryParams.addressType=this.addressType;
this.getList();
},
},
created() {
this.getList();
},
methods: {
/** 查询客户收寄件地址列表 */
getList() {
this.loading = true;
listSimpleEmisCustomerAddress(this.queryParams).then(response => {
this.emisCustomerAddressList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
// 排序 查询字段是表格中字段名字 动态取值排序顺序
handleSortChange(column) {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
this.getList();
},
handleSelect(row, event, column){
console.log(row)
this.$emit("onSelected",row);
},
/** 列索引函数 */
getIndex($index) {
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1
},
}
};
</script>
<style scoped>
.el-divider{
margin-top: 0px;
background: 0 0;
border-top: 1px solid #E6EBF5;
}
.el-divider__text {
color: #0955ee;
cursor: pointer;
}
</style>