From c97143c1a064a7abf12b935dff26346532462c7f Mon Sep 17 00:00:00 2001 From: sychoi Date: Thu, 2 May 2024 18:04:28 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EA=B0=80=EB=8F=99=20=EB=B9=84=EA=B0=80?= =?UTF-8?q?=EB=8F=99=20=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ` 1. 가동 시 무조건 비가동만 설정 가능 2. 비가동 시에는 가동만 가능 ` --- .../sts_order_prod/popComponent/isNoRun.php | 10 +- .../sts_order_prod/popComponent/isRun.php | 8 +- .../sts_order_prod/reg_prod_result.ajax.php | 24 +++ .../site/sts_order_prod/reg_prod_result.js | 169 ++++++++++++------ 4 files changed, 144 insertions(+), 67 deletions(-) diff --git a/home_dir/www/ksvc/site/sts_order_prod/popComponent/isNoRun.php b/home_dir/www/ksvc/site/sts_order_prod/popComponent/isNoRun.php index 7d1dc44..5bee63b 100644 --- a/home_dir/www/ksvc/site/sts_order_prod/popComponent/isNoRun.php +++ b/home_dir/www/ksvc/site/sts_order_prod/popComponent/isNoRun.php @@ -32,13 +32,9 @@
-
- 확인 -
- -
- 취소 -
+
diff --git a/home_dir/www/ksvc/site/sts_order_prod/popComponent/isRun.php b/home_dir/www/ksvc/site/sts_order_prod/popComponent/isRun.php index 0db52a0..bfeb695 100644 --- a/home_dir/www/ksvc/site/sts_order_prod/popComponent/isRun.php +++ b/home_dir/www/ksvc/site/sts_order_prod/popComponent/isRun.php @@ -19,13 +19,9 @@
-
+
- -
- 취소 -
+
diff --git a/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.ajax.php b/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.ajax.php index aa0d2fc..0a504da 100644 --- a/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.ajax.php +++ b/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.ajax.php @@ -63,6 +63,30 @@ if( !_notAuth("R") ){/************ 권한체크*/ $retval['code'] = false; } 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": diff --git a/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.js b/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.js index 3eb1418..2a02be0 100644 --- a/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.js +++ b/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.js @@ -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); - - this.vueform(this.bindingData, this.modal) - }); + 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); + } + + }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':