|
@@ -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() {}
|