Commit 88c3feb87829e8678b6c787bf02bf44b37ebb1b8

Authored by loveumiko
1 parent 6fdcb5ca

fix: 修复规则链导出问题

... ... @@ -5,7 +5,7 @@
5 5 <Authority>
6 6 <a-button type="primary" @click="handleAdd"> 新增规则链 </a-button>
7 7 </Authority>
8   - <Upload :show-upload-list="false" :customRequest="handleImport">
  8 + <Upload :show-upload-list="false" accept=".json," :customRequest="handleImport">
9 9 <Button type="primary" :loading="importLoading"> 导入规则链 </Button>
10 10 </Upload>
11 11 <Authority>
... ... @@ -113,7 +113,7 @@
113 113
114 114 const isEmptyObject = (value: any) => isObject(value) && !Object.keys(value).length;
115 115 const importLoading = ref<boolean>(false);
116   - const hasBatchDelete = ref<boolean>(false);
  116 + const hasBatchDelete = ref<boolean>(true);
117 117
118 118 const beforeFetch = (params) => {
119 119 Reflect.set(params, 'page', params.page - 1);
... ... @@ -239,10 +239,19 @@
239 239 const { firstNodeIndex, nodes, connections, ruleChainConnections } = await exportRuleChine(
240 240 record.id.id
241 241 );
  242 +
  243 + const node = nodes.map((item) => {
  244 + return {
  245 + ...item,
  246 + id: undefined,
  247 + ruleChainId: undefined,
  248 + };
  249 + });
242 250 const value = {
243 251 ruleChain: { additionalInfo, name, type, firstRuleNodeId, root, debugMode, configuration },
244   - metadata: { firstNodeIndex, nodes, connections, ruleChainConnections },
  252 + metadata: { firstNodeIndex, nodes: node, connections, ruleChainConnections },
245 253 };
  254 + // return;
246 255 exportJSONFile(value, name);
247 256 };
248 257
... ...
... ... @@ -143,7 +143,7 @@
143 143 }
144 144 if (predicateIsRequired) return createMessage.error('请填写条件筛选');
145 145 //TODO-fengtao-设备、属性、条件筛选验证
146   - return { ...getFieldsValue(), predicate, schedule: alarmScheduleRef.value.scheduleData };
  146 + return { ...getFieldsValue(), predicate, schedule: alarmScheduleRef.value?.scheduleData };
147 147 };
148 148
149 149 //TODO-fengtao
... ...