You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
var api = require('../../api/project.js')
|
|
|
|
var utils = require('../../utils/util')
|
|
|
|
const app = getApp()
|
|
|
|
Component({
|
|
|
|
properties: {
|
|
|
|
state: Number
|
|
|
|
},
|
|
|
|
data: {
|
|
|
|
items: [],
|
|
|
|
showSkeleton: true
|
|
|
|
},
|
|
|
|
attached: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
lifetimes: {
|
|
|
|
attached: function () {},
|
|
|
|
moved: function () {},
|
|
|
|
detached: function () {},
|
|
|
|
},
|
|
|
|
|
|
|
|
ready: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
pageLifetimes: {
|
|
|
|
// 组件所在页面的生命周期函数
|
|
|
|
show: function () {},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
getItemList: function (page, index, clear, isPartyFlag=0) {
|
|
|
|
// wx.showLoading({
|
|
|
|
// title: '加载中',
|
|
|
|
// })
|
|
|
|
if (clear == 0) {//清空数据
|
|
|
|
this.setData({
|
|
|
|
items: []
|
|
|
|
})
|
|
|
|
}
|
|
|
|
let that = this
|
|
|
|
let itemState = 0
|
|
|
|
if (index == 1) {
|
|
|
|
itemState = 10
|
|
|
|
} else if (index == 2) {
|
|
|
|
itemState = 5
|
|
|
|
} else {}
|
|
|
|
|
|
|
|
let curGrid = wx.getStorageSync('currentGrid');
|
|
|
|
let deptId='';
|
|
|
|
if (curGrid !== undefined && curGrid !== 'undefined' && curGrid !== '') {
|
|
|
|
deptId = curGrid.deptId
|
|
|
|
}
|
|
|
|
let params = {
|
|
|
|
"deptId": deptId,
|
|
|
|
"pageIndex": page,
|
|
|
|
"pageSize": app.globalData.pageSize,
|
|
|
|
"timestamp": utils.formatTimeOpen(new Date(), '-', ':'),
|
|
|
|
"itemState": itemState,
|
|
|
|
"isPartyFlag": isPartyFlag
|
|
|
|
}
|
|
|
|
console.log("params:" + JSON.stringify(params))
|
|
|
|
api.getItemList(params).then(function (res) {
|
|
|
|
// wx.hideLoading()
|
|
|
|
console.log(res.data)
|
|
|
|
that.setData({
|
|
|
|
items: that.data.items.concat(res.data),
|
|
|
|
showSkeleton: false
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
toItemDetail(e) {
|
|
|
|
const id = e.currentTarget.dataset.id
|
|
|
|
const itemState = this.data.state
|
|
|
|
console.log('状态:'+itemState)
|
|
|
|
if (itemState == 0){
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `../../pages/itemDetail/itemDetail?itemId=${id}&itemState=${itemState}`
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `../../pages/project/projectDetail/projectDetail?itemId=${id}&itemState=${itemState}`
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|