| | |
| | | res.data.forEach(i => { |
| | | children.push({ |
| | | typecode: i.typecode, |
| | | typename: i.typename |
| | | typename: i.typename, |
| | | isTrue: false |
| | | }) |
| | | }) |
| | | |
| | |
| | | // } |
| | | // }) |
| | | |
| | | console.log(cneterContent, 1) |
| | | console.log(JSON.stringify(topContent), 1) |
| | | |
| | | falseArray.push({ |
| | | id: '1' |
| | |
| | | </script> |
| | | |
| | | </head> |
| | | <!-- <body onload="scaned('SB001')"> --> |
| | | <body> |
| | | <body onload="scaned('SB001')"> |
| | | <!-- <body> --> |
| | | <div id="app"> |
| | | |
| | | <div class="body"> |
| | |
| | | |
| | | |
| | | <div style="padding: 10px;display: flex;flex-direction: column" |
| | | v-for="(item,index) in topContent[0].children"> |
| | | v-for="(item,index) in topContent[topContent.map(i => i.eqp_code).indexOf(radioValue)].children"> |
| | | <!-- v-for="(item,index) in centerContent"> --> |
| | | |
| | | <div style="display: flex;justify-content: space-between;align-items: center;"> |
| | | <div style="margin-left: 10px;">{{item.typename}}</div> |
| | | <div style="margin-right: 10px;"> |
| | | <van-switch size="24" v-model="item.typecode" @change='val=>switchChange(val,item)' |
| | | <van-switch size="24" v-model="item.isTrue" @change='val=>switchChange(val,item)' |
| | | active-color="#ee0a24" inactive-color="#dcdee0" /> |
| | | </div> |
| | | </div> |
| | |
| | | this.$forceUpdate() |
| | | }, |
| | | submit() { |
| | | setTimeout(() => { |
| | | const data = { |
| | | username: localStorage.getItem('username'), |
| | | eqpcode: topContent.find(i => i.code === radioValue).code, |
| | | wkshpcode: topContent.find(i => i.code === radioValue).wksp_code |
| | | const data = { |
| | | username: localStorage.getItem('username'), |
| | | eqpcode: topContent.find(i => i.eqp_code === radioValue).eqp_code, |
| | | // wkshpcode: topContent.find(i => i.code === radioValue).wksp_code |
| | | } |
| | | |
| | | |
| | | const DATA = topContent.find(i => i.eqp_code === radioValue).children.map(r => { |
| | | if (r.isTrue) { |
| | | return { |
| | | code: r.typecode, |
| | | name: r.typename |
| | | } |
| | | } |
| | | const DATA = [] |
| | | }) |
| | | console.log(data, DATA) |
| | | console.log(data, DATA.filter(i=>i!==undefined)) |
| | | |
| | | |
| | | |
| | | submitIsDisabled = true |
| | | // falseArray.push({ |
| | | // id: '1' |
| | | // }) |
| | | this.$forceUpdate() |
| | | post('AppDeviceManage/AppDeviceAnDengCallSave' + formatParams(data), DATA).then( |
| | | res => { |
| | | if (res.code === '200') { |
| | | vant.Notify({ |
| | | type: 'primary', |
| | | message: '提交成功!' |
| | | }) |
| | | topContent.forEach((r, i) => { |
| | | if (r.code === radioValue) { |
| | | topContent.splice(i, 1) |
| | | } |
| | | }) |
| | | if (topContent.length >= 1) { |
| | | radioValue = topContent[0].code |
| | | this.topContentClick(radioValue) |
| | | submitIsDisabled = true |
| | | this.$forceUpdate() |
| | | post('AppDeviceManage/AppDeviceAnDengLampResponseSave' + formatParams(data), DATA.filter(i=>i!==undefined)).then( |
| | | res => { |
| | | if (res.code === '200') { |
| | | vant.Notify({ |
| | | type: 'primary', |
| | | message: '提交成功!' |
| | | }) |
| | | topContent.forEach((r, i) => { |
| | | if (r.eqp_code === radioValue) { |
| | | topContent.splice(i, 1) |
| | | } |
| | | |
| | | submitIsDisabled = false |
| | | this.$forceUpdate() |
| | | }) |
| | | if (topContent.length >= 1) { |
| | | radioValue = topContent[0].eqp_code |
| | | } |
| | | }) |
| | | }, 100) |
| | | |
| | | submitIsDisabled = false |
| | | this.$forceUpdate() |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | topContentClick(code) { |
| | | |
| | | // 明天研究一下 列表选项切换问题 |
| | | |
| | | radioValue = code |
| | | // this.$forceUpdate() |
| | | |
| | | // console.log(JSON.stringify(radioValue), JSON.stringify(topContent)) |
| | | let children = [] |
| | | topContent.find(i => i.eqp_code === radioValue).forEach(i => { |
| | | children.push({ |
| | | typecode: i.typecode, |
| | | typename: i.typename |
| | | }) |
| | | }) |
| | | |
| | | |
| | | topContent.unshift({ |
| | | eqp_code: res.data[0].eqp_code, |
| | | eqp_name: res.data[0].eqp_name, |
| | | org_name: res.data[0].org_name, |
| | | children |
| | | }) |
| | | |
| | | console.log(JSON.stringify(topContent)) |
| | | |
| | | this.$forceUpdate() |
| | | |
| | | |
| | | }, |
| | | |
| | | |