赋能场景存储查询条件

This commit is contained in:
guoyue 2022-09-13 18:03:55 +08:00
parent 90a3aa8e37
commit 31a809f9d9
4 changed files with 603 additions and 652 deletions

View File

@ -1,19 +1,11 @@
<template> <template>
<div class="box"> <div class="box">
<div class="CanCase"> <div class="CanCase">
<div <div class="caseBox" v-for="(item, index) in caseList" :key="index" @click="toView(item)">
class="caseBox" <a-image :preview="false" :src="
v-for="(item, index) in caseList" item.fuseAttrList.filter((val) => val.attrType == '服务图片')[0]
:key="index" .attrValue
@click="toView(item)" " />
>
<a-image
:preview="false"
:src="
item.fuseAttrList.filter((val) => val.attrType == '服务图片')[0]
.attrValue
"
/>
<h3>{{ item.name }}</h3> <h3>{{ item.name }}</h3>
<p>发布时间 {{ item.updateDate }}</p> <p>发布时间 {{ item.updateDate }}</p>
</div> </div>
@ -21,68 +13,83 @@
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, onMounted, onBeforeUnmount } from 'vue' import { ref, onMounted, onBeforeUnmount, watch, defineProps, defineEmits } from 'vue'
import { defineProps } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
const router = useRouter() const router = useRouter()
const props = defineProps({ const props = defineProps({
resourceList: { resourceList: {
type: Object, type: Object,
default: () => {}, default: () => { },
}, },
selectCardsname: { selectCardsname: {
type: String, type: String,
default: '组件服务', default: '组件服务',
},
})
const emits = defineEmits(['saveSearchCodition'])
const caseList = ref([])
onMounted(() => {
caseList.value = props.resourceList.data
console.log('caseList.value------------>', caseList.value);
})
onBeforeUnmount(() => { })
function toView(item) {
emits('saveSearchCodition', 1)
router.push({
path: '/integrationServicesDetails',
query: {
id: item.id,
}, },
}) })
const caseList = ref([]) }
onMounted(() => { watch(
caseList.value = props.resourceList.data () => props.resourceList.data,
console.log(caseList.value, 'caseList.value') (val) => {
}) if (val) {
onBeforeUnmount(() => {}) caseList.value = val
function toView(item) { }
router.push({
path: '/integrationServicesDetails',
query: {
id: item.id,
},
})
} }
)
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.box { .box {
.CanCase { .CanCase {
margin-top: 0.2rem; margin-top: 0.2rem;
display: grid; display: grid;
grid-template-columns: 33.33% 33.33% 33.33%; grid-template-columns: 33.33% 33.33% 33.33%;
align-items: center; align-items: center;
justify-items: center; justify-items: center;
.caseBox {
width: 3.5rem; .caseBox {
height: 3rem; width: 3.5rem;
box-shadow: 1px 1px 5px 5px rgba(222, 222, 222, 0.152); height: 3rem;
background: #ffffff; box-shadow: 1px 1px 5px 5px rgba(222, 222, 222, 0.152);
border-radius: 0.05rem; background: #ffffff;
padding: 0.2rem; border-radius: 0.05rem;
margin-bottom: 0.2rem; padding: 0.2rem;
cursor: pointer; margin-bottom: 0.2rem;
img { cursor: pointer;
width: 3rem;
height: 1.8rem; img {
} width: 3rem;
h3 { height: 1.8rem;
font-size: 0.18rem; }
font-weight: bold;
margin-top: 0.1rem; h3 {
} font-size: 0.18rem;
p { font-weight: bold;
font-size: 0.16rem; margin-top: 0.1rem;
color: #797979; }
}
p {
font-size: 0.16rem;
color: #797979;
} }
} }
} }
}
</style> </style>

View File

@ -26,7 +26,8 @@
:resourceList="resourceList" :resourceTotal="resourceTotal" @saveSearchCodition="saveSearchCodition" :resourceList="resourceList" :resourceTotal="resourceTotal" @saveSearchCodition="saveSearchCodition"
ref="searchResultListDom" :selectCardsname="number == 0 ? '融合服务' : '赋能场景'" /> ref="searchResultListDom" :selectCardsname="number == 0 ? '融合服务' : '赋能场景'" />
<CanAssignCase v-else v-show="resourceList.data && resourceList.data.length > 0" :resourceList="resourceList" <CanAssignCase v-else v-show="resourceList.data && resourceList.data.length > 0" :resourceList="resourceList"
:resourceTotal="resourceTotal" :selectCardsname="number == 0 ? '融合服务' : '赋能场景'" /> @saveSearchCodition="saveSearchCodition" :resourceTotal="resourceTotal"
:selectCardsname="number == 0 ? '融合服务' : '赋能场景'" />
<div class="pagination"> <div class="pagination">
<a-pagination v-if="resourceList.data && resourceList.data.length > 0" v-model:current="currentPage" <a-pagination v-if="resourceList.data && resourceList.data.length > 0" v-model:current="currentPage"
v-model:pageSize="currentPageSize" show-size-changer show-less-items show-quick-jumper v-model:pageSize="currentPageSize" show-size-changer show-less-items show-quick-jumper
@ -53,22 +54,11 @@ import CanAssignCase from '@/views/home/components/CanAssignCase.vue'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
export default defineComponent({ export default defineComponent({
beforeRouteEnter(to, from, next) {
console.log('to---integrationServices--beforeRouteEnter------->', to)
console.log('from---integrationServices--beforeRouteEnter------->', from)
console.log('next---integrationServices--beforeRouteEnter------->', next)
// from.nameundefined
// if (from.name || from.name !== 'details') {
// console.log('------------>')
// localStorage.removeItem('DetailsPageconetent')
// }
next()
},
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
console.log('to---integrationServices--beforeRouteLeave------->', to) console.log('to---integrationServices--beforeRouteLeave------->', to)
console.log('from---integrationServices--beforeRouteLeave------->', from) console.log('from---integrationServices--beforeRouteLeave------->', from)
console.log('next---integrationServices--beforeRouteLeave------->', next) console.log('next---integrationServices--beforeRouteLeave------->', next)
if (to.name !== 'packagingDetails') { if (to.name !== 'packagingDetails' && to.name !== 'integrationServicesDetails') {
localStorage.removeItem('integrationServices') localStorage.removeItem('integrationServices')
} }
next() next()
@ -78,7 +68,7 @@ export default defineComponent({
const loading = ref(true) const loading = ref(true)
const currentPage = ref(1) const currentPage = ref(1)
const currentPageSize = ref(5) const currentPageSize = ref(5)
const pageSizeOptions = ref(['2','5', '10', '20', '50']) const pageSizeOptions = ref(['2', '5', '10', '20', '50'])
const router = useRouter() const router = useRouter()
const select = router.currentRoute.value.query.select const select = router.currentRoute.value.query.select
const searchValue = ref('') const searchValue = ref('')
@ -95,7 +85,6 @@ export default defineComponent({
name: '赋能场景', name: '赋能场景',
}, },
]) ])
const searchData = null;
const number = ref(0) const number = ref(0)
// //
const paramsGetResources = { const paramsGetResources = {
@ -110,39 +99,35 @@ export default defineComponent({
const storageSearchInfo = JSON.parse(localStorage.getItem('integrationServices')) const storageSearchInfo = JSON.parse(localStorage.getItem('integrationServices'))
// //
const handleSetSearchData = () => { const handleSetSearchData = () => {
console.log('storageSearchInfo------------>', storageSearchInfo)
if (storageSearchInfo) { if (storageSearchInfo) {
number.value = storageSearchInfo.type == '打包模式' ? 0 : 1;
// //
searchValue.value = storageSearchInfo.name; searchValue.value = storageSearchInfo.name;
currentPage.value = storageSearchInfo.page; currentPage.value = storageSearchInfo.page;
currentPageSize.value = storageSearchInfo.limit; currentPageSize.value = storageSearchInfo.limit;
titleName.value[number.value].name = storageSearchInfo.type;;
paramsGetResources.limit = storageSearchInfo.limit; paramsGetResources.limit = storageSearchInfo.limit;
paramsGetResources.page = storageSearchInfo.page; paramsGetResources.page = storageSearchInfo.page;
paramsGetResources.type = storageSearchInfo.type; paramsGetResources.type = storageSearchInfo.type;
// 使 // 使
nextTick(() => { nextTick(() => {
searchResultListDom.value.changeCondition({ searchResultListDom.value && searchResultListDom.value.changeCondition && searchResultListDom.value.changeCondition({
value: storageSearchInfo.orderField, value: storageSearchInfo.orderField,
orderType: storageSearchInfo.orderType, orderType: storageSearchInfo.orderType,
}, true) }, true)
}) })
console.log('paramsGetResources------------>', paramsGetResources);
return;
getIntegrationList() getIntegrationList()
} }
} }
const changeCards = (val) => { const changeCards = (val) => {
console.log(val) //
number.value = val number.value = val;
paramsGetResources.type = titleName.value[number.value].name;
resetAction() resetAction()
} }
// //
const onSearch = () => { const onSearch = () => {
currentPage.value = 1 currentPage.value = 1
getIntegrationList() getIntegrationList()
} }
@ -168,9 +153,8 @@ export default defineComponent({
// //
const getIntegrationList = () => { const getIntegrationList = () => {
loadingData.value = true loadingData.value = true
console.log('获取融合服务列表------------>')
paramsGetResources.name = searchValue.value; paramsGetResources.name = searchValue.value;
console.log('paramsGetResources------------>', paramsGetResources); console.log('paramsGetResources------参数下发------>', paramsGetResources);
getIntegrationServicesList(paramsGetResources).then( getIntegrationServicesList(paramsGetResources).then(
(res) => { (res) => {
loadingData.value = false loadingData.value = false
@ -194,13 +178,11 @@ export default defineComponent({
delete paramsGetResources.deptIds delete paramsGetResources.deptIds
} }
getIntegrationList() getIntegrationList()
console.log('paramsGetResources-----paramsGetResources------->', paramsGetResources);
}) })
mybus.on('changePage', (page) => { mybus.on('changePage', (page) => {
paramsGetResources.page = page paramsGetResources.page = page
console.log('paramsGetResources----changePage-------->', paramsGetResources); getIntegrationList()
getIntegrationList('分页查询')
}) })
mybus.on('changeSelcted', () => { mybus.on('changeSelcted', () => {
@ -213,19 +195,15 @@ export default defineComponent({
getIntegrationList() getIntegrationList()
}) })
mybus.on('changeCondition', (condition) => { mybus.on('changeCondition', (condition) => {
console.log('changeCondition------>', condition)
paramsGetResources.orderField = condition.orderField paramsGetResources.orderField = condition.orderField
paramsGetResources.orderType = condition.orderType paramsGetResources.orderType = condition.orderType
getIntegrationList() getIntegrationList()
}) })
const pageChange = (val) => { const pageChange = (val) => {
console.log('val-----pageChange------->', val);
currentPage.value = val currentPage.value = val
paramsGetResources.page = val paramsGetResources.page = val
getIntegrationList() // getIntegrationList() //
console.log('paramsGetResources----pageChange-------->', paramsGetResources);
} }
// //
@ -238,8 +216,8 @@ export default defineComponent({
} }
// //
const saveSearchCodition = () => { const saveSearchCodition = (n) => {
console.log('融合服务------------>', searchData); console.log('融合服务-----存储查询条件到本地------->', paramsGetResources);
localStorage.setItem( localStorage.setItem(
'integrationServices', 'integrationServices',
JSON.stringify(paramsGetResources) JSON.stringify(paramsGetResources)
@ -252,7 +230,6 @@ export default defineComponent({
} else { } else {
getIntegrationList() getIntegrationList()
} }
}) })
return { return {
@ -275,7 +252,6 @@ export default defineComponent({
onShowSizeChange, onShowSizeChange,
saveSearchCodition, saveSearchCodition,
searchResultListDom, searchResultListDom,
} }
}, },
components: { components: {

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@ import {
ref, ref,
watch, watch,
defineProps, defineProps,
nextTick, defineEmits,
} from 'vue' } from 'vue'
import { getDevelopDocTree } from '@/api/home' import { getDevelopDocTree } from '@/api/home'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'