diff --git a/package.json b/package.json index b81a0122..5a59c332 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,8 @@ "jsbarcode": "^3.11.6", "jsencrypt": "3.0.0-rc.1", "moment": "^2.29.4", + "monaco-editor": "0.24.0", + "monaco-editor-webpack-plugin": "3.1.0", "nprogress": "0.2.0", "qrcodejs2": "^0.0.2", "quill": "1.3.7", diff --git a/src/store/getters.js b/src/store/getters.js index 5ec56868..2bacb96d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -18,6 +18,7 @@ const getters = { attributeList: state => state.attribute.attributeList, groupList: state => state.attribute.groupList, functionList: state => state.attribute.functionList, + eventList: state => state.attribute.eventList, attributeInfo: state => state.permission.attribute } export default getters diff --git a/src/store/modules/attribute.js b/src/store/modules/attribute.js index 458f7b90..dbef5110 100644 --- a/src/store/modules/attribute.js +++ b/src/store/modules/attribute.js @@ -6,6 +6,7 @@ const attribute = { attributeList: [], groupList: [], functionList: [], + eventList: [], }, mutations: { @@ -66,6 +67,25 @@ const attribute = { GET_FUNCTION_LIST: (state) => { return state.functionList }, + //功能 + SET_EVENT_LIST: (state, list) => { + state.eventList = list + }, + PUSH_EVENT: (state, item) => { + state.eventList.push(item) + }, + UPDATE_EVENT: (state, {item, idx}) => { + state.eventList[idx] = item + }, + DELETE_EVENT: (state, idx) => { + state.eventList.splice(idx,1); + }, + GET_EVENT_ITEM: (state, idx) => { + return state.eventList[idx] + }, + GET_EVENT_LIST: (state) => { + return state.eventList + }, }, actions: { @@ -85,6 +105,11 @@ const attribute = { resolve(state.functionList) }) }, + GetEventList({state}) { + return new Promise((resolve, reject) => { + resolve(state.eventList) + }) + }, setAttribute({ commit, state }, data){ commit('SET_ATTRIBUTE_LIST', data) }, @@ -93,6 +118,7 @@ const attribute = { commit('SET_ATTRIBUTE_LIST', data.attrList) commit('SET_GROUP_LIST', data.groupList) commit('SET_FUNCTION_LIST', data.functionList) + commit('SET_EVENT_LIST', data.eventList) console.log('res:', state, data) }, // 新增 属性 @@ -107,6 +133,10 @@ const attribute = { AddFunction({ commit, state }, data) { commit('PUSH_FUNCTION', data) }, + // 新增 功能 + AddEvent({ commit, state }, data) { + commit('PUSH_EVENT', data) + }, // 获取 属性 单个信息 GetAttributeItem({ commit, state }, idx) { return new Promise((resolve, reject) => { @@ -119,6 +149,18 @@ const attribute = { resolve(state.groupList[idx]) }) }, + // 获取 功能 单个信息 + GetFunctionItem({ commit, state }, idx) { + return new Promise((resolve, reject) => { + resolve(state.functionList[idx]) + }) + }, + // 获取 功能 单个信息 + GetEventItem({ commit, state }, idx) { + return new Promise((resolve, reject) => { + resolve(state.eventList[idx]) + }) + }, // 修改 属性 EditAttribute({ commit, state }, param) { commit('UPDATE_ATTRIBUTE', param) @@ -131,6 +173,10 @@ const attribute = { EditFunction({ commit, state }, param) { commit('UPDATE_FUNCTION', param) }, + // 修改 事件 + EditEvent({ commit, state }, param) { + commit('UPDATE_EVENT', param) + }, // 删除分组 删除分组 判断分组是否有属性,有属性就不能删除 DeleteGroup({ commit, state }, idx) { let groupItem = state.groupList[idx]; @@ -153,7 +199,10 @@ const attribute = { DeleteFunction({ commit, state }, idx) { commit('DELETE_FUNCTION', idx) }, - + // 删除事件 + DeleteEvent({ commit, state }, idx) { + commit('DELETE_EVENT', idx) + }, } } diff --git a/src/views/components/my-monaco-editor.vue b/src/views/components/my-monaco-editor.vue new file mode 100644 index 00000000..03ce62cd --- /dev/null +++ b/src/views/components/my-monaco-editor.vue @@ -0,0 +1,106 @@ + + + + + + + diff --git a/src/views/iot/device/profile/functionWrap.vue b/src/views/iot/device/profile/functionWrap.vue index fff9ccda..1991540d 100644 --- a/src/views/iot/device/profile/functionWrap.vue +++ b/src/views/iot/device/profile/functionWrap.vue @@ -14,9 +14,259 @@ +
+
+ +
+ + + +
+ + +
+
+ + 精简模式 + 高级模式 + +
+ + +
+
+ + + + + + + + +
+ 执行 + 重置 +
+
+
+
+
+ +
+
+ 执行 + 重置 +
+
+
+
+ + +
+
执行结果:
+
+
+ + + + + + + +
{{ item.data }}
+
{{ item.time }}
+
+ + + +
+
+
+
-
暂无数据
+
暂无功能
@@ -42,18 +292,25 @@ >添加卡号 - - - + + - - + + @@ -64,6 +321,15 @@ > + + + + + + 取 消 + 确 定 + + -