meixioacomponent 0.3.99 → 0.4.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meixioacomponent",
3
- "version": "0.3.99",
3
+ "version": "0.4.02",
4
4
  "private": false,
5
5
  "author": "YuRi",
6
6
  "main": "lib/meixioacomponent.umd.min.js",
@@ -23,6 +23,7 @@
23
23
  <div class="oa-pro-table-search">
24
24
  <oa_pro_table_searchVue
25
25
  v-model="module"
26
+ v-show="!isCheckTableRow"
26
27
  ref="oaProTableSearch"
27
28
  :screenList="screenList"
28
29
  :placeholder="placeholder"
@@ -34,6 +35,17 @@
34
35
  <slot name="search-extend"></slot>
35
36
  </template>
36
37
  </oa_pro_table_searchVue>
38
+
39
+ <oa_pro_table_check_handle_barVue
40
+ :del-fn="delFn"
41
+ :export-fn="exportFn"
42
+ v-if="isCheckTableRow"
43
+ :checked-value="tableCheckboxConfig.value"
44
+ >
45
+ <template slot="check-handle">
46
+ <slot name="check-handle-plugin"></slot>
47
+ </template>
48
+ </oa_pro_table_check_handle_barVue>
37
49
  </div>
38
50
 
39
51
  <!-- 表格内容 -->
@@ -216,6 +228,7 @@ import oa_pro_colum_configVue from './oa_pro_colum_config.vue' //表格列配置
216
228
  import oa_pro_table_skeletonVue from './oa_pro_table_skeleton.vue' //表格骨架屏
217
229
  import baseDefaultSvgVue from '../base/baseDefaultSvg/baseDefaultSvg.vue' //缺省页组件
218
230
  import baseButtonHandle from '../base/baseButtonHandle/baseButtonHandle.vue' //通用组件 排列尾部按钮的组件
231
+ import oa_pro_table_check_handle_barVue from './oa_pro_table_check_handle_bar.vue' // 当表格有行被选中的时候
219
232
 
220
233
  //
221
234
  import componentConfig from '../../config/componentConfig'
@@ -272,45 +285,7 @@ export default {
272
285
  this._linkViewClassSubs.init()
273
286
  }
274
287
  },
