20260205 업데이트(컨텐츠 페이지 연결)

This commit is contained in:
2026-02-05 10:06:09 +09:00
parent 5d52f6d37a
commit 6dcc2eb796
208 changed files with 8143 additions and 1524 deletions

View File

@@ -1,6 +1,9 @@
import { w2grid, w2ui, w2popup, w2alert } from 'https://cdn.jsdelivr.net/gh/vitmalina/w2ui@master/dist/w2ui.es6.min.js'
const USE_YN_ITEMS = [
{ id: 'Y', text: '사용' },
{ id: 'N', text: '미사용' }
]
/* -------------------------------------------------
공통 유틸
------------------------------------------------- */
@@ -36,6 +39,8 @@ export function openProductPopup() {
modal: true,
body: `
<div class="product-popup">
<div style="display: flex; justify-content: flex-end; padding: 1S0px; gap: 5px;">
@@ -162,7 +167,7 @@ export function openProductPopup() {
itm_nm : merged.itm_nm,
area : merged.area,
itm_amt: merged.itm_amt,
use_yn : merged.use_yn,
use_yn : merged.use_yn?.id || merged.use_yn,
rmks : merged.rmks
})
}
@@ -224,31 +229,28 @@ export async function createProductGrid(boxId) {
lineNumbers: true // 행 번호를 표시하면 디버깅이 편합니다.
},
columns: [
/*
{ field: 'row_status', text: ' ', size: '30px', attr: 'align=center',
render: function (record) {
// 1. 신규 추가된 행 (recid가 임시값이거나 DB에 없는 경우)
if (record.is_new) return '<span style="color: green;">I</span>';
// 2. 수정된 데이터 (w2ui.changes 객체가 존재하는 경우)
if (record.w2ui && record.w2ui.changes) return '<span style="color: blue;">U</span>';
// 3. 일반 상태
return '<span style="color: gray;"> </span>';
}
},
*/
{ field: 'itm_cd', text: '상품코드', size: '80px',attr: 'align=center',style: 'text-align: center', attr: 'align=center', editable: { type: 'text' } ,sortable: true}, // name 아님!
{ field: 'itm_nm', text: '상품명', size: '120px', attr: 'align=center',style: 'text-align: center', editable: { type: 'text' } ,sortable: true}, // name 아님!
{ field: 'itm_cd', text: '상품코드', size: '80px',style: 'text-align: center', attr: 'align=center', editable: { type: 'text' } ,sortable: true}, // name 아님!
{ field: 'itm_nm', text: '상품명', size: '120px', style: 'text-align: center', editable: { type: 'text' } ,sortable: true}, // name 아님!
{ field: 'area', text: '제공량', size: '100px', attr: 'align=center',render: 'number:0' , editable: { type: 'float' } ,sortable: true}, // volume 아님!
{ field: 'itm_amt', text: '단가', size: '120px', attr: 'align=center',render: 'number:0', editable: { type: 'int' } ,sortable: true}, //
{ field: 'use_yn', text: '사용여부', size: '80px',attr: 'align=center',style: 'text-align: center', attr: 'align=center',
editable: { type: 'list', items: authItems, filter: false ,showAll: true } ,
render(record) {
const item = authItems.find(i => i.id === record.use_yn)
return item ? item.text : record.use_yn
},sortable: true
{
field: 'use_yn',
text: '사용여부',
size: '80px',
attr: 'align=center',
editable: {
type: 'list',
items: USE_YN_ITEMS,
showAll: true,
openOnFocus: true
},
{ field: 'rmks', text: '비고', size: '200px', attr: 'align=center', editable: { type: 'text' } ,sortable: true} // memo 아님!
render(record, extra) {
return extra?.value?.text || ''
},
sortable: true
},
{ field: 'rmks', text: '비고', size: '200px', editable: { type: 'text' } ,sortable: true} // memo 아님!
],
records: [] // 처음엔 비워둠
});
@@ -266,7 +268,9 @@ async function loadProductData() {
w2ui.productGrid.lock('조회 중...', true);
const response = await fetch('/kngil/bbs/adm_product_popup.php'); // PHP 파일 호출
const data = await response.json();
let data = await response.json();
data = normalizeProductUseYn(data)
w2ui.productGrid.clear();
w2ui.productGrid.add(data);
@@ -277,4 +281,14 @@ async function loadProductData() {
w2ui.productGrid.unlock();
w2alert('데이터 로드 실패');
}
}
function normalizeProductUseYn(records) {
return records.map(r => {
const item = USE_YN_ITEMS.find(u => u.id === r.use_yn)
return {
...r,
use_yn: item || null
}
})
}