index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <ContentWrap>
  3. <!-- 搜索工作栏 -->
  4. <el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true">
  5. <el-row :gutter="16">
  6. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  7. <el-form-item label="用户编号" prop="userId">
  8. <el-input
  9. v-model="queryParams.userId"
  10. placeholder="请输入用户编号"
  11. clearable
  12. @keyup.enter="handleQuery"
  13. class="!w-240px"
  14. />
  15. </el-form-item>
  16. </el-col>
  17. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  18. <el-form-item label="个人征信信息" prop="creditInformation">
  19. <el-input
  20. v-model="queryParams.creditInformation"
  21. placeholder="请输入个人征信信息"
  22. clearable
  23. @keyup.enter="handleQuery"
  24. class="!w-240px"
  25. />
  26. </el-form-item>
  27. </el-col>
  28. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  29. <el-form-item label="个人身份证信息" prop="idCardInformation">
  30. <el-input
  31. v-model="queryParams.idCardInformation"
  32. placeholder="请输入个人身份证信息"
  33. clearable
  34. @keyup.enter="handleQuery"
  35. class="!w-240px"
  36. />
  37. </el-form-item>
  38. </el-col>
  39. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  40. <el-form-item label="个人营业执照信息" prop="businessLicenseInformation">
  41. <el-input
  42. v-model="queryParams.businessLicenseInformation"
  43. placeholder="请输入个人营业执照信息"
  44. clearable
  45. @keyup.enter="handleQuery"
  46. class="!w-240px"
  47. />
  48. </el-form-item>
  49. </el-col>
  50. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  51. <el-form-item label="创建时间" prop="createTime">
  52. <el-date-picker
  53. v-model="queryParams.createTime"
  54. value-format="YYYY-MM-DD HH:mm:ss"
  55. type="daterange"
  56. start-placeholder="开始日期"
  57. end-placeholder="结束日期"
  58. :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
  59. class="!w-220px"
  60. />
  61. </el-form-item>
  62. </el-col>
  63. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  64. <el-form-item label="征信id" prop="creditId">
  65. <el-input
  66. v-model="queryParams.creditId"
  67. placeholder="请输入征信id"
  68. clearable
  69. @keyup.enter="handleQuery"
  70. class="!w-240px"
  71. />
  72. </el-form-item>
  73. </el-col>
  74. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  75. <el-form-item label="身份证ID" prop="idCardId">
  76. <el-input
  77. v-model="queryParams.idCardId"
  78. placeholder="请输入身份证ID"
  79. clearable
  80. @keyup.enter="handleQuery"
  81. class="!w-240px"
  82. />
  83. </el-form-item>
  84. </el-col>
  85. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  86. <el-form-item label="营业执照id" prop="businessLicenseId">
  87. <el-input
  88. v-model="queryParams.businessLicenseId"
  89. placeholder="请输入营业执照id"
  90. clearable
  91. @keyup.enter="handleQuery"
  92. class="!w-240px"
  93. />
  94. </el-form-item>
  95. </el-col>
  96. <el-col :xs="24" :sm="24" :md="24" :lg="24">
  97. <el-form-item>
  98. <el-button @click="handleQuery"
  99. ><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button
  100. >
  101. <el-button @click="resetQuery"
  102. ><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button
  103. >
  104. <el-button
  105. type="primary"
  106. plain
  107. @click="openForm('create')"
  108. v-hasPermi="['member:user-information:create']"
  109. >
  110. <Icon icon="ep:plus" class="mr-5px" /> 新增
  111. </el-button>
  112. <el-button
  113. type="success"
  114. plain
  115. @click="handleExport"
  116. :loading="exportLoading"
  117. v-hasPermi="['member:user-information:export']"
  118. >
  119. <Icon icon="ep:download" class="mr-5px" /> 导出
  120. </el-button>
  121. </el-form-item>
  122. </el-col>
  123. </el-row>
  124. </el-form>
  125. </ContentWrap>
  126. <!-- 列表 -->
  127. <ContentWrap>
  128. <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
  129. <el-table-column label="自增主键" align="center" prop="id" />
  130. <el-table-column label="用户编号" align="center" prop="userId" />
  131. <el-table-column label="个人征信信息" align="center" prop="creditInformation" />
  132. <el-table-column label="个人身份证信息" align="center" prop="idCardInformation" />
  133. <el-table-column label="个人营业执照信息" align="center" prop="businessLicenseInformation" />
  134. <el-table-column
  135. label="创建时间"
  136. align="center"
  137. prop="createTime"
  138. :formatter="dateFormatter"
  139. width="180px"
  140. />
  141. <el-table-column label="征信id" align="center" prop="creditId" />
  142. <el-table-column label="身份证ID" align="center" prop="idCardId" />
  143. <el-table-column label="营业执照id" align="center" prop="businessLicenseId" />
  144. <el-table-column label="操作" align="center" min-width="120px">
  145. <template #default="scope">
  146. <el-button
  147. link
  148. type="primary"
  149. @click="openForm('update', scope.row.id)"
  150. v-hasPermi="['member:user-information:update']"
  151. >
  152. 编辑
  153. </el-button>
  154. <el-button
  155. link
  156. type="danger"
  157. @click="handleDelete(scope.row.id)"
  158. v-hasPermi="['member:user-information:delete']"
  159. >
  160. 删除
  161. </el-button>
  162. </template>
  163. </el-table-column>
  164. </el-table>
  165. <!-- 分页 -->
  166. <Pagination
  167. :total="total"
  168. v-model:page="queryParams.pageNo"
  169. v-model:limit="queryParams.pageSize"
  170. @pagination="getList"
  171. />
  172. </ContentWrap>
  173. <!-- 表单弹窗:添加/修改 -->
  174. <UserInformationForm ref="formRef" @success="getList" />
  175. </template>
  176. <script setup lang="ts">
  177. import { dateFormatter } from '@/utils/formatTime'
  178. import download from '@/utils/download'
  179. import { UserInformationApi, UserInformationVO } from '@/api/member/userinformation'
  180. import UserInformationForm from './UserInformationForm.vue'
  181. /** 用户信息 列表 */
  182. defineOptions({ name: 'UserInformation' })
  183. const message = useMessage() // 消息弹窗
  184. const { t } = useI18n() // 国际化
  185. const loading = ref(true) // 列表的加载中
  186. const list = ref<UserInformationVO[]>([]) // 列表的数据
  187. const total = ref(0) // 列表的总页数
  188. const queryParams = reactive({
  189. pageNo: 1,
  190. pageSize: 10,
  191. userId: undefined,
  192. creditInformation: undefined,
  193. idCardInformation: undefined,
  194. businessLicenseInformation: undefined,
  195. createTime: [],
  196. creditId: undefined,
  197. idCardId: undefined,
  198. businessLicenseId: undefined
  199. })
  200. const queryFormRef = ref() // 搜索的表单
  201. const exportLoading = ref(false) // 导出的加载中
  202. /** 查询列表 */
  203. const getList = async () => {
  204. loading.value = true
  205. try {
  206. const data = await UserInformationApi.getUserInformationPage(queryParams)
  207. list.value = data.list
  208. total.value = data.total
  209. } finally {
  210. loading.value = false
  211. }
  212. }
  213. /** 搜索按钮操作 */
  214. const handleQuery = () => {
  215. queryParams.pageNo = 1
  216. getList()
  217. }
  218. /** 重置按钮操作 */
  219. const resetQuery = () => {
  220. queryFormRef.value.resetFields()
  221. handleQuery()
  222. }
  223. /** 添加/修改操作 */
  224. const formRef = ref()
  225. const openForm = (type: string, id?: number) => {
  226. formRef.value.open(type, id)
  227. }
  228. /** 删除按钮操作 */
  229. const handleDelete = async (id: number) => {
  230. try {
  231. // 删除的二次确认
  232. await message.delConfirm()
  233. // 发起删除
  234. await UserInformationApi.deleteUserInformation(id)
  235. message.success(t('common.delSuccess'))
  236. // 刷新列表
  237. await getList()
  238. } catch {}
  239. }
  240. /** 导出按钮操作 */
  241. const handleExport = async () => {
  242. try {
  243. // 导出的二次确认
  244. await message.exportConfirm()
  245. // 发起导出
  246. exportLoading.value = true
  247. const data = await UserInformationApi.exportUserInformation(queryParams)
  248. download.excel(data, '用户信息.xls')
  249. } catch {
  250. } finally {
  251. exportLoading.value = false
  252. }
  253. }
  254. /** 初始化 **/
  255. onMounted(() => {
  256. getList()
  257. })
  258. </script>