chenhj
20 小时以前 cb76922f5e8ccade2bdd3e1c73c64c2fe711c45f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<script setup>
import {ref} from 'vue'
import {getQuotationRecordList} from "@/api/salesManagement/salesQuotationRecord.js";
 
const props = defineProps({
  showModal: {
    type: Boolean,
    required: true
  },
  quotationId: {
    type: Number,
    required: true
  }
})
 
const emit = defineEmits(['update:showModal'])
 
const dialogVisible = computed({
  get: () => props.showModal,
  set: (val) => emit('update:showModal', val)
})
 
const leftTableData = ref([])
const rightTableData = ref([])
const selectedLeftRow = ref(null)
 
const handleRowClick = (row) => {
  selectedLeftRow.value = row
  rightTableData.value = row.products || []
}
 
const tableRowClassName = ({row}) => {
  return selectedLeftRow.value === row ? 'selected-row' : ''
}
 
const fetchData = () => {
  getQuotationRecordList({quotationRecordId: props.quotationId}).then(res => {
    const data = res.data.records || []
    data.forEach(item => {
      leftTableData.value.push(JSON.parse(item?.info || '{}'))
    })
  })
}
 
const leftColumns = [
  {prop: 'customer', label: '客户名称', minWidth: '120'},
  {prop: 'salesperson', label: '业务员', minWidth: '120'},
  {prop: 'quotationDate', label: '报价日期', minWidth: '120'},
  {prop: 'validDate', label: '有效期至', minWidth: '120'},
  {prop: 'paymentMethod', label: '支付方式', minWidth: '120'},
  {prop: 'remark', label: '备注', minWidth: '120'}
]
 
const rightColumns = [
  {prop: 'product', label: '产品名称', minWidth: '120'},
  {prop: 'specification', label: '型号', minWidth: '120'},
  {prop: 'unit', label: '单位', minWidth: '100'},
  {prop: 'unitPrice', label: '单价', minWidth: '100'}
]
 
onMounted(() => {
  fetchData()
})
 
</script>
 
<template>
  <el-dialog v-model="dialogVisible" title="详情" width="1000px" :close-on-click-modal="false">
    <el-row :gutter="20">
      <el-col :span="12">
        <div class="table-title">报价单记录</div>
        <el-table :data="leftTableData" border height="400" stripe highlight-current-row
                  @row-click="handleRowClick" :row-class-name="tableRowClassName">
          <el-table-column v-for="col in leftColumns" :key="col.prop" :prop="col.prop" :label="col.label"
                           :min-width="col.minWidth" show-overflow-tooltip/>
        </el-table>
      </el-col>
      <el-col :span="12">
        <div class="table-title">报价单产品</div>
        <el-table :data="rightTableData" border height="400" stripe>
          <el-table-column v-for="col in rightColumns" :key="col.prop" :prop="col.prop" :label="col.label"
                           :min-width="col.minWidth" show-overflow-tooltip/>
        </el-table>
      </el-col>
    </el-row>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="dialogVisible = false">关闭</el-button>
      </div>
    </template>
  </el-dialog>
</template>
 
<style scoped>
.table-title {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 10px;
  color: #303133;
}
 
:deep(.selected-row) {
  background-color: #ecf5ff !important;
}
</style>