threadInfo.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <div class="flex flex-col h-full">
  3. <div class="bg-white info flex-1 overflow-y-auto cellnormall">
  4. <van-cell title="线索名称" :value="info.clueName" />
  5. <van-cell title="线索来源" :value="info.clueSourceValue" />
  6. <van-cell title="电话号码" :value="info.phone" />
  7. <van-cell title="邮箱" :value="info.email" />
  8. <van-cell title="客户行业" :value="info.customerIndustryValue" />
  9. <van-cell title="客户级别" :value="info.customerLevelValue" />
  10. <van-cell title="客户地址" :value="info.address" />
  11. <van-cell title="负责人">
  12. <template #default>
  13. <TranslationComponent :openId="info.inchargerName" />
  14. </template>
  15. </van-cell>
  16. <van-cell title="备注" :value="info.remark" />
  17. </div>
  18. <div class="bottomButton">
  19. <van-button type="primary" class="w-full block" v-if="info.inchargerName && info.isBo != 1" @click="transformBusinessOpportunities()">线索转商机</van-button>
  20. <van-button type="warning" class="w-full block" v-if="info.inchargerName" @click="showDialogCli()">转移线索</van-button>
  21. <van-button type="primary" class="w-full block" v-if="!info.inchargerName" @click="claimAndClaim()">认领线索</van-button>
  22. <van-button type="default" class="w-full block" v-permission="[routingInformation.jurisdiction.edit]" @click="jumpEdit()">编辑线索</van-button>
  23. <van-button type="danger" class="w-full block" v-permission="[routingInformation.jurisdiction.delete]" @click="deleteRow()">删除线索</van-button>
  24. </div>
  25. <!-- 转移弹窗 -->
  26. <van-dialog v-model:show="showDialog" :title="`转移线索`" show-cancel-button
  27. @confirm="confirmTransfer" :before-close="dialogCloseBefo">
  28. <van-cell title="转移至" is-link @click="showSelect = true">
  29. <template #value>
  30. {{ dialogSelection.label }}
  31. </template>
  32. </van-cell>
  33. <div class="themeTextColor text-size-small pl-4 pt-2 pb-2">转移后,将看不到此线索了</div>
  34. </van-dialog>
  35. <!-- select 选择器 -->
  36. <van-popup v-model:show="showSelect" destroy-on-close position="bottom" :style="{ height: '80%' }">
  37. <PullDownSelector :showElement="showSelect" @change="selectChange" />
  38. </van-popup>
  39. </div>
  40. </template>
  41. <script setup>
  42. import { ref } from 'vue';
  43. import { showConfirmDialog } from 'vant';
  44. import { useLifecycle } from '@hooks/useCommon.js';
  45. import { TRANSFER_CLUES } from '@hooks/useApi'
  46. import requests from "@common/requests";
  47. import useShowToast from '@hooks/useToast'
  48. import useInfoStore from '@store/useInfoStore'
  49. import useRouterStore from "@store/useRouterStore.js";
  50. import { routingInfos } from "@utility/generalVariables"
  51. import { resetListData, getListFieldKey } from '@components/common/formForm/formCorrespondenceProcessing'
  52. import useFixedData from "@store/useFixedData.js"
  53. const fixedData = useFixedData()
  54. const router = useRouterStore()
  55. const userInfo = useInfoStore()
  56. const { toastSuccess, toastFail, toastText } = useShowToast()
  57. const props = defineProps({
  58. info: {
  59. type: Object,
  60. required: true,
  61. default: () => ({})
  62. }
  63. })
  64. const routingInformation = routingInfos['thread']
  65. const showDialog = ref(false);
  66. const showSelect = ref(false);
  67. const dialogSelection = ref({});
  68. function transformBusinessOpportunities() {
  69. const InfoJson = routingInfos['business']
  70. const formJson = fixedData.formJson[InfoJson.key] || []
  71. const formList = resetListData(formJson?.list)
  72. const filedObj = getListFieldKey(formList, props.info)
  73. const formVal = { ...filedObj, inchargerId: '', name: props.info?.clueName, clueId: props.info?.id }
  74. router.redirectTo({
  75. pathName: 'addEditor',
  76. success: () => {
  77. router.emit('addEditorParameter', {
  78. routerInfo: JSON.stringify(InfoJson),
  79. filedValue: JSON.stringify(formVal)
  80. })
  81. }
  82. })
  83. }
  84. function deleteRow() {
  85. const { name = '', searchFiled = {}, deteleFiled = '' } = routingInformation
  86. const row = props.info
  87. const foemVal = { [routingInformation.key == 'tasks' ? 'taskIds' : 'ids']: row.id }
  88. showConfirmDialog({
  89. title: `删除${name}`,
  90. message: `确定删除【${row[searchFiled?.search]}】${name}吗?`,
  91. }).then(() => {
  92. requests.post(deteleFiled, { ...foemVal }).then((res) => {
  93. toastSuccess('删除成功')
  94. router.navigateBack({
  95. success: () => {
  96. router.emit('moduleListDetailParameter', {
  97. row: JSON.stringify(routingInformation)
  98. })
  99. }
  100. })
  101. }).catch((err) => {
  102. toastFail(err.msg ? err.msg : '删除失败')
  103. })
  104. })
  105. }
  106. function jumpEdit() {
  107. const formJson = fixedData.formJson[routingInformation.key] || []
  108. const formList = resetListData(formJson?.list)
  109. const filedObj = getListFieldKey(formList, props.info)
  110. const formVal = { ...filedObj, id: props.info.id }
  111. router.navigateTo({
  112. pathName: 'addEditor',
  113. success: () => {
  114. router.emit('addEditorParameter', {
  115. routerInfo: JSON.stringify(routingInformation),
  116. filedValue: JSON.stringify(formVal)
  117. })
  118. }
  119. })
  120. }
  121. function listReloadData() {
  122. router.navigateBack({
  123. success: () => {
  124. router.eventEmit('moduleListRefreshData', {})
  125. }
  126. })
  127. }
  128. function confirmTransfer() {
  129. if(!dialogSelection.value.label) {
  130. return toastText('请选择要转移的人员')
  131. }
  132. requests.post(TRANSFER_CLUES, { id: props.info.id, inchargerId: dialogSelection.value.value }).then((res) => {
  133. toastSuccess('转移成功')
  134. showDialog.value = false
  135. setTimeout(() => {
  136. listReloadData()
  137. }, 2000)
  138. })
  139. }
  140. function claimAndClaim() {
  141. showConfirmDialog({
  142. title: '认领线索',
  143. message: `确定认领【${props.info.clueName}】线索吗?`,
  144. }).then(() => {
  145. requests.post(TRANSFER_CLUES, { ids: props.info.id, inchargerId: userInfo.userInfo.id }).then((res) => {
  146. toastSuccess('认领成功')
  147. listReloadData()
  148. props.info.inchargerName = userInfo.userInfo.clueName
  149. showDialog.value = false
  150. })
  151. })
  152. }
  153. function selectChange(value, label) {
  154. dialogSelection.value = {
  155. value, label
  156. }
  157. showSelect.value = false
  158. }
  159. function showDialogCli() {
  160. dialogSelection.value = {}
  161. showDialog.value = true
  162. }
  163. function dialogCloseBefo(val) {
  164. if(val == 'confirm' && showDialog.value) {
  165. return false
  166. }
  167. return true
  168. }
  169. useLifecycle({
  170. load: () => {
  171. // 添加加载逻辑
  172. }
  173. });
  174. </script>
  175. <style lang='scss' scoped>
  176. .bottomButton {
  177. margin: 0 14px;
  178. padding-bottom: 30px;
  179. :deep(.van-button) {
  180. margin-bottom: 20px;
  181. }
  182. }
  183. .info {
  184. margin: 8px 14px 30px 14px;
  185. padding: 14px;
  186. }
  187. </style>