<template>
|
<div class="edit-selClient-box">
|
<el-dialog
|
:title="'供应商名称'"
|
:visible.sync="editConfig.editVisible"
|
:width="dialogWidth"
|
:before-close="handleClose"
|
:append-to-body="true"
|
:close-on-click-modal="false"
|
>
|
<div class="bg-view">
|
<div class="query-bg">
|
<SearchCommonView
|
ref="searchCommonView"
|
:search-options="searchOptions"
|
@searchClick="searchClick"
|
@resetClick="resetClick"
|
/>
|
<div class="btn">
|
<!-- <el-button type="primary" size="mini" disabled>设置字段</el-button>
|
<el-button type="primary" size="mini" disabled>快速创建</el-button> -->
|
</div>
|
</div>
|
<TableCommonView
|
ref="tableListRef"
|
v-loading="loading"
|
:table-list="tableList"
|
:select-box="false"
|
@selCommonClick="selNameClick"
|
@selTableCol="selTableCol"
|
>
|
</TableCommonView>
|
<div slot="footer" class="dialog-footer">
|
<div class="btn-pager">
|
<PagerView class="page" :pagerCount="5" :layout="'total, sizes, prev, pager, next'" :pager-options="pagerOptions" v-on="pagerEvents" />
|
</div>
|
</div>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import { getSupplierList } from "@/api/supplierManage/supplier"
|
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
|
|
export default {
|
name: "EditSelClientDialog",
|
mixins: [pageMixin],
|
props: {
|
editCommonConfig: {
|
type: Object,
|
default: () => {
|
return {
|
editVisible: false,
|
title: "",
|
infomation: {}
|
}
|
}
|
}
|
},
|
components: {},
|
computed: {},
|
data() {
|
return {
|
dialogWidth: "40%",
|
editConfig: this.editCommonConfig,
|
queryInput: "",
|
select: "1",
|
tableData: [],
|
searchSelOptions: [],
|
loading: false,
|
searchOptions: [],
|
tableList: {},
|
search_map: {},
|
tableColumn: [
|
{ label: "供应商编号", prop: "number", min: 190 },
|
{ label: "供应商名称", prop: "name", min: 130, isCommonClick: true },
|
{ label: "供应商类型", prop: "supplierType", min: 130 },
|
{ label: "所属行业", prop: "industry", min: 130 },
|
{ label: "联系人", prop: "contact", min: 130 },
|
{ label: "联系电话", prop: "phone", min: 130 },
|
{ label: "状态", prop: "status_name", min: 130 },
|
{ label: "创建时间", prop: "member_name", min: 130 }
|
],
|
showCol: ["供应商编号", "供应商名称", "供应商类型", "联系人", "联系电话", "状态"]
|
}
|
},
|
created() {
|
this.setTable()
|
this.getData()
|
},
|
mounted() {},
|
methods: {
|
setTable() {
|
this.tableList = {
|
tableInfomation: [],
|
tableColumn: this.setColumnVisible(this.showCol),
|
showcol: this.showCol,
|
allcol: []
|
}
|
this.tableList.allcol = this.tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
|
this.searchOptions = []
|
for (let i = 0; i < this.tableList.tableColumn.length; i++) {
|
const label = this.tableList.tableColumn[i].label
|
const value = this.tableList.tableColumn[i].prop
|
this.searchOptions.push({ value: value, label: label })
|
}
|
},
|
selTableCol(val) {
|
this.showcol = val
|
this.tableList.tableColumn = this.setColumnVisible(val)
|
},
|
setColumnVisible(showCol) {
|
return this.tableColumn.map((ele) => {
|
return {
|
...ele,
|
isShowColumn: showCol.includes(ele.label)
|
}
|
})
|
},
|
handleClose() {
|
this.editConfig.editVisible = false
|
},
|
// 请求数据
|
async getData(val) {
|
this.loading = true
|
|
await getSupplierList({
|
keyword: val,
|
status:1,
|
page: this.pagerOptions.currPage,
|
pageSize: this.pagerOptions.pageSize
|
})
|
.then((res) => {
|
if (res.code == 200) {
|
if (res.data.list && res.data.list.length > 0) {
|
const list = res.data.list.map((item) => {
|
return {
|
...item,
|
status_name: item.status === 0 ? "未启用" : "启用"
|
}
|
})
|
this.tableList.tableInfomation = list
|
this.pagerOptions.totalCount = res.data.total
|
} else {
|
this.tableList.tableInfomation = []
|
}
|
} else {
|
this.tableList.tableInfomation = []
|
}
|
this.loading = false
|
})
|
.catch((err) => {
|
console.log(err)
|
this.tableList.tableInfomation = []
|
this.loading = false
|
})
|
},
|
selNameClick(row) {
|
this.editConfig.editVisible = false
|
this.$emit("selClient", row)
|
},
|
// 搜索
|
searchClick(val) {
|
this.getData(val)
|
},
|
resetClick() {
|
this.getData()
|
}
|
}
|
}
|
</script>
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<style lang="scss" scoped>
|
.bg-view {
|
margin: 10px;
|
.query-bg {
|
margin-left: -20px;
|
margin-bottom: 10px;
|
display: flex;
|
justify-content: space-between;
|
.el-input {
|
width: 310px;
|
.el-select {
|
width: 100px;
|
}
|
}
|
.btn {
|
float: right;
|
}
|
}
|
}
|
.sel-name {
|
color: $color-primary;
|
cursor: pointer;
|
}
|
.dialog-footer {
|
height: 50px;
|
line-height: 50px;
|
color: red;
|
.btn-pager {
|
display: flex;
|
margin-top: 0px;
|
.page {
|
margin-left: auto;
|
}
|
}
|
}
|
::v-deep {
|
.input-with-select .el-input-group__prepend {
|
background-color: #fff;
|
}
|
}
|
</style>
|