当前位置:网站首页>改善Jpopup以实现动态控制disable
改善Jpopup以实现动态控制disable
2022-07-06 05:18:00 【OK_boom】
Jeecg的Jpopup的disabled属性写死了要boolean类型,所以打它的主意是不行的,所以需要增加一个function类型的参数又实时确定状态
修改Jpopup.vue
- 增加props
在props增加三个属性:
getDisabled:{
type: Function
},
row:{
type: Object
},
column:{
type:Object
}
- 增加computed
/** * 增加computeDisabled,优先考虑getDisabled参数 * @returns {*} */
computeDisabled(){
return typeof this.getDisabled=='function'? this.getDisabled(this.row,this.column,this):this.disabled
}
- 调用
将原disabled='disabled’改为disabled=“computeDisabled”
<a-input @click="openModal" :placeholder="placeholder" v-model="showText" readOnly :disabled="computeDisabled">
修改JVxePopupCell.vue
修改popupProps,加上row,column的传递
popupProps() {
const {innerValue, originColumn: col, caseId, cellProps,row} = this
return {
...cellProps,
value: innerValue,
field: col.field || col.key,
code: col.popupCode,
orgFields: col.orgFields,
destFields: col.destFields,
groupId: caseId,
param: col.param,
sorter: col.sorter,
row: row,
column:col
}
}
应用
在jvxetable的具popup类型的column的定义可以这样应用:
{
title: '物料SQ',
key: 'prodSeq',
type: JVXETypes.popup,
fixed: 'left',
popupCode:"getProds",
field:"prod_seq",
orgFields:"id,prod_name,prod_seq,spec,fukuang,mazhong,unit",
destFields:"prodId,prodName,prodSeq,productInfo.spec,productInfo.fukuang,productInfo.mazhong,productInfo.unit",
width:"150px",
placeholder: '请输入${title}',
defaultValue:'',
param: {
prod_cat:'B04A01'},
props:{
formType:this.type,
getDisabled: (row,column,ref)=>{
return !(!!row['clone']||ref.$attrs.formType=='edit')}
},
validateRules: [{
required: true, message: '${title}不能为空' }],
}
因为column的props发展会悉数传给Jpopup,所以在这里加入getDisabled与之对接,getDisabled具3个参数。又因为getDisabled里面还要根据当前vue对象的type作为条件判断,所以亦是利用props新开formType来传递。
边栏推荐
- Sliding window problem review
- Pix2pix: image to image conversion using conditional countermeasure networks
- Nacos - TC Construction of High available seata (02)
- UCF(暑期团队赛二)
- Questions d'examen écrit classiques du pointeur
- 从0到1建设智能灰度数据体系:以vivo游戏中心为例
- [leetcode daily question] number of enclaves
- RT thread analysis log system RT_ Kprintf analysis
- Class inheritance in yyds dry inventory C
- F12 solve the problem that web pages cannot be copied
猜你喜欢
Postman Association
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Application of Flody
02. 开发博客项目之数据存储
从0到1建设智能灰度数据体系:以vivo游戏中心为例
04. Project blog log
Acwing week 58
idea一键导包
Postman pre script - global variables and environment variables
Postman assertion
随机推荐
Postman Association
Can the feelings of Xi'an version of "Coca Cola" and Bingfeng beverage rush for IPO continue?
【LeetCode】18、四数之和
[mask requirements of OSPF and Isis in multi access network]
Tetris
集合详解之 Collection + 面试题
nacos-高可用seata之TC搭建(02)
flutter 实现一个有加载动画的按钮(loadingButton)
用StopWatch 统计代码耗时
Questions d'examen écrit classiques du pointeur
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Quelques conseils communs sur l'inspecteur de l'unit é, généralement pour les extensions d'éditeur ou d'autres
Oracle query table index, unique constraint, field
02. Develop data storage of blog project
Raspberry pie 3.5-inch white screen display connection
[noip2009 popularization group] score line delimitation
Nestjs配置文件上传, 配置中间件以及管道的使用
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
组播和广播的知识点梳理
Modbus protocol communication exception