赋能场景

This commit is contained in:
gaoyuanwei 2022-08-25 20:47:41 +08:00
parent 748b3b72ea
commit d7d2c56ec7
2 changed files with 437 additions and 308 deletions

View File

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

View File

@ -5,373 +5,410 @@
<div class="top"> <div class="top">
<div class="top-title"> <div class="top-title">
全部 全部
<div v-for="(item, index) in titleName" :key="index" class="tabAll" @click="changeCards(index)" <div
:class="{ sel: index == number }"> v-for="(item, index) in titleName"
:key="index"
class="tabAll"
@click="changeCards(index)"
:class="{ sel: index == number }"
>
<span>{{ item.name }}</span> <span>{{ item.name }}</span>
</div> </div>
</div> </div>
<div class="resultListSearchInput-father"> <div class="resultListSearchInput-father" v-if="number === 0">
<div class="resultListSearchInput-son"> <div class="resultListSearchInput-son">
模糊搜索 模糊搜索
<a-input-search v-model:value="searchValue" placeholder="请输入关键词" enter-button="搜索" size="large" <a-input-search
@search="getAppResources" @change="onSearch" class="resultListSearchInput" /> v-model:value="searchValue"
placeholder="请输入关键词"
enter-button="搜索"
size="large"
@search="getAppResources"
@change="onSearch"
class="resultListSearchInput"
/>
<button class="button-reset" @click="chongzhi()">重置</button> <button class="button-reset" @click="chongzhi()">重置</button>
<div class="hengxian"></div> <div class="hengxian"></div>
</div> </div>
</div> </div>
<div v-loading="loadingData"> <div v-loading="loadingData">
<searchResultList v-show="resourceList.data && resourceList.data.length > 0" :key="listKey2" <searchResultList
:resourceList="resourceList" :resourceTotal="resourceTotal" v-if="number === 0"
:selectCardsname="number == 0 ? '融合服务' : '赋能场景'" /> v-show="resourceList.data && resourceList.data.length > 0"
:key="listKey2"
:resourceList="resourceList"
:resourceTotal="resourceTotal"
:selectCardsname="number == 0 ? '融合服务' : '赋能场景'"
/>
<CanAssignCase
v-else
v-show="resourceList.data && resourceList.data.length > 0"
:key="listKey2"
:resourceList="resourceList"
: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-model:pageSize="currentPageSize" show-size-changer show-less-items show-quick-jumper v-if="resourceList.data && resourceList.data.length > 0"
:total="resourceTotal" :page-size-options="pageSizeOptions" @change="pageChange" v-model:current="currentPage"
@showSizeChange="onShowSizeChange" /> v-model:pageSize="currentPageSize"
show-size-changer
show-less-items
show-quick-jumper
:total="resourceTotal"
:page-size-options="pageSizeOptions"
@change="pageChange"
@showSizeChange="onShowSizeChange"
/>
</div> </div>
<div v-if="resourceList.data && resourceList.data.length <= 0" style="margin-top: 2rem"> <div
v-if="resourceList.data && resourceList.data.length <= 0"
style="margin-top: 2rem"
>
<a-empty /> <a-empty />
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<home-footer></home-footer> <home-footer></home-footer>
</template> </template>
<script> <script>
import HomeFooter from '@/views/newHome/components/Footer' import HomeFooter from '@/views/newHome/components/Footer'
import mybus from '@/myplugins/mybus' import mybus from '@/myplugins/mybus'
import { defineComponent, reactive, ref, toRefs, onMounted, watch } from 'vue' import { defineComponent, reactive, ref, toRefs, onMounted, watch } from 'vue'
import { getIntegrationServicesList } from '@/api/home.js' import { getIntegrationServicesList } from '@/api/home.js'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import HomeHeader from '@/views/home/components/header' import HomeHeader from '@/views/home/components/header'
import searchResultList from '@/views/home/components/searchResultList.vue' import searchResultList from '@/views/home/components/searchResultList.vue'
import { message } from 'ant-design-vue' import CanAssignCase from '@/views/home/components/CanAssignCase.vue'
import { message } from 'ant-design-vue'
export default defineComponent({ export default defineComponent({
setup() { setup() {
//
const loading = ref(true)
const currentPage = ref(1)
const currentPageSize = ref(5)
const pageSizeOptions = ref(['5', '10', '20', '50'])
const router = useRouter()
const select = router.currentRoute.value.query.select
const searchValue = ref('')
const Cardsname = ref(select)
const resourceList = reactive({ data: [] })
const resourceTotal = ref(0)
const current = ref(1)
const loadingData = ref(false)
//
const titleName = ref([
{
name: '打包模式',
},
{
name: '赋能场景',
},
])
const number = ref(0)
//
let listKey = ref(0)
//
const listKey2 = ref(0)
//
const paramsGetResources = {
pageNum: 1,
pageSize: currentPageSize.value,
type: titleName.value[number.value].name,
name: '',
orderField: 'create_date', // total visits 访 applyCount score collectCount
orderType: 'DESC', // ASC DESC
}
const changeCards = (val) => {
console.log(val)
number.value = val
chongzhi()
}
//
const onSearch = () => {
loading.value = true
currentPage.value = 1
}
//
const chongzhi = () => {
loading.value = true
//
searchValue.value = ''
// //
currentPage.value = 1 const loading = ref(true)
currentPageSize.value = 5 const currentPage = ref(1)
// const currentPageSize = ref(5)
paramsGetResources.pageNum = 1 const pageSizeOptions = ref(['5', '10', '20', '50'])
paramsGetResources.pageSize = 5 const router = useRouter()
paramsGetResources.orderField = 'create_date' const select = router.currentRoute.value.query.select
paramsGetResources.orderType = 'DESC' const searchValue = ref('')
mybus.emit('chongzhi', { const Cardsname = ref(select)
type: titleName.value[number.value].name, const resourceList = reactive({ data: [] })
}) const resourceTotal = ref(0)
getAppResources() const current = ref(1)
} const loadingData = ref(false)
//
const getAppResources = () => { const titleName = ref([
getIntegrationList() {
} name: '打包模式',
//
const getIntegrationList = () => {
loadingData.value = true;
console.log('获取融合服务列表------------>');
let postData = {
limit: currentPageSize.value,
page: currentPage.value,
orderField: paramsGetResources.orderField,
orderType: paramsGetResources.orderType,
name: searchValue.value,
type: titleName.value[number.value].name,
}
getIntegrationServicesList(postData).then(
(res) => {
loadingData.value = false;
if (res.data.code !== 0) {
return message.error(res.data.msg)
}
console.log('res.data------------>', res.data);
resourceList.data = res.data.data.list || []
resourceTotal.value = res.data.data.total || 0
}, },
(err) => { {
loadingData.value = false; name: '赋能场景',
message.error(err) },
} ])
)
}
mybus.on('paramsGetResources', (ids) => { const number = ref(0)
if (ids && ids.length > 0) { //
paramsGetResources.deptIds = ids let listKey = ref(0)
} else { //
delete paramsGetResources.deptIds const listKey2 = ref(0)
//
const paramsGetResources = {
pageNum: 1,
pageSize: currentPageSize.value,
type: titleName.value[number.value].name,
name: '',
orderField: 'create_date', // total visits 访 applyCount score collectCount
orderType: 'DESC', // ASC DESC
} }
getAppResources()
console.log('paramsGetResources', paramsGetResources)
})
mybus.on('changePage', (page) => {
paramsGetResources.pageNum = page
getAppResources('分页查询')
})
mybus.on('changeSelcted', () => {
getAppResources()
})
mybus.on('refresh', () => { const changeCards = (val) => {
paramsGetResources.pageNum = 1 console.log(val)
currentPage.value = 1 number.value = val
getAppResources() chongzhi()
}) }
mybus.on('changeCondition', (condition) => {
paramsGetResources.orderField = condition.orderField
paramsGetResources.orderType = condition.orderType
getAppResources()
})
const pageChange = (val) => { //
console.log(val) const onSearch = () => {
loading.value = true loading.value = true
currentPage.value = val currentPage.value = 1
paramsGetResources.pageNum = val }
let params = '分页查询' // //
getAppResources(params) const chongzhi = () => {
} loading.value = true
//
searchValue.value = ''
//
currentPage.value = 1
currentPageSize.value = 5
//
paramsGetResources.pageNum = 1
paramsGetResources.pageSize = 5
paramsGetResources.orderField = 'create_date'
paramsGetResources.orderType = 'DESC'
mybus.emit('chongzhi', {
type: titleName.value[number.value].name,
})
getAppResources()
}
onMounted(() => { const getAppResources = () => {
console.log('222----onMounted-------->', 222); getIntegrationList()
listKey2.value++ }
getAppResources()
})
// //
const onShowSizeChange = (current, pageSize) => { const getIntegrationList = () => {
currentPage.value = current loadingData.value = true
currentPageSize.value = pageSize console.log('获取融合服务列表------------>')
paramsGetResources.pageNum = current let postData = {
paramsGetResources.pageSize = pageSize limit: currentPageSize.value,
getAppResources() page: currentPage.value,
} orderField: paramsGetResources.orderField,
watch(currentPageSize, () => { orderType: paramsGetResources.orderType,
console.log('pageSize', currentPageSize.value) name: searchValue.value,
}) type: titleName.value[number.value].name,
}
getIntegrationServicesList(postData).then(
(res) => {
loadingData.value = false
if (res.data.code !== 0) {
return message.error(res.data.msg)
}
console.log('res.data------------>', res.data)
return { resourceList.data = res.data.data.list || []
listKey, resourceTotal.value = res.data.data.total || 0
searchValue, },
currentPage, (err) => {
resourceList, loadingData.value = false
resourceTotal, message.error(err)
pageChange, }
listKey2, )
Cardsname, }
getAppResources,
chongzhi, mybus.on('paramsGetResources', (ids) => {
onSearch, if (ids && ids.length > 0) {
currentPageSize, paramsGetResources.deptIds = ids
pageSizeOptions, } else {
current, delete paramsGetResources.deptIds
loading, }
titleName, getAppResources()
changeCards, console.log('paramsGetResources', paramsGetResources)
number, })
loadingData, mybus.on('changePage', (page) => {
} paramsGetResources.pageNum = page
}, getAppResources('分页查询')
components: { })
HomeHeader, mybus.on('changeSelcted', () => {
HomeFooter, getAppResources()
searchResultList, })
},
beforeUnmount() { mybus.on('refresh', () => {
mybus.off('paramsGetResources') paramsGetResources.pageNum = 1
mybus.off('changeCondition') currentPage.value = 1
mybus.off('refresh') getAppResources()
mybus.off('changePage') })
}, mybus.on('changeCondition', (condition) => {
}) paramsGetResources.orderField = condition.orderField
paramsGetResources.orderType = condition.orderType
getAppResources()
})
const pageChange = (val) => {
console.log(val)
loading.value = true
currentPage.value = val
paramsGetResources.pageNum = val
let params = '分页查询' //
getAppResources(params)
}
onMounted(() => {
console.log('222----onMounted-------->', 222)
listKey2.value++
getAppResources()
})
//
const onShowSizeChange = (current, pageSize) => {
currentPage.value = current
currentPageSize.value = pageSize
paramsGetResources.pageNum = current
paramsGetResources.pageSize = pageSize
getAppResources()
}
watch(currentPageSize, () => {
console.log('pageSize', currentPageSize.value)
})
return {
listKey,
searchValue,
currentPage,
resourceList,
resourceTotal,
pageChange,
listKey2,
Cardsname,
getAppResources,
chongzhi,
onSearch,
currentPageSize,
pageSizeOptions,
current,
loading,
titleName,
changeCards,
number,
loadingData,
}
},
components: {
HomeHeader,
HomeFooter,
searchResultList,
CanAssignCase,
},
beforeUnmount() {
mybus.off('paramsGetResources')
mybus.off('changeCondition')
mybus.off('refresh')
mybus.off('changePage')
},
})
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.resultListSearchInput-father { .resultListSearchInput-father {
background: #f3f5f9; background: #f3f5f9;
padding: 0.2rem; padding: 0.2rem;
// padding-left: 0.2rem; // padding-left: 0.2rem;
// padding-top: 0.2rem; // padding-top: 0.2rem;
.resultListSearchInput-son { .resultListSearchInput-son {
background: #fff; background: #fff;
padding: 0.2rem 0.2rem 0rem 0.3rem; padding: 0.2rem 0.2rem 0rem 0.3rem;
.hengxian { .hengxian {
width: 100%; width: 100%;
height: 0.01rem; height: 0.01rem;
background: rgba(150, 144, 144, 0.3); background: rgba(150, 144, 144, 0.3);
margin-top: 0.2rem; margin-top: 0.2rem;
}
} }
} }
}
.resultListSearchInput { .resultListSearchInput {
margin-left: 0.1rem; margin-left: 0.1rem;
:deep(.ant-input) { :deep(.ant-input) {
width: 4rem; width: 4rem;
height: 0.36rem; height: 0.36rem;
background: #fff; background: #fff;
border-radius: 0.04rem; border-radius: 0.04rem;
}
:deep(.ant-input-search-button) {
width: 0.8rem;
height: 0.36rem;
background: #0087ff;
border-radius: 0.04rem !important;
font-size: 0.14rem;
font-weight: 400;
color: #fff;
line-height: 0.34rem;
margin-left: 0.1rem;
}
:deep(.ant-input-group-addon) {
left: 0 !important;
}
} }
:deep(.ant-input-search-button) { .button-reset {
border: 0;
outline: none;
width: 0.8rem; width: 0.8rem;
height: 0.36rem; height: 0.36rem;
background: #0087ff; background: #e1edfa;
border-radius: 0.04rem !important; border-radius: 0.04rem;
font-size: 0.14rem; font-size: 0.14rem;
font-weight: 400; font-weight: 400;
color: #fff; color: #0087ff;
line-height: 0.34rem; line-height: 0.34rem;
margin-left: 0.1rem; margin-left: 2.5rem;
cursor: pointer;
} }
:deep(.ant-input-group-addon) { .details-pageconetent {
left: 0 !important; height: 100%;
} width: 100%;
}
.button-reset {
border: 0;
outline: none;
width: 0.8rem;
height: 0.36rem;
background: #e1edfa;
border-radius: 0.04rem;
font-size: 0.14rem;
font-weight: 400;
color: #0087ff;
line-height: 0.34rem;
margin-left: 2.5rem;
cursor: pointer;
}
.details-pageconetent {
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
margin-top: 0.67rem;
position: relative;
background: rgba(245, 243, 243, 0.3);
.details-pageconetent-left {
max-height: 6.9rem;
position: absolute;
width: 2.5rem;
top: 0.17rem;
left: 2.5rem;
margin-right: 0.17rem;
overflow: auto;
}
.top {
min-height: 7.2rem;
position: relative;
width: 11.5rem;
display: flex; display: flex;
padding-top: 0.2rem; justify-content: center;
flex-direction: column; align-items: center;
font-size: 0.16rem; margin-top: 0.67rem;
justify-content: left; position: relative;
background: #f3f5f9; background: rgba(245, 243, 243, 0.3);
.pagination { .details-pageconetent-left {
background: #f3f5f9; max-height: 6.9rem;
padding-bottom: 0.6rem; position: absolute;
width: 2.5rem;
top: 0.17rem;
left: 2.5rem;
margin-right: 0.17rem;
overflow: auto;
} }
.top-title { .top {
padding: 0.2rem; min-height: 7.2rem;
position: relative;
width: 11.5rem;
display: flex; display: flex;
font-size: 18px; padding-top: 0.2rem;
flex-direction: column;
font-size: 0.16rem;
justify-content: left;
background: #f3f5f9;
.tabAll { .pagination {
background: #f3f5f9;
padding-bottom: 0.6rem;
}
.top-title {
padding: 0.2rem;
display: flex;
font-size: 18px; font-size: 18px;
color: #000000;
margin-right: 35px;
cursor: pointer;
}
.tabAll:nth-child(1) { .tabAll {
margin-left: 20px; font-size: 18px;
} color: #000000;
margin-right: 35px;
cursor: pointer;
}
.sel { .tabAll:nth-child(1) {
font-weight: 600; margin-left: 20px;
color: #0087ff; }
border-bottom: 0.02rem solid #0087ff;
.sel {
font-weight: 600;
color: #0087ff;
border-bottom: 0.02rem solid #0087ff;
}
} }
} }
} }
}
:deep(.ant-card-grid) { :deep(.ant-card-grid) {
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
-webkit-line-clamp: 1; -webkit-line-clamp: 1;
word-break: break-all; word-break: break-all;
} }
</style> </style>