表格处理

This commit is contained in:
2024-12-04 15:14:45 +08:00
parent 2646d1ae05
commit 1aac9b7d7c
21 changed files with 7771 additions and 34 deletions

465
package-lock.json generated
View File

@@ -11,14 +11,21 @@
"axios": "^0.18.0",
"babel-polyfill": "^6.26.0",
"clipboard": "^2.0.11",
"docx": "^9.0.3",
"docx-preview": "^0.1.4",
"docxtemplater": "^3.54.0",
"echarts": "^5.2.0",
"element-ui": "^2.11.0",
"file-saver": "^2.0.5",
"html-docx-js": "^0.3.1",
"html2canvas": "^1.4.1",
"jszip": "^3.10.1",
"mammoth": "^1.5.1",
"mavon-editor": "^2.6.17",
"multi-items-input": "^0.2.0",
"pizzip": "^3.1.7",
"quill-image-resize-module": "^3.0.0",
"tinymce": "^7.5.1",
"vue": "^2.6.10",
"vue-cropperjs": "^3.0.0",
"vue-i18n": "^8.10.0",
@@ -33,6 +40,8 @@
"devDependencies": {
"@vue/cli-plugin-babel": "^3.9.0",
"@vue/cli-service": "^3.9.0",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"sass-loader": "^7.3.1",
"vue-template-compiler": "^2.6.10"
}
@@ -1632,12 +1641,11 @@
"dev": true
},
"node_modules/@types/node": {
"version": "20.14.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz",
"integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==",
"dev": true,
"version": "22.10.1",
"resolved": "https://registry.npmmirror.com/@types/node/-/node-22.10.1.tgz",
"integrity": "sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==",
"dependencies": {
"undici-types": "~5.26.4"
"undici-types": "~6.20.0"
}
},
"node_modules/@types/normalize-package-data": {
@@ -2903,6 +2911,14 @@
"node": ">=0.10.0"
}
},
"node_modules/base64-arraybuffer": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz",
"integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==",
"engines": {
"node": ">= 0.6.0"
}
},
"node_modules/base64-js": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
@@ -4243,6 +4259,18 @@
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==",
"dev": true
},
"node_modules/copy-anything": {
"version": "2.0.6",
"resolved": "https://registry.npmmirror.com/copy-anything/-/copy-anything-2.0.6.tgz",
"integrity": "sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw==",
"dev": true,
"dependencies": {
"is-what": "^3.14.1"
},
"funding": {
"url": "https://github.com/sponsors/mesqueeb"
}
},
"node_modules/copy-concurrently": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz",
@@ -4578,6 +4606,14 @@
"node": ">4"
}
},
"node_modules/css-line-break": {
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/css-line-break/-/css-line-break-2.1.0.tgz",
"integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==",
"dependencies": {
"utrie": "^1.0.2"
}
},
"node_modules/css-loader": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/css-loader/-/css-loader-1.0.1.tgz",
@@ -5372,6 +5408,22 @@
"buffer-indexof": "^1.0.0"
}
},
"node_modules/docx": {
"version": "9.1.0",
"resolved": "https://registry.npmmirror.com/docx/-/docx-9.1.0.tgz",
"integrity": "sha512-XOtseSTRrkKN/sV5jNBqyLazyhNpWfaUhpuKc22cs+5DavNjRQvchnohb0g0S+x/96/D06U/i0/U/Gc4E5kwuQ==",
"dependencies": {
"@types/node": "^22.7.5",
"hash.js": "^1.1.7",
"jszip": "^3.10.1",
"nanoid": "^5.0.4",
"xml": "^1.0.1",
"xml-js": "^1.6.8"
},
"engines": {
"node": ">=10"
}
},
"node_modules/docx-preview": {
"version": "0.1.20",
"resolved": "https://registry.npmjs.org/docx-preview/-/docx-preview-0.1.20.tgz",
@@ -5380,6 +5432,42 @@
"jszip": ">=3.0.0"
}
},
"node_modules/docx/node_modules/nanoid": {
"version": "5.0.9",
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-5.0.9.tgz",
"integrity": "sha512-Aooyr6MXU6HpvvWXKoVoXwKMs/KyVakWwg7xQfv5/S/RIgJMy0Ifa45H9qqYy7pTCszrHzP21Uk4PZq2HpEM8Q==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"bin": {
"nanoid": "bin/nanoid.js"
},
"engines": {
"node": "^18 || >=20"
}
},
"node_modules/docxtemplater": {
"version": "3.54.1",
"resolved": "https://registry.npmmirror.com/docxtemplater/-/docxtemplater-3.54.1.tgz",
"integrity": "sha512-ZCEAAAmNWh2Ug/jhYNHnjThpEg+urfuvbHAW5NDO6vuGJivxYRuJpYBTS/X36W9uzsuSexFjLt/clg7fOa+kfw==",
"dependencies": {
"@xmldom/xmldom": "^0.9.5"
},
"engines": {
"node": ">=0.10"
}
},
"node_modules/docxtemplater/node_modules/@xmldom/xmldom": {
"version": "0.9.5",
"resolved": "https://registry.npmmirror.com/@xmldom/xmldom/-/xmldom-0.9.5.tgz",
"integrity": "sha512-6g1EwSs8cr8JhP1iBxzyVAWM6BIDvx9Y3FZRIQiMDzgG43Pxi8YkWOZ0nQj2NHgNzgXDZbJewFx/n+YAvMZrfg==",
"engines": {
"node": ">=14.6"
}
},
"node_modules/dom-converter": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz",
@@ -6386,6 +6474,11 @@
"node": ">= 4"
}
},
"node_modules/file-saver": {
"version": "2.0.5",
"resolved": "https://registry.npmmirror.com/file-saver/-/file-saver-2.0.5.tgz",
"integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA=="
},
"node_modules/file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
@@ -7286,6 +7379,24 @@
"integrity": "sha512-7Wn5GMLuHBjZCb2bTmnDOycho0p/7UVaAeqXZGbHrBCl6Yd/xDhQJAXe6Ga9AXJH2I5zY1dEdYw2u1UptnSBJA==",
"dev": true
},
"node_modules/html-docx-js": {
"version": "0.3.1",
"resolved": "https://registry.npmmirror.com/html-docx-js/-/html-docx-js-0.3.1.tgz",
"integrity": "sha512-QSrMiRhxesqxYCa3f+2Z3ttIHPzSjDOL1tCOmIDIEET7HdabxXND6tAbsFMXAgRG4RADQ3wbl74ydMmjidaDPA==",
"dependencies": {
"jszip": "^2.3.0",
"lodash.escape": "^3.0.0",
"lodash.merge": "^3.2.0"
}
},
"node_modules/html-docx-js/node_modules/jszip": {
"version": "2.7.0",
"resolved": "https://registry.npmmirror.com/jszip/-/jszip-2.7.0.tgz",
"integrity": "sha512-JIsRKRVC3gTRo2vM4Wy9WBC3TRcfnIZU8k65Phi3izkvPH975FowRYtKGT6PxevA0XnJ/yO8b0QwV0ydVyQwfw==",
"dependencies": {
"pako": "~1.0.2"
}
},
"node_modules/html-entities": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/html-entities/-/html-entities-1.4.0.tgz",
@@ -7383,6 +7494,18 @@
"object-assign": "^4.0.1"
}
},
"node_modules/html2canvas": {
"version": "1.4.1",
"resolved": "https://registry.npmmirror.com/html2canvas/-/html2canvas-1.4.1.tgz",
"integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==",
"dependencies": {
"css-line-break": "^2.1.0",
"text-segmentation": "^1.0.3"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/htmlparser2": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz",
@@ -7568,6 +7691,19 @@
"node": ">= 4"
}
},
"node_modules/image-size": {
"version": "0.5.5",
"resolved": "https://registry.npmmirror.com/image-size/-/image-size-0.5.5.tgz",
"integrity": "sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==",
"dev": true,
"optional": true,
"bin": {
"image-size": "bin/image-size.js"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/immediate": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
@@ -8311,6 +8447,12 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/is-what": {
"version": "3.14.1",
"resolved": "https://registry.npmmirror.com/is-what/-/is-what-3.14.1.tgz",
"integrity": "sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==",
"dev": true
},
"node_modules/is-whitespace": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/is-whitespace/-/is-whitespace-0.3.0.tgz",
@@ -8633,6 +8775,118 @@
"launch-editor": "^2.8.0"
}
},
"node_modules/less": {
"version": "3.13.1",
"resolved": "https://registry.npmmirror.com/less/-/less-3.13.1.tgz",
"integrity": "sha512-SwA1aQXGUvp+P5XdZslUOhhLnClSLIjWvJhmd+Vgib5BFIr9lMNlQwmwUNOjXThF/A0x+MCYYPeWEfeWiLRnTw==",
"dev": true,
"dependencies": {
"copy-anything": "^2.0.1",
"tslib": "^1.10.0"
},
"bin": {
"lessc": "bin/lessc"
},
"engines": {
"node": ">=6"
},
"optionalDependencies": {
"errno": "^0.1.1",
"graceful-fs": "^4.1.2",
"image-size": "~0.5.0",
"make-dir": "^2.1.0",
"mime": "^1.4.1",
"native-request": "^1.0.5",
"source-map": "~0.6.0"
}
},
"node_modules/less-loader": {
"version": "5.0.0",
"resolved": "https://registry.npmmirror.com/less-loader/-/less-loader-5.0.0.tgz",
"integrity": "sha512-bquCU89mO/yWLaUq0Clk7qCsKhsF/TZpJUzETRvJa9KSVEL9SO3ovCvdEHISBhrC81OwC8QSVX7E0bzElZj9cg==",
"dev": true,
"dependencies": {
"clone": "^2.1.1",
"loader-utils": "^1.1.0",
"pify": "^4.0.1"
},
"engines": {
"node": ">= 4.8.0"
},
"peerDependencies": {
"less": "^2.3.1 || ^3.0.0",
"webpack": "^2.0.0 || ^3.0.0 || ^4.0.0"
}
},
"node_modules/less-loader/node_modules/json5": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/json5/-/json5-1.0.2.tgz",
"integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
"dev": true,
"dependencies": {
"minimist": "^1.2.0"
},
"bin": {
"json5": "lib/cli.js"
}
},
"node_modules/less-loader/node_modules/loader-utils": {
"version": "1.4.2",
"resolved": "https://registry.npmmirror.com/loader-utils/-/loader-utils-1.4.2.tgz",
"integrity": "sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==",
"dev": true,
"dependencies": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^1.0.1"
},
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/less/node_modules/make-dir": {
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/make-dir/-/make-dir-2.1.0.tgz",
"integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==",
"dev": true,
"optional": true,
"dependencies": {
"pify": "^4.0.1",
"semver": "^5.6.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/less/node_modules/mime": {
"version": "1.6.0",
"resolved": "https://registry.npmmirror.com/mime/-/mime-1.6.0.tgz",
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
"dev": true,
"optional": true,
"bin": {
"mime": "cli.js"
},
"engines": {
"node": ">=4"
}
},
"node_modules/less/node_modules/semver": {
"version": "5.7.2",
"resolved": "https://registry.npmmirror.com/semver/-/semver-5.7.2.tgz",
"integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==",
"dev": true,
"optional": true,
"bin": {
"semver": "bin/semver"
}
},
"node_modules/less/node_modules/tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
"dev": true
},
"node_modules/lie": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
@@ -8686,6 +8940,56 @@
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"node_modules/lodash._arraycopy": {
"version": "3.0.0",
"resolved": "https://registry.npmmirror.com/lodash._arraycopy/-/lodash._arraycopy-3.0.0.tgz",
"integrity": "sha512-RHShTDnPKP7aWxlvXKiDT6IX2jCs6YZLCtNhOru/OX2Q/tzX295vVBK5oX1ECtN+2r86S0Ogy8ykP1sgCZAN0A=="
},
"node_modules/lodash._arrayeach": {
"version": "3.0.0",
"resolved": "https://registry.npmmirror.com/lodash._arrayeach/-/lodash._arrayeach-3.0.0.tgz",
"integrity": "sha512-Mn7HidOVcl3mkQtbPsuKR0Fj0N6Q6DQB77CtYncZcJc0bx5qv2q4Gl6a0LC1AN+GSxpnBDNnK3CKEm9XNA4zqQ=="
},
"node_modules/lodash._basecopy": {
"version": "3.0.1",
"resolved": "https://registry.npmmirror.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz",
"integrity": "sha512-rFR6Vpm4HeCK1WPGvjZSJ+7yik8d8PVUdCJx5rT2pogG4Ve/2ZS7kfmO5l5T2o5V2mqlNIfSF5MZlr1+xOoYQQ=="
},
"node_modules/lodash._basefor": {
"version": "3.0.3",
"resolved": "https://registry.npmmirror.com/lodash._basefor/-/lodash._basefor-3.0.3.tgz",
"integrity": "sha512-6bc3b8grkpMgDcVJv9JYZAk/mHgcqMljzm7OsbmcE2FGUMmmLQTPHlh/dFqR8LA0GQ7z4K67JSotVKu5058v1A=="
},
"node_modules/lodash._bindcallback": {
"version": "3.0.1",
"resolved": "https://registry.npmmirror.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz",
"integrity": "sha512-2wlI0JRAGX8WEf4Gm1p/mv/SZ+jLijpj0jyaE/AXeuQphzCgD8ZQW4oSpoN8JAopujOFGU3KMuq7qfHBWlGpjQ=="
},
"node_modules/lodash._createassigner": {
"version": "3.1.1",
"resolved": "https://registry.npmmirror.com/lodash._createassigner/-/lodash._createassigner-3.1.1.tgz",
"integrity": "sha512-LziVL7IDnJjQeeV95Wvhw6G28Z8Q6da87LWKOPWmzBLv4u6FAT/x5v00pyGW0u38UoogNF2JnD3bGgZZDaNEBw==",
"dependencies": {
"lodash._bindcallback": "^3.0.0",
"lodash._isiterateecall": "^3.0.0",
"lodash.restparam": "^3.0.0"
}
},
"node_modules/lodash._getnative": {
"version": "3.9.1",
"resolved": "https://registry.npmmirror.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz",
"integrity": "sha512-RrL9VxMEPyDMHOd9uFbvMe8X55X16/cGM5IgOKgRElQZutpX89iS6vwl64duTV1/16w5JY7tuFNXqoekmh1EmA=="
},
"node_modules/lodash._isiterateecall": {
"version": "3.0.9",
"resolved": "https://registry.npmmirror.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz",
"integrity": "sha512-De+ZbrMu6eThFti/CSzhRvTKMgQToLxbij58LMfM8JnYDNSOjkjTCIaa8ixglOeGh2nyPlakbt5bJWJ7gvpYlQ=="
},
"node_modules/lodash._root": {
"version": "3.0.1",
"resolved": "https://registry.npmmirror.com/lodash._root/-/lodash._root-3.0.1.tgz",
"integrity": "sha512-O0pWuFSK6x4EXhM1dhZ8gchNtG7JMqBtrHdoUFUWXD7dJnNSUze1GuyQr5sOs0aCvgGeI3o/OJW8f4ca7FDxmQ=="
},
"node_modules/lodash.debounce": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz",
@@ -8698,12 +9002,64 @@
"integrity": "sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==",
"dev": true
},
"node_modules/lodash.escape": {
"version": "3.2.0",
"resolved": "https://registry.npmmirror.com/lodash.escape/-/lodash.escape-3.2.0.tgz",
"integrity": "sha512-n1PZMXgaaDWZDSvuNZ/8XOcYO2hOKDqZel5adtR30VKQAtoWs/5AOeFA0vPV8moiPzlqe7F4cP2tzpFewQyelQ==",
"dependencies": {
"lodash._root": "^3.0.0"
}
},
"node_modules/lodash.isarguments": {
"version": "3.1.0",
"resolved": "https://registry.npmmirror.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz",
"integrity": "sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg=="
},
"node_modules/lodash.isarray": {
"version": "3.0.4",
"resolved": "https://registry.npmmirror.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz",
"integrity": "sha512-JwObCrNJuT0Nnbuecmqr5DgtuBppuCvGD9lxjFpAzwnVtdGoDQ1zig+5W8k5/6Gcn0gZ3936HDAlGd28i7sOGQ=="
},
"node_modules/lodash.isplainobject": {
"version": "3.2.0",
"resolved": "https://registry.npmmirror.com/lodash.isplainobject/-/lodash.isplainobject-3.2.0.tgz",
"integrity": "sha512-P4wZnho5curNqeEq/x292Pb57e1v+woR7DJ84DURelKB46lby8aDEGVobSaYtzHdQBWQrJSdxcCwjlGOvvdIyg==",
"dependencies": {
"lodash._basefor": "^3.0.0",
"lodash.isarguments": "^3.0.0",
"lodash.keysin": "^3.0.0"
}
},
"node_modules/lodash.istypedarray": {
"version": "3.0.6",
"resolved": "https://registry.npmmirror.com/lodash.istypedarray/-/lodash.istypedarray-3.0.6.tgz",
"integrity": "sha512-lGWJ6N8AA3KSv+ZZxlTdn4f6A7kMfpJboeyvbFdE7IU9YAgweODqmOgdUHOA+c6lVWeVLysdaxciFXi+foVsWw=="
},
"node_modules/lodash.kebabcase": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz",
"integrity": "sha512-N8XRTIMMqqDgSy4VLKPnJ/+hpGZN+PHQiJnSenYqPaVV/NCqEogTnAdZLQiGKhxX+JCs8waWq2t1XHWKOmlY8g==",
"dev": true
},
"node_modules/lodash.keys": {
"version": "3.1.2",
"resolved": "https://registry.npmmirror.com/lodash.keys/-/lodash.keys-3.1.2.tgz",
"integrity": "sha512-CuBsapFjcubOGMn3VD+24HOAPxM79tH+V6ivJL3CHYjtrawauDJHUk//Yew9Hvc6e9rbCrURGk8z6PC+8WJBfQ==",
"dependencies": {
"lodash._getnative": "^3.0.0",
"lodash.isarguments": "^3.0.0",
"lodash.isarray": "^3.0.0"
}
},
"node_modules/lodash.keysin": {
"version": "3.0.8",
"resolved": "https://registry.npmmirror.com/lodash.keysin/-/lodash.keysin-3.0.8.tgz",
"integrity": "sha512-YDB/5xkL3fBKFMDaC+cfGV00pbiJ6XoJIfRmBhv7aR6wWtbCW6IzkiWnTfkiHTF6ALD7ff83dAtB3OEaSoyQPg==",
"dependencies": {
"lodash.isarguments": "^3.0.0",
"lodash.isarray": "^3.0.0"
}
},
"node_modules/lodash.mapvalues": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/lodash.mapvalues/-/lodash.mapvalues-4.6.0.tgz",
@@ -8716,6 +9072,38 @@
"integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==",
"dev": true
},
"node_modules/lodash.merge": {
"version": "3.3.2",
"resolved": "https://registry.npmmirror.com/lodash.merge/-/lodash.merge-3.3.2.tgz",
"integrity": "sha512-ZgGZpRhWLjivGUbjtApZR4HyLv/UAyoYqESVYkK4aLBJVHRrbFpG+GNnE9JPijliME4LkKM0SFI/WyOiBiv1+w==",
"dependencies": {
"lodash._arraycopy": "^3.0.0",
"lodash._arrayeach": "^3.0.0",
"lodash._createassigner": "^3.0.0",
"lodash._getnative": "^3.0.0",
"lodash.isarguments": "^3.0.0",
"lodash.isarray": "^3.0.0",
"lodash.isplainobject": "^3.0.0",
"lodash.istypedarray": "^3.0.0",
"lodash.keys": "^3.0.0",
"lodash.keysin": "^3.0.0",
"lodash.toplainobject": "^3.0.0"
}
},
"node_modules/lodash.restparam": {
"version": "3.6.1",
"resolved": "https://registry.npmmirror.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz",
"integrity": "sha512-L4/arjjuq4noiUJpt3yS6KIKDtJwNe2fIYgMqyYYKoeIfV1iEqvPwhCx23o+R9dzouGihDAPN1dTIRWa7zk8tw=="
},
"node_modules/lodash.toplainobject": {
"version": "3.0.0",
"resolved": "https://registry.npmmirror.com/lodash.toplainobject/-/lodash.toplainobject-3.0.0.tgz",
"integrity": "sha512-wMI0Ju1bvSmnBS3EcRRH/3zDnZOPpDtMtNDzbbNMKuTrEpALsf+sPyMeogmv63Y11qZQO7H1xFzohIEGRMjPYA==",
"dependencies": {
"lodash._basecopy": "^3.0.0",
"lodash.keysin": "^3.0.0"
}
},
"node_modules/lodash.transform": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/lodash.transform/-/lodash.transform-4.6.0.tgz",
@@ -9286,6 +9674,13 @@
"node": ">=0.10.0"
}
},
"node_modules/native-request": {
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/native-request/-/native-request-1.1.2.tgz",
"integrity": "sha512-/etjwrK0J4Ebbcnt35VMWnfiUX/B04uwGJxyJInagxDqf2z5drSt/lsOvEMWGYunz1kaLZAFrV4NDAbOoDKvAQ==",
"dev": true,
"optional": true
},
"node_modules/negotiator": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
@@ -10185,6 +10580,19 @@
"node": ">=0.10.0"
}
},
"node_modules/pizzip": {
"version": "3.1.7",
"resolved": "https://registry.npmmirror.com/pizzip/-/pizzip-3.1.7.tgz",
"integrity": "sha512-VemVeAQtdIA74AN1Fsd5OmbMbEeS4YOwwlcudgzvmUrOIOPrk1idYC5Tw5FUFq/I0c26ziNOw9z//iPmGfp1jA==",
"dependencies": {
"pako": "^2.1.0"
}
},
"node_modules/pizzip/node_modules/pako": {
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/pako/-/pako-2.1.0.tgz",
"integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug=="
},
"node_modules/pkg-dir": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz",
@@ -11858,8 +12266,7 @@
"node_modules/sax": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
"dev": true
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
},
"node_modules/schart.js": {
"version": "3.0.4",
@@ -13259,6 +13666,14 @@
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="
},
"node_modules/text-segmentation": {
"version": "1.0.3",
"resolved": "https://registry.npmmirror.com/text-segmentation/-/text-segmentation-1.0.3.tgz",
"integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==",
"dependencies": {
"utrie": "^1.0.2"
}
},
"node_modules/thenify": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz",
@@ -13368,6 +13783,11 @@
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
},
"node_modules/tinymce": {
"version": "7.5.1",
"resolved": "https://registry.npmmirror.com/tinymce/-/tinymce-7.5.1.tgz",
"integrity": "sha512-GRXJUB0BEIOUHUEC+q9IjsgWGIAQ4Tn5t5hfpB/YR7No3oPgKHG03v1d3nbov9aqdyVW7Be+UD4I3ZerQG30VQ=="
},
"node_modules/to-arraybuffer": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz",
@@ -13640,10 +14060,9 @@
"integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A=="
},
"node_modules/undici-types": {
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
"dev": true
"version": "6.20.0",
"resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.20.0.tgz",
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="
},
"node_modules/unicode-canonical-property-names-ecmascript": {
"version": "2.0.0",
@@ -14009,6 +14428,14 @@
"node": ">= 0.4.0"
}
},
"node_modules/utrie": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/utrie/-/utrie-1.0.2.tgz",
"integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==",
"dependencies": {
"base64-arraybuffer": "^1.0.2"
}
},
"node_modules/uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
@@ -15312,6 +15739,22 @@
"resolved": "https://registry.npmmirror.com/xe-utils/-/xe-utils-3.5.30.tgz",
"integrity": "sha512-5Ez6JUANpMakduiTLxrNObzqMebnM4697KvHW5okedkUjXvYgGvkbg0tABTkvwDW/Pb09v7vT68dzBOeAuOu0g=="
},
"node_modules/xml": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/xml/-/xml-1.0.1.tgz",
"integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw=="
},
"node_modules/xml-js": {
"version": "1.6.11",
"resolved": "https://registry.npmmirror.com/xml-js/-/xml-js-1.6.11.tgz",
"integrity": "sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==",
"dependencies": {
"sax": "^1.2.4"
},
"bin": {
"xml-js": "bin/cli.js"
}
},
"node_modules/xmlbuilder": {
"version": "10.1.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-10.1.1.tgz",

View File

@@ -8,17 +8,27 @@
"build": "vue-cli-service build"
},
"dependencies": {
"@tinymce/tinymce-vue": "^3.0.1",
"axios": "^0.18.0",
"babel-polyfill": "^6.26.0",
"clipboard": "^2.0.11",
"cnpm": "^9.4.0",
"docx": "^9.1.0",
"docx-preview": "^0.1.4",
"docxtemplater": "^3.54.0",
"echarts": "^5.2.0",
"element-ui": "^2.11.0",
"file-saver": "^2.0.5",
"html-docx-js": "^0.3.1",
"html2canvas": "^1.4.1",
"install": "^0.13.0",
"jszip": "^3.10.1",
"mammoth": "^1.5.1",
"mavon-editor": "^2.6.17",
"multi-items-input": "^0.2.0",
"pizzip": "^3.1.7",
"quill-image-resize-module": "^3.0.0",
"tinymce": "^7.5.1",
"vue": "^2.6.10",
"vue-cropperjs": "^3.0.0",
"vue-i18n": "^8.10.0",
@@ -29,14 +39,13 @@
"vue-ueditor-wrap": "^2.5.6",
"vuedraggable": "^2.17.0",
"vxe-table": "^3.8.19"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.9.0",
"@vue/cli-service": "^3.9.0",
"sass-loader": "^7.3.1",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"sass-loader": "^7.3.1",
"vue-template-compiler": "^2.6.10"
}
}

