// pages/school/projectList/index.js const app = getApp() Page({ onListTap(e) { let progressId = e.currentTarget.dataset.progressid let stepCode = e.currentTarget.dataset.stepcode wx.navigateTo({ url: '/pages/project/projectHandle/index?progressId='+progressId+'&stepCode='+stepCode.substring(0,2)+'&canDo=1' }); }, lower(e) { console.log(e); }, //获取指定步骤的导航栏数据 getStepConfigByCode() { let that = this; wx.request({ url: app.globalData.serverUrl + '/baseService/gtzz/getStepConfigByCode', method: "GET", header: { 'content-type': 'application/json; charset=utf-8', 'cookie': wx.getStorageSync('sessionid') }, data: { step_code: this.data.segmentStepCode }, success(res) { that.setData({ segmentItems: res.data.list }); } }); }, //获取去年、今年、明年 getYearList() { var thisYear = new Date().getFullYear(); var lastYear = thisYear - 1; var nextYear = thisYear + 1; this.setData({ yearList: [{ id: -1, name: '全部', active: false }, { id: nextYear, name: nextYear + '年', active: false }, { id: thisYear, name: thisYear + '年', active: false }, { id: lastYear, name: lastYear + '年', active: false } ] }); }, //关闭筛选标签 closeFilterFlag(e) { let _filterTypeObj = this.data.filterTypeObj; let _typeList = this.data.typeList; _typeList[_filterTypeObj.index].active = false; _filterTypeObj.index = 0; _filterTypeObj.value = '0'; _filterTypeObj.tempIndex = 0; _filterTypeObj.tempValue = '0'; let _filterYearObj = this.data.filterYearObj; let _yearList = this.data.yearList; _yearList[_filterYearObj.index].active = false; _filterYearObj.index = 0; _filterYearObj.value = '0'; _filterYearObj.tempIndex = 0; _filterYearObj.tempValue = '0'; this.setData({ typeList: _typeList, filterTypeObj: _filterTypeObj, yearList: _yearList, filterYearObj: _filterYearObj, filterFlagShow: false, argsYear: 0, argsProTypeId: 0 }); this.getStepList(); }, //筛选确定 filterOK(e) { let flagShow = true; let _filterCondition = ''; let _filterTypeObj = this.data.filterTypeObj; _filterTypeObj.index = _filterTypeObj.tempIndex; _filterTypeObj.value = _filterTypeObj.tempValue; let _filterYearObj = this.data.filterYearObj; _filterYearObj.index = _filterYearObj.tempIndex; _filterYearObj.value = _filterYearObj.tempValue; if (_filterTypeObj.tempIndex == 0 && _filterYearObj.tempIndex == 0) { flagShow = false; } if(_filterTypeObj.tempIndex!=0){ _filterCondition = _filterCondition+this.data.typeList[_filterTypeObj.tempIndex]["name"]+","; } if(_filterYearObj.tempIndex!=0){ _filterCondition = _filterCondition+this.data.yearList[_filterYearObj.tempIndex]["name"]+","; } if(_filterCondition.length>0) { _filterCondition = _filterCondition.slice(0,_filterCondition.length - 1); } let typeId = _filterTypeObj.value; let yearId = _filterYearObj.value; this.setData({ arc_show: false, filterTypeObj: _filterTypeObj, filterYearObj: _filterYearObj, filterFlagShow: flagShow, argsProTypeId: typeId, argsYear: yearId, filterCondition:_filterCondition }); this.getStepList(); }, // 阻止冒泡 doNothing() {}, //显示筛选弹出层 onShowPopupTap() { this.setData({ arc_show: true }); let _filterTypeObj = this.data.filterTypeObj; let _typeList = this.data.typeList; _typeList[_filterTypeObj.tempIndex].active = false; _typeList[_filterTypeObj.index].active = true; let _filterYearObj = this.data.filterYearObj; let _yearList = this.data.yearList; _yearList[_filterYearObj.tempIndex].active = false; _yearList[_filterYearObj.index].active = true; this.setData({ typeList: _typeList, yearList: _yearList }); }, //隐藏筛选弹出层 onHidePopupTap() { this.setData({ arc_show: false }); let _filterTypeObj = this.data.filterTypeObj; let _typeList = this.data.typeList; _typeList[_filterTypeObj.tempIndex].active = false; _filterTypeObj.tempIndex = _filterTypeObj.index; _filterTypeObj.tempValue = _filterTypeObj.value; let _filterYearObj = this.data.filterYearObj; let _yearList = this.data.yearList; _yearList[_filterYearObj.tempIndex].active = false; _filterYearObj.tempIndex = _filterYearObj.index; _filterYearObj.tempValue = _filterYearObj.value; this.setData({ typeList: _typeList, filterTypeObj: _filterTypeObj, yearList: _yearList, filterYearObj: _filterYearObj, }); }, //点筛选中的项目类型 ontaglintapType(event) { let _filterTypeObj = this.data.filterTypeObj; //获取之前选中的index let tempIndex = _filterTypeObj.tempIndex; //获取当前选中的index let index = event.currentTarget.dataset.index; let _typeList = this.data.typeList; _typeList[tempIndex].active = false _typeList[index].active = true; _filterTypeObj.tempIndex = index _filterTypeObj.tempValue = _typeList[index].id; this.setData({ typeList: _typeList, filterTypeObj: _filterTypeObj }); }, //点筛选中的申报年度 ontaglintapYear(event) { let _filterYearObj = this.data.filterYearObj; //获取之前选中的index let tempIndex = _filterYearObj.tempIndex; //获取当前选中的index let index = event.currentTarget.dataset.index; let _yearList = this.data.yearList; _yearList[tempIndex].active = false _yearList[index].active = true; _filterYearObj.tempIndex = index _filterYearObj.tempValue = _yearList[index].id; this.setData({ yearList: _yearList, filterYearObj: _filterYearObj }); }, /** * 页面的初始数据 */ data: { arc_show: false, filterTypeObj: { index: 0, tempIndex: 0, value: '0', tempValue: '0' }, filterYearObj: { index: 0, tempIndex: 0, value: '0', tempValue: '0' }, yearList: [], typeList: [{ id: '0', name: '全部', active: false }, { id: 'ef65dc83-4775-42e7-bd1a-44bbcd4cd8ab', name: '基础条件装备', active: false }, { id: '6678226f-afc4-475d-a9c0-8ba0d669494e', name: '学科装备', active: false }, { id: 'd5c64708-a068-4198-b6bd-dd3ee91b9a11', name: '信息技术教学装备', active: false }, { id: '610f4753-52de-4459-a472-4ec1fe74f227', name: '创新教育装备', active: false }, { id: '7dd1f50b-1ce2-4ae7-8d82-5eda16d1a64a', name: '其他', active: false }, { id: '13e4eaef-cbef-48ad-bc46-5923ad933629', name: '信息化项目', active: false } ], filterCondition:'', stepList: [], argsYear: 0, argsProTypeId: 0, argsStepCode: '0201', argsKeyWord: '', argsPage: 1, argsLimit: 100, segmentItems: [], //是待还是已 1:待 2:已 showType: 1, flagShow:false, segmentStepCode:'' }, //获取指定步骤的项目列表,准备申报学校和电教馆使用同一个列表接口(已办) getStepList() { let showType = this.data.showType; let url = ''; if (showType == 1) { url = '/baseService/gtzz/getToDoStepList'; } else { url = '/baseService/gtzz/getFinishStepList'; } let that = this; wx.request({ url: app.globalData.serverUrl + url, method: "GET", header: { 'content-type': 'application/json; charset=utf-8', 'cookie': wx.getStorageSync('sessionid') }, data: { year: this.data.argsYear, step_code: this.data.argsStepCode, subject_type_id: this.data.argsProTypeId, keyword: this.data.argsKeyWord, page: this.data.argsPage, limit: this.data.argsLimit }, success(res) { that.setData({ stepList: res.data.data }); } }); }, //选项卡Change事件 segmentChange(e) { let segmentIndex = e.detail.currentIndex; let segmentItemsData = this.data.segmentItems; let stepCode = segmentItemsData[segmentIndex].out_step_code; let showType = segmentItemsData[segmentIndex].show_type; this.setData({ argsStepCode: stepCode, showType: showType }); this.getStepList(); }, //搜索 searchKeyWord() { this.getStepList(); }, //监听搜索栏输入的内容 searchInput(e) { this.setData({ argsKeyWord: e.detail.value }); }, searchClear() { this.setData({ argsKeyWord: '' }); this.getStepList(); }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { //获取页面传的参数 this.setData({ argsStepCode: options.code, segmentStepCode:options.code }); //获取筛选中的年份 this.getYearList(); }, /** * 生命周期函数--监听页面显示 */ onShow: function () { //获取列表 this.getStepList(); //获取指定步骤的导航栏数据 this.getStepConfigByCode(); } })