index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <Page :title="`${currentRoutingInformation?.name}详情`" styleReset="backNone">
  3. <template v-slot:body>
  4. <div class="w-full h-full detailsClass">
  5. <!-- 商机 -->
  6. <template v-if="currentRoutingInformation?.key == 'business'">
  7. <Business :info="queryParameters" />
  8. </template>
  9. <!-- 线索 -->
  10. <template v-if="currentRoutingInformation?.key == 'thread'">
  11. <Thread :info="queryParameters" />
  12. </template>
  13. <!-- 客户 -->
  14. <template v-if="currentRoutingInformation?.key == 'customer'">
  15. <Customer :info="queryParameters" />
  16. </template>
  17. <!-- 联系人 -->
  18. <template v-if="currentRoutingInformation?.key == 'contacts'">
  19. <Contacts :info="queryParameters" />
  20. </template>
  21. <!-- 任务 -->
  22. <template v-if="currentRoutingInformation?.key == 'tasks'">
  23. <Tasks :info="queryParameters" />
  24. </template>
  25. <!-- 产品管理 -->
  26. <template v-if="currentRoutingInformation?.key == 'product'">
  27. <Product :info="queryParameters" />
  28. </template>
  29. <!-- 合同管理 -->
  30. <template v-if="currentRoutingInformation?.key == 'contract'">
  31. <Contract :info="queryParameters" />
  32. </template>
  33. <!-- 销售订单 -->
  34. <template v-if="currentRoutingInformation?.key == 'order'">
  35. <Order :info="queryParameters" />
  36. </template>
  37. </div>
  38. </template>
  39. <template v-slot:headerRight>
  40. <template v-if="currentRoutingInformation?.key == 'tasks'">
  41. <div class="themeTextColor" @click="jumpEdit()">编辑</div>
  42. </template>
  43. </template>
  44. </Page>
  45. </template>
  46. <script setup>
  47. import { ref } from 'vue';
  48. import { useLifecycle } from '@hooks/useCommon.js';
  49. import { resetListData, getListFieldKey } from '@components/common/formForm/formCorrespondenceProcessing'
  50. import useRouterStore from "@store/useRouterStore.js";
  51. import useFixedData from "@store/useFixedData.js"
  52. import Business from "@pages/pageComponents/business/detail.vue"
  53. import Thread from "@pages/pageComponents/thread/detail.vue"
  54. import Customer from "@pages/pageComponents/customer/detail.vue"
  55. import Contacts from "@pages/pageComponents/contacts/detail.vue"
  56. import Tasks from "@pages/pageComponents/tasks/detail.vue"
  57. import Product from "@pages/pageComponents/product/detail.vue"
  58. import Contract from "@pages/pageComponents/contract/detail.vue"
  59. import Order from "@pages/pageComponents/order/detail.vue"
  60. const fixedData = useFixedData()
  61. const router = useRouterStore()
  62. const queryParameters = ref({})
  63. const currentRoutingInformation = ref({})
  64. function reloadListData(data) {
  65. const { routerInfo = '', parameter = '' } = data
  66. queryParameters.value = JSON.parse(parameter)
  67. currentRoutingInformation.value = JSON.parse(routerInfo)
  68. }
  69. function jumpEdit() {
  70. const formJson = fixedData.formJson[currentRoutingInformation.value.key] || []
  71. const formList = resetListData(formJson?.list)
  72. const filedObj = getListFieldKey(formList, queryParameters.value)
  73. const formVal = { ...queryParameters.value, ...filedObj, id: queryParameters.value.id }
  74. console.log(formVal, '<=== formVal')
  75. router.navigateTo({
  76. pathName: 'addEditor',
  77. success: () => {
  78. router.emit('addEditorParameter', {
  79. routerInfo: JSON.stringify(currentRoutingInformation.value),
  80. filedValue: JSON.stringify(formVal)
  81. })
  82. }
  83. })
  84. }
  85. useLifecycle({
  86. load: () => {
  87. router.on('detailParameter', (data) => {
  88. reloadListData(data)
  89. })
  90. }
  91. });
  92. </script>
  93. <style lang='scss' scoped>
  94. .backNone {
  95. background: linear-gradient(to bottom, #E0EFFF, #F8F8F8 60%) !important;
  96. :deep(.van-nav-bar) {
  97. background: none;
  98. }
  99. }
  100. .detailsClass {
  101. :deep(.van-tabs) {
  102. height: 100%;
  103. display: flex;
  104. flex-direction: column;
  105. }
  106. :deep(.van-tabs__content) {
  107. flex: 1;
  108. overflow: hidden;
  109. }
  110. :deep(.van-tab__panel) {
  111. height: 100%;
  112. }
  113. :deep(.van-tabs__nav) {
  114. background: none;
  115. }
  116. }
  117. </style>