diff --git a/anrui-buscenter/anrui-finmanage-ui/src/api/jichuxinxi/dictcommons.js b/anrui-buscenter/anrui-finmanage-ui/src/api/jichuxinxi/dictcommons.js index 56117fc3d1..ce80ddec73 100644 --- a/anrui-buscenter/anrui-finmanage-ui/src/api/jichuxinxi/dictcommons.js +++ b/anrui-buscenter/anrui-finmanage-ui/src/api/jichuxinxi/dictcommons.js @@ -33,6 +33,16 @@ export function getPathSidByUserSid(data) { params: data }) } + +// 根据当前登录人orgSidPath(全路径sid)查询分公司 +export function getOrgSidByPath(data) { + return request({ + url: '/portal/v1/sysstafforg/getOrgSidByPath', + method: 'get', + params: data + }) +} + // 根据分公司sid查询分公司名称 export function fetchBySid(sid) { return request({ @@ -124,3 +134,12 @@ export function getBankList(data) { }) } +// 当前用户创建申请时判断该用户是否有该菜单的操作权限 +export function selectHaveMessage(data) { + return request({ + url: '/portal/v1/sysuser/selectHaveMessage ', + method: 'post', + data: data, + headers: { 'Content-Type': 'application/json' } + }) +} diff --git a/anrui-buscenter/anrui-finmanage-ui/src/layout/components/Navbar.vue b/anrui-buscenter/anrui-finmanage-ui/src/layout/components/Navbar.vue index 906df1600d..348e7776b7 100644 --- a/anrui-buscenter/anrui-finmanage-ui/src/layout/components/Navbar.vue +++ b/anrui-buscenter/anrui-finmanage-ui/src/layout/components/Navbar.vue @@ -29,7 +29,7 @@ export default { this.Orgname = window.sessionStorage.getItem('Orgname') this.departmentName = window.sessionStorage.getItem('departmentName') this.name = window.sessionStorage.getItem('name') - this.pNameAndDepartmentNameAndPostName = window.sessionStorage.getItem('pNameAndDepartmentNameAndPostName') + this.pNameAndDepartmentNameAndPostName = window.sessionStorage.getItem('defaultOrgPathName') var nowDate = new Date() this.year = nowDate.getFullYear() }, diff --git a/anrui-buscenter/anrui-finmanage-ui/src/main.js b/anrui-buscenter/anrui-finmanage-ui/src/main.js index cbb824e2db..80808cfc1e 100644 --- a/anrui-buscenter/anrui-finmanage-ui/src/main.js +++ b/anrui-buscenter/anrui-finmanage-ui/src/main.js @@ -14,7 +14,7 @@ import Pagination from '@/components/pagination/index.vue' import tabsearch from '@/components/tab-search/index.vue' import eimage from '@/components/E-image/index.vue' import Print from '@/utils/print' // 引入附件的js文件 -import { setStorage } from './utils/auth.js' +import { setStorage, setDefaultOrgPathName, setDefaultOrgPath } from './utils/auth.js' import VueAMap from 'vue-amap' import request from '@/utils/request' @@ -56,6 +56,17 @@ function GetQueryString(name) { // if (r != null) return unescape(r[2]); return null } +var one = window.location.href.indexOf('&organizationData') + 18 +if (parseInt(one) > 18) { + const data = window.location.href.substr(one) // url解码unescape()已从web中移除,尽量不使用 + var data1 = decodeURIComponent(data) + if (data1 !== undefined) { + const obj = JSON.parse(data1) + setDefaultOrgPath(obj.defaultOrgPath) + setDefaultOrgPathName(obj.defaultOrgPathName) + } +} + // 获取登录用户信息 function getUserInfo() { return request({ @@ -79,8 +90,7 @@ function getUserInfo() { Orgname: data.organizationName, dwjb: data.dwjb, orgNamePath: data.orgNamePath, // 使用组织全路径名称 - orgSidPath: data.orgSidPath, // 使用组织全路径Sid - pNameAndDepartmentNameAndPostName:data.pNameAndDepartmentNameAndPostName + orgSidPath: data.orgSidPath // 使用组织全路径Sid } // 结果存入缓存 window.sessionStorage.setItem('staffSid', user.staffSid) @@ -94,7 +104,6 @@ function getUserInfo() { window.sessionStorage.setItem('departmentSid', user.departmentSid) window.sessionStorage.setItem('orgNamePath', user.orgNamePath) window.sessionStorage.setItem('orgSidPath', user.orgSidPath) - window.sessionStorage.setItem('pNameAndDepartmentNameAndPostName', user.pNameAndDepartmentNameAndPostName) new Vue({ el: '#app', router, diff --git a/anrui-buscenter/anrui-finmanage-ui/src/utils/auth.js b/anrui-buscenter/anrui-finmanage-ui/src/utils/auth.js index 8a7d0a4c7d..520985bd52 100644 --- a/anrui-buscenter/anrui-finmanage-ui/src/utils/auth.js +++ b/anrui-buscenter/anrui-finmanage-ui/src/utils/auth.js @@ -17,13 +17,21 @@ export function removeToken() { export function getStorage() { return sessionStorage.getItem('token') - // return 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTm8iOiIwZDhkODExOS1kNDc2LTQ3Y2UtODljMi0wNzVjZDgwOWRkYTYiLCJpc3MiOiJXQksiLCJleHAiOjE2Mzc4MDIwODh9.zLhMa-pfxK19jB1gXjjxjYQp3wxjMaJsFa_xQrwknps'; + // return 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTm8iOiIwZDhkODExOS1kNDc2LTQ3Y2UtODljMi0wNzVjZDgwOWRkYTYiLCJpc3MiOiJXQksiLCJleHAiOjE2Mzc4MDIwODh9.zLhMa-pfxK19jB1gXjjxjYQp3wxjMaJsFa_xQrwknps' } export function setStorage(session) { return sessionStorage.setItem('token', session) } +export function setDefaultOrgPathName(data) { + return sessionStorage.setItem('defaultOrgPathName', data) +} + +export function setDefaultOrgPath(data) { + return sessionStorage.setItem('defaultOrgPath', data) +} + export function removeStorage() { return sessionStorage.removeItem('token') } diff --git a/anrui-buscenter/anrui-finmanage-ui/src/utils/request.js b/anrui-buscenter/anrui-finmanage-ui/src/utils/request.js index 023c665285..12093fa629 100644 --- a/anrui-buscenter/anrui-finmanage-ui/src/utils/request.js +++ b/anrui-buscenter/anrui-finmanage-ui/src/utils/request.js @@ -4,27 +4,33 @@ import store from '@/store' import { getToken, getStorage } from '@/utils/auth' // create an axios instance -console.log(process.env.VUE_APP_URL) const service = axios.create({ baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url - // timeout: 5000 // request timeout - headers:{'Content-Type':'application/x-www-form-urlencoded;'} + // withCredentials: true, // send cookies when cross-domain requests + timeout: 30000 // request timeout }) // request interceptor service.interceptors.request.use( config => { - config.params = { - ...config.params, - _t: Date.parse(new Date()) / 1000 - } - if (getStorage()) { + // do something before request is sent + // if (store.getters.token) { + // // let each request carry token + // // ['X-Token'] is a custom headers key + // // please modify it according to the actual situation + // config.headers['X-Token'] = getToken() + // } + if (getStorage()) { + // let each request carry token + // ['X-Token'] is a custom headers key + // please modify it according to the actual situation config.headers['token'] = getStorage() } return config }, error => { + // do something with request error console.log(error) // for debug return Promise.reject(error) } @@ -32,23 +38,53 @@ service.interceptors.request.use( // response interceptor service.interceptors.response.use( + /** + * If you want to get http information such as headers or status + * Please return response => response + */ + /** + * Determine the request status by custom code + * Here is just an example + * You can also judge the status by HTTP Status Code + */ response => { const res = response.data + const statusCode = response.status // if the custom code is not 20000, it is judged as an error. - if (res.code != 200) { - if (res.msg == "请重新登录") { - // window.location.href = 'http://39.104.100.138:8082/' - } else { + if (statusCode !== 200) { + Message({ + message: res.msg || response.message || 'Error', + type: 'error', + showClose: true, + duration: 5 * 1000 + }) + + // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired; + if (statusCode === 401 || res.code === '5000' || res.code === 5000 || res.code === 50012 || res.code === 50014) { + // to re-login + MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { + confirmButtonText: '重新登录', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + store.dispatch('logout').then(() => { + location.href = 'http://120.46.131.15/#/login' + // location.reload() + }) + }) + } + return Promise.reject(new Error(res.message || 'Error')) + } else { + if (!res.success) { Message({ message: res.msg || 'Error', type: 'error', + showClose: true, duration: 5 * 1000 }) } - return Promise.reject(new Error(res.message || 'Error')) - } else { return res } }, @@ -57,6 +93,7 @@ service.interceptors.response.use( Message({ message: error.message, type: 'error', + showClose: true, duration: 5 * 1000 }) return Promise.reject(error) diff --git a/anrui-buscenter/anrui-finmanage-ui/src/views/anruifinmanagement/feiyongshenqing/chooseVinNo.vue b/anrui-buscenter/anrui-finmanage-ui/src/views/anruifinmanagement/feiyongshenqing/chooseVinNo.vue index df38027d15..8d56db987d 100644 --- a/anrui-buscenter/anrui-finmanage-ui/src/views/anruifinmanagement/feiyongshenqing/chooseVinNo.vue +++ b/anrui-buscenter/anrui-finmanage-ui/src/views/anruifinmanagement/feiyongshenqing/chooseVinNo.vue @@ -62,21 +62,19 @@ export default { isSearchShow: false, searchxianshitit: '隐藏查询条件', tableKey: 0, - showbackState: 30, sids: [], list: [], - number: '', listLoading: false, - userOrgSid: '', listQuery: { current: 1, size: 10, params: { vinNo: '', userSid: '', + orgPath: '', sidList: [] }, - total: 1 + total: 0 } } }, @@ -103,6 +101,7 @@ export default { getList() { this.listLoading = true this.listQuery.params.userSid = window.sessionStorage.getItem('userSid') + this.listQuery.params.orgPath = window.sessionStorage.getItem('defaultOrgPath') req.pageList(this.listQuery).then((response) => { this.listLoading = false if (response.success) { @@ -123,6 +122,7 @@ export default { params: { vinNo: '', userSid: '', + orgPath: '', sidList: [] }, total: 1 diff --git a/anrui-buscenter/anrui-finmanage-ui/src/views/anruifinmanagement/feiyongshenqing/expense.vue b/anrui-buscenter/anrui-finmanage-ui/src/views/anruifinmanagement/feiyongshenqing/expense.vue index f16a93e404..7b52dfd117 100644 --- a/anrui-buscenter/anrui-finmanage-ui/src/views/anruifinmanagement/feiyongshenqing/expense.vue +++ b/anrui-buscenter/anrui-finmanage-ui/src/views/anruifinmanagement/feiyongshenqing/expense.vue @@ -58,9 +58,10 @@ 查看 - + @@ -108,6 +109,9 @@ + + + @@ -116,9 +120,10 @@ import Pagination from '@/components/pagination' import pageye from '@/components/pagination/pageye' import ButtonBar from '@/components/ButtonBar' import req from '@/api/anruifinmanagement/expense' -import { typeValues } from '@/api/jichuxinxi/dictcommons' +import { typeValues, selectHaveMessage } from '@/api/jichuxinxi/dictcommons' import expenseAdd from './expenseAdd.vue' import expenseInfo from './expenseInfo.vue' +import { getStorage } from '@/utils/auth' export default { name: 'feiyongshenqingguaili', @@ -131,6 +136,9 @@ export default { }, data() { return { + url: '', + dialogHeight: '80%', + centerDialogVisible: false, btndisabled: false, btnList: [ { @@ -185,7 +193,8 @@ export default { costTypeKey: '', state: '', useTypeKey: '', - userSid: '' + userSid: '', + orgPath: '' }, current: 1, size: 10, @@ -199,9 +208,40 @@ export default { this.init() }, mounted() { + // 在外部vue的window上添加postMessage的监听,而且绑定处理函数handleMessage + window.addEventListener('message', this.handleMessage) this.$refs['btnbar'].setButtonList(this.btnList) }, methods: { + async handleMessage(event) { + var code = '' + if (event.data.params !== null && event.data.params !== undefined) { + code = event.data.params.code + } + if (code === 1) { + this.init() + this.centerDialogVisible = false + } else if (code === 2) { + this.dialogHeight = event.data.params.data + this.setIframeHeight(document.getElementById('iframe')) + } + }, + closeIt() { + this.url = '' + this.centerDialogVisible = false + }, + setIframeHeight(iframe) { + iframe.height = this.dialogHeight + }, + flowRecord(row) { + this.centerDialogVisible = true + var params = { + deployId: row.procDefId, + procInsId: row.procInstId, + token: getStorage() + } + this.url = '/#/flow/flowRecordForBusiness?data=' + encodeURI((JSON.stringify(params))) + }, init() { typeValues({ type: 'costType' }).then((res) => { if (res.success) { @@ -264,14 +304,11 @@ export default { getList() { this.listLoading = true this.listQuery.params.userSid = window.sessionStorage.getItem('userSid') + this.listQuery.params.orgPath = window.sessionStorage.getItem('defaultOrgPath') req.listPage(this.listQuery).then((response) => { console.log('列表查询结果:', response) this.listLoading = false - if ( - response.success && - response.data && - response.data.total > 0 - ) { + if (response.success) { this.list = response.data.records this.listQuery.total = response.data.total } else { @@ -294,7 +331,8 @@ export default { costTypeKey: '', state: '', useTypeKey: '', - userSid: '' + userSid: '', + orgPath: '' }, current: 1, size: 10, @@ -303,8 +341,12 @@ export default { this.init() }, toAdd() { - this.viewState = 2 - this.$refs['divAdd'].showAdd(this.listQuery.params.createOrgSid) + selectHaveMessage({ menuUrl: this.$route.path, orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((resp) => { + if (resp.success) { + this.viewState = 2 + this.$refs['divAdd'].showAdd(this.listQuery.params.createOrgSid) + } + }) }, // 删除 doDel() { diff --git a/anrui-buscenter/anrui-finmanage-ui/src/views/anruifinmanagement/feiyongshenqing/expenseAdd.vue b/anrui-buscenter/anrui-finmanage-ui/src/views/anruifinmanagement/feiyongshenqing/expenseAdd.vue index ac8b296c54..d419aedd35 100644 --- a/anrui-buscenter/anrui-finmanage-ui/src/views/anruifinmanagement/feiyongshenqing/expenseAdd.vue +++ b/anrui-buscenter/anrui-finmanage-ui/src/views/anruifinmanagement/feiyongshenqing/expenseAdd.vue @@ -103,7 +103,7 @@ import req from '@/api/anruifinmanagement/expense' import { typeValues } from '@/api/jichuxinxi/dictcommons' import chooseVinNo from './chooseVinNo' export default { - name: 'feiyongshenqingAdd', + name: 'FeiyongshenqingAdd', components: { chooseVinNo }, @@ -131,6 +131,7 @@ export default { taskId: '', useTypeKey: '', useTypeValue: '', + orgPath: '', vinNoList: [] }, rules: {}, @@ -154,20 +155,15 @@ export default { this.useType_list = res.data } }) - this.newDate() }, newDate() { - let date = new Date() - let year = date.getFullYear() // 年 - let month = date.getMonth() + 1 // 月 - let day = date.getDate() // 日 - if (month < 10) { - month = '0' + month - } - if (day < 10) { - day = '0' + day + var nowDate = new Date() + var date = { + year: nowDate.getFullYear(), + month: nowDate.getMonth() + 1, + day: nowDate.getDate() } - this.formobj.createTime = year + '-' + month + '-' + day + this.formobj.createTime = date.year + '-' + (date.month >= 10 ? date.month : '0' + date.month) + '-' + (date.day >= 10 ? date.day : '0' + date.day) }, UpNumber(e) { e.target.value = e.target.value.replace(/[^\d]/g, '') // 清除“数字”和“.”"-"以外的字符 @@ -181,11 +177,13 @@ export default { }, showAdd() { this.DataDictionary() + this.newDate() this.$nextTick(() => { this.$refs['form_obj'].clearValidate() }) this.formobj.createBySid = window.sessionStorage.getItem('userSid') this.formobj.name = window.sessionStorage.getItem('name') + this.formobj.orgPath = window.sessionStorage.getItem('defaultOrgPath') this.viewTitle = '【新增】费用申请' }, showEdit(row) { @@ -269,7 +267,6 @@ export default { if (valid) { this.submitdisabled = true req.saveOrUpdate(this.formobj).then((resp) => { - this.submitdisabled = false if (resp.success) { this.$message({ showClose: true, @@ -277,6 +274,8 @@ export default { message: resp.msg }) this.handleReturn('true') + } else { + this.submitdisabled = false } }).catch(() => { this.submitdisabled = false @@ -296,7 +295,6 @@ export default { if (valid) { this.submitdisabled = true req.submitVehicleApply(this.formobj, this.formobj.sid).then((resp) => { - this.submitdisabled = false if (resp.success) { this.$message({ showClose: true, @@ -304,6 +302,8 @@ export default { message: resp.msg }) this.handleReturn('true') + } else { + this.submitdisabled = false } }).catch(() => { this.submitdisabled = false @@ -320,23 +320,25 @@ export default { if (isreload === 'true') this.$emit('reloadlist') this.formobj = { busSid: '', - cost: '', - costTitleKey: '', - costTitleValue: '', - costTypeKey: '', - costTypeValue: '', - createBySid: '', - instanceId: '', - isOutDoor: '', - isVeh: '', - name: '', - sid: '', - taskId: '', - useTypeKey: '', - useTypeValue: '', - vinNoList: [] + cost: '', + costTitleKey: '', + costTitleValue: '', + costTypeKey: '', + costTypeValue: '', + createBySid: '', + instanceId: '', + isOutDoor: '', + isVeh: '', + name: '', + sid: '', + taskId: '', + useTypeKey: '', + useTypeValue: '', + orgPath: '', + vinNoList: [] } this.checked = false + this.submitdisabled = false this.$refs['form_obj'].resetFields() this.$emit('doback') } diff --git a/anrui-buscenter/anrui-finmanage-ui/src/views/workFlow/feiyongguanliFlow/feiyongguanli/chooseVinNo.vue b/anrui-buscenter/anrui-finmanage-ui/src/views/workFlow/feiyongguanliFlow/feiyongguanli/chooseVinNo.vue index f293ea8cdf..8f6ff3f8c2 100644 --- a/anrui-buscenter/anrui-finmanage-ui/src/views/workFlow/feiyongguanliFlow/feiyongguanli/chooseVinNo.vue +++ b/anrui-buscenter/anrui-finmanage-ui/src/views/workFlow/feiyongguanliFlow/feiyongguanli/chooseVinNo.vue @@ -62,21 +62,19 @@ export default { isSearchShow: false, searchxianshitit: '隐藏查询条件', tableKey: 0, - showbackState: 30, sids: [], list: [], - number: '', listLoading: false, - userOrgSid: '', listQuery: { current: 1, size: 10, params: { vinNo: '', userSid: '', + orgPath: '', sidList: [] }, - total: 1 + total: 0 } } }, @@ -103,6 +101,7 @@ export default { getList() { this.listLoading = true this.listQuery.params.userSid = window.sessionStorage.getItem('userSid') + this.listQuery.params.orgPath = window.sessionStorage.getItem('defaultOrgPath') req.pageList(this.listQuery).then((response) => { this.listLoading = false if (response.success) { @@ -123,6 +122,7 @@ export default { params: { vinNo: '', userSid: '', + orgPath: '', sidList: [] }, total: 1 diff --git a/anrui-buscenter/anrui-finmanage-ui/src/views/workFlow/feiyongguanliFlow/feiyongguanli/feiyongDaiBanInfo.vue b/anrui-buscenter/anrui-finmanage-ui/src/views/workFlow/feiyongguanliFlow/feiyongguanli/feiyongDaiBanInfo.vue index d9f19154d3..5c60df9004 100644 --- a/anrui-buscenter/anrui-finmanage-ui/src/views/workFlow/feiyongguanliFlow/feiyongguanli/feiyongDaiBanInfo.vue +++ b/anrui-buscenter/anrui-finmanage-ui/src/views/workFlow/feiyongguanliFlow/feiyongguanli/feiyongDaiBanInfo.vue @@ -159,7 +159,6 @@ export default { }).catch((e) => { this.formobj = {} }) - console.log('这里是详情回显', row) }, // 同意 openAgree(val) { diff --git a/anrui-buscenter/anrui-finmanage-ui/src/views/workFlow/feiyongguanliFlow/feiyongguanli/feiyongEdit.vue b/anrui-buscenter/anrui-finmanage-ui/src/views/workFlow/feiyongguanliFlow/feiyongguanli/feiyongEdit.vue index bcfc025980..498c306b45 100644 --- a/anrui-buscenter/anrui-finmanage-ui/src/views/workFlow/feiyongguanliFlow/feiyongguanli/feiyongEdit.vue +++ b/anrui-buscenter/anrui-finmanage-ui/src/views/workFlow/feiyongguanliFlow/feiyongguanli/feiyongEdit.vue @@ -102,7 +102,7 @@ import req from '@/api/anruifinmanagement/expense' import { typeValues } from '@/api/jichuxinxi/dictcommons' import chooseVinNo from './chooseVinNo' export default { - name: 'feiyongEdit', + name: 'FeiyongEdit', components: { chooseVinNo }, @@ -130,6 +130,7 @@ export default { taskId: '', useTypeKey: '', useTypeValue: '', + orgPath: '', vinNoList: [] }, rules: {}, @@ -263,7 +264,6 @@ export default { if (valid) { this.submitdisabled = true req.saveOrUpdate(this.formobj).then((resp) => { - this.submitdisabled = false if (resp.success) { this.$message({ showClose: true, @@ -278,6 +278,8 @@ export default { code: 1 } }, '*') + } else { + this.submitdisabled = false } }).catch(() => { this.submitdisabled = false @@ -297,7 +299,6 @@ export default { if (valid) { this.submitdisabled = true req.submitVehicleApply(this.formobj, this.formobj.sid).then((resp) => { - this.submitdisabled = false if (resp.success) { this.$message({ showClose: true, @@ -312,6 +313,8 @@ export default { code: 1 } }, '*') + } else { + this.submitdisabled = false } }).catch(() => { this.submitdisabled = false diff --git a/anrui-buscenter/anrui-finmanage-ui/src/views/workFlow/feiyongguanliFlow/feiyongguanli/feiyongYiBanInfo.vue b/anrui-buscenter/anrui-finmanage-ui/src/views/workFlow/feiyongguanliFlow/feiyongguanli/feiyongYiBanInfo.vue index a90a0f5a01..4310cb5f29 100644 --- a/anrui-buscenter/anrui-finmanage-ui/src/views/workFlow/feiyongguanliFlow/feiyongguanli/feiyongYiBanInfo.vue +++ b/anrui-buscenter/anrui-finmanage-ui/src/views/workFlow/feiyongguanliFlow/feiyongguanli/feiyongYiBanInfo.vue @@ -121,7 +121,6 @@ export default { }).catch((e) => { this.formobj = {} }) - console.log('这里是详情回显', row) }, /** 确认撤回任务 */ openRevoke() { @@ -156,13 +155,6 @@ export default { code: 1 } }, '*') - } else { - this.$notify({ - title: '提示', - message: '执行失败', - type: 'error', - duration: 2000 - }) } }) }