Commit 2c6927d72510a0394c72e163c540171190bd67ba

Authored by xp.Huang
2 parents af79e93a 49c45fd8

Merge branch 'ww' into 'main'

fix: subscribe value same on different page bind same device

See merge request huang/thingskit-drawio!38
... ... @@ -6,6 +6,8 @@ const del = require('del')
6 6 const path = require('path')
7 7 const { readFileSync, writeFileSync } = require('fs')
8 8
  9 +let oldTimespan = '?v=1659335275728'
  10 +
9 11 /**
10 12 * @descritpion 清除dist 文件夹
11 13 * @param {*} cb
... ... @@ -66,10 +68,19 @@ function reductionFile(cb) {
66 68 }
67 69
68 70 function generatoreVersion(cb) {
  71 +
69 72 const reg = /const\s+releaseVersion\s?=\s?.*/g
  73 + const regTimespan = /\?v=(\d+)/g
  74 + const timespan = Date.now()
  75 +
70 76 const string = readFileSync(path.resolve(__dirname, './src/main/webapp/index.html'), { encoding: 'utf-8' })
71   - const newString = string.replace(reg, `const releaseVersion = '${encodeURIComponent(Date.now())}'`)
  77 +
  78 + let newString = string.replace(reg, `const releaseVersion = '${encodeURIComponent(Date.now())}'`)
  79 +
  80 + newString = string.replace(regTimespan, `?v=${timespan}`)
  81 +
72 82 writeFileSync(path.resolve(__dirname, './src/main/webapp/index.html'), newString, { encoding: 'utf-8' })
  83 +
73 84 cb()
74 85 }
75 86
... ...
... ... @@ -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">
  25 + <link rel="stylesheet" href="./js/plugin/layui/css/layui.css?v=1659336383769">
26 26
27 27 <!-- load configure file -->
28   - <script src="./js/config/config.js"></script>
  28 + <script src="./js/config/config.js?v=1659336383769"></script>
29 29
30 30 <!-- crypto-js -->
31   - <script src="./js/plugin/crypto-js/crypto-js.js"></script>
  31 + <script src="./js/plugin/crypto-js/crypto-js.js?v=1659336383769"></script>
32 32
33 33 <!-- storage persistent -->
34   - <script src="./js/const/persistentStorage.js"></script>
  34 + <script src="./js/const/persistentStorage.js?v=1659336383769"></script>
35 35 <!-- Global const -->
36   - <script src="./js/const/const.js"></script>
  36 + <script src="./js/const/const.js?v=1659336383769"></script>
37 37
38 38 <!-- Axios -->
39   - <script src="./js/plugin/axios/axios.min.js"></script>
40   - <script src="./js/plugin/axios/DefHttp.js"></script>
41   - <script src="./js/api/index.js"></script>
  39 + <script src="./js/plugin/axios/axios.min.js?v=1659336383769"></script>
  40 + <script src="./js/plugin/axios/DefHttp.js?v=1659336383769"></script>
  41 + <script src="./js/api/index.js?v=1659336383769"></script>
42 42
43 43 <!-- load script -->
44   - <script src="./js/config/loadScript.js"></script>
  44 + <script src="./js/config/loadScript.js?v=1659336383769"></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"></script>
  57 + <script src="./js/plugin/layui/layui.js?v=1659336383769"></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">
  66 + <link rel="stylesheet" href="./styles/formatChange.css?v=1659336383769">
