瀏覽代碼

项目商机

zhaoxiaohai 2 年之前
父節點
當前提交
c0cd620bc6

+ 104 - 37
packageA/project/index.js

@@ -3,6 +3,7 @@ const _Http = getApp().globalData.http,
 
 Page({
     data: {
+        listHeight: null,
         navList: [{
             label: "全部",
             icon: "icon-webxialaxuanxiangjiantou",
@@ -11,13 +12,13 @@ Page({
             id: "1"
         }, {
             label: "创建时间",
-            icon: "icon-quxiao",
+            icon: "icon-shengxu",
             color: "",
             width: "",
             id: "3"
         }, {
             label: "筛选",
-            icon: "icon-daoruxialajiantou",
+            icon: "icon-shaixuan",
             color: "",
             width: "",
             id: "2"
@@ -48,17 +49,15 @@ Page({
             "pageNumber": 1,
             "pageSize": 20,
             "where": {
-                "condition": "",
-                "status": "",
+                "condition": "", //模糊搜索
                 "startdate": "",
-                "enddate": ""
+                "enddate": "",
+                "status": "", //项目状态
+                "projecttype": "", //项目类型
+                "stagename": "", //项目阶段
+                "tag": "" //标签
             },
-            "sort": [{
-                sortname: "默认",
-                sorted: 1,
-                sortid: 68,
-                reversed: 0
-            }]
+            "sort": []
         },
         filter: {
             show: false,
@@ -66,6 +65,8 @@ Page({
             statusActive: "",
             projectTypeList: [], //项目类型项
             typeActive: "",
+            tagList: [], //标签
+            tagActive: "",
             stageList: [], //项目阶段项目
             stageActive: "",
             startdate: "",
@@ -74,6 +75,20 @@ Page({
     },
     onLoad(options) {
         this.getList();
+        //获取所有阶段
+        this.getStage();
+        //获取所有标签
+        this.getTagList()
+    },
+    /* 处理搜索 */
+    onSearch({
+        detail
+    }) {
+        this.setData({
+            "content.where.condition": detail
+        });
+        this.getList(true);
+
     },
     /* 获取列表 */
     getList(init = false, data) {
@@ -85,6 +100,7 @@ Page({
             content.where.status = data.statusActive;
             content.where.projecttype = data.typeActive;
             content.where.stagename = data.stageActive;
+            content.where.tag = data.tagActive;
             content.where.startdate = data.startdate;
             content.where.enddate = data.enddate;
         }
@@ -98,16 +114,42 @@ Page({
                 title: res.data,
                 icon: "none"
             })
-            // this.getTags(res.data.map(v => v.sys_enterpriseid));
+
             res.data = res.data.map(v => {
-                v.winrate = parseFloat(v.winrate.substring(0, v.winrate.length - 1));
+                v.progress = v.stage / v.totalstage * 100;
                 return v
             })
             this.setData({
                 'content.pageNumber': res.pageNumber + 1,
                 'content.pageTotal': res.pageTotal,
                 'content.total': res.total,
+                'content.sort': res.sort,
                 list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
+            });
+            this.setListHeight();
+            this.getTags();
+        })
+    },
+    /* 获取列表标签 */
+    getTags() {
+        let list = this.data.list,
+            ownerids = list.map(v => v.sa_projectid);
+        _Http.basic({
+            "id": 20221018102001,
+            "content": {
+                nocache: true,
+                "ownertable": "sa_project",
+                ownerids
+            }
+        }).then(res => {
+            console.log("标签", res)
+            for (let key in res.data) {
+                let index = list.findIndex(v => v.sa_projectid == key);
+                list[index].tags = res.data[key]
+            };
+            console.log(list)
+            this.setData({
+                list
             })
         })
     },
@@ -133,6 +175,7 @@ Page({
                 this.setData({
                     'filter.statusActive': "",
                     'filter.typeActive': "",
+                    'filter.tagActive': "",
                     'filter.stageActive': "",
                     'filter.startdate': "",
                     'filter.enddate': "",
@@ -155,6 +198,15 @@ Page({
             "filter.statusActive": this.data.filter.statusActive == item ? "" : item
         })
     },
+    /* 筛选标签选择 */
+    selectTag(e) {
+        const {
+            item
+        } = e.currentTarget.dataset;
+        this.setData({
+            "filter.tagActive": this.data.filter.tagActive == item.tag ? "" : item.tag
+        })
+    },
     /* 筛选项目类 */
     selectTypeName(e) {
         const {
@@ -164,23 +216,6 @@ Page({
         this.setData({
             "filter.typeActive": value
         });
-        _Http.basic({
-            "id": 20221107150004,
-            "content": {
-                "projecttype": value
-            }
-        }).then(res => {
-            console.log("模板阶段", res)
-            if (res.msg != '成功') return wx.showToast({
-                title: res.data,
-                icon: "none"
-            })
-            this.setData({
-                "filter.stageList": res.data,
-                "filter.stageActive": ""
-            })
-        })
-
     },
     /* 筛选阶段 */
     stageStatus(e) {
@@ -259,14 +294,46 @@ Page({
         this.getList(true)
     },
     onReady() {
-        getHeight.getHeight('.total', this).then(res => this.setData({
-            listHeight: res
-        }));
+        this.setListHeight();
     },
-    /* 搜索 */
-    navSearch() {
-        wx.navigateTo({
-            url: '/packageA/project/search'
+    setListHeight() {
+        getHeight.getHeight('.total', this).then(res => {
+            if (this.data.listHeight != res)
+                this.setData({
+                    listHeight: res
+                })
+        });
+    },
+    /* 获取所有阶段 */
+    getStage() {
+        _Http.basic({
+            "id": 20221116104502,
+            "content": {
+                nocache: true,
+            }
+        }, false).then(res => {
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            this.setData({
+                "filter.stageList": res.data
+            })
+        })
+    },
+    /* 获取所有标签 */
+    getTagList() {
+        _Http.basic({
+            "id": 20220929085401,
+            "content": {
+                "ownertable": 'sa_project',
+                "ownerid": ""
+            }
+        }, false).then(res => {
+            console.log("标签", res)
+            this.setData({
+                "filter.tagList": res.data.option
+            })
         })
     },
     onShareAppMessage() {}

+ 17 - 7
packageA/project/index.wxml

@@ -1,28 +1,38 @@
-<Yl_nav search list='{{navList}}' bind:onClick='navClick' bind:onSearch='navSearch' />
+<Yl_nav search list='{{navList}}' bind:onClick='navClick' bindonSearch="onSearch" />
 <!-- 显示类型 -->
 <van-action-sheet show="{{ classShow }}" actions="{{ classActions }}" cancel-text="取消" bind:cancel="classClose" bind:select="classSelect" />
 <view class="total">共{{content.total}}个</view>
 <My_listBox id='ListBox' height="{{listHeight}}" bind:getlist='getList'>
     <List list='{{list}}' />
+    <view style="height: 80rpx;" />
 </My_listBox>
 <!-- 筛选条件 -->
 <Yl_filtrate show="{{filter.show}}" bind:handle="handleFilter">
-    <view class="groud" wx:if="{{filter.projectTypeList.length!=0}}">
+    <view class="groud" wx:if="{{filter.stageList.length!=0}}">
         <view class="label">
-            项目类型
+            项目阶段
         </view>
         <view class="content">
-            <van-button custom-class='but {{filter.typeActive==item.value?"active":""}}' wx:for="{{filter.projectTypeList}}" wx:key="item.rowindex" bindtap="selectTypeName" data-item="{{item}}">{{item.value}}</van-button>
+            <van-button custom-class='but {{filter.stageActive==item.stagename?"active":""}}' wx:for="{{filter.stageList}}" wx:key="item.stagename" bindtap="stageStatus" data-item="{{item}}">{{item.stagename}}</van-button>
         </view>
     </view>
-    <view class="groud" wx:if="{{filter.stageList.length!=0}}">
+    <view class="groud" wx:if="{{filter.tagList.length!=0}}">
         <view class="label">
-            项目阶段
+            项目标签
         </view>
         <view class="content">
-            <van-button custom-class='but {{filter.stageActive==item.stagename?"active":""}}' wx:for="{{filter.stageList}}" wx:key="item.stagename" bindtap="stageStatus" data-item="{{item}}">{{item.stagename}}</van-button>
+            <van-button custom-class='but {{filter.tagActive==item.tag?"active":""}}' wx:for="{{filter.tagList}}" wx:key="item.sys_systemtagdetailid" bindtap="selectTag" data-item="{{item}}">{{item.tag}}</van-button>
         </view>
     </view>
+    <view class="groud" wx:if="{{filter.projectTypeList.length!=0}}">
+        <view class="label">
+            项目类型
+        </view>
+        <view class="content">
+            <van-button custom-class='but {{filter.typeActive==item.value?"active":""}}' wx:for="{{filter.projectTypeList}}" wx:key="item.rowindex" bindtap="selectTypeName" data-item="{{item}}">{{item.value}}</van-button>
+        </view>
+
+    </view>
     <view class="groud">
         <view class="label">
             项目状态

+ 2 - 8
packageA/project/modules/list/index.js

@@ -1,11 +1,5 @@
 Component({
     properties: {
-        list:Array
-    },
-    data: {
-
-    },
-    methods: {
-
+        list: Array
     }
-})
+})

+ 56 - 1
packageA/project/modules/list/index.scss

@@ -49,14 +49,19 @@
                 font-family: PingFang SC-Regular, PingFang SC;
                 color: #666666;
 
+                .value {
+                    margin-top: -6rpx;
+                }
+
                 .name {
-                    margin-bottom: 6rpx;
+                    margin-top: 6rpx;
                 }
             }
         }
     }
 
     .main {
+        position: relative;
         flex: 1;
         box-sizing: border-box;
         padding: 20rpx 0;
@@ -89,6 +94,32 @@
 
         }
 
+        .tag-box {
+            display: flex;
+            align-items: center;
+            width: 100%;
+
+            .datatag,
+            .systemtag {
+                flex-shrink: 0;
+                margin-top: 6rpx;
+                background: #FAAB16;
+                color: #ffffff;
+                margin-right: 10rpx;
+                display: flex;
+                align-items: center;
+                height: 40rpx;
+                font-size: 20rpx;
+                padding: 0 10rpx;
+                border-radius: 20rpx;
+                font-family: PingFang SC-Regular, PingFang SC;
+            }
+
+            .systemtag {
+                background: #FA8C16;
+            }
+        }
+
         .replenish {
             display: flex;
             min-height: 34rpx;
@@ -99,6 +130,30 @@
             word-break: break-all;
             white-space: pre-wrap;
         }
+
+        .leader {
+            position: absolute;
+            width: 60rpx;
+            height: 60rpx;
+            border-radius: 50%;
+            right: 30rpx;
+            bottom: 10rpx;
+            overflow: hidden;
+
+            image {
+                width: 100%;
+                height: 100%;
+            }
+
+            >view {
+                font-size: 28rpx;
+                font-family: PingFang SC-Regular, PingFang SC;
+                color: #FFFFFF;
+                background-color: #3874F6;
+                line-height: 60rpx;
+                text-align: center;
+            }
+        }
     }
 }
 

+ 19 - 11
packageA/project/modules/list/index.wxml

@@ -1,11 +1,11 @@
 <navigator url="/packageA/project/detail?sa_projectid={{item.sa_projectid}}" class="project-item" wx:for="{{list}}" wx:key="item.sa_projectid">
     <view class="chart">
         <view class="circle">
-            <view class="circle_left ab" style="{{render.leftRate(item.winrate)}}" />
-            <view class="circle_right ab" style="{{render.rightRate(item.winrate)}}" />
+            <view class="circle_left ab" style="{{render.leftRate(item.progress)}}" />
+            <view class="circle_right ab" style="{{render.rightRate(item.progress)}}" />
             <view class="circle_text">
-                <text class="name">赢率</text>
-                <text class="value">{{item.winrate}}%</text>
+                <text class="value">{{item.stage+'/'+item.totalstage}}</text>
+                <text class="name">阶段进度</text>
             </view>
         </view>
     </view>
@@ -14,21 +14,29 @@
             <view class="title line-1">{{item.projectname}}</view>
             <view class="state">进行中</view>
         </view>
+        <view class="tag-box">
+            <view class="systemtag" wx:for="{{item.tags.systemtag}}" wx:key="item">{{item}}</view>
+            <view class="datatag" wx:for="{{item.tags.datatag}}" wx:key="item">{{item}}</view>
+        </view>
         <view class="replenish">
             <text style="color: #666;">项目编号:</text>
             <text>{{item.projectnum}}</text>
         </view>
-        <view class="replenish">
-            <text style="color: #666;">项目地址:</text>
-            <text>{{item.province+item.city+item.county+item.address}}</text>
+        <view class="replenish" wx:if="{{item.province}}">
+            <text style="color: #666; flex-shrink: 0;">项目地址:</text>
+            <text class="line-1" style="width: 480rpx;">{{item.province+item.city+item.county+item.address}}</text>
         </view>
-        <view class="replenish">
+        <view class="replenish" wx:if="{{item.projecttype}}">
             <text style="color: #666;">项目类型:</text>
             <text>{{item.projecttype}}</text>
         </view>
-        <view class="replenish">
-            <text style="color: #666;">负责人:</text>
-            <text>{{item.name}}</text>
+        <view class="replenish" wx:if="{{item.grade}}">
+            <text style="color: #666;">项目等级:</text>
+            <text>{{item.grade}}</text>
+        </view>
+        <view class="leader">
+            <image src="{{item.leader[0].headpic}}" wx:if="{{item.leader[0].headpic}}" mode="aspectFill" />
+            <view wx:else>{{item.leader[0].name[0]}}</view>
         </view>
     </view>
 </navigator>