Commit 5102e84556e835db490f6146fd67c14f903082dd

Authored by zhangzzzz
1 parent 63560780

修改指令集可视化功能;

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