|
|
<template> <el-dialog append-to-body title="查询人员" :close-on-click-modal="false" :close-on-press-escape="false" @close="closeDialog" :visible.sync="visible" width="685px" v-drag> <el-form label-position="top" inline="inline" size="mini" label-width="120px"> <el-form-item label="编码" > <el-input v-model="param1"></el-input> </el-form-item> <el-form-item label="名称" > <el-input v-model="param2"></el-input> </el-form-item>
<el-button style="margin-top: 18px" type="primary" @click="getDataList(false)">查询 </el-button> </el-form>
<el-table :height="height" :data="dataList" border @row-dblclick="getRowData" v-loading="dataListLoading" style="width: 100%;"> <el-table-column v-for="(item,index) in columnList" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> {{ scope.row[item.columnProp] }} </template> </el-table-column> </el-table>
<span slot="footer" class="dialog-footer"> <el-button @click="closeModel()" type="primary">关闭</el-button> </span> </el-dialog>
</template>
<script>
import { getChooselist, getChooselistData} from "@/api/chooselist/chooselist.js"
export default { data() { return { height: 200, tagNo: '', title: '列表', columnList: [ { columnProp: "username", headerAlign: "center", align: "left", columnLabel: "编码", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 50 }, { columnProp: "userDisplay", headerAlign: "center", align: "left", columnLabel: "名称", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 50 }, { columnProp: "site", headerAlign: "center", align: "left", columnLabel: "工厂编码", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 50 }, { columnProp: "buNo", headerAlign: "center", align: "left", columnLabel: "BU", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 50 }, ], queryTable: {}, visible: false, dataListLoading: false, fullscreenLoading: false, param1: '', param2: '', param3: '', param: '', site: '', conSql: '', param4: this.$store.state.user.site, dataList: [], baseListData: { caption1: '', caption2: '', caption3: '', caption4: '', description: '', fieldname1: '', fieldname2: '', sqlcode: '', tagno: '', }, defaultParam: false } }, methods: { closeModel(){ this.baseListData={ caption1: '', caption2: '', caption3: '', caption4: '', description: '', fieldname1: '', fieldname2: '', sqlcode: '', tagno: '', } this.dataList=[]; this.visible = false; },
// 获取 用户的配置
init(site,conSql,param) { this.visible = true; this.site=site this.param = param===null?'':param this.conSql = conSql?conSql: '' // 根据 tagNo 获取列表
this.getDataList(true)
this.dataListLoading = false }, getDataList (bool) { let sql = "select a.username,a.user_display userDisplay,b.site,b.bu_no as buNo from sys_user a left join AccessBu b on a.username=b.username where b.bu_no like '"
sql += this.conSql+"'" sql += " and b.site = '" + this.site + "'" if (bool) { sql += " and (a.username like '%" + this.param + "%' OR a.user_display like '%" + this.param + "%'" +" ) " } if (this.param1) { sql += " and a.username like '%" + this.param1 + "%'" } if (this.param2) { sql += " and a.user_display like '%" + this.param2 + "%'" } getChooselistData({"sqlcode": sql}).then(({data}) => { if (data.code == 0) { this.dataList = data.baseListData } else { this.$message.error(data.msg) } }) },
getRowData (row) { this.visible = false this.$emit('getBaseData',row)
},
closeDialog () {
this.dataList = [] } }}</script><style>
</style>
|