<template> <span> <c-button type="primary" icon="el-icon-search" class="m-inputbtn-btn" @click="onDialogOpen"></c-button> <el-dialog title="机构选择(双击以选择机构)" :visible.sync="dialogOpen" append-to-body> <c-list-search ref="listSearch" @form-reset="handleReset" @form-search="handleSearch" :formCount="formCount"> <template v-slot="slotProps"> <el-form class="m-table-search-form" :model="model" ref="paramsForm" :inline="true" label-position="right" label-width="100px" size="small"> <el-form-item label="机构号" prop="instCode"> <c-input v-model="model.instCode" style="width:100%" maxlength="16" placeholder="请输入"></c-input> </el-form-item> <el-form-item label="机构名称" prop="instName"> <c-input v-model="model.instName" style="width:100%" maxlength="16" placeholder="请输入"></c-input> </el-form-item> </el-form> </template> </c-list-search> <c-list-page ref="cList" :columnsConfig="columnsConfig" :params="searchParams" :pageSize="pageSize" :multipleSelect="false" :loadDataFirstRender="false" :url="url" :watchCurrentChg="false" @current-change="handleCurrentChange" @row-dblclick="handleRowDBClick" maxHeight="300px" /> </el-dialog> </span> </template> <script> import Api from "~/service/Api"; import Utils from "~/utils" export default { data: function () { return { dialogOpen:false, loading:true, model:{ instCode:'', instName:'' }, formCount: 2, // 传入搜索项的数量,组件根据数量判断是否可收起 // 映射到 list 中的搜索参数模型,searchParams 改变后会自动重新拉取数据 searchParams: {}, // 列表的配置项 columnsConfig: [ { prop: "instCode", label: "机构代码", width: '100' }, { prop: "instName", label: "机构名称", width: '100' }, { prop: "inClearInstTpName", label: "国结机构类型", width: '120' }, { prop: "instLvlName", label: "机构层级", width: '100' }, { prop: "supInstName", label: "上级机构名称", width: '120' }, { prop: "supBusiInstNo", label: "上级业务机构", width: '120' }, { prop: "swiftNo", label: "swift号码", width: '100' }, { prop: "instCnAddr", label: "机构中文地址", width: '120' }, { prop: 'enableFlagName', label: '启用标识', width: '100' } ], // 每页展示的数据。默认为20 pageSize: 10, url:"v1/pm/instManage/queryPage" } }, methods: { onDialogOpen(){ this.dialogOpen = true }, handleRowDBClick: function (row) { this.$emit('instselect',row) this.dialogOpen = false }, // 重置搜索条件需要更新到 searchParams 上 handleReset: function () { this.model = { instCode: '', instName: '' } }, handleCurrentChange: async function(){ this.handleSearch() }, // 点击搜索需要更新 searchParams 的值,注意不能直接将 params 赋值给 searchParams handleSearch: async function () { let requrl = this.url+"?pageIndex=" +this.$refs['cList'].listConfig.current +"&pageSize="+this.pageSize; this.$refs['cList'].loading = true; let rtnmsg = await Api.post(requrl,this.model); if(rtnmsg.code == 0){ this.$refs['cList'].listConfig.list = rtnmsg.data; this.$refs['cList'].listConfig.total = rtnmsg.pageInfo.total; this.$refs['cList'].listConfig.current = rtnmsg.pageInfo.pageIndex; }else { this.$notify.error({ title: "错误", message: "服务请求失败!" }); } this.$refs['cList'].loading = false; } } } </script> <style> .m-table .m-table-operation { margin-top: 15px; } .m-table .m-table-search-operation-simple { position: absolute; right: 20px; top: 20px; } </style>