index.vue 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <div class="h-full flex p-3 flex-col businessDetail" v-loading="pageLoading">
  3. <div class="w-full bg-white p-2 mb-2 shadow-md rounded-md flex items-center">
  4. <div class="icon mr-4">
  5. <el-link :underline="false" @click="backPath()">
  6. <el-icon class="el-icon--right"><icon-view /></el-icon> 返回联系人列表
  7. </el-link>
  8. </div>
  9. <div class="mr-8">
  10. <el-select v-model="values" placeholder="请选择" style="width: 300px" @change="getDetail">
  11. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
  12. </el-select>
  13. </div>
  14. </div>
  15. <!-- 内容 -->
  16. <div class="flex-1 flex flex-col overflow-y-auto overflow-x-hidden scroll-bar" v-loading="pageLoading">
  17. <div class="w-full h-auto flex justify-between">
  18. <div class="bg-white shadow-md rounded-md" style="width: 46%;">
  19. <Information :data="information" @refreshData="getDetail" />
  20. </div>
  21. <div class="bg-white ml-2 shadow-md rounded-md flex-1">
  22. <Attachment :data="information" @refreshData="getDetail" />
  23. </div>
  24. </div>
  25. <div class="w-full h-auto flex justify-between mt-2">
  26. <div class="bg-white shadow-md rounded-md" style="width: 65%;">
  27. <!-- <RelatedTasks :data="relatedTasks" :information="information" /> -->
  28. <Detailcompinents :data="relatedTasks" :information="information" :formTaskType="0" :filed="'contactsId'" :disabledList="['contactsId']" @refreshData="getDetail" />
  29. </div>
  30. <div class="bg-white ml-2 shadow-md rounded-md flex-1">
  31. <OperationRecord :data="information" />
  32. </div>
  33. </div>
  34. <div class="w-full h-auto flex justify-between mt-2">
  35. <div class="bg-white shadow-md rounded-md w-full">
  36. <RelatedBusiness :data="information" @refreshData="getDetail" />
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. </template>
  42. <script lang="ts" setup>
  43. import { ref, reactive, onMounted, inject } from "vue";
  44. import { Edit, ArrowLeft as IconView } from '@element-plus/icons-vue'
  45. import { backPath } from '../../../utils/tools'
  46. import { useRoute } from "vue-router";
  47. import { post } from "@/utils/request";
  48. import { URL_GETALL, URL_GETDETAIL } from "../api";
  49. import Information from '../component/information.vue'
  50. import Attachment from '../component/attachment.vue'
  51. import RelatedTasks from '../component/relatedTasks.vue'
  52. import OperationRecord from '../component/operationRecord.vue'
  53. import Detailcompinents from '@/components/detailcompinents/relatedTasks.vue'
  54. import RelatedBusiness from '../component/relatedBusiness.vue'
  55. const route = useRoute()
  56. const globalPopup = inject<GlobalPopup>('globalPopup')
  57. const information = ref({}) // 基本信息
  58. const relatedTasks = ref([]) // 相关任务
  59. const rowId = ref(+(route.query.id || ''))
  60. const values = ref<number | string>('')
  61. const options = ref<optionType[]>([])
  62. const pageLoading = ref(false)
  63. function getDetail() {
  64. pageLoading.value = true
  65. post(URL_GETDETAIL, { id: rowId.value }).then((res) => {
  66. res.data.sexValue = res.data.sex === 1 ? '男' : '女'
  67. information.value = res.data
  68. relatedTasks.value = res.data.taskList
  69. }).finally(() => {
  70. pageLoading.value = false
  71. })
  72. }
  73. function getAllContacts() {
  74. post(URL_GETALL, {}).then(({ data }) => {
  75. options.value = (data || []).map((item: any) => ({ value: item.id, label: item.name }))
  76. }).catch((err) => {
  77. globalPopup?.showError(err.msg)
  78. })
  79. }
  80. onMounted(() => {
  81. values.value = rowId.value || ''
  82. getAllContacts()
  83. getDetail()
  84. })
  85. </script>
  86. <style lang="scss" scoped></style>