<template>
|
<div class="add-common">
|
<el-dialog
|
:title="'相关供应商'"
|
:visible.sync="editConfig.visible"
|
:width="dialogWidth"
|
:before-close="handleClose"
|
:close-on-click-modal="false"
|
append-to-body
|
custom-class="iframe-dialog"
|
>
|
<div class="table-view">
|
<TableCommonView ref="tableListRef" :table-list="tableList" @selCommonClick="selCommonClick"> </TableCommonView>
|
<div class="btn-pager">
|
<PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
|
</div>
|
</div>
|
<div slot="footer" class="dialog-footer"></div>
|
<!-- 详情 -->
|
<DetailSupplier v-if="commonDetail.visible" :common-detail="commonDetail" />
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import { getProductListTwo,getSupplierByNumber} from "@/api/productManage/product"
|
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
|
import DetailSupplier from "@/views/supplierManage/supplier/DetailSupplier"
|
export default {
|
name: "AddSupplierDialog",
|
mixins: [pageMixin],
|
props: {
|
commonConfig: {
|
type: Object,
|
default: () => {
|
return {
|
visible: false,
|
infomation: {}
|
}
|
}
|
}
|
},
|
components: { DetailSupplier },
|
computed: {},
|
data() {
|
return {
|
dialogWidth: "60%",
|
editConfig: this.commonConfig,
|
tableList: {},
|
commonDetail: {
|
visible: false,
|
infomation: {}
|
},
|
showCol: ["供应商编号", "供应商名称", "采购价格", "供货天数", "物流时长(天)"],
|
tableColumn: [
|
{ label: "供应商编号", prop: "supplierNumber", min: 190, isCommonClick: true },
|
{ label: "供应商名称", prop: "supplierName", min: 130 },
|
{ label: "采购价格", prop: "purchasePrice", min: 130 },
|
{ label: "供货天数", prop: "deliveryTime", min: 130 },
|
{ label: "物流时长(天)", prop: "shippingDuration", min: 130 }
|
],
|
thatNumber:''
|
}
|
},
|
created() {
|
this.setTable()
|
this.getData()
|
},
|
methods: {
|
setColumnVisible(showCol) {
|
return this.tableColumn.map((ele) => {
|
return {
|
...ele,
|
isShowColumn: showCol.includes(ele.label)
|
}
|
})
|
},
|
setTable() {
|
this.tableList = {
|
tableInfomation: [],
|
selectIndex: true,
|
highlight: true,
|
ref: "tableListRef",
|
showcol: this.showCol,
|
allcol: [],
|
tableColumn: this.setColumnVisible(this.showCol)
|
}
|
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)
|
},
|
// 产品列表
|
async getData(val, content) {
|
console.log(val, content)
|
await getProductListTwo({
|
number: this.editConfig.infomation.number,
|
page: this.pagerOptions.currPage,
|
pageSize: this.pagerOptions.pageSize
|
}).then((res) => {
|
console.log(res.data)
|
const list = res.data.list.map((item) => {
|
return {
|
...item,
|
supplierNumber: item.supplier.number,
|
supplierName: item.supplier.name
|
}
|
})
|
this.tableList.tableInfomation = list || []
|
this.pagerOptions.totalCount = res.data.total
|
})
|
},
|
// 单条供应商数据-详情
|
async getSupplierByNumber() {
|
await getSupplierByNumber(
|
this.thatNumber
|
).then((res) => {
|
this.commonDetail.infomation = { ...res.data.res }
|
})
|
},
|
handleClose() {
|
this.editConfig.visible = false
|
},
|
async selCommonClick(row) {
|
this.thatNumber=row.supplier.number
|
await this.getSupplierByNumber()
|
this.commonDetail.visible = true
|
}
|
}
|
}
|
</script>
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<style lang="scss" scoped>
|
::v-deep {
|
.iframe-dialog .el-dialog__body {
|
.table-view {
|
margin: 10px;
|
.btn-pager {
|
display: flex;
|
align-items: center;
|
.page {
|
margin-left: auto;
|
}
|
}
|
}
|
}
|
.el-dialog__footer {
|
background-color: #ffffff;
|
height: 10px;
|
border-top: 0px;
|
}
|
}
|
</style>
|