|
|
@@ -0,0 +1,46 @@
|
|
|
+// get-checkitem.js
|
|
|
+
|
|
|
+const url =
|
|
|
+ // 'http://192.168.20.70:28081/api/taskequipment_gd?apiKey=cecb02cf8d1c7be3a05987d6acc6d913666d9cb72cc061039ffb19ecaead1bb9&TYPECODE=DD&TABLENAME=pipeequipmentdetail'
|
|
|
+ 'http://192.168.20.70:28081/api/taskequipment_gd?apiKey=cecb02cf8d1c7be3a05987d6acc6d913666d9cb72cc061039ffb19ecaead1bb9&TABLENAME=pipeequipmentdetail'
|
|
|
+
|
|
|
+async function main() {
|
|
|
+ const response = await fetch(url)
|
|
|
+
|
|
|
+ if (!response.ok) {
|
|
|
+ throw new Error(`请求失败:${response.status} ${response.statusText}`)
|
|
|
+ }
|
|
|
+
|
|
|
+ const result = await response.json()
|
|
|
+
|
|
|
+ const checkItemMap = new Map()
|
|
|
+
|
|
|
+ ;(result.data || []).forEach((item) => {
|
|
|
+ if (!item.CHECKITEM || !item.ITEMCODES) return
|
|
|
+
|
|
|
+ const names = item.CHECKITEM.split(',')
|
|
|
+ const codes = item.ITEMCODES.split(',')
|
|
|
+
|
|
|
+ codes.forEach((code, index) => {
|
|
|
+ const itemCode = code.trim()
|
|
|
+ const itemName = names[index]?.trim()
|
|
|
+
|
|
|
+ // 按 code 去重,最终输出 code:name 格式
|
|
|
+ if (itemCode && itemName) {
|
|
|
+ checkItemMap.set(itemCode, itemName)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ const checkItems = Array.from(checkItemMap, ([code, name]) => `${code}:${name}`)
|
|
|
+
|
|
|
+ console.log('项目总数:', checkItems.length)
|
|
|
+ console.log(checkItems)
|
|
|
+
|
|
|
+ // 如果需要换行显示,可以打开下面这行
|
|
|
+ // console.log(checkItems.join('\n'))
|
|
|
+}
|
|
|
+
|
|
|
+main().catch((error) => {
|
|
|
+ console.error('获取 CHECKITEM 失败:', error)
|
|
|
+})
|