|
@@ -1,7 +1,7 @@
|
|
|
<!--
|
|
|
* @Author: your name
|
|
|
* @Date: 2021-10-14 17:17:53
|
|
|
- * @LastEditTime: 2022-04-11 14:49:29
|
|
|
+ * @LastEditTime: 2022-04-21 11:57:19
|
|
|
* @LastEditors: your name
|
|
|
* @Description: In User Settings Edit
|
|
|
* @FilePath: \Foshan4A\src\views\dashboard\index.vue
|
|
@@ -130,6 +130,10 @@ import Journal from './components/journal.vue'
|
|
|
import { GetOthSystem } from '@/api/apiHome'
|
|
|
import axios from 'axios'
|
|
|
import qs from 'qs'
|
|
|
+import { externalSSO } from '@/api/login'
|
|
|
+import { sendLog } from '@/api/apiLog'
|
|
|
+import { parseTime } from '@/utils'
|
|
|
+import { getLogId, getUserId, getUserName } from '@/utils/auth'
|
|
|
export default {
|
|
|
name: 'Dashboard',
|
|
|
components: { Analysis, Journal },
|
|
@@ -220,7 +224,7 @@ export default {
|
|
|
userId: Number(this.UserId),
|
|
|
userType: this.UserType
|
|
|
})
|
|
|
- if (result.code === 0 && result.returnData.length) {
|
|
|
+ if (result.code === 0) {
|
|
|
this.flList = result.returnData.map(item => {
|
|
|
const map = {}
|
|
|
let params = []
|
|
@@ -360,7 +364,7 @@ export default {
|
|
|
handleCommand({ item, index }) {
|
|
|
this.toApp(item, index)
|
|
|
},
|
|
|
- toApp(item, index = 0) {
|
|
|
+ async toApp(item, index = 0) {
|
|
|
if (Number(item.status) === 1) {
|
|
|
if (item.appUrl) {
|
|
|
let method
|
|
@@ -402,26 +406,63 @@ export default {
|
|
|
document.body.appendChild(form)
|
|
|
form.submit()
|
|
|
document.body.removeChild(form)
|
|
|
+ const now = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
|
|
+ const logData = {
|
|
|
+ LogInfo: params,
|
|
|
+ BeginTime: now,
|
|
|
+ EndTime: now,
|
|
|
+ LogType: '外部系统登录',
|
|
|
+ OperateResult: null,
|
|
|
+ Ident: ''
|
|
|
+ }
|
|
|
+ sendLog({
|
|
|
+ Data: [logData],
|
|
|
+ BrowserTag: navigator.userAgent,
|
|
|
+ OperateIP: returnCitySN.cip,
|
|
|
+ Msg: '外部系统登录',
|
|
|
+ BeginTime: now,
|
|
|
+ BeginTime2: now,
|
|
|
+ EndTime: now,
|
|
|
+ OperateResult: null,
|
|
|
+ Ident: '',
|
|
|
+ OperatorId: getUserId(),
|
|
|
+ LogId: getLogId(),
|
|
|
+ UserName: getUserName()
|
|
|
+ })
|
|
|
} else {
|
|
|
method = 'post'
|
|
|
headers['Content-Type'] =
|
|
|
- item.bodyType === 'application/json'
|
|
|
- ? 'application/json;charset=UTF-8'
|
|
|
- : 'application/x-www-form-urlencoded'
|
|
|
- axios({
|
|
|
- baseURL: item.appUrl,
|
|
|
- url: url.length ? '?' + url.join('&') : '',
|
|
|
- method,
|
|
|
- headers,
|
|
|
- data: item.bodyType === 'application/json' ? params : qs.stringify(params)
|
|
|
- })
|
|
|
- .then(res => {
|
|
|
- const data = res.data.data
|
|
|
- data && window.open(data)
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- this.$message.error(err)
|
|
|
+ item.bodyType === 'application/json' ? 'application/json' : 'application/x-www-form-urlencoded'
|
|
|
+ // axios({
|
|
|
+ // baseURL: item.appUrl,
|
|
|
+ // url: url.length ? '?' + url.join('&') : '',
|
|
|
+ // method,
|
|
|
+ // headers,
|
|
|
+ // data: item.bodyType === 'application/json' ? params : qs.stringify(params)
|
|
|
+ // })
|
|
|
+ // .then(res => {
|
|
|
+ // const data = res.data.data
|
|
|
+ // data && window.open(data)
|
|
|
+ // })
|
|
|
+ // .catch(err => {
|
|
|
+ // this.$message.error(err)
|
|
|
+ // })
|
|
|
+ try {
|
|
|
+ const result = await externalSSO({
|
|
|
+ baseURL: item.appUrl,
|
|
|
+ url: url.length ? '?' + url.join('&') : '',
|
|
|
+ method,
|
|
|
+ headers,
|
|
|
+ data: item.bodyType === 'application/json' ? params : qs.stringify(params)
|
|
|
})
|
|
|
+ if (result.code === 0) {
|
|
|
+ result.data && window.open(result.data)
|
|
|
+ } else {
|
|
|
+ this.$message.error(result.message)
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log('网络错误:', error)
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
this.$message.warning('应用地址为空')
|