You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div>
  3. <crud-template ref="crudRef" class="as-weight" :submit-state="false" :home-data="field" :tableData="tableData"
  4. @btnSearch="btnSearch" @CurrentChange="handleCurrentChange" @importData="importData" @download="downloadHandle"
  5. @refreshLeft="refreshLeft" @add="Adds" @cancel="cancel" @submit="submitAdd" @handleEdit="itemEdit">
  6. <template #search>
  7. <el-input maxlength="30" v-trim clearable v-model="searchForm.batchNo" style="width: 200px"
  8. placeholder="请输入批次号" />
  9. <!-- <el-input maxlength="60" v-trim clearable v-model="searchForm.cardNo" style="width: 200px"-->
  10. <!-- placeholder="请输入卡号" />-->
  11. <el-input maxlength="20" v-trim clearable v-model="searchForm.startCardNo" style="width: 200px"
  12. placeholder="请输入起始卡号" />
  13. <el-input maxlength="20" v-trim clearable v-model="searchForm.endCardNo" style="width: 200px"
  14. placeholder="请输入结束卡号" />
  15. <!-- <el-input maxlength="60" v-trim clearable v-model="searchForm.version" style="width: 200px" placeholder="请输入卡片版本号" />-->
  16. <el-select clearable v-model="searchForm.cardType" style="width: 150px;" placeholder="请选择卡片类型">
  17. <el-option v-for="item in CARD_TYPE" :key="item.value" :label="item.label" :value="item.value" />
  18. </el-select>
  19. <el-select clearable v-model="searchForm.status" style="width: 150px;" placeholder="请选择发行状态">
  20. <el-option v-for="item in ISSUE_STATUS" :key="item.value" :label="item.label" :value="item.value" />
  21. </el-select>
  22. </template>
  23. </crud-template>
  24. </div>
  25. </template>
  26. <script setup lang="ts">
  27. import { ref, onMounted, computed } from 'vue'
  28. // @ts-ignore crudFrom模板
  29. import CrudTemplate from '@/crud/index.vue'
  30. import BaseService from '@/utils/baseService' //引入接口请求
  31. import {
  32. ElMessage,
  33. } from 'element-plus' //提示
  34. import { getZxqdFindConfig,CARD_TYPE,ISSUE_STATUS } from "./data.js";
  35. import { useRoute } from 'vue-router'
  36. import { exportFn } from '@/views/settlement/exportFn'
  37. import $storeinitData from "@/store/initData"; //引入tab vuex
  38. //或取路由传入过来的对象数据
  39. const route = useRoute()
  40. const widthBase = '120px';
  41. const crudRef = ref()
  42. let tableData: any = ref([])
  43. const itemStartValue = ref("1")
  44. //查询参数
  45. const searchForm = ref({})
  46. const agencyIdList = ref([])
  47. onMounted(() => {
  48. getList()
  49. })
  50. const field = ref(getZxqdFindConfig(route));
  51. // 导出
  52. function downloadHandle() {
  53. exportFn('/invw/api/cards/export', searchForm.value, '卡片一发')
  54. }
  55. //获取列表
  56. function getList() {
  57. crudRef.value.tableLoding = true
  58. let params: any = {
  59. pageNo: field.value.paging.currentPage,
  60. pageSize: field.value.paging.pageSize,
  61. }
  62. //赋值查询参数
  63. let searchFormList = { ...searchForm.value }
  64. for (let key in searchFormList) {
  65. if (searchFormList[key]) {
  66. params[key] = searchFormList[key]
  67. }
  68. }
  69. if(searchFormList.status === 0){
  70. params.status = 0
  71. }
  72. BaseService.postN('/invw/api/cards/page', params).then((res: any) => {
  73. if (res && res.code === 0) {
  74. //数据转换
  75. let bizContent = res.data
  76. let data = bizContent.result || []
  77. //数据渲染
  78. tableData.value = data
  79. crudRef.value.tableLoding = false
  80. //分页总数
  81. field.value.paging.total = bizContent.totalCount
  82. } else {
  83. crudRef.value.tableLoding = false
  84. ElMessage.error(res.message)
  85. }
  86. })
  87. }
  88. const Adds = () => {
  89. itemStartValue.value = 1
  90. }
  91. //表单编辑按钮
  92. function itemEdit(idx: any, row: any) {
  93. itemStartValue.value = 2
  94. }
  95. // 添加
  96. const submitAdd = (data: any) => {
  97. request(data, itemStartValue.value)
  98. }
  99. const request = (data: any, type: any) => {
  100. data.optType = type //操作类型 1新增 2修改
  101. BaseService.postN(itemStartValue.value == 1 ? '/userw/wxCar/add' : '/userw/wxCar/update', data).then((res: any) => {
  102. if (res && res.code === 0) {
  103. getList()
  104. crudRef.value.reset();
  105. crudRef.value.dialogFormVisible = false;
  106. } else {
  107. ElMessage.error(res.message)
  108. }
  109. })
  110. }
  111. // 删除
  112. const deleteHandle = (index) => {
  113. addForm.value.locationModels.splice(index, 1)
  114. }
  115. // 搜索按钮
  116. function btnSearch() {
  117. field.value.paging.currentPage = 1
  118. getList()
  119. }
  120. //标签分页
  121. function handleClick(tab, event) {
  122. orderStep.value = tab.props.name
  123. getList()
  124. }
  125. //分页
  126. function handleCurrentChange(val: number) {
  127. field.value.paging.currentPage = val
  128. getList()
  129. }
  130. // 搜索重置
  131. function refreshLeft() {
  132. searchForm.value = {}
  133. getList()
  134. }
  135. </script>
  136. <style lang="scss" scoped></style>