From b2d72d9308c08217a84a1cd0a43320a359cc4523 Mon Sep 17 00:00:00 2001 From: hezidan <2033098269@qq.com> Date: Tue, 26 Mar 2024 13:51:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=BC=96=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/index.js | 8 +- src/api/axiosFun.js | 1 - src/api/userMG.js | 25 ++- src/components/leftnav.vue | 28 ++-- src/imageUpload/index.vue | 237 +++++++++++++++++++++++++++ src/main.js | 2 +- src/router/index.js | 19 +-- src/utils/drag.js | 118 ++++++++++++++ src/views/fapiao/Fapiao.vue | 308 +++++++++++++----------------------- src/views/fapiao/edit.vue | 259 ++++++++++++++++++++++++++++++ 10 files changed, 775 insertions(+), 230 deletions(-) create mode 100644 src/imageUpload/index.vue create mode 100644 src/utils/drag.js create mode 100644 src/views/fapiao/edit.vue diff --git a/config/index.js b/config/index.js index 56ca4d8..27c1032 100644 --- a/config/index.js +++ b/config/index.js @@ -12,7 +12,8 @@ module.exports = { assetsPublicPath: '/', proxyTable: { '/api': { - target: 'http://localhost:8081', // 你请求的第三方接口 + target: 'http://192.168.2.88:8081', // 你请求的第三方接口 + // target: 'http://192.168.80.155:8081', // 你请求的第三方接口 changeOrigin: true, // 在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题 pathRewrite: { // 路径重写, '^/api': '' // 替换target中的请求地址,也就是说以后你在请求http://api.jisuapi.com/XXXXX这个地址的时候直接写成/api即可。 @@ -21,8 +22,9 @@ module.exports = { }, // Various Dev Server settings - host: 'localhost', // can be overwritten by process.env.HOST - port: 9999, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined + host: '127.0.0.1', + // host: '192.168.80.155', // can be overwritten by process.env.HOST + port: 9990, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined autoOpenBrowser: true, errorOverlay: true, notifyOnErrors: true, diff --git a/src/api/axiosFun.js b/src/api/axiosFun.js index e4e1dd0..538a64d 100644 --- a/src/api/axiosFun.js +++ b/src/api/axiosFun.js @@ -52,7 +52,6 @@ const req = (method, url, params) => { // ] }).then(res => res.data); }; - export { loginreq, req diff --git a/src/api/userMG.js b/src/api/userMG.js index 595dfe0..e4d82fd 100644 --- a/src/api/userMG.js +++ b/src/api/userMG.js @@ -50,15 +50,19 @@ export const ModelTagDelete = (params) => { return req("post", "http://127.0.0.1 /** * 发票管理 **/ -// 发票管理-获取发票列表 -export const FapiaoList = (params) => { return req("get", "http://localhost:9999/api/bill/selectAll?current="+params.pageNum+"&size="+params.pageSize+"&baoxiaoname="+params.baoxiaoname+"&billnum="+params.billnum)}; // // 发票管理-根据Id获取发票 // export const getFapiaoById = (params) => { return req("get", "http://127.0.0.1:10001/modelTagInfo/detail?id="+params.modelTagId)}; // 发票管理-获取发票列表 export const FapiaoAllList = () => { return req("get", "http://127.0.0.1:10001/modelTagInfo/selectAll")}; +// 发票管理-获取发票列表 +export const FapiaoList = (params) => { return req("get", "http://192.168.2.88:9990/api/bill/selectAll?current="+params.pageNum+"&size="+params.pageSize+"&baoxiaoname="+params.baoxiaoname+"&billnum="+params.billnum)}; // 发票管理-保存(添加编辑) -export const FapiaoSave = (params) => { return req("post", "http://localhost:9999/api/bill/insert", params) }; +export const FapiaoSave = (params) => { return req("post", "http://192.168.2.88:9990/api/bill/insert", params) }; + +// export const FapiaoList = (params) => { return req("get", "http://127.0.0.1:9990/api/bill/selectAll?current="+params.pageNum+"&size="+params.pageSize+"&baoxiaoname="+params.baoxiaoname+"&billnum="+params.billnum)}; +// export const FapiaoSave = (params) => { return req("post", "http://127.0.0.1:9990/api/bill/insert", params) }; + /** * 模型管理 @@ -105,6 +109,21 @@ export const FileUplod = (formData) => { traditional: true, }).then(res => res.data);}; +// 上传数据集文件接口 +export const fapiaoPicUplod = (formData) => { + return axios( + { + method: "post", + url: "http://192.168.2.88:9990/api/getocr/putfile", + headers: { + 'Content-Type': 'multipart/form-data', + token: localStorage.getItem('token'), + 'Access-Control-Allow-Origin': '*', + }, + data: formData, + traditional: true, + }).then(res => res.data);}; + // 数据集管理-获取模型列表 export const ModelDataList = (params) => { return req("get", "http://127.0.0.1:10001/modelDataInfo/list?pageNum="+params.pageNum+"&pageSize="+params.pageSize+"&dataName="+params.dataName)}; // 数据集管理-保存(添加编辑) diff --git a/src/components/leftnav.vue b/src/components/leftnav.vue index c70912d..8ceedd5 100644 --- a/src/components/leftnav.vue +++ b/src/components/leftnav.vue @@ -25,7 +25,7 @@ + + + + + + + + + + + + + + + + + diff --git a/src/main.js b/src/main.js index 17d6ec0..348c7bb 100644 --- a/src/main.js +++ b/src/main.js @@ -12,7 +12,7 @@ import store from './vuex/store'; // 引入icon import './assets/icon/iconfont.css' // - +import './utils/drag' // 引入echarts diff --git a/src/router/index.js b/src/router/index.js index e2a54ed..c24f2b4 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -25,6 +25,7 @@ import tags from '@/views/models/Tag'; import fapiao from '@/views/fapiao/Fapiao'; +import fapiaoedit from '@/views/fapiao/edit'; @@ -111,20 +112,20 @@ export default new Router({ }, { path: '/fapiao/Fapiao', - name: '发票查询', + name: 'fapiao', component: fapiao, meta: { requireAuth: true } }, - // { - // path: '/fapiao/Dataset', - // name: '数据集管理', - // component: fapiao, - // meta: { - // requireAuth: true - // } - // }, + { + path: '/fapiao/edit', + name: 'fapiaoedit', + component: fapiaoedit, + meta: { + requireAuth: true + } + }, ] }] }) diff --git a/src/utils/drag.js b/src/utils/drag.js new file mode 100644 index 0000000..fb3c8a8 --- /dev/null +++ b/src/utils/drag.js @@ -0,0 +1,118 @@ +import Vue from 'vue' + +// v-dialogDrag: 弹窗拖拽 +Vue.directive('dialogDrag', { + bind(el, binding, vnode, oldVnode) { + const dialogHeaderEl = el.querySelector('.el-dialog__header') + const dragDom = el.querySelector('.el-dialog') + dialogHeaderEl.style.cursor = 'move' + + // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null); + const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null) + + dialogHeaderEl.onmousedown = (e) => { + // 鼠标按下,计算当前元素距离可视区的距离 + const disX = e.clientX - dialogHeaderEl.offsetLeft + const disY = e.clientY - dialogHeaderEl.offsetTop + const minDragDomLeft = dragDom.offsetLeft; + const maxDragDomLeft = document.body.clientWidth - minDragDomLeft - dragDom.offsetWidth; + const minDragDomTop = dragDom.offsetTop; + const maxDragDomTop = document.documentElement.clientHeight - minDragDomTop - dragDom.offsetHeight; + + // 获取到的值带px 正则匹配替换 + let styL, styT + // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px + if (sty.left.includes('%')) { + styL = +document.body.clientWidth * (+sty.left.replace(/\\%/, '') / 100) + styT = +document.body.clientHeight * (+sty.top.replace(/\\%/, '') / 100) + } else { + if (sty.left && sty.left.indexOf('px') > 0) { + styL = +sty.left.replace(/(px)/, '') + } else { + styL = +0 + } + if (sty.top && sty.top.indexOf('px') > 0) { + styT = +sty.top.replace(/(px)/, '') + } else { + styT = +0 + } + } + // console.log("styL:" + styL + ";styT:" + styT) + + document.onmousemove = function (e) { + // 通过事件委托,计算移动的距离 + let l = e.clientX - disX + let t = e.clientY - disY + + // 边界处理 + if (-l > minDragDomLeft) { + l = -minDragDomLeft; + } else if (l > maxDragDomLeft) { + l = maxDragDomLeft; + } + if (-t > minDragDomTop) { + t = -minDragDomTop; + } else if (t > maxDragDomTop) { + t = maxDragDomTop; + } + + // 移动当前元素 + dragDom.style.left = `${l + styL}px` + dragDom.style.top = `${t + styT}px` + + // 将此时的位置传出去 + // binding.value({x:e.pageX,y:e.pageY}) + } + + document.onmouseup = function (e) { + document.onmousemove = null + document.onmouseup = null + } + } + + /** + * 增加一个fullscreen按钮 + */ + if(binding.value && (binding.value.zoom || binding.value.zoomMx)) { + const fullScreenBtn = document.createElement('button') + fullScreenBtn.setAttribute('type', 'button') + fullScreenBtn.className = "el-dialog__headerbtn" + fullScreenBtn.style.setProperty('right', '42px') + fullScreenBtn.setAttribute('aria-label', 'Close') + const fullScreenBtnI = document.createElement('i') + fullScreenBtnI.classList.add("el-icon-full-screen", "el-icon", "r180") + fullScreenBtn.appendChild(fullScreenBtnI) + let closeBtn = dialogHeaderEl.querySelector('button') + dialogHeaderEl.insertBefore(fullScreenBtn, closeBtn) + let dialogBodyEl = dialogHeaderEl.parentNode + let style = dialogBodyEl.style + let w = style.width + // let h = style.height + let maginTop = style['margin-top'] + let viewHeight = document.documentElement.clientHeight + fullScreenBtn.onclick = (e) => { + fullScreenBtnI.classList.toggle("el-icon-full-screen") + fullScreenBtnI.classList.toggle("el-icon-copy-document") + dialogBodyEl.classList.toggle("is-fullscreen") + if(fullScreenBtnI.classList.contains("el-icon-full-screen")) { + // 还原 + dialogBodyEl.style.setProperty("margin-top", maginTop) + binding.value.zoomMx && dialogBodyEl.style.setProperty("width", w) + dialogBodyEl.style.setProperty("height", 'auto') + if(viewHeight * parseInt(maginTop) * 2 / 100 + dialogBodyEl.scrollHeight > viewHeight) { + dialogBodyEl.style.setProperty("height", `calc(100% - ${parseInt(maginTop) * 2}${maginTop.match(/\d+\.*\d+(\S*)/)[1]}`) + } else { + dialogBodyEl.style.setProperty("height", 'auto') + } + } else { + // 最大化 + dialogBodyEl.style.setProperty("margin-top", 0) + binding.value.zoomMx && dialogBodyEl.style.setProperty("width", '100%') + dialogBodyEl.style.setProperty("height", '100%') + } + dialogBodyEl.style.setProperty("left", 0) + dialogBodyEl.style.setProperty("top", 0) + } + } + } +}) diff --git a/src/views/fapiao/Fapiao.vue b/src/views/fapiao/Fapiao.vue index c7356df..9521d7c 100644 --- a/src/views/fapiao/Fapiao.vue +++ b/src/views/fapiao/Fapiao.vue @@ -45,109 +45,58 @@ - + - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/src/views/fapiao/edit.vue b/src/views/fapiao/edit.vue new file mode 100644 index 0000000..bfccfec --- /dev/null +++ b/src/views/fapiao/edit.vue @@ -0,0 +1,259 @@ + + + + + + 首页 + 发票录入添加编辑 + + + + + + + + + + + + + + + + 取消 + 保存 + + + + + + + + + + + + + + + 请上传 + 大小不超过 {{ fileSize }}MB + 格式为 {{ fileType.join("/") }} + 的文件 + + + + + + + + + + 请上传 + 大小不超过 {{ fileSize }}MB + 格式为 {{ fileType.join("/") }} + 的文件 + + + + + + + + + -- Gitee