diff --git a/data.xlsx b/data.xlsx index 6883859..6378200 100644 Binary files a/data.xlsx and b/data.xlsx differ diff --git a/remove-empty-license.js b/remove-empty-license.js new file mode 100644 index 0000000..a5df6e1 --- /dev/null +++ b/remove-empty-license.js @@ -0,0 +1,26 @@ + +import fs from 'fs/promises'; + +async function removeEmptyLicenseRecords() { + try { + const filePath = './data.json'; + const data = await fs.readFile(filePath, 'utf-8'); + let records = JSON.parse(data); + + // Filter out records where "许可证号" is "空" + const filteredRecords = records.filter(record => record['许可证号'] !== '空'); + + // Update the sequential "序号" field for the remaining records + for (let i = 0; i < filteredRecords.length; i++) { + filteredRecords[i]['序号'] = (i + 1).toString(); + } + + await fs.writeFile(filePath, JSON.stringify(filteredRecords, null, 4), 'utf-8'); + console.log(`已从 data.json 中删除所有 "许可证号" 为 "空" 的数据。共删除 ${records.length - filteredRecords.length} 条记录。`); + console.log('序号字段已重新编号以保持顺序。'); + } catch (error) { + console.error('删除空许可证号数据时发生错误:', error.message); + } +} + +removeEmptyLicenseRecords();