openatc-components 0.1.112 → 0.1.114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Copyright (c) 2020 kedacom
3
+ * OpenATC is licensed under Mulan PSL v2.
4
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5
+ * You may obtain a copy of Mulan PSL v2 at:
6
+ * http://license.coscl.org.cn/MulanPSL2
7
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10
+ * See the Mulan PSL v2 for more details.
11
+ **/
12
+ <template>
13
+ <div class="cross-phase-dir">
14
+ <el-select v-model="phaseid" style="width: 100%" clearable :placeholder="$t('openatccomponents.common.select')" :no-data-text="$t('openatccomponents.common.nodata')"
15
+ @change="handleSelect"
16
+ >
17
+ <el-option
18
+ v-for="(option, index) in phaseOption"
19
+ :key="index"
20
+ :label="option.phasedesc"
21
+ :value="option.phaseid"
22
+ >
23
+ <span>{{ option.phasedesc }}</span>
24
+ </el-option>
25
+ </el-select>
26
+ </div>
27
+ </template>
28
+ <script>
29
+ import {
30
+ getTscPhase
31
+ } from '../../../api/cross.js'
32
+ import { getMessageByCode } from '../../../utils/responseMessage.js'
33
+ import { images } from '../../../utils/phaseList.js'
34
+ export default {
35
+ name: 'phase-direction-select',
36
+ props: {
37
+ agentid: {
38
+ type: String
39
+ }
40
+ },
41
+ data () {
42
+ return {
43
+ phaseOption: [],
44
+ phaseid: ''
45
+ }
46
+ },
47
+ mounted () {
48
+ this.getCurPhaseDirection()
49
+ },
50
+ methods: {
51
+ getCurPhaseDirection () {
52
+ this.phaseOption = []
53
+ if (this.agentid === undefined || this.agentid === '') return
54
+ getTscPhase(this.agentid).then(res => {
55
+ if (!res.data.success) {
56
+ if (res.data.code === '4003') {
57
+ this.$message.error(this.$t('openatccomponents.errorTip.devicenotonline'))
58
+ return
59
+ }
60
+ this.$message.error(getMessageByCode(res.data.code, this.$i18n.locale))
61
+ return
62
+ }
63
+ if (!res.data.data.data.phaseList) return
64
+ let options
65
+ options = res.data.data.data.phaseList.map((ele) => {
66
+ return {
67
+ ...ele,
68
+ phasedirection: ele.direction,
69
+ directiondesc: this.getPhaseName(ele.direction).name,
70
+ phasedesc:
71
+ this.$t('openatccomponents.overview.phase') +
72
+ ele.id + '-' +
73
+ this.getPhaseName(ele.direction).name,
74
+ phaseid: ele.id
75
+ }
76
+ })
77
+ console.log(options)
78
+ this.phaseOption = options
79
+ })
80
+ },
81
+ getName (status) {
82
+ let name = ''
83
+ for (let i = 0; i < status.length; i++) {
84
+ if (!status[i]) continue
85
+ name = name + ',' + this.$t(images[i].name)
86
+ }
87
+ if (name !== '') {
88
+ const obj = {
89
+ name: name.substr(1)
90
+ }
91
+ return obj
92
+ } else {
93
+ return {
94
+ name: ''
95
+ }
96
+ }
97
+ },
98
+ getPhaseName (desc) {
99
+ // 根据相位描述数组得到相位名称
100
+ let status = []
101
+ for (let obj of images) {
102
+ if (desc.length > 0 && desc.includes(obj.id)) {
103
+ status.push(1)
104
+ } else {
105
+ status.push(0)
106
+ }
107
+ }
108
+ return this.getName(status)
109
+ },
110
+ handleSelect (val) {
111
+ let phaseinfo = this.phaseOption.filter(ele => ele.phaseid === val)[0]
112
+ this.$emit('getSelectPhaseId', val)
113
+ this.$emit('getSelectPhaseInfo', phaseinfo)
114
+ }
115
+ }
116
+ }
117
+ </script>
118
+
119
+ <style scoped>
120
+ </style>
@@ -0,0 +1,2 @@
1
+ import PhaseDirectionSelect from './PhaseDirectionSelect.vue'
2
+ export default PhaseDirectionSelect
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Copyright (c) 2020 kedacom
3
+ * OpenATC is licensed under Mulan PSL v2.
4
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5
+ * You may obtain a copy of Mulan PSL v2 at:
6
+ * http://license.coscl.org.cn/MulanPSL2
7
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10
+ * See the Mulan PSL v2 for more details.
11
+ **/
12
+ <template>
13
+ <div class="cross-phase-dir">
14
+ <div v-for="phase in phaselist" :key="phase.id">
15
+ {{$t('openatccomponents.overview.phase')}}{{phase.id}} - {{phase.dirname}}
16
+ </div>
17
+ </div>
18
+ </template>
19
+ <script>
20
+ import {
21
+ getTscPhase
22
+ } from '../../../api/cross.js'
23
+ import { getMessageByCode } from '../../../utils/responseMessage.js'
24
+ import { images } from '../../../utils/phaseList.js'
25
+ export default {
26
+ name: 'phase-direction-text',
27
+ props: {
28
+ agentid: {
29
+ type: String
30
+ },
31
+ phaseidArray: {
32
+ type: Array
33
+ }
34
+ },
35
+ data () {
36
+ return {
37
+ phaselist: [],
38
+ DirectionMap: new Map() // 当前设备的相位方向Map
39
+ }
40
+ },
41
+ mounted () {
42
+ this.getCurPhaseDirection()
43
+ },
44
+ methods: {
45
+ getCurPhaseDirection () {
46
+ this.DirectionMap = new Map()
47
+ this.phaselist = []
48
+ if (this.agentid === undefined || this.agentid === '') return
49
+ getTscPhase(this.agentid).then(res => {
50
+ if (!res.data.success) {
51
+ if (res.data.code === '4003') {
52
+ this.$message.error(this.$t('openatccomponents.errorTip.devicenotonline'))
53
+ return
54
+ }
55
+ this.$message.error(getMessageByCode(res.data.code, this.$i18n.locale))
56
+ return
57
+ }
58
+ if (!res.data.data.data.phaseList) return
59
+ res.data.data.data.phaseList.forEach(ele => {
60
+ let dirname = this.getPhaseName(ele.direction).name
61
+ this.DirectionMap.set(ele.id, {...ele, dirname})
62
+ })
63
+ this.getPhaseDirTextByPhaseid()
64
+ })
65
+ },
66
+ getName (status) {
67
+ let name = ''
68
+ for (let i = 0; i < status.length; i++) {
69
+ if (!status[i]) continue
70
+ name = name + ',' + this.$t(images[i].name)
71
+ }
72
+ if (name !== '') {
73
+ const obj = {
74
+ name: name.substr(1)
75
+ }
76
+ return obj
77
+ } else {
78
+ return {
79
+ name: ''
80
+ }
81
+ }
82
+ },
83
+ getPhaseName (desc) {
84
+ // 根据相位描述数组得到相位名称
85
+ let status = []
86
+ for (let obj of images) {
87
+ if (desc.length > 0 && desc.includes(obj.id)) {
88
+ status.push(1)
89
+ } else {
90
+ status.push(0)
91
+ }
92
+ }
93
+ return this.getName(status)
94
+ },
95
+ getPhaseDirTextByPhaseid () {
96
+ this.phaselist = this.phaseidArray.map(phaseid => {
97
+ let phaseinfo = this.DirectionMap.get(phaseid)
98
+ return phaseinfo
99
+ })
100
+ }
101
+ }
102
+ }
103
+ </script>
104
+
105
+ <style scoped>
106
+ </style>
@@ -0,0 +1,2 @@
1
+ import PhaseDirectionText from './PhaseDirectionText.vue'
2
+ export default PhaseDirectionText
@@ -101,7 +101,7 @@
101
101
 
