|
|
@@ -0,0 +1,50 @@ |
|
|
|
/** |
|
|
|
* Created by 1 at 2022-09-09 17:50:25 |
|
|
|
* 注册事件类【行政区划管理】,参看event.defaultEvent.js |
|
|
|
*/ |
|
|
|
window.$swEvent.setup("bpm.sys.user.area.area", { |
|
|
|
setup(page) { |
|
|
|
const {$params, $refs, $widgets, $model, $utils, $tabRouter, $api} = page || {}; |
|
|
|
const {$$message, $$http} = $utils || {}; |
|
|
|
const custom = {}; |
|
|
|
const typeMap = {2: 105100, 4: 105101, 6: 105102, 9: 105103, 12: 105104}; |
|
|
|
// |
|
|
|
const focusName = () => { |
|
|
|
custom.name = $model.areacard.getFormVal("ar_name"); |
|
|
|
}; |
|
|
|
const changeName = (value) => { |
|
|
|
if ($model.areacard.getFormVal("ar_full_name") === custom.name) |
|
|
|
$model.areacard.setFormVal("ar_full_name", value); |
|
|
|
}; |
|
|
|
|
|
|
|
const focusCode = () => { |
|
|
|
custom.code = $model.areacard.getFormVal("ar_code"); |
|
|
|
}; |
|
|
|
const changeCode = (value) => { |
|
|
|
if ($model.areacard.getFormVal("ar_seq") === custom.code) |
|
|
|
$model.areacard.setFormVal("ar_seq", value); |
|
|
|
//根据编码长度设置区划级别 |
|
|
|
$model.areacard.setFormVal("ar_type", typeMap[value.length]); |
|
|
|
$model.areacard.setFormVal("ar_parent_id", getParentArea(value)); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
const getParentArea = (value) => { |
|
|
|
if (value.length == 12) { |
|
|
|
return value.substring(0, 9); |
|
|
|
} |
|
|
|
if (value.length == 9) { |
|
|
|
return value.substring(0, 6); |
|
|
|
} |
|
|
|
if (value.length == 6) { |
|
|
|
return value.substring(0, 4); |
|
|
|
} |
|
|
|
if (value.length == 4) { |
|
|
|
return value.substring(0, 2); |
|
|
|
} |
|
|
|
} |
|
|
|
return { |
|
|
|
focusName, changeName, focusCode, changeCode |
|
|
|
} |
|
|
|
} |
|
|
|
}); |