123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- const _Http = getApp().globalData.http;
- Page({
- data: {
- timeRangeShow: false,
- activeIndex: 0,
- whereType: {
- value: "begdate",
- list: {
- "begdate": "",
- "enddate": ""
- }
- },
- option1: [{
- text: '所有日期',
- value: '所有日期'
- },
- {
- text: '查看范围',
- value: '查看范围'
- }
- ],
- option2: [{
- text: '按日期升序',
- value: '按日期升序'
- },
- {
- text: '按日期降序',
- value: '按日期降序'
- },
- ],
- value1: '所有日期',
- value2: '按日期升序',
- "content": {
- "onceonly": 1,
- "nocache": true,
- pageNumber: 1,
- pageSize: 20,
- pageTotal: 1,
- "where": {
- "begdate": "",
- "enddate": ""
- }
- },
- },
- onLoad(options) {
- this.getList();
- },
- getList(init = false) {
- if (init.detail != undefined) init = init.detail;
- if (init) this.setData({
- ['content.pageNumber']: 1
- })
- if (this.data.content.pageNumber > this.data.content.pageTotal) return;
- let content = JSON.parse(JSON.stringify(this.data.content));
- if (content.where.begdate == "" && content.where.enddate == "") delete content.where;
- if (this.data.sort != "") content.sort = this.data.sort;
- _Http.basic({
- id: this.data.activeIndex == 2 ? 20221102094802 : 20221102094702,
- content
- }).then(res => {
- console.log("提报列表", res)
- this.selectComponent('#ListBox').RefreshToComplete();
- if (res.msg != '成功') return wx.showToast({
- title: res.msg,
- icon: "none"
- })
- for (let i = 0; i < res.data.length; i++) {
- res.data[i].begdate = res.data[i].begdate.split(" ")[0];
- res.data[i].enddate = res.data[i].enddate.split(" ")[0];
- }
- this.setData({
- list: (res.pageNumber == 1) ? res.data : this.data.list.concat(res.data),
- ['content.pageNumber']: res.pageNumber + 1,
- ['content.pageTotal']: res.pageTotal,
- total: res.total,
- sort: res.sort
- })
- })
- },
- /* tabs切换 */
- tabsClick({
- detail
- }) {
- this.setData({
- activeIndex: detail.index,
- "content.onceonly": detail.index == 0 ? 1 : 0
- });
- this.getList(true)
- },
- /* 查看日期 */
- dropdownChange1({
- detail
- }) {
- this.setData({
- value1: detail
- })
- },
- Dateclick(e) {
- console.log(e)
- setTimeout(() => {
- if (this.data.value1 == '查看范围') {
- this.setData({
- timeRangeShow: true
- })
- } else {
- this.toSeeAll();
- }
- }, 100)
- },
- /* 排序 */
- dropdownChange2({
- detail
- }) {
- this.setData({
- value2: detail,
- "sort[0].reversed": detail == '按日期降序' ? 1 : 0
- })
- this.getList(true)
- },
- /* 关闭时间范围选择 */
- timeRangeClose() {
- this.setData({
- timeRangeShow: false,
- "content.where": {
- "begdate": "",
- "enddate": ""
- }
- })
- },
- /* 查看所有日期 */
- toSeeAll() {
- this.setData({
- value1: "所有日期"
- })
- this.timeRangeClose();
- this.getList(true);
- },
- /* 选择日期类型 */
- selectDateType(e) {
- const {
- name
- } = e.target.dataset;
- this.setData({
- "whereType.value": name
- })
- },
- /* 得到选择时间 */
- getDate({
- detail
- }) {
- let obj = this.data.whereType;
- obj.list[obj.value] = detail;
- this.setData({
- whereType: obj
- })
- },
- /* 确定时间范围 */
- determineScope() {
- this.setData({
- "content.where": this.data.whereType.list
- });
- this.getList(true);
- this.timeRangeClose();
- },
- /* 去详情 */
- toDetails(e) {
- const {
- item
- } = e.currentTarget.dataset;
- wx.navigateTo({
- url: `./details?type=开始提报&id=${item.sat_submiteditmodelid}&oneToOne=${this.data.activeIndex === 0}&ishistory=${item.ishistory}`,
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- this.selectComponent("#ListBox").setHeight(".dropdown", this);
- },
- onShareAppMessage(res) {}
- })
|