OA/pages/project/index.vue

450 lines
8.2 KiB
Vue
Raw Normal View History

2023-11-05 00:11:08 +08:00
<template>
<view>
<view class="content-middle">
<view class="content-middle-title">
<view class="content-middle-search">
<text class='iconfont icon-sousuo2'></text>
<input type='text' :value='keyword' placeholder='搜索关键字' placeholder-class='placeholder'
@input="setValue"></input>
</view>
<view class="search" @click="search">
搜索
</view>
</view>
<view class="content-middle-one">
<view class="middle-one" v-for="(item,j) in list" :key='j'>
<liu-swipe-action :index="j" @clickItem="clickItem" :btnList='btnList'>
<view class="middle-onea">
<view class="middle-onea-title">
<!-- <view class="middle-onea-img">
<image :src="`${httpRequestUrl}`+item.thumb" mode=""></image>
</view> -->
<view class="middle-onea-txt">{{item.name}}</view>
</view>
<view class="middle-onea-time">
{{item.plan_time}}
</view>
</view>
<view class="middle-oneb">
<view class="middle-oneb-a">
<view class="threeb-a-b">
<view class="achor">当前阶段及负责人<text>{{item.step}}</text></view>
<!-- <view class="middle-edit" @click="editpart(item)">
编辑
</view>
<view class="middle-delete" @click="clickItem(item)">
删除
</view> -->
</view>
</view>
</view>
</liu-swipe-action>
</view>
</view>
</view>
<view class="content-bootom" @click="adddepart">
<view class="content-bootom-one">
<image src="@/static/images/ja.png" mode=""></image>
</view>
<view class="content-bootom-two">添加项目</view>
</view>
<u-empty v-if="loadConfig.status=='nomore'&& list.length==0" text="没有信息"
icon="/static/empty/data.png"></u-empty>
<u-loadmore v-else :status="loadConfig.status" :loading-text="loadConfig.loadingText"
:loadmore-text="loadConfig.loadmoreText" :nomore-text="loadConfig.nomoreText" />
</view>
</template>
<script>
import {
projectlist,
deleteprojectview
} from '@/api/oa.js'
import {
HTTP_REQUEST_URL
} from '@/config/app.js'
import {
Toast
} from '@/libs/uniApi.js'
export default {
data() {
return {
show: false,
btnList: [{
id: '1',
name: '编辑',
width: '100rpx',
height: '100rpx',
bgColor: '#5f92f7',
color: '#FFFFFF',
fontSize: '28rpx'
}, {
id: '2',
name: '删除',
height: '100rpx',
width: '100rpx',
bgColor: '#ed656d',
color: '#FFFFFF',
fontSize: '28rpx'
}],
loadConfig: {
page: 1,
limit: 5,
loadingText: '努力加载中',
loadmoreText: '轻轻上拉',
nomoreText: '我也是有底线的~~',
status: 'loadmore'
},
keyword: '',
list: [],
};
},
computed: {
httpRequestUrl() {
return HTTP_REQUEST_URL;
}
},
onLoad() {
},
onShow() {
this.initList()
},
onReachBottom() {
this.getDocumentList()
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
},
methods: {
async initList() {
this.loadConfig.page = 1;
this.loadConfig.status = "loadmore";
this.list2 = [];
await this.getDocumentList();
},
//获取项目
async getDocumentList() {
if (this.loadConfig.status == "nomore") return;
this.loadConfig.status = "loading"
let res = await projectlist({
page: this.loadConfig.page,
limit: this.loadConfig.limit,
keyword: this.keyword
})
this.loadConfig.status = "loadmore"
if (res.data.data.length < this.loadConfig.limit) {
this.loadConfig.status = "nomore"
} else {
this.loadConfig.page++;
}
this.list = [...this.list, ...res.data?.data]
},
//添加项目
adddepart() {
uni.navigateTo({
url: '/pages/addproject/index?type=' + 0
})
},
//删除弹窗
clickItem(data) {
// console.log(e)
if (data.id == 2) {
uni.showModal({
content: '确定要删除吗',
success: (e) => {
if (e.confirm) {
this.deleteDepartment(this.list[data.index].id)
this.initList()
}
}
})
} else {
this.editpart(this.list[data.index])
}
},
//删除
async deleteDepartment(id) {
const res = await deleteprojectview({
id: id
})
if (res.code == 0) {
this.initList()
}
Toast(res.msg);
},
//编辑项目
editpart(item) {
uni.navigateTo({
url: '/pages/addproject/index??type=' + 1 + "&data=" + item.id
})
},
//查询
search() {
this.initList()
},
//输入监听
setValue(e) {
this.keyword = e.detail.value
if (this.keyword.length == 0) {
this.initList()
}
}
}
};
</script>
<style lang="scss" scoped>
page {
position: relative;
}
.content-middle {
.content-middle-title {
width: 100%;
background-color: #FFFFFF;
padding-top: 20rpx;
display: flex;
.search {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
width: 149rpx;
line-height: 63rpx;
height: 63rpx;
background: #FFFFFF;
text-align: center;
border-radius: 35rpx 35rpx;
border: 2rpx solid #E6E5E5;
margin-left: 18rpx;
}
.content-middle-search {
display: flex;
width: 527rpx;
height: 63rpx;
line-height: 63rpx;
padding-left: 30rpx;
background: #F7F7F7;
border-radius: 35rpx 35rpx;
font-size: 25rpx;
input {
width: 527rpx;
height: 63rpx;
line-height: 63rpx;
padding-left: 30rpx;
}
.placeholder {
font-size: 25rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
padding-left: 30rpx;
}
}
}
.content-middle-title {
height: 98rpx;
line-height: 98rpx;
background: #FFFFFF;
font-size: 35rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
padding-left: 28rpx;
}
.content-middle-one {
.middle-one {
background-color: #FFFFFF;
padding: 28rpx 28rpx;
margin: 28rpx 28rpx;
.middle-onea {
display: flex;
justify-content: space-between;
border-bottom: 1rpx solid #CCCCCC;
padding-bottom: 20rpx;
.middle-onea-title {
display: flex;
}
.middle-onea-img {
width: 50rpx;
height: 50rpx;
margin-right: 20rpx;
image {
width: 100%;
height: 100%;
}
}
}
.middle-oneb {
display: flex;
justify-content: space-between;
margin-top: 10rpx;
.middle-oneb-a {
.threeb-a-b {
.achor {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
margin-top: 20rpx;
margin-bottom: 20rpx;
}
.middle-edit {
width: 645rpx;
height: 63rpx;
line-height: 63rpx;
background: #e6e5d9;
text-align: center;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #000;
margin-bottom: 20rpx;
}
.middle-delete {
width: 645rpx;
height: 63rpx;
line-height: 63rpx;
background: #F02828;
text-align: center;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #FFFFFF;
}
}
}
.middle-oneb-b {
width: 80rpx;
height: 80rpx;
margin-top: 45rpx;
image {
width: 100%;
height: 100%;
}
}
}
}
}
}
.content-bootom {
width: 485rpx;
height: 88rpx;
text-align: center;
line-height: 88rpx;
background: #3274F9;
border-radius: 60px 60px 60px 60px;
display: flex;
left: 50%;
margin-left: -252.5rpx;
position: absolute;
bottom: 150rpx;
z-index: 9999 !important;
position: fixed;
.content-bootom-one {
margin-left: 142rpx;
margin-top: 5rpx;
width: 32rpx;
height: 32rpx;
margin-right: 10rpx;
image {
width: 100%;
height: 100%;
}
}
.content-bootom-two {
font-size: 35rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
}
}
</style>