102
102
  <script>
103
103
  import { getPhase } from './utils'
104
- import { getIframdevid } from '../../../../utils/auth'
104
+ // import { getIframdevid } from '../../../../utils/auth'
105
105
  import { getlockPhase, lockPhase } from '../../../../api/control'
106
106
  import Stages from '../../Stages/index'
107
107
  import RingDataModel from '../../../../utils/RingDataModel.js'
@@ -190,9 +190,8 @@ export default {
190
190
  },
191
191
  getLockPhase (val) {
192
192
  this.directions = [this.checkId(val)]
193
- let iframdevid = getIframdevid()
194
193
  let param = {
195
- 'agentid': iframdevid,
194
+ 'agentid': 'config_test',
196
195
  'direction': this.directions
197
196
  }
198
197
  getlockPhase(param).then(res => {
@@ -224,9 +223,8 @@ export default {
224
223
  this.$message.error(this.$t('openatccomponents.overview.directionnull'))
225
224
  return
226
225
  }
227
- let iframdevid = getIframdevid()
228
226
  let submitdata = {
229
- agentid: iframdevid,
227
+ agentid: 'config_test',
230
228
  direction: this.directions,
231
229
  greenflash: this.manualInfo.greenclear,
232
230
  duration: this.manualInfo.duration,
@@ -236,22 +234,10 @@ export default {
236
234
 
237
235
  }
238
236
  lockPhase(submitdata).then(res => {
239
- if (!res.data.success) {
240
- if (res.data.code === '4002' && res.data.data.errorCode === '4209') {
241
- let success = res.data.data.content.success
242
- if (success !== 0) {
243
- let errormsg = 'openatccomponents.overview.putTscControlError' + success
244
- this.$message.error(this.$t(errormsg))
245
- return
246
- }
247
- }
237
+ if (res.data.success !== true) {
248
238
  this.$message.error(getMessageByCode(res.data.code, this.$i18n.locale))
249
- return
250
239
  }
251
240
  this.$alert(this.$t('openatccomponents.common.download'), { type: 'success' })
252
- // if (res.data.success !== true) {
253
- // this.$message.error(getMessageByCode(res.data.code, this.$i18n.locale))
254
- // }
255
241
  })
256
242
  }
257
243
  }
@@ -24,6 +24,8 @@ import ExpendConfig from './components/ExpendConfig/index'
24
24
  import PatternWalkSvg from './components/PatternWalkSvg/index'
25
25
  import tentativeplancontrolmodal from './components/SchemeConfig/tentativeplancontrolmodal/index'
26
26
  import priorityControl from './components/SchemeConfig/priorityControl/index'
27
+ import PhaseDirectionText from './components/PhaseDirectionText/index'
28
+ import PhaseDirectionSelect from './components/PhaseDirectionSelect/index'
27
29
  import { setToken, setHost, setIsCheckPermission, setUserRoles, setPermissions } from '../utils/auth.js'
28
30
  import componentsGlobalParam from '../store/modules/globalParam'
29
31
 
@@ -57,7 +59,9 @@ const components = {
57
59
  ExpendConfig,
58
60
  PatternWalkSvg,
59
61
  priorityControl,
60
- tentativeplancontrolmodal
62
+ tentativeplancontrolmodal,
63
+ PhaseDirectionText,
64
+ PhaseDirectionSelect
61
65
  }
62
66
 
63
67
  const language = {