<template>
|
<div class="product">
|
<div v-if="isDetail" class="detail-top">
|
<DetailListCommonBtn :query-class-options="queryClassOptions" />
|
<PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
|
</div>
|
<div v-else class="top">
|
<SearchCommonView
|
ref="searchCommonView"
|
:query-class-options="queryClassOptions"
|
:search-options="searchOptions"
|
:search-sel="searchSel"
|
@searchClick="searchClick"
|
@resetClick="resetClick"
|
/>
|
<div class="btn-pager">
|
<PublicFunctionBtnView :statistics="true" :operates-list="operatesList" @batchDelete="delClick" />
|
<PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
|
</div>
|
</div>
|
<TableCommonView
|
ref="tableListRef"
|
v-loading="loading"
|
:table-list="tableList"
|
:select-box="!isDetail"
|
@getSelectArray="getSelectArray"
|
>
|
<!-- <template slot="tableButton">
|
<el-table-column label="操作" width="60" fixed="right">
|
<template slot-scope="scope">
|
<el-button @click="handleClick(scope.row)" type="text" size="small">编辑</el-button>
|
</template>
|
</el-table-column>
|
</template> -->
|
</TableCommonView>
|
</div>
|
</template>
|
|
<script>
|
import { getProductList } from "@/api/common/other"
|
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
|
|
export default {
|
name: "ProductView",
|
props: {
|
isDetail: {
|
type: Boolean,
|
default: false
|
},
|
addConfig: {
|
type: Object,
|
default: () => {
|
return {}
|
}
|
}
|
},
|
mixins: [pageMixin],
|
components: {},
|
computed: {},
|
data() {
|
return {
|
tableList: {},
|
loading: false,
|
activeName: "second",
|
queryClassValue: "1",
|
queryClassOptions: [
|
{ value: "1", label: "全部" },
|
{ value: "2", label: "今日联系" },
|
{ value: "3", label: "本周联系" },
|
{ value: "4", label: "本月联系" }
|
],
|
searchOptions: [],
|
operatesList: [
|
{ id: "1", name: "共享" },
|
{ id: "2", name: "批量编辑" },
|
{ id: "3", name: "导出" },
|
{ id: "4", name: "下载全部附件" },
|
{ id: "5", name: "更改创建人" },
|
{ id: "6", name: "树结构设置" },
|
{ id: "7", name: "审批设置" },
|
{ id: "8", name: "回访预设列宽" }
|
],
|
editConfig: {
|
visible: false,
|
title: "新建",
|
infomation: {}
|
},
|
saleChanceName: "",
|
contactsDeail: {
|
visible: false,
|
infomation: {}
|
},
|
clientDeail: {
|
visible: false,
|
infomation: {}
|
},
|
selValueList: [],
|
searchSel: {
|
value: "topic",
|
label: ""
|
},
|
search_map: {}
|
}
|
},
|
created() {
|
this.setTable()
|
if (!this.isDetail) {
|
this.search_map = {}
|
} else {
|
this.search_map = {
|
[this.addConfig.id_name]: this.addConfig.client_name
|
}
|
}
|
this.getData(this.search_map)
|
},
|
methods: {
|
setTable() {
|
this.tableList = {
|
tableInfomation: [],
|
tableColumn: [
|
{ label: "产品名称", prop: "topic" },
|
{ label: "产品编号", prop: "client_name" },
|
{ label: "产品类别", prop: "contact_name" },
|
{ label: "规格型号", prop: "client_status" },
|
{ label: "计量单位", prop: "contact_information_name" },
|
{ label: "产品报价", prop: "follow_time" },
|
{ label: "参考成本价", prop: "next_follow_time" },
|
{ label: "总库存数量", prop: "member_name" },
|
{ label: "负责人", prop: "record" }
|
]
|
}
|
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 })
|
}
|
},
|
// 请求数据
|
async getData() {
|
this.loading = true
|
await getProductList({
|
productName: "",
|
productNumber: "",
|
page: this.pagerOptions.currPage,
|
pageSize: this.pagerOptions.pageSize
|
})
|
.then((res) => {
|
console.log(res)
|
if (res.code === 200) {
|
if (res.data.list && res.data.list.length > 0) {
|
const list = res.data.list.map((item) => {
|
return {
|
...item
|
}
|
})
|
this.tableList.tableInfomation = list || []
|
this.pagerOptions.totalCount = res.data.count
|
} else {
|
this.tableList.tableInfomation = []
|
}
|
} else {
|
this.tableList.tableInfomation = []
|
}
|
this.loading = false
|
})
|
.catch((err) => {
|
console.log(err)
|
this.tableList.tableInfomation = []
|
this.loading = false
|
})
|
},
|
// 搜索
|
searchClick(val, content) {
|
console.log(val, content)
|
this.search_map = {
|
[val.value]: content
|
}
|
this.getData()
|
},
|
resetClick() {
|
this.search_map = {}
|
this.getData()
|
},
|
getSelectArray(val) {
|
console.log(val)
|
this.selValueList = []
|
const list = val.map((item) => {
|
return item.id
|
})
|
this.selValueList = list
|
}
|
}
|
}
|
</script>
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<style lang="scss" scoped>
|
.product {
|
.top {
|
margin-bottom: 20px;
|
.btn-pager {
|
display: flex;
|
.page {
|
margin-left: auto;
|
}
|
}
|
}
|
.detail-top {
|
display: flex;
|
.page {
|
margin-left: auto;
|
}
|
}
|
}
|
</style>
|