View File

@@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
<link rel="stylesheet" href="//at.alicdn.com/t/font_830376_qzecyukz0s.css">
<title></title>
</head>
<body>
<noscript>
@@ -13,5 +14,6 @@
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</body><script src="<%=BASE_URL %>/tinymce/tinymce.min.js"></script>
</html>

1
public/tinymce Symbolic link
View File

@@ -0,0 +1 @@
D:/0--------------------xulu/项目/tougao_web/node_modules/.store/tinymce@7.5.1/node_modules/tinymce

View File

@@ -19,8 +19,8 @@ const service = axios.create({
// baseURL: 'https://submission.tmrjournals.com/', //正式 记得切换
// baseURL: 'http://www.tougao.com/', //测试本地 记得切换
// baseURL: 'http://192.168.110.110/tougao/public/index.php/',
// baseURL: '/api', //本地
baseURL: '/', //正式
baseURL: '/api', //本地
// baseURL: '/', //正式
});

View File

@@ -17,8 +17,8 @@ const en = {
labelother: 'close other',
labelall: 'close all'
},
info:{
realname:'English names can only contain uppercase and lowercase letters, "-", and spaces'
info: {
realname: 'English names can only contain uppercase and lowercase letters, "-", and spaces'
},
total: {
author: 'author',
@@ -26,19 +26,19 @@ realname:'English names can only contain uppercase and lowercase letters, "-", a
reviewers: 'reviewer',
admin: 'admin'
},
articleListEditor:{
Continuouspublication:'Continuous publication',
publishInfo:'Are you sure you want to publish this article?',
type:'Type',
edit:'Edit',
add:'Add',
journalType0:'Continuous publication',
journalType1:'Monthly',
journalType3:'Quarterly',
coverImage:'Cover Image',
JournalInstallment:'Journal Installment',
status:'Status',
delete:'Delete',
articleListEditor: {
Continuouspublication: 'Continuous publication',
publishInfo: 'Are you sure you want to publish this article?',
type: 'Type',
edit: 'Edit',
add: 'Add',
journalType0: 'Continuous publication',
journalType1: 'Monthly',
journalType3: 'Quarterly',
coverImage: 'Cover Image',
JournalInstallment: 'Journal Installment',
status: 'Status',
delete: 'Delete',
deleteInfo: 'Are you sure you want to delete this journal installment?',
},
menu: {
@@ -257,7 +257,7 @@ realname:'English names can only contain uppercase and lowercase letters, "-", a
journalArticleCount: 'Journal Article Count',
managingDirector: 'Managing Director',
GroupClassification: 'Group List',
JournalInstallment : 'Journal Installment',
JournalInstallment: 'Journal Installment',
},
home: {
authortop: 'Author guide',
@@ -352,6 +352,18 @@ realname:'English names can only contain uppercase and lowercase letters, "-", a
publicationTime: 'Year',
publicationTimeInfo: 'Year;Volume(issue):Inclusive page numbers.',
},
commonTable: {
add: 'Add',
edit: 'Edit',
rows: 'rows',
columns: 'columns',
table: 'Table',
headerPlaceholder: 'Fill in the header',
typesettingType2: 'Horizontal A4',
typesettingType1: 'Vertical A4',
exportWord: 'Export Word',
exportImg: 'Export PNG',
},
}

View File

@@ -345,6 +345,18 @@ const zh = {
publicationTime: '年份',
publicationTimeInfo: '年份;卷(期):包括页码。',
},
commonTable: {
add: '新增',
edit: '编辑',
rows: '行',
columns: '列',
table: '表格',
headerPlaceholder: '填写表头',
typesettingType2: '横向 A4',
typesettingType1: '竖向 A4',
exportWord: '导出 Word',
exportImg: '导出 图片',
},
}

View File

