diff --git a/src/api/device/product.ts b/src/api/device/product.ts index df3741d5..ca143ef3 100644 --- a/src/api/device/product.ts +++ b/src/api/device/product.ts @@ -48,7 +48,7 @@ export const category = (data: any) => server.post('/device/category/_tree', dat /** * 获取网关类型 */ - export const getProviders = () => server.get('/gateway/device/providers') + export const getProviders = (terms?:any) => server.get('/gateway/device/providers',terms) /** * 查询所属部门 diff --git a/src/utils/comm.ts b/src/utils/comm.ts index 85f9273f..50d71456 100644 --- a/src/utils/comm.ts +++ b/src/utils/comm.ts @@ -108,4 +108,29 @@ export const onlyMessage = (msg: string, type: 'success' | 'error' | 'warning' = content: msg, key: type }) +} + +export interface SearchItemData { + column: any; + value: any; + termType: string; + type?: string; +} + +export const handleParamsToString = (terms:SearchItemData[] = []) => { + const _terms: any[] = [ + { terms: [null,null,null]}, + { terms: [null,null,null]} + ] + let termsIndex = 0 + let termsStar = 0 + terms.forEach((item, index) => { + if (index > 2) { + termsIndex = 1 + termsStar = 4 + } + _terms[termsIndex].terms[index - termsStar ] = item + }) + + return JSON.stringify({ terms: _terms}) } \ No newline at end of file diff --git a/src/utils/request.ts b/src/utils/request.ts index 5c260845..2397c36e 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -118,6 +118,16 @@ export const postStream = function(url: string, data={}, params = {}) { }) } +const showNotification = ( message: string, description: string, key?: string, show: boolean = true ) => { + if (show) { + Notification.error({ + key, + message, + description + }) + } +} + /** * 异常拦截处理器 * @param {Object} error @@ -128,44 +138,19 @@ const errorHandler = (error: any) => { const data = error.response.data const status = error.response.status if (status === 403) { - Notification.error({ - key: '403', - message: 'Forbidden', - description: (data.message + '').substr(0, 90) - }) - - setTimeout(() => { - router.push({ - name: 'Exception403' - }) - }, 0) + showNotification( 'Forbidden', (data.message + '').substr(0, 90), '403') } else if (status === 500) { - Notification.error({ - key: '500', - message: 'Server Side Error', - description: (data.message + '').substr(0, 90) - }) + showNotification( 'Server Side Error', (data.message + '').substr(0, 90), '500') } else if (status === 400) { - Notification.error({ - key: '400', - message: 'Request Error', - description: (data.message + '').substr(0, 90) - }) + showNotification( 'Request Error', (data.message + '').substr(0, 90), '400') } else if (status === 401) { - Notification.error({ - key: '401', - message: 'Unauthorized', - description: '用户未登录' - }) + showNotification( 'Unauthorized', '用户未登录', '401') setTimeout(() => { location.href = `/#${LoginPath}` }, 0) } } else if (error.response === undefined) { - Notification.error({ - message: error.message, - description: (error.stack + '').substr(0, 90) - }) + showNotification( error.message, (error.stack + '').substr(0, 90), undefined) } return Promise.reject(error) } diff --git a/src/views/DataCollect/Channel/index.vue b/src/views/DataCollect/Channel/index.vue index 5bc1270c..a0e8defb 100644 --- a/src/views/DataCollect/Channel/index.vue +++ b/src/views/DataCollect/Channel/index.vue @@ -37,6 +37,7 @@ :status="getState(slotProps).value" :statusText="getState(slotProps).text" :statusNames="StatusColorEnum" + @click="handlEye(slotProps.id)" >