---
title: 查询条件转换转换
order: 6
---
单位转换。

```jsx
import React, { Component ,useRef} from 'react';
import ReactDOM from 'react-dom';
import {tfConditions,getConditionGroup} from '@riil-frontend/component-res-advanced-search';
import {Button} from "@alifd/next";
import request from './request.js'

function App () {
    const ref = useRef();
    return (
      <Button  onClick={()=>{
    const data=  tfConditions([
    {
        "relation": "and",
        "children": [
            {
                "key": 1,
                "type": {
                    "rootCi": "switch",
                    "type": "attributes",
                    "attributes": "owned_cabinet",
                    "option": "=",
                    "searchValue": "111",
                    "dataType": "string",
                    "attributesOption": [
                        {
                            "value": "owned_computer_room",
                            "name": "所属机房"
                        },
                        {
                            "value": "owned_cabinet",
                            "name": "所属机柜"
                        },
                       
                    ],
                    "relationOption": null,
                    "instanceOption": null
                }
            }
        ]
    }
]);
const newData = getConditionGroup([
    {
        "relation": "and",
        "children": [
            {
                "key": 1,
                "type": {
                    "rootCi": "switch",
                    "type": "attributes",
                    "attributes": "owned_cabinet",
                    "option": "=",
                    "searchValue": "111",
                    "dataType": "string",
                    "attributesOption": [
                        {
                            "value": "owned_computer_room",
                            "name": "所属机房"
                        },
                        {
                            "value": "owned_cabinet",
                            "name": "所属机柜"
                        },
                       
                    ],
                    "relationOption": null,
                    "instanceOption": null
                }
            }
        ]
    }
])
console.log("condition",data)
console.log("newCondition",newData)
      }} >转化</Button>
    );
  
}

ReactDOM.render((
  <App />
), mountNode);
```
