|
@@ -0,0 +1,222 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <el-dialog append-to-body :title="title" :visible.sync="innerVisible" @close="close">
|
|
|
|
|
+ <el-row>
|
|
|
|
|
+ <el-col :span="24">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="queryForm.searchText"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ placeholder="招标产品名称/招标信息标题/中标单位"
|
|
|
|
|
+ style="width: 30%; margin-right: 10px"
|
|
|
|
|
+ suffix-icon="el-icon-search"
|
|
|
|
|
+ @keyup.enter.native="fetchData" />
|
|
|
|
|
+ <el-button icon="el-icon-search" type="primary" @click="fetchData">查询</el-button>
|
|
|
|
|
+ <table-tool
|
|
|
|
|
+ :columns="columns"
|
|
|
|
|
+ :show-columns.sync="showColumns"
|
|
|
|
|
+ style="float: right"
|
|
|
|
|
+ table-type="selectCustomerBidTable" />
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ <el-table ref="bidTable" v-loading="listLoading" :data="list" @selection-change="setSelectRows">
|
|
|
|
|
+ <el-table-column align="center" type="selection" />
|
|
|
|
|
+ <el-table-column
|
|
|
|
|
+ v-for="(item, index) in showColumns"
|
|
|
|
|
+ :key="index + Math.random()"
|
|
|
|
|
+ align="center"
|
|
|
|
|
+ :label="item.label"
|
|
|
|
|
+ :prop="item.prop"
|
|
|
|
|
+ show-overflow-tooltip
|
|
|
|
|
+ :sortable="item.sortable"
|
|
|
|
|
+ :width="item.width">
|
|
|
|
|
+ <template #default="{ row }">
|
|
|
|
|
+ <span v-if="item.prop === 'infoType'">
|
|
|
|
|
+ {{ selectDictLabel(bidInfoTypeOptions, row.infoType) }}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <span v-else-if="item.prop === 'publishedTime'">
|
|
|
|
|
+ {{ parseTime(row.publishedTime, '{y}-{m}-{d}') }}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <span v-else-if="item.prop === 'biddingTime'">
|
|
|
|
|
+ {{ parseTime(row.biddingTime, '{y}-{m}-{d}') }}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <span v-else>{{ row[item.prop] }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ <el-pagination
|
|
|
|
|
+ background
|
|
|
|
|
+ :current-page="queryForm.pageNum"
|
|
|
|
|
+ :layout="layout"
|
|
|
|
|
+ :page-size="queryForm.pageSize"
|
|
|
|
|
+ :total="total"
|
|
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
|
|
+ @size-change="handleSizeChange" />
|
|
|
|
|
+ <span slot="footer">
|
|
|
|
|
+ <el-button size="mini" type="primary" @click="save">保存</el-button>
|
|
|
|
|
+ <el-button size="mini" @click="innerVisible = false">取消</el-button>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <!-- 新建联系人弹窗 -->
|
|
|
|
|
+ <customer-contact ref="contact" @contactSave="fetchData" />
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script>
|
|
|
|
|
+ import customerApi from '@/api/customer/index'
|
|
|
|
|
+ import TableTool from '@/components/table/TableTool'
|
|
|
|
|
+ import CustomerContact from '@/views/customer/components/Contact'
|
|
|
|
|
+
|
|
|
|
|
+ export default {
|
|
|
|
|
+ name: 'SelectContact',
|
|
|
|
|
+ components: {
|
|
|
|
|
+ TableTool,
|
|
|
|
|
+ CustomerContact,
|
|
|
|
|
+ },
|
|
|
|
|
+ props: {
|
|
|
|
|
+ title: {
|
|
|
|
|
+ type: String,
|
|
|
|
|
+ default: '选择客户联系人',
|
|
|
|
|
+ },
|
|
|
|
|
+ add: Boolean,
|
|
|
|
|
+ multiple: Boolean,
|
|
|
|
|
+ // 示例{ custId: id, custName: custName}
|
|
|
|
|
+ defaultCustomer: {
|
|
|
|
|
+ type: Object,
|
|
|
|
|
+ default() {
|
|
|
|
|
+ return {}
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ queryParams: {
|
|
|
|
|
+ type: Object,
|
|
|
|
|
+ default() {
|
|
|
|
|
+ return {}
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ innerVisible: false,
|
|
|
|
|
+ queryForm: {
|
|
|
|
|
+ searchText: '',
|
|
|
|
|
+ custId: 1,
|
|
|
|
|
+ pageNum: 1,
|
|
|
|
|
+ pageSize: 10,
|
|
|
|
|
+ },
|
|
|
|
|
+ showColumns: [],
|
|
|
|
|
+ columns: [
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '客户名称',
|
|
|
|
|
+ width: '200px',
|
|
|
|
|
+ prop: 'cuctName',
|
|
|
|
|
+ disableCheck: true,
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '招标产品名称',
|
|
|
|
|
+ width: '180px',
|
|
|
|
|
+ prop: 'productName',
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '发布招标日期',
|
|
|
|
|
+ width: '150px',
|
|
|
|
|
+ prop: 'publishedTime',
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '项目预算',
|
|
|
|
|
+ width: 'auto',
|
|
|
|
|
+ prop: 'budget',
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '招标信息标题',
|
|
|
|
|
+ width: '200px',
|
|
|
|
|
+ prop: 'title',
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '信息分类',
|
|
|
|
|
+ width: '150px',
|
|
|
|
|
+ prop: 'infoType',
|
|
|
|
|
+ formatter: this.infoTypeFormat,
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '中标单位',
|
|
|
|
|
+ width: '200px',
|
|
|
|
|
+ prop: 'bidder',
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '创建招标日期',
|
|
|
|
|
+ width: '150px',
|
|
|
|
|
+ prop: 'biddingTime',
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ list: [],
|
|
|
|
|
+ listLoading: true,
|
|
|
|
|
+ layout: 'total, sizes, prev, pager, next, jumper',
|
|
|
|
|
+ total: 0,
|
|
|
|
|
+ selectRows: [],
|
|
|
|
|
+ bidInfoTypeOptions: [],
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ mounted() {
|
|
|
|
|
+ this.getDicts('bid_info_type').then((response) => {
|
|
|
|
|
+ this.bidInfoTypeOptions = response.data.values || []
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ infoTypeFormat(row) {
|
|
|
|
|
+ return this.selectDictLabel(this.bidInfoTypeOptions, row.infoType)
|
|
|
|
|
+ },
|
|
|
|
|
+ open() {
|
|
|
|
|
+ this.innerVisible = true
|
|
|
|
|
+ this.fetchData()
|
|
|
|
|
+ },
|
|
|
|
|
+ close() {
|
|
|
|
|
+ this.selectRows = []
|
|
|
|
|
+ this.queryForm = this.$options.data().queryForm
|
|
|
|
|
+ this.$refs.bidTable.clearSelection()
|
|
|
|
|
+ },
|
|
|
|
|
+ save() {
|
|
|
|
|
+ this.innerVisible = false
|
|
|
|
|
+ console.log(this.selectRows)
|
|
|
|
|
+ this.$emit('save', this.selectRows)
|
|
|
|
|
+ },
|
|
|
|
|
+ handleAdd() {
|
|
|
|
|
+ this.$refs.contact.contactForm.custId = this.defaultCustomer.custId
|
|
|
|
|
+ this.$refs.contact.contactForm.custName = this.defaultCustomer.custName
|
|
|
|
|
+ this.$refs.contact.contactVisible = true
|
|
|
|
|
+ },
|
|
|
|
|
+ async fetchData() {
|
|
|
|
|
+ this.listLoading = true
|
|
|
|
|
+ let query = Object.assign(this.queryForm, this.queryParams)
|
|
|
|
|
+ const {
|
|
|
|
|
+ data: { list, total },
|
|
|
|
|
+ } = await customerApi.bidList(query)
|
|
|
|
|
+ this.list = list
|
|
|
|
|
+ this.total = total
|
|
|
|
|
+ this.listLoading = false
|
|
|
|
|
+ },
|
|
|
|
|
+ setSelectRows(val) {
|
|
|
|
|
+ if (!this.multiple && val.length === this.list.length && val.length > 1) {
|
|
|
|
|
+ // 返回单条数据情况下-控制全选情况下单选第一条数据
|
|
|
|
|
+ this.$refs.bidTable.clearSelection()
|
|
|
|
|
+ if (this.selectRows.length === 1) {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$refs.bidTable.toggleRowSelection(val.shift(), true)
|
|
|
|
|
+ } else if (!this.multiple && val.length > 1) {
|
|
|
|
|
+ // 返回单条数据情况下-控制选择当前点击数据
|
|
|
|
|
+ this.$refs.bidTable.clearSelection()
|
|
|
|
|
+ this.$refs.bidTable.toggleRowSelection(val.pop(), true)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.selectRows = val
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ handleSizeChange(val) {
|
|
|
|
|
+ this.queryForm.pageSize = val
|
|
|
|
|
+ this.fetchData()
|
|
|
|
|
+ },
|
|
|
|
|
+ handleCurrentChange(val) {
|
|
|
|
|
+ this.queryForm.pageNum = val
|
|
|
|
|
+ this.fetchData()
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ }
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style scoped></style>
|