Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Lind-pro committed Feb 25, 2021
2 parents 42e48df + d0d7843 commit 87fd273
Show file tree
Hide file tree
Showing 25 changed files with 1,429 additions and 203 deletions.
4 changes: 2 additions & 2 deletions config/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ export default {
test: {
'/jetlinks': {
// target: 'http://192.168.3.89:8848/',
target: 'http://2.jetlinks.org:9010/',
target: 'http://192.168.3.89:9010/',
changeOrigin: true,
pathRewrite: { '^/jetlinks': '' },
},
},
pre: {
'/jetlinks': {
// target: 'http://192.168.3.89:8848/',
target: 'http://2.jetlinks.org:9010/',
target: 'http://192.168.3.89:9010/',
changeOrigin: true,
pathRewrite: { '^/jetlinks': '' },
},
Expand Down
26 changes: 17 additions & 9 deletions config/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,37 +479,37 @@ export const routes = [
name: '云云对接',
icon: 'cloud',
version: 'pro',
authority: ['dueros-product', 'aliyun-bridge', 'onenet-product', 'ctwing-product', 'admin'],
authority: ['dueros-product', 'aliyun-bridge', 'onenet-product', 'ctwing-product'],
routes: [
{
path: '/cloud/duer',
name: 'DuerOS',
version: 'pro',
authority: ['dueros-product', 'admin'],
authority: ['dueros-product'],
icon: 'cloud',
component: './cloud/dueros',
},
{
path: '/cloud/aliyun',
name: '阿里云',
version: 'pro',
authority: ['aliyun-bridge', 'admin'],
authority: ['aliyun-bridge'],
icon: 'aliyun',
component: './cloud/aliyun',
},
{
path: '/cloud/onenet',
name: '移动OneNet',
version: 'pro',
authority: ['onenet-product', 'admin'],
authority: ['onenet-product'],
icon: 'mobile',
component: './cloud/onenet',
},
{
path: '/cloud/ctwing',
name: '电信CTWing',
version: 'pro',
authority: ['ctwing-product', 'admin'],
authority: ['ctwing-product'],
icon: 'phone',
component: './cloud/ctwing',
}
Expand All @@ -520,13 +520,13 @@ export const routes = [
name: '国标网关',
icon: 'youtube',
version: 'pro',
authority: ['gb28181-gateway','media-channel','media-server','media-stream','admin'],
authority: ['gb28181-gateway','media-channel','media-server','media-stream','gb28181-cascade'],
routes: [
{
path: '/media/basic',
name: '基本配置',
version: 'pro',
authority: ['gb28181-gateway','media-server','admin'],
authority: ['gb28181-gateway','media-server'],
icon: 'video-camera',
component: './media/basic',
},
Expand All @@ -550,7 +550,7 @@ export const routes = [
path: '/media/device',
name: '国标设备',
version: 'pro',
authority: ['media-device','media-stream','admin'],
authority: ['media-device'],
icon: 'gateway',
component: './media/device',
},
Expand All @@ -567,10 +567,18 @@ export const routes = [
path: '/media/reveal',
name: '分屏展示',
version: 'pro',
authority: ['media-stream','admin'],
authority: ['media-stream'],
icon: 'appstore',
component: './media/reveal',
},
{
path: '/media/cascade',
name: '国标级联',
version: 'pro',
authority: ['gb28181-cascade'],
icon: 'cloud-upload',
component: './media/cascade',
},
]
},
{
Expand Down
47 changes: 45 additions & 2 deletions src/pages/device/instance/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import React, { useEffect, useState } from 'react';
import Form, { FormComponentProps } from 'antd/lib/form';
import { Button, Col, Input, Row, Select, TreeSelect } from 'antd';
import apis from '@/services';
import { router } from 'umi';
import SearchTags from "@/pages/device/instance/Search/tags/tags";
import { getPageQuery } from '@/utils/utils';

interface Props extends FormComponentProps {
search: Function;
location: Location
}

interface State {
Expand Down Expand Up @@ -34,9 +37,41 @@ const Search: React.FC<Props> = props => {
const [categoryList, setCategoryList] = useState([]);
const [bindList, setBindList] = useState([]);

const mapType = new Map();
mapType.set('id$like', 'id');
mapType.set('name$like', 'name');
mapType.set('orgId$in', 'orgId');
mapType.set('id$dev-tag', 'devTag');
mapType.set('id$dev-bind$any', 'devBind');
mapType.set('productId$dev-prod-cat', 'devProd');

useEffect(() => {
setParameterType('id$like');
form.setFieldsValue({ parameter: 'id$like' });
const query: any = getPageQuery();
if (query && query !== {}) {
mapType.forEach((value, key) => {
let k = Object.keys(query)[0]
if(value === k){
form.setFieldsValue({ parameter: key });
if (key === 'orgId$in') {
form.setFieldsValue({value: query[k].split(",")})
} else if (key === 'id$dev-tag') {
let v = JSON.parse(query[k])
let displayData: any[] = [];
v.map((item: any) => {
displayData.push(`${item.key}=${item.value}`);
});
setFieldsValue({ 'value': displayData.join(';') });
}else if (key === 'id$dev-bind$any') {
form.setFieldsValue({value: query[k].split(",")})
}else{
form.setFieldsValue({ value: query[k] });
}
}
});
}else{
form.setFieldsValue({ parameter: 'id$like' });
}

apis.deviceProdcut.queryOrganization()
.then(res => {
Expand Down Expand Up @@ -82,8 +117,16 @@ const Search: React.FC<Props> = props => {
} else if (data.parameter === 'id$dev-tag') {
data.value = tagsData.length > 0 ? JSON.stringify(tagsData) : undefined;
} else if (data.parameter === 'id$dev-bind$any') {
data.value = JSON.stringify(data.value).replace(/[\[\]"]/g, '')
data.value = JSON.stringify(data.value).replace(/[\[\]"]/g, '')
}
let params = {}
params[mapType.get(data.parameter)] = data.value
params['productId'] = getPageQuery().productId
if(getPageQuery().productId){
params['productId'] = getPageQuery().productId
map['productId'] = getPageQuery().productId
}
router.push({ pathname: `/device/instance`, query: params })
map[data.parameter] = data.value;
props.search(map);
};
Expand Down

0 comments on commit 87fd273

Please sign in to comment.