Merge remote-tracking branch 'origin/master'

This commit is contained in:
付民康
2025-03-19 21:44:20 +08:00
7 changed files with 126 additions and 52 deletions

View File

@@ -59,14 +59,18 @@
</d-dropdown-menu>
<d-button color="primary" variant="solid" @click="search">搜索</d-button>
</div>
<d-button v-if="isLogin" @click="check" ref="origin" icon="share" class="batch-btn">批量校验</d-button>
<d-button @click="check" ref="origin" icon="share" class="batch-btn">批量校验</d-button>
<div class="home-information">
<div class="info-title">
<div class="sub-title">
<img src="@/assets/imgs/home/informIcon@2x.png" />
<span>预警公告</span>
</div>
<a v-if="isLogin" class="devui-link" @click="checkMore">更多 ></a>
<!-- <a v-if="accountInfo.access_token" class="devui-link" @click="checkMore"
>更多 <i class="icon icon-chevron-right-2"></i>
</a>
<span v-else class="text-blue-500">查看更多请先登录</span> -->
</div>
<div class="info-content">
<d-timeline :direction="'vertical'" :time-position="'right'" :position="'right'">
@@ -109,13 +113,14 @@
<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useAccount } from '@/utils/hooks/useAccount';
import AdvanceSearch from '@/components/AdvanceSearch/index.vue';
import { getHomeNoticeList } from '@/api/jyh';
import EarlyWarningDetail from '@/views/Jyh/PersonalCenter/Detail/EarlyWarningDetail.vue';
import { useDiscussGetUserInfo } from '@/api/discussion/hook';
import { useGlobalInfoStore } from '@/stores/Global';
const { updateHeaderSearch } = useGlobalInfoStore();
const { accountInfo } = useAccount();
// 获取当前用户信息 & 是否登录
const { isLogin = false, userInfo = {}} = useDiscussGetUserInfo();
const route = useRoute();
const router = useRouter();
const inputGlow = ref(false);
@@ -193,7 +198,8 @@ const updateDropdownWidth = () => {
};
const search = () => {
router.push({ name: 'Search', query: { searchWord: searchStr.value, searchType: selectedCate.value } });
updateHeaderSearch({ searchWord: searchStr.value, searchType: selectedCate.value })
router.push({ name: 'Search' });
};
const onCategoryChange = (cate) => {
@@ -241,7 +247,7 @@ onBeforeUnmount(() => {
const getNoticeList = async () => {
const res: any = await getHomeNoticeList();
if (!res.error) {
infoList.value = res.data.data;
infoList.value = res.data.data || [];
}
};
@@ -262,6 +268,7 @@ getNoticeList();
.home-content {
font-size: 14px;
height: 80%;
width: 50%;
display: flex;
flex-direction: column;
@@ -439,11 +446,8 @@ getNoticeList();
display: flex;
align-items: center;
gap: 8px;
width: 150px;
width: 140px;
flex-shrink: 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
:deep(.devui-timeline-item-data-right) {
@@ -457,4 +461,4 @@ getNoticeList();
padding: 0px !important;
}
}
</style>
</style>

View File

@@ -5,7 +5,7 @@
<div class="sub-title mt-3">
<div>
<span>重要性</span>
<d-tag type="danger" size="sm">{{warningData.importance}}</d-tag>
<d-tag size="sm" :color="tagMap[warningData.importance].color">{{tagMap[warningData.importance].text}}</d-tag>
</div>
<div v-if="propsData.type === 'system'">
<d-button v-show="mode === 'readonly'" class="edit-btn" icon="icon-edit" variant="text" title="编辑" @click="handleModeChange"/>
@@ -39,6 +39,24 @@ const toolbarConfig = [
['h1', 'h2', 'bold', 'italic', 'strike', 'underline', 'color', 'font'],
['ul', 'ol', 'checklist', 'code', 'link', 'image', 'table'],
];
const tagMap = {
'Critical': {
text: '致命',
color: '#c7000b'
},
'High': {
text: '高',
color: '#f66f6a'
},
'Medium': {
text: '中',
color: '#fac20a'
},
'Low': {
text: '低',
color: '#5e7ce0'
}
}
const mode = ref('readonly');
console.log(propsData.warningData)
warningData.value = propsData.warningData ?? {

View File

@@ -6,7 +6,7 @@
</AdvanceSearch>
<div class="jyh-form-operation">
<d-button @click="getReleaseList" class="mr-2" variant="solid">搜索</d-button>
<d-button variant="solid" color="secondary">清空</d-button>
<d-button variant="solid" color="secondary" @click="clear">清空</d-button>
</div>
<div class="left-btn">
<d-button v-if="isLogin" class="output-btn" icon="icon-share" variant="text">导出</d-button>
@@ -124,6 +124,7 @@ import { useAccountStore } from '@/stores/user';
const { formatTime } = useTimeFormat();
import { releasePage } from '@/api/jyh';
import { useTimeFormat } from '@/utils/hooks/useTimeFormat';
import { useGlobalInfoStore } from '@/stores/Global';
const { namespace } = getOrgInfo();
const userInfo = useAccountStore();
const { isLogin } = storeToRefs(userInfo);
@@ -138,16 +139,28 @@ const typeOptions = reactive(['主软件', '依赖软件']);
const riskOptions = reactive(['低', '中', '高']);
const useTypeOptions = reactive(['软件', '文档', '文档+软件']);
const isUseOptions = reactive(['是', '否']);
const globalInfo = useGlobalInfoStore();
const headerSearch = ref(globalInfo.headerSearch)
const newFormData = ref({
licenseName: '',
searchType: 'software',
searchWord: '',
searchType: headerSearch.value.searchType ? headerSearch.value.searchType : 'software',
softwareName: '',
softwareVersion: '',
dependentSoftware: '',
programmingLanguage: '',
interestTag: '',
industry: '',
dateRange: ['', '']
})
watch(() => globalInfo.headerSearch, (newVal: any) => {
headerSearch.value = newVal;
console.log(newVal)
newFormData.value.searchType = newVal.searchType;
newFormData.value.softwareName = newVal.softwareName;
getReleaseList();
}, { deep: true })
const pager = ref({
total: 10,
pageIndex: 1,
@@ -195,6 +208,22 @@ const showColumnList = ref(false);
const countryModalRef = ref(null);
const orgModalRef = ref(null);
// 清空高级搜索
const clear = () => {
newFormData.value = {
licenseName: '',
searchType: headerSearch.value.searchType ? headerSearch.value.searchType : 'software',
softwareName: '',
softwareVersion: '',
dependentSoftware: '',
programmingLanguage: '',
interestTag: '',
industry: '',
dateRange: ['', '']
}
getReleaseList();
}
// 打开模态框的方法
const openCountryModal = () => {
if (countryModalRef.value) {
@@ -304,11 +333,13 @@ const getReleaseList = async() => {
if (!error && data) {
tableData.value = data.data.records;
pager.value.total = data.data.total;
console.log(tableData.value)
}
};
onMounted(async() => {
getReleaseList();
// getReleaseList();
});
onMounted(() => {
@@ -317,18 +348,6 @@ onMounted(() => {
...query
};
});
// 监听路由变化,更新 searchWord
watch(
() => route.query.searchWord, // 监听路由的 searchWord 参数
(newSearchWord) => {
if (newSearchWord) {
newFormData.value.searchWord = newSearchWord; // 更新组件的 searchWord
getReleaseList(); // 重新调用接口
}
},
{ immediate: true } // 立即执行一次
);
</script>
<style scoped lang="scss">