<template>
|
<div class="detail-view">
|
<el-drawer :visible.sync="detailConfig.visible" size="80%" :before-close="handleClose" :append-to-body="true">
|
<template slot="title">
|
<div class="header">
|
<span class="header-label">供应商名称</span>
|
<span class="header-title">{{ detailConfig.infomation.name }}</span>
|
</div>
|
</template>
|
<div class="content">
|
<div class="tab-view">
|
<el-tabs v-model="activeName" @tab-click="tabsClick">
|
<el-tab-pane label="详情" name="first"></el-tab-pane>
|
<el-tab-pane label="采购订单" name="second"> </el-tab-pane>
|
</el-tabs>
|
</div>
|
<div v-if="activeName === 'first'" class="detail">
|
<!-- 基本信息 -->
|
<div class="basic-info">
|
<div class="basic-info-label" @click="expandClick('basic')">
|
<i v-if="isBasicExpand" class="el-icon-arrow-down"></i>
|
<i v-else class="el-icon-arrow-up"></i>
|
<span style="margin-left: 10px">基本信息</span>
|
</div>
|
<div v-show="isBasicExpand" class="basic-info-content">
|
<ul>
|
<li v-for="(item, i) in basicInfoList" :key="i">
|
<div class="left">
|
<div class="content-title">{{ item.leftStr + ":" }}</div>
|
<div class="content-data">{{ item.leftValue ? item.leftValue : "--" }}</div>
|
</div>
|
<div v-if="item.rightStr && item.rightStr.length > 0" class="right">
|
<div class="content-title">{{ item.rightStr + ":" }}</div>
|
<div class="content-data">{{ item.rightValue ? item.rightValue : "--" }}</div>
|
</div>
|
</li>
|
</ul>
|
<div class="business_scope">
|
<div class="content-title">{{ "详细地址" }}</div>
|
<div class="content-data">
|
{{ detailConfig.infomation.detailAddress ? detailConfig.infomation.detailAddress : "--" }}
|
</div>
|
</div>
|
</div>
|
</div>
|
<!-- 账户信息 -->
|
<div class="basic-info">
|
<div class="basic-info-label" @click="expandClick('dynamic')">
|
<i v-if="isDynamicExpand" class="el-icon-arrow-down"></i>
|
<i v-else class="el-icon-arrow-up"></i>
|
<span style="margin-left: 10px">账户信息</span>
|
</div>
|
<div v-show="isDynamicExpand" class="basic-info-content">
|
<ul>
|
<li v-for="(item, i) in dynamicInfoList" :key="i">
|
<div class="left">
|
<div class="content-title">{{ item.leftStr + ":" }}</div>
|
<div class="content-data">{{ item.leftValue ? item.leftValue : "--" }}</div>
|
</div>
|
<div v-if="item.rightStr && item.rightStr.length > 0" class="right">
|
<div class="content-title">{{ item.rightStr + ":" }}</div>
|
<div class="content-data">{{ item.rightValue ? item.rightValue : "--" }}</div>
|
</div>
|
</li>
|
</ul>
|
<div class="business_scope">
|
<div class="content-title">{{ "合同附件" }}</div>
|
<div class="content-data downFlie" @click="downLoadFiles">
|
{{ detailConfig.infomation.contract.fileName ? detailConfig.infomation.contract.fileName : "--" }}
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div v-if="activeName === 'second'" class="detail">
|
<!-- 采购订单-基本信息 -->
|
<!-- 产品信息 -->
|
<div class="basic-info">
|
<div class="basic-info-content" >
|
<el-button type="primary" size="mini" @click="toPurchaseBtn"><i class="el-icon-plus"></i> 新建</el-button>
|
<TableCommonView
|
style="margin-top: 2px"
|
class="content-table"
|
ref="tableListRef"
|
:table-list="tableList"
|
@selTableCol="selTableCol"
|
>
|
</TableCommonView>
|
</div>
|
</div>
|
</div>
|
</div>
|
</el-drawer>
|
</div>
|
</template>
|
|
<script>
|
import download from "downloadjs"
|
export default {
|
name: "DetailSupplier",
|
props: {
|
commonDetail: {
|
type: Object,
|
default: () => {
|
return {
|
visible: false,
|
infomation: {},
|
productListInfo:[]
|
}
|
}
|
}
|
},
|
components: {},
|
computed: {},
|
data() {
|
return {
|
detailConfig: this.commonDetail,
|
activeName: "first",
|
isBasicExpand: true, // 基本信息展开
|
basicInfoList: [],
|
isDynamicExpand: true, // 账户信息
|
dynamicInfoList: [],
|
addConfig: {},
|
record: "", // 最新进展
|
noContactDays: 0,
|
newContactDays: "",
|
tableList:{},
|
showCol: ['采购单号', '采购单名称', '单据类型', '供应商名称', '采购数量', '收货仓库','经办人','制单人'],
|
tableColumn: [
|
{ label: "单据类型", prop: "orderType", min: 130 },
|
{ label: "采购单号", prop: "number", min: 150,default:true},
|
{ label: "采购单名称", prop: "name", min: 130 },
|
{ label: "供应商名称", prop: "supplierName", min: 130 },
|
{ label: "采购数量", prop: "quantity", min: 130 },
|
{ label: "收货仓库", prop: "warehouse", min: 130 },
|
{ label: "经办人", prop: "handledBy", min: 130 },
|
{ label: "制单人", prop: "creator", min: 130 }
|
],
|
}
|
},
|
created() {
|
console.log(this.commonDetail,"抽屉组件props")
|
this.setData(this.detailConfig.infomation)
|
this.addConfig = {
|
id_name: "sales_leads_id",
|
id: this.detailConfig.infomation.id,
|
common_name: this.detailConfig.infomation.id,
|
sales_leads_name: this.detailConfig.infomation.name,
|
sales_leads_id: this.detailConfig.infomation.id
|
}
|
},
|
mounted() {},
|
methods: {
|
setData(item) {
|
if (item.FollowRecord && item.FollowRecord.length > 0) {
|
this.record = item.FollowRecord[0].record
|
console.log(item.FollowRecord[0].follow_time)
|
let follow_time = item.FollowRecord[0].follow_time
|
this.newContactDays = follow_time.substring(0, 10)
|
this.noContactDays = this.getDiffDay(Date.now(), this.newContactDays)
|
}
|
this.basicInfoList = [
|
{
|
leftStr: "供应商编号",
|
leftValue: item.number,
|
rightStr: "供应商名称",
|
rightValue: item.name
|
},
|
{
|
leftStr: "供应商类型",
|
leftValue: item.supplierType,
|
rightStr: "所属行业",
|
rightValue: item.industry
|
},
|
{
|
leftStr: "联系人",
|
leftValue: item.contact,
|
rightStr: "联系电话",
|
rightValue: item.phone
|
},
|
{
|
leftStr: "采购负责人",
|
leftValue: item.responsiblePersonName,
|
rightStr: "网址",
|
rightValue: item.url
|
},
|
{
|
leftStr: "邮箱",
|
leftValue: item.email,
|
rightStr: "",
|
rightValue: ""
|
}
|
]
|
this.purchaseList = [
|
{
|
leftStr: "采购单号",
|
leftValue: item.number,
|
rightStr: "采购单名称",
|
rightValue: item.name
|
},
|
{
|
leftStr: "供应商类型",
|
leftValue: item.supplierType,
|
rightStr: "所属行业",
|
rightValue: item.industry
|
},
|
{
|
leftStr: "单据类型",
|
leftValue: item.contact,
|
rightStr: "供应商名称",
|
rightValue: item.phone
|
},
|
{
|
leftStr: "采购数量",
|
leftValue: item.responsiblePersonName,
|
rightStr: "收货仓库",
|
rightValue: item.url
|
},
|
{
|
leftStr: "经办人",
|
leftValue: item.email,
|
rightStr: "制单人",
|
rightValue: ""
|
},
|
{
|
leftStr: "状态",
|
leftValue: item.email,
|
rightStr: "",
|
rightValue: ""
|
},
|
]
|
this.dynamicInfoList = [
|
{
|
leftStr: "户名",
|
leftValue: item.accountName,
|
rightStr: "开户行",
|
rightValue: item.bank
|
},
|
{
|
leftStr: "账号",
|
leftValue: item.account,
|
rightStr: "",
|
rightValue: ""
|
}
|
]
|
this.detailConfig.productListInfo.map((item)=>{
|
item.supplierName=item.supplier.name
|
})
|
this.tableList = {
|
tableInfomation: this.detailConfig.productListInfo?this.detailConfig.productListInfo:[],
|
selectIndex: true,
|
showcol: this.showCol,
|
allcol:[],
|
tableColumn:this.setColumnVisible(this.showCol),
|
};
|
this.tableList.allcol = this.tableList.tableColumn.filter(ele=>!ele.default).map(ele=>ele.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.detailConfig.visible = false
|
},
|
// tab切换
|
tabsClick(tab, event) {
|
console.log(tab, event)
|
},
|
// 展开收起点击事件
|
expandClick(value) {
|
console.log(value)
|
if (value === "basic") {
|
this.isBasicExpand = !this.isBasicExpand
|
} else if (value === "dynamic") {
|
this.isDynamicExpand = !this.isDynamicExpand
|
}
|
},
|
// 计算两个日期之间的差值
|
getDiffDay(date_1, date_2) {
|
let totalDays, diffDate
|
let myDate_1 = date_1
|
let myDate_2 = Date.parse(date_2)
|
// 将两个日期都转换为毫秒格式,然后做差
|
diffDate = Math.abs(myDate_1 - myDate_2) // 取相差毫秒数的绝对值
|
|
totalDays = Math.floor(diffDate / (1000 * 3600 * 24)) // 向下取整
|
// console.log(totalDays)
|
|
return totalDays // 相差的天数
|
},
|
toPurchaseBtn(){
|
this.$router.push({
|
name: 'purchase',
|
params: {
|
supplierId:this.commonDetail.infomation.ID,
|
supplierName:this.commonDetail.infomation.name
|
}
|
});
|
},
|
// 下载合同附件
|
downLoadFiles(){
|
if(this.detailConfig.infomation.contract.fileName){
|
let url = "/api/downloadContract?id=" + this.commonDetail.infomation.fileId
|
download(url, "", "")
|
}
|
}
|
}
|
}
|
</script>
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<style lang="scss" scoped>
|
::v-deep {
|
.header {
|
height: 56px;
|
display: flex;
|
align-items: center;
|
padding-left: 10px;
|
.header-label {
|
padding: 5px;
|
border-radius: 4px;
|
background-color: #ff6600;
|
color: #fff;
|
font-size: 12px;
|
}
|
.header-title {
|
color: #323232;
|
font-size: 15px;
|
margin-left: 10px;
|
font-weight: inherit;
|
}
|
}
|
.content {
|
background-color: rgb(230, 233, 240);
|
padding: 8px;
|
.tab-view {
|
background: #fff;
|
// .tab-view-pane {
|
// position: relative;
|
.item {
|
position: absolute;
|
top: 0px;
|
right: 0px;
|
}
|
// }
|
}
|
.detail {
|
.basic-info {
|
.basic-info-label {
|
padding-left: 10px;
|
height: 42px;
|
line-height: 42px;
|
background: #f4f8fe;
|
color: #333;
|
font-size: 14px;
|
}
|
.basic-info-content {
|
margin-top: 10px;
|
background: #fff;
|
ul {
|
padding-inline-start: 0;
|
}
|
li {
|
display: flex;
|
font-size: 14px;
|
font-family: PingFangSC;
|
border-bottom: 1px solid #f9f9fb;
|
.left,
|
.right {
|
width: 50%;
|
display: flex;
|
align-items: center;
|
height: 40px;
|
.content-title {
|
width: 320px;
|
text-align: right;
|
color: #555;
|
}
|
.content-data {
|
text-align: left;
|
margin-left: 25px;
|
color: #333;
|
}
|
}
|
.remark {
|
width: 100%;
|
}
|
}
|
.business_scope {
|
display: flex;
|
align-items: center;
|
font-size: 14px;
|
min-height: 40px;
|
.content-title {
|
width: 320px;
|
text-align: right;
|
color: #555;
|
}
|
.content-data {
|
flex: 1;
|
padding: 5px;
|
text-align: left;
|
margin-left: 25px;
|
color: #333;
|
}
|
}
|
}
|
}
|
}
|
.second {
|
background: #fff;
|
.followup-records {
|
.table-view {
|
margin-top: 0 !important;
|
margin-bottom: 0;
|
}
|
}
|
}
|
}
|
|
.el-drawer__header {
|
padding: 0;
|
margin-bottom: 0px;
|
}
|
.el-tabs--top .el-tabs__item.is-top:nth-child(2) {
|
padding-left: 20px;
|
}
|
.el-tabs__item.is-active {
|
color: $color-primary;
|
}
|
.el-tabs__item:hover {
|
color: $color-primary;
|
}
|
.el-tabs__active-bar {
|
background-color: $color-primary;
|
}
|
.el-tabs__header {
|
margin: 0;
|
}
|
}
|
.downFlie{
|
color: blue !important;
|
cursor: pointer;
|
}
|
</style>
|