Commit 355a19bbf93342808cf450ce8ac6533c435e59e4

Authored by xp.Huang
2 parents eba67a36 86b0900c

Merge branch 'fix/DEFECT-1638' into 'main_dev'

fix: 修改租户配置筛选无效 tcp网关子设备命令类型选择

See merge request yunteng/thingskit-front!918
@@ -174,8 +174,7 @@ @@ -174,8 +174,7 @@
174 const handleFilterOption = async (inputValue: string, option: Recordable) => { 174 const handleFilterOption = async (inputValue: string, option: Recordable) => {
175 const { filterOption, fetchSearch } = props; 175 const { filterOption, fetchSearch } = props;
176 if (filterOption && isFunction(filterOption)) { 176 if (filterOption && isFunction(filterOption)) {
177 - filterOption?.(inputValue, option);  
178 - return; 177 + return filterOption?.(inputValue, option);
179 } 178 }
180 179
181 if (fetchSearch) { 180 if (fetchSearch) {
@@ -189,8 +188,9 @@ @@ -189,8 +188,9 @@
189 @dropdownVisibleChange="handleFetch" 188 @dropdownVisibleChange="handleFetch"
190 v-bind="attrs" 189 v-bind="attrs"
191 @change="handleChange" 190 @change="handleChange"
  191 + @filterOption="handleFilterOption"
192 :options="getOptions" 192 :options="getOptions"
193 - :filterOption="handleFilterOption" 193 + optionFilterProp="label"
194 :showSearch="true" 194 :showSearch="true"
195 v-model:value="state" 195 v-model:value="state"
196 @popup-scroll="debounceHandlePopupScroll" 196 @popup-scroll="debounceHandlePopupScroll"
@@ -117,7 +117,7 @@ @@ -117,7 +117,7 @@
117 }; 117 };
118 118
119 const handleCheckCard = (item: ProfileRecord) => { 119 const handleCheckCard = (item: ProfileRecord) => {
120 - if (item.default) return; 120 + if (item.default || item.name == 'default') return;
121 item.checked = !item.checked; 121 item.checked = !item.checked;
122 }; 122 };
123 123
@@ -31,7 +31,6 @@ export const searchFormSchema: FormSchema[] = [ @@ -31,7 +31,6 @@ export const searchFormSchema: FormSchema[] = [
31 field: 'textSearch', 31 field: 'textSearch',
32 label: '名称', 32 label: '名称',
33 component: 'Input', 33 component: 'Input',
34 -  
35 colProps: { span: 8 }, 34 colProps: { span: 8 },
36 componentProps: { 35 componentProps: {
37 placeholder: '请输入名称', 36 placeholder: '请输入名称',
@@ -30,11 +30,6 @@ @@ -30,11 +30,6 @@
30 icon: 'ant-design:eye-outlined', 30 icon: 'ant-design:eye-outlined',
31 onClick: handleView.bind(null, record), 31 onClick: handleView.bind(null, record),
32 }, 32 },
33 - // {  
34 - // label: '详情',  
35 - // icon: 'ant-design:field-time-outlined',  
36 - // onClick: handleDetail.bind(null, record),  
37 - // },  
38 { 33 {
39 label: '编辑', 34 label: '编辑',
40 icon: 'clarity:note-edit-line', 35 icon: 'clarity:note-edit-line',
@@ -103,9 +98,6 @@ @@ -103,9 +98,6 @@
103 import { useRouter } from 'vue-router'; 98 import { useRouter } from 'vue-router';
104 import { ref } from 'vue'; 99 import { ref } from 'vue';
105 import { isObject } from '/@/utils/is'; 100 import { isObject } from '/@/utils/is';
106 - // import { ChainDetailDrawer } from './chainDetail/index';  
107 - // import { useDrawer } from '/@/components/Drawer';  
108 -  
109 const [registerModal, { openModal }] = useModal(); 101 const [registerModal, { openModal }] = useModal();
110 const { createMessage } = useMessage(); 102 const { createMessage } = useMessage();
111 const { hasPermission } = usePermission(); 103 const { hasPermission } = usePermission();
@@ -153,6 +153,7 @@ @@ -153,6 +153,7 @@
153 title: '是否确认删除操作?', 153 title: '是否确认删除操作?',
154 onConfirm: handleDelete.bind(null), 154 onConfirm: handleDelete.bind(null),
155 }, 155 },
  156 + disabled: !!getRecord.state,
156 }, 157 },
157 ]" 158 ]"
158 /> 159 />
@@ -293,12 +293,13 @@ export const commonDataSourceSchemas = (): FormSchema[] => { @@ -293,12 +293,13 @@ export const commonDataSourceSchemas = (): FormSchema[] => {
293 (item) => item.itemValue == CommandTypeEnum.ATTRIBUTE.toString() 293 (item) => item.itemValue == CommandTypeEnum.ATTRIBUTE.toString()
294 ); 294 );
295 } 295 }
296 -  
297 // TCP网关子 --> 不能要服务命令类型 296 // TCP网关子 --> 不能要服务命令类型
298 if (deviceType == 'SENSOR' && transportType == 'TCP') { 297 if (deviceType == 'SENSOR' && transportType == 'TCP') {
299 - return record.filter(  
300 - (item) => item.itemValue == CommandTypeEnum.ATTRIBUTE.toString()  
301 - ); 298 + return codeType == 'MODBUS_RTU'
  299 + ? record.filter((item) => item.itemValue == CommandTypeEnum.ATTRIBUTE.toString())
  300 + : codeType == 'CUSTOM'
  301 + ? record.filter((item) => item.itemValue == CommandTypeEnum.CUSTOM.toString())
  302 + : [];
302 } 303 }
303 304
304 if (codeType == TaskTypeEnum.MODBUS_RTU) { 305 if (codeType == TaskTypeEnum.MODBUS_RTU) {