275
- computed: {
276
- config() {
277
- return {
278
- footHeight: 60,
279
- headerHeight: this.headerConfig ? 36 : 0,
280
- searchContentHeight: this.searchContentHeight,
281
- }
282
- },
283
288
 
284
- tableHeight() {
285
- return (
286
- this.$props.height -
287
- this.config.footHeight -
288
- this.config.headerHeight -
289
- this.config.searchContentHeight
290
- )
291
- },
292
- fixedList() {
293
- return this.$props.tableConfig.filter((item) => {
294
- const { lock } = item
295
- return lock && lock != 'right'
296
- })
297
- },
298
-
299
- module: {
300
- get() {
301
- return this.$props.value
302
- },
303
- set(val) {
304
- this.$emit('input', val)
305
- },
306
- },
307
-
308
- showTableHeader() {
309
- return this.$props.tableConfig.filter((item) => {
310
- return item.show
311
- })
312
- },
313
- },
314
289
  props: {
315
290
  // 当加载树形结构的表格时必须传入该值
316
291
  rowKey: {
@@ -437,6 +412,59 @@ export default {
437
412
  default: true,
438
413
  },
439
414
  },
415
+ computed: {
416
+ config() {
417
+ return {
418
+ footHeight: 60,
419
+ headerHeight: this.headerConfig ? 36 : 0,
420
+ searchContentHeight: this.searchContentHeight,
421
+ }
422
+ },
423
+
424
+ tableHeight() {
425
+ return (
426
+ this.$props.height -
427
+ this.config.footHeight -
428
+ this.config.headerHeight -
429
+ this.config.searchContentHeight
430
+ )
431
+ },
432
+ fixedList() {
433
+ return this.$props.tableConfig.filter((item) => {
434
+ const { lock } = item
435
+ return lock && lock != 'right'
436
+ })
437
+ },
438
+
439
+ module: {
440
+ get() {
441
+ return this.$props.value
442
+ },
443
+ set(val) {
444
+ this.$emit('input', val)
445
+ },
446
+ },
447
+
448
+ showTableHeader() {
449
+ return this.$props.tableConfig.filter((item) => {
450
+ return item.show
451
+ })
452
+ },
453
+
454
+ isCheckTableRow() {
455
+ const { tableCheckboxConfig } = this.$props
456
+ return tableCheckboxConfig.value.length > 0
457
+ },
458
+
459
+ // 行被选中删除的方法
460
+ delFn() {
461
+ return this._linkViewClassSubs.delFn || null
462
+ },
463
+ // 行被选中导出的方法
464
+ exportFn() {
465
+ return this._linkViewClassSubs.exportFn || null
466
+ },
467
+ },
440
468
  components: {
441
469
  oaProHeader,
442
470
  baseButtonHandle,
@@ -447,6 +475,7 @@ export default {
447
475
  oa_pro_table_searchVue,
448
476
  oa_pro_colum_configVue,
449
477
  oa_pro_table_skeletonVue,
478
+ oa_pro_table_check_handle_barVue,
450
479
  },
451
480
  methods: {
452
481
  isToolTip(value) {
@@ -695,13 +724,7 @@ export default {
695
724
  this.setTableData(res)
696
725
  } else {
697
726
  const tableData = res.tableData
698
- if (
699
- res._class.__proto__.__proto__.constructor.name ==
700
- 'LinkViewClass' &&
701
- !this._linkViewClassSubs
702
- ) {
703
- this._linkViewClassSubs = res._class
704
- }
727
+ this.setLinkViewClass(res)
705
728
  if (tableData) {
706
729
  this.setTableData(tableData)
707
730
  }
@@ -720,6 +743,16 @@ export default {
720
743
  }
721
744
  },
722
745
 
746
+ // 与oa 的页面表格类联动
747
+ setLinkViewClass(res) {
748
+ if (
749
+ res._class.__proto__.__proto__.constructor.name == 'LinkViewClass' &&
750
+ !this._linkViewClassSubs
751
+ ) {
752
+ this._linkViewClassSubs = res._class
753
+ }
754
+ },
755
+
723
756
  // 表格如果有滚动条将滚动条拉到顶部
724
757
  scrollToTop() {
725
758
  const { isAuth } = this.$props
@@ -796,6 +829,11 @@ export default {
796
829
  this.preSingleTableValue = val[0]
797
830
  tableCheckboxConfig.value = val
798
831
  } else {
832
+ if (val.length == 0) {
833
+ this.preSingleTableValue = null
834
+ tableCheckboxConfig.value = []
835
+ return
836
+ }
799
837
  let index = val.findIndex((item) => {
800
838
  return item == this.preSingleTableValue
801
839
  })
@@ -812,7 +850,6 @@ export default {
812
850
  } else {
813
851
  tableCheckboxConfig.value = val
814
852
  }
815
- //console.log(tableCheckboxConfig.value);
816
853
  },
817
854
 
818
855
  // 返回被选中的值
@@ -842,7 +879,7 @@ export default {
842
879
  clearTimeout(this.triggerDown)
843
880
  this.triggerDown = setTimeout(() => {
844
881
  this.tableDataCompleted()
845
- }, 1000)
882
+ }, 800)
846
883
  },
847
884
 
848
885
  tableDataCompleted() {
@@ -0,0 +1,78 @@
1
+ <template>
2
+ <div class="check-handle-bar-wrap">
3
+ <div class="handle-notify-data">
4
+ <span class="handle-text">
5
+ 已选中
6
+ <span style="color: var(--color-primary); margin: 0px var(--margin-2);">
7
+ {{ checkNum }}
8
+ </span>
9
+
10
+ </span>
11
+ </div>
12
+
13
+ <div class="handle-plugin-wrap">
14
+ <el-button
15
+ type="info"
16
+ size="mini"
17
+ icon="el-icon-upload2"
18
+ v-if="exportFn"
19
+ @click="exportFn"
20
+ >
21
+ 导出选中
22
+ </el-button>
23
+ <el-button
24
+ type="info"
25
+ size="mini"
26
+ v-if="delFn"
27
+ @click="delFn"
28
+ icon="el-icon-delete"
29
+ >
30
+ 删除
31
+ </el-button>
32
+
33
+ <slot name="check-handle"></slot>
34
+ </div>
35
+ </div>
36
+ </template>
37
+
38
+ <script>
39
+ export default {
40
+ data() {
41
+ return {}
42
+ },
43
+ props: {
44
+ delFn: {},
45
+ exportFn: {},
46
+ checkedValue: {},
47
+ },
48
+ computed: {
49
+ checkNum() {
50
+ const { checkedValue } = this.$props
51
+ return checkedValue.length
52
+ },
53
+ },
54
+ methods: {},
55
+ }
56
+ </script>
57
+
58
+ <style lang="less" scoped>
59
+ .check-handle-bar-wrap {
60
+ width: 100%;
61
+ height: 32px;
62
+ display: flex;
63
+ align-items: center;
64
+ margin: calc(var(--margin-5) * 2) 0px;
65
+
66
+ .handle-notify-data {
67
+ .handle-text {
68
+ color: var(--font-color-d);
69
+ font-size: var(--font-size-s);
70
+ margin-right: var(--margin-4);
71
+ font-weight: var(--font-weight-kg);
72
+ }
73
+ }
74
+ .handle-plugin-wrap {
75
+ display: flex;
76
+ }
77
+ }
78
+ </style>
@@ -2,46 +2,52 @@ import axios from 'axios'
2
2
  import { GetToken } from '../utils/utils.js'
3
3
  import componentConfig from './componentConfig.js'
4
4
 
5
- const ossInstance = (params, uploadProgressFn) => {
6
- // 创建 axios 实例
7
- const instance = axios.create({
8
- // API 请求的默认前缀
9
- baseURL: `${componentConfig.uploadUrl}`,
10
- })
11
5
 
12
- // 异常拦截处理器
13
- const errorHandler = (error) => {
14
- return Promise.reject(error)
15
- }
16
6
 
17
- // 响应异常拦截处理器
18
- const resErrorHandler = (error) => {
19
- // Message.error(`网络超时,请稍后重试`);
20
- // return errorHandler(error);
21
- }
7
+ export default (file, uploadProgressFn, sourceToken) => {
22
8
 
23
- // request 拦截器
24
- instance.interceptors.request.use((config) => {
25
- config.headers['Content-Type'] = 'multipart/form-data'
26
- config.headers['authorization'] = `Bearer ${GetToken('token')}`
27
- config.onUploadProgress = (progressEvent) => {
28
- if (uploadProgressFn) {
29
- const percent = (progressEvent.loaded / progressEvent.total) * 100 || 0
30
- uploadProgressFn(percent)
31
- }
9
+
10
+ const ossInstance = (params, uploadProgressFn) => {
11
+ // 创建 axios 实例
12
+ const instance = axios.create({
13
+ // API 请求的默认前缀
14
+ baseURL: `${componentConfig.uploadUrl}`,
15
+ })
16
+
17
+ // 异常拦截处理器
18
+ const errorHandler = (error) => {
19
+ return Promise.reject(error)
32
20
  }
33
- return config
34
- }, errorHandler)
21
+
22
+ // 响应异常拦截处理器
23
+ const resErrorHandler = (error) => {
24
+ // Message.error(`网络超时,请稍后重试`);
25
+ // return errorHandler(error);
26
+ }
27
+
28
+ // request 拦截器
29
+ instance.interceptors.request.use((config) => {
30
+ config.headers['Content-Type'] = 'multipart/form-data'
31
+ config.headers['authorization'] = `Bearer ${GetToken('token')}`
32
+ config.onUploadProgress = (progressEvent) => {
33
+ if (uploadProgressFn) {
34
+ const percent = (progressEvent.loaded / progressEvent.total) * 100 || 0
35
+ uploadProgressFn(percent)
36
+ }
37
+ }
38
+ return config
39
+ }, errorHandler)
40
+
41
+ // response 拦截器
42
+ instance.interceptors.response.use(async (response) => {
43
+ return response
44
+ }, resErrorHandler)
45
+
46
+ return instance(params)
47
+ }
35
48
 
36
- // response 拦截器
37
- instance.interceptors.response.use(async (response) => {
38
- return response
39
- }, resErrorHandler)
40
49
 
41
- return instance(params)
42
- }
43
50
 
44
- export default (file, uploadProgressFn, sourceToken) => {
45
51
  return new Promise((resolve, reject) => {
46
52
  const params = new FormData()
47
53
  params.append('file', file)
package/src/App.vue CHANGED
@@ -1,13 +1,7 @@
1
1
  <template>
2
2
  <div id="app">
3
3
  <div style="height: 100vh;">
4
- <!-- <testVue></testVue> -->
5
-
6
- <base-toggle
7
- :toggleList="toggleList"
8
- v-model="test"
9
- :disabled="true"
10
- ></base-toggle>
4
+ <testVue></testVue>
11
5
  </div>
12
6
  </div>
13
7
  </template>
@@ -1,6 +1,8 @@
1
1
  class LinkViewClass {
2
2
  constructor(params) {
3
3
  this.tableData = []
4
+ this.delFn = null
5
+ this.exportFn = null
4
6
  this.refreshTableData = null
5
7
  this.pageProps = {}
6
8
  this.pageConfig = {}