list.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <hc-card class="hc-project-collect-gist-list">
  3. <template #header>
  4. <div class="relative ml-3 w-[300px]">
  5. <hc-search-input v-model="searchForm.queryValue" text="搜索" @search="searchClick">
  6. <template #prepend>
  7. <el-select v-model="searchForm.year" placeholder="年份" style="width: 75px">
  8. <el-option label="2023" value="2023" />
  9. <el-option label="2024" value="2024" />
  10. </el-select>
  11. </template>
  12. </hc-search-input>
  13. </div>
  14. </template>
  15. <template #extra>
  16. <div class="w-[120px]">
  17. <el-select v-model="searchForm.key1" filterable clearable block placeholder="项目阶段" @change="searchClick">
  18. <el-option v-for="item in stateOptions" :key="item.value" :label="item.label" :value="item.value" />
  19. </el-select>
  20. </div>
  21. <el-button v-del-com:[delTableItem] type="danger" class="ml-2" :disabled="tableCheckKeys.length <= 0">批量删除</el-button>
  22. <el-button type="warning" class="ml-2" @click="importClick">导入</el-button>
  23. <el-button v-yes-com:[deriveTableItem] type="primary" class="ml-2" :disabled="tableCheckKeys.length <= 0">批量导出</el-button>
  24. </template>
  25. <HcTableList ref="tableRef" is-admin @tap="rowNameClick" @check="tableCheck" />
  26. <template #action>
  27. <hc-pages :pages="searchForm" @change="pageChange" />
  28. </template>
  29. <!-- 导入 -->
  30. <hc-dialog v-model="isImportShow" widths="24rem" title="项目数据导入" :footer="false" @close="modalImportClose">
  31. <hc-form-upload
  32. v-model="importFile" class="hc-form-drop-upload"
  33. :options="{ num: 0, type: 'list', drop: true }"
  34. :upload="{ options: uploadOptions }"
  35. />
  36. <div class="hc-flex mt-5">
  37. <span class="mr-2">模板下载:</span>
  38. <el-button color="#20C98B" size="small" class="text-white">点击下载</el-button>
  39. </div>
  40. </hc-dialog>
  41. </hc-card>
  42. </template>
  43. <script setup>
  44. import { ref } from 'vue'
  45. import HcTableList from '../modules/gist-list.vue'
  46. //事件
  47. const emit = defineEmits(['edit'])
  48. const tableRef = ref(null)
  49. //项目阶段
  50. const stateOptions = ref([{ value: '1', label: '新开工项目' }, { value: '2', label: '建成项目' }, { value: '3', label: '在建项目' }])
  51. //搜索条件
  52. const searchForm = ref({ queryValue: '', year: '', current: 1, size: 20, total: 0 })
  53. const searchClick = () => {
  54. }
  55. //分页
  56. const pageChange = ({ current, size }) => {
  57. searchForm.value.current = current
  58. searchForm.value.size = size
  59. }
  60. //表格被选择
  61. const tableCheckKeys = ref([])
  62. const tableCheck = (row) => {
  63. tableCheckKeys.value = row
  64. }
  65. //项目名称被点击
  66. const rowNameClick = (row) => {
  67. emit('edit', row)
  68. }
  69. //批量删除
  70. const delTableItem = () => {
  71. tableRef.value?.batchRemove()
  72. }
  73. //批量导出
  74. const deriveTableItem = () => {
  75. tableRef.value?.batchExport()
  76. }
  77. //项目数据导入
  78. const isImportShow = ref(false)
  79. const importFile = ref([])
  80. const uploadOptions = {
  81. accept: '.xls,.xlsx',
  82. accept_tip: '请选择Excel文件',
  83. }
  84. const importClick = () => {
  85. isImportShow.value = true
  86. }
  87. //关闭项目数据导入弹窗
  88. const modalImportClose = () => {
  89. isImportShow.value = false
  90. }
  91. </script>