최정우 최정우 2023-04-16
230416 신규장비 커밋
@d19d48a18aa4f724773086154caf9ae9d6807233
client/views/pages/equipment/EquipmentSelect.jsx
--- client/views/pages/equipment/EquipmentSelect.jsx
+++ client/views/pages/equipment/EquipmentSelect.jsx
@@ -423,8 +423,10 @@
 		setStockEquipmentSearch({...stockEquipmentSearch});
 		setDeliveryEquipmentSearch({...deliveryEquipmentSearch});
 
+		newEquipmentSelectList(1);
 		stockEquipmentSelectList(1);
 		deliveryEquipmentSelectList(1);
+		
 	}
 	const equipmentSearchingEnter = (key) => {
 		if (key == 'Enter') {
@@ -432,6 +434,34 @@
 		} else {
 			return;
 		}
+	}
+
+	//재고 장비 검색 정보
+	const [newEquipmentSearch, setNewEquipmentSearch] = React.useState({
+		'currentPage': 1,
+		'perPage': 10,
+	});
+	//신규 장비 목록
+	const [newEquipment, setNewEquipment] = React.useState({equipmentList: [], equipmentListCount: 0});
+	//신규 장비 목록 조회
+	const newEquipmentSelectList = (currentPage) => {
+		newEquipmentSearch.currentPage = CommonUtil.isEmpty(currentPage) ? 1 : currentPage;
+		newEquipmentSearch['government_id'] = 'IS_NULL';
+		newEquipmentSearch['is_new_equipment'] = true;
+		setNewEquipmentSearch({...newEquipmentSearch});
+
+		fetch("/equipment/equipmentSelectList.json", {
+			method: "POST",
+			headers: {
+				'Content-Type': 'application/json; charset=UTF-8'
+			},
+			body: JSON.stringify(newEquipmentSearch)
+		}).then((response) => response.json()).then((data) => {
+			console.log('newEquipmentSelectList response : ', data);
+			setNewEquipment(data);
+		}).catch((error) => {
+			console.log('newEquipmentSelectList error : ', error);
+		});
 	}
 
 	//재고 장비 검색 정보
@@ -445,6 +475,7 @@
 	const stockEquipmentSelectList = (currentPage) => {
 		stockEquipmentSearch.currentPage = CommonUtil.isEmpty(currentPage) ? 1 : currentPage;
 		stockEquipmentSearch['government_id'] = 'IS_NULL';
+		stockEquipmentSearch['is_new_equipment'] = false;
 		const newStockEquipmentSearch = {...stockEquipmentSearch};
 		setStockEquipmentSearch(newStockEquipmentSearch);
 
@@ -504,6 +535,64 @@
 	const [tabIndex, setTabIndex] = React.useState(defaultTabIndex);
 	//탭 초기화
 	const tab = [{
+		title: `신규 장비 (${newEquipment.equipmentListCount})`,
+		content: (
+			<div>
+				<div className="flex equip-tab">
+					<SubTitle explanation={"데이터 수집 정보로부터 신규 등록된 장비 목록입니다. ★장비 정보를 업데이트해주세요.★"} />
+					{/* <div className="btn-wrap flex-end margin-bottom ">
+						{isEquipmentDelivery
+							? <>
+								<button className={"btn-small green-btn"} onClick={modalDeliveryOpen}>장비납품</button>
+								<button className={"btn-small red-btn"} onClick={() => {setIsEquipmentDelivery(false)}}>납품취소</button>
+							</>
+							: <>
+								<button className={"btn-small gray-btn"} onClick={() => {setIsEquipmentDelivery(true)}}>납품장비선택</button>
+								<button className={"btn-small gray-btn"} onClick={() => {modalEquipmentOpen()}}>등록</button>
+							</>
+						}
+					</div> */}
+				</div>
+				<table class="caregiver-user protector-user">
+					<thead>
+						<tr>
+							<th>No</th>
+							<th>시스템등록일시</th>
+							<th>시리얼넘버</th>
+							<th>상태</th>
+							<th>관리</th>
+						</tr>
+					</thead>
+					<tbody>
+						{newEquipment.equipmentList.map((item, idx) => { return (
+							<tr>
+								<td data-label="No">{newEquipment.equipmentListCount - idx - (newEquipmentSearch.currentPage - 1) * newEquipmentSearch.perPage}</td>
+								<td data-label="시스템등록일시">{item['equipment_insert_datetime']}</td>
+								<td data-label="시리얼넘버">{item['equipment_serial_number']}</td>
+								<td data-label="상태">{equipmentStates[item['equipment_state']]}</td>
+								<td data-label="관리">
+									<button className={"btn-small gray-btn"} onClick={() => modalEquipmentOpen(item)}>정보 수정</button>
+								</td>
+							</tr>
+						)})}
+						{CommonUtil.isEmpty(newEquipment.equipmentList) ?
+							<tr>
+								<td colSpan={8}>조회된 데이터가 없습니다</td>
+							</tr>
+						: null}
+						
+					</tbody>
+				</table>
+				<Pagination
+					currentPage={newEquipmentSearch.currentPage}
+					perPage={newEquipmentSearch.perPage}
+					totalCount={newEquipment.equipmentListCount}
+					maxRange={5}
+					click={newEquipmentSelectList}
+				/>
+			</div>
+		)
+	}, {
 		title: `재고 장비 (${stockEquipment.equipmentListCount})`,
 		content: (
 			<div>
Add a comment
List