diff --git a/package.json b/package.json index 841a5f7de090d53fb8de0bf6fb958add3883a3ad..3f19cc56cbef530e54992837d7a1f1907012bd1c 100755 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "babel-eslint": "^10.1.0", "eslint": "^6.7.2", "eslint-plugin-vue": "^6.2.2", - "vue-template-compiler": "^2.6.11" + "vue-template-compiler": "2.6.14" }, "eslintConfig": { "root": true, diff --git a/src/api/protocolApi.js b/src/api/protocolApi.js index 2ae09621546a7487d76712c9e02e468f046d4ae6..7e381f2c36794258120b735980fdc9811f654e35 100755 --- a/src/api/protocolApi.js +++ b/src/api/protocolApi.js @@ -21,7 +21,7 @@ export const ComponentDelete = (id) => { }; // 保存组件脚本 export const ComponentScriptSave = (params) => { - return json("post", "/protocol/saveComponentScript/"+params.id, params.script) + return json("post", "/protocol/saveComponentScript/"+params.id, params) }; //获取组件脚本 export const ComponentScriptGet = (id) =>{ @@ -51,7 +51,7 @@ export const ConverterDelete = (id) => { }; // 保存转换脚本 export const ConverterScriptSave = (params) => { - return json("post", "/protocol/saveConverterScript/"+params.id, params.script) + return json("post", "/protocol/saveConverterScript/"+params.id, params) }; //获取组件脚本 export const ConverterScriptGet = (id) =>{ diff --git a/src/views/protocol/Components.vue b/src/views/protocol/Components.vue index afc56b030f93e4cff91d577a8113bc2a3814368a..dae135c8cc670c8b018354fb8d755078161facbb 100755 --- a/src/views/protocol/Components.vue +++ b/src/views/protocol/Components.vue @@ -447,16 +447,27 @@ 通讯脚本:退出全屏 +
+ 脚本语言: + + +
new (function () {
})()
+ 通讯脚本:全屏 +
+ 脚本语言: + + +
new (function () {
@@ -673,12 +684,15 @@ export default { ComponentScriptGet(row.id).then((res) => { this.editScriptVisible = true; this.editScript.id = row.id; - if (!res) { - res = `this.onReceive = function (head,type,payload) { + if(!res.scriptTyp){ + res.scriptTyp = "js"; + } + if (!res.script) { + res.script = `this.onReceive = function (head,type,payload) { return null; };`; } - this.editScript = { id: row.id, script: res }; + this.editScript = { id: row.id, script: res.script , scriptTyp: res.scriptTyp}; this.testDataScript.script = localStorage.getItem("testDataScript_" + row.id) || "{}"; load.close(); diff --git a/src/views/protocol/Convertors.vue b/src/views/protocol/Convertors.vue index 36ccbc7c0c211de58c7055e1cdb88c059396bebd..a902ee5a48b2a13ccea32aac07b0afe0ed5ddd6e 100755 --- a/src/views/protocol/Convertors.vue +++ b/src/views/protocol/Convertors.vue @@ -114,12 +114,26 @@ width="80%" @click="closeDialog" > + + + 脚本语言: + + + 转换脚本: -
new (function () {
- -
})()
+
+
new (function () {
+ +
})()
+
+
+ + + +
+
  @@ -262,15 +276,18 @@ export default { ConverterScriptGet(row.id).then((res) => { this.editScriptVisible = true; this.editScript.id = row.id; - if (!res) { - res = `this.decode = function (msg) { + if(!res.typ){ + res.typ = "js"; + } + if (!res.script) { + res.script = `this.decode = function (msg) { return null; }; this.encode = function (service,device) { return null; }`; } - this.editScript = { id: row.id, script: res }; + this.editScript = res; this.testDataScript.script = localStorage.getItem("testDataScript2_" + row.id) || "{}"; load.close();