@94ai/softphone 6.0.5 → 6.0.7

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 (49) hide show
  1. package/lib/index.d.ts +60 -10
  2. package/lib/softphone.cjs.min.cjs +1 -1
  3. package/lib/softphone.esm-bundler.min.mjs +1 -1
  4. package/lib/softphone.umd.min.js +2 -2
  5. package/package.json +3 -1
  6. package/.yarnrc.yml +0 -19
  7. package/html-softphone-demo/CryptoJS.js +0 -3
  8. package/html-softphone-demo/README.md +0 -10
  9. package/html-softphone-demo/RootCA.pem +0 -20
  10. package/html-softphone-demo/WebrtcDiver.js +0 -320
  11. package/html-softphone-demo/antique_phone.mp3 +0 -0
  12. package/html-softphone-demo/cert.pem +0 -21
  13. package/html-softphone-demo/embed-ui/index.html +0 -123
  14. package/html-softphone-demo/embed-ui/softphone.js +0 -533
  15. package/html-softphone-demo/embed-ui/util.js +0 -123
  16. package/html-softphone-demo/fp.umd.min.js +0 -9
  17. package/html-softphone-demo/gg.xccjh.top.key +0 -27
  18. package/html-softphone-demo/gg.xccjh.top.pem +0 -61
  19. package/html-softphone-demo/index-channel.html +0 -904
  20. package/html-softphone-demo/index-local.html +0 -586
  21. package/html-softphone-demo/index-open.html +0 -617
  22. package/html-softphone-demo/index-switch-pcm.html +0 -613
  23. package/html-softphone-demo/index-test.html +0 -593
  24. package/html-softphone-demo/index-voice.html +0 -720
  25. package/html-softphone-demo/index.html +0 -1090
  26. package/html-softphone-demo/localhost.crt +0 -21
  27. package/html-softphone-demo/localhost.key +0 -28
  28. package/html-softphone-demo/micro-call-ui/CryptoJS.js +0 -3
  29. package/html-softphone-demo/micro-call-ui/draggable.html +0 -168
  30. package/html-softphone-demo/micro-call-ui/draggable.js +0 -1
  31. package/html-softphone-demo/micro-call-ui/index.html +0 -153
  32. package/html-softphone-demo/micro-call-ui/microphone.js +0 -824
  33. package/html-softphone-demo/micro-call-ui/qiankun.js +0 -2
  34. package/html-softphone-demo/micro-call-ui/util.js +0 -33
  35. package/html-softphone-demo/micro-call-ui/wujie.js +0 -3
  36. package/html-softphone-demo/pcm-player.js +0 -131
  37. package/html-softphone-demo/pcm-server/16bit-44100.pcm +0 -0
  38. package/html-softphone-demo/pcm-server/index.html +0 -110
  39. package/html-softphone-demo/pcm-server/server.js +0 -54
  40. package/html-softphone-demo/private.key +0 -28
  41. package/html-softphone-demo/softphone.umd.min.js +0 -2
  42. package/html-softphone-demo/tapd_35238004_base64_1695010473_859.gif +0 -0
  43. package/html-softphone-demo/test.html +0 -190
  44. package/html-softphone-demo/vue-esm-ui/common-ui.es.browser.js +0 -56545
  45. package/html-softphone-demo/vue-esm-ui/vue-esm.html +0 -2043
  46. package/html-softphone-demo/vue-sfc-ui/CryptoJS.js +0 -3
  47. package/html-softphone-demo/vue-sfc-ui/vue-sfc.html +0 -1858
  48. package/html-softphone-demo/vue-umd-ui/common-ui.umd.browser.js +0 -338
  49. package/html-softphone-demo/vue-umd-ui/vue-umd.html +0 -1978
