Commit 9ce709bc authored by shuaiqiang's avatar shuaiqiang 🇨🇳

refactor:文件分割,上传,转换工具

parent 0df7121f
import service from '@utils/GraphApiService'
export function CnConversionPCT(baseURL, data) {
return service({
baseURL: baseURL,
url: 'Word/CN2PCT',
method: 'post',
data
})
}
export function fetchDownloadFile(baseURL, params) {
return service({
baseURL: baseURL,
url: 'RequestPayment/DownloadFile',
method: 'get',
responseType: 'blob',
params
})
}
// export function CnConversionPCT(baseURL, data) {
// return service({
// baseURL: baseURL,
// url: 'Word/CN2PCT',
// method: 'post',
// data
// })
// }
\ No newline at end of file
import service from '@utils/requestService'
export function SplitRevisionDoc(baseURL, data) {
return service({
baseURL: baseURL,
url: 'api/v1.0/Word/SplitRevisionDoc',
method: 'post',
data
})
}
\ No newline at end of file
import service from '@utils/requestService'
export function createHxRequestPaymentVerticalTotal(data) {
return service({
url: 'api/v1.0/RequestPayment/ChangeHXRequestPaymentVerticalTotal',
method: 'POST',
data
})
}
export function createHxRequestPaymentVerticalTotal2(data) {
return service({
url: 'api/v1.0/RequestPayment/ChangeHXRequestPaymentVerticalTotal2',
method: 'POST',
data
})
}
export function downloadFile(params) {
return service({
url: 'api/v1.0/RequestPayment/DownloadFile',
method: 'GET',
params,
responseType: 'blob'
})
}
module.exports = {
prod_sz:{
VUE_APP_GRAPHAPI_URL :'https://pvapi.purplevineip.com/graphAPI/api/v1.0/'
prod_sz: {
VUE_APP_GRAPHAPI_URL: 'https://pvapi.purplevineip.com/graphAPI/api/v1.0/'
},
prod_tp:{
VUE_APP_GRAPHAPI_URL : 'https://pvapi.purplevineip.com/graphAPI/api/v1.0/'
prod_tp: {
VUE_APP_GRAPHAPI_URL: 'https://pvapi.purplevineip.com/graphAPI/api/v1.0/'
},
prod_test_sz:{
VUE_APP_GRAPHAPI_URL : 'https://dev.essenptl.com/graphAPITest/api/v1.0/'
prod_test_sz: {
VUE_APP_GRAPHAPI_URL: 'https://dev.essenptl.com/graphAPITest/api/v1.0/'
},
dev_tp:{
VUE_APP_GRAPHAPI_URL : 'http://localhost:64224/api/v1.0/'
prod_file_sz: {
VUE_APP_GRAPHAPI_URL: 'https://dev.essenptl.com/dev2/wade_ext/'
},
dev_sz:{
VUE_APP_GRAPHAPI_URL : 'http://localhost:64224/api/v1.0/'
dev_tp: {
VUE_APP_GRAPHAPI_URL: 'http://localhost:64224/api/v1.0/'
},
dev_test_tp:{
VUE_APP_GRAPHAPI_URL : 'https://dev.essenptl.com/graphAPITest/api/v1.0/'
dev_sz: {
VUE_APP_GRAPHAPI_URL: 'http://localhost:64224/api/v1.0/'
},
dev_test_sz:{
VUE_APP_GRAPHAPI_URL : 'https://dev.essenptl.com/graphAPITest/api/v1.0/'
}
dev_test_tp: {
VUE_APP_GRAPHAPI_URL: 'https://dev.essenptl.com/graphAPITest/api/v1.0/'
},
dev_test_sz: {
VUE_APP_GRAPHAPI_URL: 'https://dev.essenptl.com/graphAPITest/api/v1.0/',
},
dev_file_tp: {
VUE_APP_GRAPHAPI_URL: 'https://dev.essenptl.com/dev2/wade_ext/'
},
dev_file_sz: {
VUE_APP_GRAPHAPI_URL: 'https://dev.essenptl.com/dev2/wade_ext/'
},
VUE_APP_USER_ID_MODE: 'variable'
}
\ No newline at end of file
......@@ -2,12 +2,16 @@
<div id="app">
Hi app
<pLink type="primary">Test</pLink>
<splitTool env="dev_test_sz"></splitTool>
<!-- <splitTool env="dev_test_sz"></splitTool> -->
<!-- <convertTool env="dev_test_sz"></convertTool> -->
<!-- <upload env="dev_file_sz"></upload> -->
<uploadExcel env="dev_test_sz"></uploadExcel>
<!-- <fileSplit env="dev_file_sz"></fileSplit> -->
</div>
</template>
<script>
export default {
name: 'App'
name: "App"
}
</script>
\ No newline at end of file
import Vue from 'vue'
import App from './App.vue'
import store from './store'
import purpUI from '../packages'
import ElementUI from 'element-ui';
......@@ -10,5 +11,6 @@ Vue.config.productionTip = false
Vue.use(purpUI)
new Vue({
store,
render: h => h(App),
}).$mount('#app')
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
// https://webpack.js.org/guides/dependency-management/#requirecontext
const modulesFiles = require.context('./modules', true, /\.js$/)
// you do not need `import app from './modules/app'`
// it will auto require all vuex module from modules file
const modules = modulesFiles.keys().reduce((modules, modulePath) => {
// set './app.js' => 'app'
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
const value = modulesFiles(modulePath)
modules[moduleName] = value.default
return modules
}, {})
const store = new Vuex.Store({
modules
})
export default store
function getUserId() {
console.log(`current getUserIdMode:variable`)
switch ('variable' || 'localStorage') {
case 'variable':
return 'f12e6db7-99f7-43c9-88ec-3c77d4f173bd'
case 'localStorage':
return localStorage.getItem('user_id')
}
}
const state = {
wadeUserID: getUserId()
}
const mutations = {
SET_USERID: (stete, userID) => {
state.wadeUserID = userID
}
}
const actions = {
setUserID({ commit, state }) {
commit('SET_USERID', state.userID)
}
}
const getters = {
wadeUserID: state => state.wadeUserID
}
export default {
namespaced: true,
state,
mutations,
actions,
getters
}
This source diff could not be displayed because it is too large. You can view the blob instead.
.p-link-default[data-v-30dd6ef1]{color:#606266}.p-link-primary[data-v-30dd6ef1]{color:#409eff}
\ No newline at end of file
.p-link-default[data-v-30dd6ef1]{color:#606266}.p-link-primary[data-v-30dd6ef1]{color:#409eff}.el-form .el-form-item[data-v-8461da98]{margin:10px 0}.el-form .el-form-item .el-radio-group[data-v-8461da98]{margin-left:20px}.el-form .el-form-item input[data-v-8461da98]{width:126px;margin-left:10px;outline:none;border:0;background:#c6c6c6}.choose-box[data-v-8461da98]{margin-left:200px;border:1px solid #000;width:220px}.choose-box div>span[data-v-8461da98]{display:inline-block;width:56px;text-align:center;margin:10px 5px;border:1px solid #000}input[data-v-8461da98]::-webkit-input-placeholder{font-size:12px;opacity:.8}[data-v-8461da98] .el-form-item__content{line-height:1.5!important}.excel-upload-input[data-v-77bf1e84]{display:none;z-index:-9999}.drop[data-v-77bf1e84]{border:2px dashed #bbb;width:600px;height:160px;line-height:160px;margin:0 auto;font-size:24px;border-radius:5px;text-align:center;color:#bbb;position:relative}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -9,9 +9,12 @@
"version": "0.1.2",
"dependencies": {
"axios": "^0.27.2",
"core-js": "^3.8.3",
"element-ui": "^2.15.9",
"vue": "^2.6.14"
"core-js": "^3.25.0",
"element-ui": "^2.9.2",
"moment": "^2.29.4",
"vue": "^2.6.14",
"vuex": "^3.4.0",
"xlsx": "^0.18.5"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~5.0.0",
......@@ -21,7 +24,6 @@
"vue-template-compiler": "^2.6.14"
},
"peerDependencies": {
"element-ui": "^2.15.9",
"sass-loader": "^12.0.0",
"vue": "^2.6.14"
}
......@@ -2973,6 +2975,14 @@
"node": ">= 10.0.0"
}
},
"node_modules/adler-32": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.1.tgz",
"integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==",
"engines": {
"node": ">=0.8"
}
},
"node_modules/ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
......@@ -3616,6 +3626,18 @@
"node": ">=4"
}
},
"node_modules/cfb": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz",
"integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==",
"dependencies": {
"adler-32": "~1.3.0",
"crc-32": "~1.2.0"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
......@@ -3853,6 +3875,14 @@
"node": ">=6"
}
},
"node_modules/codepage": {
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz",
"integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==",
"engines": {
"node": ">=0.8"
}
},
"node_modules/color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
......@@ -4140,6 +4170,17 @@
"node": ">=10"
}
},
"node_modules/crc-32": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
"bin": {
"crc32": "bin/crc32.njs"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/cross-spawn": {
"version": "6.0.5",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
......@@ -4830,9 +4871,9 @@
"dev": true
},
"node_modules/element-ui": {
"version": "2.15.9",
"resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.15.9.tgz",
"integrity": "sha512-dx45nQLt4Hn87/Z9eRr3ex6KFZbxlFAwEU3QoW3wA5EsYftvHTyL9Pq7VnXXD7hu1Eiaup2jcs6kp+/VSFmXuA==",
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.9.2.tgz",
"integrity": "sha512-HU5DDKivv2UFZghVWiP3I74IbTzSW8VXc070fM787i1X/u9f43olDuu3S6Pe9z87Z1oNjXt06ZmBlLYtySJMCw==",
"dependencies": {
"async-validator": "~1.8.1",
"babel-helper-vue-jsx-merge-props": "^2.0.0",
......@@ -5323,6 +5364,14 @@
"node": ">= 0.6"
}
},
"node_modules/frac": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/frac/-/frac-1.1.2.tgz",
"integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==",
"engines": {
"node": ">=0.8"
}
},
"node_modules/fraction.js": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.0.tgz",
......@@ -6827,6 +6876,14 @@
"integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==",
"dev": true
},
"node_modules/moment": {
"version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
"engines": {
"node": "*"
}
},
"node_modules/mrmime": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz",
......@@ -8929,6 +8986,17 @@
"wbuf": "^1.7.3"
}
},
"node_modules/ssf": {
"version": "0.11.2",
"resolved": "https://registry.npmjs.org/ssf/-/ssf-0.11.2.tgz",
"integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
"dependencies": {
"frac": "~1.1.2"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/ssri": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz",
......@@ -9647,6 +9715,14 @@
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
"dev": true
},
"node_modules/vuex": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.4.0.tgz",
"integrity": "sha512-ajtqwEW/QhnrBZQsZxCLHThZZaa+Db45c92Asf46ZDXu6uHXgbfVuBaJ4gzD2r4UX0oMJHstFwd2r2HM4l8umg==",
"peerDependencies": {
"vue": "^2.0.0"
}
},
"node_modules/watchpack": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz",
......@@ -10154,6 +10230,22 @@
"integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==",
"dev": true
},
"node_modules/wmf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz",
"integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==",
"engines": {
"node": ">=0.8"
}
},
"node_modules/word": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/word/-/word-0.3.0.tgz",
"integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==",
"engines": {
"node": ">=0.8"
}
},
"node_modules/wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
......@@ -10231,6 +10323,26 @@
}
}
},
"node_modules/xlsx": {
"version": "0.18.5",
"resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.18.5.tgz",
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
"dependencies": {
"adler-32": "~1.3.0",
"cfb": "~1.2.1",
"codepage": "~1.15.0",
"crc-32": "~1.2.1",
"ssf": "~0.11.2",
"wmf": "~1.0.1",
"word": "~0.3.0"
},
"bin": {
"xlsx": "bin/xlsx.njs"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/y18n": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
......@@ -12512,6 +12624,11 @@
"integrity": "sha512-tNEZYz5G/zYunxFm7sfhAxkXEuLj3K6BKwv6ZURlsF6yiUQ65z0Q2wZW9L5cPUl9ocofGvXOdFYbFHp0+6MOig==",
"dev": true
},
"adler-32": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.1.tgz",
"integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A=="
},
"ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
......@@ -12979,6 +13096,15 @@
"integrity": "sha512-roIFONhcxog0JSSWbvVAh3OocukmSgpqOH6YpMkCvav/ySIV3JKg4Dc8vYtQjYi/UxpNE36r/9v+VqTQqgkYmw==",
"dev": true
},
"cfb": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz",
"integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==",
"requires": {
"adler-32": "~1.3.0",
"crc-32": "~1.2.0"
}
},
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
......@@ -13151,6 +13277,11 @@
"shallow-clone": "^3.0.0"
}
},
"codepage": {
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz",
"integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA=="
},
"color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
......@@ -13373,6 +13504,11 @@
"yaml": "^1.10.0"
}
},
"crc-32": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ=="
},
"cross-spawn": {
"version": "6.0.5",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
......@@ -13862,9 +13998,9 @@
"dev": true
},
"element-ui": {
"version": "2.15.9",
"resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.15.9.tgz",
"integrity": "sha512-dx45nQLt4Hn87/Z9eRr3ex6KFZbxlFAwEU3QoW3wA5EsYftvHTyL9Pq7VnXXD7hu1Eiaup2jcs6kp+/VSFmXuA==",
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.9.2.tgz",
"integrity": "sha512-HU5DDKivv2UFZghVWiP3I74IbTzSW8VXc070fM787i1X/u9f43olDuu3S6Pe9z87Z1oNjXt06ZmBlLYtySJMCw==",
"requires": {
"async-validator": "~1.8.1",
"babel-helper-vue-jsx-merge-props": "^2.0.0",
......@@ -14251,6 +14387,11 @@
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
"dev": true
},
"frac": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/frac/-/frac-1.1.2.tgz",
"integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA=="
},
"fraction.js": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.0.tgz",
......@@ -15374,6 +15515,11 @@
"integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==",
"dev": true
},
"moment": {
"version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
},
"mrmime": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz",
......@@ -16900,6 +17046,14 @@
"wbuf": "^1.7.3"
}
},
"ssf": {
"version": "0.11.2",
"resolved": "https://registry.npmjs.org/ssf/-/ssf-0.11.2.tgz",
"integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
"requires": {
"frac": "~1.1.2"
}
},
"ssri": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz",
......@@ -17424,6 +17578,12 @@
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
"dev": true
},
"vuex": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.4.0.tgz",
"integrity": "sha512-ajtqwEW/QhnrBZQsZxCLHThZZaa+Db45c92Asf46ZDXu6uHXgbfVuBaJ4gzD2r4UX0oMJHstFwd2r2HM4l8umg==",
"requires": {}
},
"watchpack": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz",
......@@ -17796,6 +17956,16 @@
"integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==",
"dev": true
},
"wmf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz",
"integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw=="
},
"word": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/word/-/word-0.3.0.tgz",
"integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA=="
},
"wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
......@@ -17846,6 +18016,20 @@
"dev": true,
"requires": {}
},
"xlsx": {
"version": "0.18.5",
"resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.18.5.tgz",
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
"requires": {
"adler-32": "~1.3.0",
"cfb": "~1.2.1",
"codepage": "~1.15.0",
"crc-32": "~1.2.1",
"ssf": "~0.11.2",
"wmf": "~1.0.1",
"word": "~0.3.0"
}
},
"y18n": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
......
......@@ -10,9 +10,12 @@
},
"dependencies": {
"axios": "^0.27.2",
"core-js": "^3.8.3",
"element-ui": "^2.15.9",
"vue": "^2.6.14"
"core-js": "^3.25.0",
"element-ui": "^2.9.2",
"moment": "^2.29.4",
"vue": "^2.6.14",
"vuex": "^3.4.0",
"xlsx": "^0.18.5"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~5.0.0",
......@@ -21,10 +24,9 @@
"sass-loader": "^12.0.0",
"vue-template-compiler": "^2.6.14"
},
"peerDependencies":{
"element-ui": "^2.15.9",
"vue": "^2.6.14",
"sass-loader": "^12.0.0"
"peerDependencies": {
"sass-loader": "^12.0.0",
"vue": "^2.6.14"
},
"browserslist": [
"> 1%",
......
import convertTool from './src'
convertTool.install = function (Vue) {
Vue.component(convertTool.name, convertTool)
}
export default convertTool
\ No newline at end of file
<template>
<div>
<h3>CN稿转成CPC</h3>
<el-alert
title="此功能将协助您将CN稿快速转换成CPC的排版, CN稿中须包含下列几种标题 1.说明书摘要 2.权利要求书 3.说明书 4.说明书附图或摘要附图"
type="info"
/>
<br>
<el-form ref="searchForm" size="small" label-width="160px">
<el-row>
<el-col :span="12">
<el-form-item label="CN稿" prop="business">
<el-upload
ref="upload"
class="upload-demo"
drag
:limit="1"
:file-list="fileList"
:action="uploadURL"
:on-change="handelFileChange"
:on-remove="handleFileRemove"
:on-exceed="handleExceed"
:auto-upload="false"
accept="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处,或<em>点击上传</em>
</div>
</el-upload>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12" :offset="10">
<el-button
style="margin-left: 10px"
size="small"
type="success"
@click="submitUpload"
>
开始转换
</el-button>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script>
import { CnConversionPCT,fetchDownloadFile } from "@api/convertApi";
import GraphApiService from '@utils/GraphApiService'
export default {
name: 'Cn2CpcForm',
data: function() {
return {
uploadURL: 'Word/CN2CPC',
fileList: []
}
},
props:{
baseUrl:{
type: String
}
},
methods: {
// 上传到服务器
submitUpload() {
console.log(this.fileList)
if (this.fileList.length <= 0) {
this.$message.error('请先选择需要上传的文件!')
return false
}
const formData = new FormData()
this.fileList.forEach(e => {
formData.append('file', e.raw)
})
GraphApiService
.post('Word/CN2CPC', formData)
.then(res => {
if (res.status === 200) {
this.fileList = []
this.$refs.upload.clearFiles()
const excelFileName = res.data
GraphApiService
.get('RequestPayment/DownloadFile', {
params: {
fileName: excelFileName
},
responseType: 'blob'
})
.then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
downloadElement.href = href
downloadElement.download = excelFileName.split('/')[1]
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement)
window.URL.revokeObjectURL(href)
})
} else {
this.$refs.upload.abort()
this.$message.error('下载档案失败!')
}
console.log(res.data)
})
.catch(error => {
console.log('error', error)
this.$refs.upload.abort()
this.$message.error('下载档案失败!')
})
},
// 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
handelFileChange(file, fileList) {
// 存在文件标识
let existsFileFlag = false
for (let i = 0; i < this.fileList.length; i++) {
if (
file.name === this.fileList[i].name &&
file.size === this.fileList[i].size
) {
// 如果存在了,赋值true
existsFileFlag = true
}
}
// 遍历的这个文件存在当前列表直接结束
if (existsFileFlag) {
// 否则不加入
fileList.pop()
// console.log(`文件已经存在:${file.name}`)
// this.handleMsg(`文件已经选择过了:${file.name})`);
this.$message({
showClose: true,
message: `文件已经选择过了:${file.name})`,
type: 'error'
})
return
}
this.fileList.push(file)
},
handelDetailFileChange(file, fileList) {
// 存在文件标识
let existsFileFlag = false
for (let i = 0; i < this.detailFileList.length; i++) {
if (
file.name === this.detailFileList[i].name &&
file.size === this.detailFileList[i].size
) {
// 如果存在了,赋值true
existsFileFlag = true
}
}
// 遍历的这个文件存在当前列表直接结束
if (existsFileFlag) {
// 否则不加入
fileList.pop()
// console.log(`文件已经存在:${file.name}`)
// this.handleMsg(`文件已经选择过了:${file.name})`);
this.$message({
showClose: true,
message: `文件已经选择过了:${file.name})`,
type: 'error'
})
return
}
this.detailFileList.push(file)
},
// 文件列表移除文件时的钩子
handleFileRemove(file, fileList) {
this.fileList = fileList
},
handleDetailFileRemove(file, fileList) {
this.detailFileList = fileList
},
handleExceed(files, fileList) {
this.$set(fileList[0], 'raw', files[0])
this.$set(fileList[0], 'name', files[0].name)
this.$refs['rebateUpload'].clearFiles()// 清除文件
this.$refs['rebateUpload'].handleStart(files[0])// 选择文件后的赋值方法
}
}
}
</script>
<template>
<div>
<h3>CN稿转成PCT稿</h3>
<el-alert
title="此功能将协助您将CN稿快速转换成PC稿的排版, CN稿中须包含下列几种标题 1.说明书摘要 2.权利要求书 3.说明书 4.说明书附图或摘要附图, 并且标题需设置下框线"
type="info"
/>
<br>
<el-form ref="searchForm" size="small" label-width="160px">
<el-row>
<el-col :span="12">
<el-form-item label="CN稿" prop="business">
<el-upload
ref="upload"
class="upload-demo"
drag
:limit="1"
:file-list="fileList"
:action="uploadURL"
:on-change="handelFileChange"
:on-remove="handleFileRemove"
:on-exceed="handleExceed"
:auto-upload="false"
accept="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处,或<em>点击上传</em>
</div>
</el-upload>
<el-link target="_blank" type="primary" href="https://essenptl-my.sharepoint.com/personal/service_essenptl_com/_layouts/15/onedrive.aspx?id=%2Fpersonal%2Fservice%5Fessenptl%5Fcom%2FDocuments%2F%E7%B4%AB%E8%97%A4%2Dshare%20folder%2FIT%2FDocument%2F%E4%B8%93%E5%88%A9%E4%BB%A3%E7%90%86%E4%B8%9A%E5%8A%A1%E6%A8%A1%E6%9D%BF2020%2Ezip&parent=%2Fpersonal%2Fservice%5Fessenptl%5Fcom%2FDocuments%2F%E7%B4%AB%E8%97%A4%2Dshare%20folder%2FIT%2FDocument">
模板下載
</el-link>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12" :offset="10">
<el-button
style="margin-left: 10px"
size="small"
type="success"
@click="submitUpload"
>
开始转换
</el-button>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script>
import { CnConversionPCT,fetchDownloadFile } from "@api/convertApi";
import GraphApiService from '@utils/GraphApiService'
export default {
name: 'Cn2PctForm',
data: function() {
return {
uploadURL: 'Word/CN2PCT',
fileList: []
}
},
props:{
baseUrl:{
type: String
}
},
methods: {
// 上传到服务器
async submitUpload() {
console.log(this.fileList)
if (this.fileList.length <= 0) {
this.$message.error('请先选择需要上传的文件!')
return false
}
const formData = new FormData()
this.fileList.forEach(e => {
formData.append('file', e.raw)
})
console.log(this.baseUrl)
GraphApiService
.post('Word/CN2PCT', formData)
.then(res => {
if (res.status === 200) {
this.fileList = []
this.$refs.upload.clearFiles()
const excelFileName = res.data
GraphApiService
.get('RequestPayment/DownloadFile', {
params: {
fileName: excelFileName
},
responseType: 'blob'
})
.then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
downloadElement.href = href
downloadElement.download = excelFileName.split('/')[1]
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement)
window.URL.revokeObjectURL(href)
})
} else {
this.$refs.upload.abort()
this.$message.error('下载档案失败!')
}
console.log(res.data)
})
.catch(error => {
console.log('error', error)
this.$refs.upload.abort()
this.$message.error('下载档案失败!')
})
},
// 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
handelFileChange(file, fileList) {
// 存在文件标识
let existsFileFlag = false
for (let i = 0; i < this.fileList.length; i++) {
if (
file.name === this.fileList[i].name &&
file.size === this.fileList[i].size
) {
// 如果存在了,赋值true
existsFileFlag = true
}
}
// 遍历的这个文件存在当前列表直接结束
if (existsFileFlag) {
// 否则不加入
fileList.pop()
// console.log(`文件已经存在:${file.name}`)
// this.handleMsg(`文件已经选择过了:${file.name})`);
this.$message({
showClose: true,
message: `文件已经选择过了:${file.name})`,
type: 'error'
})
return
}
this.fileList.push(file)
},
handelDetailFileChange(file, fileList) {
// 存在文件标识
let existsFileFlag = false
for (let i = 0; i < this.detailFileList.length; i++) {
if (
file.name === this.detailFileList[i].name &&
file.size === this.detailFileList[i].size
) {
// 如果存在了,赋值true
existsFileFlag = true
}
}
// 遍历的这个文件存在当前列表直接结束
if (existsFileFlag) {
// 否则不加入
fileList.pop()
// console.log(`文件已经存在:${file.name}`)
// this.handleMsg(`文件已经选择过了:${file.name})`);
this.$message({
showClose: true,
message: `文件已经选择过了:${file.name})`,
type: 'error'
})
return
}
this.detailFileList.push(file)
},
// 文件列表移除文件时的钩子
handleFileRemove(file, fileList) {
this.fileList = fileList
},
handleDetailFileRemove(file, fileList) {
this.detailFileList = fileList
},
handleExceed(files, fileList) {
this.$set(fileList[0], 'raw', files[0])
this.$set(fileList[0], 'name', files[0].name)
this.$refs['rebateUpload'].clearFiles()// 清除文件
this.$refs['rebateUpload'].handleStart(files[0])// 选择文件后的赋值方法
}
}
}
</script>
<template>
<div>
<h3>PCT槁转CN稿</h3>
<el-alert
title="此功能将协助您将PCT稿快速转换成CN稿的排版"
type="info"
/>
<br>
<el-form ref="searchForm" size="small" label-width="160px">
<el-row>
<el-col :span="12">
<el-form-item label="PCT稿" prop="business">
<el-upload
ref="upload"
class="upload-demo"
drag
:limit="1"
:file-list="fileList"
:action="uploadURL"
:on-change="handelFileChange"
:on-remove="handleFileRemove"
:on-exceed="handleExceed"
:auto-upload="false"
accept="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处,或<em>点击上传</em>
</div>
</el-upload>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12" :offset="10">
<el-button
style="margin-left: 10px"
size="small"
type="success"
@click="submitUpload"
>
开始转换
</el-button>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script>
import GraphApiService from '@utils/GraphApiService'
export default {
name: 'Cn2CpcForm',
data: function() {
return {
uploadURL: 'Word/CN2CPC',
fileList: []
}
},
props:{
baseUrl:{
type: String
}
},
methods: {
// 上传到服务器
submitUpload() {
console.log(this.fileList)
if (this.fileList.length <= 0) {
this.$message.error('请先选择需要上传的文件!')
return false
}
const formData = new FormData()
this.fileList.forEach(e => {
formData.append('file', e.raw)
})
GraphApiService
.post('Word/PCT2CN', formData)
.then(res => {
if (res.status === 200) {
this.fileList = []
this.$refs.upload.clearFiles()
const excelFileName = res.data
GraphApiService
.get('RequestPayment/DownloadFile', {
params: {
fileName: excelFileName
},
responseType: 'blob'
})
.then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
downloadElement.href = href
downloadElement.download = excelFileName.split('/')[1]
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement)
window.URL.revokeObjectURL(href)
})
} else {
this.$refs.upload.abort()
this.$message.error('下载档案失败!')
}
console.log(res.data)
})
.catch(error => {
console.log('error', error)
this.$refs.upload.abort()
this.$message.error('下载档案失败!')
})
},
// 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
handelFileChange(file, fileList) {
// 存在文件标识
let existsFileFlag = false
for (let i = 0; i < this.fileList.length; i++) {
if (
file.name === this.fileList[i].name &&
file.size === this.fileList[i].size
) {
// 如果存在了,赋值true
existsFileFlag = true
}
}
// 遍历的这个文件存在当前列表直接结束
if (existsFileFlag) {
// 否则不加入
fileList.pop()
// console.log(`文件已经存在:${file.name}`)
// this.handleMsg(`文件已经选择过了:${file.name})`);
this.$message({
showClose: true,
message: `文件已经选择过了:${file.name})`,
type: 'error'
})
return
}
this.fileList.push(file)
},
handelDetailFileChange(file, fileList) {
// 存在文件标识
let existsFileFlag = false
for (let i = 0; i < this.detailFileList.length; i++) {
if (
file.name === this.detailFileList[i].name &&
file.size === this.detailFileList[i].size
) {
// 如果存在了,赋值true
existsFileFlag = true
}
}
// 遍历的这个文件存在当前列表直接结束
if (existsFileFlag) {
// 否则不加入
fileList.pop()
// console.log(`文件已经存在:${file.name}`)
// this.handleMsg(`文件已经选择过了:${file.name})`);
this.$message({
showClose: true,
message: `文件已经选择过了:${file.name})`,
type: 'error'
})
return
}
this.detailFileList.push(file)
},
// 文件列表移除文件时的钩子
handleFileRemove(file, fileList) {
this.fileList = fileList
},
handleDetailFileRemove(file, fileList) {
this.detailFileList = fileList
},
handleExceed(files, fileList) {
this.$set(fileList[0], 'raw', files[0])
this.$set(fileList[0], 'name', files[0].name)
this.$refs['rebateUpload'].clearFiles()// 清除文件
this.$refs['rebateUpload'].handleStart(files[0])// 选择文件后的赋值方法
}
}
}
</script>
<template>
<div>
<h3>公式转换图片</h3>
<el-alert title="此功能将协助您将CN稿内中的公式快速转换为图像" type="info" />
<br>
<el-form ref="visioForm" :model="form" size="small" label-width="160px">
<el-row>
<el-col :span="16">
<el-form-item label="稿件" prop="file">
<el-upload
ref="upload"
class="upload-demo"
drag
:limit="1"
:file-list="fileList"
:action="uploadURL"
:on-change="handelFileChange"
:on-remove="handleFileRemove"
:on-exceed="handleExceed"
:auto-upload="false"
accept="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处,或<em>点击上传</em>
</div>
</el-upload>
</el-form-item>
<el-form-item label="图像设置" prop="isImgSetting">
<el-switch
v-model="form.isImgSetting"
active-color="#13ce66"
inactive-color="#ff4949"
/>
</el-form-item>
<el-form-item
v-show="form.isImgSetting"
label="寬度小于"
prop="width"
>
<el-col :span="4">
<el-input v-model="form.width" />
</el-col>
<el-col :span="3">
<el-select v-model="form.includeType" placeholder="是否或是高度">
<el-option label="无" value="无" />
<el-option label="同时" value="同时" />
<el-option label="或是" value="或是" />
</el-select>
</el-col>
<el-col v-show="form.includeType !== '无'" :span="2">
<span>高度小于</span>
</el-col>
<el-col v-show="form.includeType !== '无'" :span="2">
<el-input v-model="form.height" />
</el-col>
</el-form-item>
<el-form-item
v-show="form.isImgSetting"
label="放大倍率"
prop="width"
>
<el-col :span="4">
<el-input v-model="form.magn" />
</el-col>
<el-col :span="2">
<span></span>
</el-col>
</el-form-item>
<el-form-item label="行距设置" prop="isSetLineHeight">
<el-switch
v-model="form.isSetLineHeight"
active-color="#13ce66"
inactive-color="#ff4949"
/>
</el-form-item>
<el-form-item
v-show="form.isSetLineHeight"
label="行距"
prop="lineHeight"
>
<el-col :span="4">
<el-input v-model="form.lineHeight" />
</el-col>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12" :offset="10">
<el-button
style="margin-left: 10px"
size="small"
type="success"
@click="submitUpload"
>
开始转换
</el-button>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script>
import GraphApiService from '@utils/GraphApiService'
export default {
name: 'VisioForm',
data: function() {
return {
form: {
isImgSetting: true,
width: 100,
height: 100,
magn: 1.8,
includeType: '',
isSetLineHeight: true,
lineHeight: 18
},
uploadURL: 'Word/ConvertEquations',
fileList: []
}
},
props:{
baseUrl:{
type: String
}
},
methods: {
// 上传到服务器
submitUpload() {
console.log(this.fileList)
if (this.fileList.length <= 0) {
this.$message.error('请先选择需要上传的文件!')
return false
}
const formData = new FormData()
this.fileList.forEach(e => {
formData.append('file', e.raw)
})
formData.append('height', this.form.height)
formData.append('width', this.form.width)
formData.append('magn', this.form.magn)
formData.append('isImgSetting', this.form.isImgSetting)
formData.append(
'isIncludeHeight',
this.form.includeType !== ''
)
formData.append('includeType', this.form.includeType)
formData.append('isSetLineHeight', this.form.isSetLineHeight)
formData.append('lineHeight', this.form.lineHeight)
GraphApiService
.post('Word/ConvertEquations', formData)
.then(res => {
if (res.status === 200) {
this.fileList = []
this.$refs.upload.clearFiles()
const excelFileName = res.data
GraphApiService
.get('RequestPayment/DownloadFile', {
params: {
fileName: excelFileName
},
responseType: 'blob'
})
.then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
downloadElement.href = href
downloadElement.download = excelFileName.split('/')[1]
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement)
window.URL.revokeObjectURL(href)
})
} else {
this.$refs.upload.abort()
this.$message.error('下载档案失败!')
}
console.log(res.data)
})
.catch(error => {
console.log('error', error)
this.$refs.upload.abort()
this.$message.error('下载档案失败!')
})
},
// 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
handelFileChange(file, fileList) {
// 存在文件标识
let existsFileFlag = false
for (let i = 0; i < this.fileList.length; i++) {
if (
file.name === this.fileList[i].name &&
file.size === this.fileList[i].size
) {
// 如果存在了,赋值true
existsFileFlag = true
}
}
// 遍历的这个文件存在当前列表直接结束
if (existsFileFlag) {
// 否则不加入
fileList.pop()
// console.log(`文件已经存在:${file.name}`)
// this.handleMsg(`文件已经选择过了:${file.name})`);
this.$message({
showClose: true,
message: `文件已经选择过了:${file.name})`,
type: 'error'
})
return
}
this.fileList.push(file)
},
handelDetailFileChange(file, fileList) {
// 存在文件标识
let existsFileFlag = false
for (let i = 0; i < this.detailFileList.length; i++) {
if (
file.name === this.detailFileList[i].name &&
file.size === this.detailFileList[i].size
) {
// 如果存在了,赋值true
existsFileFlag = true
}
}
// 遍历的这个文件存在当前列表直接结束
if (existsFileFlag) {
// 否则不加入
fileList.pop()
// console.log(`文件已经存在:${file.name}`)
// this.handleMsg(`文件已经选择过了:${file.name})`);
this.$message({
showClose: true,
message: `文件已经选择过了:${file.name})`,
type: 'error'
})
return
}
this.detailFileList.push(file)
},
// 文件列表移除文件时的钩子
handleFileRemove(file, fileList) {
this.fileList = fileList
},
handleDetailFileRemove(file, fileList) {
this.detailFileList = fileList
},
handleExceed(files, fileList) {
this.$set(fileList[0], 'raw', files[0])
this.$set(fileList[0], 'name', files[0].name)
this.$refs['rebateUpload'].clearFiles()// 清除文件
this.$refs['rebateUpload'].handleStart(files[0])// 选择文件后的赋值方法
}
}
}
</script>
<template>
<el-card>
<el-tabs type="border-card">
<el-tab-pane label="CN转换PCT">
<cn-2-pct-form :baseUrl="baseUrl"/>
</el-tab-pane>
<el-tab-pane label="公式转换图片">
<visio-form :baseUrl="baseUrl"/>
</el-tab-pane>
<el-tab-pane label="PCT槁转CN稿">
<Pct2CnForm :baseUrl="baseUrl"/>
</el-tab-pane>
</el-tabs>
</el-card>
</template>
<script>
import Cn2CpcForm from './components/Cn2CpcForm'
import Cn2PctForm from './components/Cn2PctForm'
import VisioForm from './components/VisioForm'
import Pct2CnForm from './components/Pct2CnForm'
import config from '@config/index.js'
export default {
name: 'ConvertTool',
props:{
env:{
type: String,
default: 'prod_sz'
}
},
components: {
Cn2CpcForm,
Cn2PctForm,
VisioForm,
Pct2CnForm
},
computed:{
baseUrl(){
console.log('config', config, this.env)
return config[this.env].VUE_APP_GRAPHAPI_URL
}
},
}
</script>
import fileSplit from './src'
fileSplit.install = function (Vue) {
Vue.component(fileSplit.name, fileSplit)
}
export default fileSplit
\ No newline at end of file
<template>
<div>
<el-form ref="searchForm" size="small" label-width="160px">
<el-form-item prop="business">
<el-upload
ref="upload"
drag
:limit="1"
:file-list="fileList"
:action="uploadURL"
:on-change="handelFileChange"
:on-remove="handleFileRemove"
:on-exceed="handleExceed"
:auto-upload="false"
accept=".docx, .doc"
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处,或<em>点击上传</em>
</div>
</el-upload>
</el-form-item>
<el-form-item>
<span>申請類型</span>
<el-radio-group v-model="form.applyType">
<el-radio label="1">發明</el-radio>
<el-radio label="2">新型</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item class="split-style">
<span>分割方式</span>
<el-radio-group v-model="form.split">
<el-radio label="splitAccording">按照標題拆分</el-radio>
<el-radio label="pageNum">選擇自訂頁數</el-radio>
</el-radio-group>
<div v-show="form.split === 'pageNum'" class="choose-box">
<div v-for="(item, i) in inpFields" :key="item.label">
<span>{{ item.label }}</span>
<input
v-model="form[`${item.field}`]"
:placeholder="`${item.placeholder}`"
:disabled="i !== editInpIndex && editInpIndex !== -1"
@input="onInput($event, i)"
>
</div>
</div>
</el-form-item>
<el-form-item>
<el-button
size="medium"
type="primary"
>
分割
</el-button>
<el-button
v-if="fileList[0]"
size="medium"
type="primary"
@click="handleDownloadClick"
>
下載
</el-button>
</el-form-item>
</el-form>
<el-alert type="error">
<template slot="title">
注意: 切割的最後一頁 要加 分節符號且不可和文字同行
<br>
<h3><b>正確</b></h3>
<img src="../picture/success.png" width="60%">
<h3><b>錯誤</b></h3>
<img src="../picture/error.png" width="60%">
</template>
</el-alert>
</div>
</template>
<script>
// import { SplitRevisionDoc } from '@api/fileApi'
import { mixins } from "../mixin/toolMixin";
import service from '@utils/requestService'
export default {
name: 'SplitWordForm',
mixins:["mixin"],
props:{
baseUrl:{
type: String
}
},
data: function() {
return {
uploadURL: 'Word/SplitRevisionDoc',
fileList: [],
form: {
applyType: '1',
split: 'splitAccording',
abstPageRange: '',
specPageRange: '',
claimPageRange: '',
figPageRange: ''
},
disabled: {
1: false,
2: false,
3: false,
4: false
},
showPage: false,
inpFields: [
{
label: 'ABST',
field: 'abstPageRange',
placeholder: '請輸入頁數如: 1-10'
},
{
label: 'SPEC',
field: 'specPageRange',
placeholder: '請輸入頁數如: 11-20'
},
{
label: 'CLAIM',
field: 'claimPageRange',
placeholder: '請輸入頁數如: 21-30'
},
{
label: 'FIG',
field: 'figPageRange',
placeholder: '請輸入頁數如: 31-40'
}
],
editInpIndex: -1
}
},
watch: {
'form.split'(val) {
if (val === 'splitAccording') {
this.form.abstPageRange = ''
this.form.specPageRange = ''
this.form.claimPageRange = ''
this.form.figPageRange = ''
}
}
},
methods: {
onInput(e, i) {
if (e.target.value) {
this.editInpIndex = i
} else {
this.editInpIndex = -1
}
},
// 點擊下載按鈕
async handleDownloadClick() {
if (this.fileList.length <= 0) {
this.$message.error('请先选择需要上传的文件!')
return false
}
const formData = new FormData()
const { form } = this
formData.append('file', this.fileList[0].raw)
formData.append('applyType', form.applyType)
// if (form.split === 'pageNum') {
formData.append('abstPageRange', form.abstPageRange)
formData.append('specPageRange', form.specPageRange)
formData.append('claimPageRange', form.claimPageRange)
formData.append('figPageRange', form.figPageRange)
// 上傳的參數置空
// } else {
// formData.append('abstPageRange', '')
// formData.append('specPageRange', '')
// formData.append('claimPageRange', '')
// formData.append('figPageRange', '')
// }
const response = await service.post(`api/v1.0/Word/SplitRevisionDoc`, formData)
// const response = await SplitRevisionDoc(this.baseUrl, formData)
if (response) {
this.fileList = []
this.$refs.upload.clearFiles()
const zipFileName = response.data
this.downloadFile(zipFileName)
console.log(this.downloadFile)
} else {
this.$refs.upload.abort()
this.$message.error('下载档案失败!')
}
},
// 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
handelFileChange(file, fileList) {
// 存在文件标识
let existsFileFlag = false
for (let i = 0; i < this.fileList.length; i++) {
if (
file.name === this.fileList[i].name &&
file.size === this.fileList[i].size
) {
// 如果存在了,赋值true
existsFileFlag = true
}
}
// 遍历的这个文件存在当前列表直接结束
if (existsFileFlag) {
// 否则不加入
fileList.pop()
// console.log(`文件已经存在:${file.name}`)
// this.handleMsg(`文件已经选择过了:${file.name})`);
this.$message({
showClose: true,
message: `文件已经选择过了:${file.name})`,
type: 'error'
})
return
}
this.fileList.push(file)
},
handelDetailFileChange(file, fileList) {
// 存在文件标识
let existsFileFlag = false
for (let i = 0; i < this.detailFileList.length; i++) {
if (
file.name === this.detailFileList[i].name &&
file.size === this.detailFileList[i].size
) {
// 如果存在了,赋值true
existsFileFlag = true
}
}
// 遍历的这个文件存在当前列表直接结束
if (existsFileFlag) {
// 否则不加入
fileList.pop()
// console.log(`文件已经存在:${file.name}`)
// this.handleMsg(`文件已经选择过了:${file.name})`);
this.$message({
showClose: true,
message: `文件已经选择过了:${file.name})`,
type: 'error'
})
return
}
this.detailFileList.push(file)
},
// 文件列表移除文件时的钩子
handleFileRemove(file, fileList) {
this.fileList = fileList
},
handleDetailFileRemove(file, fileList) {
this.detailFileList = fileList
},
handleExceed(files, fileList) {
this.$set(fileList[0], 'raw', files[0])
this.$set(fileList[0], 'name', files[0].name)
this.$refs['rebateUpload'].clearFiles()// 清除文件
this.$refs['rebateUpload'].handleStart(files[0])// 选择文件后的赋值方法
}
}
}
</script>
<style scoped lang="scss">
.el-form .el-form-item{
margin: 10px 0;
.el-radio-group{
margin-left: 20px;
}
input{
width: 126px;
margin-left: 10px;
outline: none;
border: 0;
background: #C6C6C6;
}
}
.choose-box{
margin-left:200px;
border: 1px solid #000;
width: 220px;
div > span{
display: inline-block;
width: 56px;
text-align: center;
margin: 10px 5px;
border: 1px solid #000;
}
}
input::-webkit-input-placeholder{
font-size: 12px;
opacity: 0.8;
}
::v-deep .el-form-item__content{
line-height: 1.5!important;
}
</style>
<template>
<el-card>
<el-tabs type="border-card">
<el-tab-pane label="TW OA答辯 Word 檔案分割">
<SplitWordForm :baseUrl="baseUrl"/>
</el-tab-pane>
</el-tabs>
</el-card>
</template>
<script>
import SplitWordForm from './components/SplitWordForm'
import config from '@config/index.js'
export default {
name: 'fileSplit',
components: { SplitWordForm },
props:{
env:{
type: String,
default: 'prod_sz'
}
},
computed:{
baseUrl(){
console.log('config', config, this.env)
return config[this.env].VUE_APP_GRAPHAPI_URL
}
},
}
</script>
import service from '@utils/requestService'
import Vue from 'vue'
Vue.mixin({
methods: {
async downloadFile(zipFileName) {
try {
const formData = new FormData()
formData.append('fileName', zipFileName)
const response = await service.post('api/v1.0/Word/DownloadFile', formData, { responseType: 'blob' })
if (response) {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
downloadElement.href = href
downloadElement.download = zipFileName.split('\\').pop().split('/').pop()
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement)
window.URL.revokeObjectURL(href)
}
} catch (error) {
console.log('error', error)
this.$refs.upload.abort()
this.$message.error('下载档案失败!')
}
}
}
})
import pLink from './aComponent'
import splitTool from './splitTool'
import convertTool from './convertTool'
import fileSplit from './fileSplit'
import upload from './upload'
import uploadExcel from './upload_excel'
// 存放组件的数组
const components = [
pLink,
splitTool
splitTool,
convertTool,
fileSplit,
upload,
uploadExcel
]
// 全局注册
const install = function( Vue, opt = {} ) {
const install = function (Vue, opt = {}) {
components.forEach(item => {
register( Vue, item )
register(Vue, item)
})
}
......@@ -23,9 +31,9 @@ if (typeof window !== 'undefined' && window.Vue) {
* @param { vue } _v
* @param { component } com
*/
function register ( _v, com ) {
if(typeof _v !== 'function' && typeof com !== 'object') return
_v.component( com.name, com)
function register(_v, com) {
if (typeof _v !== 'function' && typeof com !== 'object') return
_v.component(com.name, com)
}
// 按需暴露
export {
......
......@@ -21,7 +21,7 @@
:on-remove="handleFileRemove"
:on-exceed="handleExceed"
:auto-upload="false"
accept="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
accept=".doc, .docx"
>
<i class="el-icon-upload" />
<div class="el-upload__text">
......
......@@ -21,7 +21,7 @@
:on-remove="handleFileRemove"
:on-exceed="handleExceed"
:auto-upload="false"
accept="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
accept=".doc, .docx"
>
<i class="el-icon-upload" />
<div class="el-upload__text">
......
......@@ -21,7 +21,7 @@
:on-remove="handleFileRemove"
:on-exceed="handleExceed"
:auto-upload="false"
accept="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
accept=".doc, .docx"
>
<i class="el-icon-upload" />
<div class="el-upload__text">
......
......@@ -21,7 +21,7 @@
:on-remove="handleFileRemove"
:on-exceed="handleExceed"
:auto-upload="false"
accept="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
accept=".doc, .docx"
>
<i class="el-icon-upload" />
<div class="el-upload__text">
......
......@@ -31,12 +31,17 @@ export default {
default: 'prod_sz'
}
},
components: {
SplitWordForm,
SplitRangeWordForm,
SplitPageBreakWordForm,
SplitBookMarkWordForm
},
computed:{
baseUrl(){
console.log('config', config, this.env)
return config[this.env].VUE_APP_GRAPHAPI_URL
}
},
components: { SplitWordForm, SplitRangeWordForm, SplitPageBreakWordForm, SplitBookMarkWordForm }
}
</script>
import upload from './src'
upload.install = function (Vue) {
Vue.component(upload.name, upload)
}
export default upload
\ No newline at end of file
<template>
<el-card>
<h3>华星请款单(横表)</h3>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="业务量表" name="first">
<el-form ref="searchForm" size="small" label-width="160px">
<el-row>
<el-col :span="24">
<el-form-item label="合同号" prop="agent_date">
<el-input
v-model="contractNumber"
placeholder="HETONG-1901306-10F074"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="明细表" prop="detail">
<el-upload
class="upload-demo"
drag
:file-list="detailFileList"
:action="uploadURL"
:on-change="handelDetailFileChange"
:on-remove="handleDetailFileRemove"
:auto-upload="false"
accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
multiple
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处,或<em>点击上传</em>
</div>
<div slot="tip" class="el-upload__tip">
只能上传xls/xlsx文件
<br>
档案名称请加上QK号并用-分隔,
例如QK2021016093-翼盛202012127-深圳华星(授权)明细表
</div>
</el-upload>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="业务量表" prop="business">
<el-upload
class="upload-demo"
drag
:file-list="fileList"
:action="uploadURL"
:on-change="handelFileChange"
:on-remove="handleFileRemove"
:auto-upload="false"
accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
multiple
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处,或<em>点击上传</em>
</div>
<div slot="tip" class="el-upload__tip">
只能上传xls/xlsx文件<br>
档案名称请加上QK号并用-分隔,
例如QK2021016093-翼盛202012127-深圳华星(授权)业务量表
</div>
</el-upload>
</el-form-item>
</el-col>
<el-col :span="24" :offset="10">
<el-button
style="margin-left: 10px"
size="small"
type="success"
@click="submitUpload"
>
上传到服务器
</el-button>
</el-col>
</el-row>
</el-form>
</el-tab-pane>
<el-tab-pane label="开帐单" name="second">
<el-form ref="submitForm" size="small" label-width="160px">
<el-row>
<el-col :span="24">
<el-form-item label="明细表" prop="detail">
<el-upload
class="upload-demo"
drag
:file-list="detailFileList2"
:action="uploadURL2"
:on-change="handelDetail2FileChange"
:on-remove="handleDetail2FileRemove"
:auto-upload="false"
accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
multiple
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处,或<em>点击上传</em>
</div>
<div slot="tip" class="el-upload__tip">
只能上传xls/xlsx文件
<br>
档案名称请加上QK号并用-分隔,
例如QK2021016093-翼盛202012127-深圳华星(授权)明细表
</div>
</el-upload>
</el-form-item>
</el-col>
<el-col :span="24" :offset="10">
<el-button
style="margin-left: 10px"
size="small"
type="success"
@click="submitUpload2"
>
上传到服务器
</el-button>
</el-col>
</el-row>
</el-form>
</el-tab-pane>
</el-tabs>
</el-card>
</template>
<script>
import {
createHxRequestPaymentVerticalTotal,
createHxRequestPaymentVerticalTotal2,
downloadFile
}
from '@api/warningReportApi'
import moment from 'moment'
export default {
name: 'upload',
data: function() {
return {
activeName: 'first',
projectName: '',
uploadURL: 'RequestPayment/ChangeHXRequestPaymentVerticalTotal',
uploadURL2: 'RequestPayment/ChangeHXRequestPaymentVerticalTotal2',
fileList: [], // 上传的業務量文件列表
detailFileList: [], // 上传的詳細文件列表
detailFileList2: [],
contractNumber: '',
createMonth: ''
}
},
created() {
// eslint-disable-next-line no-undef
this.createMonth = moment().format('YYYY年MM月')
},
methods: {
handleClick(tab) {
this.activeName = tab.name
},
// 上传到服务器
submitUpload() {
console.log(this.fileList)
if (this.fileList.length <= 0) {
this.$message.error('请先选择需要上传的文件!')
return false
}
let excelFileName = ''
const formData = new FormData()
if (!this.contractNumber || this.contractNumber === '') {
this.$message.error('请输入合同号')
return false
}
formData.append('contractNumber', this.contractNumber)
this.fileList.forEach(e => {
formData.append('fileList', e.raw)
})
this.detailFileList.forEach(e => {
formData.append('detailFileList', e.raw)
})
createHxRequestPaymentVerticalTotal(formData)
.then(res => {
if (res.status === 200) {
excelFileName = res.data
downloadFile({
fileName: excelFileName
})
.then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
downloadElement.href = href
downloadElement.download = excelFileName.split('/')[1]
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement)
window.URL.revokeObjectURL(href)
})
} else {
this.$message.error('下载档案失败!')
}
console.log(res.data)
})
},
submitUpload2() {
console.log(this.detailFileList2)
if (this.detailFileList2.length <= 0) {
this.$message.error('请先选择需要上传的文件!')
return false
}
let excelFileName = ''
const formData = new FormData()
this.detailFileList2.forEach(e => {
formData.append('detailFileList', e.raw)
})
createHxRequestPaymentVerticalTotal2(formData)
.then(res => {
if (res.status === 200) {
excelFileName = res.data
// debugger
downloadFile({
fileName: excelFileName
})
.then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
downloadElement.href = href
downloadElement.download = excelFileName.split('/')[1]
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement)
window.URL.revokeObjectURL(href)
})
} else {
this.$message.error('下载档案失败!')
}
console.log(res.data)
})
},
// 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
handelFileChange(file, fileList) {
// 存在文件标识
let existsFileFlag = false
for (let i = 0; i < this.fileList.length; i++) {
if (
file.name === this.fileList[i].name &&
file.size === this.fileList[i].size
) {
// 如果存在了,赋值true
existsFileFlag = true
}
}
// 遍历的这个文件存在当前列表直接结束
if (existsFileFlag) {
// 否则不加入
fileList.pop()
// console.log(`文件已经存在:${file.name}`)
// this.handleMsg(`文件已经选择过了:${file.name})`);
this.$message({
showClose: true,
message: `文件已经选择过了:${file.name})`,
type: 'error'
})
return
}
this.fileList.push(file)
},
handelDetailFileChange(file, fileList) {
// 存在文件标识
let existsFileFlag = false
for (let i = 0; i < this.detailFileList.length; i++) {
if (
file.name === this.detailFileList[i].name &&
file.size === this.detailFileList[i].size
) {
// 如果存在了,赋值true
existsFileFlag = true
}
}
// 遍历的这个文件存在当前列表直接结束
if (existsFileFlag) {
// 否则不加入
fileList.pop()
// console.log(`文件已经存在:${file.name}`)
// this.handleMsg(`文件已经选择过了:${file.name})`);
this.$message({
showClose: true,
message: `文件已经选择过了:${file.name})`,
type: 'error'
})
return
}
this.detailFileList.push(file)
},
handelDetail2FileChange(file, fileList) {
// 存在文件标识
let existsFileFlag = false
for (let i = 0; i < this.detailFileList2.length; i++) {
if (
file.name === this.detailFileList2[i].name &&
file.size === this.detailFileList2[i].size
) {
// 如果存在了,赋值true
existsFileFlag = true
}
}
// 遍历的这个文件存在当前列表直接结束
if (existsFileFlag) {
// 否则不加入
fileList.pop()
// console.log(`文件已经存在:${file.name}`)
// this.handleMsg(`文件已经选择过了:${file.name})`);
this.$message({
showClose: true,
message: `文件已经选择过了:${file.name})`,
type: 'error'
})
return
}
this.detailFileList2.push(file)
},
// 文件列表移除文件时的钩子
handleFileRemove(file, fileList) {
this.fileList = fileList
},
handleDetailFileRemove(file, fileList) {
this.detailFileList = fileList
},
handleDetail2FileRemove(file, fileList) {
this.detailFileList2 = fileList
}
}
}
</script>
import uploadExcel from './src'
uploadExcel.install = function (Vue) {
Vue.component(uploadExcel.name, uploadExcel)
}
export default uploadExcel
\ No newline at end of file
<template>
<div>
<input
ref="excel-upload-input"
class="excel-upload-input"
type="file"
accept=".xlsx, .xls"
@change="handleClick"
>
<div
class="drop"
@drop="handleDrop"
@dragover="handleDragover"
@dragenter="handleDragover"
>
Drop excel file here or
<el-button
:loading="loading"
style="margin-left: 16px"
size="mini"
type="primary"
@click="handleUpload"
>
Browse
</el-button>
</div>
</div>
</template>
<script>
import XLSX from 'xlsx/dist/xlsx.mini.min.js'
export default {
props: {
beforeUpload: Function, // eslint-disable-line
onSuccess: Function, // eslint-disable-line
},
data() {
return {
loading: false,
excelData: {
header: null,
results: null
}
}
},
methods: {
generateData({ header, results }) {
this.excelData.header = header
this.excelData.results = results
this.onSuccess && this.onSuccess(this.excelData)
},
handleDrop(e) {
e.stopPropagation()
e.preventDefault()
if (this.loading) return
const files = e.dataTransfer.files
if (files.length !== 1) {
this.$message.error('Only support uploading one file!')
return
}
const rawFile = files[0] // only use files[0]
if (!this.isExcel(rawFile)) {
this.$message.error(
'Only supports upload .xlsx, .xls, .csv suffix files'
)
return false
}
this.upload(rawFile)
e.stopPropagation()
e.preventDefault()
},
handleDragover(e) {
e.stopPropagation()
e.preventDefault()
e.dataTransfer.dropEffect = 'copy'
},
handleUpload() {
this.$refs['excel-upload-input'].click()
},
handleClick(e) {
const files = e.target.files
const rawFile = files[0] // only use files[0]
if (!rawFile) return
this.upload(rawFile)
},
upload(rawFile) {
this.$refs['excel-upload-input'].value = null // fix can't select the same excel
if (!this.beforeUpload) {
this.readerData(rawFile)
return
}
const before = this.beforeUpload(rawFile)
if (before) {
this.readerData(rawFile)
}
},
readerData(rawFile) {
this.loading = true
return new Promise(resolve => {
const reader = new FileReader()
reader.onload = e => {
const data = e.target.result
const workbook = XLSX.read(data, { type: 'array' })
const firstSheetName = workbook.SheetNames[0]
const worksheet = workbook.Sheets[firstSheetName]
const header = this.getHeaderRow(worksheet)
const results = XLSX.utils.sheet_to_json(worksheet)
this.generateData({ header, results })
this.loading = false
resolve()
}
reader.readAsArrayBuffer(rawFile)
})
},
getHeaderRow(sheet) {
const headers = []
const range = XLSX.utils.decode_range(sheet['!ref'])
let C
const R = range.s.r
/* start in the first row */
for (C = range.s.c; C <= range.e.c; ++C) {
/* walk every column in the range */
const cell = sheet[XLSX.utils.encode_cell({ c: C, r: R })]
/* find the cell in the first row */
let hdr = 'UNKNOWN ' + C // <-- replace with your desired default
if (cell && cell.t) hdr = XLSX.utils.format_cell(cell)
headers.push(hdr)
}
return headers
},
isExcel(file) {
return /\.(xlsx|xls|csv)$/.test(file.name)
}
}
}
</script>
<style scoped>
.excel-upload-input {
display: none;
z-index: -9999;
}
.drop {
border: 2px dashed #bbb;
width: 600px;
height: 160px;
line-height: 160px;
margin: 0 auto;
font-size: 24px;
border-radius: 5px;
text-align: center;
color: #bbb;
position: relative;
}
</style>
<template>
<div class="app-container">
<upload-excel-component
:on-success="handleSuccess"
:before-upload="beforeUpload"
/>
<el-button @click="inputHandler">導入</el-button>
<el-table
:key="itemkey"
:data="tableData"
border
highlight-current-row
style="width: 100%; margin-top: 20px"
>
<el-table-column
v-for="item of tableHeader"
:key="item"
:prop="item"
:label="item"
/>
</el-table>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import UploadExcelComponent from './components/UploadExcel.vue'
import graphRequest from '@utils/GraphApiService'
export default {
name:'uploadExcel',
components: { UploadExcelComponent },
data() {
return {
tableData: [],
tableHeader: [],
itemkey: '', // 临时变量
levelKeys: [
{ name: 'level1', value: '核心' },
{ name: 'level2', value: '重要' },
{ name: 'level3', value: '常规' }
]
}
},
computed: {
...mapGetters('user/', ['wadeUserID'])
},
methods: {
beforeUpload(file) {
const isLt1M = file.size / 1024 / 1024 < 1
if (isLt1M) {
return true
}
this.$message({
message: 'Please do not upload files larger than 1m in size.',
type: 'warning'
})
return false
},
handleSuccess({ results, header }) {
console.log(this.wadeUserID)
this.tableData = results
this.tableHeader = header
this.tableHeader.push('isUpload')
// this.tableData = this.tableData.map(obj => ({ ...obj, isUpload: false }))
console.log(this.tableData)
this.levelKeys.map(level => {
this.tableData.forEach((obj, index, array) => {
array[index][level.name] = this.getLevel(level.value)
array[index].isUpload = 'x'
})
})
},
inputHandler() {
this.levelKeys.forEach(level => {
console.log(`=====================${level.value}======================`)
this.tableData
.filter(item => {
return item[level.value] === 'ν'
})
.map(item => {
graphRequest
.get('/Wade/GetEhrEmployeeByName', {
params: { name: item['姓名'] }
})
.then(rest => {
if (rest.status === 200) {
if (rest.data === null || rest.data.wade_user_id === null) {
this.$message({
type: 'error',
message: `系統找不到${item['姓名']}!`
})
return
}
console.log(rest.data.wade_user_id)
const params = {
customer_id: '0BE8F97E-320D-49D7-A13B-E4E5EF4738ED', // 華星
case_level: item[level.name],
match_case_user_id: rest.data.wade_user_id,
match_type: '1',
update_user_id: this.wadeUserID
}
graphRequest
.post('/Wade/CreateCaseLevelList', params)
.then(res => {
if (res.status === 200) {
console.log(
`${item[level.name]} isUpload: ${item['姓名']}`
)
item.isUpload = 'ν'
this.itemkey = Math.random() // 在这边给key赋随机值
this.$message({ type: 'success', message: '新增成功!' })
}
})
.catch(() => {
this.$message({
type: 'error',
message: '新增失败! 已有该笔资料!'
})
})
}
})
})
})
},
searchitem(index) {
console.log(this.tableHeader[index])
return this.tableHeader[index]
},
getLevel(level) {
switch (level) {
case '重要':
return '重要專利'
case '核心':
return '核心專利'
case '常规':
return '常規專利'
}
}
}
}
</script>
import axios from 'axios'
import { Message } from 'element-ui'
const service = axios.create({
baseURL: "https://dev.essenptl.com/dev2/wade_ext",
// withCredentials: true,
timeout: 1500000
})
// response interceptor
service.interceptors.response.use(
async response => {
const res = response.data
// 判斷是否為檔案類型
if (response.config.responseType === 'blob') return res
if (
res.type && (res.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' ||
res.type === 'application/zip')
) {
return res
}
// 如果code非20000表示有發生問題
// code = 1 為運營看板暫時使用
return res
},
error => {
if (error.response) {
console.log('err' + error) // for debug
return error
// return Promise.reject(error)
} else {
console.log('err' + error) // for debug
Message({
message: error.message,
type: 'error',
duration: 5 * 1000
})
return Promise.reject(error)
}
}
)
export default service
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment