jhwxapp/miniprogram/pages/components/project-select/index.js

97 lines
1.8 KiB
JavaScript
Raw Normal View History

2023-08-10 01:21:29 +08:00
// pages/components/project-select/index.js
const app = getApp()
Component({
/**
* 组件的属性列表
*/
properties: {
init:{
type:Object
},
width:{
type:String
},
left:{
type:String
}
},
/**数据监听 */
observers: {
init: function (val) {
if(val){
this.setData({
item:val,
})
}
},
},
/**
* 组件的初始数据
*/
data: {
show: false,
index:0,
item:'',
columns:[],
projectList:[],
},
created(){
//this.getProjectNameList();
},
/**
* 组件的方法列表
*/
methods: {
showPopup() {
2023-08-21 18:55:48 +08:00
// var data = this.data.projectList;
// var initData = this.data.init
// for(var i=0;i<data.length;i++ ){
// if(data[i].id == initData.id){
// this.setData({
// index:i
// })
// break
// }
// }
2023-08-10 01:21:29 +08:00
2023-08-21 18:55:48 +08:00
// console.log(this.data.index)
// this.setData({
// columns:data,
// show: true
// });
2023-08-10 01:21:29 +08:00
},
onClose() {
this.setData({ show: false });
},
onSelectChange(e){
this.setData({
item:e.detail.value
})
},
onConfirm(){
this.setData({
value:this.data.item.text
})
this.triggerEvent('change',this.data.item)
this.setData({ show: false });
},
getProjectNameList:function(){
wx.request({
url: app.globalData.reqUrl+'/weixin/security/getProjectNameList',
method:"GET",
data:{
deptId:app.globalData.deptId,
projectId:app.globalData.userProjectId
},
success: (res) =>{
var that = this;
that.setData({
projectList:res.data
})
}
});
},
}
})