提交 9d945799 作者: wk

初次验收问题修复:组织切换增加搜索(前端临时处理)

父级 7cde8089
......@@ -43,7 +43,7 @@ const params = {
method: "post"
},
sendCode: {
url: "/api/v1/access/login/create_validate_code",
url: "/api/v1/access/login/send_validate_code",
method: "post"
},
//获取省市区
......
<template>
<view class="content">
<titleBar title="切换组织"></titleBar>
<view class="search">
<view class="search-content">
<image src="../../../static/ic-search.png" class="image"></image>
<input placeholder="搜索" placeholder-class="placeholderStyle" @input="search" class="inputStyle" />
</view>
</view>
<view class="org-content">
<view class="org-list">
<view class="org-item" v-for="(tree,index) in trees" :key="index">
......@@ -45,7 +51,8 @@
export default {
data() {
return {
trees: []
trees: [],
temp: []
}
},
onLoad() {
......@@ -73,11 +80,12 @@
if (result.code == 0) {
var list = result.data.list
if (list && list.length > 0) {
if (list[0].no == '001') {
this.trees = list[0].children_list
} else {
this.trees = list
}
// if (list[0].no == '001') {
this.trees = list[0].children_list
// } else {
// this.trees = list
// }
this.temp = list[0].children_list
}
}
})
......@@ -140,6 +148,65 @@
delta: 1
})
},
search(e) {
var key = e.detail.value
if (key) {
var list = []
var sourceData = this.temp
console.log("数据源", sourceData);
sourceData.forEach((item) => {
if (item.name.indexOf(key) != -1) {
item.isOpen = true
list.push(item)
} else {
var children = item.children_list
var childrens = []
if (children) {
children.forEach((child) => {
if (child.name.indexOf(key) != -1) {
child.isOpen = true
var childs = child.children_list
var childList = []
if (childs) {
childs.forEach((childItem) => {
if (childItem.name.indexOf(key) != -1) {
childList.push(childItem)
}
})
}
child.children_list = childList
childrens.push(child)
} else {
var childs = child.children_list
var childList = []
if (childs) {
childs.forEach((childItem) => {
if (childItem.name.indexOf(key) != -1) {
childList.push(childItem)
}
})
}
if (childList.length > 0) {
child.children_list = childList
child.isOpen = true
childrens.push(child)
}
}
})
}
if (childrens.length > 0) {
item.isOpen = true
item.children_list = childrens
list.push(item)
}
}
})
this.trees = list
} else {
this.getOrgTree()
}
}
}
}
</script>
......@@ -149,6 +216,61 @@
display: flex;
flex-direction: column;
.search {
display: flex;
flex-direction: row;
align-items: center;
margin: 30rpx 30rpx 0 30rpx;
.search-content {
display: flex;
flex-direction: row;
border: 1rpx solid #656565;
height: 30px;
width: 690rpx;
border-radius: 30rpx;
align-items: center;
image {
width: 24rpx;
margin-left: 30rpx;
height: 24rpx;
}
.placeholderStyle {
font-size: 24rpx;
color: #999;
}
.inputStyle {
font-size: 24rpx;
margin-left: 20rpx;
color: #333;
}
}
.order-content {
display: flex;
flex-direction: row;
align-items: center;
margin: 0 30rpx;
text {
font-weight: 400;
font-size: 14px;
line-height: 20px;
text-align: center;
color: #656565;
}
image {
width: 28px;
height: 14px;
}
}
}
.org-content {
display: flex;
flex-direction: column;
......
......@@ -24,7 +24,7 @@
<view class="line" v-if="false"></view>
<view class="item" @click="linkTo('/pages/mine/myApproval/myApproval')" v-if="isShow('我的审批')">
<view class="name">我的审批</view>
<view class="red-dot"></view>
<view class="red-dot" v-if="count>0"></view>
<image src="../../static/right-arrow.png" class="image"></image>
</view>
<view class="line" v-if="isShow('我的审批')"></view>
......@@ -52,6 +52,7 @@
</template>
<script>
import Api from '../../api/api.js'
export default {
data() {
return {
......@@ -64,7 +65,9 @@
}
},
menus: [],
role: "VISITOR"
role: "VISITOR",
mDatas: [],
count: 0
}
},
onLoad() {
......@@ -85,6 +88,7 @@
this.currentJob = job
this.menus = getApp().globalData.authMenus
this.role = this.userInfo.identity.code
this.getComNoApproval()
},
methods: {
isShow(name) {
......@@ -155,7 +159,56 @@
uni.navigateTo({
url: router,
})
}
},
//前端临时处理
getComNoApproval() {
Api.getExamineList({
data: {
dept_type: 1,
is_page: 0,
},
}).then((result) => {
console.log("公司申请列表", result);
if (result.code == 0) {
if (result.data.list.length > 0) {
this.mDatas = result.data.list
}
this.getProjectNoApproval()
} else {
this.$toast.showToast(result.msg)
}
})
},
getProjectNoApproval() {
Api.getExamineList({
data: {
dept_type: 2,
is_page: 0,
},
}).then((result) => {
console.log("公司申请列表", result);
if (result.code == 0) {
if (result.data.list.length > 0) {
this.mDatas = this.mDatas.concat(result.data.list)
this.dealStatus()
}
} else {
this.$toast.showToast(result.msg)
}
})
},
dealStatus() {
this.count = 0
var noApprovalList = this.mDatas.filter(item => item.status == '2')
noApprovalList.forEach((item) => {
if (this.leaveTime(item.create_time) != '0秒') {
count++
}
})
},
leaveTime(time) {
return this.$date.timeDiff(this.$date.getEndTime(time), false)
},
}
}
</script>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
Please register or to comment