0
点赞
收藏
分享

微信扫一扫

Angular4_checkbox双向绑定

静鸡鸡的JC 2023-03-06 阅读 30

<
td
><
input
type=
"text" #
box [
ngClass]=
"{'confirmBox': classFlag, 'confirmBoxError': !classFlag}" [(
ngModel)]=
"confirmMaterial"


paste)=
"inputpaste($event)" (
keyup.
enter)=
"checkscan(box.value)"
placeholder=
"Scan Material" (
ngModelChange)=
"scanClass(box.value)"


/></
td
>








<
td
><
input
type=
"checkbox" (
click)=
"setRowEditAble(item)" [(
ngModel)]=
"item.checked"
/></
td
>




inputpaste(e
:
any) {



const
value
=
e.
clipboardData.
getData(
'text/plain');



this.
matchMaterial(
value);




}



matchMaterial(value
:
string) {



if (
this.
handlingUnitMaterials) {



this.
handlingUnitMaterials.
forEach((item
:
any)
=>


if (
item.
material
===
value) {



console.
log(
item);



item.checked
=
true;



this.
setRowEditAble(
item);



// item.disableRemovedQty = false;


// item.disableReason = false;


this.
clearSearch();




}




})




}




}







setRowEditAble(item
:
any) {



if (
item) {



// console.log(item);


item.
disableRemovedQty
=
!
item.
disableRemovedQty;



item.
disableReason
=
!
item.
disableReason;



if (
item.
disableRemovedQty) {



item.
removedQty
=
0;



else


item.
removedQtyInvalid
=
true;




}



if (
item.
disableReason) {



item.
reason
=
'';



item.
removedQtyInvalid
=
false;




}




}




}

举报

相关推荐

0 条评论