print.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <div class="hc-page-layout-box">
  3. <div class="hc-layout-left-box" :style="'width:' + leftWidth + 'px;'">
  4. <div class="hc-project-box">
  5. <div class="hc-project-icon-box">
  6. <HcIcon name="stack"/>
  7. </div>
  8. <div class="ml-2 project-name-box">
  9. <span class="text-xl text-cut project-alias">{{projectInfo['projectAlias']}}</span>
  10. <div class="text-xs text-cut project-name">{{projectInfo['name']}}</div>
  11. </div>
  12. </div>
  13. <div class="hc-tree-box">
  14. <el-scrollbar>
  15. <!-- <WbsTree :autoExpandKeys="treeAutoExpandKeys" :projectId="projectId" :contractId="contractId" isColor @nodeTap="wbsElTreeClick"/> -->
  16. <TestTree
  17. :autoExpandKeys="treeAutoExpandKeys"
  18. :projectId="projectId"
  19. :wbsTempId="projectInfo?.referenceWbsTemplateIdTrial"
  20. :wbsType="2"
  21. :tenantId="userInfo?.tenant_id"
  22. @nodeTap="wbsElTreeClick"/>
  23. </el-scrollbar>
  24. </div>
  25. <!--左右拖动-->
  26. <div class="horizontal-drag-line" @mousedown="onmousedown"/>
  27. </div>
  28. <div class="hc-page-content-box">
  29. <HcCard :scrollbar="false" actionSize="lg">
  30. <template #header>
  31. <HcTooltip keys="tentative_laboratory_print_print">
  32. <el-button hc-btn>
  33. <HcIcon name="printer"/>
  34. <span>打印</span>
  35. </el-button>
  36. </HcTooltip>
  37. <HcTooltip keys="tentative_laboratory_print_print_all">
  38. <el-button hc-btn>
  39. <HcIcon name="printer" fill/>
  40. <span>全部打印</span>
  41. </el-button>
  42. </HcTooltip>
  43. </template>
  44. <HcTable ref="tableRef" :column="tableColumn" :datas="tableData" :loading="tableLoading" isCheck @selection-change="tableSelection"/>
  45. <template #action>
  46. <HcPages :pages="searchForm" @change="pageChange"/>
  47. </template>
  48. </HcCard>
  49. </div>
  50. </div>
  51. </template>
  52. <script setup>
  53. import {ref, watch, onMounted} from "vue";
  54. import {useAppStore} from "~src/store";
  55. import WbsTree from "../../data-fill/components/WbsTree.vue"
  56. import TestTree from "../material/components/TestTree.vue"
  57. import {getStoreData, setStoreData} from '~src/utils/storage'
  58. //变量
  59. const useAppState = useAppStore()
  60. const projectId = ref(useAppState.getProjectId);
  61. const contractId = ref(useAppState.getContractId);
  62. const projectInfo = ref(useAppState.getProjectInfo);
  63. const isCollapse = ref(useAppState.getCollapse)
  64. //监听
  65. watch(() => [
  66. useAppState.getCollapse
  67. ], ([Collapse]) => {
  68. isCollapse.value = Collapse
  69. })
  70. //自动展开缓存
  71. const treeAutoExpandKeys = ref(getStoreData('wbsTreeExpandKeys') || [])
  72. //渲染完成
  73. onMounted(() => {
  74. })
  75. //搜索表单
  76. const searchForm = ref({
  77. contractId: null, type: null, approval: null, betweenTime: null,
  78. current: 1, size: 20, total: 0
  79. })
  80. //树相关的变量
  81. const primaryKeyId = ref('')
  82. const nodeItemInfo = ref({})
  83. const nodeDataInfo = ref({})
  84. //树被点击
  85. const wbsElTreeClick = ({node, data, keys}) => {
  86. nodeItemInfo.value = node
  87. nodeDataInfo.value = data
  88. primaryKeyId.value = data['primaryKeyId'] || ''
  89. //缓存自动展开
  90. treeAutoExpandKeys.value = keys
  91. setStoreData('wbsTreeExpandKeys',keys)
  92. //改变搜索表单数据
  93. //searchForm.value.wbsId = data['contractIdRelation'] ? data['id'] : data['primaryKeyId']
  94. //searchForm.value.contractIdRelation = data['contractIdRelation']
  95. searchForm.value.current = 1;
  96. getTableData()
  97. }
  98. //分页被点击
  99. const pageChange = ({current, size}) => {
  100. searchForm.value.current = current
  101. searchForm.value.size = size
  102. getTableData()
  103. }
  104. //表格数据
  105. const tableRef = ref(null)
  106. const tableColumn = ref([
  107. {key:'key1', name: '表名'}
  108. ])
  109. //获取数据
  110. const tableLoading = ref(false)
  111. const tableData = ref([])
  112. const getTableData = async () => {
  113. }
  114. //多选
  115. const tableCheckedKeys = ref([]);
  116. const tableSelection = (rows) => {
  117. tableCheckedKeys.value = rows.filter((item) => {
  118. return (item??'') !== '';
  119. })
  120. }
  121. //拼接ID
  122. const rowsToId = (rows) => {
  123. return rows.map((obj) => {
  124. return obj.id;
  125. }).join(",")
  126. }
  127. //左右拖动,改变树形结构宽度
  128. const leftWidth = ref(382);
  129. const onmousedown = () => {
  130. const leftNum = isCollapse.value ? 142 : 272
  131. document.onmousemove = (ve) => {
  132. let diffVal = ve.clientX - leftNum;
  133. if(diffVal >= 310 && diffVal <= 900) {
  134. leftWidth.value = diffVal;
  135. }
  136. }
  137. document.onmouseup = () => {
  138. document.onmousemove = null;
  139. document.onmouseup = null;
  140. }
  141. }
  142. </script>
  143. <style lang="scss" scoped>
  144. </style>