You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
1.8 KiB
JavaScript
80 lines
1.8 KiB
JavaScript
class SggDeptControl {
|
|
constructor() {
|
|
this.sggs = new DatasetControl({
|
|
prefix:"sgg",
|
|
prefixName:"시군구",
|
|
keymapper:info => info.SGG_CD,
|
|
dataGetter:obj => obj.sggList,
|
|
urls: {
|
|
load: wctx.url("/user/sgg/list.do"),
|
|
getInfo: wctx.url("/user/sgg/info.do"),
|
|
create: wctx.url("/user/sgg/create.do"),
|
|
update: wctx.url("/user/sgg/update.do"),
|
|
remove: wctx.url("/user/sgg/remove.do"),
|
|
},
|
|
formats: {
|
|
REG_DT:datetimeFormat
|
|
}
|
|
});
|
|
|
|
this.depts = new DatasetControl({
|
|
prefix:"dept",
|
|
prefixName:"부서",
|
|
keymapper:info => info.DEPT_CD,
|
|
dataGetter:obj => obj.deptList,
|
|
urls: {
|
|
load: wctx.url("/user/dept/list.do"),
|
|
getInfo: wctx.url("/user/dept/info.do"),
|
|
create: wctx.url("/user/dept/create.do"),
|
|
update: wctx.url("/user/dept/update.do"),
|
|
remove: wctx.url("/user/dept/remove.do"),
|
|
},
|
|
formats: {
|
|
REG_DT:datetimeFormat
|
|
}
|
|
});
|
|
}
|
|
|
|
newSgg() {
|
|
this.sggs.newInfo({USE_YN: "Y"});
|
|
}
|
|
|
|
newDept() {
|
|
let sgg = this.sggs.getCurrent() || {};
|
|
|
|
this.depts.newInfo({SGG_CD: sgg.SGG_CD, INST_CD: sgg.INST_CD, USE_YN: "Y"});
|
|
}
|
|
|
|
getDepts(params) {
|
|
params = params || {};
|
|
|
|
if (!params.sggID && !params.instCode) {
|
|
let obj = this.sggs.getCurrent();
|
|
params.sggID = params.sggID || (obj ? obj.SGG_CD : null);
|
|
params.instCode = params.instCode || (obj ? obj.INST_CD : null);
|
|
}
|
|
|
|
if (!params.sggID && !params.instCode)
|
|
return this.depts.setData(null);
|
|
|
|
this.depts.query = params;
|
|
this.depts.load()
|
|
}
|
|
|
|
async selectDepts() {
|
|
return new Promise((resolve, reject) => {
|
|
ajax.get({
|
|
url: wctx.url("/user/dept/select.do"),
|
|
success: resp => {
|
|
dialog.alert({
|
|
title:"시군구 부서 선택",
|
|
content:resp,
|
|
size: "xl",
|
|
getData:() => getSelectedDept(),
|
|
onOK:(selected) => resolve(selected)
|
|
});
|
|
}
|
|
});
|
|
});
|
|
}
|
|
} |