当前位置:网站首页>改善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来传递。
边栏推荐
- TCP three handshakes you need to know
- Promotion hung up! The leader said it wasn't my poor skills
- Compilation et connexion de shader dans games202 - webgl (comprendre la direction)
- Why does MySQL need two-phase commit
- pix2pix:使用条件对抗网络的图像到图像转换
- flutter 实现一个有加载动画的按钮(loadingButton)
- Collection + interview questions
- 04. 项目博客之日志
- Summary of redis AOF and RDB knowledge points
- Solution of QT TCP packet sticking
猜你喜欢
Class inheritance in yyds dry inventory C
Vite configures the development environment and production environment
Ora-01779: the column corresponding to the non key value saving table cannot be modified
Postman pre script - global variables and environment variables
[classic example] binary tree recursive structure classic topic collection @ binary tree
Modbus协议通信异常
[untitled]
Ad20 is set with through-hole direct connection copper sheet, and the bonding pad is cross connected
Three methods of Oracle two table Association update
Vulhub vulnerability recurrence 71_ Unomi
随机推荐
A little knowledge of CPU, disk and memory
SQLite add index
2022 half year summary
Please wait while Jenkins is getting ready to work
Knowledge points of circular structure
Cve-2019-11043 (PHP Remote Code Execution Vulnerability)
2021robocom robot developer competition (Preliminary)
图数据库ONgDB Release v-1.0.3
Oracle deletes duplicate data, leaving only one
Questions d'examen écrit classiques du pointeur
UCF(2022暑期团队赛一)
關於Unity Inspector上的一些常用技巧,一般用於編輯器擴展或者其他
pix2pix:使用条件对抗网络的图像到图像转换
Summary of three log knowledge points of MySQL
Mysql高级篇学习总结9:创建索引、删除索引、降序索引、隐藏索引
Unity gets the width and height of Sprite
Postman pre script - global variables and environment variables
[noip2009 popularization group] score line delimitation
02. Develop data storage of blog project
Vulhub vulnerability recurrence 69_ Tiki Wiki