|  | @@ -2,24 +2,38 @@
 | 
	
		
			
				|  |  |   * 通知页面跳转
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  export function routeMsg (that, row) {
 | 
	
		
			
				|  |  | +  const safePush = (location) => {
 | 
	
		
			
				|  |  | +    try {
 | 
	
		
			
				|  |  | +      const res = that && that.$router && that.$router.push && that.$router.push(location)
 | 
	
		
			
				|  |  | +      // 兼容 vue-router 3.1+(返回 Promise)与 3.0 及更早(返回 undefined)
 | 
	
		
			
				|  |  | +      if (res && typeof res.catch === 'function') {
 | 
	
		
			
				|  |  | +        res.catch(() => {})
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      return res
 | 
	
		
			
				|  |  | +    } catch (e) {
 | 
	
		
			
				|  |  | +      // 避免异常打断用户操作
 | 
	
		
			
				|  |  | +      return null
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |    if (row.type === 1) {
 | 
	
		
			
				|  |  | -    that.$router.push({name: 'msgAnnouncement',
 | 
	
		
			
				|  |  | -      params: {notice: {
 | 
	
		
			
				|  |  | +    safePush({ name: 'msgAnnouncement',
 | 
	
		
			
				|  |  | +      params: { notice: {
 | 
	
		
			
				|  |  |          noticeId: row.noticeId,
 | 
	
		
			
				|  |  |          businessId: row.businessId
 | 
	
		
			
				|  |  | -      }}})
 | 
	
		
			
				|  |  | +      } } })
 | 
	
		
			
				|  |  |    } else if (row.type === 2) {
 | 
	
		
			
				|  |  | -    that.$router.push({name: 'msgApprove',
 | 
	
		
			
				|  |  | -      params: {notice: {
 | 
	
		
			
				|  |  | +    safePush({ name: 'msgApprove',
 | 
	
		
			
				|  |  | +      params: { notice: {
 | 
	
		
			
				|  |  |          noticeId: row.noticeId,
 | 
	
		
			
				|  |  |          businessId: row.businessId
 | 
	
		
			
				|  |  | -      }}})
 | 
	
		
			
				|  |  | +      } } })
 | 
	
		
			
				|  |  |    } else if (row.type === 3) {
 | 
	
		
			
				|  |  | -    that.$router.push({name: 'msgWork',
 | 
	
		
			
				|  |  | -      params: {notice: {
 | 
	
		
			
				|  |  | +    safePush({ name: 'msgWork',
 | 
	
		
			
				|  |  | +      params: { notice: {
 | 
	
		
			
				|  |  |          noticeId: row.noticeId,
 | 
	
		
			
				|  |  |          businessId: row.businessId
 | 
	
		
			
				|  |  | -      }}})
 | 
	
		
			
				|  |  | +      } } })
 | 
	
		
			
				|  |  |    } else {
 | 
	
		
			
				|  |  |      that.$message.warning('消息类型不支持')
 | 
	
		
			
				|  |  |    }
 | 
	
	
		
			
				|  | @@ -30,7 +44,7 @@ export function routeMsg (that, row) {
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  export function routeMsgs (that, row) {
 | 
	
		
			
				|  |  |    if (!row || !row.route) {
 | 
	
		
			
				|  |  | -    console.log('row = ', row)
 | 
	
		
			
				|  |  | +    // console.log('row = ', row)
 | 
	
		
			
				|  |  |      that.$message && that.$message.warning && that.$message.warning('消息未配置跳转地址')
 | 
	
		
			
				|  |  |      return
 | 
	
		
			
				|  |  |    }
 | 
	
	
		
			
				|  | @@ -69,21 +83,34 @@ export function routeMsgs (that, row) {
 | 
	
		
			
				|  |  |    const hasName = allRoutes.some(r => r && r.name === row.route)
 | 
	
		
			
				|  |  |    const hasPath = allRoutes.some(r => r && r.path === row.route)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +  // 统一封装,避免在不返回 Promise 的 vue-router 上对 undefined 调用 .catch
 | 
	
		
			
				|  |  | +  const safePush = (location) => {
 | 
	
		
			
				|  |  | +    try {
 | 
	
		
			
				|  |  | +      const res = that && that.$router && that.$router.push && that.$router.push(location)
 | 
	
		
			
				|  |  | +      if (res && typeof res.catch === 'function') {
 | 
	
		
			
				|  |  | +        res.catch(() => {})
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      return res
 | 
	
		
			
				|  |  | +    } catch (e) {
 | 
	
		
			
				|  |  | +      return null
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |    // 优先按路由名跳转(可传 params),否则按路径跳转(用 query 兜底)
 | 
	
		
			
				|  |  |    if (hasName) {
 | 
	
		
			
				|  |  | -    that.$router.push({ name: row.route, params: { notice } }).catch(() => {})
 | 
	
		
			
				|  |  | +    safePush({ name: row.route, params: { notice } })
 | 
	
		
			
				|  |  |      return
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |    if (hasPath) {
 | 
	
		
			
				|  |  | -    that.$router.push({ path: row.route, query: { ...notice } }).catch(() => {})
 | 
	
		
			
				|  |  | +    safePush({ path: row.route, query: { ...notice } })
 | 
	
		
			
				|  |  |      return
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    // 未匹配到配置时的兜底:无斜杠则作为 name,有斜杠当作 path
 | 
	
		
			
				|  |  | -  if (row.path.indexOf('/') === -1) {
 | 
	
		
			
				|  |  | -    that.$router.push({ name: row.route, params: { notice } }).catch(() => {})
 | 
	
		
			
				|  |  | +  if (row.route.indexOf('/') === -1) {
 | 
	
		
			
				|  |  | +    safePush({ name: row.route, params: { notice } })
 | 
	
		
			
				|  |  |    } else {
 | 
	
		
			
				|  |  | -    that.$router.push({ path: row.route, query: { ...notice } }).catch(() => {})
 | 
	
		
			
				|  |  | +    safePush({ path: row.route, query: { ...notice } })
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 |