From 9b31f446bdf729e00307d77acdbe1bd308e1c4f7 Mon Sep 17 00:00:00 2001 From: "Ahtanova.D" Date: Fri, 21 Aug 2026 10:53:29 +0000 Subject: [PATCH] =?UTF-8?q?v3:=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=84=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2=20(=D1=81?= =?UTF-8?q?=D0=BA=D1=80=D0=B5=D0=BF=D0=BA=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 137 ++++++++++++++++++++++++++++++++++++++++++++++++++--- server.js | 72 +++++++++++++++++++++++++++- 2 files changed, 201 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index a2258ed..11af6f5 100644 --- a/index.html +++ b/index.html @@ -24,6 +24,7 @@ .btn-primary:hover { background: #0056b3; } .btn-success { background: #34C759; color: white; } .btn-danger { background: #FF3B30; color: white; padding: 8px 16px; font-size: 13px; } + .btn-secondary { background: #8e8e93; color: white; } table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 14px; } th, td { padding: 12px; text-align: left; border-bottom: 1px solid #e5e5ea; } th { background: #f5f5f7; font-weight: 600; font-size: 13px; color: #6e6e73; text-transform: uppercase; } @@ -32,7 +33,6 @@ .checkbox-group input[type="checkbox"] { width: 20px; height: 20px; margin-top: 2px; } .checkbox-group label { font-size: 14px; line-height: 1.4; cursor: pointer; } .price-highlight { background: #d4edda; font-weight: 600; } - .price-low { background: #fff3cd; } .empty { text-align: center; padding: 40px; color: #86868b; } .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 24px; } .stat { background: white; padding: 20px; border-radius: 12px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.08); } @@ -41,8 +41,17 @@ .conclusion-box { background: #f0f8ff; border: 2px solid #007AFF; border-radius: 12px; padding: 20px; margin-top: 20px; } .signature-block { margin-top: 40px; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; } .signature-line { border-top: 1px solid #1d1d1f; padding-top: 8px; margin-top: 40px; } + .file-list { margin-top: 16px; } + .file-item { display: flex; align-items: center; justify-content: space-between; padding: 12px; background: #f9f9fb; border-radius: 8px; margin-bottom: 8px; } + .file-item a { color: #007AFF; text-decoration: none; font-weight: 500; } + .file-item a:hover { text-decoration: underline; } + .file-meta { font-size: 12px; color: #86868b; margin-left: 12px; } + .upload-area { border: 2px dashed #d2d2d7; border-radius: 12px; padding: 24px; text-align: center; background: #fafafa; cursor: pointer; transition: all 0.2s; } + .upload-area:hover { border-color: #007AFF; background: #f0f8ff; } + .upload-area.dragover { border-color: #34C759; background: #e8f5e9; } + .upload-icon { font-size: 48px; margin-bottom: 12px; } @media print { - .btn, .no-print { display: none !important; } + .btn, .no-print, .upload-area { display: none !important; } .card { box-shadow: none; border: 1px solid #ddd; } } @@ -56,7 +65,7 @@
- +
@@ -81,6 +90,18 @@
+ +
+ +
+
📎
+
Нажмите для загрузки или перетащите файлы сюда
+
DOCX, XLSX, PDF до 10 МБ
+
+ +
+
+ @@ -117,6 +138,17 @@ + +
+ +
+
📎
+
Нажмите для загрузки файлов
+
+ +
+
+ @@ -151,6 +183,17 @@ + +
+ +
+
📎
+
Нажмите для загрузки файлов
+
+ +
+
+ @@ -168,15 +211,15 @@

4Заключение по проверке (ст. 31 Порядка закупок)

- +
- +
- +
@@ -243,10 +286,16 @@

«___» __________ 2026 г.

+ + +
+

📎 Все прикреплённые файлы

+
+
diff --git a/server.js b/server.js index f210fb1..14b1ec7 100644 --- a/server.js +++ b/server.js @@ -1,12 +1,16 @@ const http = require("http"); const fs = require("fs"); const path = require("path"); +const formidable = require("formidable"); const PORT = process.env.PORT || 3000; const DATA = path.join(__dirname, "data.json"); +const UPLOADS = path.join(__dirname, "uploads"); + +if (!fs.existsSync(UPLOADS)) fs.mkdirSync(UPLOADS); function readData() { - try { return JSON.parse(fs.readFileSync(DATA, "utf8")); } catch (_) { return { inputData: null, suppliers: [], offers: [], checks: { c1: false, c2: false, c3: false } }; } + try { return JSON.parse(fs.readFileSync(DATA, "utf8")); } catch (_) { return { inputData: null, suppliers: [], offers: [], checks: { c1: false, c2: false, c3: false }, files: [] }; } } function writeData(data) { fs.writeFileSync(DATA, JSON.stringify(data, null, 2)); @@ -25,6 +29,72 @@ http.createServer(async (req, res) => { return res.end(JSON.stringify(readData())); } + if (req.method === "GET" && req.url === "/api/files") { + const data = readData(); + res.writeHead(200, { "Content-Type": "application/json" }); + return res.end(JSON.stringify(data.files || [])); + } + + if (req.method === "POST" && req.url === "/api/upload") { + const form = formidable({ uploadDir: UPLOADS, keepExtensions: true }); + form.parse(req, async (err, fields, files) => { + if (err) { + res.writeHead(500, { "Content-Type": "application/json" }); + return res.end(JSON.stringify({ error: err.message })); + } + const data = readData(); + const uploaded = []; + if (files.file && Array.isArray(files.file)) { + for (const f of files.file) { + const fileName = Date.now() + "_" + path.basename(f.filepath); + const newPath = path.join(UPLOADS, fileName); + fs.renameSync(f.filepath, newPath); + const fileRec = { + id: Date.now() + Math.random(), + name: f.originalFilename || fileName, + path: "/api/files/" + fileName, + section: fields.section ? fields.section[0] : "other", + size: f.size, + date: new Date().toISOString() + }; + data.files.push(fileRec); + uploaded.push(fileRec); + } + } + writeData(data); + res.writeHead(200, { "Content-Type": "application/json" }); + return res.end(JSON.stringify({ ok: true, files: uploaded })); + }); + return; + } + + if (req.method === "GET" && req.url.startsWith("/api/files/")) { + const fileName = req.url.split("/")[3]; + const filePath = path.join(UPLOADS, fileName); + if (fs.existsSync(filePath)) { + const ext = path.extname(fileName).toLowerCase(); + const mime = ext === ".pdf" ? "application/pdf" : ext === ".docx" ? "application/vnd.openxmlformats-officedocument.wordprocessingml.document" : ext === ".xlsx" ? "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : "application/octet-stream"; + res.writeHead(200, { "Content-Type": mime, "Content-Disposition": "attachment; filename=\"" + fileName + "\"" }); + return res.end(fs.readFileSync(filePath)); + } + res.writeHead(404); res.end("File not found"); + return; + } + + if (req.method === "DELETE" && req.url.startsWith("/api/files/")) { + const fileName = req.url.split("/")[3]; + const data = readData(); + const fileRec = data.files.find(f => f.path.endsWith(fileName)); + if (fileRec) { + const filePath = path.join(UPLOADS, fileName); + if (fs.existsSync(filePath)) fs.unlinkSync(filePath); + data.files = data.files.filter(f => f.path !== fileRec.path); + writeData(data); + } + res.writeHead(200, { "Content-Type": "application/json" }); + return res.end(JSON.stringify({ ok: true })); + } + if (req.method === "POST" && req.url === "/api/inputData") { const d = await body(req); const data = readData();