Commit 01fd4719034ba89a9e9c649ed6271dded89bf938

Authored by xp.Huang
2 parents 8c3f7f22 d933f532

Merge branch 'ft-dev' into 'main'

fix:修复场景联动,编辑,然后设备回显问题

See merge request huang/yun-teng-iot-front!151
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 > 11 >
12 <div class="step-form-form"> 12 <div class="step-form-form">
13 <a-steps :current="current"> 13 <a-steps :current="current">
14 - <a-step title="选择转换方式" /> 14 + <a-step title="选择流转方式" />
15 <a-step title="完善配置参数" /> 15 <a-step title="完善配置参数" />
16 </a-steps> 16 </a-steps>
17 </div> 17 </div>
@@ -70,7 +70,7 @@ @@ -70,7 +70,7 @@
70 const refTransferConfigMode = ref(null); 70 const refTransferConfigMode = ref(null);
71 const getModeSelectVal = ref({}); 71 const getModeSelectVal = ref({});
72 const isUpdate = ref(true); 72 const isUpdate = ref(true);
73 - const getTitle = computed(() => (!unref(isUpdate) ? '新增转换配置' : '编辑数据转换')); 73 + const getTitle = computed(() => (!unref(isUpdate) ? '新增流转配置' : '编辑数据流转'));
74 const current = ref(0); 74 const current = ref(0);
75 const editPostId = ref(''); 75 const editPostId = ref('');
76 const editType = reactive({ 76 const editType = reactive({
@@ -200,14 +200,14 @@ @@ -200,14 +200,14 @@
200 if (!unref(isUpdate)) { 200 if (!unref(isUpdate)) {
201 await addOrEditFunc(); 201 await addOrEditFunc();
202 await postAddConvertApi(allPostForm); 202 await postAddConvertApi(allPostForm);
203 - createMessage.success('数据转换新增成功'); 203 + createMessage.success('数据流转新增成功');
204 emit('success'); 204 emit('success');
205 defineClearFunc(); 205 defineClearFunc();
206 closeModal(); 206 closeModal();
207 } else { 207 } else {
208 await addOrEditFunc(); 208 await addOrEditFunc();
209 await postAddConvertApi(allPostForm); 209 await postAddConvertApi(allPostForm);
210 - createMessage.success('数据转换编辑成功'); 210 + createMessage.success('数据流转编辑成功');
211 emit('success'); 211 emit('success');
212 defineClearFunc(); 212 defineClearFunc();
213 closeModal(); 213 closeModal();
@@ -4,7 +4,7 @@ import { Tag } from 'ant-design-vue'; @@ -4,7 +4,7 @@ import { Tag } from 'ant-design-vue';
4 4
5 export const columns: BasicColumn[] = [ 5 export const columns: BasicColumn[] = [
6 { 6 {
7 - title: '数据转换名称', 7 + title: '数据流转名称',
8 dataIndex: 'name', 8 dataIndex: 'name',
9 width: 200, 9 width: 200,
10 }, 10 },
@@ -127,6 +127,7 @@ export const modeKafkaForm: FormSchema[] = [ @@ -127,6 +127,7 @@ export const modeKafkaForm: FormSchema[] = [
127 } else { 127 } else {
128 if (values.name != undefined) { 128 if (values.name != undefined) {
129 isExistDataManagerNameApi({ 129 isExistDataManagerNameApi({
  130 + id: '',
130 name: value, 131 name: value,
131 type: 132 type:
132 typeValue.value == '' 133 typeValue.value == ''
@@ -152,7 +153,7 @@ export const modeKafkaForm: FormSchema[] = [ @@ -152,7 +153,7 @@ export const modeKafkaForm: FormSchema[] = [
152 }, 153 },
153 { 154 {
154 field: 'topicPattern', 155 field: 'topicPattern',
155 - label: 'Topic', 156 + label: '消息次数',
156 colProps: { span: 12 }, 157 colProps: { span: 12 },
157 required: true, 158 required: true,
158 component: 'Input', 159 component: 'Input',
@@ -164,7 +165,7 @@ export const modeKafkaForm: FormSchema[] = [ @@ -164,7 +165,7 @@ export const modeKafkaForm: FormSchema[] = [
164 }, 165 },
165 { 166 {
166 field: 'bootstrapServers', 167 field: 'bootstrapServers',
167 - label: 'Bootstrap', 168 + label: '服务器',
168 colProps: { span: 12 }, 169 colProps: { span: 12 },
169 component: 'Input', 170 component: 'Input',
170 defaultValue: 'localhost:9092', 171 defaultValue: 'localhost:9092',
@@ -176,7 +177,7 @@ export const modeKafkaForm: FormSchema[] = [ @@ -176,7 +177,7 @@ export const modeKafkaForm: FormSchema[] = [
176 }, 177 },
177 { 178 {
178 field: 'retries', 179 field: 'retries',
179 - label: 'Retries', 180 + label: '重连次数',
180 colProps: { span: 12 }, 181 colProps: { span: 12 },
181 component: 'InputNumber', 182 component: 'InputNumber',
182 defaultValue: 0, 183 defaultValue: 0,
@@ -187,7 +188,7 @@ export const modeKafkaForm: FormSchema[] = [ @@ -187,7 +188,7 @@ export const modeKafkaForm: FormSchema[] = [
187 }, 188 },
188 { 189 {
189 field: 'batchSize', 190 field: 'batchSize',
190 - label: 'BatchSize', 191 + label: '生产者并发',
191 colProps: { span: 12 }, 192 colProps: { span: 12 },
192 component: 'InputNumber', 193 component: 'InputNumber',
193 defaultValue: 16384, 194 defaultValue: 16384,
@@ -198,7 +199,7 @@ export const modeKafkaForm: FormSchema[] = [ @@ -198,7 +199,7 @@ export const modeKafkaForm: FormSchema[] = [
198 }, 199 },
199 { 200 {
200 field: 'linger', 201 field: 'linger',
201 - label: 'Linger', 202 + label: '缓存时间',
202 colProps: { span: 12 }, 203 colProps: { span: 12 },
203 component: 'InputNumber', 204 component: 'InputNumber',
204 defaultValue: 0, 205 defaultValue: 0,
@@ -209,7 +210,7 @@ export const modeKafkaForm: FormSchema[] = [ @@ -209,7 +210,7 @@ export const modeKafkaForm: FormSchema[] = [
209 }, 210 },
210 { 211 {
211 field: 'bufferMemory', 212 field: 'bufferMemory',
212 - label: 'BufferMemory', 213 + label: '最大缓存',
213 colProps: { span: 12 }, 214 colProps: { span: 12 },
214 component: 'InputNumber', 215 component: 'InputNumber',
215 defaultValue: 33554432, 216 defaultValue: 33554432,
@@ -221,7 +222,7 @@ export const modeKafkaForm: FormSchema[] = [ @@ -221,7 +222,7 @@ export const modeKafkaForm: FormSchema[] = [
221 { 222 {
222 field: 'acks', 223 field: 'acks',
223 component: 'Select', 224 component: 'Select',
224 - label: 'Acks', 225 + label: '响应码',
225 colProps: { span: 12 }, 226 colProps: { span: 12 },
226 defaultValue: '-1', 227 defaultValue: '-1',
227 componentProps: { 228 componentProps: {
@@ -236,7 +237,7 @@ export const modeKafkaForm: FormSchema[] = [ @@ -236,7 +237,7 @@ export const modeKafkaForm: FormSchema[] = [
236 }, 237 },
237 { 238 {
238 field: 'keySerializer', 239 field: 'keySerializer',
239 - label: 'Key', 240 + label: '键序列化',
240 colProps: { span: 12 }, 241 colProps: { span: 12 },
241 required: true, 242 required: true,
242 component: 'Input', 243 component: 'Input',
@@ -248,7 +249,7 @@ export const modeKafkaForm: FormSchema[] = [ @@ -248,7 +249,7 @@ export const modeKafkaForm: FormSchema[] = [
248 }, 249 },
249 { 250 {
250 field: 'valueSerializer', 251 field: 'valueSerializer',
251 - label: 'Value', 252 + label: '值序列化',
252 colProps: { span: 12 }, 253 colProps: { span: 12 },
253 required: true, 254 required: true,
254 component: 'Input', 255 component: 'Input',
@@ -270,7 +271,7 @@ export const modeKafkaForm: FormSchema[] = [ @@ -270,7 +271,7 @@ export const modeKafkaForm: FormSchema[] = [
270 label: '选择', 271 label: '选择',
271 colProps: { span: 12 }, 272 colProps: { span: 12 },
272 component: 'Checkbox', 273 component: 'Checkbox',
273 - renderComponentContent: 'Add Message metadata key-value pairs to Kafka record headers', 274 + renderComponentContent: '将消息的元数据以键值对的方式添加到Kafka消息头中',
274 }, 275 },
275 { 276 {
276 field: 'kafkaHeadersCharset', 277 field: 'kafkaHeadersCharset',
@@ -114,6 +114,7 @@ @@ -114,6 +114,7 @@
114 const otherPropertiesValues = reactive({ 114 const otherPropertiesValues = reactive({
115 otherProperties: {}, 115 otherProperties: {},
116 }); 116 });
  117 + const clearName = ref('');
117 118
118 const [register, { validate, setFieldsValue, resetFields: defineClearFunc, clearValidate }] = 119 const [register, { validate, setFieldsValue, resetFields: defineClearFunc, clearValidate }] =
119 useForm({ 120 useForm({
@@ -144,6 +145,7 @@ @@ -144,6 +145,7 @@
144 }; 145 };
145 146
146 const setStepTwoFieldsValueFunc = async (v, v1) => { 147 const setStepTwoFieldsValueFunc = async (v, v1) => {
  148 + clearName.value = v1;
147 setFieldsValue(v); 149 setFieldsValue(v);
148 vType.value = v1; 150 vType.value = v1;
149 setFieldsValue({ 151 setFieldsValue({
@@ -222,7 +224,7 @@ @@ -222,7 +224,7 @@
222 .root { 224 .root {
223 width: 47.55vw; 225 width: 47.55vw;
224 border: 1px solid #d9d9d9; 226 border: 1px solid #d9d9d9;
225 - display: flex; 227 + // display: flex;
226 margin-top: 1vh; 228 margin-top: 1vh;
227 margin-left: 1.5vw; 229 margin-left: 1.5vw;
228 border-radius: 8px; 230 border-radius: 8px;
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 :rowSelection="{ type: 'checkbox' }" 7 :rowSelection="{ type: 'checkbox' }"
8 > 8 >
9 <template #toolbar> 9 <template #toolbar>
10 - <a-button type="primary" @click="handleAdd"> 添加转换 </a-button> 10 + <a-button type="primary" @click="handleAdd"> 添加流转 </a-button>
11 <a-button 11 <a-button
12 :disabled="disabledStatus1" 12 :disabled="disabledStatus1"
13 @click="handleDelete" 13 @click="handleDelete"
@@ -174,11 +174,11 @@ @@ -174,11 +174,11 @@
174 } 174 }
175 const res = await isEnableOrDisableApi(enableObj as never); 175 const res = await isEnableOrDisableApi(enableObj as never);
176 if (res !== '') { 176 if (res !== '') {
177 - createMessage.success('转换配置启用成功'); 177 + createMessage.success('流转配置启用成功');
178 setLoading(false); 178 setLoading(false);
179 reload(); 179 reload();
180 } else { 180 } else {
181 - createMessage.error('转换配置启用失败'); 181 + createMessage.error('流转配置启用失败');
182 } 182 }
183 } catch (e) { 183 } catch (e) {
184 return e; 184 return e;
@@ -197,11 +197,11 @@ @@ -197,11 +197,11 @@
197 } 197 }
198 const res = await isEnableOrDisableApi(enableObj as never); 198 const res = await isEnableOrDisableApi(enableObj as never);
199 if (res !== '') { 199 if (res !== '') {
200 - createMessage.success('转换配置禁用成功'); 200 + createMessage.success('流转配置禁用成功');
201 setLoading(false); 201 setLoading(false);
202 reload(); 202 reload();
203 } else { 203 } else {
204 - createMessage.error('转换配置禁用失败'); 204 + createMessage.error('流转配置禁用失败');
205 } 205 }
206 } catch (e) { 206 } catch (e) {
207 } finally { 207 } finally {
@@ -282,11 +282,11 @@ @@ -282,11 +282,11 @@
282 }); 282 });
283 const res = await isEnableOrDisableApi(enableObj as never); 283 const res = await isEnableOrDisableApi(enableObj as never);
284 if (res !== '') { 284 if (res !== '') {
285 - createMessage.success('转换配置多项禁用成功'); 285 + createMessage.success('流转配置多项禁用成功');
286 setLoading(false); 286 setLoading(false);
287 reload(); 287 reload();
288 } else { 288 } else {
289 - createMessage.error('转换配置多项禁用失败'); 289 + createMessage.error('流转配置多项禁用失败');
290 } 290 }
291 } catch (e) { 291 } catch (e) {
292 return e; 292 return e;
@@ -309,11 +309,11 @@ @@ -309,11 +309,11 @@
309 }); 309 });
310 const res = await isEnableOrDisableApi(enableObj as never); 310 const res = await isEnableOrDisableApi(enableObj as never);
311 if (res !== '') { 311 if (res !== '') {
312 - createMessage.success('转换配置多项启用成功'); 312 + createMessage.success('流转配置多项启用成功');
313 setLoading(false); 313 setLoading(false);
314 reload(); 314 reload();
315 } else { 315 } else {
316 - createMessage.error('转换配置多项启用失败'); 316 + createMessage.error('流转配置多项启用失败');
317 } 317 }
318 } catch (e) { 318 } catch (e) {
319 return e; 319 return e;
@@ -25,6 +25,7 @@ @@ -25,6 +25,7 @@
25 25
26 setup(props) { 26 setup(props) {
27 const fieldValue: any = ref({}); 27 const fieldValue: any = ref({});
  28 + const option = ref<[]>([]);
28 const [registerCondition, { setFieldsValue, getFieldsValue, updateSchema, resetFields }] = 29 const [registerCondition, { setFieldsValue, getFieldsValue, updateSchema, resetFields }] =
29 useForm({ 30 useForm({
30 labelWidth: 100, 31 labelWidth: 100,
@@ -39,19 +40,40 @@ @@ -39,19 +40,40 @@
39 resetFields(); 40 resetFields();
40 }; 41 };
41 const updateFieldDeviceId = (v) => { 42 const updateFieldDeviceId = (v) => {
42 - const option = v;  
43 - setTimeout(() => { 43 + if (v.length == 0 || v.length > 0) {
  44 + option.value = v;
44 updateSchema({ 45 updateSchema({
45 field: 'entityId', 46 field: 'entityId',
46 componentProps: { 47 componentProps: {
47 - options: option, 48 + options: option.value,
48 onChange(e) { 49 onChange(e) {
49 - updateFieldType2Func(e); 50 + if (e) {
  51 + setTimeout(() => {
  52 + updateFieldType2Func(e);
  53 + }, 10);
  54 + }
50 }, 55 },
51 }, 56 },
52 }); 57 });
53 - }, 10); 58 + } else if (v.length == undefined) {
  59 + setTimeout(() => {
  60 + updateSchema({
  61 + field: 'entityId',
  62 + componentProps: {
  63 + options: v.item,
  64 + onChange(e) {
  65 + if (e) {
  66 + setTimeout(() => {
  67 + updateFieldType2Func(e);
  68 + }, 10);
  69 + }
  70 + },
  71 + },
  72 + });
  73 + }, 10);
  74 + }
54 }; 75 };
  76 +
55 const updateFieldType2Func = async (e) => { 77 const updateFieldType2Func = async (e) => {
56 const data1 = await screenLinkPageByDeviceIdGetAttribut('DEVICE', e); 78 const data1 = await screenLinkPageByDeviceIdGetAttribut('DEVICE', e);
57 const data = data1.map((m) => { 79 const data = data1.map((m) => {
@@ -24,6 +24,7 @@ @@ -24,6 +24,7 @@
24 24
25 setup(props) { 25 setup(props) {
26 const fieldValue: any = ref({}); 26 const fieldValue: any = ref({});
  27 + const option = ref<[]>([]);
27 const [registerAction, { setFieldsValue, getFieldsValue, resetFields, updateSchema }] = 28 const [registerAction, { setFieldsValue, getFieldsValue, resetFields, updateSchema }] =
28 useForm({ 29 useForm({
29 labelWidth: 100, 30 labelWidth: 100,
@@ -38,14 +39,24 @@ @@ -38,14 +39,24 @@
38 resetFields(); 39 resetFields();
39 }; 40 };
40 const updateFieldDeviceId = (v) => { 41 const updateFieldDeviceId = (v) => {
41 - setTimeout(() => { 42 + if (v.length == 0 || v.length > 0) {
  43 + option.value = v;
42 updateSchema({ 44 updateSchema({
43 field: 'deviceId', 45 field: 'deviceId',
44 componentProps: { 46 componentProps: {
45 - options: v, 47 + options: option.value,
46 }, 48 },
47 }); 49 });
48 - }, 10); 50 + } else if (v.length == undefined) {
  51 + setTimeout(() => {
  52 + updateSchema({
  53 + field: 'deviceId',
  54 + componentProps: {
  55 + options: v.item,
  56 + },
  57 + });
  58 + }, 10);
  59 + }
49 }; 60 };
50 61
51 //回显数据 62 //回显数据
@@ -26,6 +26,8 @@ @@ -26,6 +26,8 @@
26 props: ['deviceInfo', 'editTriggerFather', 'newFilterMapFather'], 26 props: ['deviceInfo', 'editTriggerFather', 'newFilterMapFather'],
27 setup(props) { 27 setup(props) {
28 const fieldValue: any = ref({}); 28 const fieldValue: any = ref({});
  29 + const option = ref<[]>([]);
  30 + const data = ref<[]>([]);
29 const [registerTrigger, { resetFields, setFieldsValue, getFieldsValue, updateSchema }] = 31 const [registerTrigger, { resetFields, setFieldsValue, getFieldsValue, updateSchema }] =
30 useForm({ 32 useForm({
31 labelWidth: 100, 33 labelWidth: 100,
@@ -37,67 +39,81 @@ @@ -37,67 +39,81 @@
37 return fieldValue.value; 39 return fieldValue.value;
38 }; 40 };
39 const updateFieldDeviceId = (v) => { 41 const updateFieldDeviceId = (v) => {
40 - const option = v;  
41 - console.log(option);  
42 - setTimeout(() => { 42 + if (v.length == 0 || v.length > 0) {
  43 + option.value = v;
43 updateSchema({ 44 updateSchema({
44 field: 'entityId', 45 field: 'entityId',
45 - componentProps() {  
46 - return {  
47 - options: option,  
48 - onChange(e) {  
49 - updateFieldType2Func(e);  
50 - },  
51 - }; 46 + componentProps: {
  47 + options: option.value,
  48 + onChange(e) {
  49 + if (e) {
  50 + setTimeout(() => {
  51 + updateFieldType2Func(e);
  52 + }, 10);
  53 + }
  54 + },
52 }, 55 },
53 }); 56 });
54 - }, 10); 57 + } else if (v.length == undefined) {
  58 + setTimeout(() => {
  59 + updateSchema({
  60 + field: 'entityId',
  61 + componentProps: {
  62 + options: v.item,
  63 + onChange(e) {
  64 + if (e) {
  65 + setTimeout(() => {
  66 + updateFieldType2Func(e);
  67 + }, 10);
  68 + }
  69 + },
  70 + },
  71 + });
  72 + }, 10);
  73 + }
55 }; 74 };
56 75
57 const updateFieldType2Func = async (e) => { 76 const updateFieldType2Func = async (e) => {
58 const data1 = await screenLinkPageByDeviceIdGetAttribut('DEVICE', e); 77 const data1 = await screenLinkPageByDeviceIdGetAttribut('DEVICE', e);
59 - const data = data1.map((m) => { 78 + data.value = data1.map((m) => {
60 return { 79 return {
61 label: m, 80 label: m,
62 value: m, 81 value: m,
63 }; 82 };
64 }); 83 });
65 - setTimeout(() => {  
66 - updateSchema({  
67 - field: 'type2',  
68 - componentProps() {  
69 - return {  
70 - placeholder: '请选择属性',  
71 - options: data,  
72 - onChange(e) {  
73 - if (e) {  
74 - updateSchema([  
75 - {  
76 - field: 'operation',  
77 - ifShow: true,  
78 - },  
79 - {  
80 - field: 'value',  
81 - ifShow: true,  
82 - },  
83 - ]);  
84 - } else {  
85 - updateSchema([  
86 - {  
87 - field: 'operation',  
88 - ifShow: false,  
89 - },  
90 - {  
91 - field: 'value',  
92 - ifShow: false,  
93 - },  
94 - ]);  
95 - }  
96 - },  
97 - }; 84 +
  85 + updateSchema({
  86 + field: 'type2',
  87 + componentProps: {
  88 + placeholder: '请选择属性',
  89 + options: data.value,
  90 + onChange(e) {
  91 + if (e) {
  92 + updateSchema([
  93 + {
  94 + field: 'operation',
  95 + ifShow: true,
  96 + },
  97 + {
  98 + field: 'value',
  99 + ifShow: true,
  100 + },
  101 + ]);
  102 + } else {
  103 + updateSchema([
  104 + {
  105 + field: 'operation',
  106 + ifShow: false,
  107 + },
  108 + {
  109 + field: 'value',
  110 + ifShow: false,
  111 + },
  112 + ]);
  113 + }
98 }, 114 },
99 - });  
100 - }, 10); 115 + },
  116 + });
101 }; 117 };
102 const updateOperatorAndValue = () => { 118 const updateOperatorAndValue = () => {
103 updateSchema([ 119 updateSchema([
@@ -267,10 +267,8 @@ export const useTriggerDrawerSchema: FormSchema[] = [ @@ -267,10 +267,8 @@ export const useTriggerDrawerSchema: FormSchema[] = [
267 field: 'entityId', 267 field: 'entityId',
268 label: '', 268 label: '',
269 component: 'Select', 269 component: 'Select',
270 - componentProps() {  
271 - return {  
272 - placeholder: '请选择设备',  
273 - }; 270 + componentProps: {
  271 + placeholder: '请选择设备',
274 }, 272 },
275 ifShow: ({ values }) => 273 ifShow: ({ values }) =>
276 !isTime(Reflect.get(values, 'triggerType')) && 274 !isTime(Reflect.get(values, 'triggerType')) &&
@@ -311,13 +309,11 @@ export const useTriggerDrawerSchema: FormSchema[] = [ @@ -311,13 +309,11 @@ export const useTriggerDrawerSchema: FormSchema[] = [
311 field: 'type2', 309 field: 'type2',
312 label: '', 310 label: '',
313 component: 'Select', 311 component: 'Select',
314 - componentProps() {  
315 - return {  
316 - placeholder: '请选择属性',  
317 - onChange(v) {  
318 - console.log(v);  
319 - },  
320 - }; 312 + componentProps: {
  313 + placeholder: '请选择属性',
  314 + onChange(v) {
  315 + console.log(v);
  316 + },
321 }, 317 },
322 ifShow: ({ values }) => 318 ifShow: ({ values }) =>
323 !isTime(Reflect.get(values, 'triggerType')) && 319 !isTime(Reflect.get(values, 'triggerType')) &&
@@ -341,6 +337,10 @@ export const useTriggerDrawerSchema: FormSchema[] = [ @@ -341,6 +337,10 @@ export const useTriggerDrawerSchema: FormSchema[] = [
341 ], 337 ],
342 }, 338 },
343 ifShow: ({ values }) => isType2(Reflect.get(values, 'type2')), 339 ifShow: ({ values }) => isType2(Reflect.get(values, 'type2')),
  340 + show: ({ values }) =>
  341 + !isTime(Reflect.get(values, 'triggerType')) &&
  342 + !isScene(Reflect.get(values, 'triggerType')) &&
  343 + !isHand(Reflect.get(values, 'triggerType')),
344 colProps: { span: 12 }, 344 colProps: { span: 12 },
345 }, 345 },
346 { 346 {
@@ -353,26 +353,30 @@ export const useTriggerDrawerSchema: FormSchema[] = [ @@ -353,26 +353,30 @@ export const useTriggerDrawerSchema: FormSchema[] = [
353 placeholder: '请输入比较值', 353 placeholder: '请输入比较值',
354 }, 354 },
355 ifShow: ({ values }) => isType2(Reflect.get(values, 'type2')), 355 ifShow: ({ values }) => isType2(Reflect.get(values, 'type2')),
  356 + show: ({ values }) =>
  357 + !isTime(Reflect.get(values, 'triggerType')) &&
  358 + !isScene(Reflect.get(values, 'triggerType')) &&
  359 + !isHand(Reflect.get(values, 'triggerType')),
356 colProps: { 360 colProps: {
357 span: 12, 361 span: 12,
358 }, 362 },
359 }, 363 },
360 - {  
361 - field: 'sceneLinkageId',  
362 - label: '',  
363 - component: 'Select',  
364 - colProps: {  
365 - span: 12,  
366 - },  
367 - componentProps: {  
368 - placeholder: '请选择场景',  
369 - options: [  
370 - { label: '场景触发器1', value: '' },  
371 - { label: '场景触发器2', value: '' },  
372 - ],  
373 - },  
374 - ifShow: ({ values }) => isScene(Reflect.get(values, 'triggerType')),  
375 - }, 364 + // {
  365 + // field: 'sceneLinkageId',
  366 + // label: '',
  367 + // component: 'Select',
  368 + // colProps: {
  369 + // span: 12,
  370 + // },
  371 + // componentProps: {
  372 + // placeholder: '请选择场景',
  373 + // options: [
  374 + // { label: '场景触发器1', value: '' },
  375 + // { label: '场景触发器2', value: '' },
  376 + // ],
  377 + // },
  378 + // ifShow: ({ values }) => isScene(Reflect.get(values, 'triggerType')),
  379 + // },
376 ]; 380 ];
377 381
378 export const useConditionDrawerSchema: FormSchema[] = [ 382 export const useConditionDrawerSchema: FormSchema[] = [
@@ -509,8 +513,23 @@ export const useActionDrawerSchema: FormSchema[] = [ @@ -509,8 +513,23 @@ export const useActionDrawerSchema: FormSchema[] = [
509 label: '', 513 label: '',
510 componentProps: { 514 componentProps: {
511 maxLength: 255, 515 maxLength: 255,
512 - placeholder:  
513 - '请输入下发指定(JSON格式:{"method": "setDOValue","params": {"devID": "492S211218028819","data": {"DO1": 1}})', 516 + placeholder: '请输入下发指定',
  517 + },
  518 + ifShow: ({ values }) =>
  519 + !isScene(Reflect.get(values, 'outTarget')) && !isMsg(Reflect.get(values, 'outTarget')),
  520 + colProps: {
  521 + span: 12,
  522 + },
  523 + },
  524 + {
  525 + field: 'no',
  526 + component: 'InputTextArea',
  527 + label: '',
  528 + defaultValue:
  529 + '(可复制)下发指定格式(JSON格式:{"method": "setDOValue","params": {"devID": "492S211218028819","data": {"DO1": 1}})',
  530 + componentProps: {
  531 + maxLength: 255,
  532 + disabled: true,
514 }, 533 },
515 ifShow: ({ values }) => 534 ifShow: ({ values }) =>
516 !isScene(Reflect.get(values, 'outTarget')) && !isMsg(Reflect.get(values, 'outTarget')), 535 !isScene(Reflect.get(values, 'outTarget')) && !isMsg(Reflect.get(values, 'outTarget')),
@@ -252,6 +252,8 @@ @@ -252,6 +252,8 @@
252 let kongTriggerObj = {}; 252 let kongTriggerObj = {};
253 let kongConditionObj = {}; 253 let kongConditionObj = {};
254 let kongActionObj = {}; 254 let kongActionObj = {};
  255 + let optionsEditArray = ref<[]>([]);
  256 + const oldOrigzaition = ref('');
255 257
256 const [registerForm, { resetFields, setFieldsValue, validateFields }] = useForm({ 258 const [registerForm, { resetFields, setFieldsValue, validateFields }] = useForm({
257 labelWidth: 120, 259 labelWidth: 120,
@@ -290,27 +292,27 @@ @@ -290,27 +292,27 @@
290 addActionPushData.value.length = 0; 292 addActionPushData.value.length = 0;
291 handleClose(); 293 handleClose();
292 optionsItemArray.value.length = 0; 294 optionsItemArray.value.length = 0;
  295 + optionsItemArray.value = [];
  296 + optionsEditArray.value = [];
  297 + optionsEditArray.value.length = 0;
293 try { 298 try {
294 - setTimeout(() => {  
295 - proxy.$refs.refTriggerChild?.resetFieldsValueFunc();  
296 - proxy.$refs.refTriggerChild?.clearSelectDevice();  
297 - proxy.$refs.refTriggerChild?.clearSelectAttribute();  
298 - proxy.$refs.refConditionChild?.resetFieldsValueFunc();  
299 - proxy.$refs.refConditionChild?.clearSelectDevice();  
300 - proxy.$refs.refActionChild?.resetFieldsValueFunc();  
301 - proxy.$refs.refActionChild?.clearSelectDevice();  
302 - clearActionsAllDevice();  
303 - resetActionsAllArrayFunc();  
304 - }, 10);  
305 - } catch (e) {  
306 - return e;  
307 - } 299 + proxy.$refs.refTriggerChild?.resetFieldsValueFunc();
  300 + proxy.$refs.refTriggerChild?.clearSelectDevice();
  301 + proxy.$refs.refTriggerChild?.clearSelectAttribute();
  302 + proxy.$refs.refConditionChild?.resetFieldsValueFunc();
  303 + proxy.$refs.refConditionChild?.clearSelectDevice();
  304 + proxy.$refs.refActionChild?.resetFieldsValueFunc();
  305 + proxy.$refs.refActionChild?.clearSelectDevice();
  306 + clearActionsAllDevice();
  307 + resetActionsAllArrayFunc();
  308 + } catch {}
308 } catch (e) { 309 } catch (e) {
309 return e; 310 return e;
310 } 311 }
311 } else { 312 } else {
312 try { 313 try {
313 - emit('success'); 314 + optionsEditArray.value = [];
  315 + optionsEditArray.value.length = 0;
314 kongTriggerObj = {}; 316 kongTriggerObj = {};
315 kongConditionObj = {}; 317 kongConditionObj = {};
316 kongActionObj = {}; 318 kongActionObj = {};
@@ -373,16 +375,18 @@ @@ -373,16 +375,18 @@
373 } 375 }
374 }); 376 });
375 }); 377 });
376 -  
377 - optionsItemArray.value = options.items.map((v) => { 378 + optionsEditArray.value = options.items.map((v) => {
378 return { 379 return {
379 value: v.tbDeviceId, 380 value: v.tbDeviceId,
380 label: v.name, 381 label: v.name,
381 }; 382 };
382 }); 383 });
383 - proxy.$refs.refTriggerChild?.updateFieldDeviceId(optionsItemArray.value);  
384 - proxy.$refs.refConditionChild?.updateFieldDeviceId(optionsItemArray.value);  
385 - proxy.$refs.refActionChild?.updateFieldDeviceId(optionsItemArray.value); 384 + setTimeout(() => {
  385 + proxy.$refs.refTriggerChild?.updateFieldDeviceId(optionsEditArray.value);
  386 + proxy.$refs.refConditionChild?.updateFieldDeviceId(optionsEditArray.value);
  387 + proxy.$refs.refActionChild?.updateFieldDeviceId(optionsEditArray.value);
  388 + }, 20);
  389 + emit('success');
386 } catch (e) { 390 } catch (e) {
387 return e; 391 return e;
388 } 392 }
@@ -434,7 +438,9 @@ @@ -434,7 +438,9 @@
434 return e; 438 return e;
435 } 439 }
436 }; 440 };
  441 +
437 watch(getData, async (newV: string) => { 442 watch(getData, async (newV: string) => {
  443 + oldOrigzaition.value = newV;
438 const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); 444 const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV });
439 optionsItemArray.value = options.items.map((v) => { 445 optionsItemArray.value = options.items.map((v) => {
440 return { 446 return {
@@ -442,23 +448,13 @@ @@ -442,23 +448,13 @@
442 label: v.name, 448 label: v.name,
443 }; 449 };
444 }); 450 });
445 - // optionsItemArray.value = options.items;  
446 - updateDeviceIdFunc(optionsItemArray.value);  
447 - proxy.$refs.refActionChild?.updateFieldDeviceId(optionsItemArray.value);  
448 - proxy.$refs.refConditionChild?.updateFieldDeviceId(optionsItemArray.value);  
449 - proxy.$refs.refTriggerChild?.updateFieldDeviceId(optionsItemArray.value); 451 + setTimeout(() => {
  452 + proxy.$refs.refTriggerChild?.updateFieldDeviceId(optionsItemArray.value);
  453 + proxy.$refs.refConditionChild?.updateFieldDeviceId(optionsItemArray.value);
  454 + proxy.$refs.refActionChild?.updateFieldDeviceId(optionsItemArray.value);
  455 + }, 10);
450 }); 456 });
451 457
452 - const updateDeviceIdFunc = (v) => {  
453 - try {  
454 - proxy.$refs.refTriggerChild?.updateFieldDeviceId(v);  
455 - proxy.$refs.refConditionChild?.updateFieldDeviceId(v);  
456 - proxy.$refs.refActionChild?.updateFieldDeviceId(v);  
457 - } catch (e) {  
458 - return e;  
459 - }  
460 - };  
461 -  
462 //获取触发器方法 458 //获取触发器方法
463 const refTriggerChildDataFunc = () => { 459 const refTriggerChildDataFunc = () => {
464 try { 460 try {
@@ -503,11 +499,8 @@ @@ -503,11 +499,8 @@
503 key: m.type2 == null ? 'CO2' : m.type2, 499 key: m.type2 == null ? 'CO2' : m.type2,
504 type: m.type1 == null ? 'TIME_SERIES' : m.type1, 500 type: m.type1 == null ? 'TIME_SERIES' : m.type1,
505 }, 501 },
506 - // valueType: m.type2 == null ? 'NUMERIC' : m.type2,  
507 valueType: 'NUMERIC', 502 valueType: 'NUMERIC',
508 - // value: {},  
509 predicate: { 503 predicate: {
510 - // type: m.type2 == null ? 'NUMERIC' : m.type2,  
511 type: 'NUMERIC', 504 type: 'NUMERIC',
512 value: { 505 value: {
513 defaultValue: Number(m.value), 506 defaultValue: Number(m.value),
@@ -642,44 +635,9 @@ @@ -642,44 +635,9 @@
642 if (!unref(isUpdate)) { 635 if (!unref(isUpdate)) {
643 refTriggerChildDataFunc(); 636 refTriggerChildDataFunc();
644 unref(addTriggerPushData).push(refTriggerChildData as never); 637 unref(addTriggerPushData).push(refTriggerChildData as never);
645 - (addTriggerPushData.value as any) = addTriggerPushData.value.map((m: any) => {  
646 - return {  
647 - triggerType: m?.triggerType,  
648 - entityId: m?.entityId || m?.entityId1,  
649 - sceneLinkageId: m?.sceneLinkageId,  
650 - triggerCondition: {  
651 - condition: [  
652 - {  
653 - key: {  
654 - key: m.type2 == null ? 'CO2' : m.type2,  
655 - type: m.type1 == null ? 'TIME_SERIES' : m.type1,  
656 - },  
657 - // valueType: m.type2 == null ? 'NUMERIC' : m.type2,  
658 - valueType: 'NUMERIC',  
659 - // value: {},  
660 - predicate: {  
661 - // type: m.type2 == null ? 'NUMERIC' : m.type2,  
662 - type: 'NUMERIC',  
663 - value: {  
664 - defaultValue: Number(m.value),  
665 - },  
666 - operation: m.operation == null ? 'EQUAL' : m.operation,  
667 - },  
668 - },  
669 - ],  
670 - spec: {  
671 - type: 'SIMPLE',  
672 - },  
673 - },  
674 - };  
675 - });  
676 - try {  
677 - setTimeout(() => {  
678 - proxy.$refs.refTriggerChild?.updateFieldDeviceId(optionsItemArray.value);  
679 - }, 10);  
680 - } catch (e) {  
681 - return e;  
682 - } 638 + setTimeout(() => {
  639 + proxy.$refs.refTriggerChild?.updateFieldDeviceId(optionsItemArray.value);
  640 + }, 20);
683 } else { 641 } else {
684 isNoChange.value = false; 642 isNoChange.value = false;
685 unref(editTriggerPushData).push(refTriggerChildData as never); 643 unref(editTriggerPushData).push(refTriggerChildData as never);
@@ -693,15 +651,14 @@ @@ -693,15 +651,14 @@
693 condition: [ 651 condition: [
694 { 652 {
695 key: { 653 key: {
696 - key: m.key1 == null ? 'CO2' : m.key1, 654 + key: m.type2 == null ? 'CO2' : m.type2,
697 type: m.type1 == null ? 'TIME_SERIES' : m.type1, 655 type: m.type1 == null ? 'TIME_SERIES' : m.type1,
698 }, 656 },
699 - valueType: m.type2 == null ? 'NUMERIC' : m.type2,  
700 - value: {}, 657 + valueType: 'NUMERIC',
701 predicate: { 658 predicate: {
702 - type: m.type2 == null ? 'NUMERIC' : m.type2, 659 + type: 'NUMERIC',
703 value: { 660 value: {
704 - defaultValue: Number(m.value) == null ? 0 : Number(m.value), 661 + defaultValue: Number(m.value),
705 }, 662 },
706 operation: m.operation == null ? 'EQUAL' : m.operation, 663 operation: m.operation == null ? 'EQUAL' : m.operation,
707 }, 664 },
@@ -715,8 +672,11 @@ @@ -715,8 +672,11 @@
715 }); 672 });
716 try { 673 try {
717 setTimeout(() => { 674 setTimeout(() => {
718 - proxy.$refs.refTriggerChild.updateFieldDeviceId(optionsItemArray.value);  
719 - }, 50); 675 + proxy.$refs.refTriggerChild?.updateFieldDeviceId({
  676 + status: 'edit',
  677 + item: optionsEditArray.value,
  678 + });
  679 + }, 20);
720 } catch (e) { 680 } catch (e) {
721 return e; 681 return e;
722 } 682 }
@@ -744,38 +704,10 @@ @@ -744,38 +704,10 @@
744 if (!unref(isUpdate)) { 704 if (!unref(isUpdate)) {
745 refConditionChildDataFunc(); 705 refConditionChildDataFunc();
746 unref(addConditionPushData).push(refConditionChildData as never); 706 unref(addConditionPushData).push(refConditionChildData as never);
747 - (addConditionPushData.value as any) = addConditionPushData.value.map((m: any) => {  
748 - return {  
749 - triggerType: m?.triggerType,  
750 - entityId: m?.entityId,  
751 - triggerCondition: {  
752 - condition: [  
753 - {  
754 - key: {  
755 - key: m.type == null ? 'CO2' : m.type,  
756 - type: 'TIME_SERIES',  
757 - },  
758 - valueType: 'NUMERIC',  
759 - // value: {},  
760 - predicate: {  
761 - type: 'NUMERIC',  
762 - value: {  
763 - defaultValue: Number(m.value) == null ? 0 : Number(m.value),  
764 - },  
765 - operation: m.operation,  
766 - },  
767 - },  
768 - ],  
769 - spec: {  
770 - type: 'SIMPLE',  
771 - },  
772 - },  
773 - };  
774 - });  
775 try { 707 try {
776 setTimeout(() => { 708 setTimeout(() => {
777 - proxy.$refs.refConditionChild.updateFieldDeviceId(optionsItemArray.value);  
778 - }, 50); 709 + proxy.$refs.refConditionChild?.updateFieldDeviceId(optionsItemArray.value);
  710 + }, 20);
779 } catch (e) { 711 } catch (e) {
780 return e; 712 return e;
781 } 713 }
@@ -792,32 +724,17 @@ @@ -792,32 +724,17 @@
792 condition: [ 724 condition: [
793 { 725 {
794 key: { 726 key: {
  727 + key: m.type == null ? 'CO2' : m.type,
795 type: 'TIME_SERIES', 728 type: 'TIME_SERIES',
796 - key: 'CO2',  
797 }, 729 },
798 - valueType:  
799 - m.type == 'NUMERIC1'  
800 - ? 'NUMERIC'  
801 - : m.type == 'NUMERIC2'  
802 - ? 'NUMERIC'  
803 - : 'NUMERIC',  
804 - value: {}, 730 + valueType: 'NUMERIC',
  731 + // value: {},
805 predicate: { 732 predicate: {
806 - type:  
807 - m.type == 'NUMERIC1'  
808 - ? 'NUMERIC'  
809 - : m.type == 'NUMERIC2'  
810 - ? 'NUMERIC'  
811 - : 'NUMERIC', 733 + type: 'NUMERIC',
812 value: { 734 value: {
813 - defaultValue:  
814 - Number(m.value1) == null  
815 - ? 0  
816 - : Number(m.value1) || Number(m.value2) == null  
817 - ? 0  
818 - : Number(m.value2), 735 + defaultValue: Number(m.value) == null ? 0 : Number(m.value),
819 }, 736 },
820 - operation: m.operation1 || m.operatio2, 737 + operation: m.operation,
821 }, 738 },
822 }, 739 },
823 ], 740 ],
@@ -829,8 +746,11 @@ @@ -829,8 +746,11 @@
829 }); 746 });
830 try { 747 try {
831 setTimeout(() => { 748 setTimeout(() => {
832 - proxy.$refs.refConditionChild.updateFieldDeviceId(optionsItemArray.value);  
833 - }, 50); 749 + proxy.$refs.refConditionChild?.updateFieldDeviceId({
  750 + status: 'edit',
  751 + item: optionsEditArray.value,
  752 + });
  753 + }, 20);
834 } catch (e) { 754 } catch (e) {
835 return e; 755 return e;
836 } 756 }
@@ -867,7 +787,7 @@ @@ -867,7 +787,7 @@
867 try { 787 try {
868 setTimeout(() => { 788 setTimeout(() => {
869 proxy.$refs.refActionChild.updateFieldDeviceId(optionsItemArray.value); 789 proxy.$refs.refActionChild.updateFieldDeviceId(optionsItemArray.value);
870 - }, 50); 790 + }, 20);
871 } catch (e) { 791 } catch (e) {
872 return e; 792 return e;
873 } 793 }
@@ -878,8 +798,11 @@ @@ -878,8 +798,11 @@
878 pushEditActionArray.value.push(refActionChildData); 798 pushEditActionArray.value.push(refActionChildData);
879 try { 799 try {
880 setTimeout(() => { 800 setTimeout(() => {
881 - proxy.$refs.refActionChild.updateFieldDeviceId(optionsItemArray.value);  
882 - }, 50); 801 + proxy.$refs.refActionChild.updateFieldDeviceId({
  802 + status: 'edit',
  803 + item: optionsEditArray.value,
  804 + });
  805 + }, 20);
883 } catch (e) { 806 } catch (e) {
884 return e; 807 return e;
885 } 808 }
@@ -903,7 +826,6 @@ @@ -903,7 +826,6 @@
903 }; 826 };
904 827
905 return { 828 return {
906 - updateDeviceIdFunc,  
907 handleClose, 829 handleClose,
908 newFilterMap, 830 newFilterMap,
909 newConditionFilterMap, 831 newConditionFilterMap,