123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- <template>
- <div class="hc-page-layout-box">
- <div class="hc-layout-left-box" :style="'width:' + leftWidth + 'px;'">
- <div class="hc-project-box">
- <div class="hc-project-icon-box">
- <HcIcon name="stack"/>
- </div>
- <div class="ml-2 project-name-box">
- <span class="text-xl text-cut project-alias">{{projectInfo['projectAlias']}}</span>
- <div class="text-xs text-cut project-name">{{projectInfo['name']}}</div>
- </div>
- </div>
- <div class="hc-tree-box">
- <el-scrollbar>
- <!-- <WbsTree :autoExpandKeys="treeAutoExpandKeys" :projectId="projectId" :contractId="contractId" isColor @nodeTap="wbsElTreeClick"/> -->
- <TestTree
- :autoExpandKeys="treeAutoExpandKeys"
- :projectId="projectId"
- :wbsTempId="projectInfo?.referenceWbsTemplateIdTrial"
- :wbsType="2"
- :tenantId="userInfo?.tenant_id"
- @nodeTap="wbsElTreeClick"/>
- </el-scrollbar>
- </div>
- <!--左右拖动-->
- <div class="horizontal-drag-line" @mousedown="onmousedown"/>
- </div>
- <div class="hc-page-content-box">
- <HcCard :scrollbar="false" actionSize="lg">
- <template #header>
- <HcTooltip keys="tentative_laboratory_print_print">
- <el-button hc-btn>
- <HcIcon name="printer"/>
- <span>打印</span>
- </el-button>
- </HcTooltip>
- <HcTooltip keys="tentative_laboratory_print_print_all">
- <el-button hc-btn>
- <HcIcon name="printer" fill/>
- <span>全部打印</span>
- </el-button>
- </HcTooltip>
- </template>
- <HcTable ref="tableRef" :column="tableColumn" :datas="tableData" :loading="tableLoading" isCheck @selection-change="tableSelection"/>
- <template #action>
- <HcPages :pages="searchForm" @change="pageChange"/>
- </template>
- </HcCard>
- </div>
- </div>
- </template>
- <script setup>
- import {ref, watch, onMounted} from "vue";
- import {useAppStore} from "~src/store";
- import WbsTree from "../../data-fill/components/WbsTree.vue"
- import TestTree from "../material/components/TestTree.vue"
- import {getStoreData, setStoreData} from '~src/utils/storage'
- //变量
- const useAppState = useAppStore()
- const projectId = ref(useAppState.getProjectId);
- const contractId = ref(useAppState.getContractId);
- const projectInfo = ref(useAppState.getProjectInfo);
- const isCollapse = ref(useAppState.getCollapse)
- //监听
- watch(() => [
- useAppState.getCollapse
- ], ([Collapse]) => {
- isCollapse.value = Collapse
- })
- //自动展开缓存
- const treeAutoExpandKeys = ref(getStoreData('wbsTreeExpandKeys') || [])
- //渲染完成
- onMounted(() => {
- })
- //搜索表单
- const searchForm = ref({
- contractId: null, type: null, approval: null, betweenTime: null,
- current: 1, size: 20, total: 0
- })
- //树相关的变量
- const primaryKeyId = ref('')
- const nodeItemInfo = ref({})
- const nodeDataInfo = ref({})
- //树被点击
- const wbsElTreeClick = ({node, data, keys}) => {
- nodeItemInfo.value = node
- nodeDataInfo.value = data
- primaryKeyId.value = data['primaryKeyId'] || ''
- //缓存自动展开
- treeAutoExpandKeys.value = keys
- setStoreData('wbsTreeExpandKeys',keys)
- //改变搜索表单数据
- //searchForm.value.wbsId = data['contractIdRelation'] ? data['id'] : data['primaryKeyId']
- //searchForm.value.contractIdRelation = data['contractIdRelation']
- searchForm.value.current = 1;
- getTableData()
- }
- //分页被点击
- const pageChange = ({current, size}) => {
- searchForm.value.current = current
- searchForm.value.size = size
- getTableData()
- }
- //表格数据
- const tableRef = ref(null)
- const tableColumn = ref([
- {key:'key1', name: '表名'}
- ])
- //获取数据
- const tableLoading = ref(false)
- const tableData = ref([])
- const getTableData = async () => {
- }
- //多选
- const tableCheckedKeys = ref([]);
- const tableSelection = (rows) => {
- tableCheckedKeys.value = rows.filter((item) => {
- return (item??'') !== '';
- })
- }
- //拼接ID
- const rowsToId = (rows) => {
- return rows.map((obj) => {
- return obj.id;
- }).join(",")
- }
- //左右拖动,改变树形结构宽度
- const leftWidth = ref(382);
- const onmousedown = () => {
- const leftNum = isCollapse.value ? 142 : 272
- document.onmousemove = (ve) => {
- let diffVal = ve.clientX - leftNum;
- if(diffVal >= 310 && diffVal <= 900) {
- leftWidth.value = diffVal;
- }
- }
- document.onmouseup = () => {
- document.onmousemove = null;
- document.onmouseup = null;
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|