@skillre/dsh-plugin-work-dashboard 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client/text.js +5 -0
- package/lib/client/zip.d.ts +38 -0
- package/lib/client/zip.js +165 -0
- package/lib/client.js +143 -12
- package/lib/index.js +8 -2
- package/lib/report-form.d.ts +11 -0
- package/lib/report-form.js +13 -0
- package/lib/report-page.js +129 -39
- package/lib/report-style.js +35 -1
- package/lib/types.d.ts +10 -0
- package/package.json +1 -1
- package/skills/poc-export/SKILL.md +1 -1
package/lib/client/text.js
CHANGED
|
@@ -173,6 +173,10 @@ export const zh = {
|
|
|
173
173
|
exportStageAll: '全部阶段',
|
|
174
174
|
exportStageEmpty: '这个阶段下没有项目。',
|
|
175
175
|
exportHint: '表单完全离线可用:没有 CDN、没有外部字体、没有服务器。每个项目一个文件;组员点「保存」把内容写回表单文件,再用企业微信发回。DSH 校验后准备待审变更,不直接写台账。',
|
|
176
|
+
// A batch of several projects arrives as one archive: the browser allows a
|
|
177
|
+
// single automatic download per click, so the remaining files would be blocked
|
|
178
|
+
// and the batch would look like it exported one project.
|
|
179
|
+
exportArchiveHint: '选了 {count} 个项目:会下载 1 个 zip,解压后每个项目一个表单,各自发回给对应组员。',
|
|
176
180
|
exportGenerate: '生成表单文件',
|
|
177
181
|
exportGenerating: '正在生成…',
|
|
178
182
|
exportDone: '已下载 {name}',
|
|
@@ -757,6 +761,7 @@ export const en = {
|
|
|
757
761
|
exportStageAll: 'All stages',
|
|
758
762
|
exportStageEmpty: 'No projects at this stage.',
|
|
759
763
|
exportHint: 'The form works fully offline: no CDN, no external fonts, no server. One file per project: the colleague saves answers back into the same form file and sends it back. DSH validates it and prepares a change for review.',
|
|
764
|
+
exportArchiveHint: '{count} projects selected: one zip is downloaded. Unzip it and every project has its own form to send to its owner.',
|
|
760
765
|
exportGenerate: 'Generate form files',
|
|
761
766
|
exportGenerating: 'Generating…',
|
|
762
767
|
exportDone: 'Downloaded {name}',
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A minimal ZIP writer — store only, no compression, no dependency.
|
|
3
|
+
*
|
|
4
|
+
* ## Why this exists
|
|
5
|
+
*
|
|
6
|
+
* Exporting several projects produces one form per project, and the browser will
|
|
7
|
+
* not let a single click start several downloads: the first `<a download>` is
|
|
8
|
+
* allowed, the rest are blocked until the user grants "automatic downloads" for
|
|
9
|
+
* the origin. That permission prompt is easy to miss and, once missed, the batch
|
|
10
|
+
* looks like it exported one file. Shipping the batch as one archive keeps the
|
|
11
|
+
* one-file-per-project rule *inside* the download while still being exactly one
|
|
12
|
+
* download.
|
|
13
|
+
*
|
|
14
|
+
* ## Why hand-rolled
|
|
15
|
+
*
|
|
16
|
+
* The client bundle is built with esbuild from this repository's own sources; a
|
|
17
|
+
* zip library would be a new runtime dependency for ~130 lines of struct
|
|
18
|
+
* packing. Store (method 0) is enough: the payload is UTF-8 HTML that is already
|
|
19
|
+
* mostly compressible-by-nobody's-standard, and the file is opened locally, not
|
|
20
|
+
* served.
|
|
21
|
+
*
|
|
22
|
+
* ## What it does not do
|
|
23
|
+
*
|
|
24
|
+
* No directory entries (the paths used here are flat), no ZIP64 (a batch is
|
|
25
|
+
* capped well below 4 GiB by `MAX_REPORT_PROJECTS`), no encryption, no comments.
|
|
26
|
+
*/
|
|
27
|
+
/** One member of the archive; `name` is the path inside it. */
|
|
28
|
+
export interface ZipEntry {
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly content: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Pack the entries into one archive.
|
|
34
|
+
*
|
|
35
|
+
* Entry order is preserved, so the download lists the projects in the order the
|
|
36
|
+
* reader selected them.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildZip(entries: readonly ZipEntry[], at?: Date): Blob;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A minimal ZIP writer — store only, no compression, no dependency.
|
|
3
|
+
*
|
|
4
|
+
* ## Why this exists
|
|
5
|
+
*
|
|
6
|
+
* Exporting several projects produces one form per project, and the browser will
|
|
7
|
+
* not let a single click start several downloads: the first `<a download>` is
|
|
8
|
+
* allowed, the rest are blocked until the user grants "automatic downloads" for
|
|
9
|
+
* the origin. That permission prompt is easy to miss and, once missed, the batch
|
|
10
|
+
* looks like it exported one file. Shipping the batch as one archive keeps the
|
|
11
|
+
* one-file-per-project rule *inside* the download while still being exactly one
|
|
12
|
+
* download.
|
|
13
|
+
*
|
|
14
|
+
* ## Why hand-rolled
|
|
15
|
+
*
|
|
16
|
+
* The client bundle is built with esbuild from this repository's own sources; a
|
|
17
|
+
* zip library would be a new runtime dependency for ~130 lines of struct
|
|
18
|
+
* packing. Store (method 0) is enough: the payload is UTF-8 HTML that is already
|
|
19
|
+
* mostly compressible-by-nobody's-standard, and the file is opened locally, not
|
|
20
|
+
* served.
|
|
21
|
+
*
|
|
22
|
+
* ## What it does not do
|
|
23
|
+
*
|
|
24
|
+
* No directory entries (the paths used here are flat), no ZIP64 (a batch is
|
|
25
|
+
* capped well below 4 GiB by `MAX_REPORT_PROJECTS`), no encryption, no comments.
|
|
26
|
+
*/
|
|
27
|
+
/** CRC-32 lookup table, built once per page load (256 entries, trivial cost). */
|
|
28
|
+
const CRC_TABLE = (() => {
|
|
29
|
+
const table = new Uint32Array(256);
|
|
30
|
+
for (let index = 0; index < 256; index += 1) {
|
|
31
|
+
let value = index;
|
|
32
|
+
for (let bit = 0; bit < 8; bit += 1)
|
|
33
|
+
value = value & 1 ? 0xEDB88320 ^ (value >>> 1) : value >>> 1;
|
|
34
|
+
table[index] = value >>> 0;
|
|
35
|
+
}
|
|
36
|
+
return table;
|
|
37
|
+
})();
|
|
38
|
+
function crc32(bytes) {
|
|
39
|
+
let crc = 0xFFFFFFFF;
|
|
40
|
+
for (let index = 0; index < bytes.length; index += 1) {
|
|
41
|
+
crc = CRC_TABLE[(crc ^ bytes[index]) & 0xFF] ^ (crc >>> 8);
|
|
42
|
+
}
|
|
43
|
+
return (crc ^ 0xFFFFFFFF) >>> 0;
|
|
44
|
+
}
|
|
45
|
+
/** Growable byte buffer; the archive is assembled member by member. */
|
|
46
|
+
class ByteSink {
|
|
47
|
+
parts = [];
|
|
48
|
+
size = 0;
|
|
49
|
+
get length() {
|
|
50
|
+
return this.size;
|
|
51
|
+
}
|
|
52
|
+
push(bytes) {
|
|
53
|
+
this.parts.push(bytes);
|
|
54
|
+
this.size += bytes.length;
|
|
55
|
+
}
|
|
56
|
+
/** Little-endian integer of `width` bytes (1, 2 or 4). */
|
|
57
|
+
pushInt(value, width) {
|
|
58
|
+
const bytes = new Uint8Array(width);
|
|
59
|
+
for (let index = 0; index < width; index += 1)
|
|
60
|
+
bytes[index] = (value >>> (8 * index)) & 0xFF;
|
|
61
|
+
this.push(bytes);
|
|
62
|
+
}
|
|
63
|
+
concat() {
|
|
64
|
+
const out = new Uint8Array(this.size);
|
|
65
|
+
let offset = 0;
|
|
66
|
+
for (const part of this.parts) {
|
|
67
|
+
out.set(part, offset);
|
|
68
|
+
offset += part.length;
|
|
69
|
+
}
|
|
70
|
+
return out;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* MS-DOS date and time, the only timestamp a ZIP stores.
|
|
75
|
+
*
|
|
76
|
+
* Years before 1980 cannot be represented, and the ZIP epoch starts there; a
|
|
77
|
+
* clock set that far back is a broken machine rather than a real export date, so
|
|
78
|
+
* it is clamped instead of throwing at the end of a successful export.
|
|
79
|
+
*/
|
|
80
|
+
function dosStamp(at) {
|
|
81
|
+
const year = Math.max(1980, at.getFullYear());
|
|
82
|
+
const time = (at.getHours() << 11) | (at.getMinutes() << 5) | Math.floor(at.getSeconds() / 2);
|
|
83
|
+
const date = ((year - 1980) << 9) | ((at.getMonth() + 1) << 5) | at.getDate();
|
|
84
|
+
return { time, date };
|
|
85
|
+
}
|
|
86
|
+
/** UTF-8 bytes of a member name; ZIP paths are always `/`-separated. */
|
|
87
|
+
function nameBytes(name) {
|
|
88
|
+
return new TextEncoder().encode(name.replace(/\\/g, '/').replace(/^\/+/, ''));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Pack the entries into one archive.
|
|
92
|
+
*
|
|
93
|
+
* Entry order is preserved, so the download lists the projects in the order the
|
|
94
|
+
* reader selected them.
|
|
95
|
+
*/
|
|
96
|
+
export function buildZip(entries, at = new Date()) {
|
|
97
|
+
const encoder = new TextEncoder();
|
|
98
|
+
const { time, date } = dosStamp(at);
|
|
99
|
+
// General-purpose bit 11 marks the names as UTF-8. Without it a Chinese file
|
|
100
|
+
// name is decoded as CP437 by some tools and shows up as mojibake.
|
|
101
|
+
const flags = 0x0800;
|
|
102
|
+
const local = new ByteSink();
|
|
103
|
+
const central = new ByteSink();
|
|
104
|
+
const offsets = [];
|
|
105
|
+
for (const entry of entries) {
|
|
106
|
+
const name = nameBytes(entry.name);
|
|
107
|
+
const data = encoder.encode(entry.content);
|
|
108
|
+
const crc = crc32(data);
|
|
109
|
+
offsets.push(local.length);
|
|
110
|
+
local.pushInt(0x04034B50, 4); // local file header
|
|
111
|
+
local.pushInt(20, 2); // version needed to extract (2.0)
|
|
112
|
+
local.pushInt(flags, 2);
|
|
113
|
+
local.pushInt(0, 2); // method: store
|
|
114
|
+
local.pushInt(time, 2);
|
|
115
|
+
local.pushInt(date, 2);
|
|
116
|
+
local.pushInt(crc, 4);
|
|
117
|
+
local.pushInt(data.length, 4); // compressed size
|
|
118
|
+
local.pushInt(data.length, 4); // uncompressed size
|
|
119
|
+
local.pushInt(name.length, 2);
|
|
120
|
+
local.pushInt(0, 2); // extra field length
|
|
121
|
+
local.push(name);
|
|
122
|
+
local.push(data);
|
|
123
|
+
}
|
|
124
|
+
let centralSize = 0;
|
|
125
|
+
for (const [index, entry] of entries.entries()) {
|
|
126
|
+
const name = nameBytes(entry.name);
|
|
127
|
+
const data = encoder.encode(entry.content);
|
|
128
|
+
const before = central.length;
|
|
129
|
+
central.pushInt(0x02014B50, 4); // central directory header
|
|
130
|
+
central.pushInt(20, 2); // version made by
|
|
131
|
+
central.pushInt(20, 2); // version needed
|
|
132
|
+
central.pushInt(flags, 2);
|
|
133
|
+
central.pushInt(0, 2); // method: store
|
|
134
|
+
central.pushInt(time, 2);
|
|
135
|
+
central.pushInt(date, 2);
|
|
136
|
+
central.pushInt(crc32(data), 4);
|
|
137
|
+
central.pushInt(data.length, 4);
|
|
138
|
+
central.pushInt(data.length, 4);
|
|
139
|
+
central.pushInt(name.length, 2);
|
|
140
|
+
central.pushInt(0, 2); // extra field length
|
|
141
|
+
central.pushInt(0, 2); // comment length
|
|
142
|
+
central.pushInt(0, 2); // disk number start
|
|
143
|
+
central.pushInt(0, 2); // internal attributes
|
|
144
|
+
central.pushInt(0, 4); // external attributes
|
|
145
|
+
central.pushInt(offsets[index], 4);
|
|
146
|
+
central.push(name);
|
|
147
|
+
centralSize += central.length - before;
|
|
148
|
+
}
|
|
149
|
+
const directory = central.concat();
|
|
150
|
+
const out = local;
|
|
151
|
+
const directoryOffset = out.length;
|
|
152
|
+
out.push(directory);
|
|
153
|
+
out.pushInt(0x06054B50, 4); // end of central directory
|
|
154
|
+
out.pushInt(0, 2); // this disk
|
|
155
|
+
out.pushInt(0, 2); // disk with the central directory
|
|
156
|
+
out.pushInt(entries.length, 2);
|
|
157
|
+
out.pushInt(entries.length, 2);
|
|
158
|
+
out.pushInt(centralSize, 4);
|
|
159
|
+
out.pushInt(directoryOffset, 4);
|
|
160
|
+
out.pushInt(0, 2); // comment length
|
|
161
|
+
const bytes = out.concat();
|
|
162
|
+
// `Uint8Array<ArrayBufferLike>` is not a `BlobPart` under the DOM typings, even
|
|
163
|
+
// though every byte here is a fresh non-shared buffer.
|
|
164
|
+
return new Blob([bytes], { type: 'application/zip' });
|
|
165
|
+
}
|
package/lib/client.js
CHANGED
|
@@ -270,6 +270,10 @@ window.__ModuleLoader__.load({
|
|
|
270
270
|
exportStageAll: "\u5168\u90E8\u9636\u6BB5",
|
|
271
271
|
exportStageEmpty: "\u8FD9\u4E2A\u9636\u6BB5\u4E0B\u6CA1\u6709\u9879\u76EE\u3002",
|
|
272
272
|
exportHint: "\u8868\u5355\u5B8C\u5168\u79BB\u7EBF\u53EF\u7528\uFF1A\u6CA1\u6709 CDN\u3001\u6CA1\u6709\u5916\u90E8\u5B57\u4F53\u3001\u6CA1\u6709\u670D\u52A1\u5668\u3002\u6BCF\u4E2A\u9879\u76EE\u4E00\u4E2A\u6587\u4EF6\uFF1B\u7EC4\u5458\u70B9\u300C\u4FDD\u5B58\u300D\u628A\u5185\u5BB9\u5199\u56DE\u8868\u5355\u6587\u4EF6\uFF0C\u518D\u7528\u4F01\u4E1A\u5FAE\u4FE1\u53D1\u56DE\u3002DSH \u6821\u9A8C\u540E\u51C6\u5907\u5F85\u5BA1\u53D8\u66F4\uFF0C\u4E0D\u76F4\u63A5\u5199\u53F0\u8D26\u3002",
|
|
273
|
+
// A batch of several projects arrives as one archive: the browser allows a
|
|
274
|
+
// single automatic download per click, so the remaining files would be blocked
|
|
275
|
+
// and the batch would look like it exported one project.
|
|
276
|
+
exportArchiveHint: "\u9009\u4E86 {count} \u4E2A\u9879\u76EE\uFF1A\u4F1A\u4E0B\u8F7D 1 \u4E2A zip\uFF0C\u89E3\u538B\u540E\u6BCF\u4E2A\u9879\u76EE\u4E00\u4E2A\u8868\u5355\uFF0C\u5404\u81EA\u53D1\u56DE\u7ED9\u5BF9\u5E94\u7EC4\u5458\u3002",
|
|
273
277
|
exportGenerate: "\u751F\u6210\u8868\u5355\u6587\u4EF6",
|
|
274
278
|
exportGenerating: "\u6B63\u5728\u751F\u6210\u2026",
|
|
275
279
|
exportDone: "\u5DF2\u4E0B\u8F7D {name}",
|
|
@@ -853,6 +857,7 @@ window.__ModuleLoader__.load({
|
|
|
853
857
|
exportStageAll: "All stages",
|
|
854
858
|
exportStageEmpty: "No projects at this stage.",
|
|
855
859
|
exportHint: "The form works fully offline: no CDN, no external fonts, no server. One file per project: the colleague saves answers back into the same form file and sends it back. DSH validates it and prepares a change for review.",
|
|
860
|
+
exportArchiveHint: "{count} projects selected: one zip is downloaded. Unzip it and every project has its own form to send to its owner.",
|
|
856
861
|
exportGenerate: "Generate form files",
|
|
857
862
|
exportGenerating: "Generating\u2026",
|
|
858
863
|
exportDone: "Downloaded {name}",
|
|
@@ -4639,6 +4644,127 @@ window.__ModuleLoader__.load({
|
|
|
4639
4644
|
|
|
4640
4645
|
// src/client/export-form.tsx
|
|
4641
4646
|
var import_react3 = require("react");
|
|
4647
|
+
|
|
4648
|
+
// src/client/zip.ts
|
|
4649
|
+
var CRC_TABLE = (() => {
|
|
4650
|
+
const table = new Uint32Array(256);
|
|
4651
|
+
for (let index = 0; index < 256; index += 1) {
|
|
4652
|
+
let value = index;
|
|
4653
|
+
for (let bit = 0; bit < 8; bit += 1) value = value & 1 ? 3988292384 ^ value >>> 1 : value >>> 1;
|
|
4654
|
+
table[index] = value >>> 0;
|
|
4655
|
+
}
|
|
4656
|
+
return table;
|
|
4657
|
+
})();
|
|
4658
|
+
function crc32(bytes) {
|
|
4659
|
+
let crc = 4294967295;
|
|
4660
|
+
for (let index = 0; index < bytes.length; index += 1) {
|
|
4661
|
+
crc = CRC_TABLE[(crc ^ bytes[index]) & 255] ^ crc >>> 8;
|
|
4662
|
+
}
|
|
4663
|
+
return (crc ^ 4294967295) >>> 0;
|
|
4664
|
+
}
|
|
4665
|
+
var ByteSink = class {
|
|
4666
|
+
parts = [];
|
|
4667
|
+
size = 0;
|
|
4668
|
+
get length() {
|
|
4669
|
+
return this.size;
|
|
4670
|
+
}
|
|
4671
|
+
push(bytes) {
|
|
4672
|
+
this.parts.push(bytes);
|
|
4673
|
+
this.size += bytes.length;
|
|
4674
|
+
}
|
|
4675
|
+
/** Little-endian integer of `width` bytes (1, 2 or 4). */
|
|
4676
|
+
pushInt(value, width) {
|
|
4677
|
+
const bytes = new Uint8Array(width);
|
|
4678
|
+
for (let index = 0; index < width; index += 1) bytes[index] = value >>> 8 * index & 255;
|
|
4679
|
+
this.push(bytes);
|
|
4680
|
+
}
|
|
4681
|
+
concat() {
|
|
4682
|
+
const out = new Uint8Array(this.size);
|
|
4683
|
+
let offset = 0;
|
|
4684
|
+
for (const part of this.parts) {
|
|
4685
|
+
out.set(part, offset);
|
|
4686
|
+
offset += part.length;
|
|
4687
|
+
}
|
|
4688
|
+
return out;
|
|
4689
|
+
}
|
|
4690
|
+
};
|
|
4691
|
+
function dosStamp(at) {
|
|
4692
|
+
const year = Math.max(1980, at.getFullYear());
|
|
4693
|
+
const time = at.getHours() << 11 | at.getMinutes() << 5 | Math.floor(at.getSeconds() / 2);
|
|
4694
|
+
const date = year - 1980 << 9 | at.getMonth() + 1 << 5 | at.getDate();
|
|
4695
|
+
return { time, date };
|
|
4696
|
+
}
|
|
4697
|
+
function nameBytes(name) {
|
|
4698
|
+
return new TextEncoder().encode(name.replace(/\\/g, "/").replace(/^\/+/, ""));
|
|
4699
|
+
}
|
|
4700
|
+
function buildZip(entries, at = /* @__PURE__ */ new Date()) {
|
|
4701
|
+
const encoder = new TextEncoder();
|
|
4702
|
+
const { time, date } = dosStamp(at);
|
|
4703
|
+
const flags = 2048;
|
|
4704
|
+
const local = new ByteSink();
|
|
4705
|
+
const central = new ByteSink();
|
|
4706
|
+
const offsets = [];
|
|
4707
|
+
for (const entry of entries) {
|
|
4708
|
+
const name = nameBytes(entry.name);
|
|
4709
|
+
const data = encoder.encode(entry.content);
|
|
4710
|
+
const crc = crc32(data);
|
|
4711
|
+
offsets.push(local.length);
|
|
4712
|
+
local.pushInt(67324752, 4);
|
|
4713
|
+
local.pushInt(20, 2);
|
|
4714
|
+
local.pushInt(flags, 2);
|
|
4715
|
+
local.pushInt(0, 2);
|
|
4716
|
+
local.pushInt(time, 2);
|
|
4717
|
+
local.pushInt(date, 2);
|
|
4718
|
+
local.pushInt(crc, 4);
|
|
4719
|
+
local.pushInt(data.length, 4);
|
|
4720
|
+
local.pushInt(data.length, 4);
|
|
4721
|
+
local.pushInt(name.length, 2);
|
|
4722
|
+
local.pushInt(0, 2);
|
|
4723
|
+
local.push(name);
|
|
4724
|
+
local.push(data);
|
|
4725
|
+
}
|
|
4726
|
+
let centralSize = 0;
|
|
4727
|
+
for (const [index, entry] of entries.entries()) {
|
|
4728
|
+
const name = nameBytes(entry.name);
|
|
4729
|
+
const data = encoder.encode(entry.content);
|
|
4730
|
+
const before = central.length;
|
|
4731
|
+
central.pushInt(33639248, 4);
|
|
4732
|
+
central.pushInt(20, 2);
|
|
4733
|
+
central.pushInt(20, 2);
|
|
4734
|
+
central.pushInt(flags, 2);
|
|
4735
|
+
central.pushInt(0, 2);
|
|
4736
|
+
central.pushInt(time, 2);
|
|
4737
|
+
central.pushInt(date, 2);
|
|
4738
|
+
central.pushInt(crc32(data), 4);
|
|
4739
|
+
central.pushInt(data.length, 4);
|
|
4740
|
+
central.pushInt(data.length, 4);
|
|
4741
|
+
central.pushInt(name.length, 2);
|
|
4742
|
+
central.pushInt(0, 2);
|
|
4743
|
+
central.pushInt(0, 2);
|
|
4744
|
+
central.pushInt(0, 2);
|
|
4745
|
+
central.pushInt(0, 2);
|
|
4746
|
+
central.pushInt(0, 4);
|
|
4747
|
+
central.pushInt(offsets[index], 4);
|
|
4748
|
+
central.push(name);
|
|
4749
|
+
centralSize += central.length - before;
|
|
4750
|
+
}
|
|
4751
|
+
const directory = central.concat();
|
|
4752
|
+
const out = local;
|
|
4753
|
+
const directoryOffset = out.length;
|
|
4754
|
+
out.push(directory);
|
|
4755
|
+
out.pushInt(101010256, 4);
|
|
4756
|
+
out.pushInt(0, 2);
|
|
4757
|
+
out.pushInt(0, 2);
|
|
4758
|
+
out.pushInt(entries.length, 2);
|
|
4759
|
+
out.pushInt(entries.length, 2);
|
|
4760
|
+
out.pushInt(centralSize, 4);
|
|
4761
|
+
out.pushInt(directoryOffset, 4);
|
|
4762
|
+
out.pushInt(0, 2);
|
|
4763
|
+
const bytes = out.concat();
|
|
4764
|
+
return new Blob([bytes], { type: "application/zip" });
|
|
4765
|
+
}
|
|
4766
|
+
|
|
4767
|
+
// src/client/export-form.tsx
|
|
4642
4768
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
4643
4769
|
var STAGE_FILTERS = [
|
|
4644
4770
|
{ key: "G0", label: "G0" },
|
|
@@ -4677,6 +4803,16 @@ window.__ModuleLoader__.load({
|
|
|
4677
4803
|
};
|
|
4678
4804
|
const selectAll = () => setSelected(new Set(visibleRows.map((row) => row.pocId)));
|
|
4679
4805
|
const selectNone = () => setSelected(/* @__PURE__ */ new Set());
|
|
4806
|
+
const save = (fileName, payload) => {
|
|
4807
|
+
const url = URL.createObjectURL(payload);
|
|
4808
|
+
const anchor = document.createElement("a");
|
|
4809
|
+
anchor.href = url;
|
|
4810
|
+
anchor.download = fileName;
|
|
4811
|
+
document.body.appendChild(anchor);
|
|
4812
|
+
anchor.click();
|
|
4813
|
+
anchor.remove();
|
|
4814
|
+
setTimeout(() => URL.revokeObjectURL(url), 4e3);
|
|
4815
|
+
};
|
|
4680
4816
|
const generate = async () => {
|
|
4681
4817
|
if (intent === "progress" && selectedIds.length === 0) return;
|
|
4682
4818
|
setBusy(true);
|
|
@@ -4685,17 +4821,12 @@ window.__ModuleLoader__.load({
|
|
|
4685
4821
|
const result = await api.exportForm(mode, mode === "blank" ? [] : selectedIds);
|
|
4686
4822
|
const files = Array.isArray(result.files) ? result.files : [];
|
|
4687
4823
|
if (files.length === 0) throw new Error(t("exportFailed"));
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
const
|
|
4693
|
-
|
|
4694
|
-
anchor.download = file.fileName;
|
|
4695
|
-
document.body.appendChild(anchor);
|
|
4696
|
-
anchor.click();
|
|
4697
|
-
anchor.remove();
|
|
4698
|
-
setTimeout(() => URL.revokeObjectURL(url), 4e3);
|
|
4824
|
+
if (files.length === 1) {
|
|
4825
|
+
const only = files[0];
|
|
4826
|
+
save(only.fileName, new Blob([only.html], { type: "text/html;charset=utf-8" }));
|
|
4827
|
+
} else {
|
|
4828
|
+
const archive = buildZip(files.map((file) => ({ name: file.fileName, content: file.html })));
|
|
4829
|
+
save(result.archiveName ?? "\u8BB0\u5F55\u8FDB\u5C55.zip", archive);
|
|
4699
4830
|
}
|
|
4700
4831
|
onClose();
|
|
4701
4832
|
} catch (error) {
|
|
@@ -4803,7 +4934,7 @@ window.__ModuleLoader__.load({
|
|
|
4803
4934
|
] })
|
|
4804
4935
|
] })
|
|
4805
4936
|
] }) }, row.pocId)) })),
|
|
4806
|
-
intent === "new" ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "helper-box", children: selectedIds.length === 0 ? t("exportBlankHint") : t("exportHint") })
|
|
4937
|
+
intent === "new" ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "helper-box", children: selectedIds.length === 0 ? t("exportBlankHint") : selectedIds.length === 1 ? t("exportHint") : format(t("exportArchiveHint"), { count: selectedIds.length }) })
|
|
4807
4938
|
] }),
|
|
4808
4939
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "modal-footer", children: [
|
|
4809
4940
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "spacer" }),
|
package/lib/index.js
CHANGED
|
@@ -21,7 +21,7 @@ import { buildGlobalTimeline } from './timeline.js';
|
|
|
21
21
|
import { text } from './gap.js';
|
|
22
22
|
import { canReportProgress } from './progress.js';
|
|
23
23
|
import { buildDossier } from './report-contract.js';
|
|
24
|
-
import { buildReportHtml, reportFileName, reportFileNames } from './report-form.js';
|
|
24
|
+
import { buildReportHtml, reportArchiveName, reportFileName, reportFileNames } from './report-form.js';
|
|
25
25
|
import { registerBundledSkills } from './skill.js';
|
|
26
26
|
import { createExecuteRoute } from './transport.js';
|
|
27
27
|
export { resolveConfig };
|
|
@@ -147,6 +147,7 @@ export function createRuntime(config, options = {}) {
|
|
|
147
147
|
files: [{ html: buildReportHtml('new', [], stamp), fileName: reportFileName('new', null, stamp), projectCount: 0, pocId: null }],
|
|
148
148
|
fileCount: 1,
|
|
149
149
|
projectCount: 0,
|
|
150
|
+
archiveName: null,
|
|
150
151
|
};
|
|
151
152
|
}
|
|
152
153
|
const wanted = new Set(pocIds);
|
|
@@ -168,7 +169,12 @@ export function createRuntime(config, options = {}) {
|
|
|
168
169
|
projectCount: 1,
|
|
169
170
|
pocId: text(record.poc_id),
|
|
170
171
|
}));
|
|
171
|
-
return {
|
|
172
|
+
return {
|
|
173
|
+
files,
|
|
174
|
+
fileCount: files.length,
|
|
175
|
+
projectCount: records.length,
|
|
176
|
+
archiveName: files.length > 1 ? reportArchiveName(stamp) : null,
|
|
177
|
+
};
|
|
172
178
|
},
|
|
173
179
|
};
|
|
174
180
|
}
|
package/lib/report-form.d.ts
CHANGED
|
@@ -32,3 +32,14 @@ export declare function reportFileNames(intent: 'new' | 'progress', projects: re
|
|
|
32
32
|
owner?: string;
|
|
33
33
|
pocId?: string;
|
|
34
34
|
}[], now?: Date): string[];
|
|
35
|
+
/**
|
|
36
|
+
* The download name of a multi-project batch.
|
|
37
|
+
*
|
|
38
|
+
* A batch travels as ONE archive because browsers allow a single automatic
|
|
39
|
+
* download per click: the second `<a download>` in the same gesture is blocked
|
|
40
|
+
* (or silently dropped) unless the user grants "multiple downloads" for the
|
|
41
|
+
* origin, which is a permission prompt most people never notice. One archive is
|
|
42
|
+
* one download, so every selected project actually arrives. Inside it the files
|
|
43
|
+
* are still one form per project.
|
|
44
|
+
*/
|
|
45
|
+
export declare function reportArchiveName(now?: Date): string;
|
package/lib/report-form.js
CHANGED
|
@@ -112,3 +112,16 @@ export function reportFileNames(intent, projects, now = new Date()) {
|
|
|
112
112
|
return name;
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* The download name of a multi-project batch.
|
|
117
|
+
*
|
|
118
|
+
* A batch travels as ONE archive because browsers allow a single automatic
|
|
119
|
+
* download per click: the second `<a download>` in the same gesture is blocked
|
|
120
|
+
* (or silently dropped) unless the user grants "multiple downloads" for the
|
|
121
|
+
* origin, which is a permission prompt most people never notice. One archive is
|
|
122
|
+
* one download, so every selected project actually arrives. Inside it the files
|
|
123
|
+
* are still one form per project.
|
|
124
|
+
*/
|
|
125
|
+
export function reportArchiveName(now = new Date()) {
|
|
126
|
+
return `记录进展_${calendarDate(now)}.zip`;
|
|
127
|
+
}
|
package/lib/report-page.js
CHANGED
|
@@ -597,6 +597,11 @@ function reportPage() {
|
|
|
597
597
|
completion: '',
|
|
598
598
|
});
|
|
599
599
|
}
|
|
600
|
+
// One blank plan-external row is present from the start, so "计划之外还做了
|
|
601
|
+
// 什么" opens with a field to type in instead of a button. It carries no
|
|
602
|
+
// content, so validation ignores it and `buildRound` drops it.
|
|
603
|
+
ws.lines.push(makeExtraLine(ws));
|
|
604
|
+
ws.openLines[at(ws.lines, ws.lines.length - 1).key] = false;
|
|
600
605
|
return ws;
|
|
601
606
|
}
|
|
602
607
|
function makeWorkspaces() {
|
|
@@ -1334,8 +1339,13 @@ function reportPage() {
|
|
|
1334
1339
|
registerRef(path, wrap);
|
|
1335
1340
|
return wrap;
|
|
1336
1341
|
}
|
|
1337
|
-
/**
|
|
1338
|
-
|
|
1342
|
+
/**
|
|
1343
|
+
* A section head: numbered badge, title, one-line lead, right-hand note.
|
|
1344
|
+
*
|
|
1345
|
+
* `noteKind` picks the note's treatment. `pill` is for a count the reader
|
|
1346
|
+
* scans ("3 项 · 已完成 1"); `note` is for an instruction ("三项都必填").
|
|
1347
|
+
*/
|
|
1348
|
+
function sectionShell(num, title, sub, note, noteKind = 'note') {
|
|
1339
1349
|
var head = el('div', 'rp-sechead');
|
|
1340
1350
|
var left = el('div', 'rp-secl');
|
|
1341
1351
|
// An empty `num` means this block is a continuation of the section above it,
|
|
@@ -1357,12 +1367,19 @@ function reportPage() {
|
|
|
1357
1367
|
left.appendChild(titles);
|
|
1358
1368
|
head.appendChild(left);
|
|
1359
1369
|
if (note !== '') {
|
|
1360
|
-
var n = el('span', 'rp-secnote');
|
|
1370
|
+
var n = el('span', noteKind === 'pill' ? 'rp-pill' : 'rp-secnote');
|
|
1361
1371
|
setText(n, note);
|
|
1372
|
+
if (noteKind === 'pill')
|
|
1373
|
+
n.setAttribute('role', 'status');
|
|
1362
1374
|
head.appendChild(n);
|
|
1363
1375
|
}
|
|
1364
1376
|
return head;
|
|
1365
1377
|
}
|
|
1378
|
+
/** A worksheet section; everything after the first sits under a hairline. */
|
|
1379
|
+
function worksheetSection(rule) {
|
|
1380
|
+
var sec = el('section', rule ? 'rp-section-rule' : '');
|
|
1381
|
+
return sec;
|
|
1382
|
+
}
|
|
1366
1383
|
function sectionNote(sec, text) {
|
|
1367
1384
|
var p = el('p', 'rp-secsub');
|
|
1368
1385
|
p.style.padding = '0 0 10px 35px';
|
|
@@ -1708,7 +1725,7 @@ function reportPage() {
|
|
|
1708
1725
|
if (text.indexOf('legacy-') === 0)
|
|
1709
1726
|
return text;
|
|
1710
1727
|
var cut = text.indexOf('-');
|
|
1711
|
-
return 'plan-' + (cut > 0 ? text.slice(0, cut) : text);
|
|
1728
|
+
return 'plan-' + (cut > 0 ? text.slice(0, cut) : text).slice(0, 4);
|
|
1712
1729
|
}
|
|
1713
1730
|
/** One work item.
|
|
1714
1731
|
*
|
|
@@ -1719,6 +1736,19 @@ function reportPage() {
|
|
|
1719
1736
|
*/
|
|
1720
1737
|
function renderLineCard(ws, line, position, extra) {
|
|
1721
1738
|
var open = ws.openLines[line.key] === true;
|
|
1739
|
+
// An untouched plan-external row is not a work item yet: it is the empty field
|
|
1740
|
+
// waiting for one. It gets a label and an input, and nothing that looks like
|
|
1741
|
+
// a filled row (no "(未命名)" title, no status control, no chips).
|
|
1742
|
+
if (extra && !open && !lineHasContent(line)) {
|
|
1743
|
+
var blank = el('div', 'rp-plan');
|
|
1744
|
+
blank.setAttribute('data-line', line.key);
|
|
1745
|
+
blank.className += ' rp-item';
|
|
1746
|
+
var titleField = mkInput(line.title, '例:受邀参加客户年度安全峰会,做了 20 分钟专题分享', 500);
|
|
1747
|
+
titleField.setAttribute('data-role', 'line-title');
|
|
1748
|
+
titleField.setAttribute('data-line', line.key);
|
|
1749
|
+
blank.appendChild(fieldWrap('line:' + line.key + ':title', '做了什么(自拟标题)', false, titleField, '', 'is-quiet'));
|
|
1750
|
+
return blank;
|
|
1751
|
+
}
|
|
1722
1752
|
var wrap = el('div', 'rp-plan' + (open ? ' is-open' : ''));
|
|
1723
1753
|
wrap.setAttribute('data-line', line.key);
|
|
1724
1754
|
wrap.className += ' rp-item';
|
|
@@ -1738,19 +1768,30 @@ function reportPage() {
|
|
|
1738
1768
|
head.appendChild(renderStatusField(ws, line));
|
|
1739
1769
|
wrap.appendChild(head);
|
|
1740
1770
|
if (!open) {
|
|
1741
|
-
var row = el('div', 'rp-collapsed');
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1771
|
+
var row = el('div', 'rp-collapsed' + (extra && !lineHasContent(line) ? ' is-blank' : ''));
|
|
1772
|
+
// A previous plan already has its title from the ledger, so the row asks for
|
|
1773
|
+
// the outcome. A plan-external item has no title yet, so the row asks for
|
|
1774
|
+
// that first — the design's "做了什么(自拟标题)".
|
|
1775
|
+
var first = null;
|
|
1776
|
+
if (extra) {
|
|
1777
|
+
first = mkInput(line.title, '例:受邀参加客户年度安全峰会,做了 20 分钟专题分享', 500);
|
|
1778
|
+
first.setAttribute('data-role', 'line-title');
|
|
1779
|
+
}
|
|
1780
|
+
else {
|
|
1781
|
+
first = mkInput(line.actual, '填写实际结果…', 5000);
|
|
1782
|
+
first.setAttribute('data-role', 'line-actual');
|
|
1783
|
+
}
|
|
1784
|
+
first.setAttribute('data-line', line.key);
|
|
1745
1785
|
var box = el('div', 'rp-box is-quiet');
|
|
1746
|
-
box.appendChild(
|
|
1786
|
+
box.appendChild(first);
|
|
1747
1787
|
row.appendChild(box);
|
|
1748
1788
|
var counts = [
|
|
1749
1789
|
['evidence', 'file', '证据', line.evidence.length, line.evidence.length > 0],
|
|
1750
1790
|
['customer', 'chat', '反馈', 0, trim(line.customerSynced) !== '' || trim(line.customerFeedback) !== ''],
|
|
1751
1791
|
['ids', 'list', '场景', 0, line.scenarioIds.length + line.criteriaIds.length > 0],
|
|
1752
1792
|
];
|
|
1753
|
-
|
|
1793
|
+
var showChips = !extra || lineHasContent(line);
|
|
1794
|
+
for (var i = 0; i < counts.length && showChips; i += 1) {
|
|
1754
1795
|
var spec = at(counts, i);
|
|
1755
1796
|
var button = el('button', 'rp-mini');
|
|
1756
1797
|
button.type = 'button';
|
|
@@ -1797,54 +1838,83 @@ function reportPage() {
|
|
|
1797
1838
|
wrap.appendChild(body);
|
|
1798
1839
|
return wrap;
|
|
1799
1840
|
}
|
|
1841
|
+
/**
|
|
1842
|
+
* The "nothing happened this round" option.
|
|
1843
|
+
*
|
|
1844
|
+
* It is a statement about the whole round, not a chip belonging to one row, so
|
|
1845
|
+
* it takes the full width and carries its own type scale. The previous version
|
|
1846
|
+
* was an inline mini-button: in a project whose last round set no plans it
|
|
1847
|
+
* wrapped onto three lines inside a 174px bordered box, which made the one
|
|
1848
|
+
* control the reader most needs the least legible thing on the page.
|
|
1849
|
+
*/
|
|
1850
|
+
function renderNoProgressChoice(ws) {
|
|
1851
|
+
var label = el('label', 'rp-noop');
|
|
1852
|
+
if (ws.noProgress)
|
|
1853
|
+
label.setAttribute('data-n', '1');
|
|
1854
|
+
var checkbox = el('input', '');
|
|
1855
|
+
checkbox.type = 'checkbox';
|
|
1856
|
+
checkbox.setAttribute('data-role', 'no-progress');
|
|
1857
|
+
checkbox.checked = ws.noProgress;
|
|
1858
|
+
label.appendChild(checkbox);
|
|
1859
|
+
var body = el('span', '');
|
|
1860
|
+
var title = el('span', 'rp-noop-t');
|
|
1861
|
+
setText(title, '本轮无实质进展');
|
|
1862
|
+
body.appendChild(title);
|
|
1863
|
+
var sub = el('span', 'rp-noop-s');
|
|
1864
|
+
setText(sub, '勾选后本轮不用再填进展项,台账里会明确记成「无实质进展」。');
|
|
1865
|
+
body.appendChild(sub);
|
|
1866
|
+
label.appendChild(body);
|
|
1867
|
+
return label;
|
|
1868
|
+
}
|
|
1800
1869
|
function renderProgressSection(ws) {
|
|
1801
1870
|
var input = ws.input;
|
|
1802
|
-
var sec =
|
|
1871
|
+
var sec = worksheetSection(false);
|
|
1803
1872
|
var planned = input.previousPlans.length;
|
|
1804
|
-
|
|
1873
|
+
var done = 0;
|
|
1874
|
+
for (var i = 0; i < ws.lines.length; i += 1) {
|
|
1875
|
+
if (at(ws.lines, i).status === '已完成')
|
|
1876
|
+
done += 1;
|
|
1877
|
+
}
|
|
1878
|
+
sec.appendChild(sectionShell('1', '上次定的计划,做到什么程度了', '逐项反馈。没做完就写没做完,比写成「推进中」有用。', planned ? planned + ' 项 · 已完成 ' + done : '无计划', 'pill'));
|
|
1805
1879
|
var general = el('p', 'rp-err rp-err-general');
|
|
1806
1880
|
general.id = 'rp-round-error';
|
|
1807
1881
|
sec.appendChild(general);
|
|
1808
1882
|
registerRef('round:missing', general);
|
|
1809
1883
|
if (!planned) {
|
|
1810
|
-
var box = el('div', '');
|
|
1811
1884
|
var note = el('p', 'rp-hint');
|
|
1812
1885
|
setText(note, '上一轮没有约定计划,所以没有需要逐项对照的承诺。可以登记这轮实际做的事,或勾选下面的「本轮无实质进展」。');
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
var checkbox = el('input', '');
|
|
1817
|
-
checkbox.type = 'checkbox';
|
|
1818
|
-
checkbox.setAttribute('data-role', 'no-progress');
|
|
1819
|
-
checkbox.checked = ws.noProgress;
|
|
1820
|
-
label.appendChild(checkbox);
|
|
1821
|
-
var span = el('span', '');
|
|
1822
|
-
setText(span, '本轮无实质进展(明确记录)');
|
|
1823
|
-
label.appendChild(span);
|
|
1824
|
-
if (ws.noProgress)
|
|
1825
|
-
label.setAttribute('data-n', '1');
|
|
1826
|
-
box.appendChild(label);
|
|
1827
|
-
sec.appendChild(box);
|
|
1886
|
+
sec.appendChild(note);
|
|
1887
|
+
sec.appendChild(el('div', 'rp-noop-spacer'));
|
|
1888
|
+
sec.appendChild(renderNoProgressChoice(ws));
|
|
1828
1889
|
}
|
|
1829
1890
|
var list = el('div', '');
|
|
1830
1891
|
for (var i = 0; i < ws.lines.length; i += 1) {
|
|
1831
1892
|
var line = at(ws.lines, i);
|
|
1832
|
-
|
|
1893
|
+
// Plan-external rows belong to section 3; rendering them here would show
|
|
1894
|
+
// every extra twice.
|
|
1895
|
+
if (line.editableTitle)
|
|
1896
|
+
continue;
|
|
1897
|
+
list.appendChild(renderLineCard(ws, line, i + 1, false));
|
|
1833
1898
|
}
|
|
1834
1899
|
sec.appendChild(list);
|
|
1835
1900
|
var add = el('button', 'rp-addline');
|
|
1836
1901
|
add.type = 'button';
|
|
1837
1902
|
add.setAttribute('data-act', 'add-line');
|
|
1838
|
-
|
|
1903
|
+
// The no-plan row is a full-width block, so the link under it needs the same
|
|
1904
|
+
// breathing room the design gives it there; under a list of plan cards the
|
|
1905
|
+
// tighter spacing still reads as belonging to the last card.
|
|
1906
|
+
add.style.paddingTop = planned ? '10px' : '18px';
|
|
1839
1907
|
add.appendChild(svgIcon('plus', 12));
|
|
1840
1908
|
addText(add, planned ? '添加一条计划外的进展' : '添加一条进展');
|
|
1841
1909
|
sec.appendChild(add);
|
|
1842
1910
|
return sec;
|
|
1843
1911
|
}
|
|
1844
1912
|
function renderPlansSection(ws, num = '4') {
|
|
1845
|
-
var sec =
|
|
1913
|
+
var sec = worksheetSection(true);
|
|
1846
1914
|
sec.appendChild(sectionShell(num, '下一轮打算做什么', '这里写的,下次就是对照项。', '必选其一'));
|
|
1847
|
-
|
|
1915
|
+
// No error styling on first paint: an unanswered radio group is the normal
|
|
1916
|
+
// starting state, not a mistake. `applyIssues` marks it after a save attempt.
|
|
1917
|
+
var choice = el('div', 'rp-choice');
|
|
1848
1918
|
choice.setAttribute('role', 'group');
|
|
1849
1919
|
choice.setAttribute('aria-label', '下轮计划');
|
|
1850
1920
|
var options = [
|
|
@@ -1925,7 +1995,7 @@ function reportPage() {
|
|
|
1925
1995
|
}
|
|
1926
1996
|
/** The round's own metadata: date, type, what changed. */
|
|
1927
1997
|
function renderRoundStrip(ws, num = '2') {
|
|
1928
|
-
var sec =
|
|
1998
|
+
var sec = worksheetSection(true);
|
|
1929
1999
|
sec.appendChild(sectionShell(num, '这一轮本身', '日期、类型、以及和上一轮相比什么变了', '三项都必填'));
|
|
1930
2000
|
var grid = el('div', 'rp-three');
|
|
1931
2001
|
var date = mkDate(ws.roundDate);
|
|
@@ -1946,7 +2016,7 @@ function reportPage() {
|
|
|
1946
2016
|
return sec;
|
|
1947
2017
|
}
|
|
1948
2018
|
function renderExtraSection(ws) {
|
|
1949
|
-
var sec =
|
|
2019
|
+
var sec = worksheetSection(true);
|
|
1950
2020
|
sec.appendChild(sectionShell('3', '计划之外还做了什么', '临时插入的事也算进展,别让它只活在聊天记录里。', '没有就留空'));
|
|
1951
2021
|
var list = el('div', '');
|
|
1952
2022
|
list.id = 'rp-extras';
|
|
@@ -2095,7 +2165,7 @@ function reportPage() {
|
|
|
2095
2165
|
/** The new-project worksheet: identity + Gate 0, no round required. */
|
|
2096
2166
|
function renderNewProject(ws) {
|
|
2097
2167
|
var wrap = el('div', '');
|
|
2098
|
-
var identity =
|
|
2168
|
+
var identity = worksheetSection(false);
|
|
2099
2169
|
identity.appendChild(sectionShell('1', '项目身份', '谁、哪家、谁负责。阶段和状态由台账维护。', '带 * 必填'));
|
|
2100
2170
|
var grid = el('div', 'rp-two');
|
|
2101
2171
|
var col1 = el('div', 'rp-f');
|
|
@@ -2162,7 +2232,7 @@ function reportPage() {
|
|
|
2162
2232
|
optional.appendChild(grid2);
|
|
2163
2233
|
identity.appendChild(optional);
|
|
2164
2234
|
wrap.appendChild(identity);
|
|
2165
|
-
var gate =
|
|
2235
|
+
var gate = worksheetSection(true);
|
|
2166
2236
|
gate.appendChild(sectionShell('2', 'Gate 0 · 值不值得做', '这五项齐了,G0 评审才有意义。评审结论不在这里填。', '五项必填'));
|
|
2167
2237
|
var areas = [
|
|
2168
2238
|
['whyCustomer', '客户为什么要测', ws.gate0.whyCustomer, '客户自己的痛点与压力,不是我们的卖点'],
|
|
@@ -2184,7 +2254,7 @@ function reportPage() {
|
|
|
2184
2254
|
wrap.appendChild(gate);
|
|
2185
2255
|
// Section 3 owns the whole optional first round, in the order the facts are
|
|
2186
2256
|
// asked for: the round's own metadata, then what was done, then next steps.
|
|
2187
|
-
var extra =
|
|
2257
|
+
var extra = worksheetSection(true);
|
|
2188
2258
|
extra.appendChild(sectionShell('3', '第一轮进展与下一步计划', '不填也能保存。填了就是第一轮记录。', '选填'));
|
|
2189
2259
|
extra.appendChild(renderRoundStrip(ws, ''));
|
|
2190
2260
|
var list = el('div', '');
|
|
@@ -2767,8 +2837,15 @@ function reportPage() {
|
|
|
2767
2837
|
}
|
|
2768
2838
|
return Math.max(n, 1);
|
|
2769
2839
|
}
|
|
2770
|
-
// One line per previous plan, plus date / type / change, plus the choice.
|
|
2771
|
-
|
|
2840
|
+
// One line per previous plan, plus date / type / change, plus the choice. The
|
|
2841
|
+
// blank plan-external row is only counted once it has content.
|
|
2842
|
+
var counted = 0;
|
|
2843
|
+
for (var i = 0; i < ws.lines.length; i += 1) {
|
|
2844
|
+
var line = at(ws.lines, i);
|
|
2845
|
+
if (!line.editableTitle || lineHasContent(line))
|
|
2846
|
+
counted += 1;
|
|
2847
|
+
}
|
|
2848
|
+
var total = counted + 3 + 1;
|
|
2772
2849
|
if (ws.plansChoice === 'has')
|
|
2773
2850
|
total += ws.plans.length * 3;
|
|
2774
2851
|
return Math.max(total, 1);
|
|
@@ -2930,6 +3007,10 @@ function reportPage() {
|
|
|
2930
3007
|
function validateLines(ws, issues) {
|
|
2931
3008
|
for (var i = 0; i < ws.lines.length; i += 1) {
|
|
2932
3009
|
var line = at(ws.lines, i);
|
|
3010
|
+
// The blank plan-external row starts empty on purpose; only a row the
|
|
3011
|
+
// colleague has touched becomes a fact that needs answering.
|
|
3012
|
+
if (line.editableTitle && !lineHasContent(line))
|
|
3013
|
+
continue;
|
|
2933
3014
|
// Name the item by its own goal rather than by an array position: the
|
|
2934
3015
|
// screen shows a plan's title, not "第 2 项", so an index would send the
|
|
2935
3016
|
// reader counting rows to find the field the message is about.
|
|
@@ -3062,6 +3143,8 @@ function reportPage() {
|
|
|
3062
3143
|
var lines = [];
|
|
3063
3144
|
for (var i = 0; i < ws.lines.length; i += 1) {
|
|
3064
3145
|
var line = at(ws.lines, i);
|
|
3146
|
+
if (line.editableTitle && !lineHasContent(line))
|
|
3147
|
+
continue;
|
|
3065
3148
|
var item = {};
|
|
3066
3149
|
if (line.planId !== '')
|
|
3067
3150
|
item.plan_id = line.planId;
|
|
@@ -3632,6 +3715,13 @@ function reportPage() {
|
|
|
3632
3715
|
}
|
|
3633
3716
|
else if (role === 'no-progress') {
|
|
3634
3717
|
ws.noProgress = target.checked === true;
|
|
3718
|
+
var noop = target.parentNode;
|
|
3719
|
+
if (noop && noop.setAttribute) {
|
|
3720
|
+
if (ws.noProgress)
|
|
3721
|
+
noop.setAttribute('data-n', '1');
|
|
3722
|
+
else
|
|
3723
|
+
noop.removeAttribute('data-n');
|
|
3724
|
+
}
|
|
3635
3725
|
var change = app.querySelector('[data-role="round"][data-field="change"]');
|
|
3636
3726
|
if (change) {
|
|
3637
3727
|
change.disabled = ws.noProgress;
|
package/lib/report-style.js
CHANGED
|
@@ -27,7 +27,11 @@
|
|
|
27
27
|
* network. The stacks below degrade to the platform's own Chinese faces.
|
|
28
28
|
*/
|
|
29
29
|
export const REPORT_STYLE = `
|
|
30
|
-
.rp-app
|
|
30
|
+
/* The palette lives on :root, not on .rp-app, because the body element needs the canvas
|
|
31
|
+
colour too. Scoping the variables to the app shell left an 8px browser-default
|
|
32
|
+
margin and a white strip around the whole page — the one thing a document
|
|
33
|
+
opened from file:// must not have. */
|
|
34
|
+
:root{
|
|
31
35
|
--canvas:#EEF0EE; --paper:#FFFFFF;
|
|
32
36
|
--ink:#121A16; --ink2:#4C5651; --ink3:#7E8983; --ink4:#AEB7B2;
|
|
33
37
|
--line:#D9DFDB; --line2:#E9EDEA;
|
|
@@ -39,9 +43,15 @@ export const REPORT_STYLE = `
|
|
|
39
43
|
--sans:"Noto Sans SC","PingFang SC","Hiragino Sans GB","Microsoft YaHei",system-ui,sans-serif;
|
|
40
44
|
--serif:"Noto Serif SC","Songti SC","Source Han Serif SC",Georgia,serif;
|
|
41
45
|
--mono:"IBM Plex Mono",ui-monospace,"SF Mono",Menlo,monospace;
|
|
46
|
+
}
|
|
47
|
+
html,body{
|
|
48
|
+
margin:0; padding:0;
|
|
42
49
|
background:var(--canvas); color:var(--ink);
|
|
43
50
|
font-family:var(--sans); font-size:13px; line-height:1.5;
|
|
44
51
|
-webkit-font-smoothing:antialiased;
|
|
52
|
+
}
|
|
53
|
+
.rp-app{
|
|
54
|
+
background:var(--canvas);
|
|
45
55
|
padding-bottom:100px; margin:0;
|
|
46
56
|
}
|
|
47
57
|
.rp-app *{box-sizing:border-box;margin:0;padding:0}
|
|
@@ -110,6 +120,9 @@ export const REPORT_STYLE = `
|
|
|
110
120
|
.rp-sectitle{font-size:17px;font-weight:600;color:var(--ink);letter-spacing:-.1px}
|
|
111
121
|
.rp-secsub{font-size:11.5px;color:var(--ink3);padding-top:2px}
|
|
112
122
|
.rp-secnote{font-size:11px;color:var(--ink4);flex:none}
|
|
123
|
+
/* Every section after the first opens with a hairline, the way a printed form
|
|
124
|
+
separates its numbered blocks. Without it the page reads as one long scroll. */
|
|
125
|
+
.rp-section-rule{border-top:1px solid var(--line2)}
|
|
113
126
|
.rp-pill{padding:5px 10px;background:var(--quiet);border-radius:2px;font-family:var(--mono);font-size:10.5px;color:var(--ink2);flex:none}
|
|
114
127
|
|
|
115
128
|
/* ---------- plan card ---------- */
|
|
@@ -131,6 +144,11 @@ export const REPORT_STYLE = `
|
|
|
131
144
|
.rp-label{display:flex;align-items:center;gap:6px;font-family:var(--mono);font-size:10px;letter-spacing:.9px;color:var(--ink3);margin-bottom:7px;flex-wrap:wrap}
|
|
132
145
|
.rp-label .rp-req{color:var(--accent)}
|
|
133
146
|
.rp-label .rp-hint{font-family:var(--sans);letter-spacing:0;font-size:10.5px;color:var(--ink4)}
|
|
147
|
+
/* A standalone hint is prose, not a label suffix. Without its own rule it fell
|
|
148
|
+
back to the 13px body size in full ink and read as a paragraph of the form
|
|
149
|
+
itself — the words a colleague skims and ignores are exactly the ones that
|
|
150
|
+
explain what the section wants. */
|
|
151
|
+
p.rp-hint{font-size:12px;line-height:1.7;color:var(--ink3)}
|
|
134
152
|
.rp-box{background:var(--paper);border:1px solid var(--line);border-radius:2px;padding:11px 13px}
|
|
135
153
|
.rp-box.is-quiet{background:var(--quiet);border-color:var(--line2)}
|
|
136
154
|
.rp-box:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
|
|
@@ -159,6 +177,7 @@ export const REPORT_STYLE = `
|
|
|
159
177
|
.rp-chip svg{flex:none}
|
|
160
178
|
|
|
161
179
|
.rp-collapsed{display:flex;align-items:center;gap:14px;padding:12px 16px;border-bottom:1px solid var(--line2);flex-wrap:wrap}
|
|
180
|
+
.rp-collapsed.is-blank{border-bottom:0;padding-bottom:2px}
|
|
162
181
|
.rp-collapsed .rp-box{flex:1 1 200px}
|
|
163
182
|
.rp-collapsed .rp-box input{font-size:12px;color:var(--ink4);font-style:italic}
|
|
164
183
|
.rp-mini{display:inline-flex;align-items:center;gap:5px;padding:6px 10px;flex:none;border:1px solid var(--line);border-radius:2px;background:var(--paper);font-size:10.5px;color:var(--ink2);transition:all .15s}
|
|
@@ -167,6 +186,21 @@ export const REPORT_STYLE = `
|
|
|
167
186
|
.rp-mini[data-n="1"]{border-color:#BBD9C8;background:var(--accent-soft);color:var(--accent)}
|
|
168
187
|
.rp-mini[data-n="1"] svg{color:var(--accent)}
|
|
169
188
|
|
|
189
|
+
/* The "nothing happened this round" option.
|
|
190
|
+
It is a statement about the whole round, not a chip in a row, so it owns the
|
|
191
|
+
full width and keeps its own type scale. Rendered as a bordered inline chip it
|
|
192
|
+
wrapped onto three lines in a 174px box next to nothing — the one control a
|
|
193
|
+
colleague is most likely to reach for, and the least legible thing on screen. */
|
|
194
|
+
.rp-noop{display:flex;align-items:flex-start;gap:11px;width:100%;padding:13px 16px;border:1px solid var(--line);border-radius:2px;background:var(--paper);cursor:pointer;transition:border-color .15s,background .15s}
|
|
195
|
+
.rp-noop:hover{border-color:var(--ink4)}
|
|
196
|
+
.rp-noop:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
|
|
197
|
+
.rp-noop input[type=checkbox]{width:14px;height:14px;margin-top:2px;flex:none;accent-color:var(--accent);cursor:pointer}
|
|
198
|
+
.rp-noop .rp-noop-t{display:block;font-size:13px;font-weight:500;color:var(--ink);transition:color .15s}
|
|
199
|
+
.rp-noop .rp-noop-s{display:block;font-size:11px;line-height:1.5;color:var(--ink3);padding-top:3px}
|
|
200
|
+
.rp-noop[data-n="1"]{border-color:#BBD9C8;background:var(--accent-soft)}
|
|
201
|
+
.rp-noop[data-n="1"] .rp-noop-t{color:var(--accent)}
|
|
202
|
+
.rp-noop-spacer{height:14px}
|
|
203
|
+
|
|
170
204
|
/* ---------- three-up ---------- */
|
|
171
205
|
.rp-three{display:flex;gap:14px;flex-wrap:wrap}
|
|
172
206
|
.rp-three>.rp-f{flex:1 1 28%;margin-bottom:0;min-width:170px}
|
package/lib/types.d.ts
CHANGED
|
@@ -741,6 +741,16 @@ export interface ExportFormResult {
|
|
|
741
741
|
fileCount: number;
|
|
742
742
|
/** How many projects the whole export covers; `0` for a blank form. */
|
|
743
743
|
projectCount: number;
|
|
744
|
+
/**
|
|
745
|
+
* Download name of the archive that carries a batch, or `null` for a batch of
|
|
746
|
+
* one (which downloads as a plain `.html`).
|
|
747
|
+
*
|
|
748
|
+
* The browser allows one automatic download per click, so a multi-project
|
|
749
|
+
* export arrives as a single `.zip` holding the same one-file-per-project set.
|
|
750
|
+
* The name is built on the Host, next to the file names, so the two cannot
|
|
751
|
+
* drift apart over the date format.
|
|
752
|
+
*/
|
|
753
|
+
archiveName: string | null;
|
|
744
754
|
}
|
|
745
755
|
/**
|
|
746
756
|
* Where a blocker comes from.
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ node <skill-dir>/scripts/export-form.mjs --mode fill \
|
|
|
15
15
|
--poc "$HOME/.dsh/cache/work-dashboard/repo/projects/POC-006.yaml" --out /tmp/poc-progress.html
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
`--poc` 支持带 `*` 的路径,使用引号保留通配符。**一个项目一个文件**,文件名是「项目名称_负责人_记录进展_日期.html
|
|
18
|
+
`--poc` 支持带 `*` 的路径,使用引号保留通配符。**一个项目一个文件**,文件名是「项目名称_负责人_记录进展_日期.html」;多选时仍是一个项目一个文件,但下载的是一个 zip(浏览器一次点击只允许一次自动下载),解压后用,绝不合并成一份。只把同一接收者有权查看的项目一起导出。优先刷新看板或读取当前台账;旧项目可以预览,但必须在台账 3.2 迁移完成后重新导出再正式填报。不要用旧版 `poc_form.py`。
|
|
19
19
|
|
|
20
20
|
组员用浏览器打开,无需联网或登录。上轮各计划只读,可以反馈未开始、延期或取消。各项证据分别填写,不借用别项证据。下一步计划会原样带到下次表单;没有就明确选「暂无」。草稿只在本机且绑定此次导出,**不是已发送**。
|
|
21
21
|
|