From b5ab349b8fd15bd418b42bb65f868a9eecaed0eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E8=99=B9=E7=9D=BF?= <297504645@qq.com> Date: Tue, 18 Jul 2023 10:02:52 +0800 Subject: [PATCH 01/35] =?UTF-8?q?=E6=98=8E=E7=BB=86=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E8=AE=BE=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/filterForDetailPage/index.vue | 12 ++++++++++-- Code/Fe/src/components/tablePagination/index.vue | 14 +++++++++++--- Code/Fe/src/mixins/TableHeaderMixins.js | 3 ++- Code/Fe/src/mixins/TableMixins.js | 11 ++++++----- Code/Fe/src/utils/detailsPageColumns_api/index.js | 9 +++++++++ Code/Fe/src/views/interfaceBoard/TestSchool.vue | 13 ++++++------- 6 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 Code/Fe/src/utils/detailsPageColumns_api/index.js diff --git a/Code/Fe/src/components/filterForDetailPage/index.vue b/Code/Fe/src/components/filterForDetailPage/index.vue index ced8e1a..af563f2 100644 --- a/Code/Fe/src/components/filterForDetailPage/index.vue +++ b/Code/Fe/src/components/filterForDetailPage/index.vue @@ -20,6 +20,8 @@ :currenButtonData="currenButtonData" :tableData="tableData" :tableLoading="Loading.tableLoading" + @rowDrop="rowDropForDetail" + :rowSource="'detailPage_api'" :tableColumns="listColumns" :totalCount="totalCount" :multipleSelection="multipleSelection" @@ -46,7 +48,7 @@ label="操作" :align="'center'" width="150" - fixed="right" + fixed="left" > - - \ No newline at end of file +} + + \ No newline at end of file From 1c1c03c83564640fcf714715720e2e8bccd1adbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E8=99=B9=E7=9D=BF?= <297504645@qq.com> Date: Thu, 20 Jul 2023 09:47:24 +0800 Subject: [PATCH 10/35] =?UTF-8?q?=E8=8F=9C=E5=8D=95=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=B0=81=E8=A3=85=E5=8F=8A=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Code/Fe/public/config.js | 2 + Code/Fe/src/App.vue | 2 + Code/Fe/src/store/modules/permission.js | 109 +++++++++++++----------- 3 files changed, 62 insertions(+), 51 deletions(-) diff --git a/Code/Fe/public/config.js b/Code/Fe/public/config.js index 8a6e680..bce2a27 100644 --- a/Code/Fe/public/config.js +++ b/Code/Fe/public/config.js @@ -7,6 +7,8 @@ window.SITE_CONFIG['isAutoLogin'] = false window.SITE_CONFIG['isSinglePage'] = false window.SITE_CONFIG['userNameOrEmailAddress'] = 'admin' window.SITE_CONFIG['client_secret'] = '1q2w3E*' +window.SITE_CONFIG['menuHiddenConfig'] = ['AsnDet','PoDet','ReceiptDet','ReturnDet','SodDet'] + // window.SITE_CONFIG['user'] = 'http://dev.ccwin-in.com:60069/api' // // window.SITE_CONFIG['print'] = 'print'21384 // window.SITE_CONFIG['print'] = 'http://dev.ccwin-in.com:60074' diff --git a/Code/Fe/src/App.vue b/Code/Fe/src/App.vue index b84602c..a88e274 100644 --- a/Code/Fe/src/App.vue +++ b/Code/Fe/src/App.vue @@ -15,6 +15,8 @@ localStorage.setItem('isAutoLogin',window.SITE_CONFIG['isAutoLogin']) localStorage.setItem('isSinglePage',window.SITE_CONFIG['isSinglePage']) localStorage.setItem('userNameOrEmailAddress',window.SITE_CONFIG['userNameOrEmailAddress']) localStorage.setItem('client_secret',window.SITE_CONFIG['client_secret']) +localStorage.setItem('menuHiddenConfig',window.SITE_CONFIG['menuHiddenConfig']) + // localStorage.setItem('user',window.SITE_CONFIG['user']) // localStorage.setItem('print',window.SITE_CONFIG['print']) // localStorage.setItem('warehouseCode',window.SITE_CONFIG['warehouseCode']) diff --git a/Code/Fe/src/store/modules/permission.js b/Code/Fe/src/store/modules/permission.js index 90ca6f5..7f14117 100644 --- a/Code/Fe/src/store/modules/permission.js +++ b/Code/Fe/src/store/modules/permission.js @@ -178,63 +178,70 @@ const actions = { _menuList.push(item.substring(item.indexOf('.') + 1,item.length)) } } - let _noShowMenus = ['Z.AsnDet']//不显示的菜单 + // todo-new:接口获取 接口没有走配置文件 + let _noShowMenus = null//不显示的菜单 + _noShowMenus = localStorage.getItem('menuHiddenConfig').split(',') // 去掉不显示的菜单后全部显示的菜单 - let _showMenus = _menuList.filter(item1 => !_noShowMenus.some(item2 => item2 === item1)) - // 数据模拟,todo:接口获取 - let _treeMenusAll = [ - {name:"aaaaaaa"}, - {name:"ExportCustomUserSetting" - // ,children:[ - // {name:'OutgoingDataHistory',children:[ - // {name:'IncomingData',children:[ - // {name:'OutgoingDataHistory'}, - // {name:'IncomingData'}, - // {name:'333333'}, - // ]}, - // {name:'eee1111-bbb',children:[ - // {name:'ExportCustomUserSetting'}, - // {name:'MessageReceive'}, - // ]}, - // ]}, - // {name:'eee222'}, - // {name:'eee333'}, - // {name:'eee444'}, - // {name:'eee555'}, - // ] - }, - {name:"OutgoingDataHistory"}, - {name:"IncomingData"}, - {name:"IncomingDataHistory"}, - {name:"MesProductL7PartsNote"}, - {name:"MessageReceive"}, - {name:"OutgoingData"}, - {name:"AsnDet"}, - {name:"AsnMstr"}, - {name:"Bom"}, - {name:"CustPart"}, - {name:"Cust"}, - {name:"Inventory"}, - {name:"Loc"}, - {name:"Part"}, - {name:"PoDet"}, - {name:"PoMstr"}, - {name:"PrhHist"}, - {name:"ProdLine"}, - {name:"ReceiptDet"}, - {name:"ReceiptMstr"}, - {name:"ReturnDet"}, - {name:"ReturnMstr"}, - {name:"SodDet"}, - {name:"VendPart"}, - {name:"Vend"}, - ] + let _showMenus = _noShowMenus && _noShowMenus.length > 0 ? _menuList.filter(item1 => !_noShowMenus.some(item2 => item2 === item1)) : _menuList + // 数据模拟,todo-new:接口获取 + let _treeMenusAll = null//树形菜单 + // _treeMenusAll = [ + // {name:"aaaaaaa"}, + // {name:"ExportCustomUserSetting" + // // ,children:[ + // // {name:'OutgoingDataHistory',children:[ + // // {name:'IncomingData',children:[ + // // {name:'OutgoingDataHistory'}, + // // {name:'IncomingData'}, + // // {name:'333333'}, + // // ]}, + // // {name:'eee1111-bbb',children:[ + // // {name:'ExportCustomUserSetting'}, + // // {name:'MessageReceive'}, + // // ]}, + // // ]}, + // // {name:'eee222'}, + // // {name:'eee333'}, + // // {name:'eee444'}, + // // {name:'eee555'}, + // // ] + // }, + // {name:"OutgoingDataHistory"}, + // {name:"IncomingData"}, + // {name:"IncomingDataHistory"}, + // {name:"MesProductL7PartsNote"}, + // {name:"MessageReceive"}, + // {name:"OutgoingData"}, + // {name:"AsnDet"}, + // {name:"AsnMstr"}, + // {name:"Bom"}, + // {name:"CustPart"}, + // {name:"Cust"}, + // {name:"Inventory"}, + // {name:"Loc"}, + // {name:"Part"}, + // {name:"PoDet"}, + // {name:"PoMstr"}, + // {name:"PrhHist"}, + // {name:"ProdLine"}, + // {name:"ReceiptDet"}, + // {name:"ReceiptMstr"}, + // {name:"ReturnDet"}, + // {name:"ReturnMstr"}, + // {name:"SodDet"}, + // {name:"VendPart"}, + // {name:"Vend"}, + // ] let _initTreeMenus = [] if(_treeMenusAll && _treeMenusAll.length > 0){ _initTreeMenus = initTreeMenusHandle(_treeMenusAll,_showMenus,_zh,true) }else{ - _initTreeMenus = _showMenus + let _data = [] + for(let i in _showMenus){ + _data.push({name:_showMenus[i]}) + } + _initTreeMenus = initTreeMenusHandle(_data,_showMenus,_zh,true) } // 最后查重+层级查重后的菜单 let _initEndMenus = generaMenu(asyncRoutes, _initTreeMenus,true) From 57e1662e49c0a173a7dbb6443f3d8ac7cad31c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E8=99=B9=E7=9D=BF?= <297504645@qq.com> Date: Thu, 20 Jul 2023 13:12:13 +0800 Subject: [PATCH 11/35] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Code/Fe/src/components/filterForDetailPage/index.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Code/Fe/src/components/filterForDetailPage/index.vue b/Code/Fe/src/components/filterForDetailPage/index.vue index d98ad3d..ba6e60a 100644 --- a/Code/Fe/src/components/filterForDetailPage/index.vue +++ b/Code/Fe/src/components/filterForDetailPage/index.vue @@ -92,6 +92,8 @@ :append-to-body="false" :title="showParentTitle" :visible.sync="showParentDialog" + :close-on-click-modal="true" + :close-on-press-escape="true" :show-close="true" >
@@ -267,7 +269,7 @@ methods: { }, // 查看主表信息 showParentHandleForDetail(data){ - this.showParentTitle = `${data[this.URLOption_masterName]} 主表信息` + this.showParentTitle = `${data[this.URLOption_masterName] || ''} 主表信息` this.showParentDialog = true this.showParentLoading = true getListDesById(this.URLOption_parent,data[this.URLOption_masterId]) From 81ca70f7c8f93b27290c9ee5b4ce0bee9300662c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E8=99=B9=E7=9D=BF?= <297504645@qq.com> Date: Thu, 20 Jul 2023 15:02:26 +0800 Subject: [PATCH 12/35] =?UTF-8?q?=E5=8A=A8=E6=80=81=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E5=8F=8A=E8=B7=AF=E7=94=B1=E5=AE=88=E6=8A=A4=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E7=BC=96=E5=86=99=E5=BC=80=E5=8F=91=EF=BC=88?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=99=BB=E5=BD=95=E7=AD=89=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E5=A4=84=E7=90=86=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Code/Fe/public/config.js | 2 +- Code/Fe/src/layout/components/Navbar.vue | 2 +- Code/Fe/src/permission.js | 242 +++++++---------------- 3 files changed, 76 insertions(+), 170 deletions(-) diff --git a/Code/Fe/public/config.js b/Code/Fe/public/config.js index bce2a27..6afd744 100644 --- a/Code/Fe/public/config.js +++ b/Code/Fe/public/config.js @@ -3,7 +3,7 @@ window.SITE_CONFIG['base'] = 'http://dev.ccwin-in.com:60069' window.SITE_CONFIG['columnsApiNames'] = '/api/abp/application-localization' // window.SITE_CONFIG['columnsApiNames'] = '/api/abp/application-configuration' window.SITE_CONFIG['columnsApiNamesZh'] = 'Winin' -window.SITE_CONFIG['isAutoLogin'] = false +window.SITE_CONFIG['isAutoLogin'] = true window.SITE_CONFIG['isSinglePage'] = false window.SITE_CONFIG['userNameOrEmailAddress'] = 'admin' window.SITE_CONFIG['client_secret'] = '1q2w3E*' diff --git a/Code/Fe/src/layout/components/Navbar.vue b/Code/Fe/src/layout/components/Navbar.vue index 6f898db..9da40da 100644 --- a/Code/Fe/src/layout/components/Navbar.vue +++ b/Code/Fe/src/layout/components/Navbar.vue @@ -82,7 +82,7 @@ export default { // this.$router.push(`/login?redirect=${this.$route.fullPath}`); localStorage.removeItem("interfaceBoardColumnsNames") localStorage.removeItem("currentUserInfo") - this.$router.push('/login?isAutoLogin=false') + this.$router.push(`/login?redirect=${this.$route.fullPath}&isAutoLogin=false`) }, handleClick() { diff --git a/Code/Fe/src/permission.js b/Code/Fe/src/permission.js index 33c5468..72c1859 100644 --- a/Code/Fe/src/permission.js +++ b/Code/Fe/src/permission.js @@ -1,17 +1,11 @@ import router from './router' import store from './store' -import { - Message -} from 'element-ui' +import { Message } from 'element-ui' import NProgress from 'nprogress' // progress bar import 'nprogress/nprogress.css' // progress bar style -import { - getToken -} from '@/utils/auth' // get token from cookie +import { getToken } from '@/utils/auth' // get token from cookie import getPageTitle from '@/utils/get-page-title' -import { - asyncRoutes -} from '@/router' +import { asyncRoutes } from '@/router' import { getInterfaceBoard } from "@/api/wms-interface" import { login,getUsersByUserName } from "@/api/wms-auth" @@ -19,195 +13,107 @@ NProgress.configure({ showSpinner: false }) // NProgress Configuration -const whiteList = ['/login', '/auth-redirect', '/testForm'] // no redirect whitelist - - router.beforeEach(async (to, from, next) => { - // 添加路由信息,方便代码修改定位 - // console.log('----------------' + to.meta.title + '-----------------------'+ to.fullPath.substring(to.fullPath.lastIndexOf('-')+1,to.fullPath.length) + '.vue' ); // start progress bar NProgress.start() - // set page title document.title = getPageTitle() // 判断是否自动登录 let isAutoLogin = JSON.parse(localStorage.getItem('isAutoLogin')) + const interfaceBoardColumnsNames = localStorage.getItem("interfaceBoardColumnsNames") // 如果路径中有isAutoLogin参数则优先,否则读取配置文件中的isAutoLogin参数 let _url_isAutoLogin = to.query.isAutoLogin if( _url_isAutoLogin== 'false' || _url_isAutoLogin == 'true'){ isAutoLogin = JSON.parse(_url_isAutoLogin) } let userInfo = localStorage.getItem('currentUserInfo') - let _zh = localStorage.getItem('columnsApiNamesZh') // 是否有用户信息: // 1、如果没有判断是否为自动登录(是自动登录则自动执行登录,账号密码为配置信息中的值,不是自动登录则跳到登录页) - // 2、如果有用户信息:则检查是否有api接口的表头数据,没有的话重新获取 + // 2、有/没有:则检查是否有api接口的表头数据,没有的话重新获取 if(userInfo){ if(store.getters.permission_routes && store.getters.permission_routes.length > 0){ next() }else{ const accessRoutes = await store.dispatch('permission/getApiColumnsNames') router.addRoutes(accessRoutes) + console.log(52) next({ ...to, + query:{ + loginName:from.query.loginName, + isAutoLogin:from.query.isAutoLogin, + }, replace: true }) } - // next({ - // ...to, - // replace: true - // }) - // if(menuList){ - // next() - // }else{ - // const accessRoutes = await store.dispatch('permission/getApiColumnsNames') - // router.addRoutes(accessRoutes) - // next() - // } - // if(store.getters.permission_routes && store.getters.permission_routes.length > 0){ - // next() - // }else{ - // // const accessRoutes = await store.dispatch('permission/getApiColumnsNames') - // // router.addRoutes(accessRoutes) - // next() - // } - // if(isAutoLogin || to.query.loginName){ - // // let loginForm= { - // // userNameOrEmailAddress:localStorage.getItem("userNameOrEmailAddress"), - // // password:localStorage.getItem("client_secret"), - // // // rememberMe:true, - // // // grant_type: 'password', - // // // client_id: 'Auth_App', - // // } - // // // store.dispatch('user/login', loginForm).then(() => { - // // login(loginForm).then(()=>{ - // let _username = to.query.loginName ? to.query.loginName : localStorage.getItem("userNameOrEmailAddress") - // getUsersByUserName(_username).then(res=>{ - // // todo:currentUserInfo全程需要优化 - // localStorage.setItem("currentUserInfo", JSON.stringify(res)); - // }) - // .catch(err => { - // console.log('获取用户信息失败,请重试') - // }) - // // 提前获取接口监控看板表头数据并存储 - // getInterfaceBoard().then(result => { - // localStorage.setItem("interfaceBoardColumnsNames", JSON.stringify(result.resources[_zh].texts)); - // next('/') - // }) - // .catch(err => { - // console.log('获取表头失败,请重试') - // }) - // // }) - // // .catch((error) => { - // // console.log('登录失败') - // // }) - // } - // else{ - // if (to.path != '/login') { - // next('/login') - // }else{ - // next() - // } - // NProgress.done() - // } }else{ - if(to.path == '/login'){ - next() - }else{ - next('/login') + if(!interfaceBoardColumnsNames){ + const accessRoutes = await store.dispatch('permission/getApiColumnsNames') + router.addRoutes(accessRoutes) + console.log(123,to) + next({ + ...to, + query:{ + loginName:to.query.loginName, + isAutoLogin:to.query.isAutoLogin, + }, + replace: true + }) + } + if(isAutoLogin || to.query.loginName){ + // let loginForm= { + // userNameOrEmailAddress:localStorage.getItem("userNameOrEmailAddress"), + // password:localStorage.getItem("client_secret"), + // // rememberMe:true, + // // grant_type: 'password', + // // client_id: 'Auth_App', + // } + // // store.dispatch('user/login', loginForm).then(() => { + // login(loginForm).then(()=>{ + let _username = to.query.loginName ? to.query.loginName : localStorage.getItem("userNameOrEmailAddress") + if(to.path != '/login'){ + getUsersByUserName(_username).then(res=>{ + // todo:currentUserInfo全程需要优化 + if(res && JSON.stringify(res).length > 0){ + localStorage.setItem("currentUserInfo", JSON.stringify(res)); + // next('/') + next({ + ...to, + query:{ + loginName:to.query.loginName, + isAutoLogin:to.query.isAutoLogin, + }, + replace: true + }) + }else{ + next(`/login?loginName=${to.query.loginName}&isAutoLogin=${to.query.isAutoLogin}`) + // next(`/login`) + Message.error('获取用户信息失败,请重试') + } + }) + .catch(err => { + console.log('获取用户信息失败,请重试') + }) + }else{ + next() + } + // }) + // .catch((error) => { + // console.log('登录失败') + // }) + } + else{ + if (to.path != '/login') { + Message.error('获取用户信息失败,请重新登录') + next(`/login?loginName=${to.query.loginName}&isAutoLogin=${to.query.isAutoLogin}`) + next(`/login`) + }else{ + next() + } } - // if (to.path != '/login') { - // next('/login') - // }else{ - // next() - // } NProgress.done() - // 重新获取api接口表头 - // const _interfaceBoardColumnsNames = localStorage.getItem("interfaceBoardColumnsNames") - // if( !_interfaceBoardColumnsNames || _interfaceBoardColumnsNames == 'undefined' || _interfaceBoardColumnsNames == 'null'){ - // getInterfaceBoard().then(result => { - // // todo-new:columnsApiNamesZh配置的地址补全(evel) - // localStorage.setItem("interfaceBoardColumnsNames", JSON.stringify(result.resources[_zh].texts)); - // setTimeout(()=>{ - // next() - // },0) - // }) - // }else{ - // next() - // } } - - - // determine whether the user has logged in - - // todo-new:如果token接口恢复做处理 - const hasToken = getToken() - // else if (hasToken) { - // // if(from.path != '/login'){ - // // let _interfaceBoardColumnsNames = localStorage.getItem("interfaceBoardColumnsNames") - // // if(!_interfaceBoardColumnsNames){ - // // // next({ - // // // path: '/' - // // // }) - // // // NProgress.done() - // // } - // // } - // if (to.path === '/login') { - // // if is logged in, redirect to the home page - // next({ - // path: '/' - // }) - // NProgress.done() // hack: https://github.com/PanJiaChen/vue-element-admin/pull/2939 - // } else { - // // determine whether the user has obtained his permission roles through getInfo - // const hasRoles =await store.getters.roles && await store.getters.roles.length > 0 - // if (hasRoles) { - // next() - // } else { - // try { - // // get user info - // // note: roles must be a object array! such as: ['admin'] or ,['developer','editor'] - - // const { - // roles - // } = await store.dispatch('user/getInfo') - // // generate accessible routes map based on roles - - // // const accessRoutes = await store.dispatch('permission/generateRoutes', localStorage.getItem('userId')) - // // router.addRoutes(accessRoutes) - - // // 原码 防止刷新出现空白页(系统暂无出现所以注释) - // // const accessRoutes = await store.dispatch('permission/generateRoutes', roles) - // // router.addRoutes(accessRoutes) - - // // hack method to ensure that addRoutes is complete - // // set the replace: true, so the navigation will not leave a history record - // next({ - // ...to, - // replace: true - // }) - // } catch (error) { - // // remove token and go to login page to re-login - // await store.dispatch('user/resetToken') - // Message.error(error || 'Has Error') - // next(`/login?redirect=${to.path}`) - // NProgress.done() - // } - // } - // } - // } else { - // /* has no token*/ - - // if (whiteList.indexOf(to.path) !== -1) { - // // in the free login whitelist, go directly - // next() - // } else { - // // other pages that do not have permission to access are redirected to the login page. - // next(`/login?redirect=${to.path}`) - // NProgress.done() - // } - // } }) router.afterEach(() => { @@ -223,4 +129,4 @@ router.afterEach(() => { }, 1000) // finish progress bar NProgress.done() -}) +}) \ No newline at end of file From efb0dac12723b5ab1810b844d9ce559dbe18d86b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E8=99=B9=E7=9D=BF?= <297504645@qq.com> Date: Thu, 20 Jul 2023 16:20:06 +0800 Subject: [PATCH 13/35] =?UTF-8?q?=E6=8A=BD=E5=B1=89=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/currenDescriptions/index.vue | 18 +++++++++++++++++- .../components/filterForDetailPage/index.vue | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Code/Fe/src/components/currenDescriptions/index.vue b/Code/Fe/src/components/currenDescriptions/index.vue index 995990b..9e3c88f 100644 --- a/Code/Fe/src/components/currenDescriptions/index.vue +++ b/Code/Fe/src/components/currenDescriptions/index.vue @@ -1,5 +1,6 @@ @@ -375,11 +127,13 @@ :append-to-body="true" :show-close="true" :title="'内容详情'" + :close-on-click-modal="true" + :close-on-press-escape="true" > {{ showDetailData ? showDetailData + "" : showDetailData }} - + { @@ -883,28 +639,50 @@ export default { } } } + console.log(666,this.showJsonData) + this.showJsonData = _arr + this.showJsonData_str = JSON.stringify(JSON.parse(JSON.stringify(this.showJsonData)), null, '\t') this.$emit("showJsonTable", row); }, // 复制Json按钮 copyJsonHandle(){ + console.log(651,window.isSecureContext) this.showJsonCopy = true - navigator.clipboard.writeText(this.showJsonData_str) - .then(() => { - this.$message.success('复制成功'); - }) - .catch(err => { - this.$message.error('复制失败'); - }); - this.$nextTick(()=>{ - if(this.$refs.copyJsonTextarea_ref){ - this.$refs.copyJsonTextarea_ref.focus() + if (navigator.clipboard && window.isSecureContext) { + navigator.clipboard.writeText(this.showJsonData_str) + .then(() => { + this.$message.success('复制成功'); + }) + .catch(err => { + this.$message.error('复制失败'); + }); + }else { + // 创建text area + const textArea = document.createElement('textarea') + textArea.value = this.showJsonData_str + // 使text area不在viewport,同时设置不可见 + document.body.appendChild(textArea) + textArea.focus() + textArea.select() + return new Promise((resolve, reject) => { + // 执行复制命令并移除文本框 + document.execCommand('copy') ? resolve() : reject(new Error('出错了')) + textArea.remove() + }).then(() => { this.$nextTick(()=>{ - document.getElementById('copyJsonTextarea_dialog_ref').scrollTop = 0 + if(this.$refs.copyJsonTextarea_ref){ + this.$message.success('复制成功'); + this.$refs.copyJsonTextarea_ref.focus() + document.getElementById('copyJsonTextarea_dialog_ref').scrollTop = 0 + } }) - } - }) + },() => { + this.$message.error('复制失败'); + }) + } + }, //点击按钮打开自定义弹窗 buttonClick(row, index, label) { @@ -918,6 +696,36 @@ export default { buttonOperationClick_right(row, item, index) { this.$emit("buttonOperationClick_right", row, item, index); }, + // 转义枚举值 + initApiEnumList(item,data){ + let _enumListOp = this.$store.getters.enumList[item.apiBaseType] + let _item_enumList = {} + _enumListOp.enumValues.forEach((item,key)=>{ + _item_enumList[item] = _enumListOp.enumNames[key] + }) + return _item_enumList[data] || '未定义' + }, + // 其他类型转义,直接显示 | 点击可出详情 | 点击可点出json + initApiOtherType(data){ + try { + let _json = JSON.parse(data) + // 数值类型 + if(typeof _json == 'number' && _json){ + return [data,'show'] + }else{ + return [data,'json'] + } + } + // 直接显示 + catch(err){ + return [data,'detail'] + } + }, + // 判断操作 + showTypeHandle(type,row){ + if(type == 'detail')this.showDetailInfo(row) + if(type == 'json')this.showJsonTable(row) + }, }, }; diff --git a/Code/Fe/src/mixins/TableMixins.js b/Code/Fe/src/mixins/TableMixins.js index 251c472..edf881a 100644 --- a/Code/Fe/src/mixins/TableMixins.js +++ b/Code/Fe/src/mixins/TableMixins.js @@ -48,6 +48,8 @@ export const tableMixins = { URLOption_base:allUrlOption[this.$route.name].baseURL, //主表-明细 URLOption_detail:allUrlOption[this.$route.name].detailURL, + //明细列表(主表明细找枚举转义使用) + URLOption_detailList:allUrlOption[this.$route.name].detailListURL, // 主表-明细-筛选数据同步回显 detailSearchDataFE:null, // 主表-操作列 @@ -56,40 +58,54 @@ export const tableMixins = { }, methods: { // 获取通过api的表头数据,不可以在初始化处理,因为接口返回问题 - initApiColumns(table,des,detailsTable,detailsPage){ - // 赋值表头数据 - // if(table && table[this.$route.name])this.apiColumns_Table = this.initTableColumns(table[this.$route.name]) - if(des && des[this.$route.name])this.apiColumns_DesTions = des[this.$route.name] - if(detailsTable && detailsTable[this.$route.name])this.apiColumns_DetailsTable = this.initTableColumns(detailsTable[this.$route.name],'detail_api') - if(detailsPage && detailsPage[this.$route.name])this.apiColumns_DetailsPage = this.initTableColumns(detailsPage[this.$route.name],'detailPage_api') + // initApiColumns(table,des,detailsTable,detailsPage){ + // // 赋值表头数据 + // // if(table && table[this.$route.name])this.apiColumns_Table = this.initTableColumns(table[this.$route.name]) + // if(des && des[this.$route.name])this.apiColumns_DesTions = des[this.$route.name] + // if(detailsTable && detailsTable[this.$route.name])this.apiColumns_DetailsTable = this.initTableColumns(detailsTable[this.$route.name],'detail_api') + // if(detailsPage && detailsPage[this.$route.name])this.apiColumns_DetailsPage = this.initTableColumns(detailsPage[this.$route.name],'detailPage_api') + // }, + // get-dto-column-type接口表头类型初始化 + initApiColumnsForDto(data,list,titleName){ + let _coloums = data.filter(item=>{ + return item.dtoType == 'S' + }) + let _Columns_Table = [] + if(_coloums && _coloums.length > 0){ + let _data = _coloums[0].columnsTypes + _data.forEach(item=>{ + let _item = { + label:initFromApiColumnsLable(titleName + item.z_ColumnName) || item.z_ColumnName, + prop:firstWordSizeChange(item.z_ColumnName), + apiType:item.z_ColumnType, + apiBaseType:item.z_ColumnBaseType, + apiIsEnum:item.isEnum + } + // 如果list接口存在数据 ,与list接口返回字段比较处理,list接口存在的话则追加 + let _if = firstWordSizeChange(item.z_ColumnName) != 'details' + if(list && list.length > 0){ + _if = firstWordSizeChange(item.z_ColumnName) in list && firstWordSizeChange(item.z_ColumnName) != 'details' + } + if(_if){ + _Columns_Table.push(_item) + } + }) + } + return _Columns_Table }, //渲染数据 paging(callback) { this.Loading.tableLoading = true; this.PageListParams.SkipCount = (this.oldSkipCount - 1) * this.PageListParams.MaxResultCount Promise.all([ - getDtoColumnType(this.$route.name), + getDtoColumnType(this.URLOption_base), getPageList(this.PageListParams, this.URLOption_base) ]).then((allData) => { // 表头处理 if(allData[0]){ - let _coloums = allData[0].filter(item=>{ - return item.dtoType == 'S' - }) - let _Columns_Table = [] - if(_coloums && _coloums.length > 0){ - let _data = _coloums[0].columnsTypes - _data.forEach(item=>{ - let _item = { - label:initFromApiColumnsLable(this.$route.name + item.z_ColumnName) || item.z_ColumnName, - prop:firstWordSizeChange(item.z_ColumnName), - apiType:item.z_ColumnType, - isEnum:item.isEnum - } - _Columns_Table.push(_item) - }) - } - this.apiColumns_Table = this.initTableColumns(_Columns_Table) + let _Columns = this.initApiColumnsForDto(allData[0],allData[1].items[0] ,this.$route.name) + this.apiColumns_Table = this.initTableColumns(_Columns) + this.apiColumns_DesTions = _Columns } // 页面数据处理 if(allData[1]){ @@ -97,17 +113,10 @@ export const tableMixins = { this.totalCount = allData[1].totalCount } this.pagingCallback(callback) - console.log(111,this.apiColumns_Table,this.tableData) - }).catch(()=>{ + }).catch((err)=>{ this.Loading.tableLoading = false + if(error_callback)error_callback() }) - // getPageList(this.PageListParams, this.URLOption_base).then(res => { - // this.tableData = res.items - // this.totalCount = res.totalCount - // this.pagingCallback(callback) - // }).catch(err => { - // this.Loading.tableLoading = false - // }) }, //接受排序信息并改变视图 sortChange(val) { @@ -147,24 +156,35 @@ export const tableMixins = { this.Loading.DrawerLoading = true this.displayDialog.detailsDialog = true; let _url = this.URLOption_detail ? this.URLOption_detail : this.URLOption_base - getDetailed(val.id, _url).then(res => { - // 打印使用的全部数据存储 - this.tableDataDetails = JSON.parse(JSON.stringify(res)) - this.propsData = res - if (res.details) { - if(this.$refs.currenDrawer_Ref){ - this.$refs.currenDrawer_Ref.getDetailList(res,()=>{ - this.inlineDialogCallback() - },()=>{ - this.Loading.DrawerLoading = false - }) + Promise.all([ + getDtoColumnType(this.URLOption_detailList), + getDetailed(val.id, _url) + ]).then((allData) => { + // 表头处理 + if(allData[0]){ + let _parentName = this.URLOption_detailList.substr(0,this.URLOption_detailList.indexOf('/')) + this.initApiColumnsForDto(allData[0],allData[1].details[0],_parentName) + this.apiColumns_DetailsTable = this.initTableColumns(this.initApiColumnsForDto(allData[0],allData[1].details[0],_parentName)) + } + // 页面数据处理 + if(allData[1]){ + let res = allData[1] + // 打印使用的全部数据存储 + this.tableDataDetails = JSON.parse(JSON.stringify(res)) + this.propsData = res + if (res.details) { + if(this.$refs.currenDrawer_Ref){ + this.$refs.currenDrawer_Ref.getDetailList(res,()=>{ + this.inlineDialogCallback() + },()=>{ + this.Loading.DrawerLoading = false + }) + } + }else{ + this.Loading.DrawerLoading = false } - // 前端分页处理 - // this.propsData = this.detailListPageFromFE(res) - }else{ - this.Loading.DrawerLoading = false } - }).catch(err => { + }).catch(()=>{ this.Loading.DrawerLoading = false }) }, @@ -277,7 +297,6 @@ export const tableMixins = { // if( _item.name == 'search' || _item.name == 'moreList-search'){ // let _searchObj = {} // let searchData = options.data_moreList.filters; - // console.log(299,searchData) // searchData.forEach(item=>{ // _searchObj[item.column] = item.value // }) diff --git a/Code/Fe/src/permission.js b/Code/Fe/src/permission.js index ca62732..ab774e3 100644 --- a/Code/Fe/src/permission.js +++ b/Code/Fe/src/permission.js @@ -6,7 +6,6 @@ import 'nprogress/nprogress.css' // progress bar style import { getToken } from '@/utils/auth' // get token from cookie import getPageTitle from '@/utils/get-page-title' import { asyncRoutes } from '@/router' -import { getInterfaceBoard } from "@/api/wms-interface" import { login,getUsersByUserName } from "@/api/wms-auth" NProgress.configure({ @@ -19,6 +18,16 @@ router.beforeEach(async (to, from, next) => { // set page title document.title = getPageTitle() + // 获取枚举数据 + if(!store.getters.enumList || store.getters.enumList.length <= 0){ + await store.dispatch('definition/getEnumList') + } + + // // 获取表头转义 + // if(!store.getters.columZHList || store.getters.columZHList.length <= 0){ + // await store.dispatch('definition/getColumZHList') + // } + // 判断是否自动登录 let isAutoLogin = JSON.parse(localStorage.getItem('isAutoLogin')) const interfaceBoardColumnsNames = localStorage.getItem("interfaceBoardColumnsNames") @@ -52,11 +61,12 @@ router.beforeEach(async (to, from, next) => { }) } }else{ - console.log('没有store.getters.currentUserInfo',store.getters.currentUserInfo) + // console.log('没有store.getters.currentUserInfo',store.getters.currentUserInfo) if(!interfaceBoardColumnsNames){ console.log('没有interfaceBoardColumnsNames',interfaceBoardColumnsNames) - const accessRoutes = await store.dispatch('permission/getApiColumnsNames') - router.addRoutes(accessRoutes) + await store.dispatch('definition/getColumZHList') + // const accessRoutes = await store.dispatch('permission/getApiColumnsNames') + // router.addRoutes(accessRoutes) next({ ...to, query:{ @@ -91,14 +101,15 @@ router.beforeEach(async (to, from, next) => { replace: true }) }).catch(()=>{ - next({ - path:'/login', - query:{ - isAutoLogin:to.query.isAutoLogin, - isSinglePage:to.query.isSinglePage - }, - replace: true - }) + next() + // next({ + // path:'/login', + // query:{ + // isAutoLogin:to.query.isAutoLogin, + // isSinglePage:to.query.isSinglePage + // }, + // replace: true + // }) // next(`/login?loginName=${to.query.loginName}&isAutoLogin=${to.query.isAutoLogin}`) // next(`/login`) Message.error('获取用户信息失败,请重试!') diff --git a/Code/Fe/src/router/index.js b/Code/Fe/src/router/index.js index f94fb44..f3a3c8b 100644 --- a/Code/Fe/src/router/index.js +++ b/Code/Fe/src/router/index.js @@ -87,7 +87,7 @@ export let constantRoutes = [ name: 'Dashboard', meta: { keepAlive : true, - title: '系统首页', + title: localStorage.getItem('browserLanguage') == 'zh-Hans' ? '系统首页' : 'Dashboard', icon: '系统首页', outerFirst:true // affix: true diff --git a/Code/Fe/src/store/getters.js b/Code/Fe/src/store/getters.js index 48b96d8..544de54 100644 --- a/Code/Fe/src/store/getters.js +++ b/Code/Fe/src/store/getters.js @@ -14,5 +14,7 @@ const getters = { permission_routes: state => state.permission.routes, errorLogs: state => state.errorLog.logs, dictionaries: state => state.dictionaries.dict, + enumList: state => state.definition.enumList, + columZHList: state => state.definition.enumList, } export default getters diff --git a/Code/Fe/src/store/modules/definition.js b/Code/Fe/src/store/modules/definition.js index 7d8b791..fc46be0 100644 --- a/Code/Fe/src/store/modules/definition.js +++ b/Code/Fe/src/store/modules/definition.js @@ -1,16 +1,39 @@ +import { getInterfaceBoard,getApiEnumList } from "@/api/wms-interface" + const state = { - enumList: [] + enumList: [],//枚举 + columZHList:null,//表头转义 } const mutations = { - GET_ENUM_LIST: (state, log) => { - state.logs.push(log) + GET_ENUM_LIST: (state, data) => { + state.enumList=data + }, + GET_COLUMZH_LIST: (state, data) => { + state.columZHList=data }, } const actions = { - getEnumList({ commit }, log) { - commit('GET_ENUM_LIST', log) + // 获取枚举 + getEnumList({ commit }) { + return new Promise(resolve => { + getApiEnumList().then(res=>{ + commit('GET_ENUM_LIST', res.types) + resolve(res) + }) + }) + }, + // 获取表头转义 + getColumZHList({ commit }) { + return new Promise(resolve => { + getInterfaceBoard().then(res=>{ + let _zh = res.resources[localStorage.getItem('columnsApiNamesZh')].texts; + localStorage.setItem("interfaceBoardColumnsNames",JSON.stringify(_zh)) + commit('GET_COLUMZH_LIST', _zh) + resolve(res) + }) + }) }, } diff --git a/Code/Fe/src/store/modules/permission.js b/Code/Fe/src/store/modules/permission.js index 7f14117..c44f7f1 100644 --- a/Code/Fe/src/store/modules/permission.js +++ b/Code/Fe/src/store/modules/permission.js @@ -140,14 +140,14 @@ export function generaMenu(routes, data, first) { } // todo:接口返回的层级菜单,与查重后最终显示的菜单数组做查重及组合处理 -export function initTreeMenusHandle(tree, list,zh,first) { +export function initTreeMenusHandle(tree, list,first) { let _res = [] tree.forEach(item=>{ if(list.indexOf(item.name) >= 0){ - item.title = zh[item.name] || item.name + item.title = JSON.parse(localStorage.getItem("interfaceBoardColumnsNames"))[item.name] || item.name if(first)item.component = '@/layout' if (item.children && item.children.length > 0) { - item.children = initTreeMenusHandle(item.children,list,zh) + item.children = initTreeMenusHandle(item.children,list) } _res.push(item) } @@ -168,8 +168,6 @@ const actions = { // resolve(accessedRoutes) getDefinitionMenu(true).then(res => { let _allConfig = res.auth.grantedPolicies;//所有配置 - let _zh = res.localization.values[localStorage.getItem('columnsApiNamesZh')]; - localStorage.setItem("interfaceBoardColumnsNames", JSON.stringify(_zh)); let _menuList = []//接口获取所有的菜单 for(let item in _allConfig){ let point_number = item.split('.').length - 1 @@ -235,13 +233,13 @@ const actions = { let _initTreeMenus = [] if(_treeMenusAll && _treeMenusAll.length > 0){ - _initTreeMenus = initTreeMenusHandle(_treeMenusAll,_showMenus,_zh,true) + _initTreeMenus = initTreeMenusHandle(_treeMenusAll,_showMenus,true) }else{ let _data = [] for(let i in _showMenus){ _data.push({name:_showMenus[i]}) } - _initTreeMenus = initTreeMenusHandle(_data,_showMenus,_zh,true) + _initTreeMenus = initTreeMenusHandle(_data,_showMenus,true) } // 最后查重+层级查重后的菜单 let _initEndMenus = generaMenu(asyncRoutes, _initTreeMenus,true) diff --git a/Code/Fe/src/utils/detailsPageColumns_api/index.js b/Code/Fe/src/utils/detailsPageColumns_api/index.js index dcbd804..be71fdb 100644 --- a/Code/Fe/src/utils/detailsPageColumns_api/index.js +++ b/Code/Fe/src/utils/detailsPageColumns_api/index.js @@ -3,7 +3,7 @@ import { initFromApiColumnsLable } from '@/utils/index' // 测试数据 -export const TestSchool = [ - { label: initFromApiColumnsLable('TestStudentDetailStudentName'), prop: "studentName" }, - { label: initFromApiColumnsLable('TestStudentDetailOrderType'), prop: "orderType" }, -] \ No newline at end of file +// export const TestSchool = [ +// { label: initFromApiColumnsLable('TestStudentDetailStudentName'), prop: "studentName" }, +// { label: initFromApiColumnsLable('TestStudentDetailOrderType'), prop: "orderType" }, +// ] \ No newline at end of file diff --git a/Code/Fe/src/utils/detailsTableColumns_api/index.js b/Code/Fe/src/utils/detailsTableColumns_api/index.js index 27d924e..51ffc1d 100644 --- a/Code/Fe/src/utils/detailsTableColumns_api/index.js +++ b/Code/Fe/src/utils/detailsTableColumns_api/index.js @@ -4,7 +4,7 @@ import { initFromApiColumnsLable } from '@/utils/index' // 测试数据 -export const TestSchool = [ - { label: initFromApiColumnsLable('TestStudentDetailStudentName'), prop: "studentName" }, - { label: initFromApiColumnsLable('TestStudentDetailOrderType'), prop: "orderType" }, -] \ No newline at end of file +// export const TestSchool = [ +// { label: initFromApiColumnsLable('TestStudentDetailStudentName'), prop: "studentName" }, +// { label: initFromApiColumnsLable('TestStudentDetailOrderType'), prop: "orderType" }, +// ] \ No newline at end of file diff --git a/Code/Fe/src/utils/tableColumns_api/index.js b/Code/Fe/src/utils/tableColumns_api/index.js index b4b0a73..253be7e 100644 --- a/Code/Fe/src/utils/tableColumns_api/index.js +++ b/Code/Fe/src/utils/tableColumns_api/index.js @@ -3,7 +3,7 @@ import { initFromApiColumnsLable } from '@/utils/index' // 测试数据 -export const TestSchool = [ - { label: initFromApiColumnsLable('TestSchoolSchoolName'), prop: "schoolName", fixed: "left" }, - { label: initFromApiColumnsLable('TestStudentDetailOrderType'), prop: "orderType" }, -] \ No newline at end of file +// export const TestSchool = [ +// { label: initFromApiColumnsLable('TestSchoolSchoolName'), prop: "schoolName", fixed: "left" }, +// { label: initFromApiColumnsLable('TestStudentDetailOrderType'), prop: "orderType" }, +// ] \ No newline at end of file diff --git a/Code/Fe/src/utils/tabsDesTions_api/index.js b/Code/Fe/src/utils/tabsDesTions_api/index.js index a9b3ea5..d04646b 100644 --- a/Code/Fe/src/utils/tabsDesTions_api/index.js +++ b/Code/Fe/src/utils/tabsDesTions_api/index.js @@ -3,7 +3,7 @@ import { initFromApiColumnsLable } from '@/utils/index' // 测试数据 -export const TestSchool = [ - { label: initFromApiColumnsLable('TestSchoolSchoolName'), prop: "schoolName", fixed: "left", type: "name" }, - { label: initFromApiColumnsLable('TestStudentDetailOrderType'), prop: "orderType" }, -] \ No newline at end of file +// export const TestSchool = [ +// { label: initFromApiColumnsLable('TestSchoolSchoolName'), prop: "schoolName", fixed: "left", type: "name" }, +// { label: initFromApiColumnsLable('TestStudentDetailOrderType'), prop: "orderType" }, +// ] \ No newline at end of file diff --git a/Code/Fe/src/views/interfaceBoard/TestSchool.vue b/Code/Fe/src/views/interfaceBoard/TestSchool.vue index 4aa4757..ca2e992 100644 --- a/Code/Fe/src/views/interfaceBoard/TestSchool.vue +++ b/Code/Fe/src/views/interfaceBoard/TestSchool.vue @@ -66,10 +66,10 @@ @goBack="goBack" > + @@ -92,10 +92,10 @@ import { newAndEdiDialogMixins } from "@/mixins/newAndEdiDialogMixins" import { mixins } from "@/mixins/mixins"; import { filterSelectMixins } from '@/mixins/filter-Select' import { getToken } from '@/utils/auth' -import * as tableColumns_api from "@/utils/tableColumns_api/index" //全局从接口缓存的表头 -import * as tabsDesTions_api from "@/utils/tabsDesTions_api/index" //全局从接口缓存的详情 -import * as detailsTableColumns_api from "@/utils/detailsTableColumns_api/index" //全局从接口缓存的列表-明细 -import * as detailsPageColumns_api from "@/utils/detailsPageColumns_api/index" //全局从接口缓存的明细列表 +// import * as tableColumns_api from "@/utils/tableColumns_api/index" //全局从接口缓存的表头 +// import * as tabsDesTions_api from "@/utils/tabsDesTions_api/index" //全局从接口缓存的详情 +// import * as detailsTableColumns_api from "@/utils/detailsTableColumns_api/index" //全局从接口缓存的列表-明细 +// import * as detailsPageColumns_api from "@/utils/detailsPageColumns_api/index" //全局从接口缓存的明细列表 export default { name: "TestSchool", @@ -176,7 +176,8 @@ export default { }; }, mounted() { - this.initApiColumns(tableColumns_api,tabsDesTions_api,detailsTableColumns_api,detailsPageColumns_api) + // 如果使用动态api(全局进入时候获取情况) + // this.initApiColumns(tableColumns_api,tabsDesTions_api,detailsTableColumns_api,detailsPageColumns_api) this.paging(); }, } diff --git a/Code/Fe/src/views/login/index.vue b/Code/Fe/src/views/login/index.vue index b7c6d36..2cf4b08 100644 --- a/Code/Fe/src/views/login/index.vue +++ b/Code/Fe/src/views/login/index.vue @@ -70,7 +70,6 @@
\ No newline at end of file diff --git a/Code/Fe/src/components/tablePagination/index.vue b/Code/Fe/src/components/tablePagination/index.vue index 80178e1..900316d 100644 --- a/Code/Fe/src/components/tablePagination/index.vue +++ b/Code/Fe/src/components/tablePagination/index.vue @@ -36,6 +36,7 @@ :visible="rowDropVisible" @closeRowDrop="closeRowDrop" :source="rowSource" + :innerMaxHeight="rowMaxHeight" >
@@ -90,6 +91,10 @@ export default { rowDrop }, props: { + rowMaxHeight:{ + type:String, + default:'calc(90vh - 280px)' + }, // 筛选高度 searchOverallCoverHeight:{ type: String, diff --git a/Code/Fe/src/components/umyTable/index.vue b/Code/Fe/src/components/umyTable/index.vue index fa03c13..048ffc0 100644 --- a/Code/Fe/src/components/umyTable/index.vue +++ b/Code/Fe/src/components/umyTable/index.vue @@ -86,7 +86,7 @@