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 | 22 | <meta name="mobile-web-app-capable" content="yes"> |
23 | 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 | 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 | 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 | 33 | <!-- storage persistent --> |
34 | - <script src="./js/const/persistentStorage.js?v=1660097025459"></script> | |
34 | + <script src="./js/const/persistentStorage.js?v=1663582316568"></script> | |
35 | 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 | 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 | 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 | 46 | <!-- act editor --> |
47 | 47 | <!-- <script src="https://oss.yuntengcloud.com/iotdocs/thingskit-scada/ace.js"></script> --> |
... | ... | @@ -54,7 +54,7 @@ |
54 | 54 | <!-- <script src="https://vjs.zencdn.net/7.10.2/video.min.js"></script> --> |
55 | 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 | 58 | <!-- <link rel="stylesheet" href="https://cdnjs.loli.net/ajax/libs/layui/2.6.8/css/layui.min.css" |
59 | 59 | integrity="sha512-iQBJbsNHXUcgEIgWThd2dr8tOdKPvICwqjPEZYY81z3eMya44A5MiAqfWSCh+Ee1YzNYkdrI982Qhwgr8LEYOQ==" |
60 | 60 | crossorigin="anonymous" referrerpolicy="no-referrer" /> |
... | ... | @@ -63,7 +63,7 @@ |
63 | 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 | 68 | <script type="text/javascript"> |
69 | 69 | /** |
... | ... | @@ -306,7 +306,7 @@ |
306 | 306 | var supportedDomain = (hostName.substring(hostName.length - 8, hostName.length) === '.draw.io') || |
307 | 307 | (hostName.substring(hostName.length - 13, hostName.length) === '.diagrams.net'); |
308 | 308 | |
309 | - const releaseVersion = '1660097025459' | |
309 | + const releaseVersion = '1663582316568' | |
310 | 310 | const appMinSrc = Enable_OSS ? `${OSS_Prefix}app.min.js?v=${releaseVersion}` : `js/app.min.js?v=${releaseVersion}` |
311 | 311 | function loadAppJS() { |
312 | 312 | mxscript(appMinSrc, function () { | ... | ... |
1 | 1 | /** |
2 | 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 | 7 | * @description enable load script form oss server |
... | ... | @@ -12,3 +12,5 @@ const Enable_OSS = true |
12 | 12 | * @description 代理配置项 |
13 | 13 | */ |
14 | 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 | 21 | /** |
22 | 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 | 26 | const USER_PERMISSION = { |
27 | 27 | permission: [] | ... | ... |
... | ... | @@ -4221,8 +4221,8 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { |
4221 | 4221 | function getUserPermission() { |
4222 | 4222 | defHttp.get('/yt/role/me/permissions') |
4223 | 4223 | .then(res => { |
4224 | - USER_PERMISSION.permission = res | |
4225 | - console.log({ USER_PERMISSION }) | |
4224 | + console.log('enter') | |
4225 | + USER_PERMISSION.permission = res | |
4226 | 4226 | updateButtonContainer() |
4227 | 4227 | // var flag = hasSavePermission() |
4228 | 4228 | // if (!flag) { |
... | ... | @@ -4234,9 +4234,10 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { |
4234 | 4234 | |
4235 | 4235 | // 调用API,获取保存的内容 |
4236 | 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 | 4241 | const { platform } = response || {} |
4241 | 4242 | const pageSizeControl = PageSetupDialog.getFormats |
4242 | 4243 | PageSetupDialog.getFormats = function () { |
... | ... | @@ -4281,10 +4282,8 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { |
4281 | 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 | 268 | * @description 开关组件状态 {true | false | null} |
269 | 269 | */ |
270 | 270 | SWITCH_STATE: 'switchState', |
271 | + | |
272 | + /** | |
273 | + * @description 图片组件 | |
274 | + */ | |
275 | + IMAGE: 'image' | |
271 | 276 | |
272 | 277 | } |
273 | 278 | |
... | ... | @@ -717,7 +722,7 @@ |
717 | 722 | |
718 | 723 | // TODO thingsKit 设置数据绑定展示面板 |
719 | 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 | 726 | this.setComponentPermission(LINE, [RUNNING_AND_STOP, DYNAMIC_EFFECT]) |
722 | 727 | this.setComponentPermission(DEFAULT, [DYNAMIC_EFFECT]) |
723 | 728 | this.setComponentPermission(REAL_TIME, [DYNAMIC_EFFECT]) |
... | ... | @@ -730,6 +735,7 @@ |
730 | 735 | this.setComponentPermission(VIDEO, [VIDEO_PANEL]) |
731 | 736 | this.setComponentPermission(SWITCH, [DATA_SOURCE, SWITCH_STATE_SETTING]) |
732 | 737 | this.setComponentPermission(PARAMS_SETTING_BUTTON, [DATA_SOURCE, ONLY_SINGLE_EVENT]) |
738 | + this.setComponentPermission(IMAGE, [DATA_SOURCE]) | |
733 | 739 | |
734 | 740 | var thingskitEntries = [ |
735 | 741 | { title: mxResources.get('general'), id: 'general', image: IMAGE_PATH + '/sidebar-general.png' }, | ... | ... |
... | ... | @@ -59,6 +59,12 @@ |
59 | 59 | this.setCellAttributes(cell, { [basicAttr.COMPONENT_TYPE]: componentType.VIDEO }) |
60 | 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 | 70 | this.addPaletteFunctions('component', '基础元件', true, fns); | ... | ... |
... | ... | @@ -5930,7 +5930,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
5930 | 5930 | [componentType.DEFAULT]: getSubmitValue, |
5931 | 5931 | [componentType.VIDEO]: getVideoSubmitValue, |
5932 | 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 | 5937 | const cell = vertices[0] |
... | ... | @@ -13453,6 +13454,11 @@ class HandleDataSource { |
13453 | 13454 | return |
13454 | 13455 | } |
13455 | 13456 | |
13457 | + if (type === this.componentType.IMAGE) { | |
13458 | + this.handleImageComponent(message) | |
13459 | + return | |
13460 | + } | |
13461 | + | |
13456 | 13462 | if (!data) return |
13457 | 13463 | const [[timespan, value]] = data[attr] |
13458 | 13464 | node.setValue(value) |
... | ... | @@ -13508,6 +13514,7 @@ class HandleDataSource { |
13508 | 13514 | |
13509 | 13515 | handleParamSettingButton(message) { |
13510 | 13516 | const { subscriptionId, data = {} } = message |
13517 | + if (!data) return | |
13511 | 13518 | const node = this.getNodeByCmdId(subscriptionId) |
13512 | 13519 | const { attr } = this.getBindData(subscriptionId) |
13513 | 13520 | const [[timespan, receiveValue] = []] = data[attr] || [] |
... | ... | @@ -13516,6 +13523,16 @@ class HandleDataSource { |
13516 | 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 | 13537 | * @description 更新实时数据 |
13521 | 13538 | * @param {} message |
... | ... | @@ -13821,7 +13838,7 @@ class HandleDataSource { |
13821 | 13838 | }, |
13822 | 13839 | data: [ |
13823 | 13840 | { |
13824 | - value: 20 | |
13841 | + value | |
13825 | 13842 | } |
13826 | 13843 | ] |
13827 | 13844 | }, | ... | ... |
... | ... | @@ -49,6 +49,11 @@ function createAxios(options) { |
49 | 49 | |
50 | 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 | 57 | return Promise.reject(error); |
53 | 58 | } |
54 | 59 | ); | ... | ... |