tk2312-web/src/so/so/pub/pubrule/editUtil.js

38 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 主组织主动触发编辑后事件
* @param {*} props
* @param {*} areacode 区域编码
* @param {*} key 触发字段默认为pk_org
* @param {*} value 触发的value {value:,display:}
* @param {*} afterEvent 自己的编辑后事件
*/
function mainOrgEdit(props, areacode, key = 'pk_org', value, afterEvent) {
editForm(props, areacode, key, value, afterEvent);
}
/**
* 编辑form表单
* @param {*} props
* @param {*} areacode
* @param {*} key
* @param {*} value
* @param {*} afterEvent
*/
function editForm(props, areacode, key, value, afterEvent) {
edit(props, 'form', areacode, key, value, null, null, afterEvent);
}
function edit(props, type, areacode, key, value, changedrows, index, afterEvent) {
props.handleRelationItems({
type: type, //编辑的是表单值为'form', 编辑的是表格值为'table'
areaCode: areacode, //编辑区域的编码
key: key, //编辑字段英文名称
value: value, //编辑字段的新值
changedrows: changedrows, // 若编辑的是表格,需要传该参数(编辑字段的旧值),表单不传
index: index, //当前是第几行 从 0 开始,编辑表格时,需要传该参数,表单不传
callback: afterEvent //请求成功的回调(业务组自己的编辑后事件)
});
}
export { mainOrgEdit, editForm };