vue2-client 1.0.0 → 1.2.1

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.
Files changed (134) hide show
  1. package/.eslintrc.js +81 -81
  2. package/README.md +65 -55
  3. package/babel.config.js +15 -14
  4. package/docs/index.md +29 -29
  5. package/docs/notice.md +24 -0
  6. package/index.js +28 -0
  7. package/jest.config.js +3 -3
  8. package/package.json +1 -1
  9. package/public/index.html +27 -27
  10. package/src/App.vue +2 -2
  11. package/src/base-client/all.js +57 -57
  12. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +1159 -1159
  13. package/src/base-client/components/common/CreateQuery/index.md +1 -1
  14. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +540 -540
  15. package/src/base-client/components/common/CreateSimpleFormQuery/index.md +1 -1
  16. package/src/base-client/components/common/CustomColumnsDrawer/index.md +1 -1
  17. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +150 -150
  18. package/src/base-client/components/common/FormGroupEdit/index.md +1 -1
  19. package/src/base-client/components/common/FormGroupQuery/index.md +1 -1
  20. package/src/base-client/components/common/XAddForm/XAddForm.vue +323 -323
  21. package/src/base-client/components/common/XAddForm/index.md +1 -1
  22. package/src/base-client/components/common/XBadge/index.md +1 -1
  23. package/src/base-client/components/common/XCard/index.md +1 -1
  24. package/src/base-client/components/common/XForm/XForm.vue +275 -275
  25. package/src/base-client/components/common/XForm/XFormItem.vue +217 -217
  26. package/src/base-client/components/common/XForm/index.md +196 -196
  27. package/src/base-client/components/common/XFormCol/index.md +1 -1
  28. package/src/base-client/components/common/XFormTable/XFormTable.vue +405 -405
  29. package/src/base-client/components/common/XFormTable/index.md +2 -2
  30. package/src/base-client/components/common/XTable/XTable.vue +262 -262
  31. package/src/base-client/components/common/XTable/index.md +255 -255
  32. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +1 -1
  33. package/src/base-client/components/iot/CustomerDetailsView/CustomerDetailsView.vue +226 -226
  34. package/src/base-client/components/iot/CustomerDetailsView/index.md +2 -2
  35. package/src/base-client/components/iot/DataAnalysisUser/DataAnalysisUser.vue +1 -1
  36. package/src/base-client/components/iot/DataAnalysisViewGD/DataAnalysisViewGD.vue +548 -548
  37. package/src/base-client/components/iot/DeviceBrandDetailsView/DeviceBrandDetailsView.vue +453 -453
  38. package/src/base-client/components/iot/DeviceDetailsView/DeviceDetailsView.vue +231 -231
  39. package/src/base-client/components/iot/DeviceDetailsView/index.md +1 -1
  40. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsCount.vue +330 -330
  41. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsException.vue +1 -1
  42. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsInstruct.vue +3 -3
  43. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsInstructOperate.vue +122 -122
  44. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsMain.vue +1 -1
  45. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsRead.vue +3 -3
  46. package/src/base-client/components/iot/DeviceTypeDetailsView/DeviceTypeDetailsView.vue +277 -277
  47. package/src/base-client/components/iot/InstructDetailsView/InstructDetailsView.vue +472 -472
  48. package/src/base-client/components/iot/InstructDetailsView/index.md +1 -1
  49. package/src/base-client/components/iot/LogDetailsView/LogDetailsView.vue +380 -380
  50. package/src/base-client/components/iot/LogDetailsView/index.md +1 -1
  51. package/src/base-client/components/iot/MeterDetailsView/MeterDetailsView.vue +360 -360
  52. package/src/base-client/components/iot/MeterDetailsView/index.md +1 -1
  53. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsCount.vue +335 -335
  54. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsException.vue +185 -185
  55. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsHandPlan.vue +292 -292
  56. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsInstruct.vue +237 -237
  57. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsMain.vue +257 -257
  58. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsSellGas.vue +190 -190
  59. package/src/base-client/components/iot/WebmeterAnalysisView/WebmeterAnalysisView.vue +723 -723
  60. package/src/base-client/components/iot/WebmeterAnalysisView/index.md +1 -1
  61. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
  62. package/src/base-client/components/system/DictionaryDetailsView/index.md +1 -1
  63. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +248 -248
  64. package/src/base-client/components/ticket/EmployeeDetailsView/EmployeeDetailsView.vue +406 -406
  65. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +486 -486
  66. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +184 -184
  67. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +303 -303
  68. package/src/base-client/plugins/AppData.js +69 -69
  69. package/src/base-client/plugins/GetLoginInfoService.js +221 -222
  70. package/src/base-client/plugins/index.js +21 -21
  71. package/src/bootstrap.js +6 -4
  72. package/src/components/Ellipsis/Ellipsis.vue +1 -1
  73. package/src/components/Ellipsis/index.md +2 -2
  74. package/src/components/NumberInfo/index.md +1 -1
  75. package/src/components/STable/README.md +3 -3
  76. package/src/components/Trend/index.md +1 -1
  77. package/src/components/cache/AKeepAlive.js +1 -1
  78. package/src/components/checkbox/index.js +2 -2
  79. package/src/components/index.js +15 -15
  80. package/src/components/menu/menu.js +1 -1
  81. package/src/components/setting/Setting.vue +4 -4
  82. package/src/components/table/advance/AdvanceTable.vue +3 -3
  83. package/src/components/transition/PageToggleTransition.vue +1 -1
  84. package/src/config/default/setting.config.js +33 -33
  85. package/src/layouts/CommonLayout.vue +1 -1
  86. package/src/layouts/ComponentLayoutOne.vue +47 -47
  87. package/src/layouts/PageLayout.vue +2 -2
  88. package/src/layouts/SinglePageView.vue +1 -1
  89. package/src/layouts/header/AdminHeader.vue +2 -2
  90. package/src/layouts/header/HeaderAvatar.vue +1 -1
  91. package/src/layouts/header/HeaderNotice.vue +97 -97
  92. package/src/layouts/tabs/TabsHead.vue +1 -1
  93. package/src/layouts/tabs/TabsView.vue +6 -6
  94. package/src/main.js +20 -12
  95. package/src/mock/common/reportData.js +20 -20
  96. package/src/mock/goods/index.js +2 -2
  97. package/src/mock/index.js +6 -6
  98. package/src/mock/project/index.js +1 -1
  99. package/src/mock/user/current.js +1 -1
  100. package/src/mock/user/login.js +1 -1
  101. package/src/mock/user/routes.js +61 -61
  102. package/src/mock/workplace/index.js +1 -1
  103. package/src/pages/exception/403.vue +25 -25
  104. package/src/pages/exception/404.vue +25 -25
  105. package/src/pages/exception/500.vue +25 -25
  106. package/src/pages/login/Login.vue +194 -194
  107. package/src/pages/report/ReportTable.js +125 -125
  108. package/src/pages/report/ReportTableHome.vue +28 -28
  109. package/src/pages/resourceManage/resourceManageMain.vue +55 -55
  110. package/src/pages/system/applyInstallView/Core.vue +1 -1
  111. package/src/pages/system/applyInstallView/index.vue +1 -1
  112. package/src/pages/system/dictionary/index.vue +1 -1
  113. package/src/pages/system/queryParams/index.vue +1 -1
  114. package/src/router/async/config.async.js +1 -1
  115. package/src/router/async/router.map.js +59 -59
  116. package/src/router/guards.js +3 -3
  117. package/src/router/index.js +4 -8
  118. package/src/services/api/common.js +39 -39
  119. package/src/services/api/restTools.js +23 -23
  120. package/src/services/dataSource.js +1 -1
  121. package/src/services/user.js +2 -2
  122. package/src/store/index.js +3 -6
  123. package/src/store/modules/setting.js +5 -5
  124. package/src/theme/index.less +5 -5
  125. package/src/theme/reportTable.less +58 -58
  126. package/src/utils/i18n.js +2 -2
  127. package/src/utils/indexedDB.js +146 -146
  128. package/src/utils/request.js +3 -3
  129. package/src/utils/routerUtil.js +18 -5
  130. package/tests/unit/ReportTable.spec.js +15 -15
  131. package/vue.config.js +153 -152
  132. package/webpack.config.js +12 -0
  133. package/src/index.js +0 -29
  134. package/src/router/config.js +0 -23
