1
0
Fork 0

feat: 가동 비가동 기능

`
1. 가동 시 무조건 비가동만 설정 가능
2. 비가동 시에는 가동만 가능
`
This commit is contained in:
sychoi 2024-05-02 18:04:28 +09:00
parent 94adb04cf7
commit c97143c1a0
4 changed files with 144 additions and 67 deletions

View File

@ -32,13 +32,9 @@
<div class="table-title" style="margin-top:10px;">
<div class="button-box flexend">
<div class="add-btn reverse-btn flexrow flexfillcenter gap06">
확인
</div>
<div class="remove-btn reverse-btn flexrow flexfillcenter gap06">
취소
</div>
<button type="button" class="add-btn reverse-btn flexrow flexfillcenter gap06">
확인
</button>
</div>
</div>

View File

@ -19,13 +19,9 @@
<div class="table-title" style="margin-top:10px;">
<div class="button-box flexend">
<div class="add-btn reverse-btn flexrow flexfillcenter gap06">
<button type="button" class="add-btn reverse-btn flexrow flexfillcenter gap06">
확인
</div>
<div class="remove-btn reverse-btn flexrow flexfillcenter gap06">
취소
</div>
</button>
</div>
</div>

View File

@ -64,6 +64,30 @@ if( !_notAuth("R") ){/************ 권한체크*/
}
break;
case "checkRunStatus":
$sql = "USP_P_REG_PROD_RUN_S20";
$params = array(
'WO_NO' => $_REQUEST["WO_NO"] ?: "",
'WO_SEQ' => $_REQUEST["WO_SEQ"] ?: "",
'EMP_NO' => $_REQUEST["EMP_NO"] ?: "",
);
$rst = $baseObj->DB->exec($sql, $params);
$rows = array();
if( $rst ){
$retval['code'] = true;
while( $row = $baseObj->DB->fetch_array($rst) ){
$rows[] = $row;
}
$retval['data'] = $rows;
$retval['mesg'] = "정상적으로 작동하였습니다.";
}else{
$retval['code'] = false;
}
break;
case "putRunInfo":
if (_notAuth("W")){ break; }

View File

