BusinessList.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <el-table :data="list" :show-overflow-tooltip="true" :stripe="true" height="200">
  3. <el-table-column align="center" label="商机名称" prop="name" />
  4. <el-table-column align="center" label="客户名称" prop="customerName" />
  5. <el-table-column align="center" label="商机金额" prop="price" />
  6. <el-table-column
  7. :formatter="dateFormatter"
  8. align="center"
  9. label="预计成交日期"
  10. prop="dealTime"
  11. width="120px"
  12. />
  13. <el-table-column align="center" label="商机状态类型" prop="statusTypeName" width="120" />
  14. <el-table-column align="center" label="商机状态" prop="statusName" />
  15. <el-table-column
  16. :formatter="dateFormatter"
  17. align="center"
  18. label="更新时间"
  19. prop="updateTime"
  20. width="180px"
  21. />
  22. <el-table-column
  23. :formatter="dateFormatter"
  24. align="center"
  25. label="创建时间"
  26. prop="createTime"
  27. width="180px"
  28. />
  29. <el-table-column align="center" label="负责人" prop="ownerUserName" width="120" />
  30. <el-table-column align="center" label="创建人" prop="creatorName" width="120" />
  31. <el-table-column align="center" label="备注" prop="remark" />
  32. <el-table-column align="center" fixed="right" label="操作" width="130">
  33. <template #default="scope">
  34. <el-button link type="danger" @click="handleDelete(scope.row.id)"> 移除</el-button>
  35. </template>
  36. </el-table-column>
  37. </el-table>
  38. </template>
  39. <script lang="ts" setup>
  40. import { dateFormatter } from '@/utils/formatTime'
  41. import * as BusinessApi from '@/api/crm/business'
  42. defineOptions({ name: 'BusinessList' })
  43. const props = withDefaults(defineProps<{ businessIds: number[] }>(), {
  44. businessIds: () => []
  45. })
  46. const list = ref<BusinessApi.BusinessVO[]>([] as BusinessApi.BusinessVO[])
  47. watch(
  48. () => props.businessIds,
  49. (val) => {
  50. if (!val || val.length === 0) {
  51. return
  52. }
  53. list.value = BusinessApi.getBusinessListByIds(unref(val)) as unknown as BusinessApi.BusinessVO[]
  54. }
  55. )
  56. const emits = defineEmits<{
  57. (e: 'update:businessIds', businessIds: number[]): void
  58. }>()
  59. const handleDelete = (id: number) => {
  60. const index = list.value.findIndex((item) => item.id === id)
  61. if (index !== -1) {
  62. list.value.splice(index, 1)
  63. }
  64. emits(
  65. 'update:businessIds',
  66. list.value.map((item) => item.id)
  67. )
  68. }
  69. </script>