| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- import fs from 'fs'
- const p = 'src/api/mock/dongguan.js'
- let s = fs.readFileSync(p, 'utf8')
- const start = s.indexOf('function buildTimeline()')
- const end = s.indexOf('export function isDongguanBase')
- if (start < 0 || end < 0) throw new Error('markers not found')
- const neu = `function buildTimeline() {
- // 对齐原型「当前周期」:7 月~11 月
- const tasks = [
- { id: 'T-70', date: '2024-07-12', type: 'uav', status: 'done', label: '飞巡' },
- { id: 'T-71', date: '2024-07-26', type: 'manual', status: 'done', label: '人工普查' },
- { id: 'T-72', date: '2024-08-08', type: 'uav', status: 'done', label: '飞巡' },
- { id: 'T-73', date: '2024-08-22', type: 'uav', status: 'done', label: '飞巡' },
- { id: 'T-74', date: '2024-09-05', type: 'manual', status: 'done', label: '人工普查' },
- { id: 'T-75', date: '2024-09-18', type: 'uav', status: 'done', label: '飞巡' },
- { id: 'T-76', date: '2024-10-02', type: 'uav', status: 'done', label: '飞巡' },
- { id: 'T-77', date: '2024-10-11', type: 'manual', status: 'done', label: '人工普查' },
- { id: 'T-78', date: '2024-10-22', type: 'uav', status: 'done', label: '飞巡' },
- { id: 'T-79', date: '2024-11-02', type: 'uav', status: 'done', label: '飞巡' },
- { id: 'T-80', date: '2024-11-08', type: 'manual', status: 'pending', label: '人工普查' },
- { id: 'T-81', date: '2024-11-18', type: 'uav', status: 'todo', label: '飞巡' },
- { id: 'T-82', date: '2024-11-25', type: 'uav', status: 'overdue', label: '飞巡' },
- ]
- const indicators = [
- { id: 'I1', name: '果实着色面积占比', date: '2024-07-20', value: 68.2, unit: '%', source: 'uav' },
- { id: 'I2', name: '新梢整齐度', date: '2024-08-22', value: 72.5, unit: '%', source: 'uav' },
- { id: 'I3', name: '抽穗率', date: '2024-09-12', value: 41.0, unit: '%', source: 'uav' },
- { id: 'I4', name: '秋梢老熟度', date: '2024-10-11', value: 86.0, unit: '%', source: 'uav' },
- { id: 'I5', name: '控梢效果指数', date: '2024-11-02', value: 91.3, unit: '%', source: 'manual' },
- ]
- const phenology = [
- { id: 'PH1', name: '果实成熟采收期', start: '2024-07-01', end: '2024-08-05', key: true },
- { id: 'PH2', name: '秋梢萌发期', start: '2024-08-06', end: '2024-09-10', key: false },
- { id: 'PH3', name: '秋梢老熟期', start: '2024-09-11', end: '2024-10-20', key: false },
- { id: 'PH4', name: '控梢期(休眠期)', start: '2024-10-21', end: '2024-11-30', key: false },
- ]
- const stresses = [
- { id: 'S1', start: '2024-07-18', end: '2024-07-24', type: 'high_dry', label: '高温干旱' },
- { id: 'S2', start: '2024-08-14', end: '2024-08-19', type: 'high_humid', label: '高温高湿' },
- { id: 'S3', start: '2024-09-03', end: '2024-09-07', type: 'heavy_rain', label: '强降水' },
- { id: 'S4', start: '2024-10-08', end: '2024-10-12', type: 'drought', label: '干旱' },
- { id: 'S5', start: '2024-11-01', end: '2024-11-04', type: 'low_temp', label: '低温' },
- ]
- const events = [
- { date: '2024-11-11', title: '秋梢老熟普查' },
- { date: '2024-11-17', title: '植株长势调控' },
- { date: '2024-11-24', title: '控梢药剂评估' },
- ]
- return {
- range: { start: '2024-07-01', end: '2024-11-30' },
- today: '2024-11-03',
- zoneOptions: [
- { id: 'P3', name: 'P3 分区 1B 实验区', role: 'exp' },
- { id: 'P4', name: 'P4 分区 1B 对照区', role: 'ctl' },
- { id: 'P1', name: 'P1 分区 1A 实验区', role: 'exp' },
- { id: 'P2', name: 'P2 分区 1A 对照区', role: 'ctl' },
- ],
- curveZoneOptions: [
- { id: '1B', name: '分区 1B · 抗寒性试验区 (P3 / P4)', exp: 'P3', ctl: 'P4' },
- { id: '1A', name: '分区 1A · 抗旱性试验区 (P1 / P2)', exp: 'P1', ctl: 'P2' },
- ],
- tasks,
- indicators,
- phenology,
- stresses,
- events,
- }
- }
- `
- fs.writeFileSync(p, s.slice(0, start) + neu + s.slice(end))
- console.log('patched', p)
|