diff --git a/pages/dickey/treeselect.js b/pages/dickey/treeselect.js index 5002477..1066ccf 100644 --- a/pages/dickey/treeselect.js +++ b/pages/dickey/treeselect.js @@ -1,91 +1,50 @@ Page({ data: { value: [], + action:'' }, selThis(e) { //console.log(e.detail); var pages = getCurrentPages(); var prevPage = pages[pages.length - 2]; - prevPage.setData({ - sdbm__partname: e.detail.name, - sdbm: e.detail.id, - pxbm: e.detail.id, - pxbm__partname: e.detail.name, - zgbm__partname: e.detail.name, - zgbm: e.detail.id, - newbm__partname: e.detail.name, - newbm: e.detail.id, + if (this.data.action=='yhlxo'){ + prevPage.setData({ + yhlxo__name: e.detail.name, + yhlxo: e.detail.id, + }) + } + else if (this.data.action=='yhlb'){ + prevPage.setData({ + yhlb__name: e.detail.name, + yhlb: e.detail.id, + }) + } + + wx.navigateBack({ + delta: 0, }) - if(prevPage.route.indexOf('operation')!=-1){ - prevPage.getspr12array() - } - wx.request({ - url: getApp().globalData.serverUrl + 'getuser?a=combobox&partid='+e.detail.id, - header: { - 'content-type': 'application/json', // 默认值 - 'Cookie': getApp().globalData.sessionId, - }, - data: {}, - success: res => { - if (res.statusCode === 200) { - prevPage.setData({ - zgrArray: res.data, - newrArray: res.data, - skrArray:res.data, - }) - wx.navigateBack() - } - } - }); - }, - convert(rows) { - function exists(rows, parentId) { - for (var i = 0; i < rows.length; i++) { - if (rows[i].id == parentId) return true; - } - return false; - } - - var nodes = []; - // get the top level nodes - for (var i = 0; i < rows.length; i++) { - var row = rows[i]; - if (!exists(rows, row.parentId)) { - nodes.push({ - id: row.id, - name: row.name - }); - } - } - - var toDo = []; - for (var i = 0; i < nodes.length; i++) { - toDo.push(nodes[i]); - } - while (toDo.length) { - var node = toDo.shift(); // the parent node - // get the children nodes - for (var i = 0; i < rows.length; i++) { - var row = rows[i]; - if (row.parentId == node.id) { - var child = { id: row.id, name: row.name }; - if (node.children) { - node.children.push(child); - } else { - node.children = [child]; - } - toDo.push(child); - } - } - } - return nodes; }, onLoad:function(option) { let strurl - if(option.a=='yhlx'){ - strurl = getApp().globalData.serverUrl + 'parthandle?a='+strurl + if(option.a=='yhlxo'){ + this.data.action = 'yhlxo'; + strurl = getApp().globalData.serverUrl + 'getdickey?dicclass=56&a=combobox' this.setData({ - text:'隐患类型' + text:'隐患因素(依据GB13861-2009)' + }) + } + else if(option.a=='yhlb1'){ + this.data.action = 'yhlb'; + strurl = getApp().globalData.serverUrl + 'getdickey?dicclass=16&a=combobox' + this.setData({ + text:'隐患类别(依据隐患排查通用上报标准)' + }) + } + else if(option.a=='yhlb2'){ + this.data.action = 'yhlb'; + strurl = getApp().globalData.serverUrl + 'getdickey?dicclass=17&a=combobox' + this.setData({ + text:'隐患类别(依据隐患排查通用上报标准)' }) } wx.request({ @@ -97,9 +56,9 @@ Page({ data: {}, success: res => { if (res.statusCode === 200) { - var rows = res.data + this.setData({ - value: this.convert(rows) + value: res.data }) } } diff --git a/pages/dickey/treeselect.wxml b/pages/dickey/treeselect.wxml index 36eb00b..4a5e395 100644 --- a/pages/dickey/treeselect.wxml +++ b/pages/dickey/treeselect.wxml @@ -1,7 +1,7 @@ - 公司组织机构 + {{text}} diff --git a/pages/trouble/accesstrouble.js b/pages/trouble/accesstrouble.js index 601eb6e..8bb0d3f 100644 --- a/pages/trouble/accesstrouble.js +++ b/pages/trouble/accesstrouble.js @@ -16,6 +16,7 @@ Page({ yhdd: '', yhms: '', yhpg: '', + yhlxo: '', yhlx: '', yhlb: '', yyfx: '', @@ -28,7 +29,8 @@ Page({ zghtp: [], zppg: 'no', newr:'', - action:'正常处理' + action:'正常处理', + surl:'' }, yhlbArray:{}, bindfcyjInput: function (e) { @@ -59,11 +61,11 @@ Page({ }) if(this.data.yhlx==16){ this.setData({ - yhlbArray: this.yhlbArray.data1, + surl:'/pages/dickey/treeselect?a=yhlb1' }) }else{ this.setData({ - yhlbArray: this.yhlbArray.data2, + surl:'/pages/dickey/treeselect?a=yhlb2' }) } }, @@ -143,7 +145,7 @@ Page({ } } }); - //获取隐患类型 + //获取隐患大类 wx.request({ url: this.data.serverUrl + 'getdicclass?dicid=15', header: { @@ -226,7 +228,7 @@ Page({ if (that.data.yhpg == '') { that.Tap1('请选择隐患评估!') } else if (that.data.yhlx == '') { - that.Tap1('请输入隐患类型!') + that.Tap1('请输入隐患大类!') } else if (that.data.yhlb == '') { that.Tap1('请输入隐患类别!') } else if (that.data.zgbm == '') { diff --git a/pages/trouble/accesstrouble.wxml b/pages/trouble/accesstrouble.wxml index 6637c81..6461d62 100644 --- a/pages/trouble/accesstrouble.wxml +++ b/pages/trouble/accesstrouble.wxml @@ -147,7 +147,20 @@ - 隐患类型 + 隐患因素 + + + + + + {{yhlxo__name}} + + + + + + + 隐患大类 @@ -160,9 +173,11 @@ 隐患类别 - - {{yhlbArray[yhlbIndex].text}} - + + + {{yhlb__name}} + + @@ -177,7 +192,15 @@ - 隐患类型 + 隐患因素 + + + {{yhlxo__dickeyname}} + + + + + 隐患大类 {{yhlx__dicname}} @@ -409,7 +432,7 @@ - + \ No newline at end of file diff --git a/pages/trouble/addtrouble.wxml b/pages/trouble/addtrouble.wxml index fd4b3fb..528be7b 100644 --- a/pages/trouble/addtrouble.wxml +++ b/pages/trouble/addtrouble.wxml @@ -80,19 +80,6 @@ - - - 隐患类型 - - - - - - {{yhlx__name}} - - - - 隐患描述 diff --git a/pages/trouble/addtroublezg.js b/pages/trouble/addtroublezg.js index cd5f248..cfc0b1d 100644 --- a/pages/trouble/addtroublezg.js +++ b/pages/trouble/addtroublezg.js @@ -78,7 +78,7 @@ Page({ if (that.data.yhpg == '') { that.Tap1('请选择隐患评估!') } else if (that.data.yhlx == '') { - that.Tap1('请输入隐患类型!') + that.Tap1('请输入隐患大类!') } else if (that.data.yhlb == '') { that.Tap1('请输入隐患类别!') } else if (that.data.zgms == '') { @@ -307,7 +307,7 @@ Page({ } } }); - //获取隐患类型 + //获取隐患大类 wx.request({ url: this.data.serverUrl + 'getdicclass?dicid=15', header: { diff --git a/pages/trouble/addtroublezg.wxml b/pages/trouble/addtroublezg.wxml index 3c025dc..179362b 100644 --- a/pages/trouble/addtroublezg.wxml +++ b/pages/trouble/addtroublezg.wxml @@ -17,7 +17,20 @@ - 隐患类型 + 隐患因素 + + + + + + {{yhlxo__name}} + + + + + + + 隐患大类 diff --git a/pages/trouble/addtroublezp.js b/pages/trouble/addtroublezp.js index db0b7d1..9cb7a7c 100644 --- a/pages/trouble/addtroublezp.js +++ b/pages/trouble/addtroublezp.js @@ -21,6 +21,8 @@ Page({ yhlbIndex: null, zgrArray: [], zgrIndex: null, + surl:'', + yhlxo:"" }, yhdic:{ }, @@ -33,14 +35,20 @@ Page({ }) this.data.yhlx = this.data.yhlxArray[e.detail.value].value if (this.data.yhlx==16){ - this.data.yhlbArray = this.yhdic.yhlb1; + // this.data.yhlbArray = this.yhdic.yhlb1; + // this.setData({ + // yhlbArray: this.yhdic.yhlb1, + // }) this.setData({ - yhlbArray: this.yhdic.yhlb1, + surl:'/pages/dickey/treeselect?a=yhlb1' }) }else{ - this.data.yhlbArray = this.yhdic.yhlb2; + // this.data.yhlbArray = this.yhdic.yhlb2; + // this.setData({ + // yhlbArray: this.yhdic.yhlb2, + // }) this.setData({ - yhlbArray: this.yhdic.yhlb2, + surl:'/pages/dickey/treeselect?a=yhlb2' }) } }, @@ -74,7 +82,7 @@ Page({ if (that.data.yhpg == '') { that.Tap1('请选择隐患评估!') } else if (that.data.yhlx == '') { - that.Tap1('请输入隐患类型!') + that.Tap1('请输入隐患大类!') } else if (that.data.yhlb == '') { that.Tap1('请输入隐患类别!') } else if (that.data.zgbm == '') { @@ -126,6 +134,7 @@ Page({ 'yhms': this.data.yhms, 'yhtp': this.data.yhtp, 'yhpg': this.data.yhpg, + 'yhlxo': this.data.yhlxo, 'yhlx': this.data.yhlx, 'yhlb': this.data.yhlb, 'zgbm': this.data.zgbm, @@ -262,7 +271,7 @@ Page({ } } }); - //获取隐患类型 + //获取隐患大类 wx.request({ url: this.data.serverUrl + 'getdicclass?dicid=15', header: { diff --git a/pages/trouble/addtroublezp.wxml b/pages/trouble/addtroublezp.wxml index 8eacb91..73bc8bb 100644 --- a/pages/trouble/addtroublezp.wxml +++ b/pages/trouble/addtroublezp.wxml @@ -19,7 +19,20 @@ - 隐患类型 + 隐患因素 + + + + + + {{yhlxo__name}} + + + + + + + 隐患大类 @@ -32,9 +45,11 @@ 隐患类别 - - {{yhlbArray[yhlbIndex].text}} - + + + {{yhlb__name}} + + @@ -97,7 +112,7 @@ - + \ No newline at end of file diff --git a/pages/trouble/troubledetail.wxml b/pages/trouble/troubledetail.wxml index 9069e44..9681a51 100644 --- a/pages/trouble/troubledetail.wxml +++ b/pages/trouble/troubledetail.wxml @@ -22,9 +22,17 @@ {{yhdj__dickeyname}} + + + 隐患因素 + + + {{yhlxo__dickeyname}} + + - 隐患类型 + 隐患大类 {{yhlx__dicname}}