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.5KB

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