scan.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <hc-new-card>
  3. <template #header>
  4. <hc-new-switch :datas="tabTab" :keys="tabKey" :round="false" size="default" @change="tabChange" />
  5. </template>
  6. <template #extra>
  7. <el-button hc-btn type="primary" @click="isTableInfoShow = true">
  8. <HcIcon name="add" />
  9. <span>新增</span>
  10. </el-button>
  11. </template>
  12. <div class="relative h-full flex">
  13. <div :id="`hc_tree_card_${uuid}`">
  14. <hc-card-item scrollbar>
  15. <hc-data-tree :h-props="treeProps" :datas="treeLoadNode" :menus="treeMenus" :root-menu="treeRootMenu" default-expand-all @menuTap="treeMenuTap" />
  16. </hc-card-item>
  17. </div>
  18. <div :id="`hc_table_card_${uuid}`" class="flex-1">
  19. <hc-card-item>
  20. <hc-table :column="tableColumn" :datas="tableData" :loading="tableLoading" is-new :index-style="{ width: 60 }">
  21. <template #action="{ row }">
  22. <el-link type="primary">扫描</el-link>
  23. <el-link type="success">修改</el-link>
  24. <el-link type="danger">删除</el-link>
  25. </template>
  26. </hc-table>
  27. <template #action>
  28. <hc-pages :pages="searchForm" @change="pageChange" />
  29. </template>
  30. </hc-card-item>
  31. </div>
  32. </div>
  33. <!-- 节点树的新增和编辑 -->
  34. <treeInfoModal v-model="isTreeInfoShow" />
  35. <!-- 表格的新增和编辑 -->
  36. <tableInfoModal v-model="isTableInfoShow" />
  37. </hc-new-card>
  38. </template>
  39. <script setup>
  40. import { nextTick, onMounted, ref } from 'vue'
  41. import treeInfoModal from './components/treeInfoModal.vue'
  42. import tableInfoModal from './components/tableInfoModal.vue'
  43. import { getRandom } from 'js-fast-way'
  44. defineOptions({
  45. name: 'AlterCollectionScan',
  46. })
  47. const uuid = getRandom(4)
  48. //渲染完成
  49. onMounted(() => {
  50. setSplitRef()
  51. })
  52. //初始化设置拖动分割线
  53. const setSplitRef = () => {
  54. //配置参考: https://split.js.org/#/?direction=vertical&snapOffset=0
  55. nextTick(() => {
  56. window.$split(['#hc_tree_card_' + uuid, '#hc_table_card_' + uuid], {
  57. sizes: [20, 80],
  58. snapOffset: 0,
  59. minSize: [50, 500],
  60. })
  61. })
  62. }
  63. //类型tab数据和相关处理
  64. const tabKey = ref('key1')
  65. const tabTab = ref([
  66. { key: 'key1', name: '普通变更' },
  67. { key: 'key2', name: '工区变更' },
  68. ])
  69. const tabChange = (item) => {
  70. tabKey.value = item?.key
  71. console.log(item)
  72. }
  73. //数据格式
  74. const treeProps = {
  75. label: 'label',
  76. children: 'children',
  77. }
  78. //数据
  79. const treeLoadNode = ref([
  80. {
  81. label: '变更归档目录',
  82. children: [
  83. { label: '归档目录1-1' },
  84. { label: '归档目录2-1' },
  85. { label: '归档目录2-2' },
  86. { label: '归档目录3-1' },
  87. { label: '归档目录3-2' },
  88. ],
  89. },
  90. ])
  91. //根节点菜单
  92. const treeRootMenu = [
  93. { icon: 'add', label: '新增', key: 'add' },
  94. { icon: 'arrow-up-down-line', label: '排序', key: 'sort' },
  95. ]
  96. //节点菜单
  97. const treeMenus = [
  98. { icon: 'add', label: '新增', key: 'add' },
  99. { icon: 'pencil', label: '修改', key: 'edit' },
  100. { icon: 'arrow-up-down-line', label: '排序', key: 'sort' },
  101. { icon: 'close', label: '删除', key: 'del' },
  102. ]
  103. const treeMenuTap = ({ key, node, data }) => {
  104. console.log(key, node, data)
  105. if (key === 'add' || key === 'edit') {
  106. isTreeInfoShow.value = true
  107. }
  108. }
  109. const isTreeInfoShow = ref(false)
  110. const isTableInfoShow = ref(false)
  111. //搜索表单
  112. const searchForm = ref({ current: 1, size: 10, total: 0 })
  113. //分页
  114. const pageChange = ({ current, size }) => {
  115. searchForm.value.current = current
  116. searchForm.value.size = size
  117. }
  118. //表格数据
  119. const tableLoading = ref(false)
  120. const tableColumn = ref([
  121. { key: 'key1', name: '文件编号' },
  122. { key: 'key2', name: '文件名称' },
  123. { key: 'key3', name: '编制单位' },
  124. { key: 'key4', name: '扫描状态' },
  125. { key: 'key5', name: '归集状态' },
  126. { key: 'action', name: '操作', width: 130 },
  127. ])
  128. const tableData = ref([
  129. { key1: '1111' },
  130. ])
  131. </script>