@@ -19,6 +19,15 @@
<span v-if="Ainfo.refer_state.state" class="el-icon-check pass status"> Complete</span>
<span v-else class="el-icon-pie-chart notPass status"> Pending</span>
</h5>
<div class="con">
<h4>Generate charts </h4>
<p class="mt10"><el-button @click="goGenerateCharts(thisArtcleId)" icon="el-icon-edit" type="text">Edit</el-button></p>
</div>
<div class="con">
<h4>References </h4>
<p class="mt20">A total of <i class="tip">{{Ainfo.refer_state.num}}</i> references in this manuscript is identified.</p>
@@ -73,6 +82,16 @@
}
});
},
// 跳转到图表编辑页面
goGenerateCharts(id){
this.$router.push({
path: 'GenerateCharts',
query: {
id: id
}
});
},
// 隐藏alert
hideAlert(){

View File

@@ -0,0 +1,971 @@
<template>
<div style="height: 98%">
<div class="crumbs">
<el-breadcrumb separator="/">
<el-breadcrumb-item> <i class="el-icon-document-copy"></i> Generate Charts </el-breadcrumb-item>
</el-breadcrumb>
</div>
<div
class="container"
style="height: 97%; min-width: calc(1000px - 300px); width: calc(100% - 300px); background-color: #fafafa; padding: 10px 0 0 0"
>
<h3 class="man_Title">
{{ detailTitle }}
</h3>
<div class="type_MTxt" style="box-sizing: border-box">
<div
v-for="(item, index) in Main_List"
@dragover.prevent
:class="item.p_main_img_id ? 'imgBox' : ''"
@drop="onDrop($event, index)"
>
<p v-html="item.text" v-if="!item.p_main_img_id"></p>
<p v-if="item.p_main_img_id" class="MaxPicture">
<img :src="baseUrl + 'public/mainimg/' + item.content" :style="'width:' + item.width + 'px'" />
<font :style="'width:' + item.width + 'px'">{{ item.note }} </font>
</p>
<font v-if="item.getnum != 0" class="chNumer">{{ item.getnum }}</font>
<b
class="MaxBtn"
@click="MTxtEdit(item, index)"
style="background-color: #006699; right: 40px"
v-if="item.p_main_img_id"
>
<i class="el-icon-edit"></i>
</b>
<!-- <b class="MaxBtn" @click="MTxtPic(item, index)" style="background-color: #13bc20; right: 40px">
<svg
t="1684978324047"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="1967"
width="15"
height="15"
>
<path
d="M512 46.208a42.666667 42.666667 0 0 1 4.992 85.077333L512 131.541333H174.208a42.666667 42.666667 0 0 0-42.368 37.717334l-0.298667 4.949333v487.850667L307.2 501.12a88.874667 88.874667 0 0 1 112.042667-6.570667l5.845333 4.608 150.442667 128.896 101.973333-101.888a88.874667 88.874667 0 0 1 110.122667-12.373333l6.058666 4.138667 104.832 78.592V512a42.666667 42.666667 0 0 1 85.077334-4.992l0.298666 4.992v342.698667a128 128 0 0 1-120.490666 127.786666l-7.509334 0.213334H174.208a128 128 0 0 1-127.786667-120.490667l-0.213333-7.509333V174.208a128 128 0 0 1 120.490667-127.786667l7.509333-0.213333H512zM366.378667 563.2l-1.536 0.853333-233.301334 213.76v76.885334a42.666667 42.666667 0 0 0 37.717334 42.368l4.949333 0.298666H855.893333a42.666667 42.666667 0 0 0 42.368-37.717333l0.298667-4.949333v-151.808l-3.285333-2.090667-152.789334-114.602667a3.541333 3.541333 0 0 0-3.2-0.554666l-1.450666 0.853333-97.28 97.28 76.970666 66.048a42.666667 42.666667 0 0 1-51.2 68.010667l-4.309333-3.2-292.437333-250.666667a3.541333 3.541333 0 0 0-3.2-0.768z m415.829333-516.992a42.666667 42.666667 0 0 1 42.410667 37.717333l0.256 4.949334v96h96a42.666667 42.666667 0 0 1 4.992 85.077333l-4.992 0.256h-96v96a42.666667 42.666667 0 0 1-85.034667 4.992l-0.298667-4.992v-96h-96a42.666667 42.666667 0 0 1-4.949333-85.034667l4.949333-0.298666h96v-96a42.666667 42.666667 0 0 1 42.666667-42.666667z"
fill="#ffffff"
p-id="1968"
></path>
</svg>
</b> -->
<!-- <b class="MaxBtn" @click="MTxtTable(item, index)" style="background-color: #e07404; right: 0px">
<i class="el-icon-document-add"></i>
</b> -->
<b
class="MaxBtn"
@click="MTxtDelet(item, index)"
style="background-color: #bc1a13; right: 0px"
v-if="item.p_main_img_id"
>
<i class="el-icon-delete"></i>
</b>
</div>
</div>
<div style="height: 20px" v-if="Art_Doi == undefined"></div>
<div style="margin: 20px 0 0 0; text-align: center; padding-bottom: 30px" v-if="Art_Doi != undefined">
<el-button icon="el-icon-finished" type="primary" style="width: 350px" @click="pushOnline()"> Push Online </el-button>
</div>
</div>
<div
class="right-side"
style="
width: 300px;
position: fixed;
right: 20px;
top: 17vh;
bottom: 10px;
background-color: #fff;
box-shadow: 0 1px 3px rgb(16 17 19 / 6%);
border-radius: 4px;
"
>
<p style="padding: 10px 10px; box-sizing: border-box; font-weight: bold">
Unfettered area
<b class="MaxBtn" @click="MTxtPic()" style="background-color: #13bc20; right: 40px; top: 5px">
<svg
t="1684978324047"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="1967"
width="15"
height="15"
>
<path
d="M512 46.208a42.666667 42.666667 0 0 1 4.992 85.077333L512 131.541333H174.208a42.666667 42.666667 0 0 0-42.368 37.717334l-0.298667 4.949333v487.850667L307.2 501.12a88.874667 88.874667 0 0 1 112.042667-6.570667l5.845333 4.608 150.442667 128.896 101.973333-101.888a88.874667 88.874667 0 0 1 110.122667-12.373333l6.058666 4.138667 104.832 78.592V512a42.666667 42.666667 0 0 1 85.077334-4.992l0.298666 4.992v342.698667a128 128 0 0 1-120.490666 127.786666l-7.509334 0.213334H174.208a128 128 0 0 1-127.786667-120.490667l-0.213333-7.509333V174.208a128 128 0 0 1 120.490667-127.786667l7.509333-0.213333H512zM366.378667 563.2l-1.536 0.853333-233.301334 213.76v76.885334a42.666667 42.666667 0 0 0 37.717334 42.368l4.949333 0.298666H855.893333a42.666667 42.666667 0 0 0 42.368-37.717333l0.298667-4.949333v-151.808l-3.285333-2.090667-152.789334-114.602667a3.541333 3.541333 0 0 0-3.2-0.554666l-1.450666 0.853333-97.28 97.28 76.970666 66.048a42.666667 42.666667 0 0 1-51.2 68.010667l-4.309333-3.2-292.437333-250.666667a3.541333 3.541333 0 0 0-3.2-0.768z m415.829333-516.992a42.666667 42.666667 0 0 1 42.410667 37.717333l0.256 4.949334v96h96a42.666667 42.666667 0 0 1 4.992 85.077333l-4.992 0.256h-96v96a42.666667 42.666667 0 0 1-85.034667 4.992l-0.298667-4.992v-96h-96a42.666667 42.666667 0 0 1-4.949333-85.034667l4.949333-0.298666h96v-96a42.666667 42.666667 0 0 1 42.666667-42.666667z"
fill="#ffffff"
p-id="1968"
></path>
</svg> </b
><b class="MaxBtn" @click="MTxtTable()" style="background-color: #e07404; right: 0px; top: 5px">
<i class="el-icon-document-add"></i>
</b>
</p>
<div class="unfetteredBox">
<div
:style="item.isHidden ? 'opacity:0.2' : 'opacity:1'"
v-for="(item, index) in images"
:key="index"
class="image"
draggable="true"
@dragstart="onDragStart($event, item, index)"
>
<img :src="baseUrl + 'public/mainimg/' + item.content" style="width: 100%; height: 100%; object-fit: cover" />
</div>
</div>
</div>
<!--修改文本 -->
<el-dialog title="Edit Text" :visible.sync="txtVisible" width="800px" :close-on-click-modal="false">
<el-form ref="editMes" :model="txtStyle" label-width="1px">
<p style="margin: 0 5px 15px 5px; line-height: 18px; font-size: 13px; color: #aaa">{{ exegesis }}</p>
<el-form-item label="">
<el-input type="textarea" placeholder="Please enter the table content..." v-model="txtStyle.text" autosize> </el-input>
</el-form-item>
</el-form>
<p class="type_Gbtn" @click="trsanGtp">
<i class="el-icon-document-copy" style="margin-right: 5px" v-if="btnDisble"></i>
<i class="el-icon-loading" style="margin-right: 5px" v-if="!btnDisble"></i>
TMRGTP Proofreading
</p>
<div class="type_CHar" v-if="txtStyle.ChGtpTxt != ''">
<p v-html="txtStyle.ChGtpTxt"></p>
<font class="chReple" @click="replceChGpr(item)">Replace</font>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="txtVisible = false"> Cancel </el-button>
<el-button type="primary" @click="saveTxt">
<i class="el-icon-finished" style="margin-right: 5px"></i>
Save
</el-button>
</span>
</el-dialog>
<!--添加/修改图片 -->
<el-dialog :title="picStyle.visiTitle" :visible.sync="pictVisible" width="800px" :close-on-click-modal="false">
<el-form ref="editMes" :model="picStyle" label-width="150px">
<el-form-item>
<span slot="label">
<font style="color: #f56c6c; margin-right: 5px">*</font>
Picture :
</span>
<el-upload
class="avatar-uploader"
:action="'/api/api/Production/up_mainimg_file'"
:show-file-list="false"
name="mainimg"
:on-success="handleAvatarSuccess"
:on-error="handleAvatarError"
:before-upload="beforeAvatarUpload"
>
<img v-if="picStyle.imageUrl" :src="picStyle.imageUrl" class="avatar" />
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
<!-- <el-form-item label="Bottom Title :">
<el-input placeholder="Please enter the table title..." v-model="picStyle.titleBot">
</el-input>
</el-form-item> -->
<el-form-item label="Picture Describe :">
<el-input placeholder="Please enter the table describe..." v-model="picStyle.note" type="textarea" :rows="3">
</el-input>
</el-form-item>
</el-form>
<p style="margin: 20px 0; text-align: right">
<el-button
type="warning"
plain
@click="
picStyle.picUrl = '';
picStyle.titleBot = '';
picStyle.note = '';
picStyle.imageUrl = '';
"
>
<i class="el-icon-refresh" style="margin-right: 5px"></i>Empty
</el-button>
</p>
<div class="lineStyle" v-if="picStyle.picUrl != ''">
<div>
<span class="title" style="margin-left: 25px">Picture Width :</span>
<el-input v-model="picStyle.width" style="width: 120px">
<template slot="append">px</template>
</el-input>
</div>
</div>
<div style="padding: 0 20px" v-if="picStyle.picUrl != ''">
<div style="text-align: center">
<img :src="baseUrl + 'public/mainimg/' + picStyle.picUrl" :style="'width:' + picStyle.width + 'px'" />
</div>
<p style="text-align: center; margin: 10px 0 15px 0; font-size: 12px; color: #006699">
<b>{{ picStyle.titleBot }}</b>
</p>
<p
style="text-align: center; margin: 10px auto 0; font-size: 12px; line-height: 22px"
:style="'width:' + picStyle.width + 'px'"
v-html="picStyle.note"
></p>
</div>
<span slot="footer" class="dialog-footer" v-if="picStyle.picUrl != ''">
<el-button @click="pictVisible = false"> Cancel </el-button>
<el-button type="primary" @click="savePic">
<i class="el-icon-finished" style="margin-right: 5px"></i>
Save Picture
</el-button>
</span>
</el-dialog>
<!-- 添加表格 -->
<el-dialog title="Insert Table" :visible.sync="threeVisible" width="1200px" :close-on-click-modal="false" >
<el-form ref="editMes" :model="lineStyle" label-width="115px">
<el-form-item label="Top Title :">
<el-input placeholder="Please enter the table title..." v-model="lineStyle.titleTop"> </el-input>
</el-form-item>
<el-form-item label="Word">
<span slot="label">
<font style="color: #f56c6c; margin-right: 5px">*</font>
Content :
</span>
<common-table ref="commonTable" style="margin-left: -115px;" :lineStyle="lineStyle"></common-table>
</el-form-item>
<el-form-item label="Bottom Title :">
<el-input placeholder="Please enter the table title..." v-model="lineStyle.titleBot"> </el-input>
</el-form-item>
</el-form>
<p style="margin: 20px 0; text-align: right">
<el-button
type="warning"
plain
@click="
lineStyle.textarea = '';
lineStyle.titleTop = '';
lineStyle.titleBot = '';
lineTable = [];
"
>
<i class="el-icon-refresh" style="margin-right: 5px"></i>Empty
</el-button>
<el-button type="primary" plain @click="CopyExcelToTable">
<i class="el-icon-sort" style="margin-right: 5px"></i>Generate Table
</el-button>
</p>
<div class="lineStyle" v-if="lineTable.length != 0">
<div>
<span class="title">Table All Width :</span>
<el-input v-model="lineStyle.tabwith" style="width: 120px">
<template slot="append">%</template>
</el-input>
</div>
<div>
<div v-for="(item, index) in lineStyle.arrwith" class="styArry">
<span class="title"
>Column <b style="color: #006699">{{ index + 1 }}</b> :</span
>
<el-input v-model="lineStyle.arrwith[index]" style="width: 100px">
<template slot="append">%</template>
</el-input>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveLine" v-if="lineTable.length != 0">
<i class="el-icon-finished" style="margin-right: 5px"></i>
Save Table
</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { del } from 'vue';
export default {
data() {
return {
images: [
{
p_main_img_id: 157,
p_article_id: 2141,
p_main_id: 101853,
pre_id: 0,
width: 500,
content: '20240906/7c4cfd8f431cddf05f33634d4ee2cdca.jpg',
note: 'Figure 1 Oracle bone inscriptions of YANG',
ctime: 0,
state: 0
}
],
baseUrl: this.Common.baseUrl,
baseUrl: 'https://submission.tmrjournals.com/',
mediaUrl: this.Common.mediaUrl,
Art_Id: this.$route.query.id,
Art_Doi: this.$route.query.doi,
Art_web_Id: this.$route.query.artID,
Art_P_Id: '',
btnDisble: true,
detailTitle: '',
Main_List: [],
txtStyle: {
text: '',
ChGtpTxt: ''
},
txtVisible: false,
lineStyle: {
titleTop: '',
titleBot: '',
textarea: '',
tableData: [],
tabwith: '100',
arrwith: []
},
lineTable: [],
threeVisible: false,
picStyle: {
titleBot: '',
note: '',
// picUrl: 'https://www.tmrjournals.cn/public/articleHTML/TMR/TMR20230213002/images/alternativeImage/TMR20230213002-F004.jpg',
picUrl: '',
imageUrl: '',
width: '500'
},
pictVisible: false,
typesettingType: 1,
exegesis: "The following contents'<b></b>,<i></i>'are necessary for the generation phase, please do not delete them!!!"
};
},
created() {
this.getDate();
},
methods: {
onDragStart(event, image, index) {
event.dataTransfer.setData('image', JSON.stringify({ ...image, isNewReformat: true }));
event.dataTransfer.setData('imageIndex', index);
},
onDrop(event, index) {
console.log('index at line 297:', index);
const draggedImage = JSON.parse(event.dataTransfer.getData('image'));
const draggedImageIndex = JSON.parse(event.dataTransfer.getData('imageIndex'));
console.log('draggedImage at line 298:', draggedImage);
this.Main_List.splice(index, 0, draggedImage);
this.images[draggedImageIndex].isHidden = true;
},
// 获取数据
getDate() {
let urlLInk = '';
let urlTask = {};
if (this.Art_Id != undefined) {
urlLInk = 'api/Production/getProductionMains';
urlTask.p_article_id = this.Art_Id;
}
// if (this.Art_Doi != undefined) {
// urlLInk = 'api/Production/getProductionMainsByDoi';
// urlTask.doi = this.Art_Doi;
// }
const loading = this.$loading({
lock: true,
text: 'Loading...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
// 获取文章信息
this.$api
.post(urlLInk, urlTask)
.then((res) => {
if (res.code == 0) {
this.detailTitle = res.data.production.title;
this.Art_P_Id = res.data.production.p_article_id;
this.Main_List = res.data.mains;
for (let i = 0; i < this.Main_List.length; i++) {
this.Main_List[i].text = this.Main_List[i].content;
this.Main_List[i].getnum = 0;
}
loading.close();
} else {
this.$message.error(res.msg);
loading.close();
}
})
.catch((err) => {
this.$message.error(err);
loading.close();
});
},
// 修改段落/图片
MTxtEdit(val, num) {
this.picStyle = JSON.parse(JSON.stringify(val));
this.picStyle.picUrl = this.picStyle.content;
this.picStyle.imageUrl = this.baseUrl + 'public/mainimg/' + this.picStyle.content;
this.picStyle.visiTitle = 'Edit Picture';
this.pictVisible = true;
},
// 转化为gpt标准格式
trsanGtp() {
if (this.btnDisble) {
this.btnDisble = false;
this.$api
.post('api/Production/mainGptcheck', {
p_main_id: this.txtStyle.p_main_id
})
.then((res) => {
if (res.code == 0) {
this.txtStyle.ChGtpTxt = res.data.content;
this.btnDisble = true;
// this.$forceUpdate()
this.$message.success('Converting success!');
} else {
this.btnDisble = true;
this.$message.error('Converting fail!');
}
})
.catch((err) => {
this.btnDisble = true;
this.$message.error('Converting fail!');
});
} else {
this.$message.warning('Converting, please wait!');
}
},
// 替换Gtp生成的内容
replceChGpr(val) {
this.txtStyle.text = JSON.parse(JSON.stringify(this.txtStyle.ChGtpTxt));
},
// 确定保存段落修改
saveTxt() {
this.$api
.post('api/Production/editProductionMain', {
p_main_id: this.txtStyle.p_main_id,
content: this.txtStyle.text
})
.then((res) => {
if (res.code == 0) {
this.$message.success('Successfully edit text!');
this.txtVisible = false;
this.getDate();
// this.Main_List[this.txtStyle.index].text = JSON.parse(JSON.stringify(this.txtStyle.text))
} else {
this.$message.error(res.msg);
}
})
.catch((err) => {
this.$message.error(err);
});
},
// 图片段落
MTxtPic(val, num) {
this.picStyle.pre_type = 'img';
// this.picStyle.body = val.p_main_img_id;
this.picStyle.p_article_id = this.Art_P_Id;
this.picStyle.titleBot = '';
this.picStyle.note = '';
this.picStyle.width = '500';
this.picStyle.picUrl = '';
this.picStyle.imageUrl = '';
this.picStyle.visiTitle = 'Insert Picture Backward';
this.pictVisible = true;
},
// 确定保存图片
savePic() {
this.picStyle.content = this.picStyle.picUrl;
this.images.push(this.picStyle);
this.pictVisible = false;
return false;
//要走接口
if (this.picStyle.note == '') {
this.$message.error('Please fill in the picture describe!');
return;
}
this.picStyle.content = this.picStyle.picUrl;
if (this.picStyle.visiTitle == 'Edit Picture') {
this.$api
.post('api/Production/editProductionMainImg', this.picStyle)
.then((res) => {
if (res.code == 0) {
this.$message.success('Successfully edit image!');
this.pictVisible = false;
this.getDate();
} else {
this.$message.error(res.msg);
}
})
.catch((err) => {
this.$message.error(err);
});
} else {
this.$api
.post('api/Production/addProductionMainImg', this.picStyle)
.then((res) => {
if (res.code == 0) {
this.$message.success('Successfully added image!');
this.pictVisible = false;
this.getDate();
} else {
this.$message.error(res.msg);
}
})
.catch((err) => {
this.$message.error(err);
});
}
},
async removeEvent(row) {
// const type = await VXETable.modal.confirm('您确定要删除该数据?')
const $table = this.$refs.xTable;
// if (type === 'confirm') {
$table.remove(row);
// }
},
async insertEvent(row) {
const $table = this.$refs.xTable;
const record = {};
const { row: newRow } = await $table.insertAt(record, row);
await $table.setEditCell(newRow, 'name');
},
// 表格段落
MTxtTable(val, num) {
// this.lineStyle.p_main_id = val.p_main_id;
this.lineStyle.textarea = '';
this.lineStyle.titleCon = '';
this.lineTable = [];
this.threeVisible = true;
this.typesettingType = '1';
this.$forceUpdate();
},
// 表格转化
CopyExcelToTable() {
if (this.lineStyle.textarea == '') {
this.$message.error('Please fill in the table content!');
return;
}
console.log(this.lineStyle.textarea);
let txtRows = this.lineStyle.textarea.split('\n');
let txtColum = [];
for (let i = 0; i < txtRows.length; i++) {
if (txtRows[i] != '') {
let columns = txtRows[i].split('\t');
let dataone = [];
for (let j = 0; j < columns.length; j++) {
dataone.push(columns[j]);
}
txtColum.push(dataone);
}
}
let arrwithNumer = Math.floor(100 / txtColum[0].length) - 2;
this.lineStyle.arrwith = [];
for (let i = 0; i < txtColum[0].length; i++) {
this.lineStyle.arrwith.push(arrwithNumer);
}
this.lineTable = txtColum;
},
// 确定保存表格
saveLine() {
let dataTable = '';
for (let i = 0; i < this.lineTable.length; i++) {
let ArryDr = '';
let listHNem = '';
for (let j = 0; j < this.lineTable[i].length; j++) {
let ArrHtml =
'<div style="width:' +
this.lineStyle.arrwith[j] +
'%;line-height: 22px;vertical-align: middle;display: inline-block;padding: 0 1%;font-size: 14px;color: #606266;word-wrap: break-word;word-break: normal;">' +
this.lineTable[i][j] +
'</div>';
ArryDr = ArryDr + ArrHtml;
}
if (i == 0) {
listHNem =
'<div style="display: flex;border-top: 2px solid #333333;border-bottom: 1px solid #333333;padding: 10px 0;font-weight: bold;margin-bottom: 20px;">' +
ArryDr +
'</div>';
} else if (i == this.lineTable.length - 1) {
listHNem = '<div style="display: flex;border-bottom: 2px solid #333333;padding:0 0 20px 0;">' + ArryDr + '</div>';
ArryDr = ArryDr + listHNem;
} else {
listHNem = '<div style="display: flex;padding:20px 0;">' + ArryDr + '</div>';
}
dataTable = dataTable + listHNem;
}
dataTable = '<div style="width:' + this.lineStyle.tabwith + '%">' + dataTable + '</div>';
if (this.lineStyle.titleTop != '') {
dataTable =
'<p style="text-align: center;margin: 0 0 10px 0;font-size: 12px;color: #006699;"><b>' +
this.lineStyle.titleTop +
'</b></p>' +
dataTable;
}
if (this.lineStyle.titleBot != '') {
dataTable =
dataTable + '<p style="text-align: center;margin: 10px 0 0 0;font-size: 12px;">' + this.lineStyle.titleBot + '</p>';
}
console.log(dataTable);
},
// 删除段落/图片
MTxtDelet(val, index) {
var imageIndex = this.images.findIndex((e) => e.p_main_img_id == val.p_main_img_id);
if (imageIndex > -1) {
delete this.images[imageIndex].isHidden;
} else {
this.images.push(val);
}
this.$forceUpdate();
this.Main_List.splice(index, 1);
console.log('this.images.push at line 654:', this.images);
// this.$api
// .post('api/Production/delProductionMainImg', {
// p_main_img_id: val.p_main_img_id
// })
// .then((res) => {
// if (res.code == 0) {
// this.$message.success('Successfully deleted!');
// this.getDate();
// // this.Main_List.splice(num, 1);
// } else {
// this.$message.error(res.msg);
// }
// })
// .catch((err) => {
// this.$message.error(err);
// });
},
// 推送
pushOnline() {
// 二次确认
this.$confirm('Are you sure you want to push it to the official website?', 'Tips', {
type: 'warning'
})
.then(() => {
this.$api
.post('api/Production/pushMainToWeb', {
article_id: this.Art_web_Id,
p_article_id: this.Art_P_Id
})
.then((res) => {
if (res.code == 0) {
this.$message.success('Successfully push!');
this.getDate();
if (this.Art_Doi != undefined) {
this.$router.push({
path: 'comArtHtmlEdit',
query: {
artID: this.Art_web_Id
}
});
}
} else {
this.$message.error(res.msg);
}
})
.catch((err) => {
this.$message.error(err);
});
})
.catch(() => {});
},
// 上传图片
handleAvatarSuccess(res, file) {
if (res.code == 0) {
this.picStyle.picUrl = res.upurl;
this.$forceUpdate();
} else {
this.$message.error(res.msg);
}
this.picStyle.imageUrl = URL.createObjectURL(file.raw);
},
handleAvatarError(res, file) {},
beforeAvatarUpload(file) {
const isLt2M = file.size / 1024 / 1024 < 1;
if (!isLt2M) {
this.$message.error('Picture size cannot exceed 1M!');
}
return isLt2M;
}
}
};
</script>
<style scoped>
.lineStyle {
border-top: 1px solid #0066994d;
padding: 20px 20px 40px 20px;
}
.lineStyle > div {
}
.lineStyle > div span.title {
font-size: 14px;
color: #606266;
margin: 0px 10px 0px 0px;
}
.lineStyle > div font.mark {
font-size: 14px;
color: #606266;
margin: 0px 0px 0px 10px;
}
.lineStyle .styArry {
display: inline-block;
margin: 15px 40px 0 0;
}
.lineStyle .styArry:nth-last-child(1) {
margin-right: 0;
}
.lineAll {
margin: 0 auto;
}
.lineAll .lineTit {
padding: 0 0 20px 0;
font-size: 14px;
}
.lineAll .lineTit:nth-child(1) {
border-top: 2px solid #333333;
border-bottom: 1px solid #333333;
padding: 10px 0;
font-weight: bold;
}
.lineAll .lineTit:nth-child(2) {
padding-top: 20px;
}
.lineAll .lineTit:nth-last-child(1) {
border-bottom: 2px solid #333333;
}
.lineAll .lineTit > div {
line-height: 22px;
vertical-align: middle;
display: inline-block;
padding: 0 1%;
}
.man_Title {
background-color: #fff;
margin: 0 0 10px 0;
border-bottom: 1px solid #dde1eb;
box-shadow: 0 5px 5px -2px rgb(134 134 134);
padding: 12px 25px 8px 25px;
font-size: 16px;
line-height: 24px;
color: #333;
position: relative;
}
.man_Title button {
position: absolute;
top: 10px;
right: 10px;
}
.type_MTxt {
background-color: #fff;
padding: 0 10px 10px 10px;
box-shadow: 0 1px 3px rgb(16 17 19 / 6%);
position: relative;
}
.type_MTxt > div {
position: relative;
padding: 8px 15px;
min-height: 22px;
border: 2px dashed #fff;
border-radius: 5px;
color: #606266;
}
.type_MTxt > .imgBox:hover {
background-color: rgb(0 102 153 / 10%);
border: 2px dashed rgb(0 102 153 / 50%);
}
.type_MTxt > div > p {
font-size: 14px;
line-height: 22px;
}
.type_MTxt > .imgBox .chNumer {
position: absolute;
top: -2px;
right: -1px;
border-radius: 3px;
font-size: 10px;
background-color: rgb(0 102 153 / 85%);
color: #fff;
padding: 0 6px;
}
.type_MTxt > div .MaxPicture {
text-align: center;
}
.type_MTxt > div .MaxPicture > img {
margin-bottom: 10px;
}
.type_MTxt > div .MaxPicture > font {
display: block;
margin: 0 auto;
font-size: 13px;
}
.MaxBtn {
position: absolute;
right: 0;
top: -1px;
color: #fff;
border-radius: 50px;
font-size: 15.5px;
padding: 6px 7px;
display: none;
opacity: 0.75;
}
.MaxBtn {
display: block;
}
.MaxBtn:hover {
opacity: 1;
cursor: pointer;
}
.type_Gbtn {
color: #fff;
border-color: #006699;
background: #006699;
width: 30%;
text-align: center;
padding: 8px 0;
font-size: 14px;
border-radius: 8px;
font-weight: 500;
margin: 0 auto;
}
.type_Gbtn:hover {
box-shadow: 0 4px 14px rgb(0 102 153 / 30%);
cursor: pointer;
}
.type_CHar {
position: relative;
border-left: 4px solid rgba(0 102 153 / 20%);
border-radius: 5px;
padding: 20px 25px 15px 20px;
background-color: #fff;
margin: 20px 0 0 0;
font-size: 14px;
line-height: 22px;
box-shadow: 0 1px 10px rgb(0 102 153 / 20%);
}
.type_CHar .chReple {
position: absolute;
top: -1px;
right: 1px;
border-radius: 3px;
font-size: 10px;
background-color: rgb(223 109 11);
opacity: 0.85;
color: #fff;
padding: 1px 10px;
}
.type_CHar .chReple:hover {
opacity: 1;
cursor: pointer;
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
width: 100px;
height: 100px;
}
.avatar-uploader_small {
height: 100px;
}
.avatar-uploader .el-upload:hover {
border-color: #409eff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 120px;
height: 120px;
line-height: 120px;
text-align: center;
}
.avatar-uploader_small .el-upload {
width: 80px;
height: 80px;
}
.avatar-uploader_small .avatar-uploader-icon {
line-height: 80px;
margin-left: -30px;
}
.avatar {
width: 120px;
height: 120px;
display: block;
}
.unfetteredBox {
display: flex;
flex-wrap: wrap;
padding: 0 10px;
box-sizing: border-box;
}
.unfetteredBox .image {
margin-top: 10px;
box-shadow: rgba(16, 17, 19, 0.5) 0px 1px 3px;
margin-right: 10px;
height: 60px;
width: 60px;
border-radius: 4px;
overflow: hidden;
}
</style>

View File

@@ -0,0 +1,971 @@
<template>
<div style="height: 98%">
<div class="crumbs">
<el-breadcrumb separator="/">
<el-breadcrumb-item> <i class="el-icon-document-copy"></i> Generate Charts </el-breadcrumb-item>
</el-breadcrumb>
</div>
<div
class="container"
style="height: 97%; min-width: calc(1000px - 300px); width: calc(100% - 300px); background-color: #fafafa; padding: 10px 0 0 0"
>
<h3 class="man_Title">
{{ detailTitle }}
</h3>
<div class="type_MTxt" style="box-sizing: border-box">
<div
v-for="(item, index) in Main_List"
@dragover.prevent
:class="item.p_main_img_id ? 'imgBox' : ''"
@drop="onDrop($event, index)"
>
<p v-html="item.text" v-if="!item.p_main_img_id"></p>
<p v-if="item.p_main_img_id" class="MaxPicture">
<img :src="baseUrl + 'public/mainimg/' + item.content" :style="'width:' + item.width + 'px'" />
<font :style="'width:' + item.width + 'px'">{{ item.note }} </font>
</p>
<font v-if="item.getnum != 0" class="chNumer">{{ item.getnum }}</font>
<b
class="MaxBtn"
@click="MTxtEdit(item, index)"
style="background-color: #006699; right: 40px"
v-if="item.p_main_img_id"
>
<i class="el-icon-edit"></i>
</b>
<!-- <b class="MaxBtn" @click="MTxtPic(item, index)" style="background-color: #13bc20; right: 40px">
<svg
t="1684978324047"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="1967"
width="15"
height="15"
>
<path
d="M512 46.208a42.666667 42.666667 0 0 1 4.992 85.077333L512 131.541333H174.208a42.666667 42.666667 0 0 0-42.368 37.717334l-0.298667 4.949333v487.850667L307.2 501.12a88.874667 88.874667 0 0 1 112.042667-6.570667l5.845333 4.608 150.442667 128.896 101.973333-101.888a88.874667 88.874667 0 0 1 110.122667-12.373333l6.058666 4.138667 104.832 78.592V512a42.666667 42.666667 0 0 1 85.077334-4.992l0.298666 4.992v342.698667a128 128 0 0 1-120.490666 127.786666l-7.509334 0.213334H174.208a128 128 0 0 1-127.786667-120.490667l-0.213333-7.509333V174.208a128 128 0 0 1 120.490667-127.786667l7.509333-0.213333H512zM366.378667 563.2l-1.536 0.853333-233.301334 213.76v76.885334a42.666667 42.666667 0 0 0 37.717334 42.368l4.949333 0.298666H855.893333a42.666667 42.666667 0 0 0 42.368-37.717333l0.298667-4.949333v-151.808l-3.285333-2.090667-152.789334-114.602667a3.541333 3.541333 0 0 0-3.2-0.554666l-1.450666 0.853333-97.28 97.28 76.970666 66.048a42.666667 42.666667 0 0 1-51.2 68.010667l-4.309333-3.2-292.437333-250.666667a3.541333 3.541333 0 0 0-3.2-0.768z m415.829333-516.992a42.666667 42.666667 0 0 1 42.410667 37.717333l0.256 4.949334v96h96a42.666667 42.666667 0 0 1 4.992 85.077333l-4.992 0.256h-96v96a42.666667 42.666667 0 0 1-85.034667 4.992l-0.298667-4.992v-96h-96a42.666667 42.666667 0 0 1-4.949333-85.034667l4.949333-0.298666h96v-96a42.666667 42.666667 0 0 1 42.666667-42.666667z"
fill="#ffffff"
p-id="1968"
></path>
</svg>
</b> -->
<!-- <b class="MaxBtn" @click="MTxtTable(item, index)" style="background-color: #e07404; right: 0px">
<i class="el-icon-document-add"></i>
</b> -->
<b
class="MaxBtn"
@click="MTxtDelet(item, index)"
style="background-color: #bc1a13; right: 0px"
v-if="item.p_main_img_id"
>
<i class="el-icon-delete"></i>
</b>
</div>
</div>
<div style="height: 20px" v-if="Art_Doi == undefined"></div>
<div style="margin: 20px 0 0 0; text-align: center; padding-bottom: 30px" v-if="Art_Doi != undefined">
<el-button icon="el-icon-finished" type="primary" style="width: 350px" @click="pushOnline()"> Push Online </el-button>
</div>
</div>
<div
class="right-side"
style="
width: 300px;
position: fixed;
right: 20px;
top: 17vh;
bottom: 10px;
background-color: #fff;
box-shadow: 0 1px 3px rgb(16 17 19 / 6%);
border-radius: 4px;
"
>
<p style="padding: 10px 10px; box-sizing: border-box; font-weight: bold">
Unfettered area
<b class="MaxBtn" @click="MTxtPic()" style="background-color: #13bc20; right: 40px; top: 5px">
<svg
t="1684978324047"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="1967"
width="15"
height="15"
>
<path
d="M512 46.208a42.666667 42.666667 0 0 1 4.992 85.077333L512 131.541333H174.208a42.666667 42.666667 0 0 0-42.368 37.717334l-0.298667 4.949333v487.850667L307.2 501.12a88.874667 88.874667 0 0 1 112.042667-6.570667l5.845333 4.608 150.442667 128.896 101.973333-101.888a88.874667 88.874667 0 0 1 110.122667-12.373333l6.058666 4.138667 104.832 78.592V512a42.666667 42.666667 0 0 1 85.077334-4.992l0.298666 4.992v342.698667a128 128 0 0 1-120.490666 127.786666l-7.509334 0.213334H174.208a128 128 0 0 1-127.786667-120.490667l-0.213333-7.509333V174.208a128 128 0 0 1 120.490667-127.786667l7.509333-0.213333H512zM366.378667 563.2l-1.536 0.853333-233.301334 213.76v76.885334a42.666667 42.666667 0 0 0 37.717334 42.368l4.949333 0.298666H855.893333a42.666667 42.666667 0 0 0 42.368-37.717333l0.298667-4.949333v-151.808l-3.285333-2.090667-152.789334-114.602667a3.541333 3.541333 0 0 0-3.2-0.554666l-1.450666 0.853333-97.28 97.28 76.970666 66.048a42.666667 42.666667 0 0 1-51.2 68.010667l-4.309333-3.2-292.437333-250.666667a3.541333 3.541333 0 0 0-3.2-0.768z m415.829333-516.992a42.666667 42.666667 0 0 1 42.410667 37.717333l0.256 4.949334v96h96a42.666667 42.666667 0 0 1 4.992 85.077333l-4.992 0.256h-96v96a42.666667 42.666667 0 0 1-85.034667 4.992l-0.298667-4.992v-96h-96a42.666667 42.666667 0 0 1-4.949333-85.034667l4.949333-0.298666h96v-96a42.666667 42.666667 0 0 1 42.666667-42.666667z"
fill="#ffffff"
p-id="1968"
></path>
</svg> </b
><b class="MaxBtn" @click="MTxtTable()" style="background-color: #e07404; right: 0px; top: 5px">
<i class="el-icon-document-add"></i>
</b>
</p>
<div class="unfetteredBox">
<div
:style="item.isHidden ? 'opacity:0.2' : 'opacity:1'"
v-for="(item, index) in images"
:key="index"
class="image"
draggable="true"
@dragstart="onDragStart($event, item, index)"
>
<img :src="baseUrl + 'public/mainimg/' + item.content" style="width: 100%; height: 100%; object-fit: cover" />
</div>
</div>
</div>
<!--修改文本 -->
<el-dialog title="Edit Text" :visible.sync="txtVisible" width="800px" :close-on-click-modal="false">
<el-form ref="editMes" :model="txtStyle" label-width="1px">
<p style="margin: 0 5px 15px 5px; line-height: 18px; font-size: 13px; color: #aaa">{{ exegesis }}</p>
<el-form-item label="">
<el-input type="textarea" placeholder="Please enter the table content..." v-model="txtStyle.text" autosize> </el-input>
</el-form-item>
</el-form>
<p class="type_Gbtn" @click="trsanGtp">
<i class="el-icon-document-copy" style="margin-right: 5px" v-if="btnDisble"></i>
<i class="el-icon-loading" style="margin-right: 5px" v-if="!btnDisble"></i>
TMRGTP Proofreading
</p>
<div class="type_CHar" v-if="txtStyle.ChGtpTxt != ''">
<p v-html="txtStyle.ChGtpTxt"></p>
<font class="chReple" @click="replceChGpr(item)">Replace</font>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="txtVisible = false"> Cancel </el-button>
<el-button type="primary" @click="saveTxt">
<i class="el-icon-finished" style="margin-right: 5px"></i>
Save
</el-button>
</span>
</el-dialog>
<!--添加/修改图片 -->
<el-dialog :title="picStyle.visiTitle" :visible.sync="pictVisible" width="800px" :close-on-click-modal="false">
<el-form ref="editMes" :model="picStyle" label-width="150px">
<el-form-item>
<span slot="label">
<font style="color: #f56c6c; margin-right: 5px">*</font>
Picture :
</span>
<el-upload
class="avatar-uploader"
:action="'/api/api/Production/up_mainimg_file'"
:show-file-list="false"
name="mainimg"
:on-success="handleAvatarSuccess"
:on-error="handleAvatarError"
:before-upload="beforeAvatarUpload"
>
<img v-if="picStyle.imageUrl" :src="picStyle.imageUrl" class="avatar" />
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
<!-- <el-form-item label="Bottom Title :">
<el-input placeholder="Please enter the table title..." v-model="picStyle.titleBot">
</el-input>
</el-form-item> -->
<el-form-item label="Picture Describe :">
<el-input placeholder="Please enter the table describe..." v-model="picStyle.note" type="textarea" :rows="3">
</el-input>
</el-form-item>
</el-form>
<p style="margin: 20px 0; text-align: right">
<el-button
type="warning"
plain
@click="
picStyle.picUrl = '';
picStyle.titleBot = '';
picStyle.note = '';
picStyle.imageUrl = '';
"
>
<i class="el-icon-refresh" style="margin-right: 5px"></i>Empty
</el-button>
</p>
<div class="lineStyle" v-if="picStyle.picUrl != ''">
<div>
<span class="title" style="margin-left: 25px">Picture Width :</span>
<el-input v-model="picStyle.width" style="width: 120px">
<template slot="append">px</template>
</el-input>
</div>
</div>
<div style="padding: 0 20px" v-if="picStyle.picUrl != ''">
<div style="text-align: center">
<img :src="baseUrl + 'public/mainimg/' + picStyle.picUrl" :style="'width:' + picStyle.width + 'px'" />
</div>
<p style="text-align: center; margin: 10px 0 15px 0; font-size: 12px; color: #006699">
<b>{{ picStyle.titleBot }}</b>
</p>
<p
style="text-align: center; margin: 10px auto 0; font-size: 12px; line-height: 22px"
:style="'width:' + picStyle.width + 'px'"
v-html="picStyle.note"
></p>
</div>
<span slot="footer" class="dialog-footer" v-if="picStyle.picUrl != ''">
<el-button @click="pictVisible = false"> Cancel </el-button>
<el-button type="primary" @click="savePic">
<i class="el-icon-finished" style="margin-right: 5px"></i>
Save Picture
</el-button>
</span>
</el-dialog>
<!-- 添加表格 -->
<el-dialog title="Insert Table" :visible.sync="threeVisible" width="1200px" :close-on-click-modal="false" >
<el-form ref="editMes" :model="lineStyle" label-width="115px">
<el-form-item label="Top Title :">
<el-input placeholder="Please enter the table title..." v-model="lineStyle.titleTop"> </el-input>
</el-form-item>
<el-form-item label="Word">
<span slot="label">
<font style="color: #f56c6c; margin-right: 5px">*</font>
Content :
</span>
<common-table ref="commonTable" style="margin-left: -115px;" :lineStyle="lineStyle"></common-table>
</el-form-item>
<el-form-item label="Bottom Title :">
<el-input placeholder="Please enter the table title..." v-model="lineStyle.titleBot"> </el-input>
</el-form-item>
</el-form>
<p style="margin: 20px 0; text-align: right">
<el-button
type="warning"
plain
@click="
lineStyle.textarea = '';
lineStyle.titleTop = '';
lineStyle.titleBot = '';
lineTable = [];
"
>
<i class="el-icon-refresh" style="margin-right: 5px"></i>Empty
</el-button>
<el-button type="primary" plain @click="CopyExcelToTable">
<i class="el-icon-sort" style="margin-right: 5px"></i>Generate Table
</el-button>
</p>
<div class="lineStyle" v-if="lineTable.length != 0">
<div>
<span class="title">Table All Width :</span>
<el-input v-model="lineStyle.tabwith" style="width: 120px">
<template slot="append">%</template>
</el-input>
</div>
<div>
<div v-for="(item, index) in lineStyle.arrwith" class="styArry">
<span class="title"
>Column <b style="color: #006699">{{ index + 1 }}</b> :</span
>
<el-input v-model="lineStyle.arrwith[index]" style="width: 100px">
<template slot="append">%</template>
</el-input>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveLine" v-if="lineTable.length != 0">
<i class="el-icon-finished" style="margin-right: 5px"></i>
Save Table
</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { del } from 'vue';
export default {
data() {
return {
images: [
{
p_main_img_id: 157,
p_article_id: 2141,
p_main_id: 101853,
pre_id: 0,
width: 500,
content: '20240906/7c4cfd8f431cddf05f33634d4ee2cdca.jpg',
note: 'Figure 1 Oracle bone inscriptions of YANG',
ctime: 0,
state: 0
}
],
baseUrl: this.Common.baseUrl,
baseUrl: 'https://submission.tmrjournals.com/',
mediaUrl: this.Common.mediaUrl,
Art_Id: this.$route.query.id,
Art_Doi: this.$route.query.doi,
Art_web_Id: this.$route.query.artID,
Art_P_Id: '',
btnDisble: true,
detailTitle: '',
Main_List: [],
txtStyle: {
text: '',
ChGtpTxt: ''
},
txtVisible: false,
lineStyle: {
titleTop: '',
titleBot: '',
textarea: '',
tableData: [],
tabwith: '100',
arrwith: []
},
lineTable: [],
threeVisible: false,
picStyle: {
titleBot: '',
note: '',
// picUrl: 'https://www.tmrjournals.cn/public/articleHTML/TMR/TMR20230213002/images/alternativeImage/TMR20230213002-F004.jpg',
picUrl: '',
imageUrl: '',
width: '500'
},
pictVisible: false,
typesettingType: 1,
exegesis: "The following contents'<b></b>,<i></i>'are necessary for the generation phase, please do not delete them!!!"
};
},
created() {
this.getDate();
},
methods: {
onDragStart(event, image, index) {
event.dataTransfer.setData('image', JSON.stringify({ ...image, isNewReformat: true }));
event.dataTransfer.setData('imageIndex', index);
},
onDrop(event, index) {
console.log('index at line 297:', index);
const draggedImage = JSON.parse(event.dataTransfer.getData('image'));
const draggedImageIndex = JSON.parse(event.dataTransfer.getData('imageIndex'));
console.log('draggedImage at line 298:', draggedImage);
this.Main_List.splice(index, 0, draggedImage);
this.images[draggedImageIndex].isHidden = true;
},
// 获取数据
getDate() {
let urlLInk = '';
let urlTask = {};
if (this.Art_Id != undefined) {
urlLInk = 'api/Production/getProductionMains';
urlTask.p_article_id = this.Art_Id;
}
// if (this.Art_Doi != undefined) {
// urlLInk = 'api/Production/getProductionMainsByDoi';
// urlTask.doi = this.Art_Doi;
// }
const loading = this.$loading({
lock: true,
text: 'Loading...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
// 获取文章信息
this.$api
.post(urlLInk, urlTask)
.then((res) => {
if (res.code == 0) {
this.detailTitle = res.data.production.title;
this.Art_P_Id = res.data.production.p_article_id;
this.Main_List = res.data.mains;
for (let i = 0; i < this.Main_List.length; i++) {
this.Main_List[i].text = this.Main_List[i].content;
this.Main_List[i].getnum = 0;
}
loading.close();
} else {
this.$message.error(res.msg);
loading.close();
}
})
.catch((err) => {
this.$message.error(err);
loading.close();
});
},
// 修改段落/图片
MTxtEdit(val, num) {
this.picStyle = JSON.parse(JSON.stringify(val));
this.picStyle.picUrl = this.picStyle.content;
this.picStyle.imageUrl = this.baseUrl + 'public/mainimg/' + this.picStyle.content;
this.picStyle.visiTitle = 'Edit Picture';
this.pictVisible = true;
},
// 转化为gpt标准格式
trsanGtp() {
if (this.btnDisble) {
this.btnDisble = false;
this.$api
.post('api/Production/mainGptcheck', {
p_main_id: this.txtStyle.p_main_id
})
.then((res) => {
if (res.code == 0) {
this.txtStyle.ChGtpTxt = res.data.content;
this.btnDisble = true;
// this.$forceUpdate()
this.$message.success('Converting success!');
} else {
this.btnDisble = true;
this.$message.error('Converting fail!');
}
})
.catch((err) => {
this.btnDisble = true;
this.$message.error('Converting fail!');
});
} else {
this.$message.warning('Converting, please wait!');
}
},
// 替换Gtp生成的内容
replceChGpr(val) {
this.txtStyle.text = JSON.parse(JSON.stringify(this.txtStyle.ChGtpTxt));
},
// 确定保存段落修改
saveTxt() {
this.$api
.post('api/Production/editProductionMain', {
p_main_id: this.txtStyle.p_main_id,
content: this.txtStyle.text
})
.then((res) => {
if (res.code == 0) {
this.$message.success('Successfully edit text!');
this.txtVisible = false;
this.getDate();
// this.Main_List[this.txtStyle.index].text = JSON.parse(JSON.stringify(this.txtStyle.text))
} else {
this.$message.error(res.msg);
}
})
.catch((err) => {
this.$message.error(err);
});
},
// 图片段落
MTxtPic(val, num) {
this.picStyle.pre_type = 'img';
// this.picStyle.body = val.p_main_img_id;
this.picStyle.p_article_id = this.Art_P_Id;
this.picStyle.titleBot = '';
this.picStyle.note = '';
this.picStyle.width = '500';
this.picStyle.picUrl = '';
this.picStyle.imageUrl = '';
this.picStyle.visiTitle = 'Insert Picture Backward';
this.pictVisible = true;
},
// 确定保存图片
savePic() {
this.picStyle.content = this.picStyle.picUrl;
this.images.push(this.picStyle);
this.pictVisible = false;
return false;
//要走接口
if (this.picStyle.note == '') {
this.$message.error('Please fill in the picture describe!');
return;
}
this.picStyle.content = this.picStyle.picUrl;
if (this.picStyle.visiTitle == 'Edit Picture') {
this.$api
.post('api/Production/editProductionMainImg', this.picStyle)
.then((res) => {
if (res.code == 0) {
this.$message.success('Successfully edit image!');
this.pictVisible = false;
this.getDate();
} else {
this.$message.error(res.msg);
}
})
.catch((err) => {
this.$message.error(err);
});
} else {
this.$api
.post('api/Production/addProductionMainImg', this.picStyle)
.then((res) => {
if (res.code == 0) {
this.$message.success('Successfully added image!');
this.pictVisible = false;
this.getDate();
} else {
this.$message.error(res.msg);
}
})
.catch((err) => {
this.$message.error(err);
});
}
},
async removeEvent(row) {
// const type = await VXETable.modal.confirm('您确定要删除该数据?')
const $table = this.$refs.xTable;
// if (type === 'confirm') {
$table.remove(row);
// }
},
async insertEvent(row) {
const $table = this.$refs.xTable;
const record = {};
const { row: newRow } = await $table.insertAt(record, row);
await $table.setEditCell(newRow, 'name');
},
// 表格段落
MTxtTable(val, num) {
// this.lineStyle.p_main_id = val.p_main_id;
this.lineStyle.textarea = '';
this.lineStyle.titleCon = '';
this.lineTable = [];
this.threeVisible = true;
this.typesettingType = '1';
this.$forceUpdate();
},
// 表格转化
CopyExcelToTable() {
if (this.lineStyle.textarea == '') {
this.$message.error('Please fill in the table content!');
return;
}
console.log(this.lineStyle.textarea);
let txtRows = this.lineStyle.textarea.split('\n');
let txtColum = [];
for (let i = 0; i < txtRows.length; i++) {
if (txtRows[i] != '') {
let columns = txtRows[i].split('\t');
let dataone = [];
for (let j = 0; j < columns.length; j++) {
dataone.push(columns[j]);
}
txtColum.push(dataone);
}
}
let arrwithNumer = Math.floor(100 / txtColum[0].length) - 2;
this.lineStyle.arrwith = [];
for (let i = 0; i < txtColum[0].length; i++) {
this.lineStyle.arrwith.push(arrwithNumer);
}
this.lineTable = txtColum;
},
// 确定保存表格
saveLine() {
let dataTable = '';
for (let i = 0; i < this.lineTable.length; i++) {
let ArryDr = '';
let listHNem = '';
for (let j = 0; j < this.lineTable[i].length; j++) {
let ArrHtml =
'<div style="width:' +
this.lineStyle.arrwith[j] +
'%;line-height: 22px;vertical-align: middle;display: inline-block;padding: 0 1%;font-size: 14px;color: #606266;word-wrap: break-word;word-break: normal;">' +
this.lineTable[i][j] +
'</div>';
ArryDr = ArryDr + ArrHtml;
}
if (i == 0) {
listHNem =
'<div style="display: flex;border-top: 2px solid #333333;border-bottom: 1px solid #333333;padding: 10px 0;font-weight: bold;margin-bottom: 20px;">' +
ArryDr +
'</div>';
} else if (i == this.lineTable.length - 1) {
listHNem = '<div style="display: flex;border-bottom: 2px solid #333333;padding:0 0 20px 0;">' + ArryDr + '</div>';
ArryDr = ArryDr + listHNem;
} else {
listHNem = '<div style="display: flex;padding:20px 0;">' + ArryDr + '</div>';
}
dataTable = dataTable + listHNem;
}
dataTable = '<div style="width:' + this.lineStyle.tabwith + '%">' + dataTable + '</div>';
if (this.lineStyle.titleTop != '') {
dataTable =
'<p style="text-align: center;margin: 0 0 10px 0;font-size: 12px;color: #006699;"><b>' +
this.lineStyle.titleTop +
'</b></p>' +
dataTable;
}
if (this.lineStyle.titleBot != '') {
dataTable =
dataTable + '<p style="text-align: center;margin: 10px 0 0 0;font-size: 12px;">' + this.lineStyle.titleBot + '</p>';
}
console.log(dataTable);
},
// 删除段落/图片
MTxtDelet(val, index) {
var imageIndex = this.images.findIndex((e) => e.p_main_img_id == val.p_main_img_id);
if (imageIndex > -1) {
delete this.images[imageIndex].isHidden;
} else {
this.images.push(val);
}
this.$forceUpdate();
this.Main_List.splice(index, 1);
console.log('this.images.push at line 654:', this.images);
// this.$api
// .post('api/Production/delProductionMainImg', {
// p_main_img_id: val.p_main_img_id
// })
// .then((res) => {
// if (res.code == 0) {
// this.$message.success('Successfully deleted!');
// this.getDate();
// // this.Main_List.splice(num, 1);
// } else {
// this.$message.error(res.msg);
// }
// })
// .catch((err) => {
// this.$message.error(err);
// });
},
// 推送
pushOnline() {
// 二次确认
this.$confirm('Are you sure you want to push it to the official website?', 'Tips', {
type: 'warning'
})
.then(() => {
this.$api
.post('api/Production/pushMainToWeb', {
article_id: this.Art_web_Id,
p_article_id: this.Art_P_Id
})
.then((res) => {
if (res.code == 0) {
this.$message.success('Successfully push!');
this.getDate();
if (this.Art_Doi != undefined) {
this.$router.push({
path: 'comArtHtmlEdit',
query: {
artID: this.Art_web_Id
}
});
}
} else {
this.$message.error(res.msg);
}
})
.catch((err) => {
this.$message.error(err);
});
})
.catch(() => {});
},
// 上传图片
handleAvatarSuccess(res, file) {
if (res.code == 0) {
this.picStyle.picUrl = res.upurl;
this.$forceUpdate();
} else {
this.$message.error(res.msg);
}
this.picStyle.imageUrl = URL.createObjectURL(file.raw);
},
handleAvatarError(res, file) {},
beforeAvatarUpload(file) {
const isLt2M = file.size / 1024 / 1024 < 1;
if (!isLt2M) {
this.$message.error('Picture size cannot exceed 1M!');
}
return isLt2M;
}
}
};
</script>
<style scoped>
.lineStyle {
border-top: 1px solid #0066994d;
padding: 20px 20px 40px 20px;
}
.lineStyle > div {
}
.lineStyle > div span.title {
font-size: 14px;
color: #606266;
margin: 0px 10px 0px 0px;
}
.lineStyle > div font.mark {
font-size: 14px;
color: #606266;
margin: 0px 0px 0px 10px;
}
.lineStyle .styArry {
display: inline-block;
margin: 15px 40px 0 0;
}
.lineStyle .styArry:nth-last-child(1) {
margin-right: 0;
}
.lineAll {
margin: 0 auto;
}
.lineAll .lineTit {
padding: 0 0 20px 0;
font-size: 14px;
}
.lineAll .lineTit:nth-child(1) {
border-top: 2px solid #333333;
border-bottom: 1px solid #333333;
padding: 10px 0;
font-weight: bold;
}
.lineAll .lineTit:nth-child(2) {
padding-top: 20px;
}
.lineAll .lineTit:nth-last-child(1) {
border-bottom: 2px solid #333333;
}
.lineAll .lineTit > div {
line-height: 22px;
vertical-align: middle;
display: inline-block;
padding: 0 1%;
}
.man_Title {
background-color: #fff;
margin: 0 0 10px 0;
border-bottom: 1px solid #dde1eb;
box-shadow: 0 5px 5px -2px rgb(134 134 134);
padding: 12px 25px 8px 25px;
font-size: 16px;
line-height: 24px;
color: #333;
position: relative;
}
.man_Title button {
position: absolute;
top: 10px;
right: 10px;
}
.type_MTxt {
background-color: #fff;
padding: 0 10px 10px 10px;
box-shadow: 0 1px 3px rgb(16 17 19 / 6%);
position: relative;
}
.type_MTxt > div {
position: relative;
padding: 8px 15px;
min-height: 22px;
border: 2px dashed #fff;
border-radius: 5px;
color: #606266;
}
.type_MTxt > .imgBox:hover {
background-color: rgb(0 102 153 / 10%);
border: 2px dashed rgb(0 102 153 / 50%);
}
.type_MTxt > div > p {
font-size: 14px;
line-height: 22px;
}
.type_MTxt > .imgBox .chNumer {
position: absolute;
top: -2px;
right: -1px;
border-radius: 3px;
font-size: 10px;
background-color: rgb(0 102 153 / 85%);
color: #fff;
padding: 0 6px;
}
.type_MTxt > div .MaxPicture {
text-align: center;
}
.type_MTxt > div .MaxPicture > img {
margin-bottom: 10px;
}
.type_MTxt > div .MaxPicture > font {
display: block;
margin: 0 auto;
font-size: 13px;
}
.MaxBtn {
position: absolute;
right: 0;
top: -1px;
color: #fff;
border-radius: 50px;
font-size: 15.5px;
padding: 6px 7px;
display: none;
opacity: 0.75;
}
.MaxBtn {
display: block;
}
.MaxBtn:hover {
opacity: 1;
cursor: pointer;
}
.type_Gbtn {
color: #fff;
border-color: #006699;
background: #006699;
width: 30%;
text-align: center;
padding: 8px 0;
font-size: 14px;
border-radius: 8px;
font-weight: 500;
margin: 0 auto;
}
.type_Gbtn:hover {
box-shadow: 0 4px 14px rgb(0 102 153 / 30%);
cursor: pointer;
}
.type_CHar {
position: relative;
border-left: 4px solid rgba(0 102 153 / 20%);
border-radius: 5px;
padding: 20px 25px 15px 20px;
background-color: #fff;
margin: 20px 0 0 0;
font-size: 14px;
line-height: 22px;
box-shadow: 0 1px 10px rgb(0 102 153 / 20%);
}
.type_CHar .chReple {
position: absolute;
top: -1px;
right: 1px;
border-radius: 3px;
font-size: 10px;
background-color: rgb(223 109 11);
opacity: 0.85;
color: #fff;
padding: 1px 10px;
}
.type_CHar .chReple:hover {
opacity: 1;
cursor: pointer;
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
width: 100px;
height: 100px;
}
.avatar-uploader_small {
height: 100px;
}
.avatar-uploader .el-upload:hover {
border-color: #409eff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 120px;
height: 120px;
line-height: 120px;
text-align: center;
}
.avatar-uploader_small .el-upload {
width: 80px;
height: 80px;
}
.avatar-uploader_small .avatar-uploader-icon {
line-height: 80px;
margin-left: -30px;
}
.avatar {
width: 120px;
height: 120px;
display: block;
}
.unfetteredBox {
display: flex;
flex-wrap: wrap;
padding: 0 10px;
box-sizing: border-box;
}
.unfetteredBox .image {
margin-top: 10px;
box-shadow: rgba(16, 17, 19, 0.5) 0px 1px 3px;
margin-right: 10px;
height: 60px;
width: 60px;
border-radius: 4px;
overflow: hidden;
}
</style>

View File

@@ -0,0 +1,522 @@
<template>
<div class="tinymce-container editor-container">
<textarea class="tinymce-textarea" :id="tinymceId"></textarea>
</div>
</template>
<script>
import { string } from 'html-docx-js/dist/html-docx';
import htmlDocx from 'html-docx-js/dist/html-docx.js';
import { Document, Packer, PageOrientation, Paragraph, TextRun } from "docx"; // 引入 docx.js
import html2canvas from 'html2canvas';
const toolbar =
'undo redo | formatselect | bold italic | forecolor |subscript superscript|table tabledelete | |spacer customButton |customButtonExportWord |customButtonExportImg | pageOrientation';
const tableStyle = ` b span{
font-weight: bold !important;
}
i span{
font-style: italic !important; ;
}
sub span{
vertical-align: sub;
}
sup span{
vertical-align: sup;
}
table {
border:0px !important;
border-collapse: collapse; /* 去除单元格间隙 */
width: auto;
margin : 0 auto !important;
table-layout: auto; /* 自动调整列宽 */
text-align:left;
font-family:'Charis SIL' !important;
font-size: 7.5000pt !important;
mso-font-kerning: 1.0000pt !important;
line-height: 10pt !important;
mos-line-height: 10pt !important;
}
table td, table th {
padding: 5px;
text-align:left !important;
white-space: pre-wrap; /* 保留换行符并换行 */
word-wrap: break-word; /* 长单词自动换行 */
word-break: break-word;
font-family:'Charis SIL' !important;
font-size: 7.5000pt !important;
mso-font-kerning: 1.0000pt !important;
line-height: 10pt !important;
mos-line-height: 10pt !important;
}
table tr td{
text-align:left !important;
border-left:none !important;
mso-border-left-alt:none !important;
border-right:none !important;
mso-border-right-alt:none !important;
border-top:none;mso-border-top-alt:none !important;
border-bottom:none !important;
mso-border-bottom-alt:none !important;
border:1px dashed #dcdfe6 !important;
border-left:1px dashed #dcdfe6 !important;
border-right:1px dashed #dcdfe6 !important;
}
table tr td p{
display:flex;text-align:left !important;
align-items:center;
margin:0;
font-family:'Charis SIL' !important;
font-size: 7.5000pt !important;
mso-font-kerning: 1.0000pt !important;
line-height: 10pt !important;
mos-line-height: 10pt !important;
}
table span{
color:#000000;text-align:left !important;
font-family:'Charis SIL' !important;
font-size: 7.5000pt !important;
mso-font-kerning: 1.0000pt !important;
line-height: 10pt !important;
mos-line-height: 10pt !important;
}
table .color-highlight{
color:rgb(0,130,170) !important;
font-family:'Charis SIL' !important;
font-size: 7.5000pt !important;
mso-font-kerning: 1.0000pt !important;
line-height: 10pt !important;
mos-line-height: 10pt !important;
}
`;
export default {
name: 'tinymce',
components: {},
props: {
id: {
type: String
},
value: {
type: String,
default: ''
},
isEdit: {},
toolbar: {
type: Array,
required: false,
default() {
return [];
}
},
menubar: {
default: 'file edit insert view format table '
},
height: {
type: Number,
required: false,
default: 360
},
width: {
type: String,
required: false,
default: '100%'
},
isShowArtWorkButton: {
default: false
}
},
data() {
return {
typesettingType: 1,
uploadReset: false,
dialogVisible: false,
form: {
name: '',
region: '',
date1: '',
date2: '',
delivery: false,
type: [],
resource: '',
desc: ''
},
formLabelWidth: '120px',
hasChange: false,
hasInit: false,
tinymceId: this.id || 'vue-tinymce-' + +new Date()
};
},
watch: {
value(val) {
if (!this.hasChange && this.hasInit) {
this.$nextTick(() => window.tinymce.get(this.tinymceId).setContent(val));
}
}
},
mounted() {
this.typesettingType = 1;
this.initTinymce();
},
activated() {
this.typesettingType = 1;
this.initTinymce();
},
deactivated() {
this.destroyTinymce();
},
methods: {
handleSubmit() {
this.$refs.uploadImage.handleSubmit();
},
getDetail(val) {
if (this.hasInit == true) {
this.$nextTick(() => window.tinymce.get(this.tinymceId).setContent(val));
}
},
//将字符串添加到富文本编辑器中
addArtWork(str) {
window.tinymce.get(this.tinymceId).insertContent(str);
},
onClick(e) {
this.$emit('onClick', e, tinymce);
},
changeTable() {
// 获取所有表格
const tables = window.tinymce.get(this.tinymceId).getBody().querySelectorAll('table');
console.log('tables at line 110:', tables);
// 遍历并设置样式
tables.forEach((table) => {
const editor = window.tinymce.get(this.tinymceId);
editor.dom.setStyles(table, {
width: this.typesettingType == 1 ? '171.5mm' : '258.6mm'
});
});
this.$forceUpdate();
},
initTinymce() {
const _this = this;
window.tinymce.init({
selector: `#${this.tinymceId}`,
content_css: false, // 禁用默认样式
table_resize_bars: true, // 启用拖动调整功能
valid_elements: '*[*]', // 允许所有 HTML 标签
paste_preprocess: function (plugin, args) {
let content = args.content;
const container = document.createElement('div');
container.innerHTML = content;
_this.updateTableStyles(container);
args.content = container.innerHTML; // 更新内容
},
content_style: `${tableStyle}`,
formats: {
bold: { inline: 'b' },
italic: { inline: 'i' }
},
body_class: 'panel-body ',
object_resizing: false,
toolbar: this.toolbar.length > 0 ? this.toolbar : toolbar,
menubar: false, // 启用菜单栏并保持必要的项目
statusbar: false, // 关闭底部状态栏
custom_colors: false,
color_map: ['000000', 'Black', '0082AA', 'TMR Blue'],
plugins: 'forecolor code paste table', // 启用 forecolor 和 code 插件
end_container_on_empty_block: true,
content_css: 'default', // 加载 TinyMCE 默认样式表
//设置自定义按钮 myCustomToolbarButton
setup(ed) {
ed.ui.registry.addButton('pageOrientation', {
text: '切换方向',
onAction: function () {
_this.typesettingType = _this.typesettingType == 1 ? 2 : 1;
_this.changeTable();
// if (ed.dom.hasClass(ed.getBody(), 'a4-portrait')) {
// ed.dom.removeClass(ed.getBody(), 'a4-portrait');
// ed.dom.addClass(ed.getBody(), 'a4-landscape');
// } else {
// ed.dom.removeClass(ed.getBody(), 'a4-landscape');
// ed.dom.addClass(ed.getBody(), 'a4-portrait');
// }
}
});
ed.on('init', function () {
const editorBody = ed.getBody();
// 创建 MutationObserver 监听内容变化
const observer = new MutationObserver(() => {
const hasHorizontalScrollbar = editorBody.scrollWidth > editorBody.clientWidth;
if (hasHorizontalScrollbar) {
console.log('TinyMCE 出现横向滚动条');
} else {
console.log('没有横向滚动条');
}
});
// 监听子节点和内容的变化
observer.observe(editorBody, { childList: true, subtree: true, characterData: true });
});
// 定义自定义按钮
ed.ui.registry.addButton('customButton', {
text: 'Empty',
onAction: () => {
// 插入自定义表格到编辑器中
ed.setContent('');
}
});
// 定义自定义按钮
ed.ui.registry.addButton('customButtonExportWord', {
text: _this.$t('commonTable.exportWord'),
onAction: () => {
// 插入自定义表格到编辑器中
let content = ed.getContent(); // 获取内容
content = content.replace(/<strong>/g, '<b>').replace(/<\/strong>/g, '</b>');
content = content.replace(/<em>/g, '<i>').replace(/<\/strong>/g, '</i>');
_this.export('table', content);
}
});
// 定义自定义按钮
ed.ui.registry.addButton('customButtonExportImg', {
text: _this.$t('commonTable.exportImg'),
onAction: () => {
// 插入自定义表格到编辑器中
_this.export('image', ed.getContent());
}
});
ed.ui.registry.addContextToolbar('spacer', {
predicate: () => false, // 保持静态
items: '',
scope: 'node'
});
ed.on('paste', (event) => {});
ed.on('SetContent', function (e) {
e.content = e.content.replace(/<strong>/g, '<b>').replace(/<\/strong>/g, '</b>');
e.content = e.content.replace(/<em>/g, '<i>').replace(/<\/em>/g, '</i>');
});
ed.on('GetContent', function (e) {
e.content = e.content.replace(/<b>/g, '<strong>').replace(/<\/b>/g, '</strong>');
e.content = e.content.replace(/<i>/g, '<em>').replace(/<\/i>/g, '</em>');
});
},
init_instance_callback: (editor) => {
if (_this.value) {
editor.setContent(_this.value);
}
_this.hasInit = true;
editor.on('NodeChange Change KeyUp SetContent', () => {
this.hasChange = true;
this.$emit('input', editor.getContent());
});
}
});
},
replaceNegativeSign(node) {
if (node.nodeType === Node.TEXT_NODE) {
// 如果是文本节点,替换负号
node.nodeValue = node.nodeValue.replace(/^-(?=\d)/, '');
} else if (node.nodeType === Node.ELEMENT_NODE) {
// 如果是元素节点,递归处理子节点
node.childNodes.forEach(this.replaceNegativeSign);
}
},
capitalizeFirstLetter(node) {
if (node.nodeType === Node.TEXT_NODE) {
// 如果是文本节点,只处理第一个非空字符
node.nodeValue = node.nodeValue.replace(/^\s*([a-zA-Z])/, (match, firstLetter) => {
return firstLetter.toUpperCase();
});
} else if (node.nodeType === Node.ELEMENT_NODE) {
// 递归处理子节点
node.childNodes.forEach(this.capitalizeFirstLetter);
}
},
updateTableStyles(container) {
var _this = this;
// 更新表格样式
const tables = container.querySelectorAll('table');
tables.forEach((table) => {
table.setAttribute(
'style',
`width: ${
this.typesettingType == 1 ? '171.5mm' : '258.6mm'
};border: none; margin: 0 auto !important;border-collapse: collapse; `
);
const cells = table.querySelectorAll('td');
cells.forEach((td) => {
if (/^-?\d+(\.\d+)?$/.test(td.textContent.trim())) {
_this.replaceNegativeSign(td);
}
const hasSupOrSub = _this.containsSupOrSub(td); // 检查当前 td 是否包含上下标
if (!hasSupOrSub) {
// 递归处理单元格内的所有子节点
td.childNodes.forEach(_this.capitalizeFirstLetter);
// 替换 <a> 标签为其内部文本
td.querySelectorAll('a').forEach((a) => {
const textNode = document.createTextNode(a.textContent); // 创建文本节点
a.replaceWith(textNode); // 用文本节点替换 <a> 标签
});
}
// 获取 td 元素中的所有子元素
const childElements = td.querySelectorAll('*');
// 遍历每个子元素
childElements.forEach((element) => {
// 如果元素的文本内容匹配正则表达式
if (/\[\d+(?:,\d+)*\]/g.test(element.textContent)) {
console.log('匹配到带有数字的方括号内容');
// 为匹配的元素添加样式类
element.classList.add('color-highlight');
}
});
});
const firstRowTdElements = container.querySelectorAll('tr:first-child td'); // 获取第一个 <tr> 中的所有 <td> 元素
// 遍历所有 <td> 元素,添加上下边框样式
firstRowTdElements.forEach((td) => {
const currentStyle = td.getAttribute('style');
if (currentStyle) {
td.setAttribute(
'style',
currentStyle +
';border-top:1.0000pt solid #000 !important;mso-border-top-alt:0.5000pt solid #000 !important;border-bottom:1.0000pt solid #000 !important;mso-border-bottom-alt:0.5000pt solid #000 !important;'
);
} else {
td.setAttribute(
'style',
'border-top:1.0000pt solid #000 !important;mso-border-top-alt:0.5000pt solid #000 !important;border-bottom:1.0000pt solid #000 !important;mso-border-bottom-alt:0.5000pt solid #000 !important;'
);
}
});
const firstRowTdElementsLast = container.querySelectorAll('tr:last-of-type td');
// 遍历所有 <td> 元素,添加上下边框样式
firstRowTdElementsLast.forEach((td) => {
// 获取当前的 style 属性(如果有)
const currentStyle = td.getAttribute('style');
// 如果已有 style 属性,则追加边框样式;如果没有 style 属性,则设置新的 style
if (currentStyle) {
td.setAttribute(
'style',
currentStyle +
';border-bottom:1.0000pt solid #000 !important;mso-border-bottom-alt:0.5000pt solid #000 !important;'
);
} else {
td.setAttribute(
'style',
'border-bottom:1.0000pt solid #000 !important;mso-border-bottom-alt:0.5000pt solid #000 !important;'
);
}
});
});
},
//销毁富文本
destroyTinymce() {
if (window.tinymce.get(this.tinymceId)) {
window.tinymce.get(this.tinymceId).destroy();
}
},
//设置内容
setContent(value) {
window.tinymce.get(this.tinymceId).setContent(value);
},
//获取内容
getContent(type) {
this.$emit('getContent', type, window.tinymce.get(this.tinymceId).getContent());
},
export(type, data) {
if (type == 'table') {
var tableHtml = `<html xmlns:w="urn:schemas-microsoft-com:office:word">
<head>
<style>
@page {
size: A4; /* 或者 A3, Letter 等纸张大小 */
margin: 20mm;
}
${tableStyle}
</style>
</head>
<body>
${data}
</body>
</html>`;
console.log('tableHtml at line 438:', tableHtml);
const converted = htmlDocx.asBlob(tableHtml); // 将 HTML 转换为 Word Blob
// 触发文件下载
const link = document.createElement('a');
link.href = URL.createObjectURL(converted);
link.download = 'table.docx';
link.click();
} else if (type == 'image') {
const hiddenContainer = document.createElement('div');
hiddenContainer.style.position = 'absolute';
hiddenContainer.style.left = '-9999ppx';
hiddenContainer.style.top = '0';
hiddenContainer.innerHTML = data;
const style = document.createElement('style');
style.innerHTML = `${tableStyle}`;
document.head.appendChild(style);
document.body.appendChild(hiddenContainer);
// 使用 html2canvas 捕获表格内容
const table = hiddenContainer.querySelector('table'); // 找到表格
table.style.border = 'none';
// 使用 html2canvas 将内容转为图片
html2canvas(hiddenContainer, {
scale: 2, // 提高图片的分辨率默认为1设置为2可以使图片更清晰
logging: false, // 禁用日志输出
useCORS: true, // 允许跨域图像
allowTaint: true // 允许污染 canvas解决图片链接不可用问题
})
// 清空现有内容,显示图片
.then((canvas) => {
const imgData = canvas.toDataURL('image/png'); // 创建一个图片对象
const link = document.createElement('a'); // 创建一个链接并下载图片
link.href = imgData;
link.download = 'image.png';
link.click();
});
}
},
inlineStyles(element) {
const styles = window.getComputedStyle(element);
for (let style in styles) {
if (styles.hasOwnProperty(style)) {
element.style[style] = styles[style];
}
}
},
//获取上传图片后的地址,并设置图片样式
tableSuccessCBK(arr) {
console.log(arr, '222');
const _this = this;
window.tinymce.get(_this.tinymceId).insertContent(arr);
},
containsSupOrSub(element) {
// 如果当前节点是元素节点
if (element.nodeType === 1) {
// 如果是 <sup> 或 <sub> 标签,返回 true
if (element.tagName === 'SUP' || element.tagName === 'SUB') {
return true;
}
// 否则,递归检查子节点
return Array.from(element.childNodes).some((child) => this.containsSupOrSub(child));
}
// 如果不是元素节点(如文本节点),返回 false
return false;
}
},
destroyed() {
this.destroyTinymce();
}
};
</script>
<style scoped>
::v-deep .tox-tinymce-aux {
z-index: 9999 !important;
}
::v-deep .tox .tox-menu {
z-index: 9999 !important;
}
</style>

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,432 @@
<template>
<div>
<div>
<el-select v-model="typesettingType">
<el-option v-for="item in typesettingTypeOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select>
<span>请在下面区域粘贴 Word 表格</span>
</div>
<div class="controls" style="overflow: hidden">
请在此区域粘贴 Word 表格typesettingType 为页面方向 1为竖向 <span> </span>
<div
style="margin: 0 auto; box-sizing: border-box"
class="paste-area"
:style="`width: ${typesettingType == 1 ? 210 : 297}mm !important;
padding:25.4mm 19.1mm`"
contenteditable="true"
id="content"
ref="content"
@paste="handlePaste"
></div>
</div>
<el-button @click="exportToWord">导出为 Word</el-button>
<el-button @click="downloadImage">导出为 图片</el-button>
</div>
</template>
<script>
import htmlDocx from 'html-docx-js/dist/html-docx.js';
import html2canvas from 'html2canvas';
export default {
data() {
return {
updatedHtml: '',
typesettingType: 1
};
},
mounted() {
this.typesettingType = 1;
},
methods: {
downloadImage() {
},
handlePaste(event) {
setTimeout(() => {
content= this.$refs.content
if (content) {
const updatedHtml = this.setHtmlWord(content.innerHTML);
this.updatedHtml = updatedHtml.match(/<table[\s\S]*?<\/table>/i)[0];
console.log('updatedHtml at line 114:', this.updatedHtml);
}
}, 50);
},
//判断内容是否有上下标
containsSupOrSub(element) {
// 如果当前节点是元素节点
if (element.nodeType === 1) {
// 如果是 <sup> 或 <sub> 标签,返回 true
if (element.tagName === 'SUP' || element.tagName === 'SUB') {
return true;
}
// 否则,递归检查子节点
return Array.from(element.childNodes).some((child) => this.containsSupOrSub(child));
}
// 如果不是元素节点(如文本节点),返回 false
return false;
},
setHtmlWord(setHtmlWord) {
if (setHtmlWord.includes('<table')) {
} else {
return false;
}
const html = setHtmlWord
.replace(
/<(table)([^>]*style="([^"]*)")/g, // 匹配有 style 属性的 <table>
(match, p1, p2, p3) => {
const existingStyle = p3;
// 如果现有样式不为空,则在原样式后追加新的样式
const updatedStyle = existingStyle
? existingStyle +
`; width: ${
this.typesettingType == 1 ? '488' : '736'
}pt !important; mso-padding-alt: 0.7500pt 0.7500pt 0.7500pt 0.7500pt;`
: `width: ${
this.typesettingType == 1 ? '488' : '736'
}pt !important; mso-padding-alt: 0.7500pt 0.7500pt 0.7500pt 0.7500pt;`;
var str = `<table${p2.replace(`style="${existingStyle}"`, `style="${updatedStyle}"`)}`;
return str;
}
)
.replace(/style="style=;/g, 'style="')
.replace(/;;/g, ';')
.replace(/\n/g, '<br>');
const container = document.createElement('div');
container.innerHTML = html;
const AllTd = container.querySelectorAll('table td'); // 获取 <tr> 中的所有 <td> 元素
const firstRowTdElementsAll = container.querySelectorAll('*'); // 获取第一个 <tr> 中的所有 <td> 元素
// 遍历所有 <td> 元素,添加上下边框样式
firstRowTdElementsAll.forEach((td) => {
let htmlContent = td.innerHTML;
const currentStyle = td.getAttribute('style');
if (currentStyle) {
td.setAttribute(
'style',
currentStyle +
";text-align:left;font-family:'Charis SIL' !important; font-size: 7.5000pt !important; mso-font-kerning: 1.0000pt !important; line-height: 10pt !important;mos-line-height: 10pt !important;"
);
} else {
td.setAttribute(
'style',
"text-align:left;font-family:'Charis SIL' !important; font-size: 7.5000pt !important; mso-font-kerning: 1.0000pt !important; line-height: 10pt !important;mos-line-height: 10pt !important;mso-line-height-rule: exactly !important;"
);
}
});
// 遍历所有 <td> 元素,添加上下边框样式
AllTd.forEach((td) => {
if (/^-?\d+(\.\d+)?$/.test(td.textContent)) {
// 如果是纯数字(包括负数),替换负号为双负号
td.textContent = td.textContent.replace(/^-(?=\d)/, ''); // 替换负号为 "--"
}
const hasSupOrSub = this.containsSupOrSub(td); // 检查当前 td 是否包含上下标
if (!hasSupOrSub) {
td.textContent = td.textContent.replace(/(^|\s)(\w)/g, (match, space, firstLetter) => {
// 将首字母大写,并保持原始空格或其他字符
return space + firstLetter.toUpperCase();
});
td.textContent = td.textContent.replace(/<a\b[^>]*>(.*?)<\/a>/gi, (match, innerText) => {
return innerText; // 保留链接内部的内容
});
}
const currentStyle = td.getAttribute('style');
if (currentStyle) {
const regex = /\[\d+(?:,\d+)*\]/g;
if (regex.test(td.innerHTML)) {
// 如果匹配到,则对该 <td> 应用样式,比如改变文本颜色
td.setAttribute(
'style',
currentStyle +
';color:rgb(0,130,170) !important;border-left:none !important;mso-border-left-alt:none !important;border-right:none !important;mso-border-right-alt:none !important;border-top:none;mso-border-top-alt:none !important;border-bottom:none !important;mso-border-bottom-alt:none !important;'
);
} else {
td.setAttribute(
'style',
currentStyle +
';color:#000000 !important;border-left:none !important;mso-border-left-alt:none !important;border-right:none !important;mso-border-right-alt:none !important;border-top:none;mso-border-top-alt:none !important;border-bottom:none !important;mso-border-bottom-alt:none !important;'
);
}
} else {
if (regex.test(td.innerHTML)) {
// 如果匹配到,则对该 <td> 应用样式,比如改变文本颜色
td.setAttribute(
'style',
'color:rgb(0,130,170) !important;border-left:none !important;mso-border-left-alt:none !important;border-right:none !important;mso-border-right-alt:none !important;border-top:none;mso-border-top-alt:none !important;border-bottom:none !important;mso-border-bottom-alt:none !important;'
);
} else {
td.setAttribute(
'style',
'color:#000000 !important;border-left:none !important;mso-border-left-alt:none !important;border-right:none !important;mso-border-right-alt:none !important;border-top:none;mso-border-top-alt:none !important;border-bottom:none !important;mso-border-bottom-alt:none !important;'
);
}
}
});
const firstRowTdElements = container.querySelectorAll('tr:first-child td'); // 获取第一个 <tr> 中的所有 <td> 元素
// 遍历所有 <td> 元素,添加上下边框样式
firstRowTdElements.forEach((td) => {
const currentStyle = td.getAttribute('style');
if (currentStyle) {
td.setAttribute(
'style',
currentStyle +
';color:#000000 !important; border-top:1.0000pt solid #000 !important;mso-border-top-alt:0.5000pt solid #000 !important;border-bottom:1.0000pt solid #000 !important;mso-border-bottom-alt:0.5000pt solid #000 !important;'
);
} else {
td.setAttribute(
'style',
'color:#000000 !important;border-top:1.0000pt solid #000 !important;mso-border-top-alt:0.5000pt solid #000 !important;border-bottom:1.0000pt solid #000 !important;mso-border-bottom-alt:0.5000pt solid #000 !important;'
);
}
});
const firstRowTdElementsLast = container.querySelectorAll('tr:last-of-type td');
// 遍历所有 <td> 元素,添加上下边框样式
firstRowTdElementsLast.forEach((td) => {
// 获取当前的 style 属性(如果有)
const currentStyle = td.getAttribute('style');
// 如果已有 style 属性,则追加边框样式;如果没有 style 属性,则设置新的 style
if (currentStyle) {
td.setAttribute(
'style',
currentStyle + ';border-bottom:1.0000pt solid #000 !important;mso-border-bottom-alt:0.5000pt solid #000 !important;'
);
} else {
td.setAttribute(
'style',
'border-bottom:1.0000pt solid #000 !important;mso-border-bottom-alt:0.5000pt solid #000 !important;'
);
}
});
// 获取修改后的 HTML 内容
const updatedHtml = container.innerHTML;
this.$forceUpdate();
// 输出修改后的 HTML
return updatedHtml;
},
getContent(type, data) {
if (type == 'table') {
var tableHtml = `<html xmlns:w="urn:schemas-microsoft-com:office:word">
<head>
<style>
@page {
size: A4 !important;
margin: 1in;
size: landscape; /* 强制页面方向为横向 */
}
table {
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid #000;
padding: 8px;
text-align: left;
}
p,th, td,tr,table {
font-size: 7.5000pt; /* 字体大小 */
margin-top: 0pt; /* 段前间距 */
margin-bottom: 0pt; /* 段后间距 */
}
</style>
</head>
<body>
${data}
</body>
</html>
`;
console.log('tableHtml at line 150:', tableHtml);
const converted = htmlDocx.asBlob(tableHtml); // 将 HTML 转换为 Word Blob
// 触发文件下载
const link = document.createElement('a');
link.href = URL.createObjectURL(converted);
link.download = 'table.docx';
link.click();
} else if (type == 'image') {
// tinymce
// 显示内容的容器
const container = this.$refs.output;
console.log('outputDiv at line 358:', container);
const outputDiv = container.querySelector('table');
console.log('outputDiv at line 360:', outputDiv);
// 使用 html2canvas 将内容转为图片
html2canvas(outputDiv, {
scale: 3, // 提高图片的分辨率默认为1设置为2可以使图片更清晰
logging: false, // 禁用日志输出
useCORS: true, // 允许跨域图像
allowTaint: true // 允许污染 canvas解决图片链接不可用问题
})
// 清空现有内容,显示图片
.then((canvas) => {
// 创建一个图片对象
const imgData = canvas.toDataURL('image/png');
// 创建一个链接并下载图片
const link = document.createElement('a');
link.href = imgData;
link.download = 'image.png';
link.click();
});
}
},
exportToWord() {
// 获取 HTML 内容
// console.log('html at line 118:', updatedHtml);
const tableHtml = `
<html xmlns:w="urn:schemas-microsoft-com:office:word">
<head>
<style>
@page {
size: A4 !important;
margin: 1in;
size: landscape; /* 强制页面方向为横向 */
}
table {
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid #000;
padding: 8px;
text-align: left;
}
p,th, td,tr,table {
font-size: 7.5000pt; /* 字体大小 */
margin-top: 0pt; /* 段前间距 */
margin-bottom: 0pt; /* 段后间距 */
}
</style>
</head>
<body>
<div align="center">
${this.$refs.content.innerHTML}
</div>
</body>
</html>`;
console.log('tableHtml at line 150:', tableHtml);
const converted = htmlDocx.asBlob(tableHtml); // 将 HTML 转换为 Word Blob
// 触发文件下载
const link = document.createElement('a');
link.href = URL.createObjectURL(converted);
link.download = 'table.docx';
link.click();
}
}
};
</script>
<style scoped>
table {
border-collapse: collapse;
width: 100%;
margin: 20px 0;
}
th,
td {
border: 1px dashed #dcdfe6;
padding: 8px;
text-align: center;
position: relative;
}
table {
border-top: 2px solid #000;
border-bottom: 1px solid #000;
}
th {
border-bottom: 1px solid #000;
}
th input,
td input {
width: 100%;
border: none;
outline: none;
text-align: center;
}
th input,
td input ::placeholder {
color: #aaa !important;
}
.controls {
margin: 0 0 20px;
}
.drag-handle {
cursor: move;
}
::v-deep .paste-area {
height: auto; /* A4纸高度 */
background: white; /* 纸张背景 */
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* 添加阴影模拟纸张浮起 */
border: 1px solid #ddd; /* 模拟纸张边框 */
/* padding: 25.4mm 19.1mm; //内边距 */
box-sizing: border-box; /* 确保内边距不会影响整体尺寸 */
transform-origin: top left;
}
::v-deep .paste-area table {
/* border-top: 2px solid #000 !important; */
/* border-bottom: 1px solid #000 !important; */
margin-left: 0 !important;
margin-right: 0 !important;
margin: 0 auto !important;
}
::v-deep .paste-area table td {
border-top: none !important;
border-bottom: none !important;
border: 1px dashed #dcdfe6 !important;
/* display: flex;
align-items: center; */
}
::v-deep .paste-area table td p {
display: flex;
align-items: center;
}
::v-deep .paste-area table .MsoNormal {
max-width: 200px !important; /* 限制容器宽度 */
word-wrap: break-word !important;
overflow-wrap: break-word !important;
}
.text-container {
position: relative;
padding: 20px;
border: 1px solid #ccc;
margin: 20px;
font-size: 16px;
line-height: 1.5;
}
</style>

View File

@@ -0,0 +1,657 @@
<template>
<div>
<div>
<el-select v-model="typesettingType">
<el-option v-for="item in typesettingTypeOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select>
<span>请在下面区域粘贴 Word 表格</span>
</div>
<tinymce
ref="tinymceChild"
:value="updatedHtml"
:typesettingType="typesettingType"
class="paste-area text-container"
@handlePaste="handlePaste"
@getContent="getContent"
:style="`width: ${typesettingType == 1 ? 210 : 297}mm !important;
padding:2mm`"
style="
white-space: pre-line;
line-height: 12px;
max-height: 50vh;
overflow: auto;
font-size: 12px;
font-size: 7.5pt; /* 字体大小 */
margin-top: 0pt; /* 段前间距 */
margin-bottom: 0pt; /* 段后间距 */
"
></tinymce>
<div class="controls" style="overflow: hidden">
请在此区域粘贴 Word 表格<span> </span>
<div
v-show="!updatedHtml"
style="margin: 0 auto; box-sizing: border-box"
class="paste-area"
:style="`width: ${typesettingType == 1 ? 210 : 297}mm !important;
padding:25.4mm 19.1mm`"
contenteditable="true"
id="content"
ref="content"
@paste="handlePaste"
></div>
</div>
<!-- <div id="output" ref="output" v-html="updatedHtml"></div> -->
<!-- 要导出的内容 -->
<el-button @click="exportToWord">导出为 Word</el-button>
<el-button @click="downloadImage">导出为 图片</el-button>
</div>
</template>
<script>
import htmlDocx from 'html-docx-js/dist/html-docx.js';
import html2canvas from 'html2canvas';
import Tinymce from '@/components/page/components/Tinymce';
export default {
props: ['lineStyle'],
components: {
Tinymce
},
data() {
return {
showToolbar: false, // 是否显示工具栏
toolbarStyle: {
top: '0px',
left: '0px'
}, // 工具栏的样式
selectionRange: null, // 保存选区范围
updatedHtml: '',
imgHtml: '',
typesettingTypeOptions: [
{ label: this.$t('commonTable.typesettingType1'), value: 1, pageWidth: 210 },
{ label: this.$t('commonTable.typesettingType2'), value: 2, pageWidth: 297 }
],
transform: null,
typesettingType: 1
};
},
mounted() {
this.typesettingType = 1;
},
methods: {
handleTextSelection() {
// 获取用户的文本选区
const selection = window.getSelection();
if (selection && selection.rangeCount > 0) {
const range = selection.getRangeAt(0);
const selectedText = selection.toString();
if (selectedText.trim()) {
// 保存选区
this.selectionRange = range;
// 获取选区的边界矩形
const rect = range.getBoundingClientRect();
this.toolbarStyle = {
top: `${rect.top}px`,
left: `${rect.right}px`
};
// 显示工具栏
this.showToolbar = true;
} else {
// 如果没有选中文字,隐藏工具栏
this.showToolbar = false;
}
}
},
applyFormat(format, value) {
if (!this.selectionRange) return;
const wrapper = document.createElement('span');
switch (format) {
case 'bold':
wrapper.style.fontWeight = 'bold';
break;
case 'italic':
wrapper.style.fontStyle = 'italic';
break;
case 'color':
wrapper.style.color = value;
break;
}
// 用选区的内容替换为格式化后的内容
wrapper.appendChild(this.selectionRange.extractContents());
this.selectionRange.insertNode(wrapper);
// 清除选区
window.getSelection().removeAllRanges();
this.showToolbar = false;
},
downloadImage() {
this.$nextTick(() => {
this.$refs.tinymceChild.getContent('image');
return;
});
},
handlePaste(event) {
setTimeout(() => {
// 解析内容并替换表格
console.log('event.currentTarget.innerHTML at line 146:', event)
let replacedContent = this.setHtmlWord(event);
this.$nextTick(() => {
this.$refs.tinymceChild.tableSuccessCBK(replacedContent);
});
// 将新的内容插入到可编辑区域
// if (container && content) {
// const containerWidth = container.offsetWidth;
// const containerHeight = container.offsetHeight;
// const contentWidth = content.offsetWidth;
// const contentHeight = content.offsetHeight;
// // 计算缩放比例,保持等比例缩放
// const scale = Math.min(containerWidth / contentWidth, containerHeight / contentHeight);
// console.log('scale at line 60:', scale);
// // 应用缩放比例
// // content.style.transform = `scale(${scale})`;
// // content.style.transformOrigin = 'top left'; // 缩放基点
// if (content) {
// const updatedHtml = this.setHtmlWord();
// this.updatedHtml = updatedHtml.match(/<table[\s\S]*?<\/table>/i)[0];
// console.log('updatedHtml at line 114:', this.updatedHtml);
// }
// }
}, 50);
},
// 处理 td 点击事件
handleTdClick(index, content) {
alert(`Clicked TD ${index + 1}: ${content}`);
},
containsSupOrSub(element) {
// 如果当前节点是元素节点
if (element.nodeType === 1) {
// 如果是 <sup> 或 <sub> 标签,返回 true
if (element.tagName === 'SUP' || element.tagName === 'SUB') {
return true;
}
// 否则,递归检查子节点
return Array.from(element.childNodes).some((child) => this.containsSupOrSub(child));
}
// 如果不是元素节点(如文本节点),返回 false
return false;
},
setHtmlWord(setHtmlWord) {
// if (setHtmlWord.includes('<table')) {
// } else {
// return false;
// }
const html = setHtmlWord
.replace(
/<(table)([^>]*style="([^"]*)")/g, // 匹配有 style 属性的 <table>
(match, p1, p2, p3) => {
const existingStyle = p3;
// 如果现有样式不为空,则在原样式后追加新的样式
const updatedStyle = existingStyle
? existingStyle +
`; width: ${
this.typesettingType == 1 ? '488' : '736'
}pt !important; mso-padding-alt: 0.7500pt 0.7500pt 0.7500pt 0.7500pt;`
: `width: ${
this.typesettingType == 1 ? '488' : '736'
}pt !important; mso-padding-alt: 0.7500pt 0.7500pt 0.7500pt 0.7500pt;`;
var str = `<table${p2.replace(`style="${existingStyle}"`, `style="${updatedStyle}"`)}`;
return str;
}
)
.replace(/style="style=;/g, 'style="')
.replace(/;;/g, ';')
.replace(/\n/g, '<br>');
const container = document.createElement('div');
container.innerHTML = html;
const AllTd = container.querySelectorAll('table td'); // 获取 <tr> 中的所有 <td> 元素
const firstRowTdElementsAll = container.querySelectorAll('*'); // 获取第一个 <tr> 中的所有 <td> 元素
// 遍历所有 <td> 元素,添加上下边框样式
firstRowTdElementsAll.forEach((td) => {
let htmlContent = td.innerHTML;
const currentStyle = td.getAttribute('style');
if (currentStyle) {
td.setAttribute(
'style',
currentStyle +
";text-align:left;font-family:'Charis SIL' !important; font-size: 7.5000pt !important; mso-font-kerning: 1.0000pt !important; line-height: 10pt !important;mos-line-height: 10pt !important;"
);
} else {
td.setAttribute(
'style',
"text-align:left;font-family:'Charis SIL' !important; font-size: 7.5000pt !important; mso-font-kerning: 1.0000pt !important; line-height: 10pt !important;mos-line-height: 10pt !important;mso-line-height-rule: exactly !important;"
);
}
});
// 遍历所有 <td> 元素,添加上下边框样式
AllTd.forEach((td) => {
// td.textContent = td.textContent.replace(/<a[^>]*>(.*?)<\/a>/g, '$1');
// td.textContent = td.textContent.trimEnd();
if (/^-?\d+(\.\d+)?$/.test(td.textContent)) {
// 如果是纯数字(包括负数),替换负号为双负号
td.textContent = td.textContent.replace(/^-(?=\d)/, ''); // 替换负号为 "--"
}
const hasSupOrSub = this.containsSupOrSub(td); // 检查当前 td 是否包含上下标
if (!hasSupOrSub) {
td.textContent = td.textContent.replace(/(^|\s)(\w)/g, (match, space, firstLetter) => {
// 将首字母大写,并保持原始空格或其他字符
return space + firstLetter.toUpperCase();
});
td.textContent = td.textContent.replace(/<a\b[^>]*>(.*?)<\/a>/gi, (match, innerText) => {
return innerText; // 保留链接内部的内容
});
}
const currentStyle = td.getAttribute('style');
if (currentStyle) {
const regex = /\[\d+(?:,\d+)*\]/g;
if (regex.test(td.innerHTML)) {
// 如果匹配到,则对该 <td> 应用样式,比如改变文本颜色
td.setAttribute(
'style',
currentStyle +
';color:rgb(0,130,170) !important;border-left:none !important;mso-border-left-alt:none !important;border-right:none !important;mso-border-right-alt:none !important;border-top:none;mso-border-top-alt:none !important;border-bottom:none !important;mso-border-bottom-alt:none !important;'
);
} else {
td.setAttribute(
'style',
currentStyle +
';color:#000000 !important;border-left:none !important;mso-border-left-alt:none !important;border-right:none !important;mso-border-right-alt:none !important;border-top:none;mso-border-top-alt:none !important;border-bottom:none !important;mso-border-bottom-alt:none !important;'
);
}
} else {
if (regex.test(td.innerHTML)) {
// 如果匹配到,则对该 <td> 应用样式,比如改变文本颜色
td.setAttribute(
'style',
'color:rgb(0,130,170) !important;border-left:none !important;mso-border-left-alt:none !important;border-right:none !important;mso-border-right-alt:none !important;border-top:none;mso-border-top-alt:none !important;border-bottom:none !important;mso-border-bottom-alt:none !important;'
);
} else {
td.setAttribute(
'style',
'color:#000000 !important;border-left:none !important;mso-border-left-alt:none !important;border-right:none !important;mso-border-right-alt:none !important;border-top:none;mso-border-top-alt:none !important;border-bottom:none !important;mso-border-bottom-alt:none !important;'
);
}
}
});
const firstRowTdElements = container.querySelectorAll('tr:first-child td'); // 获取第一个 <tr> 中的所有 <td> 元素
// 遍历所有 <td> 元素,添加上下边框样式
firstRowTdElements.forEach((td) => {
const currentStyle = td.getAttribute('style');
if (currentStyle) {
td.setAttribute(
'style',
currentStyle +
';color:#000000 !important; border-top:1.0000pt solid #000 !important;mso-border-top-alt:0.5000pt solid #000 !important;border-bottom:1.0000pt solid #000 !important;mso-border-bottom-alt:0.5000pt solid #000 !important;'
);
} else {
td.setAttribute(
'style',
'color:#000000 !important;border-top:1.0000pt solid #000 !important;mso-border-top-alt:0.5000pt solid #000 !important;border-bottom:1.0000pt solid #000 !important;mso-border-bottom-alt:0.5000pt solid #000 !important;'
);
}
});
const firstRowTdElementsLast = container.querySelectorAll('tr:last-of-type td');
// 遍历所有 <td> 元素,添加上下边框样式
firstRowTdElementsLast.forEach((td) => {
// 获取当前的 style 属性(如果有)
const currentStyle = td.getAttribute('style');
// 如果已有 style 属性,则追加边框样式;如果没有 style 属性,则设置新的 style
if (currentStyle) {
td.setAttribute(
'style',
currentStyle + ';border-bottom:1.0000pt solid #000 !important;mso-border-bottom-alt:0.5000pt solid #000 !important;'
);
} else {
td.setAttribute(
'style',
'border-bottom:1.0000pt solid #000 !important;mso-border-bottom-alt:0.5000pt solid #000 !important;'
);
}
});
// 获取修改后的 HTML 内容
const updatedHtml = container.innerHTML;
this.$forceUpdate();
// 输出修改后的 HTML
return updatedHtml;
},
getContent(type, data) {
if (type == 'table') {
var tableHtml = `<html xmlns:w="urn:schemas-microsoft-com:office:word">
<head>
<style>
@page {
size: A4 !important;
margin: 1in;
size: landscape; /* 强制页面方向为横向 */
}
table {
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid #000;
padding: 8px;
text-align: left;
}
p,th, td,tr,table {
font-size: 7.5000pt; /* 字体大小 */
margin-top: 0pt; /* 段前间距 */
margin-bottom: 0pt; /* 段后间距 */
}
</style>
</head>
<body>
${data}
</body>
</html>
`;
console.log('tableHtml at line 150:', tableHtml);
const converted = htmlDocx.asBlob(tableHtml); // 将 HTML 转换为 Word Blob
// 触发文件下载
const link = document.createElement('a');
link.href = URL.createObjectURL(converted);
link.download = 'table.docx';
link.click();
} else if (type == 'image') {
// tinymce
// 显示内容的容器
const container = this.$refs.output;
console.log('outputDiv at line 358:', container);
const outputDiv = container.querySelector('table');
console.log('outputDiv at line 360:', outputDiv);
// 使用 html2canvas 将内容转为图片
html2canvas(outputDiv, {
scale: 3, // 提高图片的分辨率默认为1设置为2可以使图片更清晰
logging: false, // 禁用日志输出
useCORS: true, // 允许跨域图像
allowTaint: true // 允许污染 canvas解决图片链接不可用问题
})
// 清空现有内容,显示图片
.then((canvas) => {
// 创建一个图片对象
const imgData = canvas.toDataURL('image/png');
// 创建一个链接并下载图片
const link = document.createElement('a');
link.href = imgData;
link.download = 'image.png';
link.click();
});
}
},
exportToWord() {
this.$nextTick(() => {
this.$refs.tinymceChild.getContent('table');
return;
});
// 获取 HTML 内容
// console.log('html at line 118:', updatedHtml);
const tableHtml = `
<html xmlns:w="urn:schemas-microsoft-com:office:word">
<head>
<style>
@page {
size: A4 !important;
margin: 1in;
size: landscape; /* 强制页面方向为横向 */
}
table {
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid #000;
padding: 8px;
text-align: left;
}
p,th, td,tr,table {
font-size: 7.5000pt; /* 字体大小 */
margin-top: 0pt; /* 段前间距 */
margin-bottom: 0pt; /* 段后间距 */
}
</style>
</head>
<body>
<div align="center">
${
this.lineStyle.titleTop
? `<p
class="MsoNormal"
align="center"
style="
margin-bottom: 0pt;
mso-line-break-override: restrictions;
punctuation-wrap: simple;
text-align: center;
mso-outline-level: 1;
line-height: 10pt !important;mos-line-height: 10pt !important;
mso-line-height-rule: exactly;
"
>
<b
><span style="font-family: Charis SIL; font-size: 7.5pt"
>${this.lineStyle.titleTop}</span
></b
>
</p>`
: ``
}
${updatedHtml}
${
this.lineStyle.titleBot
? ` <p
class="MsoNormal"
style="
margin-bottom: 0pt;
mso-line-break-override: restrictions;
punctuation-wrap: simple;
mso-outline-level: 1;
line-height: 10pt !important;mos-line-height: 10pt !important;
mso-line-height-rule: exactly;
text-align: justify; /* 使用 CSS 标准的两端对齐 */
mso-text-align: justify; /* 确保 Word 中应用两端对齐 */
"
>
<span
style="
mso-spacerun: 'yes';
font-family: 宋体;
mso-ascii-font-family: 'Charis SIL';
mso-hansi-font-family: 'Charis SIL';
mso-bidi-font-family: 'Charis SIL';
font-size: 7.5pt;
mso-font-kerning: 1pt;
"
>${this.lineStyle.titleBot}</span
>
</p>`
: ``
}
</div>
</body>
</html>`;
console.log('tableHtml at line 150:', tableHtml);
const converted = htmlDocx.asBlob(tableHtml); // 将 HTML 转换为 Word Blob
// 触发文件下载
const link = document.createElement('a');
link.href = URL.createObjectURL(converted);
link.download = 'table.docx';
link.click();
}
}
};
</script>
<style scoped>
table {
border-collapse: collapse;
width: 100%;
margin: 20px 0;
}
th,
td {
border: 1px dashed #dcdfe6;
padding: 8px;
text-align: center;
position: relative;
}
table {
border-top: 2px solid #000;
border-bottom: 1px solid #000;
}
th {
border-bottom: 1px solid #000;
}
th input,
td input {
width: 100%;
border: none;
outline: none;
text-align: center;
}
th input,
td input ::placeholder {
color: #aaa !important;
}
.controls {
margin: 0 0 20px;
}
.drag-handle {
cursor: move;
}
::v-deep .paste-area {
height: auto; /* A4纸高度 */
background: white; /* 纸张背景 */
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* 添加阴影模拟纸张浮起 */
border: 1px solid #ddd; /* 模拟纸张边框 */
/* padding: 25.4mm 19.1mm; //内边距 */
box-sizing: border-box; /* 确保内边距不会影响整体尺寸 */
transform-origin: top left;
}
::v-deep .paste-area table {
/* border-top: 2px solid #000 !important; */
/* border-bottom: 1px solid #000 !important; */
margin-left: 0 !important;
margin-right: 0 !important;
margin: 0 auto !important;
}
::v-deep .paste-area table td {
border-top: none !important;
border-bottom: none !important;
border: 1px dashed #dcdfe6 !important;
/* display: flex;
align-items: center; */
}
::v-deep .paste-area table td p {
display: flex;
align-items: center;
}
::v-deep .paste-area table .MsoNormal {
max-width: 200px !important; /* 限制容器宽度 */
word-wrap: break-word !important;
overflow-wrap: break-word !important;
}
.text-container {
position: relative;
padding: 20px;
border: 1px solid #ccc;
margin: 20px;
font-size: 16px;
line-height: 1.5;
}
.toolbar {
position: absolute;
display: flex;
gap: 5px;
padding: 5px;
background-color: white;
border: 1px solid #ccc;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
z-index: 10;
}
.toolbar button {
padding: 5px 10px;
font-size: 16px;
cursor: pointer;
border: none;
background: none;
}
.toolbar button:hover {
background-color: #f0f0f0;
}
::v-deep #output table tr td {
border: 1px dashed #dcdfe6 !important;
border-left: 1px dashed #dcdfe6 !important;
border-right: 1px dashed #dcdfe6 !important;
}
::v-deep #output table tr td p {
display: flex;
align-items: center;
}
.modal {
z-index: 1000; /* 保证模态框 z-index 低于颜色选择框 */
}
</style>

View File

@@ -0,0 +1,251 @@
<template>
<div>
<div
class="paste-area"
:style="`width: ${210}mm !important;padding: 25.4mm 19.1mm;`"
> <div
class="paste-area"
:style="`width: 100% !important;`"
contenteditable="true"
id="content"
ref="content"
@paste="handlePaste"
></div></div>
<div class="controls" style="overflow: hidden;"> 请在此区域粘贴 Word 表格
<div class="paste-area" contenteditable="true" @paste="handlePaste">
</div>
<!-- <p style="float: left;">Add&nbsp;&nbsp;
<el-input style="width: 50px;" v-model="rowsNumber"></el-input>
<span>&nbsp;&nbsp;{{ $t('commonTable.rows') }} *&nbsp;&nbsp;</span>
<el-input style="width: 50px;" v-model="columnsNumber"></el-input>
<span>&nbsp;&nbsp;{{ $t('commonTable.columns') }}&nbsp;&nbsp;{{ $t('commonTable.table') }}</span>
<el-button style="margin-left: 20px;" @click="Generate">Generate</el-button>
</p> -->
<p style="float: right;">
<el-button @click="addRow">增加行</el-button>
<el-button @click="addColumn">增加列</el-button>
<el-button @click="mergeCells">合并选中单元格</el-button>
</p>
</div>
<table v-if="tableData.length > 0">
<tbody>
<tr v-for="(row, rowIndex) in tableData" :key="rowIndex">
<td v-for="(cell, colIndex) in row" :key="colIndex" contenteditable="true">
{{ cell }}
</td>
</tr>
</tbody>
</table>
<!-- <table>
<thead>
<tr>
<th
v-for="(header, index) in headers"
:key="index"
draggable="true"
@dragstart="startDrag(index)"
@dragover.prevent
@drop="dropColumn(index)"
>
<input v-model="headers[index]" :placeholder="$t('commonTable.headerPlaceholder')" />
</th>
</tr>
</thead>
<tbody>
<tr v-for="(row, rowIndex) in rows" :key="rowIndex">
<td
v-for="(cell, colIndex) in row"
:key="colIndex"
@click="selectCell(rowIndex, colIndex)"
:colspan="cell.colspan"
:rowspan="cell.rowspan"
v-if="!cell.merged"
>
<input v-model="cell.value" placeholder="" />
</td>
</tr>
</tbody>
</table> -->
</div>
</template>
<script>
export default {
data() {
return {
tableData: [], // 表格数据
rowsNumber:'',
columnsNumber:'',
headers: [], // 表头
rows: [
[
{ value: '', rowspan: 1, colspan: 1, merged: false },
{ value: '', rowspan: 1, colspan: 1, merged: false },
{ value: '', rowspan: 1, colspan: 1, merged: false }
]
], // 表格数据
selectedCells: [], // 存储选中的单元格
draggedColumnIndex: null // 拖拽的列索引
};
},
methods: {
handlePaste(event) {
// event.preventDefault(); // 阻止默认粘贴行为
// 获取剪贴板 HTML 内容
// const clipboardData = event.clipboardData || window.clipboardData;
// const htmlData = clipboardData.getData("text/html");
// if (!htmlData) {
// alert("未检测到表格内容!");
// return;
// }
// // 创建 DOM 元素解析 HTML
// const parser = new DOMParser();
// const doc = parser.parseFromString(htmlData, "text/html");
// const table = doc.querySelector("table");
// if (!table) {
// alert("粘贴内容中没有表格!");
// return;
// }
// // 提取表格数据
// const rows = Array.from(table.rows).map(row =>
// Array.from(row.cells).map(cell => cell.innerText.trim()) // innerText 保留换行符
// );
// this.tableData = rows; // 更新表格数据
},
Generate(){
for(let i=0;i<this.columnsNumber;i++){
this.headers.push('')
}
},
addRow() {
const newRow = this.headers.map(() => ({
value: '',
rowspan: 1,
colspan: 1,
merged: false
}));
this.rows.push(newRow);
},
addColumn() {
this.headers.push(`${this.headers.length + 1}`);
this.rows.forEach((row) => {
row.push({ value: '', rowspan: 1, colspan: 1, merged: false });
});
},
startDrag(index) {
this.draggedColumnIndex = index;
},
dropColumn(index) {
if (this.draggedColumnIndex === null || this.draggedColumnIndex === index) return;
const draggedHeader = this.headers.splice(this.draggedColumnIndex, 1)[0];
this.headers.splice(index, 0, draggedHeader);
this.rows.forEach((row) => {
const draggedCell = row.splice(this.draggedColumnIndex, 1)[0];
row.splice(index, 0, draggedCell);
});
this.draggedColumnIndex = null;
},
selectCell(rowIndex, colIndex) {
this.selectedCells.push({ row: rowIndex, col: colIndex });
},
mergeCells() {
if (this.selectedCells.length < 2) return;
const rows = this.selectedCells.map((cell) => cell.row);
const cols = this.selectedCells.map((cell) => cell.col);
const minRow = Math.min(...rows);
const maxRow = Math.max(...rows);
const minCol = Math.min(...cols);
const maxCol = Math.max(...cols);
for (let r = minRow; r <= maxRow; r++) {
for (let c = minCol; c <= maxCol; c++) {
if (r === minRow && c === minCol) {
this.rows[r][c].rowspan = maxRow - minRow + 1;
this.rows[r][c].colspan = maxCol - minCol + 1;
} else {
this.rows[r][c].merged = true;
}
}
}
this.selectedCells = [];
}
}
};
</script>
<style scoped>
table {
border-collapse: collapse;
width: 100%;
margin: 20px 0;
}
th, td {
border: 1px dashed #DCDFE6;
padding: 8px;
text-align: center;
position: relative;
}
table{
border-top: 2px solid #000;
border-bottom: 1px solid #000;
}
th{
border-bottom: 1px solid #000;
}
th input, td input {
width: 100%;
border: none;
outline: none;
text-align: center;
}
th input, td input ::placeholder{
color:#aaa !important;
}
.controls {
margin:0 0 20px;
}
.drag-handle {
cursor: move;
}
::v-deep .paste-area {
width: 100%;
}
::v-deep .paste-area .MsoNormalTable{
border-top: 2px solid #000 !important;
border-bottom: 1px solid #000 !important;
margin-left: 0!important;
margin-right: 0!important;
margin: 0 auto !important;
}
::v-deep .paste-area .MsoNormalTable td{
border-top: none !important;
border-bottom: none !important;
border: 1px dashed #DCDFE6 !important;
}
</style>

View File

@@ -0,0 +1,151 @@
<template>
<div>
<div>
<!-- <el-select v-model="typesettingType">
<el-option v-for="item in typesettingTypeOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select> -->
<!-- <span style="margin-left:10px ;">请在下面区域粘贴 Word 表格</span> -->
<tinymce
ref="tinymceChild"
:value="updatedHtml"
:typesettingType="typesettingType"
class="paste-area text-container"
style="
white-space: pre-line;
line-height: 12px;
max-height: 50vh;
overflow: auto;
font-size: 12px;
font-size: 7.5pt; /* 字体大小 */
margin-top: 0pt; /* 段前间距 */
margin-bottom: 0pt; /* 段后间距 */
"
></tinymce>
</div>
</div>
</template>
<script>
import Tinymce from '@/components/page/components/Tinymce';
export default {
props: ['lineStyle'],
components: {
Tinymce
},
data() {
return {
showToolbar: false, // 是否显示工具栏
toolbarStyle: {
top: '0px',
left: '0px'
}, // 工具栏的样式
selectionRange: null, // 保存选区范围
updatedHtml: '',
imgHtml: '',
typesettingTypeOptions: [
{ label: this.$t('commonTable.typesettingType1'), value: 1, pageWidth: 210 },
{ label: this.$t('commonTable.typesettingType2'), value: 2, pageWidth: 297 }
],
transform: null,
typesettingType: 1
};
},
mounted() {
this.typesettingType = 1;
},
methods: {
}
};
</script>
<style scoped>
table {
border-collapse: collapse;
width: 100%;
margin: 20px 0;
}
th,
td {
border: 1px dashed #dcdfe6;
padding: 8px;
text-align: center;
position: relative;
}
table {
border-top: 2px solid #000;
border-bottom: 1px solid #000;
}
th {
border-bottom: 1px solid #000;
}
th input,
td input {
width: 100%;
border: none;
outline: none;
text-align: center;
}
th input,
td input ::placeholder {
color: #aaa !important;
}
.controls {
margin: 0 0 20px;
}
.drag-handle {
cursor: move;
}
::v-deep .paste-area {
height: auto; /* A4纸高度 */
background: white; /* 纸张背景 */
/* padding: 25.4mm 19.1mm; //内边距 */
box-sizing: border-box; /* 确保内边距不会影响整体尺寸 */
transform-origin: top left;
}
::v-deep .paste-area table {
/* border-top: 2px solid #000 !important; */
/* border-bottom: 1px solid #000 !important; */
margin-left: 0 !important;
margin-right: 0 !important;
margin: 0 auto !important;
}
::v-deep .paste-area table td {
border-top: none !important;
border-bottom: none !important;
border: 1px dashed #dcdfe6 !important;
/* display: flex;
align-items: center; */
}
::v-deep .paste-area table td p {
display: flex;
align-items: center;
}
::v-deep .paste-area table .MsoNormal {
max-width: 200px !important; /* 限制容器宽度 */
word-wrap: break-word !important;
overflow-wrap: break-word !important;
}
.text-container {
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -15,6 +15,10 @@ import Common from './components/common/common'
Vue.prototype.$validateString = function (str) {
return /^[a-zA-Z\s-]+$/.test(str);
}
import VXETable from 'vxe-table'
import 'vxe-table/lib/style.css'
Vue.use(VXETable)
// 引入富文本编辑器
import VueQuillEditor from 'vue-quill-editor'
@@ -62,6 +66,12 @@ Vue.prototype.$echarts = echarts
Vue.prototype.$api = api
Vue.config.productionTip = false;
import Editor from "@tinymce/tinymce-vue"; // 默认导入
Vue.component("Editor", Editor);
import commonTable from '@/components/page/components/table/table.vue'
Vue.component('common-table', commonTable);
Vue.use(VueI18n);
Vue.use(ElementUI, {
size: 'small',

View File

@@ -942,6 +942,13 @@ export default new Router({
title: 'Reference Workflow'
}
},
{
path: '/GenerateCharts', //用户端预收录-引用编辑
component: () => import('../components/page/GenerateCharts'),
meta: {
title: 'Generate Charts'
}
},
{
name: 'PreIngestedEditor',
path: '/PreIngestedEditor', // 编辑端 - 预收录编辑页面

View File

@@ -72,9 +72,9 @@ module.exports = {
// target: 'https://www.tmrjournals.cn',
// target: 'http://www.tougao.com/public/index.php/',
// target: 'http://www.tougao.com/',
target: 'http://192.168.110.110/tougao/public/index.php/',
// target: 'http://192.168.110.110/tougao/public/index.php/',
// target: 'http://api.tmrjournals.com/public/index.php/',//正式
// target: 'https://submission.tmrjournals.com/',//正式
target: 'https://submission.tmrjournals.com/',//正式
changeOrigin: true,
pathRewrite: {
'^/api': ''