@ -1,10 +1,5 @@
class SimpleTable {
constructor(fields, getmode, putmode, formData){
constructor(fields, getmode, putmode, formData, addData, updateData){
// ajax
this.ajaxUrl = './reg_prod_result.ajax.php';
this.getMode = getmode?getmode:'';
@ -21,8 +16,27 @@ class SimpleTable {
// addCode
this.addCode = ''
// listener init
this.init(addData, updateData); // 리스너 초기화
}
// initEventListener() {
// this.callPutData = (addData, updateData, btn) => {
// this.putData(addData, updateData);
// if (btn === 'isRun') {
// document.querySelector("#isNoRun").disabled = false;
// document.querySelector("#isRun").disabled = true;
// this.addBtn.disabled = true;
// } else if (btn === 'isNoRun') {
// document.querySelector("#isNoRun").disabled = true;
// document.querySelector("#isRun").disabled = false;
// this.addBtn.disabled = true;
// }
// };
// }
getMainList(){
return ajax_json({
url: this.ajaxUrl,
@ -46,21 +60,11 @@ class SimpleTable {
},
})
}
// addRow(data){
// this.tbList.addRow({...data})
// }
putData(addData, updateData){
putData(){
const postData = {
mode : this.putMode
}
// if(addData){
// postData['reqdata'] = JSON.stringify([{ ...this.formData, ...addData}]);
// }else if(updateData){
// postData['reqdata'] = JSON.stringify([{ FACLT_OPER_NO : this.addCode, ...updateData}]);
// }
const tableData = this.tbList.getData().filter(row=>row._STATUS_)[0];
postData['reqdata'] = JSON.stringify([{...tableData, ...this.formData, FACLT_OPER_NO : this.addCode}])
@ -86,16 +90,19 @@ class SimpleTable {
})
}
};
updateData(updateData){
update(updateData){
if(updateData){
this.tbList.getRowFromPosition(this.tbList.getData().length).update({ FACLT_OPER_NO: this.addCode, ...updateData });
console.log(updateData)
};
}
};
init(addData, updateData, btn){
init(addData, updateData){
if (this.tbList) {
this.tbList.destroy();
}
const commonFieldData = {
headerSort: false,
@ -112,7 +119,7 @@ class SimpleTable {
columns: this.field,
columnDefaults: commonFieldData,
selectableRows:1,
})
});
this.tbList.on("tableBuilt", () => {
this.getMainList().then(()=>{
@ -125,20 +132,33 @@ class SimpleTable {
};
})
})
};
this.addBtn?.addEventListener('click', ()=>{
this.putData(addData,updateData);
if(btn=='isRun'){
event(addData, updateData, btn){
if(this.eventHandler){
this.addBtn?.removeEventListener('click', this.eventHandler);
};
this.eventHandler = () => {
this.putData(addData, updateData);
if (btn === 'isRun') {
document.querySelector("#isNoRun").disabled = false;
document.querySelector("#isRun").disabled = true;
}else if(btn=='isNoRun'){
this.addBtn.disabled = true;
} else if (btn === 'isNoRun') {
document.querySelector("#isNoRun").disabled = true;
document.querySelector("#isRun").disabled = false;
this.addBtn.disabled = true;
}
})
};
this.addBtn?.addEventListener('click', this.eventHandler);
}
}
};
class FieldPop {
@ -149,12 +169,40 @@ class FieldPop {
init() {
vnLoad('', './reg_prod_result.php','', (loadHtml) => {
this.modal = kuls_modal(loadHtml);
ajax_json({
url: './reg_prod_result.ajax.php',
data: {
mode: 'checkRunStatus',
...this.bindingData
},
success:( data ) => {
if( data.code ){
console.log(data)
if(data.data.length>0){
const disabledList = [false, false, true, false];
this.vueform(this.bindingData, this.modal, disabledList);
}else{
const disabledList = [false, false, false, true];
this.vueform(this.bindingData, this.modal, disabledList);
}
this.vueform(this.bindingData, this.modal)
});
}else{
console.log(data)
}
},
error: (request, status, error)=>{
kuls_alert(error.message);
},
})
})
}
vueform(bindingData, modal){
// checkRunStatus(){
// return
// }
vueform(bindingData, modal, disabledList){
return createApp({
data() {
return {
@ -166,6 +214,8 @@ class FieldPop {
table : {},
checkEvent : '',
callBack : function(){},
isComponent : {
@ -205,7 +255,7 @@ class FieldPop {
activeTab : '',
isDisabled : [false, false, false, true],
isDisabled : disabledList,
dateTime : '00:00',
@ -343,11 +393,16 @@ class FieldPop {
},
callTable(com, addData=false, updateData=false, btn=false ){
console.log("callTable")
this.$nextTick(()=>{
this.table = new SimpleTable(this.tableField[com], this.getMode, this.putMode, this.formData);
return this.$nextTick(()=>{
const table = new SimpleTable(this.tableField[com], this.getMode, this.putMode, this.formData, addData, updateData);
this.table.init(addData, updateData, btn);
if(this.checkEvent !== com){
table.event(addData, updateData, btn);
this.checkEvent = com;
}
return table;
})
},
@ -355,6 +410,7 @@ class FieldPop {
// 클릭시 컴포넌트 생성 및 삭제로 페이지 레이아웃 변경
showComponent(com, tab) {
this.activeTab = tab;
let table = '';
Object.keys(this.isComponent).map((key)=>{
this.isComponent[key] = com == key ? true : false;
@ -383,19 +439,22 @@ class FieldPop {
this.getMode = 'getRunInfo';
this.putMode = 'putRunInfo';
this.callTable(com,{
table = this.callTable(com,{
WO_NO: this.formData.WO_NO,
RUNSTOP_GB: 'R',
OPER_ST_TM : this.dateTime,
},false,'isRun');
},false,'isRun').then(table=>{
const tb = table;
this.callBack = ()=>{
tb.update({
WO_NO: this.formData.WO_NO,
RUNSTOP_GB: 'R',
OPER_ST_TM : this.dateTime,
})
}
})
this.callBack = ()=>{
this.table.updateData({
WO_NO: this.formData.WO_NO,
RUNSTOP_GB: 'R',
OPER_ST_TM : this.dateTime,
})
}
break;
@ -413,15 +472,17 @@ class FieldPop {
STOP_CD: this.STOP_CD_val,
RUNSTOP_GB: 'S',
OPER_ED_TM : this.dateTime,
}, 'isNoRun');
}, 'isNoRun').then(table=>{
this.callBack = ()=>{
const tb = table;
tb.update({
STOP_CD: this.STOP_CD_val,
RUNSTOP_GB: 'S',
OPER_ED_TM : this.dateTime,
})
};
})
this.callBack = ()=>{
this.table.updateData({
STOP_CD: this.STOP_CD_val,
RUNSTOP_GB: 'S',
OPER_ED_TM : this.dateTime,
})
};
break;
case 'isDefHst':