vue2-client 1.1.0 → 1.2.2

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 (147) hide show
  1. package/.eslintrc.js +81 -81
  2. package/README.md +65 -63
  3. package/babel.config.js +15 -14
  4. package/docs/index.md +29 -29
  5. package/docs/notice.md +22 -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/assets/img/SunClientDownload.png +0 -0
  12. package/src/assets/img/SunClientManual/1.png +0 -0
  13. package/src/assets/img/SunClientManual/2.png +0 -0
  14. package/src/assets/img/SunClientManual/3.png +0 -0
  15. package/src/assets/img/SunClientManual/4.png +0 -0
  16. package/src/assets/img/ToDeskDownload.png +0 -0
  17. package/src/assets/img/ToDeskManual/1.png +0 -0
  18. package/src/assets/img/ToDeskManual/2.png +0 -0
  19. package/src/assets/img/ToDeskManual/3.png +0 -0
  20. package/src/assets/img/ToDeskManual/4.png +0 -0
  21. package/src/assets/sound/newNote.mp3 +0 -0
  22. package/src/base-client/all.js +57 -57
  23. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +1157 -1159
  24. package/src/base-client/components/common/CreateQuery/index.md +1 -1
  25. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +540 -540
  26. package/src/base-client/components/common/CreateSimpleFormQuery/index.md +1 -1
  27. package/src/base-client/components/common/CustomColumnsDrawer/index.md +1 -1
  28. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +150 -150
  29. package/src/base-client/components/common/FormGroupEdit/index.md +1 -1
  30. package/src/base-client/components/common/FormGroupQuery/index.md +1 -1
  31. package/src/base-client/components/common/XAddForm/XAddForm.vue +323 -323
  32. package/src/base-client/components/common/XAddForm/index.md +1 -1
  33. package/src/base-client/components/common/XBadge/index.md +1 -1
  34. package/src/base-client/components/common/XCard/index.md +1 -1
  35. package/src/base-client/components/common/XForm/XForm.vue +275 -275
  36. package/src/base-client/components/common/XForm/XFormItem.vue +217 -217
  37. package/src/base-client/components/common/XForm/index.md +196 -196
  38. package/src/base-client/components/common/XFormCol/index.md +1 -1
  39. package/src/base-client/components/common/XFormTable/XFormTable.vue +407 -405
  40. package/src/base-client/components/common/XFormTable/index.md +3 -3
  41. package/src/base-client/components/common/XTable/XTable.vue +262 -262
  42. package/src/base-client/components/common/XTable/index.md +255 -255
  43. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +1 -1
  44. package/src/base-client/components/iot/CustomerDetailsView/CustomerDetailsView.vue +226 -226
  45. package/src/base-client/components/iot/CustomerDetailsView/index.md +2 -2
  46. package/src/base-client/components/iot/DataAnalysisUser/DataAnalysisUser.vue +1 -1
  47. package/src/base-client/components/iot/DataAnalysisViewGD/DataAnalysisViewGD.vue +548 -548
  48. package/src/base-client/components/iot/DeviceBrandDetailsView/DeviceBrandDetailsView.vue +453 -453
  49. package/src/base-client/components/iot/DeviceDetailsView/DeviceDetailsView.vue +231 -231
  50. package/src/base-client/components/iot/DeviceDetailsView/index.md +1 -1
  51. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsCount.vue +330 -330
  52. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsException.vue +1 -1
  53. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsInstruct.vue +3 -3
  54. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsInstructOperate.vue +122 -122
  55. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsMain.vue +1 -1
  56. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsRead.vue +3 -3
  57. package/src/base-client/components/iot/DeviceTypeDetailsView/DeviceTypeDetailsView.vue +277 -277
  58. package/src/base-client/components/iot/InstructDetailsView/InstructDetailsView.vue +472 -472
  59. package/src/base-client/components/iot/InstructDetailsView/index.md +1 -1
  60. package/src/base-client/components/iot/LogDetailsView/LogDetailsView.vue +380 -380
  61. package/src/base-client/components/iot/LogDetailsView/index.md +1 -1
  62. package/src/base-client/components/iot/MeterDetailsView/MeterDetailsView.vue +360 -360
  63. package/src/base-client/components/iot/MeterDetailsView/index.md +1 -1
  64. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsCount.vue +335 -335
  65. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsException.vue +185 -185
  66. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsHandPlan.vue +292 -292
  67. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsInstruct.vue +237 -237
  68. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsMain.vue +257 -257
  69. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsSellGas.vue +190 -190
  70. package/src/base-client/components/iot/WebmeterAnalysisView/WebmeterAnalysisView.vue +723 -723
  71. package/src/base-client/components/iot/WebmeterAnalysisView/index.md +1 -1
  72. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
  73. package/src/base-client/components/system/DictionaryDetailsView/index.md +1 -1
  74. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +248 -248
  75. package/src/base-client/components/ticket/EmployeeDetailsView/EmployeeDetailsView.vue +371 -406
  76. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +838 -486
  77. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +261 -184
  78. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +528 -303
  79. package/src/base-client/plugins/AppData.js +69 -69
  80. package/src/base-client/plugins/GetLoginInfoService.js +221 -221
  81. package/src/base-client/plugins/index.js +21 -21
  82. package/src/bootstrap.js +27 -27
  83. package/src/components/Ellipsis/Ellipsis.vue +1 -1
  84. package/src/components/Ellipsis/index.md +2 -2
  85. package/src/components/NumberInfo/index.md +1 -1
  86. package/src/components/STable/README.md +3 -3
  87. package/src/components/Trend/index.md +1 -1
  88. package/src/components/cache/AKeepAlive.js +1 -1
  89. package/src/components/checkbox/index.js +2 -2
  90. package/src/components/index.js +15 -15
  91. package/src/components/menu/menu.js +1 -1
  92. package/src/components/setting/Setting.vue +4 -4
  93. package/src/components/table/advance/AdvanceTable.vue +3 -3
  94. package/src/components/transition/PageToggleTransition.vue +1 -1
  95. package/src/config/default/setting.config.js +33 -33
  96. package/src/layouts/CommonLayout.vue +1 -1
  97. package/src/layouts/ComponentLayoutOne.vue +47 -47
  98. package/src/layouts/PageLayout.vue +2 -2
  99. package/src/layouts/SinglePageView.vue +1 -1
  100. package/src/layouts/header/AdminHeader.vue +2 -2
  101. package/src/layouts/header/HeaderAvatar.vue +1 -1
  102. package/src/layouts/header/HeaderNotice.vue +97 -97
  103. package/src/layouts/tabs/TabsHead.vue +1 -1
  104. package/src/layouts/tabs/TabsView.vue +6 -6
  105. package/src/main.js +20 -20
  106. package/src/mock/common/reportData.js +20 -20
  107. package/src/mock/goods/index.js +2 -2
  108. package/src/mock/index.js +6 -6
  109. package/src/mock/project/index.js +1 -1
  110. package/src/mock/user/current.js +1 -1
  111. package/src/mock/user/login.js +1 -1
  112. package/src/mock/user/routes.js +61 -61
  113. package/src/mock/workplace/index.js +1 -1
  114. package/src/pages/exception/403.vue +25 -25
  115. package/src/pages/exception/404.vue +25 -25
  116. package/src/pages/exception/500.vue +25 -25
  117. package/src/pages/login/Login.vue +194 -194
  118. package/src/pages/report/ReportTable.js +125 -125
  119. package/src/pages/report/ReportTableHome.vue +28 -28
  120. package/src/pages/resourceManage/resourceManageMain.vue +55 -55
  121. package/src/pages/system/applyInstallView/Core.vue +1 -1
  122. package/src/pages/system/applyInstallView/index.vue +1 -1
  123. package/src/pages/system/dictionary/index.vue +1 -1
  124. package/src/pages/system/queryParams/index.vue +1 -1
  125. package/src/router/async/config.async.js +1 -1
  126. package/src/router/async/router.map.js +59 -59
  127. package/src/router/guards.js +3 -3
  128. package/src/router/index.js +27 -27
  129. package/src/services/api/EmployeeDetailsViewApi.js +3 -1
  130. package/src/services/api/TicketDetailsViewApi.js +9 -1
  131. package/src/services/api/common.js +37 -39
  132. package/src/services/api/restTools.js +23 -23
  133. package/src/services/dataSource.js +1 -1
  134. package/src/services/user.js +2 -2
  135. package/src/store/index.js +5 -5
  136. package/src/store/modules/setting.js +5 -5
  137. package/src/theme/index.less +5 -5
  138. package/src/theme/reportTable.less +58 -58
  139. package/src/utils/i18n.js +2 -2
  140. package/src/utils/indexedDB.js +146 -146
  141. package/src/utils/request.js +197 -197
  142. package/src/utils/routerUtil.js +18 -5
  143. package/tests/unit/ReportTable.spec.js +15 -15
  144. package/vue.config.js +153 -152
  145. package/webpack.config.js +12 -12
  146. package/src/index.js +0 -28
  147. package/src/router/config.js +0 -23
