table-download.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <div class="admin-authorize-editInfo">
  3. <el-dialog :title="titleText" v-model="isShowDialog" draggable width="769px">
  4. <el-table stripe :data="softwareDownloadData.tableModel"
  5. v-loading="softwareDownloadData.loading"
  6. size="default"
  7. class="my-fill mt8" shadow="hover">
  8. <el-table-column v-for="column in softwareDownloadData.dynamicColumns" :key="column.prop" :prop="column.prop" :label="column.label" align="center" >
  9. </el-table-column>
  10. </el-table>
  11. <div class="my-flex my-flex-end" style="margin-top: 20px">
  12. <el-pagination
  13. v-model:currentPage="softwareDownloadData.pageInput.CurrentPage"
  14. v-model:page-size="softwareDownloadData.pageInput.PageSize"
  15. :total="softwareDownloadData.total"
  16. :page-sizes="[10, 15, 20, 50, 100]"
  17. small
  18. background
  19. @size-change="onSizeChange"
  20. @current-change="onCurrentChange"
  21. layout="total, sizes, prev, pager, next, jumper"
  22. />
  23. </div>
  24. <template #footer>
  25. <span class="dialog-footer">
  26. <el-button type="primary" icon="ele-CircleClose" @click="onClose" size="default">关闭</el-button>
  27. </span>
  28. </template>
  29. </el-dialog>
  30. </div>
  31. </template>
  32. <script setup lang="ts">
  33. import { reactive, ref, watch} from "vue";
  34. import {DownloadRecordDto,pageInputDownloadRecordDto} from "/@/api/admin/deviceAuthorization/softwarePackageManagementDto";
  35. import {SoftwarePackageManagementApi} from "/@/api/admin/deviceAuthorization/softwarePackageManagementApi";
  36. /**软件包下载记录管理对象*/
  37. const softwareDownloadData = reactive({
  38. loading: false,
  39. filterModel: {
  40. fileId:0,
  41. /**文件名称 */
  42. fileName: "",
  43. /**下载时间 */
  44. downloadTime: "2020-11-22",
  45. /**下载人员 */
  46. downloadedBy: "",
  47. },
  48. total: 0,
  49. pageInput: {
  50. currentPage: 1,
  51. pageSize: 10,
  52. } as pageInputDownloadRecordDto,
  53. tableModel: [] as Array<DownloadRecordDto>,
  54. /**动态表头 */
  55. dynamicColumns: [
  56. { prop: 'fileName', label: '文件名称' },
  57. { prop: 'downloadTime', label: '下载时间' },
  58. { prop: 'downloadedBy', label: '下载人员' },
  59. ]
  60. })
  61. const isShowDialog=ref(false)
  62. const titleText=ref('下载记录')
  63. const formRef = ref()
  64. const openDialog = async (id) => {
  65. softwareDownloadData.filterModel.fileId=id
  66. softwareDownloadData.loading = true
  67. const res:any = await new SoftwarePackageManagementApi().getDownloadData({...softwareDownloadData.pageInput,filter:softwareDownloadData.filterModel})
  68. softwareDownloadData.tableModel = res?.data?.list ?? []
  69. softwareDownloadData.total = res?.data?.total ?? 0
  70. softwareDownloadData.loading = false
  71. isShowDialog.value = true
  72. }
  73. /**页条数变化*/
  74. const onSizeChange = () => {
  75. openDialog(softwareDownloadData.filterModel.fileId)
  76. }
  77. /**页数变化*/
  78. const onCurrentChange = () =>{
  79. openDialog(softwareDownloadData.filterModel.fileId)
  80. }
  81. //关闭弹窗
  82. const onClose = () => {
  83. isShowDialog.value = false
  84. }
  85. /***监听弹窗关 闭表单验证*/
  86. watch(() => isShowDialog.value,(newVal) => {
  87. if(newVal) formRef.value?.resetFields()
  88. })
  89. defineExpose({
  90. openDialog,
  91. })
  92. </script>
  93. <style scoped lang="scss">
  94. </style>