|
@@ -13,7 +13,7 @@
|
|
|
<template #header>
|
|
|
{{ headerTitle }}
|
|
|
</template>
|
|
|
- <div v-loading="ruleLoading" class="rule-box">
|
|
|
+ <div v-if="!isShowFile" v-loading="ruleLoading" class="rule-box">
|
|
|
<div v-for="(item, index) in ruleItemOptions" :key="index" class="rule-box-item" @click="ruleDetailClick(item)">
|
|
|
<div class="rule-box-item-icon">
|
|
|
<i class="ri-file-fill" style=" cursor: pointer; font-size: 48px;color:orange" />
|
|
@@ -21,6 +21,14 @@
|
|
|
<div class="rule-box-item-title">{{ item.name }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div v-else v-loading="ruleFileLoading" class="rule-box">
|
|
|
+ <div v-for="(item, index) in fileData" :key="index" class="rule-box-item" @click="ruleDetailClick1(item)">
|
|
|
+ <div class="rule-box-item-icon">
|
|
|
+ <i class="ri-article-fill" style=" cursor: pointer; font-size: 48px;color:orange" />
|
|
|
+ </div>
|
|
|
+ <div class="rule-box-item-title">{{ item.name }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</hc-card>
|
|
|
</hc-body>
|
|
|
</template>
|
|
@@ -30,8 +38,10 @@ import { onActivated, onUnmounted, ref, watch } from 'vue'
|
|
|
import { useAppStore } from '~src/store'
|
|
|
import { getStoreValue, setStoreValue } from '~src/utils/storage'
|
|
|
import TestTree from '../material/components/TestTree.vue'
|
|
|
+import dataApi from '~api/basic/rule.js'
|
|
|
//自动展开缓存
|
|
|
const treeAutoExpandKeys = ref(getStoreValue('testTreeExpandKeys') || [])
|
|
|
+import { getArrValue, isNullES } from 'js-fast-way'
|
|
|
|
|
|
//变量
|
|
|
const useAppState = useAppStore()
|
|
@@ -44,7 +54,8 @@ const nodeItemInfo = ref(null)
|
|
|
//树被点击
|
|
|
const wbsElTreeClick = ({ node, data, keys }) => {
|
|
|
nodeItemInfo.value = data
|
|
|
-
|
|
|
+ isShowFile.value = false
|
|
|
+
|
|
|
//缓存自动展开
|
|
|
treeAutoExpandKeys.value = keys
|
|
|
setStoreValue('testTreeExpandKeys', keys)
|
|
@@ -56,47 +67,85 @@ const wbsElTreeClick = ({ node, data, keys }) => {
|
|
|
|
|
|
//搜索表单
|
|
|
const ruleLoading = ref(false)
|
|
|
-const ruleItemOptions = ref([
|
|
|
- { name:'测试规范1', id:1 },
|
|
|
- { name:'测试规范2', id:2 },
|
|
|
- { name:'测试规范3', id:3 },
|
|
|
- { name:'测试规范4', id:4 },
|
|
|
- { name:'测试规范5', id:5 },
|
|
|
- { name:'测试规范6', id:6 },
|
|
|
- { name:'测试规范7', id:7 },
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-])
|
|
|
+const ruleItemOptions = ref([])
|
|
|
|
|
|
const searchForm = ref({
|
|
|
startTime: null, endTime: null, queryValue: null, nodeId: '',
|
|
|
current: 1, size: 20, total: 0,
|
|
|
})
|
|
|
const ruleDetailClick = (item)=>{
|
|
|
- console.log(123)
|
|
|
+ console.log(item)
|
|
|
+ headerTitle.value = '规范文件'
|
|
|
+ isShowFile.value = true
|
|
|
+ getFileDetail(item.id)
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+const ruleDetailClick1 = (item)=>{
|
|
|
+ getFileDetail1(item.id)
|
|
|
}
|
|
|
+
|
|
|
const getTableData = async () => {
|
|
|
- // const nodeId = primaryKeyId.value
|
|
|
- // if (isNullES(nodeId)) return
|
|
|
- // tableLoading.value = true
|
|
|
- // const { error, code, data } = await samplingApi.queryPage({
|
|
|
- // projectId: projectId.value,
|
|
|
- // nodeId,
|
|
|
- // ...searchForm.value,
|
|
|
- // })
|
|
|
- // //处理数据
|
|
|
- // tableLoading.value = false
|
|
|
- // if (!error && code === 200) {
|
|
|
- // tableData.value = getArrValue(data['records'])
|
|
|
- // searchForm.value.total = data.total || 0
|
|
|
- // } else {
|
|
|
- // tableData.value = []
|
|
|
- // searchForm.value.total = 0
|
|
|
- // }
|
|
|
+ const nodeId = nodeItemInfo.value.id
|
|
|
+ if (isNullES(nodeId)) return
|
|
|
+ ruleLoading.value = true
|
|
|
+ const { error, code, data } = await dataApi.page({
|
|
|
+ projectId: projectId.value,
|
|
|
+ contractId: contractId.value,
|
|
|
+ type: 1,
|
|
|
+ privateId: nodeItemInfo.value['id'] || '',
|
|
|
+ current: 1,
|
|
|
+ size:200,
|
|
|
+ })
|
|
|
+ //处理数据
|
|
|
+ ruleLoading.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ ruleItemOptions.value = getArrValue(data['records'])
|
|
|
+ searchForm.value.total = data.total || 0
|
|
|
+ } else {
|
|
|
+ ruleItemOptions.value = []
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
const headerTitle = ref('规范文件夹')
|
|
|
+const ruleFileLoading = ref(false)
|
|
|
+const isShowFile = ref(false)
|
|
|
+const fileData = ref([])
|
|
|
+
|
|
|
+//获取规范详情
|
|
|
+const getFileDetail = async (id) => {
|
|
|
+ ruleFileLoading.value = true
|
|
|
+ const { error, code, data } = await dataApi.page({
|
|
|
+ type: 2,
|
|
|
+ parentId: id,
|
|
|
+ privateId: nodeItemInfo.value['id'] || '',
|
|
|
+ current: 1,
|
|
|
+ size: 100,
|
|
|
+
|
|
|
+ })
|
|
|
+ //处理数据
|
|
|
+ ruleFileLoading.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ fileData.value = getArrValue(data['records'])
|
|
|
+ } else {
|
|
|
+ fileData.value = []
|
|
|
+ }
|
|
|
+}
|
|
|
+const getFileDetail1 = async (id) => {
|
|
|
+ ruleFileLoading.value = true
|
|
|
+ const { error, code, data } = await dataApi.getById({
|
|
|
+ id,
|
|
|
+
|
|
|
+ })
|
|
|
+ //处理数据
|
|
|
+ ruleFileLoading.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ console.log(data, 'data')
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|