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="table-title" style="margin-top:10px;">
<div class="button-box flexend"> <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> </button>
<div class="remove-btn reverse-btn flexrow flexfillcenter gap06">
취소
</div>
</div> </div>
</div> </div>

View File

@ -19,13 +19,9 @@
<div class="table-title" style="margin-top:10px;"> <div class="table-title" style="margin-top:10px;">
<div class="button-box flexend"> <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> </button>
<div class="remove-btn reverse-btn flexrow flexfillcenter gap06">
취소
</div>
</div> </div>
</div> </div>

View File

@ -64,6 +64,30 @@ if( !_notAuth("R") ){/************ 권한체크*/
} }
break; 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": case "putRunInfo":
if (_notAuth("W")){ break; } if (_notAuth("W")){ break; }

View File

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