@@ -1,453 +1,453 @@
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
- <form-group-query
10
- @getColumnJson="getColumnJson"
11
- :visible.sync="createQueryVisible"
12
- @saveQueryParams="saveQueryParams"
13
- />
14
- <form-group-edit
15
- @getColumnJson="getColumnJson"
16
- :visible.sync="editQueryVisible"
17
- :modifyModelData="this.details.f_params_json ? JSON.parse(this.details.f_params_json) : {}"
18
- @onSubmit="saveDeviceParams"
19
- />
20
- <a-spin :spinning="loadDeviceBrandDetails">
21
- <a-page-header :title="details.f_brand">
22
- <div class="row">
23
- <div class="content">
24
- <a-descriptions size="small" :column="isMobile ? 1 : 2">
25
- <a-descriptions-item label="设备厂家">{{ details.f_manufactor }}</a-descriptions-item>
26
- <a-descriptions-item label="设备别名">{{ details.f_alias }}</a-descriptions-item>
27
- <a-descriptions-item label="设备兼容方式">{{ details.f_compatible_mode }}</a-descriptions-item>
28
- <a-descriptions-item label="创建人">{{ details.f_inputtor }}</a-descriptions-item>
29
- <a-descriptions-item label="创建时间">{{ details.f_input_date }}</a-descriptions-item>
30
- </a-descriptions>
31
- </div>
32
- </div>
33
- <!-- actions -->
34
- <template v-slot:extra>
35
- <a-button-group style="margin-right: 4px;">
36
- <a-button type="dashed" @click="initView" :loading="loadDeviceBrandDetails">刷新</a-button>
37
- </a-button-group>
38
- <a-button-group style="margin-right: 4px;">
39
- </a-button-group>
40
- </template>
41
- <template slot="footer">
42
- <a-tabs :default-active-key="tabActiveKey" :activeKey="tabActiveKey" @change="handleTabChange" style="margin-bottom: 23px;">
43
- <template v-for="value in tabList">
44
- <a-tab-pane :key="value.key" :tab="value.tab"/>
45
- </template>
46
- </a-tabs>
47
- <div v-if="!loadDeviceBrandDetails">
48
- <x-form-table
49
- v-if="tabActiveKey === '1'"
50
- title="设备型号"
51
- :fixed-add-form="fixedAddForm"
52
- :fixed-query-form="fixedQueryForm"
53
- queryParamsName="deviceModelQueryParams">
54
- </x-form-table>
55
- <div v-if="tabActiveKey === '2'">
56
- <a-transfer
57
- :data-source="mockData"
58
- :target-keys="targetKeys"
59
- :show-search="true"
60
- :titles="['已配置的指令', '可加入的指令']"
61
- :operations="['移除', '加入']"
62
- :filter-option="(inputValue, item) => item.title.indexOf(inputValue) !== -1"
63
- :show-select-all="false"
64
- @change="onChange"
65
- >
66
- <template
67
- slot="children"
68
- slot-scope="{
69
- props: { direction, filteredItems, selectedKeys, disabled: listDisabled },
70
- on: { itemSelectAll, itemSelect },
71
- }"
72
- >
73
- <a-table
74
- :row-selection="getRowSelection({ disabled: listDisabled, selectedKeys, itemSelectAll, itemSelect })"
75
- :columns="direction === 'left' ? leftColumns : rightColumns"
76
- :data-source="filteredItems"
77
- size="small"
78
- :style="{ pointerEvents: listDisabled ? 'none' : null }"
79
- :custom-row="({ key, disabled: itemDisabled }) => ({
80
- on: {
81
- click: () => {
82
- if (itemDisabled || listDisabled) return;
83
- itemSelect(key, !selectedKeys.includes(key));
84
- },
85
- },
86
- })"
87
- />
88
- </template>
89
- </a-transfer>
90
- <span :style="{ float: 'right', overflow: 'hidden', marginTop: '8px' }">
91
- <a-button-group>
92
- <a-button type="primary" @click="saveInstructType" :loading="saveInstructTypeLoading">保存配置</a-button>
93
- </a-button-group>
94
- </span>
95
- </div>
96
- <div v-if="tabActiveKey === '3'">
97
- <a-space>
98
- <a-button type="primary" @click="toCreateQuery">
99
- <a-icon :style="iconStyle" type="api"/>编辑设备品牌参数项
100
- </a-button>
101
- <a-button type="primary" @click="toEditQuery">
102
- <a-icon :style="iconStyle" type="interaction"/>设置参数项默认值
103
- </a-button>
104
- </a-space>
105
- <a-card title="设备品牌参数预览" :bordered="true" size="small" style="margin-top: 20px;">
106
- <json-viewer :copyable="{copyText: '复制', copiedText: '已复制'}" :value="getColumnJson()" :expand-depth="parseInt('100')" style="overflow: auto;max-height: 440px"></json-viewer>
107
- </a-card>
108
- </div>
109
- </div>
110
- </template>
111
- </a-page-header>
112
- </a-spin>
113
- </a-drawer>
114
- </template>
115
-
116
- <script>
117
- import JsonViewer from 'vue-json-viewer'
118
- import XFormTable from '@/base-client/components/common/XFormTable/XFormTable'
119
- import { DeviceBrandDetailsViewApi } from '@/services/api/DeviceBrandDetailsViewApi'
120
- import { post } from '@/services/api/restTools'
121
- import { mapGetters, mapState } from 'vuex'
122
-
123
- const leftTableColumns = [
124
- {
125
- dataIndex: 'title',
126
- title: '指令类型'
127
- },
128
- {
129
- dataIndex: 'description',
130
- title: '指令说明'
131
- }
132
- ]
133
-
134
- export default {
135
- name: 'DeviceBrandDetailsView',
136
- components: {
137
- JsonViewer,
138
- XFormTable
139
- },
140
- data () {
141
- return {
142
- // 页面宽度
143
- screenWidth: document.documentElement.clientWidth,
144
- // Tab页签
145
- tabActiveKey: '1',
146
- // 设备品牌详情
147
- details: {
148
- f_brand: '',
149
- f_alias: '',
150
- f_manufactor: '',
151
- f_compatible_mode: '',
152
- f_input_date: '',
153
- f_inputtor: '',
154
- f_brand_set_params_json: '',
155
- f_params_json: ''
156
- },
157
- // 图标样式
158
- iconStyle: {
159
- position: 'relative',
160
- top: '1px'
161
- },
162
- tabList: [
163
- { key: '1', tab: '设备型号' },
164
- { key: '2', tab: '指令配置' },
165
- { key: '3', tab: '参数项配置' }
166
- ],
167
- fixedAddForm: {},
168
- fixedQueryForm: {},
169
- // 是否显示生成查询配置抽屉
170
- createQueryVisible: false,
171
- // 是否显示修改设备品牌默认参数抽屉
172
- editQueryVisible: false,
173
- // 设备品牌详情加载
174
- loadDeviceBrandDetails: true,
175
- // 支持的指令保存加载
176
- saveInstructTypeLoading: false,
177
- // 穿梭框
178
- mockData: [],
179
- targetKeys: [],
180
- leftColumns: leftTableColumns,
181
- rightColumns: leftTableColumns
182
- }
183
- },
184
- mounted () {
185
- this.initView()
186
- },
187
- computed: {
188
- ...mapGetters(['account/user']),
189
- ...mapState('account', { currUser: 'user' }),
190
- ...mapState('setting', ['isMobile'])
191
- },
192
- props: {
193
- brandId: {
194
- type: String,
195
- required: true
196
- },
197
- visible: {
198
- type: Boolean,
199
- default: false
200
- }
201
- },
202
- methods: {
203
- // 初始化组件
204
- initView () {
205
- this.tabActiveKey = '1'
206
- this.fixedQueryForm['m_f_brand_id'] = this.brandId
207
- this.fixedAddForm['m_f_brand_id'] = this.brandId
208
- this.getDeviceBrand(this.brandId)
209
- },
210
- onClose () {
211
- this.$emit('update:visible', false)
212
- },
213
- // 通用徽标过滤器
214
- badgeFilter (key, value) {
215
- const object = this.$appdata.getParam(key)
216
- if (object.hasOwnProperty(value)) {
217
- return object[value]
218
- } else {
219
- return {
220
- 'status': 'default',
221
- 'text': '未知类型:' + value
222
- }
223
- }
224
- },
225
- // 获取设备品牌详情信息
226
- getDeviceBrand (brandId) {
227
- this.loadDeviceBrandDetails = true
228
- return post(DeviceBrandDetailsViewApi.getDeviceBrandDetails, {
229
- id: brandId
230
- }).then(res => {
231
- this.details = res
232
- this.loadDeviceBrandDetails = false
233
- }, err => {
234
- this.loadDeviceBrandDetails = false
235
- console.error(err)
236
- })
237
- },
238
- // Tab切换
239
- handleTabChange (key) {
240
- this.tabActiveKey = key
241
- if (key === '2') {
242
- this.getDeviceBrandInstruct(this.details.f_type_id)
243
- }
244
- },
245
- // 获取指令
246
- getDeviceBrandInstruct (typeId) {
247
- return post(DeviceBrandDetailsViewApi.getDeviceBrandInstructs, {
248
- typeId: typeId
249
- }).then(res => {
250
- for (const i of res.keys()) {
251
- res[i].key = res[i].key + ''
252
- res[i].disabled = false
253
- }
254
- const instructKeys = this.details.f_instruct_array ? this.details.f_instruct_array : []
255
- const resKeys = this.getRealTargetKeys(instructKeys, res)
256
- this.mockData = res
257
- this.targetKeys = resKeys
258
- }, err => {
259
- console.error(err)
260
- })
261
- },
262
- // 穿梭框
263
- onChange (nextTargetKeys) {
264
- this.targetKeys = nextTargetKeys
265
- },
266
- getRowSelection ({ disabled, selectedKeys, itemSelectAll, itemSelect }) {
267
- const _this = this
268
- return {
269
- getCheckboxProps: item => ({ props: { disabled: disabled || item.disabled } }),
270
- onSelectAll (selected, selectedRows) {
271
- const treeSelectedKeys = selectedRows
272
- .filter(item => !item.disabled)
273
- .map(({ key }) => key)
274
- const diffKeys = selected
275
- ? _this.difference(treeSelectedKeys, selectedKeys)
276
- : _this.difference(selectedKeys, treeSelectedKeys)
277
- itemSelectAll(diffKeys, selected)
278
- },
279
- onSelect ({ key }, selected) {
280
- itemSelect(key, selected)
281
- },
282
- selectedRowKeys: selectedKeys
283
- }
284
- },
285
- difference (keysA, keysB) {
286
- const result = []
287
- let isSame = false
288
- for (const itemA in keysA) {
289
- for (const itemB in keysB) {
290
- if (itemA === itemB) {
291
- isSame = true
292
- break
293
- }
294
- }
295
- if (!isSame) {
296
- result.push(itemA)
297
- }
298
- }
299
- return Object.assign(result, keysA)
300
- },
301
- saveInstructType () {
302
- this.saveInstructTypeLoading = true
303
- const resKeys = this.getRealTargetKeys(this.targetKeys, this.mockData)
304
- return post(DeviceBrandDetailsViewApi.updateBrandInstructKeys, {
305
- brandId: this.brandId,
306
- resKeys: resKeys
307
- }).then(res => {
308
- this.$message.success('保存成功')
309
- this.getDeviceBrand(this.brandId)
310
- this.saveInstructTypeLoading = false
311
- }, err => {
312
- console.error(err)
313
- this.saveInstructTypeLoading = false
314
- })
315
- },
316
- getRealTargetKeys (targetKeys, mockData) {
317
- const resKeys = mockData.map(({ key }) => key)
318
- for (const instructKey of targetKeys) {
319
- for (const i in resKeys) {
320
- if (instructKey === resKeys[i]) {
321
- resKeys.splice(i, 1)
322
- }
323
- }
324
- }
325
- return resKeys
326
- },
327
- toCreateQuery () {
328
- this.createQueryVisible = true
329
- },
330
- toEditQuery () {
331
- this.editQueryVisible = true
332
- },
333
- // 获取参数项配置
334
- getColumnJson (callback) {
335
- let data
336
- if (this.details.f_brand_set_params_json) {
337
- data = JSON.parse(this.details.f_brand_set_params_json)
338
- } else {
339
- data = {}
340
- }
341
- if (callback) {
342
- callback(data)
343
- }
344
- return data
345
- },
346
- // 存储查询配置信息
347
- saveQueryParams (source) {
348
- return post(DeviceBrandDetailsViewApi.updateDeviceBrandJsonParams, {
349
- id: this.brandId,
350
- source: source
351
- }).then(res => {
352
- this.$message.success('保存查询配置成功')
353
- this.getDeviceBrand(this.brandId)
354
- }, err => {
355
- console.error(err)
356
- })
357
- },
358
- // 存储设备品牌默认参数值
359
- saveDeviceParams (source, callback) {
360
- source['id'] = this.brandId
361
- return post(DeviceBrandDetailsViewApi.updateDeviceDefaultParams, source).then(res => {
362
- const result = true
363
- callback(result)
364
- this.initView()
365
- this.tabActiveKey = '3'
366
- }).catch(e => {
367
- const result = false
368
- callback(result)
369
- })
370
- }
371
- },
372
- watch: {
373
- 'visible' (val) {
374
- if (val) {
375
- this.initView()
376
- }
377
- }
378
- }
379
- }
380
- </script>
381
-
382
- <style lang="less" scoped>
383
- .business {
384
- color: #ffffff;
385
- }
386
- .business:enabled:hover {
387
- background-color: #85CE61 !important;
388
- border-color: #85CE61 !important;
389
- }
390
- .business:enabled {
391
- background-color: #67c23a;
392
- border-color: #67c23a;
393
- }
394
- .business:disabled {
395
- color: rgba(0, 0, 0, 0.25);
396
- }
397
- .detail-layout {
398
- margin-left: 44px;
399
- }
400
- .text {
401
- color: rgba(0, 0, 0, .45);
402
- }
403
-
404
- .heading {
405
- color: rgba(0, 0, 0, .85);
406
- font-size: 20px;
407
- }
408
-
409
- .no-data {
410
- color: rgba(0, 0, 0, .25);
411
- text-align: center;
412
- line-height: 64px;
413
- font-size: 16px;
414
-
415
- i {
416
- font-size: 24px;
417
- margin-right: 16px;
418
- position: relative;
419
- top: 3px;
420
- }
421
- }
422
-
423
- .mobile {
424
- .detail-layout {
425
- margin-left: unset;
426
- }
427
- .text {
428
-
429
- }
430
- .status-list {
431
- text-align: left;
432
- }
433
- }
434
-
435
- .row {
436
- display: flex;
437
-
438
- .content {
439
- -webkit-box-flex: 1;
440
- flex: auto;
441
- -ms-flex: auto;
442
- }
443
-
444
- .extra {
445
- flex: 0 1 auto;
446
- -webkit-box-flex: 0;
447
- -ms-flex: 0 1 auto;
448
- min-width: 242px;
449
- margin-left: 88px;
450
- text-align: right;
451
- }
452
- }
453
- </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
+ <form-group-query
10
+ @getColumnJson="getColumnJson"
11
+ :visible.sync="createQueryVisible"
12
+ @saveQueryParams="saveQueryParams"
13
+ />
14
+ <form-group-edit
15
+ @getColumnJson="getColumnJson"
16
+ :visible.sync="editQueryVisible"
17
+ :modifyModelData="this.details.f_params_json ? JSON.parse(this.details.f_params_json) : {}"
18
+ @onSubmit="saveDeviceParams"
19
+ />
20
+ <a-spin :spinning="loadDeviceBrandDetails">
21
+ <a-page-header :title="details.f_brand">
22
+ <div class="row">
23
+ <div class="content">
24
+ <a-descriptions size="small" :column="isMobile ? 1 : 2">
25
+ <a-descriptions-item label="设备厂家">{{ details.f_manufactor }}</a-descriptions-item>
26
+ <a-descriptions-item label="设备别名">{{ details.f_alias }}</a-descriptions-item>
27
+ <a-descriptions-item label="设备兼容方式">{{ details.f_compatible_mode }}</a-descriptions-item>
28
+ <a-descriptions-item label="创建人">{{ details.f_inputtor }}</a-descriptions-item>
29
+ <a-descriptions-item label="创建时间">{{ details.f_input_date }}</a-descriptions-item>
30
+ </a-descriptions>
31
+ </div>
32
+ </div>
33
+ <!-- actions -->
34
+ <template v-slot:extra>
35
+ <a-button-group style="margin-right: 4px;">
36
+ <a-button type="dashed" @click="initView" :loading="loadDeviceBrandDetails">刷新</a-button>
37
+ </a-button-group>
38
+ <a-button-group style="margin-right: 4px;">
39
+ </a-button-group>
40
+ </template>
41
+ <template slot="footer">
42
+ <a-tabs :default-active-key="tabActiveKey" :activeKey="tabActiveKey" @change="handleTabChange" style="margin-bottom: 23px;">
43
+ <template v-for="value in tabList">
44
+ <a-tab-pane :key="value.key" :tab="value.tab"/>
45
+ </template>
46
+ </a-tabs>
47
+ <div v-if="!loadDeviceBrandDetails">
48
+ <x-form-table
49
+ v-if="tabActiveKey === '1'"
50
+ title="设备型号"
51
+ :fixed-add-form="fixedAddForm"
52
+ :fixed-query-form="fixedQueryForm"
53
+ queryParamsName="deviceModelQueryParams">
54
+ </x-form-table>
55
+ <div v-if="tabActiveKey === '2'">
56
+ <a-transfer
57
+ :data-source="mockData"
58
+ :target-keys="targetKeys"
59
+ :show-search="true"
60
+ :titles="['已配置的指令', '可加入的指令']"
61
+ :operations="['移除', '加入']"
62
+ :filter-option="(inputValue, item) => item.title.indexOf(inputValue) !== -1"
63
+ :show-select-all="false"
64
+ @change="onChange"
65
+ >
66
+ <template
67
+ slot="children"
68
+ slot-scope="{
69
+ props: { direction, filteredItems, selectedKeys, disabled: listDisabled },
70
+ on: { itemSelectAll, itemSelect },
71
+ }"
72
+ >
73
+ <a-table
74
+ :row-selection="getRowSelection({ disabled: listDisabled, selectedKeys, itemSelectAll, itemSelect })"
75
+ :columns="direction === 'left' ? leftColumns : rightColumns"
76
+ :data-source="filteredItems"
77
+ size="small"
78
+ :style="{ pointerEvents: listDisabled ? 'none' : null }"
79
+ :custom-row="({ key, disabled: itemDisabled }) => ({
80
+ on: {
81
+ click: () => {
82
+ if (itemDisabled || listDisabled) return;
83
+ itemSelect(key, !selectedKeys.includes(key));
84
+ },
85
+ },
86
+ })"
87
+ />
88
+ </template>
89
+ </a-transfer>
90
+ <span :style="{ float: 'right', overflow: 'hidden', marginTop: '8px' }">
91
+ <a-button-group>
92
+ <a-button type="primary" @click="saveInstructType" :loading="saveInstructTypeLoading">保存配置</a-button>
93
+ </a-button-group>
94
+ </span>
95
+ </div>
96
+ <div v-if="tabActiveKey === '3'">
97
+ <a-space>
98
+ <a-button type="primary" @click="toCreateQuery">
99
+ <a-icon :style="iconStyle" type="api"/>编辑设备品牌参数项
100
+ </a-button>
101
+ <a-button type="primary" @click="toEditQuery">
102
+ <a-icon :style="iconStyle" type="interaction"/>设置参数项默认值
103
+ </a-button>
104
+ </a-space>
105
+ <a-card title="设备品牌参数预览" :bordered="true" size="small" style="margin-top: 20px;">
106
+ <json-viewer :copyable="{copyText: '复制', copiedText: '已复制'}" :value="getColumnJson()" :expand-depth="parseInt('100')" style="overflow: auto;max-height: 440px"></json-viewer>
107
+ </a-card>
108
+ </div>
109
+ </div>
110
+ </template>
111
+ </a-page-header>
112
+ </a-spin>
113
+ </a-drawer>
114
+ </template>
115
+
116
+ <script>
117
+ import JsonViewer from 'vue-json-viewer'
118
+ import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
119
+ import { DeviceBrandDetailsViewApi } from '@vue2-client/services/api/DeviceBrandDetailsViewApi'
120
+ import { post } from '@vue2-client/services/api/restTools'
121
+ import { mapGetters, mapState } from 'vuex'
122
+
123
+ const leftTableColumns = [
124
+ {
125
+ dataIndex: 'title',
126
+ title: '指令类型'
127
+ },
128
+ {
129
+ dataIndex: 'description',
130
+ title: '指令说明'
131
+ }
132
+ ]
133
+
134
+ export default {
135
+ name: 'DeviceBrandDetailsView',
136
+ components: {
137
+ JsonViewer,
138
+ XFormTable
139
+ },
140
+ data () {
141
+ return {
142
+ // 页面宽度
143
+ screenWidth: document.documentElement.clientWidth,
144
+ // Tab页签
145
+ tabActiveKey: '1',
146
+ // 设备品牌详情
147
+ details: {
148
+ f_brand: '',
149
+ f_alias: '',
150
+ f_manufactor: '',
151
+ f_compatible_mode: '',
152
+ f_input_date: '',
153
+ f_inputtor: '',
154
+ f_brand_set_params_json: '',
155
+ f_params_json: ''
156
+ },
157
+ // 图标样式
158
+ iconStyle: {
159
+ position: 'relative',
160
+ top: '1px'
161
+ },
162
+ tabList: [
163
+ { key: '1', tab: '设备型号' },
164
+ { key: '2', tab: '指令配置' },
165
+ { key: '3', tab: '参数项配置' }
166
+ ],
167
+ fixedAddForm: {},
168
+ fixedQueryForm: {},
169
+ // 是否显示生成查询配置抽屉
170
+ createQueryVisible: false,
171
+ // 是否显示修改设备品牌默认参数抽屉
172
+ editQueryVisible: false,
173
+ // 设备品牌详情加载
174
+ loadDeviceBrandDetails: true,
175
+ // 支持的指令保存加载
176
+ saveInstructTypeLoading: false,
177
+ // 穿梭框
178
+ mockData: [],
179
+ targetKeys: [],
180
+ leftColumns: leftTableColumns,
181
+ rightColumns: leftTableColumns
182
+ }
183
+ },
184
+ mounted () {
185
+ this.initView()
186
+ },
187
+ computed: {
188
+ ...mapGetters(['account/user']),
189
+ ...mapState('account', { currUser: 'user' }),
190
+ ...mapState('setting', ['isMobile'])
191
+ },
192
+ props: {
193
+ brandId: {
194
+ type: String,
195
+ required: true
196
+ },
197
+ visible: {
198
+ type: Boolean,
199
+ default: false
200
+ }
201
+ },
202
+ methods: {
203
+ // 初始化组件
204
+ initView () {
205
+ this.tabActiveKey = '1'
206
+ this.fixedQueryForm['m_f_brand_id'] = this.brandId
207
+ this.fixedAddForm['m_f_brand_id'] = this.brandId
208
+ this.getDeviceBrand(this.brandId)
209
+ },
210
+ onClose () {
211
+ this.$emit('update:visible', false)
212
+ },
213
+ // 通用徽标过滤器
214
+ badgeFilter (key, value) {
215
+ const object = this.$appdata.getParam(key)
216
+ if (object.hasOwnProperty(value)) {
217
+ return object[value]
218
+ } else {
219
+ return {
220
+ 'status': 'default',
221
+ 'text': '未知类型:' + value
222
+ }
223
+ }
224
+ },
225
+ // 获取设备品牌详情信息
226
+ getDeviceBrand (brandId) {
227
+ this.loadDeviceBrandDetails = true
228
+ return post(DeviceBrandDetailsViewApi.getDeviceBrandDetails, {
229
+ id: brandId
230
+ }).then(res => {
231
+ this.details = res
232
+ this.loadDeviceBrandDetails = false
233
+ }, err => {
234
+ this.loadDeviceBrandDetails = false
235
+ console.error(err)
236
+ })
237
+ },
238
+ // Tab切换
239
+ handleTabChange (key) {
240
+ this.tabActiveKey = key
241
+ if (key === '2') {
242
+ this.getDeviceBrandInstruct(this.details.f_type_id)
243
+ }
244
+ },
245
+ // 获取指令
246
+ getDeviceBrandInstruct (typeId) {
247
+ return post(DeviceBrandDetailsViewApi.getDeviceBrandInstructs, {
248
+ typeId: typeId
249
+ }).then(res => {
250
+ for (const i of res.keys()) {
251
+ res[i].key = res[i].key + ''
252
+ res[i].disabled = false
253
+ }
254
+ const instructKeys = this.details.f_instruct_array ? this.details.f_instruct_array : []
255
+ const resKeys = this.getRealTargetKeys(instructKeys, res)
256
+ this.mockData = res
257
+ this.targetKeys = resKeys
258
+ }, err => {
259
+ console.error(err)
260
+ })
261
+ },
262
+ // 穿梭框
263
+ onChange (nextTargetKeys) {
264
+ this.targetKeys = nextTargetKeys
265
+ },
266
+ getRowSelection ({ disabled, selectedKeys, itemSelectAll, itemSelect }) {
267
+ const _this = this
268
+ return {
269
+ getCheckboxProps: item => ({ props: { disabled: disabled || item.disabled } }),
270
+ onSelectAll (selected, selectedRows) {
271
+ const treeSelectedKeys = selectedRows
272
+ .filter(item => !item.disabled)
273
+ .map(({ key }) => key)
274
+ const diffKeys = selected
275
+ ? _this.difference(treeSelectedKeys, selectedKeys)
276
+ : _this.difference(selectedKeys, treeSelectedKeys)
277
+ itemSelectAll(diffKeys, selected)
278
+ },
279
+ onSelect ({ key }, selected) {
280
+ itemSelect(key, selected)
281
+ },
282
+ selectedRowKeys: selectedKeys
283
+ }
284
+ },
285
+ difference (keysA, keysB) {
286
+ const result = []
287
+ let isSame = false
288
+ for (const itemA in keysA) {
289
+ for (const itemB in keysB) {
290
+ if (itemA === itemB) {
291
+ isSame = true
292
+ break
293
+ }
294
+ }
295
+ if (!isSame) {
296
+ result.push(itemA)
297
+ }
298
+ }
299
+ return Object.assign(result, keysA)
300
+ },
301
+ saveInstructType () {
302
+ this.saveInstructTypeLoading = true
303
+ const resKeys = this.getRealTargetKeys(this.targetKeys, this.mockData)
304
+ return post(DeviceBrandDetailsViewApi.updateBrandInstructKeys, {
305
+ brandId: this.brandId,
306
+ resKeys: resKeys
307
+ }).then(res => {
308
+ this.$message.success('保存成功')
309
+ this.getDeviceBrand(this.brandId)
310
+ this.saveInstructTypeLoading = false
311
+ }, err => {
312
+ console.error(err)
313
+ this.saveInstructTypeLoading = false
314
+ })
315
+ },
316
+ getRealTargetKeys (targetKeys, mockData) {
317
+ const resKeys = mockData.map(({ key }) => key)
318
+ for (const instructKey of targetKeys) {
319
+ for (const i in resKeys) {
320
+ if (instructKey === resKeys[i]) {
321
+ resKeys.splice(i, 1)
322
+ }
323
+ }
324
+ }
325
+ return resKeys
326
+ },
327
+ toCreateQuery () {
328
+ this.createQueryVisible = true
329
+ },
330
+ toEditQuery () {
331
+ this.editQueryVisible = true
332
+ },
333
+ // 获取参数项配置
334
+ getColumnJson (callback) {
335
+ let data
336
+ if (this.details.f_brand_set_params_json) {
337
+ data = JSON.parse(this.details.f_brand_set_params_json)
338
+ } else {
339
+ data = {}
340
+ }
341
+ if (callback) {
342
+ callback(data)
343
+ }
344
+ return data
345
+ },
346
+ // 存储查询配置信息
347
+ saveQueryParams (source) {
348
+ return post(DeviceBrandDetailsViewApi.updateDeviceBrandJsonParams, {
349
+ id: this.brandId,
350
+ source: source
351
+ }).then(res => {
352
+ this.$message.success('保存查询配置成功')
353
+ this.getDeviceBrand(this.brandId)
354
+ }, err => {
355
+ console.error(err)
356
+ })
357
+ },
358
+ // 存储设备品牌默认参数值
359
+ saveDeviceParams (source, callback) {
360
+ source['id'] = this.brandId
361
+ return post(DeviceBrandDetailsViewApi.updateDeviceDefaultParams, source).then(res => {
362
+ const result = true
363
+ callback(result)
364
+ this.initView()
365
+ this.tabActiveKey = '3'
366
+ }).catch(e => {
367
+ const result = false
368
+ callback(result)
369
+ })
370
+ }
371
+ },
372
+ watch: {
373
+ 'visible' (val) {
374
+ if (val) {
375
+ this.initView()
376
+ }
377
+ }
378
+ }
379
+ }
380
+ </script>
381
+
382
+ <style lang="less" scoped>
383
+ .business {
384
+ color: #ffffff;
385
+ }
386
+ .business:enabled:hover {
387
+ background-color: #85CE61 !important;
388
+ border-color: #85CE61 !important;
389
+ }
390
+ .business:enabled {
391
+ background-color: #67c23a;
392
+ border-color: #67c23a;
393
+ }
394
+ .business:disabled {
395
+ color: rgba(0, 0, 0, 0.25);
396
+ }
397
+ .detail-layout {
398
+ margin-left: 44px;
399
+ }
400
+ .text {
401
+ color: rgba(0, 0, 0, .45);
402
+ }
403
+
404
+ .heading {
405
+ color: rgba(0, 0, 0, .85);
406
+ font-size: 20px;
407
+ }
408
+
409
+ .no-data {
410
+ color: rgba(0, 0, 0, .25);
411
+ text-align: center;
412
+ line-height: 64px;
413
+ font-size: 16px;
414
+
415
+ i {
416
+ font-size: 24px;
417
+ margin-right: 16px;
418
+ position: relative;
419
+ top: 3px;
420
+ }
421
+ }
422
+
423
+ .mobile {
424
+ .detail-layout {
425
+ margin-left: unset;
426
+ }
427
+ .text {
428
+
429
+ }
430
+ .status-list {
431
+ text-align: left;
432
+ }
433
+ }
434
+
435
+ .row {
436
+ display: flex;
437
+
438
+ .content {
439
+ -webkit-box-flex: 1;
440
+ flex: auto;
441
+ -ms-flex: auto;
442
+ }
443
+
444
+ .extra {
445
+ flex: 0 1 auto;
446
+ -webkit-box-flex: 0;
447
+ -ms-flex: 0 1 auto;
448
+ min-width: 242px;
449
+ margin-left: 88px;
450
+ text-align: right;
451
+ }
452
+ }
453
+ </style>