Files
app-govern/pages/project/list.vue

166 lines
4.7 KiB
Vue
Raw Normal View History

2023-02-15 16:32:21 +08:00
<template>
<view :loading="loading">
2023-02-20 14:19:28 +08:00
<!-- <uni-nav-bar left-icon="left" right-icon="cart" title="标题" /> -->
2023-05-25 10:10:22 +08:00
<uni-nav-bar
dark
:fixed="true"
status-bar
left-icon="left"
2023-08-10 09:18:17 +08:00
:rightIcon="userInfo.authorities === 'app_vip_user' || userInfo.authorities === 'engineering_user' ? 'plusempty' : ''"
2023-05-25 10:10:22 +08:00
background-color="#fff"
color="#111"
title="项目管理"
@clickLeft="back"
@clickRight="add"
/>
2023-08-23 16:22:08 +08:00
<uni-search-bar v-model="store.params.searchValue" clearButton="none" bgColor="#fff" placeholder="请输入关键词"
@input="store.search()"></uni-search-bar>
2023-02-15 16:32:21 +08:00
<view class="message">
2023-08-23 16:22:08 +08:00
<uni-card :title="item.name" @click="jump(item)"
v-for="(item, index) in store.data" :key="index"
:style="{marginTop:index===0?'0':''}">
2023-02-28 14:03:38 +08:00
<view class="term-list-bottom">
<view class="term-list-bottom-item">
<view>设备个数</view>
2023-08-18 14:41:53 +08:00
<view>{{ item.devNum }}</view>
2023-02-28 14:03:38 +08:00
</view>
<view class="term-list-bottom-item">
2023-08-23 16:22:08 +08:00
<view>所属工程</view>
<view>{{ item.engineeringName }}</view>
2023-02-28 14:03:38 +08:00
</view>
</view>
</uni-card>
2023-05-25 10:10:22 +08:00
<Cn-empty v-if="store.empty" style="padding-top: 200px"></Cn-empty>
2023-03-30 09:04:07 +08:00
<uni-load-more v-if="store.data && store.data.length > 0" :status="store.status"></uni-load-more>
2023-02-15 16:32:21 +08:00
</view>
</view>
</template>
<script>
2023-03-30 09:04:07 +08:00
import list from '../../common/js/list'
2023-08-18 14:41:53 +08:00
2023-02-15 16:32:21 +08:00
export default {
2023-03-30 09:04:07 +08:00
mixins: [list],
2023-05-25 10:10:22 +08:00
data() {
2023-02-15 16:32:21 +08:00
return {
2023-03-01 08:48:52 +08:00
loading: false,
2023-05-25 10:10:22 +08:00
userInfo: {},
2023-02-15 16:32:21 +08:00
}
},
methods: {
2023-05-25 10:10:22 +08:00
init() {
2023-08-10 09:18:17 +08:00
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
2023-07-03 20:29:24 +08:00
this.store = this.DataSource('/cs-device-boot/project/queryProject')
2023-08-23 16:22:08 +08:00
this.store.params.searchValue = ''
2023-03-30 09:04:07 +08:00
this.store.reload()
2023-02-15 16:32:21 +08:00
},
2023-05-25 10:10:22 +08:00
back() {
2023-02-20 14:19:28 +08:00
uni.navigateBack()
},
2023-05-25 10:10:22 +08:00
add() {
2023-08-18 14:41:53 +08:00
if (this.userInfo.authorities === 'app_vip_user' || this.userInfo.authorities === 'engineering_user') {
if (!uni.getStorageSync('engineering')) {
return uni.showToast({
title: '请先创建一个工程',
icon: 'none',
})
}
uni.navigateTo({
url: `/pages/project/new`,
2023-07-24 08:47:20 +08:00
})
}
2023-02-20 14:19:28 +08:00
},
2023-05-25 10:10:22 +08:00
upgrade(code) {
console.log(code)
2023-02-15 16:32:21 +08:00
uni.showToast({
title: '升级成功',
2023-05-25 10:10:22 +08:00
icon: 'none',
2023-02-15 16:32:21 +08:00
})
},
2023-05-25 10:10:22 +08:00
jump(project) {
2023-07-24 08:47:20 +08:00
console.log(project);
2023-02-15 16:32:21 +08:00
uni.navigateTo({
2023-07-24 08:47:20 +08:00
url: `/pages/project/detail?project=${encodeURIComponent(JSON.stringify(project))}`,
2023-02-20 14:19:28 +08:00
})
2023-05-25 10:10:22 +08:00
},
2023-02-15 16:32:21 +08:00
},
2023-05-25 10:10:22 +08:00
onLoad() {
2023-02-15 16:32:21 +08:00
this.init()
},
}
</script>
<style lang="scss">
.message {
.message-header {
padding: 200rpx 34rpx 34rpx;
display: flex;
align-items: center;
background: $uni-theme-white;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 8rpx #e7e7e74c;
.message-header-head {
margin-right: 30rpx;
height: 128rpx;
width: 128rpx;
border-radius: $uni-theme-radius;
overflow: hidden;
}
.message-header-name {
margin-right: 30rpx;
flex: 1;
font-size: 36rpx;
color: #111;
font-weight: 700;
.tag {
margin-top: 10rpx;
font-size: 24rpx;
color: #aaa;
}
}
}
.message-nav {
padding: 34rpx;
display: flex;
align-items: center;
background: $uni-theme-white;
border-bottom: 1rpx solid #e8e8e8;
&-icon {
margin-right: 30rpx;
height: 44rpx;
width: 44rpx;
border-radius: $uni-theme-radius;
overflow: hidden;
}
&-label {
margin-right: 30rpx;
flex: 1;
font-size: 28rpx;
color: #111;
}
}
}
2023-02-28 14:03:38 +08:00
.term-list-bottom {
.term-list-bottom-item {
font-size: 28rpx;
margin-bottom: 20rpx;
display: flex;
justify-content: space-between;
// view:first-of-type{
// color: #111;
// }
}
.term-list-bottom-item:last-of-type {
margin-bottom: 0;
}
}
2023-05-25 10:10:22 +08:00
</style>