| xqd
@@ -24,22 +24,22 @@ Page({
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
|
|
|
- onChange: function(e) {
|
|
|
+ onChange: function (e) {
|
|
|
var name = e.currentTarget.dataset.name
|
|
|
this.setData({
|
|
|
[name]: e.detail
|
|
|
})
|
|
|
- if(['device_id', 'device_name_id'].indexOf(name) != -1) {
|
|
|
- if(name == 'device_id') {
|
|
|
+ if (['device_id', 'device_name_id'].indexOf(name) != -1) {
|
|
|
+ if (name == 'device_id') {
|
|
|
this.setData({
|
|
|
device_name_id: '',
|
|
|
spec_id: ''
|
|
|
})
|
|
|
}
|
|
|
- if(name == 'device_name_id') {
|
|
|
+ if (name == 'device_name_id') {
|
|
|
this.setData({
|
|
|
spec_id: ''
|
|
|
})
|
| xqd
@@ -48,7 +48,7 @@ Page({
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- confirm: function() {
|
|
|
+ confirm: function () {
|
|
|
this.saveFilter()
|
|
|
wx.navigateBack()
|
|
|
},
|
| xqd
@@ -60,21 +60,21 @@ Page({
|
|
|
|
|
|
},
|
|
|
|
|
|
- delete: function(e) {
|
|
|
+ delete: function (e) {
|
|
|
var name = e.currentTarget.dataset.name
|
|
|
var index = e.currentTarget.dataset.index
|
|
|
var items = this.data[name]
|
|
|
- if(index == 0) return false;
|
|
|
+ if (index == 0) return false;
|
|
|
items.splice(index, 1)
|
|
|
this.setData({
|
|
|
[name]: items
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- add: function(e) {
|
|
|
+ add: function (e) {
|
|
|
var name = e.currentTarget.dataset.name
|
|
|
var items = this.data[name]
|
|
|
- if(!items[items.length - 1]) {
|
|
|
+ if (!items[items.length - 1]) {
|
|
|
util.error('请先选择');
|
|
|
return false
|
|
|
}
|
| xqd
@@ -83,21 +83,25 @@ Page({
|
|
|
[name]: items
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
- onDropChange: function(e) {
|
|
|
+ onrentChange: function (e) {
|
|
|
+ this.setData({
|
|
|
+ rent_type_ids: [e.detail]
|
|
|
+ })
|
|
|
+ console.log(this.data.rent_type_ids)
|
|
|
+ },
|
|
|
+ onDropChange: function (e) {
|
|
|
var index = e.currentTarget.dataset.index
|
|
|
var name = e.currentTarget.dataset.name
|
|
|
var val = e.detail
|
|
|
var items = this.data[name]
|
|
|
items[index] = val
|
|
|
- console.log(items)
|
|
|
this.setData({
|
|
|
[name]: items
|
|
|
})
|
|
|
- if(name == 'device_ids') {
|
|
|
+ if (name == 'device_ids') {
|
|
|
this.updateDeviceNames()
|
|
|
}
|
|
|
- if(name == 'device_name_ids') {
|
|
|
+ if (name == 'device_name_ids') {
|
|
|
this.updateSpecs()
|
|
|
}
|
|
|
},
|
| xqd
@@ -107,7 +111,10 @@ Page({
|
|
|
that.setData({
|
|
|
device_name_ids: ['']
|
|
|
})
|
|
|
- api.getByName(this, 'device-names/get', 'names', {type: 'drop_menu', device_ids: this.data.device_ids}, function() {
|
|
|
+ api.getByName(this, 'device-names/get', 'names', {
|
|
|
+ type: 'drop_menu',
|
|
|
+ device_ids: this.data.device_ids
|
|
|
+ }, function () {
|
|
|
that.updateSpecs();
|
|
|
});
|
|
|
},
|
| xqd
@@ -117,7 +124,10 @@ Page({
|
|
|
that.setData({
|
|
|
spec_ids: ['']
|
|
|
})
|
|
|
- api.getByName(this, 'specs/get', 'specs', {type: 'drop_menu', device_name_ids: this.data.device_name_ids});
|
|
|
+ api.getByName(this, 'specs/get', 'specs', {
|
|
|
+ type: 'drop_menu',
|
|
|
+ device_name_ids: this.data.device_name_ids
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
/**
|
| xqd
@@ -126,10 +136,20 @@ Page({
|
|
|
onShow: function () {
|
|
|
var data = wx.getStorageSync('sg-data-filters')
|
|
|
this.setData(data)
|
|
|
- api.getByName(this, 'devices/get', 'devices', {type: 'drop_menu'});
|
|
|
- api.getByName(this, 'device-names/get', 'names', {type: 'drop_menu', device_ids: this.data.device_ids});
|
|
|
- api.getByName(this, 'specs/get', 'specs', {type: 'drop_menu', device_name_ids: this.data.device_name_ids});
|
|
|
- api.getByName(this, 'rent-types/get', 'rent_types', {type: 'drop_menu'});
|
|
|
+ api.getByName(this, 'devices/get', 'devices', {
|
|
|
+ type: 'drop_menu'
|
|
|
+ });
|
|
|
+ api.getByName(this, 'device-names/get', 'names', {
|
|
|
+ type: 'drop_menu',
|
|
|
+ device_ids: this.data.device_ids
|
|
|
+ });
|
|
|
+ api.getByName(this, 'specs/get', 'specs', {
|
|
|
+ type: 'drop_menu',
|
|
|
+ device_name_ids: this.data.device_name_ids
|
|
|
+ });
|
|
|
+ api.getByName(this, 'rent-types/get', 'rent_types', {
|
|
|
+ type: 'drop_menu'
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
/**
|
| xqd
@@ -171,7 +191,7 @@ Page({
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom: function () {
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
|
|
|
/**
|