|  | @ -7,18 +7,22 @@ import { IconSearch, IconHelpCircle, IconAlertCircle, IconMinusCircle, IconPlusC | 
			
		
	
		
		
			
				
					|  |  | import { SkeletonScreen } from "$components"; |  |  | import { SkeletonScreen } from "$components"; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | const AddModel = props => { |  |  | const AddModel = props => { | 
			
		
	
		
		
			
				
					
					|  |  |    const { dispatch, user, error, actions, close, editionData, searchValue, dataToModal } = props |  |  |    const { dispatch, user, error, actions, close, editionData, searchValue, dataToModal, cancel } = props | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |    const { edition } = actions |  |  |    const { edition } = actions | 
			
		
	
		
		
			
				
					|  |  |    const [query, setQuery] = useState({ limit: 10, page: 0 }); //页码信息 |  |  |    const [query, setQuery] = useState({ limit: 10, page: 0 }); //页码信息 | 
			
		
	
		
		
			
				
					|  |  |    const [limits, setLimits] = useState()//每页实际条数 |  |  |    const [limits, setLimits] = useState()//每页实际条数 | 
			
		
	
		
		
			
				
					|  |  |    const [detailV, setDetailV] = useState(false) |  |  |    const [detailV, setDetailV] = useState(false) | 
			
		
	
		
		
			
				
					|  |  |    const [property, setProperty] = useState([{ key: 'hb', value: 'ture' }]) |  |  |    const [property, setProperty] = useState([{ key: 'hb', value: 'ture' }]) | 
			
		
	
		
		
			
				
					
					|  |  |    const [type, setType] = useState('group')  //类型的判断 |  |  |    const [type, setType] = useState('antenna')  //类型的判断 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |    const [isEditor, setIsEditor] = useState(false) |  |  |    const [isEditor, setIsEditor] = useState(false) | 
			
		
	
		
		
			
				
					|  |  |    const [appearType, setAppearType] = useState('mqtt') |  |  |    const [appearType, setAppearType] = useState('mqtt') | 
			
		
	
		
		
			
				
					|  |  |    const api = useRef() |  |  |    const api = useRef() | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |    useEffect(() => { |  |  |    useEffect(() => { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |       if (dataToModal?.Plugin?.id) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |          setType(dataToModal?.Plugin?.type) | 
			
		
	
		
		
			
				
					|  |  |  |  |  |          setAppearType(dataToModal?.AntennaCtx?.type) | 
			
		
	
		
		
			
				
					|  |  |  |  |  |       } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |    }, []) |  |  |    }, []) | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  | @ -32,20 +36,23 @@ const AddModel = props => { | 
			
		
	
		
		
			
				
					|  |  |             visible={true} |  |  |             visible={true} | 
			
		
	
		
		
			
				
					|  |  |             onOk={() => { |  |  |             onOk={() => { | 
			
		
	
		
		
			
				
					|  |  |                api.current.validate().then(r => { |  |  |                api.current.validate().then(r => { | 
			
		
	
		
		
			
				
					
					|  |  |                   console.log(r); |  |  |                   if (r.ctx_res) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                   r.ctx_res = JSON.parse(r.ctx_res) |  |  |                      // r.ctx_res = JSON.parse(r.ctx_res) | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |                   } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                   if (r.ctx_group_content) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                      // r.ctx_group_content='[0]' | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                   } | 
			
		
	
		
		
			
				
					|  |  |                   // delete r.type |  |  |                   // delete r.type | 
			
		
	
		
		
			
				
					|  |  |                   if (editionData) { |  |  |                   if (editionData) { | 
			
		
	
		
		
			
				
					|  |  |                      dispatch(edition.postAlterPlugIn(searchValue, editionData, r)).then(res => { |  |  |                      dispatch(edition.postAlterPlugIn(searchValue, editionData, r)).then(res => { | 
			
		
	
		
		
			
				
					|  |  |                         console.log(res) |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                         if (res.success) { |  |  |                         if (res.success) { | 
			
		
	
		
		
			
				
					
					|  |  |                            // close() |  |  |                            close() | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                         } |  |  |                         } | 
			
		
	
		
		
			
				
					|  |  |                      }) |  |  |                      }) | 
			
		
	
		
		
			
				
					|  |  |                   } else { |  |  |                   } else { | 
			
		
	
		
		
			
				
					|  |  |                      dispatch(edition.postAddPlugIn(searchValue, r)).then(res => { |  |  |                      dispatch(edition.postAddPlugIn(searchValue, r)).then(res => { | 
			
		
	
		
		
			
				
					|  |  |                         if (res.success) { |  |  |                         if (res.success) { | 
			
		
	
		
		
			
				
					
					|  |  |                            console.log(res); |  |  |                            // console.log(res); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                            close() |  |  |                            close() | 
			
		
	
		
		
			
				
					|  |  |                         } |  |  |                         } | 
			
		
	
		
		
			
				
					|  |  |                      }) |  |  |                      }) | 
			
		
	
	
		
		
			
				
					|  | @ -54,7 +61,7 @@ const AddModel = props => { | 
			
		
	
		
		
			
				
					|  |  |                }) |  |  |                }) | 
			
		
	
		
		
			
				
					|  |  |             }} |  |  |             }} | 
			
		
	
		
		
			
				
					|  |  |             width={560} |  |  |             width={560} | 
			
		
	
		
		
			
				
					
					|  |  |             onCancel={() => close()} |  |  |             onCancel={() => cancel()} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |          > |  |  |          > | 
			
		
	
		
		
			
				
					|  |  |             <Form |  |  |             <Form | 
			
		
	
		
		
			
				
					|  |  |                getFormApi={(formApi) => (api.current = formApi)} |  |  |                getFormApi={(formApi) => (api.current = formApi)} | 
			
		
	
	
		
		
			
				
					|  | @ -64,7 +71,6 @@ const AddModel = props => { | 
			
		
	
		
		
			
				
					|  |  |                allowEmpty={true} |  |  |                allowEmpty={true} | 
			
		
	
		
		
			
				
					|  |  |                style={{ display: 'flex', flexDirection: 'column' }} |  |  |                style={{ display: 'flex', flexDirection: 'column' }} | 
			
		
	
		
		
			
				
					|  |  |                onValueChange={(_, v) => { |  |  |                onValueChange={(_, v) => { | 
			
		
	
		
		
			
				
					|  |  |                   console.log(v); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                   if (v?.type) { |  |  |                   if (v?.type) { | 
			
		
	
		
		
			
				
					|  |  |                      setType(v.type) |  |  |                      setType(v.type) | 
			
		
	
		
		
			
				
					|  |  |                   } |  |  |                   } | 
			
		
	
	
		
		
			
				
					|  | @ -92,7 +98,7 @@ const AddModel = props => { | 
			
		
	
		
		
			
				
					|  |  |                   initValue={dataToModal?.Plugin?.type || type} |  |  |                   initValue={dataToModal?.Plugin?.type || type} | 
			
		
	
		
		
			
				
					|  |  |                   rules={[{ required: true, message: "请选择类型" }]} |  |  |                   rules={[{ required: true, message: "请选择类型" }]} | 
			
		
	
		
		
			
				
					|  |  |                > |  |  |                > | 
			
		
	
		
		
			
				
					
					|  |  |                   {[{ name: '上报', value: 'group' }, { name: '计算', value: 'antenna' }].map(v => <Form.Select.Option key={v.value} value={v.value}>{v.name}</Form.Select.Option>)} |  |  |                   {[{ name: '上报', value: 'antenna' }, { name: '计算', value: 'group' }].map(v => <Form.Select.Option key={v.value} value={v.value}>{v.name}</Form.Select.Option>)} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                </Form.Select> |  |  |                </Form.Select> | 
			
		
	
		
		
			
				
					|  |  |                <Form.TextArea |  |  |                <Form.TextArea | 
			
		
	
		
		
			
				
					|  |  |                   field='description' |  |  |                   field='description' | 
			
		
	
	
		
		
			
				
					|  | @ -109,9 +115,10 @@ const AddModel = props => { | 
			
		
	
		
		
			
				
					|  |  |                   label='是否启动:' |  |  |                   label='是否启动:' | 
			
		
	
		
		
			
				
					|  |  |                   labelPosition="left" |  |  |                   labelPosition="left" | 
			
		
	
		
		
			
				
					|  |  |                   style={{ marginBottom: 12 }} |  |  |                   style={{ marginBottom: 12 }} | 
			
		
	
		
		
			
				
					
					|  |  |                   initValue={dataToModal?.Plugin?.enable || true} |  |  |                   // checked={dataToModal?.Plugin?.id ? dataToModal?.Plugin?.enable : true} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |                   initValue={dataToModal?.Plugin?.id ? dataToModal?.Plugin?.enable : true} | 
			
		
	
		
		
			
				
					|  |  |                /> |  |  |                /> | 
			
		
	
		
		
			
				
					
					|  |  |                {type == 'group' ? |  |  |                {type == 'antenna' ? | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                   <> |  |  |                   <> | 
			
		
	
		
		
			
				
					|  |  |                      <Form.Select |  |  |                      <Form.Select | 
			
		
	
		
		
			
				
					|  |  |                         field="ctx_type" |  |  |                         field="ctx_type" | 
			
		
	
	
		
		
			
				
					|  | @ -152,42 +159,42 @@ const AddModel = props => { | 
			
		
	
		
		
			
				
					|  |  |                            {appearType == 'mqtt' ? |  |  |                            {appearType == 'mqtt' ? | 
			
		
	
		
		
			
				
					|  |  |                               <> |  |  |                               <> | 
			
		
	
		
		
			
				
					|  |  |                                  <Form.Input field='ctx_param_ur' label='URL(必填):' labelPosition="left" |  |  |                                  <Form.Input field='ctx_param_ur' label='URL(必填):' labelPosition="left" | 
			
		
	
		
		
			
				
					
					|  |  |                                     placeholder='127.0.0.1:1883' style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.name || ''} |  |  |                                     placeholder='127.0.0.1:1883' style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.AntennaCtx?.params?.ur || ''} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                  /> |  |  |                                  /> | 
			
		
	
		
		
			
				
					|  |  |                                  <Form.Input field='ctx_param_clientid' label='ClientlD:' labelPosition="left" placeholder='请输入ClientlD' |  |  |                                  <Form.Input field='ctx_param_clientid' label='ClientlD:' labelPosition="left" placeholder='请输入ClientlD' | 
			
		
	
		
		
			
				
					
					|  |  |                                     style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.name || ''} |  |  |                                     style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.AntennaCtx?.params?.clientid || ''} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                  /> |  |  |                                  /> | 
			
		
	
		
		
			
				
					|  |  |                                  <Form.Input field='ctx_param_username' label='用户名:' labelPosition="left" placeholder='请输入用户名' |  |  |                                  <Form.Input field='ctx_param_username' label='用户名:' labelPosition="left" placeholder='请输入用户名' | 
			
		
	
		
		
			
				
					
					|  |  |                                     style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.name || ''} |  |  |                                     style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.AntennaCtx?.params?.username || ''} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                  /> |  |  |                                  /> | 
			
		
	
		
		
			
				
					|  |  |                                  <Form.Input field='ctx_param_password' label='密码:' labelPosition="left" placeholder='请输入密码' |  |  |                                  <Form.Input field='ctx_param_password' label='密码:' labelPosition="left" placeholder='请输入密码' | 
			
		
	
		
		
			
				
					
					|  |  |                                     style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.name || ''} |  |  |                                     style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.AntennaCtx?.params?.password || ''} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                  /> |  |  |                                  /> | 
			
		
	
		
		
			
				
					|  |  |                                  <Form.Input field='ctx_param_topic' label='默认上报主题:' labelPosition="left" placeholder='请输入主题' |  |  |                                  <Form.Input field='ctx_param_topic' label='默认上报主题:' labelPosition="left" placeholder='请输入主题' | 
			
		
	
		
		
			
				
					
					|  |  |                                     style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.name || ''} |  |  |                                     style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.AntennaCtx?.params?.topic || ''} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                  /> |  |  |                                  /> | 
			
		
	
		
		
			
				
					|  |  |                                  <Form.Input field='ctx_param_qos' label='默认上报QoS:' labelPosition="left" placeholder='0' |  |  |                                  <Form.Input field='ctx_param_qos' label='默认上报QoS:' labelPosition="left" placeholder='0' | 
			
		
	
		
		
			
				
					
					|  |  |                                     style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.name || ''} |  |  |                                     style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.AntennaCtx?.params?.qos || ''} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                  /> |  |  |                                  /> | 
			
		
	
		
		
			
				
					|  |  |                               </> |  |  |                               </> | 
			
		
	
		
		
			
				
					|  |  |                               : appearType == 'http' ? |  |  |                               : appearType == 'http' ? | 
			
		
	
		
		
			
				
					|  |  |                                  <> |  |  |                                  <> | 
			
		
	
		
		
			
				
					|  |  |                                     <Form.Input field='ctx_param_url' label='请求地址:' labelPosition="left" |  |  |                                     <Form.Input field='ctx_param_url' label='请求地址:' labelPosition="left" | 
			
		
	
		
		
			
				
					
					|  |  |                                        style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.name || ''} |  |  |                                        style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.AntennaCtx?.params?.url || ''} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                     /> |  |  |                                     /> | 
			
		
	
		
		
			
				
					|  |  |                                     <Form.Input field='ctx_param_method' label='请求方法:' labelPosition="left" placeholder='post' |  |  |                                     <Form.Input field='ctx_param_method' label='请求方法:' labelPosition="left" placeholder='post' | 
			
		
	
		
		
			
				
					
					|  |  |                                        style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.name || ''} |  |  |                                        style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.AntennaCtx?.params?.method || ''} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                     /> |  |  |                                     /> | 
			
		
	
		
		
			
				
					|  |  |                                     <Form.Input field='ctx_param_headers' label='默认请求头:' labelPosition="left" |  |  |                                     <Form.Input field='ctx_param_headers' label='默认请求头:' labelPosition="left" | 
			
		
	
		
		
			
				
					
					|  |  |                                        style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.name || JSON.stringify({})} |  |  |                                        style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.AntennaCtx?.params?.headers || ''} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                     /> |  |  |                                     /> | 
			
		
	
		
		
			
				
					|  |  |                                  </> |  |  |                                  </> | 
			
		
	
		
		
			
				
					|  |  |                                  : <> |  |  |                                  : <> | 
			
		
	
		
		
			
				
					|  |  |                                     <Form.Input field='ctx_param_type' label='数据库类型:' labelPosition="left" |  |  |                                     <Form.Input field='ctx_param_type' label='数据库类型:' labelPosition="left" | 
			
		
	
		
		
			
				
					
					|  |  |                                        style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.name || JSON.stringify({})} |  |  |                                        style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.AntennaCtx?.params?.type || ''} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                     /> |  |  |                                     /> | 
			
		
	
		
		
			
				
					|  |  |                                     <Form.Input field='ctx_param_conn' label='连接字符串:' labelPosition="left" |  |  |                                     <Form.Input field='ctx_param_conn' label='连接字符串:' labelPosition="left" | 
			
		
	
		
		
			
				
					
					|  |  |                                        style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.name || JSON.stringify({})} |  |  |                                        style={{ width: 180, marginBottom: 12 }} initValue={dataToModal?.AntennaCtx?.params?.conn || ''} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                     /> |  |  |                                     /> | 
			
		
	
		
		
			
				
					|  |  |                                  </> |  |  |                                  </> | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  | @ -213,14 +220,23 @@ const AddModel = props => { | 
			
		
	
		
		
			
				
					|  |  |                      /> |  |  |                      /> | 
			
		
	
		
		
			
				
					|  |  |                   </> |  |  |                   </> | 
			
		
	
		
		
			
				
					|  |  |                   : <> |  |  |                   : <> | 
			
		
	
		
		
			
				
					
					|  |  |                      <Button style={{ width: 182, marginBottom: 10, marginLeft: 104, color: '#0000009c', border: '1px solid #00000040', }}>获取平台计算和分组配置</Button> |  |  |                      <Button style={{ width: 182, marginBottom: 10, marginLeft: 104, color: '#0000009c', border: '1px solid #00000040', }} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |                         onClick={() => { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                            dispatch(edition.getPlugInPlatfromGroups(editionData)).then(res => { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                               // console.log(res) | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                               if (res.success) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                  api.current.setValue('ctx_group_content', res.payload.data) | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                               } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                            }) | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         }} | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                      >获取平台计算和分组配置</Button> | 
			
		
	
		
		
			
				
					|  |  |                      <Form.TextArea |  |  |                      <Form.TextArea | 
			
		
	
		
		
			
				
					|  |  |                         field='ctx_group_content' |  |  |                         field='ctx_group_content' | 
			
		
	
		
		
			
				
					|  |  |                         label='计算配置:' |  |  |                         label='计算配置:' | 
			
		
	
		
		
			
				
					|  |  |                         labelPosition="left" |  |  |                         labelPosition="left" | 
			
		
	
		
		
			
				
					|  |  |                         placeholder='' |  |  |                         placeholder='' | 
			
		
	
		
		
			
				
					|  |  |                         style={{ width: 300, marginBottom: 12 }} |  |  |                         style={{ width: 300, marginBottom: 12 }} | 
			
		
	
		
		
			
				
					
					|  |  |                         initValue={JSON.stringify(dataToModal?.GroupCtx?.groups) || JSON.stringify([])} |  |  |                         initValue={JSON.stringify(dataToModal?.GroupCtx?.groups) || '[]'} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                         autosize |  |  |                         autosize | 
			
		
	
		
		
			
				
					|  |  |                         rules={[{ required: true, message: "请输入计算配置" }]} |  |  |                         rules={[{ required: true, message: "请输入计算配置" }]} | 
			
		
	
		
		
			
				
					|  |  |                      /> |  |  |                      /> | 
			
		
	
	
		
		
			
				
					|  | @ -230,7 +246,6 @@ const AddModel = props => { | 
			
		
	
		
		
			
				
					|  |  |             </Form> |  |  |             </Form> | 
			
		
	
		
		
			
				
					|  |  |          </Modal> |  |  |          </Modal> | 
			
		
	
		
		
			
				
					|  |  |       </> |  |  |       </> | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  |    ); |  |  |    ); | 
			
		
	
		
		
			
				
					|  |  | } |  |  | } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  | 
 |