Commit 4318430a by huangqy

步进器的逻辑更改

parent 9b85400f
......@@ -502,8 +502,7 @@ export struct WzInfo {
* @return {*}
* @author: 王弘钢
*/
async handleNumberBoxChangeValue(row) {
console.log('event,element,count', JSON.stringify(this))
async handleNumberBoxChangeValue(row, that) {
try {
const updateParams = {
mxguid: row.mxguid,
......@@ -530,7 +529,8 @@ export struct WzInfo {
}
await wzcrkmxModel.updateWzmx(updateParams)
// createOrFindSQL("GY_M_PMV3", updateWzmx(updateParams))
this.pageInit(row, 'update')
console.log('event,element,count', 'asdhasudaugduay')
that.pageInit(row, 'update')
} catch (e) {
console.log("更新数字报错了!!!!!!" + e.stack)
//TODO handle the exception
......@@ -1257,7 +1257,7 @@ export struct WzInfo {
List() {
ForEach(this.historicalInformation, (item) => {
ListItem() {
WzList({ wzmx: item, handleNumberBoxChangeValue: this.handleNumberBoxChangeValue })
WzList({ wzmx: item, handleNumberBoxChangeValue: this.handleNumberBoxChangeValue, that: this })
}
})
}
......
......@@ -3,7 +3,9 @@ import { historicalInformationClass, WzmxClass } from './Wzcrk.data'
@Component
export struct WzList {
@ObjectLink wzmx: historicalInformationClass
handleNumberBoxChangeValue: (wzmx: historicalInformationClass) => void
@State that: any = null
handleNumberBoxChangeValue: (wzmx: historicalInformationClass, that) => void
controller: TextInputController = new TextInputController()
build() {
Column() {
......@@ -28,19 +30,26 @@ export struct WzList {
Row() {
Counter() {
Text(this.wzmx.crksl + '')
TextInput({ text: this.wzmx.crksl + '', controller: this.controller})
.onChange((value) => {
this.wzmx.crksl = Number(value)
})
.onSubmit(() => {
this.handleNumberBoxChangeValue(this.wzmx, this.that)
})
.borderRadius(0).backgroundColor('#fff').fontSize(15).textAlign(TextAlign.Center)
}
.width(120)
.width(130)
.onInc(() => {
this.wzmx.crksl = this.wzmx.crksl + 1
this.handleNumberBoxChangeValue(this.wzmx)
this.handleNumberBoxChangeValue(this.wzmx, this.that)
})
.onDec(() => {
if( this.wzmx.crksl == 0) {
return
}
this.wzmx.crksl = this.wzmx.crksl - 1
this.handleNumberBoxChangeValue(this.wzmx)
this.handleNumberBoxChangeValue(this.wzmx, this.that)
})
}.alignSelf(ItemAlign.End)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论