|
@@ -11,6 +11,9 @@ Page({
|
|
items_first: null,
|
|
items_first: null,
|
|
items_second: null,
|
|
items_second: null,
|
|
items_third: null,
|
|
items_third: null,
|
|
|
|
+
|
|
|
|
+ chooseItems: null,
|
|
|
|
+ totalItems: 0,
|
|
//
|
|
//
|
|
isFolded: true,
|
|
isFolded: true,
|
|
hui: "block",
|
|
hui: "block",
|
|
@@ -130,7 +133,7 @@ Page({
|
|
|
|
|
|
|
|
|
|
onLoad(e) {
|
|
onLoad(e) {
|
|
- console.log(e.busEnterpriseId)
|
|
|
|
|
|
+ this.data.chooseItems = new Map()
|
|
this.data.busEnterpriseId = e.busEnterpriseId
|
|
this.data.busEnterpriseId = e.busEnterpriseId
|
|
this.getXunjianczData()
|
|
this.getXunjianczData()
|
|
},
|
|
},
|
|
@@ -208,7 +211,6 @@ Page({
|
|
http.post("/system/AppXunjianController/getItems", obj, this.getSecondItemsSuccess)
|
|
http.post("/system/AppXunjianController/getItems", obj, this.getSecondItemsSuccess)
|
|
},
|
|
},
|
|
getSecondItemsSuccess(res) {
|
|
getSecondItemsSuccess(res) {
|
|
- console.log(res)
|
|
|
|
this.setData({
|
|
this.setData({
|
|
items_second: res.data
|
|
items_second: res.data
|
|
})
|
|
})
|
|
@@ -237,15 +239,89 @@ Page({
|
|
http.post("/system/AppXunjianController/getItemsLast", obj, this.getThirdItemsSuccess)
|
|
http.post("/system/AppXunjianController/getItemsLast", obj, this.getThirdItemsSuccess)
|
|
},
|
|
},
|
|
getThirdItemsSuccess(res) {
|
|
getThirdItemsSuccess(res) {
|
|
|
|
+ let that = this
|
|
|
|
+ res.data.forEach(element => {
|
|
|
|
+ if (that.data.chooseItems[element.busItemsId] == true) {
|
|
|
|
+ element.checked = true
|
|
|
|
+ }
|
|
|
|
+ });
|
|
this.setData({
|
|
this.setData({
|
|
items_third: res.data
|
|
items_third: res.data
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
- checkThirdItem(e){
|
|
|
|
- console.log(e)
|
|
|
|
|
|
+ checkThirdItem(e) {
|
|
|
|
+ let busItemId = e.currentTarget.dataset.busitemsid
|
|
|
|
+ if (this.data.chooseItems[busItemId] == undefined || this.data.chooseItems[busItemId] == null) {
|
|
|
|
+ this.data.chooseItems[busItemId] = true
|
|
|
|
+ } else {
|
|
|
|
+ this.data.chooseItems[busItemId] = null
|
|
|
|
+ }
|
|
|
|
+ //计数
|
|
|
|
+ console.log(this.data.chooseItems)
|
|
|
|
+ let count = 0;
|
|
|
|
+ for (let item in this.data.chooseItems) {
|
|
|
|
+ if (this.data.chooseItems[item] == true) {
|
|
|
|
+ count++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.setData({
|
|
|
|
+ totalItems: count
|
|
|
|
+ })
|
|
},
|
|
},
|
|
|
|
+ saveXunjianItems() {
|
|
|
|
+ let obj = new Object()
|
|
|
|
+ obj.busEnterpriseId = this.data.busEnterpriseId
|
|
|
|
+ obj.chooseItems = this.data.chooseItems;
|
|
|
|
+ http.send_post("/system/AppXunjianController/saveXunjianItems", obj, this.saveXunjianItemsSuccess)
|
|
|
|
+ },
|
|
|
|
+ saveXunjianItemsSuccess(res) {
|
|
|
|
+ console.log(res)
|
|
|
|
+ if (res.data.code == 200) {
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: '../xunjiancz/xunjiancz?busEnterpriseId=' + this.data.busEnterpriseId,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ deleteItem(e) {
|
|
|
|
+ let that = this
|
|
|
|
+ let info = e.currentTarget.dataset.busiteminfo
|
|
|
|
+ wx.showModal({
|
|
|
|
+ title: "提示",
|
|
|
|
+ content: "确定要删除[" + info + "]?",
|
|
|
|
+ success: function (sm) {
|
|
|
|
+ if(sm.confirm){
|
|
|
|
+ let obj = new Object()
|
|
|
|
+ obj.busItemsId = e.currentTarget.dataset.busitemid
|
|
|
|
+ obj.busEnterpriseId = that.data.busEnterpriseId
|
|
|
|
+ obj.jibie = e.currentTarget.dataset.jibie
|
|
|
|
+ http.post("/system/AppXunjianController/deleteXunjianItem", obj, that.deleteItemSuccess)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ deleteItemSuccess(res) {
|
|
|
|
+ let that = this
|
|
|
|
+ if(res.code ==200){
|
|
|
|
+ this.data.xunjianItems[res.data.jibie][1].forEach(function (it,idx) {
|
|
|
|
+ console.log(it.listid,"======",res.data.busItemsId)
|
|
|
|
+ if(it.listid == res.data.busItemsId){
|
|
|
|
+ that.data.xunjianItems[res.data.jibie][1].splice(idx,1)
|
|
|
|
+ that.setData({
|
|
|
|
+ xunjianItems : that.data.xunjianItems
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ bindViewXunJian(){
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: '../xunjian/xunjian?busEnterpriseId='+this.data.busEnterpriseId,
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
|
|
change_color_3(e) {
|
|
change_color_3(e) {
|
|
|
|
|
|
@@ -262,25 +338,26 @@ Page({
|
|
},
|
|
},
|
|
|
|
|
|
checkboxChange(e) {
|
|
checkboxChange(e) {
|
|
- let index = this.data.eIndex
|
|
|
|
- let index2 = this.data.eIndex2
|
|
|
|
- console.log('checkbox发生change事件,携带value值为:', e.detail.value)
|
|
|
|
- const items = this.data.listdatachoose[index].children[index2].children
|
|
|
|
- console.log(items)
|
|
|
|
- const values = e.detail.value
|
|
|
|
- for (let i = 0, lenI = items.length; i < lenI; ++i) {
|
|
|
|
- items[i].choose = false
|
|
|
|
- for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
|
|
|
|
- if (items[i].value === values[j]) {
|
|
|
|
- items[i].choose = true
|
|
|
|
- break
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- console.log(items[i].choose, 'sladjfklsadjflkasdjflkdjslk')
|
|
|
|
- }
|
|
|
|
- this.setData({
|
|
|
|
- items
|
|
|
|
- })
|
|
|
|
|
|
+ console.log(e)
|
|
|
|
+ // let index = this.data.eIndex
|
|
|
|
+ // let index2 = this.data.eIndex2
|
|
|
|
+ // console.log('checkbox发生change事件,携带value值为:', e.detail.value)
|
|
|
|
+ // const items = this.data.listdatachoose[index].children[index2].children
|
|
|
|
+ // console.log(items)
|
|
|
|
+ // const values = e.detail.value
|
|
|
|
+ // for (let i = 0, lenI = items.length; i < lenI; ++i) {
|
|
|
|
+ // items[i].choose = false
|
|
|
|
+ // for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
|
|
|
|
+ // if (items[i].value === values[j]) {
|
|
|
|
+ // items[i].choose = true
|
|
|
|
+ // break
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // console.log(items[i].choose, 'sladjfklsadjflkasdjflkdjslk')
|
|
|
|
+ // }
|
|
|
|
+ // this.setData({
|
|
|
|
+ // items
|
|
|
|
+ // })
|
|
},
|
|
},
|
|
//收起弹层
|
|
//收起弹层
|
|
updown() {
|
|
updown() {
|