index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <div>
  3. <Des :list="desList"
  4. @onClick="imgClick" />
  5. <a-modal :visible="previewVisible"
  6. :footer="null"
  7. @cancel="cancelImg">
  8. <img alt="预览附件"
  9. style="width: 100%"
  10. :src="previewImage" />
  11. </a-modal>
  12. </div>
  13. </template>
  14. <script lang="ts">
  15. import { defineComponent, PropType, watchEffect } from 'vue';
  16. import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
  17. import { getStatusName } from '@/common/constants/enumsName';
  18. import { formatValue } from '@/common/methods';
  19. import { getCardTypeEnumItemName } from '@/common/constants/enumsName';
  20. import { Des, DescriptionsList, handleDesList } from '@/common/components/commonDes';
  21. import { handlePreviewImg } from '@/common/setup/upload';
  22. export default defineComponent({
  23. name: 'custom-detail-desc',
  24. components: { Des },
  25. props: {
  26. selectedRow: {
  27. type: Object as PropType<QueryCustomInfoType>,
  28. default: {},
  29. },
  30. },
  31. setup(props) {
  32. function isPersonal() {
  33. return props.selectedRow.userinfotype === 1;
  34. }
  35. const { desList, getDesList } = handleDesList();
  36. // 预览附件
  37. const { previewVisible, previewImage, cancelImg, previewImg, getImgName } = handlePreviewImg();
  38. //
  39. function imgClick({ label }: DescriptionsList) {
  40. const { attachment1, cardfrontphotourl, cardbackphotourl } = props.selectedRow;
  41. switch (label) {
  42. case '营业执照':
  43. previewImg(attachment1);
  44. break;
  45. case '身份证正面照':
  46. previewImg(cardfrontphotourl);
  47. break;
  48. case '身份证反面照':
  49. previewImg(cardbackphotourl);
  50. break;
  51. }
  52. }
  53. watchEffect(() => {
  54. // if (props.selectedRow.customername) {
  55. const data = props.selectedRow;
  56. // 个人
  57. const person = [
  58. { label: '客户类型', value: '个人' },
  59. { label: '姓名', value: formatValue(data.username) },
  60. { label: '身份证号码', value: formatValue(data.cardnum) },
  61. { label: '手机号码', value: formatValue(data.mobile) },
  62. { label: '身份证正面照', value: formatValue(getImgName(data.cardfrontphotourl)), className: 'blue' },
  63. { label: '身份证反面照', value: formatValue(getImgName(data.cardbackphotourl)), className: 'blue' },
  64. { label: '邮箱', value: formatValue(data.email) },
  65. { label: '联系电话', value: formatValue(data.telphone) },
  66. { label: '通讯地址', value: formatValue(data.address) },
  67. { label: '备注', value: formatValue(data.remark) },
  68. ];
  69. // 企业
  70. const company = [
  71. { label: '客户类型', value: '企业' },
  72. { label: '企业名称', value: data.customername },
  73. { label: '企业简称', value: formatValue(data.nickname) },
  74. { label: '证件类型', value: getCardTypeEnumItemName(data.cardtype) },
  75. { label: '法定代表人', value: formatValue(data.legalpersonname) },
  76. { label: '证件号码', value: formatValue(data.cardnum) },
  77. { label: '纳税人识别号', value: formatValue(data.taxpayernum) },
  78. { label: '营业执照', value: formatValue(getImgName(data.attachment1)), className: 'blue' },
  79. { label: '联系人', value: formatValue(data.contactname) },
  80. { label: '联系人手机号', value: formatValue(data.mobile) },
  81. { label: '联系电话', value: formatValue(data.telphone) },
  82. { label: '状态', value: getStatusName(data.status), className: 'green' },
  83. { label: '通讯地址', value: formatValue(data.address) },
  84. { label: '备注', value: formatValue(data.remark) },
  85. ];
  86. getDesList(isPersonal() ? person : company);
  87. // }
  88. });
  89. return {
  90. desList,
  91. previewVisible,
  92. previewImage,
  93. cancelImg,
  94. imgClick,
  95. };
  96. },
  97. });
  98. </script>
  99. <style lang="less">
  100. .custom-detail {
  101. .ant-form.inlineForm {
  102. margin-top: 20px;
  103. }
  104. .upload {
  105. .look {
  106. margin-left: 0;
  107. }
  108. }
  109. }
  110. </style>;