@@ -1,472 +1,472 @@
1
- <template>
2
- <a-drawer
3
- title="指令详情"
4
- placement="right"
5
- :width="isMobile ? screenWidth : screenWidth * 0.85"
6
- :visible="visible"
7
- @close="onClose"
8
- >
9
- <a-spin :spinning="loadInstructDetails">
10
- <meter-details-view
11
- :visible.sync="detailVisible"
12
- :select-org-name="selectOrgName"
13
- :userid="selectUserId"
14
- v-if="selectUserId && isShowUserFiles"
15
- />
16
- <a-page-header
17
- :title="'指令:' + details.f_instruct_type"
18
- >
19
- <div class="row">
20
- <div class="content">
21
- <a-descriptions size="small" :column="isMobile ? 1 : 2">
22
- <a-descriptions-item label="指令编号" :span="isMobile ? 1 : 2">{{ details.id }}</a-descriptions-item>
23
- <a-descriptions-item label="表编号">
24
- <a v-if="isShowUserFiles" @click="openUserFilesDetails">{{ details.userid }}</a>
25
- <span v-else>{{ details.userid }}</span>
26
- </a-descriptions-item>
27
- <a-descriptions-item label="表号">{{ details.f_meternumber }}</a-descriptions-item>
28
- <a-descriptions-item label="操作人员">{{ details.f_inputtor }}</a-descriptions-item>
29
- <a-descriptions-item label="指令说明">{{ details.f_instruct_title }}</a-descriptions-item>
30
- <a-descriptions-item label="生成时间">{{ format(details.f_instruct_date,'yyyy-MM-dd hh:mm:ss') }}</a-descriptions-item>
31
- <a-descriptions-item label="表厂别名">{{ details.f_alias }}</a-descriptions-item>
32
- <a-descriptions-item label="最后发送时间">{{ format(details.f_send_date,'yyyy-MM-dd hh:mm:ss') }}</a-descriptions-item>
33
- <a-descriptions-item label="最后响应时间">{{ format(details.f_callback_date,'yyyy-MM-dd hh:mm:ss') }}</a-descriptions-item>
34
- </a-descriptions>
35
- </div>
36
- <div class="extra">
37
- <a-row class="status-list">
38
- <a-col :xs="12" :sm="24">
39
- <div class="text">指令状态</div>
40
- <div class="heading">
41
- <x-badge :value="details.f_instruct_state" badge-key="instructStateMap" :is-external-text="true"/>
42
- </div>
43
- </a-col>
44
- </a-row>
45
- <p></p>
46
- <a-row class="status-list">
47
- <a-col :xs="12" :sm="24">
48
- <div class="text">响应结果</div>
49
- <div class="heading">{{ details.f_receive_state }}</div>
50
- </a-col>
51
- </a-row>
52
- </div>
53
- </div>
54
-
55
- <!-- actions -->
56
- <template v-slot:extra>
57
- <a-button-group style="margin-right: 4px;">
58
- <a-button type="dashed" @click="initView" :loading="loadInstructDetails">刷新</a-button>
59
- </a-button-group>
60
- <a-button-group style="margin-right: 4px;">
61
- <a-popover title="重新发送" placement="bottomLeft">
62
- <template slot="content">
63
- <p>将指令标记为待发送状态</p>
64
- <p>指令将在 定时器轮询/表具上报 后重新发送</p>
65
- <p style="color: red">此操作不可撤销</p>
66
- </template>
67
- <a-button type="primary" @click="againSend(details.id)" :disabled="againSendBtnHide()">重新发送</a-button>
68
- </a-popover>
69
- <a-popover title="取消发送" placement="bottomLeft">
70
- <template slot="content">
71
- <p>该指令将被<span style="color: red;font-weight: bold">取消</span>,请谨慎操作</p>
72
- <p>只有待发送或已发送的指令可以取消发送</p>
73
- <p style="color: red">此操作不可撤销</p>
74
- </template>
75
- <a-button type="danger" @click="cancelSend(details.id)" :disabled="cancelSendBtnHide()">取消发送</a-button>
76
- </a-popover>
77
- </a-button-group>
78
- </template>
79
-
80
- <!-- 操作 -->
81
- <a-card :bordered="false" title="指令状态">
82
- <a-steps :direction="'horizontal'" :current="step" :status="status">
83
- <a-step>
84
- <template v-slot:title><span>待发送</span></template>
85
- <template v-slot:description>
86
- <div>指令已经就绪,待发送<div>{{ format(details.f_instruct_date,'yyyy-MM-dd hh:mm:ss') }}</div></div>
87
- </template>
88
- </a-step>
89
- <a-step>
90
- <template v-slot:title><span>已发送</span></template>
91
- <template v-slot:description>
92
- <div>{{ getIntroduction() }}<div>{{ format(details.f_send_date,'yyyy-MM-dd hh:mm:ss') }}</div></div>
93
- </template>
94
- </a-step>
95
- <a-step>
96
- <template v-slot:title><span>{{ instructResult }}</span></template>
97
- <template v-slot:description>
98
- <div>{{ getResultText(instructResult) }}<div>{{ format(details.f_callback_date,'yyyy-MM-dd hh:mm:ss') }}</div></div>
99
- </template>
100
- </a-step>
101
- </a-steps>
102
- </a-card>
103
- <a-card
104
- style="margin-top: 24px"
105
- :bordered="false"
106
- :tabList="operationTabList"
107
- :activeTabKey="operationActiveTabKey"
108
- @tabChange="(key) => {this.operationActiveTabKey = key}"
109
- >
110
- <div v-if="operationActiveTabKey === '1'">
111
- <a-card type="inner" title="指令内容">
112
- <json-viewer :copyable="{copyText: '复制', copiedText: '已复制'}" :value="details.f_instruct_content === undefined ? {} : toJSON(details.f_instruct_content)"></json-viewer>
113
- </a-card>
114
- <a-card type="inner" title="指令元数据">
115
- <json-viewer :copyable="{copyText: '复制', copiedText: '已复制'}" :value="details.f_instruct_meta_data === undefined ? {} : toJSON(details.f_instruct_meta_data)"></json-viewer>
116
- </a-card>
117
- </div>
118
-
119
- <x-table
120
- v-if="loaded && operationActiveTabKey === '2'"
121
- :json-data="showColumns"
122
- :queryParamsName="queryParamsName"
123
- @loadData="loadData"
124
- :form="form"
125
- />
126
- <div v-else-if="operationActiveTabKey === '3'" class="no-data"><a-icon type="frown-o"/>暂无数据</div>
127
- </a-card>
128
- </a-page-header>
129
- </a-spin>
130
- </a-drawer>
131
- </template>
132
-
133
- <script>
134
- import JsonViewer from 'vue-json-viewer'
135
- import { formatDate } from '@/utils/util'
136
- import { InstructDetailsViewApi } from '@/services/api/InstructDetailsViewApi'
137
- import { post } from '@/services/api/restTools'
138
- import { query, commonApi } from '@/services/api/common'
139
- import XTable from '@/base-client/components/common/XTable/XTable'
140
- import { mapState } from 'vuex'
141
-
142
- export default {
143
- name: 'InstructDetailsView',
144
- components: {
145
- JsonViewer,
146
- XTable
147
- },
148
- data () {
149
- return {
150
- // 页面宽度
151
- screenWidth: document.documentElement.clientWidth,
152
- // 指令详情
153
- details: {
154
- id: 0,
155
- userid: 0,
156
- f_meternumber: '',
157
- f_instruct_type: '',
158
- f_instruct_title: '',
159
- f_instruct_state: '待发送',
160
- f_receive_state: '',
161
- f_inputtor: '',
162
- f_alias: '',
163
- f_instruct_date: '',
164
- f_send_date: '',
165
- f_callback_date: '',
166
- f_instruct_meta_data: {},
167
- f_instruct_content: {}
168
- },
169
- // 当前步骤
170
- step: 0,
171
- // 当前状态,
172
- status: 'process',
173
- // 指令状态结果
174
- instructResult: '执行成功',
175
- // 档案详情组件显示
176
- detailVisible: false,
177
- // 查询的档案id
178
- selectUserId: undefined,
179
- // 档案id
180
- userId: undefined,
181
- // 指令详情加载
182
- loadInstructDetails: true,
183
- // 查询配置文件名
184
- queryParamsName: 'recordQueryParams',
185
- // 查询列集合
186
- showColumns: [],
187
- // queryJson加载是否完成
188
- loaded: false,
189
- // 查询操作日志表单
190
- form: {
191
- f_data_id: this.instructid,
192
- f_org_name: this.selectOrgName
193
- },
194
- operationTabList: [
195
- {
196
- key: '1',
197
- tab: '开发者信息'
198
- },
199
- {
200
- key: '2',
201
- tab: '操作日志'
202
- },
203
- {
204
- key: '3',
205
- tab: '维护教程'
206
- }
207
- ],
208
- operationActiveTabKey: '1'
209
- }
210
- },
211
- created () {
212
- this.getColumnsJson()
213
- },
214
- mounted () {
215
- this.initView()
216
- },
217
- computed: {
218
- ...mapState('account', { currUser: 'user' }),
219
- ...mapState('setting', ['isMobile'])
220
- },
221
- props: {
222
- instructid: {
223
- type: String,
224
- required: true
225
- },
226
- selectOrgName: {
227
- type: String,
228
- required: true
229
- },
230
- visible: {
231
- type: Boolean,
232
- default: false
233
- },
234
- isShowUserFiles: {
235
- type: Boolean,
236
- default: true
237
- }
238
- },
239
- methods: {
240
- // 初始化组件
241
- initView () {
242
- this.getInstruct(this.instructid, this.selectOrgName)
243
- },
244
- // 获取查询配置JSON
245
- getColumnsJson () {
246
- post(commonApi.getColumnsJson, { str: this.queryParamsName }).then((res) => {
247
- this.showColumns = res.columnJson
248
- this.loaded = true
249
- })
250
- },
251
- // 关闭抽屉时回调
252
- onClose () {
253
- this.$emit('update:visible', false)
254
- },
255
- // 加载xTable数据
256
- loadData (requestParameters, callback) {
257
- callback(query(requestParameters))
258
- },
259
- // 获取指令详情信息
260
- getInstruct (instructId, selectOrgName) {
261
- this.loadInstructDetails = true
262
- return post(InstructDetailsViewApi.getInstructDetails, {
263
- id: instructId,
264
- orgName: selectOrgName
265
- })
266
- .then(res => {
267
- this.details = res
268
- this.userId = res.userid + ''
269
- // 判断当前指令状态是不是最终流程
270
- if (this.details.f_instruct_state === '待发送') {
271
- this.status = 'process'
272
- this.step = 0
273
- this.instructResult = '执行成功'
274
- } else if (this.details.f_instruct_state === '已发送') {
275
- this.status = 'process'
276
- this.step = 1
277
- this.instructResult = '执行成功'
278
- } else {
279
- this.step = 2
280
- this.instructResult = this.details.f_instruct_state
281
- if (this.details.f_instruct_state === '发送失败' || this.details.f_instruct_state === '执行失败' ||
282
- this.details.f_instruct_state === '响应超时') {
283
- this.status = 'error'
284
- } else if (this.details.f_instruct_state === '忽略冗余' || this.details.f_instruct_state === '无响应' || this.details.f_instruct_state === '已延迟') {
285
- this.status = 'wait'
286
- } else {
287
- this.status = 'finish'
288
- }
289
- }
290
- this.loadInstructDetails = false
291
- }, err => {
292
- this.loadInstructDetails = false
293
- console.error(err)
294
- })
295
- },
296
- // 获取指令操作记录
297
- getRecord (requestParameters) {
298
- return post(InstructDetailsViewApi.getInstructRecordList, requestParameters)
299
- .then(res => {
300
- return res
301
- })
302
- },
303
- // 日期格式化
304
- format (date, format) {
305
- return formatDate(date, format)
306
- },
307
- // 重新发送指令
308
- againSend (id) {
309
- const _this = this
310
- this.$confirm({
311
- title: '您确定要重新发送该指令吗?',
312
- content: '指令状态将被标记为待发送',
313
- okText: '确定',
314
- okType: 'danger',
315
- cancelText: '取消',
316
- onOk () {
317
- return post(InstructDetailsViewApi.againSendInstruct, {
318
- id: id,
319
- orgName: _this.selectOrgName,
320
- username: _this.currUser.username
321
- }).then(res => {
322
- _this.getInstruct(id, _this.selectOrgName)
323
- if (res.nums === 1) {
324
- _this.$message.success('操作成功')
325
- } else {
326
- _this.$message.error('操作失败')
327
- }
328
- })
329
- }
330
- })
331
- },
332
- // 取消发送指令
333
- cancelSend (id) {
334
- const _this = this
335
- this.$confirm({
336
- title: '您确定要取消发送该指令吗?',
337
- content: '指令状态将被标记为忽略冗余',
338
- okText: '确定',
339
- okType: 'danger',
340
- cancelText: '取消',
341
- onOk () {
342
- return post(InstructDetailsViewApi.cancelSendInstruct, {
343
- id: id,
344
- orgName: _this.selectOrgName,
345
- username: _this.currUser.username
346
- }).then(res => {
347
- _this.getInstruct(id, _this.selectOrgName)
348
- if (res.nums === 1) {
349
- _this.$message.success('操作成功')
350
- } else {
351
- _this.$message.error('操作失败')
352
- }
353
- })
354
- }
355
- })
356
- },
357
- // 控制重新发送按钮的显示
358
- againSendBtnHide () {
359
- return this.step === 0 || this.loadInstructDetails
360
- },
361
- // 控制取消发送按钮的显示
362
- cancelSendBtnHide () {
363
- return (this.step !== 0 && this.step !== 1 && this.details.f_instruct_state !== '已延迟') || this.loadInstructDetails
364
- },
365
- // 转换JSON
366
- toJSON (value) {
367
- try {
368
- return JSON.parse(value)
369
- } catch (e) {
370
- return value
371
- }
372
- },
373
- // 获取指令过程说明
374
- getIntroduction () {
375
- if (this.step > 0) {
376
- return '已发送,等待响应结果'
377
- } else if (this.step === 0) {
378
- return ''
379
- }
380
- },
381
- // 获取指令结果说明
382
- getResultText (value) {
383
- if (this.step === 2) {
384
- if (value === '执行成功') {
385
- return '指令已发送成功'
386
- } else if (value === '执行失败') {
387
- return '失败,请查看响应结果'
388
- } else if (value === '忽略冗余') {
389
- return '指令已被取消发送'
390
- } else if (value === '无响应') {
391
- return '无法得到指令响应结果'
392
- } else if (value === '响应超时') {
393
- return '未得到指令响应结果'
394
- } else if (value === '已延迟') {
395
- return '由于表具限制,指令已被延迟发送'
396
- }
397
- }
398
- },
399
- // 打开档案详情抽屉
400
- openUserFilesDetails () {
401
- this.selectUserId = this.userId
402
- this.detailVisible = true
403
- }
404
- },
405
- watch: {
406
- 'visible' (val) {
407
- if (val) {
408
- this.initView()
409
- }
410
- }
411
- }
412
- }
413
- </script>
414
-
415
- <style lang="less" scoped>
416
- .detail-layout {
417
- margin-left: 44px;
418
- }
419
- .text {
420
- color: rgba(0, 0, 0, .45);
421
- }
422
-
423
- .heading {
424
- color: rgba(0, 0, 0, .85);
425
- font-size: 20px;
426
- }
427
-
428
- .no-data {
429
- color: rgba(0, 0, 0, .25);
430
- text-align: center;
431
- line-height: 64px;
432
- font-size: 16px;
433
-
434
- i {
435
- font-size: 24px;
436
- margin-right: 16px;
437
- position: relative;
438
- top: 3px;
439
- }
440
- }
441
-
442
- .mobile {
443
- .detail-layout {
444
- margin-left: unset;
445
- }
446
- .text {
447
-
448
- }
449
- .status-list {
450
- text-align: left;
451
- }
452
- }
453
-
454
- .row {
455
- display: flex;
456
-
457
- .content {
458
- -webkit-box-flex: 1;
459
- flex: auto;
460
- -ms-flex: auto;
461
- }
462
-
463
- .extra {
464
- flex: 0 1 auto;
465
- -webkit-box-flex: 0;
466
- -ms-flex: 0 1 auto;
467
- min-width: 242px;
468
- margin-left: 88px;
469
- text-align: right;
470
- }
471
- }
472
- </style>
1
+ <template>
2
+ <a-drawer
3
+ title="指令详情"
4
+ placement="right"
5
+ :width="isMobile ? screenWidth : screenWidth * 0.85"
6
+ :visible="visible"
7
+ @close="onClose"
8
+ >
9
+ <a-spin :spinning="loadInstructDetails">
10
+ <meter-details-view
11
+ :visible.sync="detailVisible"
12
+ :select-org-name="selectOrgName"
13
+ :userid="selectUserId"
14
+ v-if="selectUserId && isShowUserFiles"
15
+ />
16
+ <a-page-header
17
+ :title="'指令:' + details.f_instruct_type"
18
+ >
19
+ <div class="row">
20
+ <div class="content">
21
+ <a-descriptions size="small" :column="isMobile ? 1 : 2">
22
+ <a-descriptions-item label="指令编号" :span="isMobile ? 1 : 2">{{ details.id }}</a-descriptions-item>
23
+ <a-descriptions-item label="表编号">
24
+ <a v-if="isShowUserFiles" @click="openUserFilesDetails">{{ details.userid }}</a>
25
+ <span v-else>{{ details.userid }}</span>
26
+ </a-descriptions-item>
27
+ <a-descriptions-item label="表号">{{ details.f_meternumber }}</a-descriptions-item>
28
+ <a-descriptions-item label="操作人员">{{ details.f_inputtor }}</a-descriptions-item>
29
+ <a-descriptions-item label="指令说明">{{ details.f_instruct_title }}</a-descriptions-item>
30
+ <a-descriptions-item label="生成时间">{{ format(details.f_instruct_date,'yyyy-MM-dd hh:mm:ss') }}</a-descriptions-item>
31
+ <a-descriptions-item label="表厂别名">{{ details.f_alias }}</a-descriptions-item>
32
+ <a-descriptions-item label="最后发送时间">{{ format(details.f_send_date,'yyyy-MM-dd hh:mm:ss') }}</a-descriptions-item>
33
+ <a-descriptions-item label="最后响应时间">{{ format(details.f_callback_date,'yyyy-MM-dd hh:mm:ss') }}</a-descriptions-item>
34
+ </a-descriptions>
35
+ </div>
36
+ <div class="extra">
37
+ <a-row class="status-list">
38
+ <a-col :xs="12" :sm="24">
39
+ <div class="text">指令状态</div>
40
+ <div class="heading">
41
+ <x-badge :value="details.f_instruct_state" badge-key="instructStateMap" :is-external-text="true"/>
42
+ </div>
43
+ </a-col>
44
+ </a-row>
45
+ <p></p>
46
+ <a-row class="status-list">
47
+ <a-col :xs="12" :sm="24">
48
+ <div class="text">响应结果</div>
49
+ <div class="heading">{{ details.f_receive_state }}</div>
50
+ </a-col>
51
+ </a-row>
52
+ </div>
53
+ </div>
54
+
55
+ <!-- actions -->
56
+ <template v-slot:extra>
57
+ <a-button-group style="margin-right: 4px;">
58
+ <a-button type="dashed" @click="initView" :loading="loadInstructDetails">刷新</a-button>
59
+ </a-button-group>
60
+ <a-button-group style="margin-right: 4px;">
61
+ <a-popover title="重新发送" placement="bottomLeft">
62
+ <template slot="content">
63
+ <p>将指令标记为待发送状态</p>
64
+ <p>指令将在 定时器轮询/表具上报 后重新发送</p>
65
+ <p style="color: red">此操作不可撤销</p>
66
+ </template>
67
+ <a-button type="primary" @click="againSend(details.id)" :disabled="againSendBtnHide()">重新发送</a-button>
68
+ </a-popover>
69
+ <a-popover title="取消发送" placement="bottomLeft">
70
+ <template slot="content">
71
+ <p>该指令将被<span style="color: red;font-weight: bold">取消</span>,请谨慎操作</p>
72
+ <p>只有待发送或已发送的指令可以取消发送</p>
73
+ <p style="color: red">此操作不可撤销</p>
74
+ </template>
75
+ <a-button type="danger" @click="cancelSend(details.id)" :disabled="cancelSendBtnHide()">取消发送</a-button>
76
+ </a-popover>
77
+ </a-button-group>
78
+ </template>
79
+
80
+ <!-- 操作 -->
81
+ <a-card :bordered="false" title="指令状态">
82
+ <a-steps :direction="'horizontal'" :current="step" :status="status">
83
+ <a-step>
84
+ <template v-slot:title><span>待发送</span></template>
85
+ <template v-slot:description>
86
+ <div>指令已经就绪,待发送<div>{{ format(details.f_instruct_date,'yyyy-MM-dd hh:mm:ss') }}</div></div>
87
+ </template>
88
+ </a-step>
89
+ <a-step>
90
+ <template v-slot:title><span>已发送</span></template>
91
+ <template v-slot:description>
92
+ <div>{{ getIntroduction() }}<div>{{ format(details.f_send_date,'yyyy-MM-dd hh:mm:ss') }}</div></div>
93
+ </template>
94
+ </a-step>
95
+ <a-step>
96
+ <template v-slot:title><span>{{ instructResult }}</span></template>
97
+ <template v-slot:description>
98
+ <div>{{ getResultText(instructResult) }}<div>{{ format(details.f_callback_date,'yyyy-MM-dd hh:mm:ss') }}</div></div>
99
+ </template>
100
+ </a-step>
101
+ </a-steps>
102
+ </a-card>
103
+ <a-card
104
+ style="margin-top: 24px"
105
+ :bordered="false"
106
+ :tabList="operationTabList"
107
+ :activeTabKey="operationActiveTabKey"
108
+ @tabChange="(key) => {this.operationActiveTabKey = key}"
109
+ >
110
+ <div v-if="operationActiveTabKey === '1'">
111
+ <a-card type="inner" title="指令内容">
112
+ <json-viewer :copyable="{copyText: '复制', copiedText: '已复制'}" :value="details.f_instruct_content === undefined ? {} : toJSON(details.f_instruct_content)"></json-viewer>
113
+ </a-card>
114
+ <a-card type="inner" title="指令元数据">
115
+ <json-viewer :copyable="{copyText: '复制', copiedText: '已复制'}" :value="details.f_instruct_meta_data === undefined ? {} : toJSON(details.f_instruct_meta_data)"></json-viewer>
116
+ </a-card>
117
+ </div>
118
+
119
+ <x-table
120
+ v-if="loaded && operationActiveTabKey === '2'"
121
+ :json-data="showColumns"
122
+ :queryParamsName="queryParamsName"
123
+ @loadData="loadData"
124
+ :form="form"
125
+ />
126
+ <div v-else-if="operationActiveTabKey === '3'" class="no-data"><a-icon type="frown-o"/>暂无数据</div>
127
+ </a-card>
128
+ </a-page-header>
129
+ </a-spin>
130
+ </a-drawer>
131
+ </template>
132
+
133
+ <script>
134
+ import JsonViewer from 'vue-json-viewer'
135
+ import { formatDate } from '@vue2-client/utils/util'
136
+ import { InstructDetailsViewApi } from '@vue2-client/services/api/InstructDetailsViewApi'
137
+ import { post } from '@vue2-client/services/api/restTools'
138
+ import { query, commonApi } from '@vue2-client/services/api/common'
139
+ import XTable from '@vue2-client/base-client/components/common/XTable/XTable'
140
+ import { mapState } from 'vuex'
141
+
142
+ export default {
143
+ name: 'InstructDetailsView',
144
+ components: {
145
+ JsonViewer,
146
+ XTable
147
+ },
148
+ data () {
149
+ return {
150
+ // 页面宽度
151
+ screenWidth: document.documentElement.clientWidth,
152
+ // 指令详情
153
+ details: {
154
+ id: 0,
155
+ userid: 0,
156
+ f_meternumber: '',
157
+ f_instruct_type: '',
158
+ f_instruct_title: '',
159
+ f_instruct_state: '待发送',
160
+ f_receive_state: '',
161
+ f_inputtor: '',
162
+ f_alias: '',
163
+ f_instruct_date: '',
164
+ f_send_date: '',
165
+ f_callback_date: '',
166
+ f_instruct_meta_data: {},
167
+ f_instruct_content: {}
168
+ },
169
+ // 当前步骤
170
+ step: 0,
171
+ // 当前状态,
172
+ status: 'process',
173
+ // 指令状态结果
174
+ instructResult: '执行成功',
175
+ // 档案详情组件显示
176
+ detailVisible: false,
177
+ // 查询的档案id
178
+ selectUserId: undefined,
179
+ // 档案id
180
+ userId: undefined,
181
+ // 指令详情加载
182
+ loadInstructDetails: true,
183
+ // 查询配置文件名
184
+ queryParamsName: 'recordQueryParams',
185
+ // 查询列集合
186
+ showColumns: [],
187
+ // queryJson加载是否完成
188
+ loaded: false,
189
+ // 查询操作日志表单
190
+ form: {
191
+ f_data_id: this.instructid,
192
+ f_org_name: this.selectOrgName
193
+ },
194
+ operationTabList: [
195
+ {
196
+ key: '1',
197
+ tab: '开发者信息'
198
+ },
199
+ {
200
+ key: '2',
201
+ tab: '操作日志'
202
+ },
203
+ {
204
+ key: '3',
205
+ tab: '维护教程'
206
+ }
207
+ ],
208
+ operationActiveTabKey: '1'
209
+ }
210
+ },
211
+ created () {
212
+ this.getColumnsJson()
213
+ },
214
+ mounted () {
215
+ this.initView()
216
+ },
217
+ computed: {
218
+ ...mapState('account', { currUser: 'user' }),
219
+ ...mapState('setting', ['isMobile'])
220
+ },
221
+ props: {
222
+ instructid: {
223
+ type: String,
224
+ required: true
225
+ },
226
+ selectOrgName: {
227
+ type: String,
228
+ required: true
229
+ },
230
+ visible: {
231
+ type: Boolean,
232
+ default: false
233
+ },
234
+ isShowUserFiles: {
235
+ type: Boolean,
236
+ default: true
237
+ }
238
+ },
239
+ methods: {
240
+ // 初始化组件
241
+ initView () {
242
+ this.getInstruct(this.instructid, this.selectOrgName)
243
+ },
244
+ // 获取查询配置JSON
245
+ getColumnsJson () {
246
+ post(commonApi.getColumnsJson, { str: this.queryParamsName }).then((res) => {
247
+ this.showColumns = res.columnJson
248
+ this.loaded = true
249
+ })
250
+ },
251
+ // 关闭抽屉时回调
252
+ onClose () {
253
+ this.$emit('update:visible', false)
254
+ },
255
+ // 加载xTable数据
256
+ loadData (requestParameters, callback) {
257
+ callback(query(requestParameters))
258
+ },
259
+ // 获取指令详情信息
260
+ getInstruct (instructId, selectOrgName) {
261
+ this.loadInstructDetails = true
262
+ return post(InstructDetailsViewApi.getInstructDetails, {
263
+ id: instructId,
264
+ orgName: selectOrgName
265
+ })
266
+ .then(res => {
267
+ this.details = res
268
+ this.userId = res.userid + ''
269
+ // 判断当前指令状态是不是最终流程
270
+ if (this.details.f_instruct_state === '待发送') {
271
+ this.status = 'process'
272
+ this.step = 0
273
+ this.instructResult = '执行成功'
274
+ } else if (this.details.f_instruct_state === '已发送') {
275
+ this.status = 'process'
276
+ this.step = 1
277
+ this.instructResult = '执行成功'
278
+ } else {
279
+ this.step = 2
280
+ this.instructResult = this.details.f_instruct_state
281
+ if (this.details.f_instruct_state === '发送失败' || this.details.f_instruct_state === '执行失败' ||
282
+ this.details.f_instruct_state === '响应超时') {
283
+ this.status = 'error'
284
+ } else if (this.details.f_instruct_state === '忽略冗余' || this.details.f_instruct_state === '无响应' || this.details.f_instruct_state === '已延迟') {
285
+ this.status = 'wait'
286
+ } else {
287
+ this.status = 'finish'
288
+ }
289
+ }
290
+ this.loadInstructDetails = false
291
+ }, err => {
292
+ this.loadInstructDetails = false
293
+ console.error(err)
294
+ })
295
+ },
296
+ // 获取指令操作记录
297
+ getRecord (requestParameters) {
298
+ return post(InstructDetailsViewApi.getInstructRecordList, requestParameters)
299
+ .then(res => {
300
+ return res
301
+ })
302
+ },
303
+ // 日期格式化
304
+ format (date, format) {
305
+ return formatDate(date, format)
306
+ },
307
+ // 重新发送指令
308
+ againSend (id) {
309
+ const _this = this
310
+ this.$confirm({
311
+ title: '您确定要重新发送该指令吗?',
312
+ content: '指令状态将被标记为待发送',
313
+ okText: '确定',
314
+ okType: 'danger',
315
+ cancelText: '取消',
316
+ onOk () {
317
+ return post(InstructDetailsViewApi.againSendInstruct, {
318
+ id: id,
319
+ orgName: _this.selectOrgName,
320
+ username: _this.currUser.username
321
+ }).then(res => {
322
+ _this.getInstruct(id, _this.selectOrgName)
323
+ if (res.nums === 1) {
324
+ _this.$message.success('操作成功')
325
+ } else {
326
+ _this.$message.error('操作失败')
327
+ }
328
+ })
329
+ }
330
+ })
331
+ },
332
+ // 取消发送指令
333
+ cancelSend (id) {
334
+ const _this = this
335
+ this.$confirm({
336
+ title: '您确定要取消发送该指令吗?',
337
+ content: '指令状态将被标记为忽略冗余',
338
+ okText: '确定',
339
+ okType: 'danger',
340
+ cancelText: '取消',
341
+ onOk () {
342
+ return post(InstructDetailsViewApi.cancelSendInstruct, {
343
+ id: id,
344
+ orgName: _this.selectOrgName,
345
+ username: _this.currUser.username
346
+ }).then(res => {
347
+ _this.getInstruct(id, _this.selectOrgName)
348
+ if (res.nums === 1) {
349
+ _this.$message.success('操作成功')
350
+ } else {
351
+ _this.$message.error('操作失败')
352
+ }
353
+ })
354
+ }
355
+ })
356
+ },
357
+ // 控制重新发送按钮的显示
358
+ againSendBtnHide () {
359
+ return this.step === 0 || this.loadInstructDetails
360
+ },
361
+ // 控制取消发送按钮的显示
362
+ cancelSendBtnHide () {
363
+ return (this.step !== 0 && this.step !== 1 && this.details.f_instruct_state !== '已延迟') || this.loadInstructDetails
364
+ },
365
+ // 转换JSON
366
+ toJSON (value) {
367
+ try {
368
+ return JSON.parse(value)
369
+ } catch (e) {
370
+ return value
371
+ }
372
+ },
373
+ // 获取指令过程说明
374
+ getIntroduction () {
375
+ if (this.step > 0) {
376
+ return '已发送,等待响应结果'
377
+ } else if (this.step === 0) {
378
+ return ''
379
+ }
380
+ },
381
+ // 获取指令结果说明
382
+ getResultText (value) {
383
+ if (this.step === 2) {
384
+ if (value === '执行成功') {
385
+ return '指令已发送成功'
386
+ } else if (value === '执行失败') {
387
+ return '失败,请查看响应结果'
388
+ } else if (value === '忽略冗余') {
389
+ return '指令已被取消发送'
390
+ } else if (value === '无响应') {
391
+ return '无法得到指令响应结果'
392
+ } else if (value === '响应超时') {
393
+ return '未得到指令响应结果'
394
+ } else if (value === '已延迟') {
395
+ return '由于表具限制,指令已被延迟发送'
396
+ }
397
+ }
398
+ },
399
+ // 打开档案详情抽屉
400
+ openUserFilesDetails () {
401
+ this.selectUserId = this.userId
402
+ this.detailVisible = true
403
+ }
404
+ },
405
+ watch: {
406
+ 'visible' (val) {
407
+ if (val) {
408
+ this.initView()
409
+ }
410
+ }
411
+ }
412
+ }
413
+ </script>
414
+
415
+ <style lang="less" scoped>
416
+ .detail-layout {
417
+ margin-left: 44px;
418
+ }
419
+ .text {
420
+ color: rgba(0, 0, 0, .45);
421
+ }
422
+
423
+ .heading {
424
+ color: rgba(0, 0, 0, .85);
425
+ font-size: 20px;
426
+ }
427
+
428
+ .no-data {
429
+ color: rgba(0, 0, 0, .25);
430
+ text-align: center;
431
+ line-height: 64px;
432
+ font-size: 16px;
433
+
434
+ i {
435
+ font-size: 24px;
436
+ margin-right: 16px;
437
+ position: relative;
438
+ top: 3px;
439
+ }
440
+ }
441
+
442
+ .mobile {
443
+ .detail-layout {
444
+ margin-left: unset;
445
+ }
446
+ .text {
447
+
448
+ }
449
+ .status-list {
450
+ text-align: left;
451
+ }
452
+ }
453
+
454
+ .row {
455
+ display: flex;
456
+
457
+ .content {
458
+ -webkit-box-flex: 1;
459
+ flex: auto;
460
+ -ms-flex: auto;
461
+ }
462
+
463
+ .extra {
464
+ flex: 0 1 auto;
465
+ -webkit-box-flex: 0;
466
+ -ms-flex: 0 1 auto;
467
+ min-width: 242px;
468
+ margin-left: 88px;
469
+ text-align: right;
470
+ }
471
+ }
472
+ </style>