linktest.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <div>
  3. <el-dialog v-model="state.showDialog" destroy-on-close :title="title" draggable :close-on-click-modal="false"
  4. :close-on-press-escape="false" width="1000px">
  5. <div>
  6. <el-card class="mt8" shadow="never" :body-style="{ paddingBottom: '0' }">
  7. <el-form :inline="true" @submit.stop.prevent>
  8. <el-form-item label="推广码来源">
  9. <el-input v-model="state.filter.keywords" placeholder="请输入推广码来源" />
  10. </el-form-item>
  11. <el-form-item>
  12. <el-button type="primary" icon="ele-Search" @click="onQuery"> 查询 </el-button>
  13. </el-form-item>
  14. </el-form>
  15. </el-card>
  16. <el-card class="my-fill mt8" shadow="never">
  17. <el-table v-loading="state.loading" :data="state.projectLinkListData" row-key="id" height="'100%'" style="width: 100%; height: 100%">
  18. <el-table-column label="推广码来源" prop="company" min-width="120" show-overflow-tooltip/>
  19. <el-table-column label="所属平台" prop="orgName" min-width="120" show-overflow-tooltip/>
  20. <el-table-column label="编号" prop="num" min-width="120" show-overflow-tooltip/>
  21. <el-table-column label="二维码" prop="qrcodeUrl" min-width="120" show-overflow-tooltip/>
  22. <el-table-column label="短链" prop="shortUrl" min-width="120" show-overflow-tooltip/>
  23. <el-table-column label="查单码" prop="queryUrl" min-width="120" show-overflow-tooltip/>
  24. <el-table-column label="口令" prop="shareCommand" min-width="120" show-overflow-tooltip/>
  25. <el-table-column label="申请时间" min-width="120" show-overflow-tooltip>
  26. <template #default="{ row }">
  27. {{row.isUse===1? row.useTime:'' }}
  28. </template>
  29. </el-table-column>
  30. <el-table-column label="姓名" prop="salesman" min-width="120" show-overflow-tooltip/>
  31. <el-table-column label="手机号" prop="salesmanPhone" min-width="120" show-overflow-tooltip/>
  32. <el-table-column label="备注" prop="salesmanRemark" min-width="120" show-overflow-tooltip/>
  33. </el-table>
  34. <div class="my-flex my-flex-end" style="margin-top: 20px">
  35. <el-pagination v-model:currentPage="state.pageInput.currentPage"
  36. v-model:page-size="state.pageInput.pageSize" :total="state.total" :page-sizes="[10, 20, 50, 100]" small
  37. background @size-change="onSizeChange" @current-change="onCurrentChange"
  38. layout="total, sizes, prev, pager, next, jumper" />
  39. </div>
  40. </el-card>
  41. </div>
  42. </el-dialog>
  43. </div>
  44. </template>
  45. <script lang="ts" setup name="admin/tenant/form">
  46. import { reactive, toRefs, getCurrentInstance, ref } from 'vue'
  47. import { PageInputProjectLinkGetPageDto, ProjectLinkListOutput } from '/@/api/admin/data-contracts'
  48. import { ProjectLinkApi } from '/@/api/admin/ProjectLink'
  49. import eventBus from '/@/utils/mitt'
  50. import QRCode from 'qrcodejs2-fixes'
  51. // 定义变量内容
  52. const qrcodeRef = ref()
  53. defineProps({
  54. title: {
  55. type: String,
  56. default: '',
  57. },
  58. })
  59. // const { proxy } = getCurrentInstance() as any
  60. // const formRef = ref()
  61. const state = reactive({
  62. showDialog: false,
  63. sureLoading: false,
  64. loading: false,
  65. filter: {
  66. projectId: 0,
  67. isUse: -1,
  68. tenantId: 0,
  69. keywords: ''
  70. }, pageInput: {
  71. currentPage: 1,
  72. pageSize: 10,
  73. } as PageInputProjectLinkGetPageDto,
  74. total: 0,
  75. projectLinkListData: [] as Array<ProjectLinkListOutput>,
  76. })
  77. // const { form } = toRefs(state)
  78. // 打开对话框
  79. const open = async (row: any = {}) => {
  80. state.filter.projectId = row.projectId;
  81. onQuery();
  82. state.showDialog = true
  83. }
  84. //查询
  85. const onQuery = async () => {
  86. state.loading = true
  87. state.pageInput.filter = state.filter
  88. const res = await new ProjectLinkApi().getPage(state.pageInput).catch(() => {
  89. state.loading = false
  90. })
  91. state.projectLinkListData = res?.data?.list ?? []
  92. state.total = res?.data?.total ?? 0
  93. state.loading = false
  94. }
  95. // 初始化生成二维码
  96. const initQrcode = (text:string) => {
  97. new QRCode(qrcodeRef.value, {
  98. text: text,
  99. width: 125,
  100. height: 125,
  101. colorDark: '#000000',
  102. colorLight: '#ffffff',
  103. })
  104. }
  105. const onSizeChange = (val: number) => {
  106. state.pageInput.pageSize = val
  107. onQuery()
  108. }
  109. const onCurrentChange = (val: number) => {
  110. state.pageInput.currentPage = val
  111. onQuery()
  112. }
  113. defineExpose({
  114. open,
  115. })
  116. </script>