@@ -1,1858 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang='en' class=''>
3
- <head>
4
- <meta charset='UTF-8'>
5
- <title>vue-sfc Demo</title>
6
- </head>
7
- <body>
8
- <noscript type="vue-sfc" component="MyComponent" mount="#app" lib="element-ui@2.13.2,common-ui@8.3.23">
9
- <template>
10
- <div class="demo">
11
- <el-row style="margin-top: 10px">
12
- <h3>1. 按钮和动态提示</h3>
13
- <span class="test-sass" @click="openNotify">测试sass,点击打开common-ui【通知】</span>
14
- <el-button @click="openMessage">element-ui按钮,点击提示common-ui【消息】</el-button>
15
- <nf-button type="danger" @click="drawer = true">common-ui按钮,点击打开common-ui【抽屉】</nf-button>
16
- <nf-button text type="danger" @click="openConfirm">带hover的自定义颜色文本,点击打开common-ui【弹框】</nf-button>
17
- <nf-drawer
18
- title="我是标题"
19
- :visible.sync="drawer"
20
- @confirm="handleConfirm"
21
- currentTab="高级配置"
22
- :tabs="tabs"
23
- >
24
- <div style="padding: 20px;" slot="tab-1">我是自定义的基础配置</div>
25
- <div style="padding: 20px;" slot="tab-2">我是自定义的高级配置</div>
26
- <div style="padding: 20px;" slot="tab-3">我是自定义的特殊配置</div>
27
- </nf-drawer>
28
- </el-row>
29
- <div style="margin-top: 10px">
30
- <h3>2. 输入框</h3>
31
- <el-input
32
- v-model="text"
33
- maxlength="100000"
34
- :show-word-limit="true"
35
- style='width: 500px;vertical-align: top'
36
- />
37
- <el-input
38
- style='width: 200px'
39
- type="textarea"
40
- v-model="textarea"
41
- maxlength="100000"
42
- :show-word-limit="true"
43
- />
44
- <el-divider>上面el-input</el-divider>
45
- <el-divider>下面nf-input</el-divider>
46
- <nf-input
47
- v-model="text"
48
- maxlength="100000"
49
- :show-word-limit="true"
50
- style='width: 500px;vertical-align: top'
51
- />
52
- <nf-input
53
- style='width: 200px'
54
- type="textarea"
55
- v-model="textarea"
56
- maxlength="100000"
57
- :show-word-limit="true"
58
- />
59
- </div>
60
- <div style="margin-top: 10px">
61
- <h3>3. 折叠检测器</h3>
62
- <nf-action style='width: fit-content;' :span='3'>
63
- <nf-button type="text" size="mini">导入</nf-button>
64
- <nf-button type="text" size="mini">详情</nf-button>
65
- <nf-button type="text" size="mini">复制</nf-button>
66
- <nf-button type="text" size="mini">停用</nf-button>
67
- <nf-button type="text" size="mini">启用</nf-button>
68
- <nf-button type="text" size="mini">编辑</nf-button>
69
- </nf-action>
70
- <span style="display: inline-block;margin-left: 20px;width: 360px;">
71
- <nf-text-overflow content="似水流年是一个人所有的一切,只有这个东西,才真正归你所有。其余的一切,都是片刻的欢娱和不幸,转眼间就已跑到那似水流年里去" />
72
- </span>
73
- </div>
74
- <div style="margin-top: 10px;">
75
- <h3>4. 标签</h3>
76
- <nf-tag style='margin-right: 20px;' type='success'>已通过</nf-tag>
77
- <nf-tag style='margin-right: 20px;' type='info'>已发布</nf-tag>
78
- <nf-tag style='margin-right: 20px;' type='disabled'>已删除</nf-tag>
79
- <nf-tag style='margin-right: 20px;' type='warning'>待处理</nf-tag>
80
- <nf-tag style='margin-right: 20px;' type='tip'>审核中</nf-tag>
81
- <nf-tag style='margin-right: 20px;' type='danger'>草稿发布失败</nf-tag>
82
- </div>
83
- <div style="margin-top: 10px;">
84
- <h3>5. 选择器</h3>
85
- <nf-radio-group
86
- style="display: inline-block"
87
- :groups="queryList"
88
- multiple
89
- @change="changeHandler"
90
- :value.sync="multipleActiveIndex"
91
- />
92
- </div>
93
- <div style="margin-top: 10px;">
94
- <h3>6. 虚拟滚动分页选择器</h3>
95
- <div style="width: 600px;">
96
- <!-- request 👈 定制分页请求方法,要求返回promise<{records: any[], total:number}>,入参({[pageNoAlias]: number,[pageSizeAlias]: number,[keywordAlias]: string}) -->
97
- <!-- pageSize 👈 定制每次分页请求数量 -->
98
- <!-- virtual-list 👈 默认不开启虚拟滚动,设置true开启 -->
99
- <!-- keeps 👈 默认30,定制虚拟滚动最多真实渲染的下拉项数量 -->
100
- <!-- key-value 👈 list每个数据项渲染对应的label和value对应的prop,类型[string, string],默认值['label', 'value'] -->
101
- <!-- data-key 👈 虚拟滚动要求在list每个数据项有一个唯一值,该属性用以指定数据项唯一值对应的prop,类型string -->
102
-
103
- <nf-lazy-select
104
- v-model="test"
105
-
106
- :request="testPage"
107
- :page-size='10'
108
- keyword-alias="keyword"
109
- page-no-alias="pageNo"
110
- page-size-alias="pageSize"
111
-
112
- loading-sesc='加载中...'
113
- no-data-text='无数据'
114
- placeholder='请输入英文字母'
115
-
116
- virtual-list
117
- :keeps='15'
118
- :key-value="['label', 'value']"
119
- data-key='value'
120
- multiple
121
- @change='testChange1'
122
- @input='testInput1'
123
- :visible-change-keyword-cached="true"
124
- :visible-change-select-list-cached="true"
125
- >
126
- <template slot='option' slot-scope="{row}">
127
- <span v-if='row.value == 0'>
128
- <span style='color: red' >label: 《{{row.label}}》</span> - value: 《{{row.value}}》
129
- </span>
130
- <span style='color: blue' v-if='row.value == 1'>{{row.label}}</span>
131
- <span v-if='row.value != 0 && row.value != 1'>{{row.label}}</span>
132
- </template>
133
- </nf-lazy-select>
134
-
135
- <el-divider>上面多选 </el-divider>
136
- <el-divider>下面单选 </el-divider>
137
-
138
- <nf-lazy-select
139
- v-model="test1"
140
-
141
- :request="testPage"
142
- @change='testChange2'
143
- @input='testInput2'
144
-
145
- :visible-change-keyword-cached="true"
146
- :visible-change-select-list-cached="true"
147
-
148
- :page-size='10'
149
- keyword-alias="keyword"
150
- page-no-alias="pageNo"
151
- page-size-alias="pageSize"
152
-
153
- loading-sesc='加载中...'
154
- no-data-text='无数据'
155
- placeholder='请输入英文字母'
156
-
157
- virtual-list
158
- :keeps='15'
159
- :key-value="['label', 'value']"
160
- data-key='value'
161
- />
162
-
163
-
164
- <el-divider>上面开启虚拟滚动 </el-divider>
165
- <el-divider>下面不开启虚拟滚动 </el-divider>
166
-
167
- <nf-lazy-select
168
- v-model="test2"
169
- @change='testChange3'
170
- @input='testInput3'
171
-
172
- :request="testPage"
173
- :pageSize='10'
174
-
175
- loading-desc='加载中...'
176
- no-data-text='无数据'
177
- placeholder='请输入英文字母'
178
-
179
- :key-value="['label', 'value']"
180
- >
181
- <template slot='option' slot-scope="{row}">
182
- <span v-if='row.value == 0'>
183
- <span style='color: red' >label: 《{{row.label}}》</span> - value: 《{{row.value}}》
184
- </span>
185
- <span style='color: blue' v-if='row.value == 1'>{{row.label}}</span>
186
- <span v-if='row.value != 0 && row.value != 1'>{{row.label}}</span>
187
- </template>
188
- </nf-lazy-select>
189
- </div>
190
- </div>
191
- <div style="margin-top: 10px;" :gutter="20">
192
- <h3>7. 关键词与变量</h3>
193
- <nf-keywords
194
- class="nf-keyword-html"
195
- style="width: 600px"
196
- :data="keywords"
197
- @delAll="delAllKeywordFn"
198
- @delItem="delItem"
199
- @copySuccess="copySuccess"
200
- :get-item-disabled-status="getItemDisabledStatus"
201
- />
202
- </div>
203
- <div style="margin-top: 10px;" :gutter="20">
204
- <h3>8. 音频组件</h3>
205
- <nf-button @click='betweenPlay' style='transform: translateY(-22px);'>区间播放</nf-button>
206
- <nf-audio
207
- style="display: inline-flex;"
208
- debuglog
209
- ref='nfAudio'
210
- :src='url'
211
- @download='download'
212
- :jump-time='jumpToTime'
213
- :back-second='backSecond'
214
- :forward-second='forwardSecond'
215
- :between-start='betweenStart'
216
- :between-end='betweenEnd'
217
- />
218
- </div>
219
- <div style="margin-top: 10px" >
220
- <h3>9. 空状态</h3>
221
- <el-row :gutter="20" style="width: 1200px">
222
- <el-col :span="6">
223
- <nf-empty type='message' border></nf-empty>
224
- </el-col>
225
- <el-col :span="6">
226
- <nf-empty type='internet' :image-size='145'></nf-empty>
227
- </el-col>
228
- <el-col :span="6">
229
- <nf-empty :image-size='140' type='authority'></nf-empty>
230
- </el-col>
231
- <el-col :span="6">
232
- <nf-empty :image-size='140' type='server'></nf-empty>
233
- </el-col>
234
- </el-row>
235
- </div>
236
- <div style="margin-top: 10px">
237
- <h3>10. 表格</h3>
238
- <nf-table
239
- ref='nfTable3'
240
- :data="showData"
241
- storage-key='nf-table-test3'
242
- :column-edit="true"
243
- :columns="nfTable.tableColumns3.value"
244
- :table-events="{
245
- select:nfTable.changeSelectFn3,
246
- 'select-all': nfTable.changeSelectAllFn3
247
- }"
248
- :table-attrs="{
249
- 'show-summary': true,
250
- 'summary-method': getSummaries,
251
- 'row-key': 'id'
252
- }"
253
- :loading='nfTable.searchForm3.value.loading'
254
- >
255
- <!-- 👈 上述只配置表格类属性和事件,下述其他通过slot定制 -->
256
- <!-- 定制列目显示 -->
257
- <el-button
258
- slot="columnEdit"
259
- @click="nfTable.columnEditDialog3()"
260
- class="nf-column-display"
261
- type="pripary"
262
- :plain="true"
263
- icon="el-icon-plus"
264
- size="mini"
265
- :round="false"
266
- :circle="false"
267
- :loading="false"
268
- :disabled="false"
269
- >
270
- slot定制表格列目显示隐藏
271
- </el-button>
272
- <!-- 定制表单 -->
273
- <nf-search-form
274
- slot="searchBox"
275
- :form-options="searchOptionTable"
276
- :label-width="80"
277
- storage-key='nf-search-form-test3'
278
- :column-edit='true'
279
- :columns="4"
280
- btn-model="inline"
281
- btn-items='search'
282
- @onSearch='nfTable.onSearch3'
283
- @onChange="nfTable.searchChange3"
284
- check-btn-text='slot定制表单列目显示隐藏'
285
- />
286
- <!-- 定制单个表格项 -->
287
- <span slot="operationName" slot-scope="scope" v-text='`${scope.row.operationName} ${scope.row.viceOperationName}`' />
288
- <span slot="operation" slot-scope="scope">
289
- <el-button size="mini" type="text" >详情</el-button>
290
- <el-button size="mini" type="text">编辑</el-button>
291
- <el-button size="mini" type="text">语音</el-button>
292
- </span>
293
- <!-- 定制单个表头 -->
294
- <span slot="completionRateHeader">
295
- <span style="margin-right: 4px;">任务完成率</span>
296
- <el-tooltip placement="right" effect="light">
297
- <div slot="content">累计完成率=(累计导入数-进行中外呼数)/累计导入数</div>
298
- <i class="iconfont icon-bangzhuzhongxin" style="font-weight: normal" />
299
- </el-tooltip>
300
- </span>
301
- <!-- 定制actionBar -->
302
- <span slot="actionBar">
303
- <el-checkbox style='margin-right: 20px;' @change='nfTable.selectAll3' v-model='nfTable.select3.value'>当页全选</el-checkbox>
304
- <el-button type="success" size='mini'>开启</el-button>
305
- <el-button type="danger" size='mini'> 暂停</el-button>
306
- <el-button type="danger" size='mini'>删除</el-button>
307
- </span>
308
- <!-- 定制empty -->
309
- <span slot="empty">
310
- 定制empty
311
- </span>
312
- <!-- 定制append -->
313
- <span slot="append">
314
- slot定制append
315
- </span>
316
- <!-- 定制分页 -->
317
- <span slot="pagination" style='float: right'>
318
- <el-pagination ref="nfTablePaginationRef" v-bind="pageAttrs" v-on="pageEvents" />
319
- </span>
320
- </nf-table>
321
-
322
- <el-divider> 上面当窗口很小时 操作列和选择列 固定横向拖拽(可以F12打开控制台缩小窗口试试)</el-divider>
323
- <el-divider> 下面配合nf-empty使用 </el-divider>
324
-
325
- <nf-table
326
- ref='nfTable4'
327
- :data="[]"
328
- storage-key='nf-table-test4'
329
- :column-edit="true"
330
- search-form-storage-key='nf-search-form-test4'
331
- :columns="nfTable.tableColumns5.value"
332
- :loading='nfTable.searchForm5.value.loading'
333
- >
334
- <!-- 去除searchBox -->
335
- <span slot="searchBox"></span>
336
- <!-- 定制append -->
337
- <span slot="append">
338
- slot定制append
339
- </span>
340
- <!-- 定制empty -->
341
- <nf-empty style='margin-top: 20px;' slot="empty" :image-size='145'></nf-empty>
342
- </nf-table>
343
- </div>
344
- <div style="margin-top: 10px">
345
- <h3>11. 表单</h3>
346
- <!-- form-options 👈 唯一必传,控制所有表单项目渲染的 json data(表单填充数据不用给,组件初始化后通过ref或@回调获取即可),其他所有属性可选 -->
347
- <!-- rules 👈 可选,定制表单校验规则 -->
348
-
349
- <!-- columns 👈 可选,几个表单项自动收起,默认自动检测为一行的数量 -->
350
- <!-- is-collapse 👈 可选,初始化是否展开 -->
351
-
352
- <!-- btn-items 👈 可选,开启默认按钮 -->
353
- <!-- reverse-btn-slot 👈 可选,反转自定义按钮slot和默认按钮的顺序 -->
354
-
355
- <!-- closable 👈 可选,打开控制显示每个表单项的显示隐藏icon,功能同 列编辑 异曲同工,默认false -->
356
- <!-- column-edit 👈 可选,开启列编辑,默认false -->
357
- <!-- check-mode 👈 可选,列编辑交互模式,默认drawer(drawer/dialog) -->
358
- <!-- storage-key 👈 可选,开启列编辑后必给,列编辑数据缓存key,用来做多个表单缓存命名空间区分,默认nf-search-form-columns-cached-key -->
359
- <!-- priority 👈 可选,开启列编辑后,打开列编辑弹框缓存回显列目项优先级,处理item.initHidden,table.showColumn和cookies.cached回显优先级,默认cached(cached/value) -->
360
-
361
- <!-- itemWidth 👈 可选,默认227, 每个search form item content的宽度定制,实现label上下布局(用于各种语言的最佳布局)表单项对齐,如果需要单独做一个定制宽度,form-options的每个item传入width即可 -->
362
-
363
- <!-- inline 👈 可选,行内表单,支持所有el-form属性设置 -->
364
- <!-- label-position 👈 可选,表单标签位置,同上,支持所有el-form属性设置 -->
365
- <!-- btn-model 👈 可选,操作按钮和自定义按钮slot是否单独一行,为了兼容ai-search-form默认继承了这个功能 -->
366
- <!-- btn-box-label 👈 可选,btn-model='inline'时,定制按钮slot和默认按钮作为最后一个form-item包裹在内,-->
367
- <!-- 该属性设置form-item的label,用来在上下label布局对齐高度,或手动改透明度组直接当作label用 -->
368
- <nf-search-form
369
- :form-options="searchOption"
370
- :rules='rules'
371
-
372
- :columns='columns'
373
- @isCollapseChange="isCollapseChange"
374
-
375
- :btn-items="btnItemList"
376
- @onSearch="searchFn"
377
- @onExport="exportFn"
378
- @onResetFields='resetFieldsFn'
379
-
380
- :closable='true'
381
- storage-key='nf-search-form-test1'
382
- :column-edit='true'
383
- check-mode='drawer'
384
-
385
- :inline='inline'
386
- :label-position='labelPosition'
387
- btn-model='inline'
388
- btn-box-label='自定按钮slot定制的内容 + 默认按钮:'
389
-
390
- ref='nfSearchFormRef'
391
- >
392
- <!-- slot='custumSlot' 👈 数字区间slot定制 -->
393
- <span slot="repeatCountAppend">Not</span>
394
- <span slot="doubleRepeatCountAppend">In</span>
395
- <span slot="doubleRepeatCountAppendSegment" class="iconfont icon-dao" style="margin: 0 5px" />
396
- <!-- slot='custumSlot' 👈 数据项slot定制 -->
397
- <el-input
398
- slot='custumSlot'
399
- v-model='searchForm.custumSlot'
400
- placehold='请输入'
401
- clearable
402
- prefix-icon="el-icon-search"
403
- suffix-icon="el-icon-date"
404
- style='display:inline-block;width: 100%'
405
- />
406
- <!-- slot='btnBox' 👈 操作按钮slot定制 -->
407
- <span slot='btnBox' style='align-self: self-start;margin-right: 10px;'>
408
- <div>
409
- <el-button size='mini' @click='inline=!inline'>切换块级</el-button>
410
- <el-button size='mini' @click='columns++'>增加折叠个数</el-button>
411
- <el-button size='mini' @click='columns--'>减少折叠个数</el-button>
412
- </div>
413
- <div>
414
- <el-button size='mini' @click='changeLabelPosition("top")'>表单项前缀向上</el-button>
415
- <el-button size='mini' @click='changeLabelPosition("right")'>表单项前缀向右</el-button>
416
- </div>
417
- <div>
418
- <el-button size='mini' @click='changeLabelPosition("left")'>表单项前缀向左</el-button>
419
- <el-button size='mini' type="primary" @click="submitForm()">表单校验</el-button>
420
- <el-button size='mini' @click="resetForm()">重置校验</el-button>
421
- </div>
422
- </span>
423
- </nf-search-form>
424
- </div>
425
- <div style="margin-top: 10px">
426
- <h3>12. 软电话</h3>
427
- <nf-microphone
428
- ref="nfSoftPhone1"
429
-
430
- :agentTag="agentTag"
431
- :appKey="appKey"
432
- :sign.sync='sign'
433
- :timestamp.sync='timestamp'
434
- extStatus="1"
435
-
436
- name="nf-softphone0"
437
- destination-origin="nf-softphone1"
438
- ancestor-origin="nf-softphone1"
439
-
440
- @softphone-connect="softphoneConnectCallBack1"
441
- @softphone-call-refresh="softphoneCallRefreshCallBack1"
442
- @softphone-seats-status-change="softphoneSeatStatusChangeCallBack1"
443
- @softphone-accept="softphoneAcceptCallBack1"
444
- @softphone-ignore="softphoneIgnoreCallBack1"
445
- @softphone-hangup="softphoneHangupCallBack1"
446
- @softphone-auto-ignore-callback="softphoneAutoIgnoreCallback1"
447
- @softphone-session-state-change="softphoneSessionStateChangeCallBack1"
448
- @softphone-incoming="softphoneIncomingCallBack1"
449
- @softphone-send-dtmf="softphoneSendDtmfCallBack1"
450
- @softphone-connect-registered="softphoneConnectRegisteredCallBack1"
451
- @softphone-sign-overdued="softphoneSignOverduedCallBack1"
452
- />
453
- </div>
454
- </div>
455
- </template>
456
- <script lang='ts' setup>
457
- import {
458
- ref,
459
- getCurrentInstance,
460
- reactive,
461
- computed
462
- } from 'vue'
463
-
464
- /**
465
- * nf-keyword
466
- */
467
- const keywords = ref([])
468
-
469
- const delAllKeywordFn = (tags) => {
470
- keywords.value = []
471
- console.log(tags)
472
- }
473
- const delItem = (item) => {
474
- console.log(item)
475
- }
476
- const copySuccess = (str) => {
477
- console.log(str)
478
- }
479
- const getItemDisabledStatus = (tag) => {
480
- if(tag.content === 'aa') {
481
- return true
482
- }
483
- return false
484
- }
485
- /**
486
- * nf-keyword
487
- */
488
- /**
489
- * nf-table
490
- */
491
- const deepClone = (source) => {
492
- if (!source && typeof source !== 'object') {
493
- throw new Error('error arguments shallowClone')
494
- }
495
- const targetObj: Record<string, any> | Record<string, any>[] = source.constructor === Array ? [] : {}
496
- Object.keys(source).forEach((keys) => {
497
- if (source[keys] && typeof source[keys] === 'object') {
498
- targetObj[keys] = source[keys].constructor === Array ? [] : {}
499
- targetObj[keys] = deepClone(source[keys])
500
- } else {
501
- targetObj[keys] = source[keys]
502
- }
503
- })
504
- return targetObj
505
- }
506
-
507
- /**
508
- 定制表格合计行的显示
509
- */
510
- const getSummaries = (param) => {
511
- const { columns, data } = param;
512
- const sums = [];
513
- columns.forEach((column, index) => {
514
- if (index === 0) {
515
- sums[index] = '汇总';
516
- return;
517
- }
518
- if (index === 1 || index === 2) {
519
- sums[index] = '--';
520
- return;
521
- }
522
- const values = data.map(item => Number(item[column.property]));
523
- if (!values.every(value => isNaN(value))) {
524
- sums[index] = values.reduce((prev, curr) => {
525
- const value = Number(curr);
526
- if (!isNaN(value)) {
527
- return prev + curr;
528
- } else {
529
- return prev;
530
- }
531
- }, 0);
532
- sums[index] += '%';
533
- } else {
534
- sums[index] = '--';
535
- }
536
- });
537
- return sums;
538
- };
539
- /**
540
- 用来模拟表单数据加载
541
- */
542
- const mockData = [
543
- {
544
- name: "复制_测试",
545
- startTime: "2022-12-21 00:00:00",
546
- companyName: "konghang",
547
- completionRate: 1,
548
- operationName: "a26",
549
- viceOperationName:"副负责人",
550
- address: 'xxx',
551
- id: 1,
552
- unit: 22,
553
- taskId: 1,
554
- getOptionsId: 1,
555
- },
556
- {
557
- name: "测试",
558
- startTime: "2022-12-25 00:00:00",
559
- companyName: "konghang1",
560
- completionRate: 0.6,
561
- operationName: "a28",
562
- viceOperationName:"副负责人",
563
- address: 'xxx',
564
- id: 2,
565
- unit: 22,
566
- taskId: 2,
567
- getOptionsId: 2,
568
- },
569
- ];
570
- /**
571
- 用来动态改变nf-search-form渲染框架的json data
572
- */
573
- const mockColumns = [
574
- {
575
- label: '启动日期',
576
- prop: 'startTime',
577
- labelTooltip: '启动日期labelTooltip',
578
- attr: {
579
- width: 200
580
- }
581
- },
582
- {
583
- label: '任务完成率',
584
- prop: 'completionRate',
585
- /** 定制表头slot */
586
- headerSlot: 'completionRateHeader',
587
- attr: {
588
- /** 定制formatter */
589
- formatter: row => {
590
- return `${row.completionRate}%`
591
- },
592
- 'min-width': 130
593
- }
594
- },
595
- {
596
- label: '运营负责人',
597
- prop: 'operationName',
598
- /** 定制slot */
599
- slot: 'operationName',
600
- attr: {
601
- 'min-width': 135
602
- }
603
- },
604
- {
605
- label: '操作',
606
- prop: 'operation',
607
- /** 定制动作slot */
608
- slot: 'operation',
609
- attr: {
610
- fixed: 'right',
611
- 'min-width': 200
612
- },
613
- }
614
- ];
615
- /**
616
- 定制nf-search-form渲染框架的json data
617
- */
618
- const searchOptionTable = ref([
619
- {
620
- label: '普通输入框',
621
- prop: 'normalInputBox',
622
- element: 'el-input',
623
- width: '200px',
624
- category: '分类一',
625
- placeholder: '选择右侧下拉查询新增表格数据'
626
- },
627
- {
628
- label: '数字输入框',
629
- prop: 'numberInputBox',
630
- element: 'el-input-number',
631
- class: 'nf-input-number-custom',
632
- placeholder: '这里输入后搜索即清空数据',
633
- width: '200px',
634
- category: '分类一'
635
- },
636
- {
637
- label: '普通下拉',
638
- prop: 'normalDropdown',
639
- element: 'el-select',
640
- 'data-key': 'value',
641
- options: [
642
- { label: '查询新增10条数据', value: 1 },
643
- { label: '查询数据结果为10条', value: 2 }
644
- ],
645
- category: '分类一'
646
- },
647
- {
648
- label: '虚拟下拉',
649
- prop: 'virtualDropdown',
650
- element: 'el-select',
651
- 'data-key': 'value',
652
- 'virtual-list': true,
653
- options: [
654
- { label: '给点意见', value: '1' },
655
- { label: '售后问题', value: '2' }
656
- ],
657
- category: '分类一'
658
- }
659
- ]);
660
- const nfTable = reactive({});
661
- const proxy = getCurrentInstance()?.proxy
662
- /**
663
- 通过方法批量产生demo数据
664
- */
665
- const useTableInteractiveProgram = (index) => {
666
- /**
667
- 表格配置
668
- */
669
- nfTable[`tableData${index}`] = ref([]);
670
- nfTable[`tableColumns${index}`] = ref([
671
- {
672
- label: '选择',
673
- type: 'selection',
674
- prop: 'selection',
675
- attr: {
676
- /** 固定死宽度 */
677
- width: '100px',
678
- fixed: 'left',
679
- align: 'center'
680
- }
681
- },
682
- {
683
- label: 'id',
684
- prop: 'id',
685
- attr: {
686
- /** 固定死宽度,拖拽最小值根据内容单行撑开的宽度最小值,常用做法 */
687
- width: '100px'
688
- }
689
- },
690
- {
691
- label: '编号',
692
- prop: 'taskId',
693
- attr: {
694
- /** 固定死宽度,拖拽最小值根据内容单行撑开的宽度最小值,常用做法 */
695
- width: '100px'
696
- }
697
- },
698
- {
699
- label: '任务名称',
700
- prop: 'name',
701
- attr: {
702
- /** 宽度最小值,同时也是拖拽最小值,一般很多表头项时设置width即可,不用设置min-width */
703
- 'min-width': '120px'
704
- }
705
- },
706
- {
707
- label: '所属企业',
708
- prop: 'companyName',
709
- attr: {
710
- /** 如果表头项很少可以设置min-width */
711
- 'min-width': 120
712
- }
713
- },
714
- {
715
- label: '启动日期',
716
- prop: 'startTime',
717
- attr: {
718
- /** 不设置默认根据分配高度自动折行 */
719
- /** width: 160 */
720
- }
721
- },
722
- {
723
- label: '操作',
724
- attr: {
725
- fixed: 'right',
726
- 'min-width': 200
727
- },
728
- prop: 'operation',
729
- operationList: [{
730
- name: '详情',
731
- onClick(row, scope) {
732
- alert('详情')
733
- console.log(row, scope)
734
- }
735
- }, {
736
- name: '编辑',
737
- onClick() {
738
- alert('编辑')
739
- }
740
- }, {
741
- name: '语音通知',
742
- onClick() {
743
- alert('语音通知')
744
- }
745
- }]
746
- }
747
- ]);
748
- /**
749
- actionBar配置
750
- */
751
- nfTable[`changeSelectFn${index}`] = (selection, row) => {
752
- if(selection.length === nfTable[`searchForm${index}`].value.pageSize) {
753
- nfTable[`select${index}`].value = true
754
- nfTable[`actionBarOptList${index}`].value[0].value = true;
755
- } else {
756
- nfTable[`select${index}`].value = false
757
- nfTable[`actionBarOptList${index}`].value[0].value = false;
758
- }
759
- };
760
- nfTable[`changeSelectAllFn${index}`] = (selection) => {
761
- if(selection.length === nfTable[`searchForm${index}`].value.pageSize) {
762
- nfTable[`select${index}`].value = true
763
- nfTable[`actionBarOptList${index}`].value[0].value = true;
764
- } else {
765
- nfTable[`select${index}`].value = false
766
- nfTable[`actionBarOptList${index}`].value[0].value = false;
767
- }
768
- };
769
- nfTable[`select${index}`] = ref();
770
- nfTable[`selectAll${index}`] = (val) => {
771
- nfTable[`select${index}`].value = val;
772
- proxy?.$refs[`nfTable${index}`]?.toggleAllSelection()
773
- };
774
- nfTable[`actionBarOptList${index}`] = ref([
775
- {
776
- element: 'el-checkbox',
777
- value: false,
778
- text: '当页全选',
779
- events: {
780
- change(val) {
781
- nfTable[`actionBarOptList${index}`].value[0].value = val;
782
- proxy?.$refs[`nfTable${index}`]?.toggleAllSelection()
783
- }
784
- }
785
- },
786
- {
787
- element: 'el-button',
788
- value: '开启',
789
- type: 'primary',
790
- events: {
791
- click() {
792
- alert('开启')
793
- }
794
- }
795
- },
796
- {
797
- element: 'el-button',
798
- value: '暂停',
799
- type: 'danger',
800
- events: {
801
- click() {
802
- alert('暂停')
803
- }
804
- }
805
- },
806
- {
807
- element: 'el-button',
808
- value: '删除',
809
- type: 'danger',
810
- events: {
811
- click() {
812
- alert('删除')
813
- }
814
- }
815
- }
816
- ]);
817
- /**
818
- mock数据
819
- */
820
- nfTable[`addTableData${index}`] = (repeat = 1, limit, immediately = false) => {
821
- nfTable[`searchForm${index}`].value.loading = true;
822
- const addData = () => {
823
- Array(repeat).fill(0).forEach(_ => nfTable[`tableData${index}`].value = nfTable[`tableData${index}`].value.concat(deepClone(mockData).map(itemM => {
824
- itemM.id = itemM.id + nfTable[`tableData${index}`].value.length;
825
- return itemM
826
- })));
827
- if (limit) {
828
- nfTable[`tableData${index}`].value = nfTable[`tableData${index}`].value.slice(0, limit)
829
- }
830
- nfTable[`searchForm${index}`].value.loading = false
831
- }
832
- if (immediately) {
833
- addData();
834
- } else {
835
- setTimeout(() => {
836
- addData();
837
- }, 1000)
838
- }
839
- };
840
- /**
841
- 表单配置
842
- */
843
- nfTable[`searchForm${index}`] = ref({
844
- pageNo: 1,
845
- pageSize: 3,
846
- loading: false,
847
- });
848
- nfTable[`searchChange${index}`] = (data) => {
849
- nfTable[`searchForm${index}`].value = {
850
- ...nfTable[`searchForm${index}`].value,
851
- ...data
852
- }
853
- };
854
- nfTable[`onSearch${index}`] = (data) => {
855
- const newAdd = data.normalDropdown === 2;
856
- const limitAdd = data.normalDropdown === 1;
857
- const numberInputBox = !!data.numberInputBox;
858
- if (numberInputBox) {
859
- nfTable[`tableData${index}`].value = [];
860
- return
861
- }
862
- nfTable[`addTableData${index}`](newAdd || limitAdd ? 5: 1, data.normalDropdown === 2 ? 10 : 0)
863
- };
864
- /**
865
- 分页配置
866
- */
867
- nfTable[`pageConfig${index}`] = computed(() => {
868
- const { pageNo, pageSize, loading } = nfTable[`searchForm${index}`].value;
869
- return {
870
- 'current-page': pageNo,
871
- 'page-size': pageSize,
872
- disabled: loading,
873
- }
874
- });
875
- nfTable[`pageSizeChangeFn${index}`] = (val) => {
876
- console.log(`pageSizeChangeFn${index}`, val);
877
- nfTable[`searchForm${index}`].value.pageSize = val
878
- };
879
- nfTable[`pageCurrentChangeFn${index}`] = (val) => {
880
- console.log(`pageCurrentChangeFn${index}`, val);
881
- nfTable[`searchForm${index}`].value.pageNo = val
882
- };
883
- /**
884
- columnEdit配置
885
- */
886
- nfTable[`columnEditDialog${index}`] = () => {
887
- if (proxy?.$refs[`nfTable${index}`]) {
888
- proxy.$refs[`nfTable${index}`].nfColumCheckDialogVisible = true
889
- }
890
- };
891
- };
892
- /**
893
- 初始化数据 👈 组装好所有需要的数据丢进nf-table即可
894
- */
895
- useTableInteractiveProgram(3);
896
- useTableInteractiveProgram(5);
897
- nfTable.addTableData3(2, 0, true);
898
- nfTable.addTableData5(2, 0, true);
899
- /**
900
- 补丁数据
901
- */
902
- nfTable.tableColumns3 = ref(deepClone(nfTable.tableColumns1?.value || []).slice(0, -2).concat(deepClone(mockColumns)));
903
-
904
- /**
905
- 由于使用了分页slot,这里自定义分页逻辑 - 前端分页
906
- */
907
- const showData = computed(() => {
908
- const list = nfTable.tableData3.value;
909
- const pageSize = pageAttrs.value['page-size'];
910
- const currentPage = pageAttrs.value['current-page'] || 1;
911
- if (list.length > pageSize) {
912
- return list.slice((currentPage - 1) * pageSize, currentPage * pageSize)
913
- } else {
914
- return list
915
- }
916
- });
917
- const pageAttrs = computed(() => {
918
- const { pageNo, pageSize, loading } = nfTable.searchForm3.value;
919
- return {
920
- background: false,
921
- layout: 'total, sizes, prev, pager, next',
922
- 'page-sizes': [3, 10, 20, 30, 40, 50, 100, 200],
923
- 'current-page': pageNo,
924
- 'page-size': pageSize,
925
- total: nfTable.tableData3.value.length,
926
- disabled: loading,
927
- }
928
- });
929
- const pageEvents = computed(() => {
930
- return {
931
- 'size-change':nfTable.pageSizeChangeFn3,
932
- 'current-change':nfTable.pageCurrentChangeFn3
933
- }
934
- });
935
- /**
936
- * nf-table
937
- */
938
- /**
939
- * nf-search-form
940
- */
941
- const EXCHANGE_KEY_TYPE = {
942
- range: 1, // 数组值分割多个字段
943
- multiple: 2, // 分割逗号
944
- }
945
- const nfSearchFormRef = ref()
946
-
947
- const columns = ref(6)
948
- const inline = ref(true)
949
- const labelPosition = ref('top')
950
- const changeLabelPosition = (val) => {
951
- labelPosition.value = val
952
- }
953
-
954
- const isCollapseChange = (collapse) => {
955
- console.log(collapse)
956
- }
957
-
958
- const rules = ref({
959
- normalInputBox: [
960
- { required: true, message: '支持校验', trigger: 'change' },
961
- { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'change' }
962
- ],
963
- })
964
-
965
- const btnItemList = ref([
966
- 'search',
967
- 'export',
968
- 'reset',
969
- {
970
- name: '自定义配置按钮',
971
- onClick(formData) {
972
- console.log('点击了自定义按钮', formData);
973
- }
974
- },
975
- {
976
- name: '动态展示按钮show(formData)',
977
- show(formData) {
978
- return formData.showKey === '3'
979
- }
980
- }
981
- ]);
982
-
983
- const submitForm = (formName) => {
984
- nfSearchFormRef.value?.onNfSearchFormValidate()
985
- };
986
- const resetForm = (formName) => {
987
- nfSearchFormRef.value?.resetNfSearchFormModel();
988
- };
989
-
990
- // 模拟后端接口
991
- const mockIndexSearch = ref(0);
992
- const mockKeywordIndexSearch = ref(0);
993
- const mockKeywordSearch = ref('');
994
- const testPageSearch = (param) => {
995
- return new Promise((resolve) => {
996
- setTimeout(() => {
997
- // 模拟后端接口关键字
998
- if (param.pageNo === 1) {
999
- mockIndexSearch.value = 0
1000
- mockKeywordIndexSearch.value = 0
1001
- }
1002
- console.log(param.pageNo)
1003
- if (param.keyword) {
1004
- mockIndexSearch.value = 0
1005
- if (mockKeywordSearch.value !== param.keyword) {
1006
- mockKeywordSearch.value = param.keyword
1007
- mockKeywordIndexSearch.value = 0
1008
- }
1009
- } else {
1010
- mockKeywordIndexSearch.value = 0
1011
- mockKeywordSearch.value = ''
1012
- }
1013
-
1014
- const mockData = {
1015
- records: [
1016
- {
1017
- value: (mockKeywordSearch.value ? mockKeywordSearchIndexSearch.value : mockIndexSearch.value)+((param.pageNo - 1)*4+0)+mockKeywordSearch.value,
1018
- label: (mockKeywordSearch.value ? mockKeywordSearchIndexSearch.value : mockIndexSearch.value)+((param.pageNo - 1)*4+0)+mockKeywordSearch.value,
1019
- },
1020
- {
1021
- value: (mockKeywordSearch.value ? mockKeywordSearchIndexSearch.value : mockIndexSearch.value)+((param.pageNo - 1)*4+1)+mockKeywordSearch.value,
1022
- label: (mockKeywordSearch.value ? mockKeywordSearchIndexSearch.value : mockIndexSearch.value)+((param.pageNo - 1)*4+1)+mockKeywordSearch.value,
1023
- },
1024
- {
1025
- value: (mockKeywordSearch.value ? mockKeywordSearchIndexSearch.value : mockIndexSearch.value)+((param.pageNo - 1)*4+2)+mockKeywordSearch.value,
1026
- label: (mockKeywordSearch.value ? mockKeywordSearchIndexSearch.value : mockIndexSearch.value)+((param.pageNo - 1)*4+2)+mockKeywordSearch.value,
1027
- },
1028
- {
1029
- value: (mockKeywordSearch.value ? mockKeywordSearchIndexSearch.value : mockIndexSearch.value)+((param.pageNo - 1)*4+3)+mockKeywordSearch.value,
1030
- label: (mockKeywordSearch.value ? mockKeywordSearchIndexSearch.value : mockIndexSearch.value)+((param.pageNo - 1)*4+3)+mockKeywordSearch.value,
1031
- }
1032
- ],
1033
- total: 100,
1034
- };
1035
- resolve(mockData)
1036
- }, 1000)
1037
- })
1038
- }
1039
-
1040
-
1041
- const searchOption = ref([
1042
- {
1043
- label: '普通输入框',
1044
- prop: 'normalInputBox',
1045
- element: 'el-input',
1046
- width: '200px',
1047
- category: '分类一',
1048
- isShowColon: true
1049
- },
1050
- {
1051
- label: '输入框带append',
1052
- prop: 'normalInputBox2',
1053
- element: 'el-input',
1054
- width: '200px',
1055
- category: '分类一',
1056
- isShowColon: true,
1057
- append: '元'
1058
- },
1059
- {
1060
- label: '输入框带prepend',
1061
- prop: 'normalInputBox3',
1062
- element: 'el-input',
1063
- width: '200px',
1064
- category: '分类一',
1065
- isShowColon: true,
1066
- prepend: '前prepend'
1067
- },
1068
- {
1069
- label: '数字输入框',
1070
- prop: 'numberInputBox',
1071
- element: 'el-input-number',
1072
- width: '200px',
1073
- category: '分类一'
1074
- },
1075
- {
1076
- label: '普通下拉',
1077
- prop: 'normalDropdown',
1078
- element: 'el-select',
1079
- 'data-key': 'value',
1080
- options: [
1081
- { label: '给点意见', value: '1' },
1082
- { label: '售后问题', value: '2' }
1083
- ],
1084
- category: '分类一'
1085
- },
1086
- {
1087
- label: '动态展示show(formData)',
1088
- prop: 'showKey',
1089
- element: 'el-select',
1090
- 'data-key': 'value',
1091
- options: [
1092
- { label: '展示所属企业form-item', value: '1' },
1093
- { label: '展示所属任务form-item', value: '2' },
1094
- { label: '展示"动态展示按钮"', value: '3' },
1095
- ],
1096
- category: '分类一'
1097
- },
1098
- {
1099
- label: '所属企业',
1100
- prop: 'companyId',
1101
- element: 'el-select',
1102
- 'data-key': 'value',
1103
- options: [
1104
- { label: '企业1', value: '1' },
1105
- { label: '企业2', value: '2' }
1106
- ],
1107
- show(formData) {
1108
- return formData.showKey === '1'
1109
- },
1110
- category: '分类一'
1111
- },
1112
- {
1113
- label: '所属任务',
1114
- prop: 'taskId',
1115
- element: 'el-select',
1116
- 'data-key': 'value',
1117
- options: [
1118
- { label: '任务1', value: '1' },
1119
- { label: '任务2', value: '2' }
1120
- ],
1121
- show(formData) {
1122
- return formData.showKey === '2'
1123
- },
1124
- category: '分类一'
1125
- },
1126
- {
1127
- label: 'changeProps下拉',
1128
- prop: 'changePropsKey',
1129
- element: 'el-select',
1130
- 'data-key': 'value',
1131
- options: [
1132
- { label: 'changeProps1', value: 1 },
1133
- { label: 'changeProps2', value: 2 }
1134
- ],
1135
- changeProps: ['getOptionsKey'],
1136
- category: '分类一'
1137
- },
1138
- {
1139
- label: 'getOptions下拉',
1140
- prop: 'getOptionsKey',
1141
- element: 'el-select',
1142
- 'data-key': 'value',
1143
- getOptions(callback, formData) {
1144
- console.log('获取到当前所依赖的表单数据', formData)
1145
- setTimeout(() => {
1146
- callback([
1147
- { label: 'getOptions1', value: '1' },
1148
- { label: 'getOptions2', value: '2' }
1149
- ])
1150
- }, 5000)
1151
- },
1152
- category: '分类一'
1153
- },
1154
- {
1155
- label: '日期区间配置(exchangeKey)',
1156
- prop: 'exchangeTime',
1157
- type: 'daterange',
1158
- element: 'el-date-picker',
1159
- category: '分类二',
1160
- exchangeKey: { type: EXCHANGE_KEY_TYPE.range, value: ['beginTime', 'endTime'] },
1161
- },
1162
- {
1163
- label: '全选下拉',
1164
- prop: 'multipleDropdown',
1165
- element: 'el-select',
1166
- multiple: true,
1167
- selectAll: true,
1168
- selectAllText: '我全都要',
1169
- 'data-key': 'value',
1170
- options: [{
1171
- value: '选项1',
1172
- label: '黄金糕'
1173
- }, {
1174
- value: '选项2',
1175
- label: '双皮奶'
1176
- }, {
1177
- value: '选项3',
1178
- label: '蚵仔煎'
1179
- }, {
1180
- value: '选项4',
1181
- label: '龙须面'
1182
- }, {
1183
- value: '选项5',
1184
- label: '北京烤鸭'
1185
- }, {
1186
- value: '选项6',
1187
- label: '干炒牛河'
1188
- }, {
1189
- value: '选项7',
1190
- label: '艇仔粥'
1191
- }, {
1192
- value: '选项8',
1193
- label: '油条'
1194
- }, {
1195
- value: '选项9',
1196
- label: '糯米鸡'
1197
- }],
1198
- category: '分类一'
1199
- },
1200
- {
1201
- label: '虚拟下拉',
1202
- prop: 'virtualDropdown',
1203
- element: 'el-select',
1204
- 'data-key': 'value',
1205
- 'virtual-list': true,
1206
- options: [
1207
- { label: '给点意见', value: '1' },
1208
- { label: '售后问题', value: '2' }
1209
- ],
1210
- category: '分类一'
1211
- },
1212
- {
1213
- label: '分页虚拟下拉',
1214
- prop: 'pageVirtualDropdown',
1215
- element: 'nf-lazy-select',
1216
- 'data-key': 'value',
1217
- 'virtual-list': true,
1218
- request: testPageSearch,
1219
- category: '分类一'
1220
- },
1221
- {
1222
- label: '多选穿梭',
1223
- prop: 'multipleChoiceShuttle',
1224
- element: 'nf-transfer-select',
1225
- initValue: [],
1226
- options:[{
1227
- value: '选项1',
1228
- label: '黄金糕'
1229
- }, {
1230
- value: '选项2',
1231
- label: '双皮奶'
1232
- }, {
1233
- value: '选项3',
1234
- label: '蚵仔煎'
1235
- }, {
1236
- value: '选项4',
1237
- label: '龙须面'
1238
- }, {
1239
- value: '选项5',
1240
- label: '北京烤鸭'
1241
- }],
1242
- category: '分类一'
1243
- },
1244
- {
1245
- label: '级联',
1246
- prop: 'elCascader',
1247
- element: 'el-cascader',
1248
- 'popper-class': 'nf-search-form-demo',
1249
- options: [{
1250
- value: 'zhinan',
1251
- label: '指南',
1252
- children: [{
1253
- value: 'shejiyuanze',
1254
- label: '设计原则',
1255
- children: [{
1256
- value: 'yizhi',
1257
- label: '一致'
1258
- }]
1259
- }, {
1260
- value: 'daohang',
1261
- label: '导航',
1262
- children: [{
1263
- value: 'cexiangdaohang',
1264
- label: '侧向导航'
1265
- }]
1266
- }]
1267
- }, {
1268
- value: 'zujian',
1269
- label: '组件',
1270
- children: [{
1271
- value: 'basic',
1272
- label: 'Basic',
1273
- children: [{
1274
- value: 'layout',
1275
- label: 'Layout 布局'
1276
- }]
1277
- }]
1278
- }, {
1279
- value: 'ziyuan',
1280
- label: '资源',
1281
- children: [{
1282
- value: 'axure',
1283
- label: 'Axure Components'
1284
- }]
1285
- }],
1286
- category: '分类一'
1287
- },
1288
- {
1289
- label: '任意时间点',
1290
- prop: 'anyPointInTime',
1291
- element: 'el-time-picker',
1292
- 'picker-options': {
1293
- start: '08:30',
1294
- step: '00:10',
1295
- end: '18:30'
1296
- },
1297
- category: '分类二'
1298
- },
1299
- {
1300
- label: '任意时间区间',
1301
- prop: 'anyTimeInterval',
1302
- element: 'el-time-picker',
1303
- 'is-range': true,
1304
- 'picker-options': {
1305
- start: '08:30',
1306
- step: '00:10',
1307
- end: '18:30'
1308
- },
1309
- category: '分类二'
1310
- },
1311
- {
1312
- label: '年份选择',
1313
- prop: 'year',
1314
- type: 'year',
1315
- element: 'el-date-picker',
1316
- category: '分类二'
1317
- },
1318
- {
1319
- label: '半年选择',
1320
- prop: 'halfyear',
1321
- element: 'nf-half-year-picker',
1322
- category: '分类二'
1323
- },
1324
- {
1325
- label: '季度选择',
1326
- prop: 'quarter',
1327
- element: 'nf-quarter-picker',
1328
- category: '分类二'
1329
- },
1330
- {
1331
- label: '月份选择',
1332
- prop: 'month',
1333
- type: 'month',
1334
- element: 'el-date-picker',
1335
- category: '分类二'
1336
- },
1337
- {
1338
- label: '周数选择',
1339
- prop: 'week',
1340
- type: 'week',
1341
- element: 'el-date-picker',
1342
- category: '分类二'
1343
- },
1344
- {
1345
- label: '日期选择',
1346
- prop: 'date',
1347
- type: 'date',
1348
- element: 'el-date-picker',
1349
- category: '分类二'
1350
- },
1351
- {
1352
- label: '日期区间',
1353
- prop: 'daterange',
1354
- type: 'daterange',
1355
- element: 'el-date-picker',
1356
- category: '分类二'
1357
- },
1358
- {
1359
- label: '周区间',
1360
- prop: 'weekrange',
1361
- element: 'nf-double-week',
1362
- category: '分类二'
1363
- },
1364
- {
1365
- label: '月份区间',
1366
- prop: 'monthrange',
1367
- type: 'monthrange',
1368
- element: 'el-date-picker',
1369
- category: '分类二'
1370
- },
1371
- {
1372
- label: '季度区间',
1373
- prop: 'quarterrange',
1374
- element: 'nf-double-quarter',
1375
- category: '分类二'
1376
- },
1377
- {
1378
- label: '半年区间',
1379
- prop: 'halfyearrrange',
1380
- element: 'nf-double-half-year',
1381
- category: '分类二'
1382
- },
1383
- {
1384
- label: '年区间',
1385
- prop: 'yearrrange',
1386
- element: 'nf-double-year',
1387
- category: '分类二'
1388
- },
1389
- {
1390
- label: '日期和时间点',
1391
- prop: 'datetime',
1392
- type: 'datetime',
1393
- element: 'el-date-picker',
1394
- category: '分类二'
1395
- },
1396
- {
1397
- label: '日期和时间范围',
1398
- prop: 'datetimerange',
1399
- type: 'datetimerange',
1400
- element: 'el-date-picker',
1401
- category: '分类二'
1402
- },
1403
- {
1404
- label: '固定时间',
1405
- prop: 'fixedtime',
1406
- element: 'el-time-select',
1407
- 'picker-options': {
1408
- start: '08:30',
1409
- step: '00:10',
1410
- end: '18:30'
1411
- },
1412
- category: '分类三'
1413
- },
1414
- {
1415
- label: '固定时间区间',
1416
- prop: 'fixedTimeInterval',
1417
- element: 'el-time-select',
1418
- type: 'datetimerange',
1419
- 'picker-options': {
1420
- start: '08:30',
1421
- step: '00:10',
1422
- end: '18:30'
1423
- },
1424
- category: '分类三'
1425
- },
1426
- {
1427
- label: '数字区间',
1428
- prop: 'numberRange',
1429
- element: 'number-range',
1430
- initValue: [],
1431
- min: 0,
1432
- category: '分类三',
1433
- class: 'number-range-box',
1434
- inputSlot: {
1435
- append: 'repeatCountAppend',
1436
- doubleAppend: 'doubleRepeatCountAppend',
1437
- doubleSegment: 'doubleRepeatCountAppendSegment',
1438
- },
1439
- tag: 'el-input',
1440
- events: {
1441
- input: (val) => {
1442
- let flag = false
1443
- const val0 = val[0]?.replace(/[^0-9]/g, '')
1444
- const val1 = val[1]?.replace(/[^0-9]/g, '')
1445
- if (val[0] && val0 != val[0]) {
1446
- flag = true
1447
- }
1448
- if (val[1] && val1 != val[1]) {
1449
- flag = true
1450
- }
1451
- if (flag && this.$refs.unfinishNfSearchForm) {
1452
- this.$refs.nfSearchForm.unfinishNfSearchForm.repeatCountVal = [val0, val1]
1453
- }
1454
- }
1455
- }
1456
- },
1457
- {
1458
- label: '自定义slot',
1459
- prop: 'custumSlot',
1460
- slot: 'custumSlot',
1461
- category: '分类四',
1462
- },
1463
- ])
1464
-
1465
- const searchForm = ref({
1466
- custumSlot: ''
1467
- })
1468
-
1469
- const searchFn = (data) => {
1470
- console.log(data)
1471
- searchForm.value = ref({
1472
- ...searchForm.value,
1473
- ...data
1474
- })
1475
- }
1476
- const resetFieldsFn = () => {
1477
- searchForm.value.custumSlot = ''
1478
- }
1479
- const exportFn = (data) => {
1480
- console.log(data)
1481
- }
1482
- /**
1483
- * nf-search-form
1484
- */
1485
- /**
1486
- * nf-lazy-select
1487
- */
1488
- const test = ref();
1489
- const test1 = ref();
1490
- const test2 = ref();
1491
- const testChange1 = () => {
1492
- console.log('testChange1')
1493
- }
1494
- const testChange2 = () => {
1495
- console.log('testChange2')
1496
- }
1497
- const testChange3 = () => {
1498
- console.log('testChange3')
1499
- }
1500
- const testInput1 = () => {
1501
- console.log('testInput1')
1502
- }
1503
- const testInput2 = () => {
1504
- console.log('testInput2')
1505
- }
1506
- const testInput3 = () => {
1507
- console.log('testInput3')
1508
- }
1509
-
1510
- // 模拟后端接口
1511
- const mockIndex = ref(0);
1512
- const mockKeywordIndex = ref(0);
1513
- const mockKeyword = ref('');
1514
- const testPage = (param) => {
1515
- return new Promise((resolve) => {
1516
- setTimeout(() => {
1517
- // 模拟后端接口关键字
1518
- if (param.pageNo === 1) {
1519
- mockIndex.value = 0
1520
- mockKeywordIndex.value = 0
1521
- }
1522
- console.log(param.pageNo)
1523
- if (param.keyword) {
1524
- mockIndex.value = 0
1525
- if (mockKeyword.value !== param.keyword) {
1526
- mockKeyword.value = param.keyword
1527
- mockKeywordIndex.value = 0
1528
- }
1529
- } else {
1530
- mockKeywordIndex.value = 0
1531
- mockKeyword.value = ''
1532
- }
1533
-
1534
- const mockData = {
1535
- records: [
1536
- {
1537
- value: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+0)+mockKeyword.value,
1538
- label: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+0)+mockKeyword.value + '显示',
1539
- a: 1,
1540
- },
1541
- {
1542
- value: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+1)+mockKeyword.value,
1543
- label: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+1)+mockKeyword.value + '显示'
1544
- },
1545
- {
1546
- value: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+2)+mockKeyword.value,
1547
- label: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+2)+mockKeyword.value + '显示'
1548
-
1549
- },
1550
- {
1551
- value: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+3)+mockKeyword.value,
1552
- label: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+3)+mockKeyword.value + '显示'
1553
- },
1554
- {
1555
- value: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+4)+mockKeyword.value,
1556
- label: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+4)+mockKeyword.value + '显示'
1557
- },
1558
- {
1559
- value: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+5)+mockKeyword.value,
1560
- label: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+5)+mockKeyword.value + '显示'
1561
- },
1562
- {
1563
- value: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+6)+mockKeyword.value,
1564
- label: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+6)+mockKeyword.value + '显示'
1565
-
1566
- },
1567
- {
1568
- value: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+7)+mockKeyword.value,
1569
- label: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+7)+mockKeyword.value + '显示'
1570
- },
1571
- {
1572
- value: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+8)+mockKeyword.value,
1573
- label: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+8)+mockKeyword.value + '显示'
1574
-
1575
- },
1576
- {
1577
- value: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+9)+mockKeyword.value,
1578
- label: (mockKeyword.value ? mockKeywordIndex.value : mockIndex.value)+((param.pageNo - 1)*10+9)+mockKeyword.value + '显示'
1579
- }
1580
- ],
1581
- total: 1000,
1582
- };
1583
- resolve(mockData)
1584
- }, 1000)
1585
- })
1586
- }
1587
- /**
1588
- * nf-lazy-select
1589
- */
1590
-
1591
- /**
1592
- * nf-radio
1593
- */
1594
- // 1-当天,2-按日,3-按周,4-按月
1595
- const TimeTypeMap = {
1596
- today: 1,
1597
- day: 2,
1598
- week: 3,
1599
- month: 4
1600
- }
1601
- const multipleActiveIndex = ref([TimeTypeMap['day']])
1602
- const queryList = ref([ {
1603
- name: '今日',
1604
- value: TimeTypeMap['today'],
1605
- tip: '',
1606
- },
1607
- {
1608
- name: '按日',
1609
- value: TimeTypeMap['day'],
1610
- tip: '按日统计,默认查询最近7天'
1611
- },
1612
- {
1613
- name: '按周',
1614
- value: TimeTypeMap['week'],
1615
- tip: '按周统计,默认查询最近4周,最近可选上一周'
1616
- },
1617
- {
1618
- name: '按月',
1619
- value: TimeTypeMap['month'],
1620
- tip: '按月统计,默认查询最近6个月,最近可选上一个月'
1621
- }
1622
- ])
1623
- const changeHandler = ({index,value}) => {
1624
- console.log(index)
1625
- console.log(value)
1626
- }
1627
- /**
1628
- * nf-radio
1629
- */
1630
-
1631
- /**
1632
- * nf-input
1633
- */
1634
- const text = ref('字数长度很长,自定义el-input背景可以看出展示会出现输入框文本被遮挡,nf-input做了数据统计遮挡优化')
1635
- const textarea = ref('字数长度很长,自定义el-input背景可以看出展示会出现输入框文本被遮挡,nf-input做了数据统计遮挡优化')
1636
- /**
1637
- * nf-input
1638
- */
1639
-
1640
- /**
1641
- * nf-drawer
1642
- */
1643
- const drawer = ref(false)
1644
- const tabs = ref([
1645
- { name: "基础配置", slot: "tab-1" },
1646
- { name: "高级配置", slot: "tab-2" },
1647
- { name: "特殊配置", slot: "tab-3" },
1648
- ]);
1649
- const handleConfirm = (done) => {
1650
- setTimeout(() => {
1651
- done()
1652
- }, 1000);
1653
- };
1654
- /**
1655
- * nf-drawer
1656
- */
1657
-
1658
- /**
1659
- * 动态提示
1660
- */
1661
- const app = getCurrentInstance()?.proxy
1662
- const openMessage = () => {
1663
- // app.$openMessage("这是一条消息提示");
1664
- // app.$openMessage.success("这是一条消息提示");
1665
- // app.$openMessage.warning("这是一条消息提示");
1666
- app.$openMessage.error("这是一条消息提示");
1667
- };
1668
- const openNotify = () => {
1669
- // app.$openNotify({
1670
- // title: "提示",
1671
- // message: "这是一条不会自动关闭的消息",
1672
- // duration: 0,
1673
- // });
1674
- app.$openNotify({
1675
- title: "成功",
1676
- message: "这是一条成功的提示消息",
1677
- type: "success",
1678
- });
1679
- // app.$openNotify({
1680
- // title: "警告",
1681
- // message: "这是一条警告的提示消息",
1682
- // type: "warning",
1683
- // });
1684
- // app.$openNotify.info({
1685
- // title: "消息",
1686
- // message: "这是一条消息的提示消息",
1687
- // });
1688
- // app.$openNotify.error({
1689
- // title: "错误",
1690
- // message: "这是一条错误的提示消息",
1691
- // })
1692
- };
1693
- const openConfirm = () => {
1694
- // app.$openConfirm({
1695
- // type: "success",
1696
- // title: "成功",
1697
- // message: "这是一条消息提示",
1698
- // onConfirm: (done) => done(),
1699
- // });
1700
- // app.$openConfirm.success({
1701
- // type: "warning",
1702
- // title: "警告",
1703
- // message: "这是一条警告消息提示",
1704
- // onConfirm: (done) => {
1705
- // setTimeout(() => {
1706
- // done();
1707
- // }, 1000);
1708
- // },
1709
- // });
1710
- app.$openConfirm({
1711
- type: "error",
1712
- title: "错误",
1713
- message: "这是一条错误消息提示",
1714
- onConfirm: (done) => done(),
1715
- });
1716
- // app.$openMessage({
1717
- // type: "info",
1718
- // title: "HTML 片段",
1719
- // message: '<strong>这是 <i>HTML</i> 片段</strong>',
1720
- // dangerouslyUseHTMLString: true,
1721
- // onConfirm: (done) => done(),
1722
- // });
1723
- // app.$openConfirm({
1724
- // title: "提示",
1725
- // message: "这是一条消息提示"
1726
- // }).then(done => {
1727
- // app.$openMessage("你点击了确定")
1728
- // setTimeout(()=>{
1729
- // done()
1730
- // }, 1000)
1731
- // }).catch(()=>{
1732
- // app.$openMessage("你点击了取消")
1733
- // })
1734
- };
1735
- /**
1736
- * 动态提示
1737
- */
1738
-
1739
- /**
1740
- * nf-audio
1741
- */
1742
- const betweenStart = ref(0.3)
1743
- const betweenEnd = ref(1.6)
1744
- const nfAudio = ref()
1745
- const url = 'https://oss.xccjh.top/xccjh-images/%E5%B0%8F%E4%B8%83-%E5%A5%B3-%E5%93%88%E5%93%88%E5%93%88%E5%93%88%E5%93%88%E5%93%88%E5%93%88%E5%93%88.wav'
1746
- const jumpToTime = 0.5
1747
- const backSecond = 0.3
1748
- const forwardSecond = 0.6
1749
- function download(){
1750
- alert('下载成功')
1751
- }
1752
- function betweenPlay() {
1753
- nfAudio.value.betweenPlay()
1754
- }
1755
- /**
1756
- * nf-audio
1757
- */
1758
-
1759
- /**
1760
- * nf-microphone
1761
- */
1762
- const sign = ref('')
1763
- const timestamp = ref(Date.now())
1764
-
1765
- const agentTag = 'zoujh-test'
1766
- const appKey = '032d44009bff1752'
1767
- const appSecret = '4c7304c94c5e8725613516d4d6db679b'
1768
-
1769
- const str = appKey + timestamp.value
1770
- const sha1 = window.CryptoJS.HmacSHA1(str, appSecret)
1771
- sign.value = window.CryptoJS.enc.Base64.stringify(sha1)
1772
-
1773
- const nfSoftPhone1 = ref()
1774
- const commonSoftphone = ref()
1775
-
1776
- const softphoneConnectCallBack1 = async (data) => {
1777
- console.log('softphone-connect1', data)
1778
- commonSoftphone.value = data.commonSoftphone
1779
- // await (await data.commonSoftphone.getUserAgentManager()).toggleNap(false)
1780
- }
1781
- const softphoneCallRefreshCallBack1 = (data) => {
1782
- console.log('softphone-call-refresh1', data)
1783
- }
1784
- const softphoneSeatStatusChangeCallBack1 = (data) => {
1785
- console.log('softphone-seats-status-change1', data)
1786
- }
1787
- const softphoneAcceptCallBack1 = (data) => {
1788
- console.log('softphone-accept1', data)
1789
- }
1790
- const softphoneIgnoreCallBack1 = (data) => {
1791
- console.log('softphone-ignore1', data)
1792
- }
1793
- const softphoneHangupCallBack1 = (data) => {
1794
- console.log('softphone-hangup1', data)
1795
- }
1796
- const softphoneAutoIgnoreCallback1 = (data) => {
1797
- console.log('softphone-auto-ignore-callback1', data)
1798
- }
1799
- const softphoneSessionStateChangeCallBack1 = (data) => {
1800
- console.log('softphone-session-state-change1', data)
1801
- }
1802
- const softphoneIncomingCallBack1 = (data) => {
1803
- console.log('softphone-incoming1', data)
1804
- }
1805
- const softphoneSendDtmfCallBack1 = (data) => {
1806
- console.log('softphone-send-dtmf1', data)
1807
- }
1808
- const softphoneConnectRegisteredCallBack1 = (data) => {
1809
- console.log('softphone-connect-registered1', data)
1810
- }
1811
-
1812
- const softphoneSignOverduedCallBack1 = (done) => {
1813
- console.log('softphone-sign-overdued1')
1814
- const timestamp = Date.now()
1815
- done({
1816
- timestamp,
1817
- sign: window.CryptoJS.enc.Base64.stringify(window.CryptoJS.HmacSHA1(appKey + timestamp, appSecret))
1818
- })
1819
- } // 👈 注册sign过期后重新刷新sign逻辑
1820
-
1821
- // setTimeout(() => {
1822
- // commonSoftphone.value.getUserAgentManagerSync().callNumber('15018707394')
1823
- // }, 5000)
1824
- /**
1825
- * nf-microphone
1826
- */
1827
-
1828
- </script>
1829
- <style lang="scss" scoped>
1830
- html,body {
1831
- padding: 0px;
1832
- .test-sass {
1833
- color: red;
1834
- margin-bottom: 10px;
1835
- }
1836
- .nf-keyword-html {
1837
- :deep(.nf-keyword-input-item-box) {
1838
- overflow-y: auto!important;
1839
- }
1840
- }
1841
- }
1842
- </style>
1843
- </noscript>
1844
- <div id="app"></div>
1845
- <script>
1846
- const process = {
1847
- env: {
1848
- NODE_ENV: 'production'
1849
- },
1850
- stdout: {
1851
- isTTY: false
1852
- }
1853
- }
1854
- </script>
1855
- <script src="https://unpkg.com/crypto-js@4.2.0/crypto-js.js"></script>
1856
- <script src="https://unpkg.com/@94ai/noscript-vue2-sfc-parser@1.1.18/index.js"></script>
1857
- </body>
1858
- </html>