Commit 6d452738a7e2d1a3c24c9e14d308b27b78a2ee84
Merge branch 'ww' into 'main'
feat: add picture component See merge request huang/thingskit-drawio!44
Showing
9 changed files
with
67 additions
and
25 deletions
@@ -22,26 +22,26 @@ | @@ -22,26 +22,26 @@ | ||
22 | <meta name="mobile-web-app-capable" content="yes"> | 22 | <meta name="mobile-web-app-capable" content="yes"> |
23 | <meta name="theme-color" content="#d89000"> | 23 | <meta name="theme-color" content="#d89000"> |
24 | 24 | ||
25 | - <link rel="stylesheet" href="./js/plugin/layui/css/layui.css?v=1660097025459"> | 25 | + <link rel="stylesheet" href="./js/plugin/layui/css/layui.css?v=1663582316568"> |
26 | 26 | ||
27 | <!-- load configure file --> | 27 | <!-- load configure file --> |
28 | - <script src="./js/config/config.js?v=1660097025459"></script> | 28 | + <script src="./js/config/config.js?v=1663582316568"></script> |
29 | 29 | ||
30 | <!-- crypto-js --> | 30 | <!-- crypto-js --> |
31 | - <script src="./js/plugin/crypto-js/crypto-js.js?v=1660097025459"></script> | 31 | + <script src="./js/plugin/crypto-js/crypto-js.js?v=1663582316568"></script> |
32 | 32 | ||
33 | <!-- storage persistent --> | 33 | <!-- storage persistent --> |
34 | - <script src="./js/const/persistentStorage.js?v=1660097025459"></script> | 34 | + <script src="./js/const/persistentStorage.js?v=1663582316568"></script> |
35 | <!-- Global const --> | 35 | <!-- Global const --> |
36 | - <script src="./js/const/const.js?v=1660097025459"></script> | 36 | + <script src="./js/const/const.js?v=1663582316568"></script> |
37 | 37 | ||
38 | <!-- Axios --> | 38 | <!-- Axios --> |
39 | - <script src="./js/plugin/axios/axios.min.js?v=1660097025459"></script> | ||
40 | - <script src="./js/plugin/axios/DefHttp.js?v=1660097025459"></script> | ||
41 | - <script src="./js/api/index.js?v=1660097025459"></script> | 39 | + <script src="./js/plugin/axios/axios.min.js?v=1663582316568"></script> |
40 | + <script src="./js/plugin/axios/DefHttp.js?v=1663582316568"></script> | ||
41 | + <script src="./js/api/index.js?v=1663582316568"></script> | ||
42 | 42 | ||
43 | <!-- load script --> | 43 | <!-- load script --> |
44 | - <script src="./js/config/loadScript.js?v=1660097025459"></script> | 44 | + <script src="./js/config/loadScript.js?v=1663582316568"></script> |
45 | 45 | ||
46 | <!-- act editor --> | 46 | <!-- act editor --> |
47 | <!-- <script src="https://oss.yuntengcloud.com/iotdocs/thingskit-scada/ace.js"></script> --> | 47 | <!-- <script src="https://oss.yuntengcloud.com/iotdocs/thingskit-scada/ace.js"></script> --> |
@@ -54,7 +54,7 @@ | @@ -54,7 +54,7 @@ | ||
54 | <!-- <script src="https://vjs.zencdn.net/7.10.2/video.min.js"></script> --> | 54 | <!-- <script src="https://vjs.zencdn.net/7.10.2/video.min.js"></script> --> |
55 | <!-- <script src="https://oss.yuntengcloud.com/iotdocs/thingskit-scada/video.min.js"></script> --> | 55 | <!-- <script src="https://oss.yuntengcloud.com/iotdocs/thingskit-scada/video.min.js"></script> --> |
56 | 56 | ||
57 | - <script src="./js/plugin/layui/layui.js?v=1660097025459"></script> | 57 | + <script src="./js/plugin/layui/layui.js?v=1663582316568"></script> |
58 | <!-- <link rel="stylesheet" href="https://cdnjs.loli.net/ajax/libs/layui/2.6.8/css/layui.min.css" | 58 | <!-- <link rel="stylesheet" href="https://cdnjs.loli.net/ajax/libs/layui/2.6.8/css/layui.min.css" |
59 | integrity="sha512-iQBJbsNHXUcgEIgWThd2dr8tOdKPvICwqjPEZYY81z3eMya44A5MiAqfWSCh+Ee1YzNYkdrI982Qhwgr8LEYOQ==" | 59 | integrity="sha512-iQBJbsNHXUcgEIgWThd2dr8tOdKPvICwqjPEZYY81z3eMya44A5MiAqfWSCh+Ee1YzNYkdrI982Qhwgr8LEYOQ==" |
60 | crossorigin="anonymous" referrerpolicy="no-referrer" /> | 60 | crossorigin="anonymous" referrerpolicy="no-referrer" /> |
@@ -63,7 +63,7 @@ | @@ -63,7 +63,7 @@ | ||
63 | crossorigin="anonymous" referrerpolicy="no-referrer"></script> --> | 63 | crossorigin="anonymous" referrerpolicy="no-referrer"></script> --> |
64 | 64 | ||
65 | <!-- 引入修改样式 --> | 65 | <!-- 引入修改样式 --> |
66 | - <link rel="stylesheet" href="./styles/formatChange.css?v=1660097025459"> | 66 | + <link rel="stylesheet" href="./styles/formatChange.css?v=1663582316568"> |
67 | 67 | ||
68 | <script type="text/javascript"> | 68 | <script type="text/javascript"> |
69 | /** | 69 | /** |
@@ -306,7 +306,7 @@ | @@ -306,7 +306,7 @@ | ||
306 | var supportedDomain = (hostName.substring(hostName.length - 8, hostName.length) === '.draw.io') || | 306 | var supportedDomain = (hostName.substring(hostName.length - 8, hostName.length) === '.draw.io') || |
307 | (hostName.substring(hostName.length - 13, hostName.length) === '.diagrams.net'); | 307 | (hostName.substring(hostName.length - 13, hostName.length) === '.diagrams.net'); |
308 | 308 | ||
309 | - const releaseVersion = '1660097025459' | 309 | + const releaseVersion = '1663582316568' |
310 | const appMinSrc = Enable_OSS ? `${OSS_Prefix}app.min.js?v=${releaseVersion}` : `js/app.min.js?v=${releaseVersion}` | 310 | const appMinSrc = Enable_OSS ? `${OSS_Prefix}app.min.js?v=${releaseVersion}` : `js/app.min.js?v=${releaseVersion}` |
311 | function loadAppJS() { | 311 | function loadAppJS() { |
312 | mxscript(appMinSrc, function () { | 312 | mxscript(appMinSrc, function () { |
1 | /** | 1 | /** |
2 | * @description load script from oss server prefix | 2 | * @description load script from oss server prefix |
3 | */ | 3 | */ |
4 | -const OSS_Prefix = 'https://oss.yuntengcloud.com/iotdocs/thingskit-scada/' | 4 | +const OSS_Prefix = 'https://oss.yuntengcloud.com/iotdocs/thingskit-scada-development/' |
5 | 5 | ||
6 | /** | 6 | /** |
7 | * @description enable load script form oss server | 7 | * @description enable load script form oss server |
@@ -12,3 +12,5 @@ const Enable_OSS = true | @@ -12,3 +12,5 @@ const Enable_OSS = true | ||
12 | * @description 代理配置项 | 12 | * @description 代理配置项 |
13 | */ | 13 | */ |
14 | const Proxy_Prefix = window.location.pathname.startsWith('/') ? window.location.pathname.replace(/\/$/, '') : window.location.pathname | 14 | const Proxy_Prefix = window.location.pathname.startsWith('/') ? window.location.pathname.replace(/\/$/, '') : window.location.pathname |
15 | + | ||
16 | + |
@@ -21,7 +21,7 @@ const GLOBAL_TOKEN = (() => { | @@ -21,7 +21,7 @@ const GLOBAL_TOKEN = (() => { | ||
21 | /** | 21 | /** |
22 | * @description 写权限 key | 22 | * @description 写权限 key |
23 | */ | 23 | */ |
24 | -const CAN_WRITE = 'api:yt:admin:designConfiguration' | 24 | +const CAN_WRITE = 'api:yt:configuration:center:get_configuration_info:get' |
25 | 25 | ||
26 | const USER_PERMISSION = { | 26 | const USER_PERMISSION = { |
27 | permission: [] | 27 | permission: [] |
@@ -4221,8 +4221,8 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { | @@ -4221,8 +4221,8 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { | ||
4221 | function getUserPermission() { | 4221 | function getUserPermission() { |
4222 | defHttp.get('/yt/role/me/permissions') | 4222 | defHttp.get('/yt/role/me/permissions') |
4223 | .then(res => { | 4223 | .then(res => { |
4224 | - USER_PERMISSION.permission = res | ||
4225 | - console.log({ USER_PERMISSION }) | 4224 | + console.log('enter') |
4225 | + USER_PERMISSION.permission = res | ||
4226 | updateButtonContainer() | 4226 | updateButtonContainer() |
4227 | // var flag = hasSavePermission() | 4227 | // var flag = hasSavePermission() |
4228 | // if (!flag) { | 4228 | // if (!flag) { |
@@ -4234,9 +4234,10 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { | @@ -4234,9 +4234,10 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { | ||
4234 | 4234 | ||
4235 | // 调用API,获取保存的内容 | 4235 | // 调用API,获取保存的内容 |
4236 | function getSaveContent() { | 4236 | function getSaveContent() { |
4237 | - defHttp.get('/yt/configuration/center/getConfigurationInfo/' + Editor.configurationId) | ||
4238 | - .then(function (response) { | ||
4239 | - console.log({ response }) | 4237 | + defHttp.get('/yt/configuration/center/get_configuration_info/' + Editor.configurationId) |
4238 | + .then(function (response) { | ||
4239 | + getUserPermission() | ||
4240 | + | ||
4240 | const { platform } = response || {} | 4241 | const { platform } = response || {} |
4241 | const pageSizeControl = PageSetupDialog.getFormats | 4242 | const pageSizeControl = PageSetupDialog.getFormats |
4242 | PageSetupDialog.getFormats = function () { | 4243 | PageSetupDialog.getFormats = function () { |
@@ -4281,10 +4282,8 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { | @@ -4281,10 +4282,8 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { | ||
4281 | fn(); | 4282 | fn(); |
4282 | } | 4283 | } |
4283 | 4284 | ||
4284 | - getUserPermission() | ||
4285 | }) | 4285 | }) |
4286 | - .catch(function (error) { | ||
4287 | - console.log(error); | 4286 | + .catch(function (error) { |
4288 | }); | 4287 | }); |
4289 | } | 4288 | } |
4290 | 4289 |
@@ -268,6 +268,11 @@ | @@ -268,6 +268,11 @@ | ||
268 | * @description 开关组件状态 {true | false | null} | 268 | * @description 开关组件状态 {true | false | null} |
269 | */ | 269 | */ |
270 | SWITCH_STATE: 'switchState', | 270 | SWITCH_STATE: 'switchState', |
271 | + | ||
272 | + /** | ||
273 | + * @description 图片组件 | ||
274 | + */ | ||
275 | + IMAGE: 'image' | ||
271 | 276 | ||
272 | } | 277 | } |
273 | 278 | ||
@@ -717,7 +722,7 @@ | @@ -717,7 +722,7 @@ | ||
717 | 722 | ||
718 | // TODO thingsKit 设置数据绑定展示面板 | 723 | // TODO thingsKit 设置数据绑定展示面板 |
719 | const { LINE_CHART_EXPAND, BAR_CHART_EXPAND, DASHBOARD_CHART_EXPAND, DYNAMIC_EFFECT, DATA_SOURCE, VAR_IMAGE, INTERACTION, VIDEO: VIDEO_PANEL, SWITCH_STATE_SETTING, ONLY_SINGLE_EVENT, RUNNING_AND_STOP } = this.enumPermissionPanel | 724 | const { LINE_CHART_EXPAND, BAR_CHART_EXPAND, DASHBOARD_CHART_EXPAND, DYNAMIC_EFFECT, DATA_SOURCE, VAR_IMAGE, INTERACTION, VIDEO: VIDEO_PANEL, SWITCH_STATE_SETTING, ONLY_SINGLE_EVENT, RUNNING_AND_STOP } = this.enumPermissionPanel |
720 | - const { LINE, LINE_CHART, REAL_TIME, TITLE, VARIABLE, DEFAULT, BAR_CHART, VIDEO, SWITCH, PARAMS_SETTING_BUTTON, DASHBOARD_CHART } = this.enumComponentType | 725 | + const { LINE, LINE_CHART, REAL_TIME, TITLE, VARIABLE, DEFAULT, BAR_CHART, VIDEO, SWITCH, PARAMS_SETTING_BUTTON, DASHBOARD_CHART, IMAGE } = this.enumComponentType |
721 | this.setComponentPermission(LINE, [RUNNING_AND_STOP, DYNAMIC_EFFECT]) | 726 | this.setComponentPermission(LINE, [RUNNING_AND_STOP, DYNAMIC_EFFECT]) |
722 | this.setComponentPermission(DEFAULT, [DYNAMIC_EFFECT]) | 727 | this.setComponentPermission(DEFAULT, [DYNAMIC_EFFECT]) |
723 | this.setComponentPermission(REAL_TIME, [DYNAMIC_EFFECT]) | 728 | this.setComponentPermission(REAL_TIME, [DYNAMIC_EFFECT]) |
@@ -730,6 +735,7 @@ | @@ -730,6 +735,7 @@ | ||
730 | this.setComponentPermission(VIDEO, [VIDEO_PANEL]) | 735 | this.setComponentPermission(VIDEO, [VIDEO_PANEL]) |
731 | this.setComponentPermission(SWITCH, [DATA_SOURCE, SWITCH_STATE_SETTING]) | 736 | this.setComponentPermission(SWITCH, [DATA_SOURCE, SWITCH_STATE_SETTING]) |
732 | this.setComponentPermission(PARAMS_SETTING_BUTTON, [DATA_SOURCE, ONLY_SINGLE_EVENT]) | 737 | this.setComponentPermission(PARAMS_SETTING_BUTTON, [DATA_SOURCE, ONLY_SINGLE_EVENT]) |
738 | + this.setComponentPermission(IMAGE, [DATA_SOURCE]) | ||
733 | 739 | ||
734 | var thingskitEntries = [ | 740 | var thingskitEntries = [ |
735 | { title: mxResources.get('general'), id: 'general', image: IMAGE_PATH + '/sidebar-general.png' }, | 741 | { title: mxResources.get('general'), id: 'general', image: IMAGE_PATH + '/sidebar-general.png' }, |
@@ -59,6 +59,12 @@ | @@ -59,6 +59,12 @@ | ||
59 | this.setCellAttributes(cell, { [basicAttr.COMPONENT_TYPE]: componentType.VIDEO }) | 59 | this.setCellAttributes(cell, { [basicAttr.COMPONENT_TYPE]: componentType.VIDEO }) |
60 | return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '视频'); | 60 | return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '视频'); |
61 | })), | 61 | })), |
62 | + this.addEntry(this.getTagsForStencil('mxgraph.basic', '图片', 'basic').join(' '), mxUtils.bind(this, function () { | ||
63 | + const cell = new mxCell(`<img class="basic-component__image" src="${Proxy_Prefix}/images/thingskit/img-placeholder.png" />`, new mxGeometry(0, 0, 190, 190), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;'); | ||
64 | + cell.setVertex(true) | ||
65 | + this.setCellAttributes(cell, { [basicAttr.COMPONENT_TYPE]: componentType.IMAGE }) | ||
66 | + return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '图片'); | ||
67 | + })), | ||
62 | ]; | 68 | ]; |
63 | 69 | ||
64 | this.addPaletteFunctions('component', '基础元件', true, fns); | 70 | this.addPaletteFunctions('component', '基础元件', true, fns); |
@@ -5930,7 +5930,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -5930,7 +5930,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
5930 | [componentType.DEFAULT]: getSubmitValue, | 5930 | [componentType.DEFAULT]: getSubmitValue, |
5931 | [componentType.VIDEO]: getVideoSubmitValue, | 5931 | [componentType.VIDEO]: getVideoSubmitValue, |
5932 | [componentType.SWITCH]: getSwitchSubmitValue, | 5932 | [componentType.SWITCH]: getSwitchSubmitValue, |
5933 | - [componentType.PARAMS_SETTING_BUTTON]: getSwitchSubmitValue | 5933 | + [componentType.PARAMS_SETTING_BUTTON]: getSwitchSubmitValue, |
5934 | + [componentType.IMAGE]: getSubmitValue | ||
5934 | } | 5935 | } |
5935 | 5936 | ||
5936 | const cell = vertices[0] | 5937 | const cell = vertices[0] |
@@ -13453,6 +13454,11 @@ class HandleDataSource { | @@ -13453,6 +13454,11 @@ class HandleDataSource { | ||
13453 | return | 13454 | return |
13454 | } | 13455 | } |
13455 | 13456 | ||
13457 | + if (type === this.componentType.IMAGE) { | ||
13458 | + this.handleImageComponent(message) | ||
13459 | + return | ||
13460 | + } | ||
13461 | + | ||
13456 | if (!data) return | 13462 | if (!data) return |
13457 | const [[timespan, value]] = data[attr] | 13463 | const [[timespan, value]] = data[attr] |
13458 | node.setValue(value) | 13464 | node.setValue(value) |
@@ -13508,6 +13514,7 @@ class HandleDataSource { | @@ -13508,6 +13514,7 @@ class HandleDataSource { | ||
13508 | 13514 | ||
13509 | handleParamSettingButton(message) { | 13515 | handleParamSettingButton(message) { |
13510 | const { subscriptionId, data = {} } = message | 13516 | const { subscriptionId, data = {} } = message |
13517 | + if (!data) return | ||
13511 | const node = this.getNodeByCmdId(subscriptionId) | 13518 | const node = this.getNodeByCmdId(subscriptionId) |
13512 | const { attr } = this.getBindData(subscriptionId) | 13519 | const { attr } = this.getBindData(subscriptionId) |
13513 | const [[timespan, receiveValue] = []] = data[attr] || [] | 13520 | const [[timespan, receiveValue] = []] = data[attr] || [] |
@@ -13516,6 +13523,16 @@ class HandleDataSource { | @@ -13516,6 +13523,16 @@ class HandleDataSource { | ||
13516 | }, node) | 13523 | }, node) |
13517 | } | 13524 | } |
13518 | 13525 | ||
13526 | + handleImageComponent(message) { | ||
13527 | + const { subscriptionId, data = {} } = message | ||
13528 | + const node = this.getNodeByCmdId(subscriptionId) | ||
13529 | + const { attr } = this.getBindData(subscriptionId) | ||
13530 | + const [[timespan, receiveValue] = []] = data[attr] || [] | ||
13531 | + this.updatePage(() => { | ||
13532 | + node.setAttribute('label', `<img class="basic-component__image" alt="图片" src="${receiveValue}" />`) | ||
13533 | + }, node) | ||
13534 | + } | ||
13535 | + | ||
13519 | /** | 13536 | /** |
13520 | * @description 更新实时数据 | 13537 | * @description 更新实时数据 |
13521 | * @param {} message | 13538 | * @param {} message |
@@ -13821,7 +13838,7 @@ class HandleDataSource { | @@ -13821,7 +13838,7 @@ class HandleDataSource { | ||
13821 | }, | 13838 | }, |
13822 | data: [ | 13839 | data: [ |
13823 | { | 13840 | { |
13824 | - value: 20 | 13841 | + value |
13825 | } | 13842 | } |
13826 | ] | 13843 | ] |
13827 | }, | 13844 | }, |
@@ -49,6 +49,11 @@ function createAxios(options) { | @@ -49,6 +49,11 @@ function createAxios(options) { | ||
49 | 49 | ||
50 | doRefreshToken() | 50 | doRefreshToken() |
51 | } | 51 | } |
52 | + | ||
53 | + const message = error.response && error.response.data && error.response.data.message | ||
54 | + const { layer } = layui | ||
55 | + message && layer.msg(message, { icon: 5 }) | ||
56 | + | ||
52 | return Promise.reject(error); | 57 | return Promise.reject(error); |
53 | } | 58 | } |
54 | ); | 59 | ); |