Commit 2af3fe42eb84ed44d1c1cc77e07e8dbb445b47bb

Authored by fengwotao
1 parent 6a7475d9

feat:大屏公共接口管理测试新增支持restful风格的接口测试

... ... @@ -21,7 +21,6 @@
21 21 placeholder="请选择"
22 22 notFoundContent="请选择"
23 23 :options="selectOptions"
24   - @change="handleChange(item)"
25 24 allowClear
26 25 />
27 26 </td>
... ... @@ -45,6 +44,7 @@
45 44 notFoundContent="请选择"
46 45 :options="entityOptions"
47 46 allowClear
  47 + @change="handleDeviceChange(item)"
48 48 />
49 49 <Select
50 50 v-else-if="item.key === 'keys'"
... ... @@ -171,58 +171,15 @@
171 171 });
172 172 };
173 173
174   - //TODO 待优化 Select互斥
175   - const handleChange = async (e) => {
176   - selectOptions.value.forEach((ele) => {
177   - ele.disabled = false;
178   - tableTestArray.content.forEach((element) => {
179   - if (element.key === e.key && element.key !== 'scope') {
180   - element.value = null;
181   - }
182   - if (element.key === ele.value && element.key !== 'scope') {
183   - ele.disabled = true;
184   - }
185   - });
186   - });
187   - //获取对应项
188   - if (e.key === 'deviceProfileId') {
189   - const { options } = await useApi(e.key);
190   - valueOptions.value = options;
191   - } else if (e.key === 'organizationId') {
192   - const { options } = await useApi(e.key);
193   - treeData.value = options as any;
194   - } else if (e.key === 'entityId') {
195   - const getOrganizationIds = tableTestArray.content
196   - .map((f) => {
197   - if (f.key === 'organizationId') {
198   - return f.value;
199   - }
200   - })
201   - .filter(Boolean);
202   - if (getOrganizationIds.length === 0) return;
203   - getEntityOptions(getOrganizationIds?.at(-1));
204   - } else if (e.key === 'keys') {
205   - const getIds = tableTestArray.content
206   - .map((f) => {
207   - if (f.key === 'deviceProfileId') {
208   - return f.value;
209   - }
210   - })
211   - .filter(Boolean);
212   - if (getIds.length === 0) return;
213   - getAttributeOptions({ deviceProfileId: getIds?.at(-1) });
214   - } else if (e.key === 'date') {
215   - valueOptions.value = [];
216   - }
217   - };
218   -
219 174 const handleOrgnationChange = async (e) => {
  175 + let deviceProfileId = '';
220 176 tableTestArray.content.forEach((f) => {
221 177 if (f.key === 'entityId') {
222 178 f.value = null;
223 179 }
  180 + if (f.key === 'deviceProfileId') deviceProfileId = f.value;
224 181 });
225   - getEntityOptions(e.value);
  182 + getEntityOptions(e.value, deviceProfileId);
226 183 };
227 184
228 185 const getEntityOptions = async (organizationId: string, deviceProfileId?: string) => {
... ... @@ -240,16 +197,26 @@
240 197 };
241 198
242 199 const handleValueChange = (e) => {
  200 + let organizationId = '';
243 201 if (e.key === 'deviceProfileId') {
244 202 tableTestArray.content.forEach((f) => {
245 203 if (f.key === 'keys') {
246 204 f.value = null;
247 205 }
  206 + if (f.key === 'organizationId') organizationId = f.value;
  207 + if (f.key === 'entityId') f.value = null;
248 208 });
249 209 getAttributeOptions({ deviceProfileId: e.value });
  210 + if (organizationId !== '') {
  211 + getEntityOptions(organizationId, e.value);
  212 + }
250 213 }
251 214 };
252 215
  216 + const handleDeviceChange = (e) => {
  217 + console.log(e);
  218 + };
  219 +
253 220 //获取数据
254 221 const getValue = () => {
255 222 return tableTestArray.content;
... ... @@ -261,6 +228,9 @@
261 228 </script>
262 229
263 230 <style scoped lang="less">
  231 + :deep(.ant-select-selector) {
  232 + width: 12vw !important;
  233 + }
264 234 @table-color: #e5e7eb;
265 235
266 236 .table-border-color {
... ...