threadInfo.vue 5.8 KB

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