Commit 5102e84556e835db490f6146fd67c14f903082dd

Authored by zhangzzzz
1 parent 63560780

修改指令集可视化功能;

src/components/Common/CommonInstructSet.js
... ... @@ -1229,7 +1229,10 @@ const handleOpenSql = async (props, instruct) => {
1229 1229 } = props;
1230 1230 const { userinfo } = app;
1231 1231  
1232   - const { data = [] } = instruct;
  1232 + let { data = [] } = instruct;
  1233 + if (!data.length) {
  1234 + data = [instruct];
  1235 + }
1233 1236  
1234 1237 let result = {};
1235 1238  
... ... @@ -1365,7 +1368,10 @@ const handleGetSqlValue = async (props, data, srcDatasetRow = {}) => {
1365 1368 /************************* 执行sql exesql ************************/
1366 1369 // 执行sql -> 暂存sql,全部执行完后一起执行
1367 1370 const handleExeSql = (props, instruct) => {
1368   - const { data = [] } = instruct;
  1371 + let { data = [] } = instruct;
  1372 + if (!data.length) {
  1373 + data = [instruct];
  1374 + }
1369 1375 const result = [];
1370 1376 data.forEach(item => {
1371 1377 const { sql, srcDataset } = item;
... ...
src/components/Common/InstructSetSetting/index.js
... ... @@ -14,7 +14,7 @@ const InstructSetSetting = (props = {}) => {
14 14 const { instructSetSettingVisible } = props;
15 15 if (!instructSetSettingVisible) return "";
16 16  
17   - const { onCancelInstructSetSettingModal, showConfig, dataValue, instructSetSettingId, slave0Data, app } = props;
  17 + const { name, sFieldName, onCancelInstructSetSettingModal, showConfig, dataValue, instructSetSettingId, slave0Data, app } = props;
18 18 const { showName, sName } = showConfig;
19 19 const { currentPane } = app;
20 20 const { key, parentPaneKey } = currentPane;
... ... @@ -97,12 +97,14 @@ const InstructSetSetting = (props = {}) => {
97 97 const { command, data } = event.data;
98 98  
99 99 if (command === "initData") {
100   - if (!bConfigured && props.name !== "master") return;
  100 + // if (!bConfigured && props.name !== "master") return;
101 101  
102 102 iframeRef.current.contentWindow.postMessage(
103 103 {
  104 + tableName: name,
  105 + sFieldName,
104 106 command: "initData",
105   - value: instructSet.change || instructSet.blur || (instructSet ? [instructSet] : []),
  107 + value: instructSet.change || instructSet.blur || (commonUtils.isNotEmptyObject(instructSet) ? [instructSet] : []),
106 108 slave0Data,
107 109 configList: configList.current,
108 110 srcModelsList: srcModelsList.current,
... ... @@ -177,7 +179,7 @@ const InstructSetSetting = (props = {}) => {
177 179 >
178 180 格式化
179 181 </Button>
180   - <Button type="primary" onClick={() => props.onSaveData(JSON.stringify(JSON.parse(value.replace(/[\r\n]/g, ""))))}>
  182 + <Button type="primary" onClick={() => props.onSaveData(value ? JSON.stringify(JSON.parse(value.replace(/[\r\n]/g, ""))) : "")}>
181 183 保存
182 184 </Button>
183 185 <Button type="primary" onClick={() => setMode("config")}>
... ...