67 67
68 68 <script type="text/javascript">
69 69 /**
... ...
... ... @@ -5179,6 +5179,12 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5179 5179 const act = currentNodeData.act ?? []
5180 5180 const event = currentNodeData.event ?? []
5181 5181 const actionType = {}
  5182 +
  5183 + const hasExistEl = $(`.layui-form[lay-filter="${CONTAINER_FILTER}"]`).find('input[type="checkbox"]')
  5184 + $(hasExistEl).each((i) => {
  5185 + $(hasExistEl[i]).attr('disabled', true)
  5186 + })
  5187 +
5182 5188 for (const item of act) {
5183 5189 const flag = !item.condition || !item.condition?.length
5184 5190 $(`.interaction__container input[name="${item.type}"]`).attr('disabled', flag)
... ... @@ -5189,6 +5195,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5189 5195 $(`.interaction__container input[name="${item.type}"]`).attr('disabled', flag)
5190 5196 actionType[item.type] = item.enabled
5191 5197 }
  5198 +
5192 5199 form.val(CONTAINER_FILTER, actionType)
5193 5200 }
5194 5201
... ... @@ -6471,7 +6478,8 @@ DataFormatPanel.prototype.addDataFont = function (container) {
6471 6478 * @description 创建组织树
6472 6479 */
6473 6480 async function createOrgTreeSelect() {
6474   - const [err, treeList] = await to(ConfigurationNodeApi.getOrgTree())
  6481 + const [err, res] = await to(ConfigurationNodeApi.getOrgTree())
  6482 + treeList = res
6475 6483 if (err) return
6476 6484 UseLayUi.createTreeSelect({
6477 6485 elem: `#${enumActionEl.ORG_EL}`,
... ... @@ -6481,7 +6489,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
6481 6489 layVerify: 'required',
6482 6490 layVerType: 'tips',
6483 6491 treeProps: {
6484   - data: treeList,
  6492 + data: res,
6485 6493 onlyIconControl: true,
6486 6494 click(node) {
6487 6495 recordData.orgId = node.data.id
... ... @@ -7059,7 +7067,8 @@ DataFormatPanel.prototype.addDataFont = function (container) {
7059 7067 </div>
7060 7068 </div>
7061 7069 <div class="layui-form-item" id="${enumActionEl.WAY_SELECT}" style="display:none">
7062   - <label class="layui-form-label">单向/双向</label>
  7070 + <label class="layui-form-label">单向/双向 ${createHelpMessage(`单向:服务器向网关设备、直连设备发送指令。发送指令后,设备不会返回任何信息。\n
  7071 + 双向:服务器向网关设备、直连设备发送指令。发送指令后,设备返回响应信息。`, 'way')}</label>
7063 7072 <div class="layui-input-block">
7064 7073 <input type="radio" name="${enumConst.WAY}" value="${enumWayType.ONE_WAY}" title="单向" checked="">
7065 7074 <input type="radio" name="${enumConst.WAY}" value="${enumWayType.TWO_WAY}" title="双向">
... ... @@ -12530,7 +12539,7 @@ class UseLayUi {
12530 12539
12531 12540 static topMsg(msg, options, icon) {
12532 12541 const { layer } = layui
12533   - layer.msg(`<div style="padding: 20px; display: flex; align-items: center;"><i class="layui-layer-ico layui-layer-ico6" style="width: 30px;height: 30px;"></i><span style="margin-left: 5px">${msg}</span></div>`, { ...options, type: 1, icon, time: 2000, })
  12542 + layer.msg(`<div style="padding: 20px; display: flex; align-items: center;"><i class="layui-layer-ico layui-layer-ico${icon}" style="width: 30px;height: 30px;"></i><span style="margin-left: 5px">${msg}</span></div>`, { ...options, type: 1, icon, time: 2000, })
12534 12543 }
12535 12544
12536 12545 static topSuccessMsg(msg = '操作成功', options) {
... ... @@ -12801,7 +12810,7 @@ class Ws {
12801 12810 * @description 发送消息
12802 12811 */
12803 12812 send(message) {
12804   - if (this.ws.readyState !== 1) {
  12813 + if (!this.ws || this.ws.readyState !== 1) {
12805 12814 this.errorStack.push(message)
12806 12815 return
12807 12816 }
... ... @@ -12832,6 +12841,7 @@ class Ws {
12832 12841 this.close()
12833 12842 this.ws = null
12834 12843 this.errorStack = null
  12844 + Ws.instance = null
12835 12845 }
12836 12846
12837 12847 /**
... ... @@ -13020,6 +13030,7 @@ class DispatchCenter {
13020 13030 * @description 建立socket连接
13021 13031 */
13022 13032 connectSocket() {
  13033 + Ws.instance?.destroy?.()
13023 13034 this.socket = Ws.getInstance({ url: GLOBAL_WS_URL(), onmessageCallback: this.socketOnmessage })
13024 13035 }
13025 13036
... ... @@ -13061,9 +13072,6 @@ class DispatchCenter {
13061 13072 if (!id) return
13062 13073 const [err, res] = await to(ConfigurationNodeApi.getConfigurationInfo('CONTENT', id))
13063 13074 this.contentData = res
13064   - // const { dataSources } = this.contentData = res
13065   - // const tsSubCmds = this.generatorDataSourceMapping(dataSources)
13066   - // this.sendMessageToGetRealTimeData({ tsSubCmds })
13067 13075 }
13068 13076
13069 13077 /**
... ... @@ -14121,6 +14129,7 @@ class HandleDataInteraction {
14121 14129
14122 14130 },
14123 14131 async success(layero, index) {
  14132 + $('.layui-layer-setwin a').removeAttr('href')
14124 14133 form.render()
14125 14134 },
14126 14135 })
... ...
... ... @@ -589,3 +589,9 @@
589 589 top: -130px;
590 590 z-index: 99;
591 591 }
  592 +
  593 +.way .thingskit-help-container {
  594 + width: 220px;
  595 + top: -130px;
  596 + z-index: 99;
  597 +}
... ...