mali-applet-ui 1.1.36 → 1.1.37

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/env/index.d.ts CHANGED
@@ -5,4 +5,9 @@ export function sendMail(options: {
5
5
  receivedBy: string | string[]
6
6
  subject: string
7
7
  html: string
8
+ })
9
+ export function sendQyWechatMsg(webhook: string, params: {
10
+ content: string
11
+ mentionedList?: string[]
12
+ mentionedMobileList?: string[]
8
13
  })
package/env/index.js CHANGED
@@ -33,8 +33,26 @@ function sendMail ({ receivedBy, subject, html }) {
33
33
  })
34
34
  }
35
35
 
36
+ function sendQyWechatMsg (webhook, params) {
37
+ if (!webhook) {
38
+ throw new Error('企微机器人 webhook 地址不能为空')
39
+ }
40
+ return axios.post(webhook, {
41
+ msgtype: 'markdown',
42
+ markdown: {
43
+ content: params.content || '',
44
+ mentioned_list: params.mentionedList || [],
45
+ mentioned_mobile_list: params.mentionedMobileList || []
46
+ }
47
+ }).then(res => {
48
+ return res.data
49
+ })
50
+ }
51
+
36
52
  exports.sendMail = sendMail
53
+ exports.sendQyWechatMsg = sendQyWechatMsg
37
54
 
38
55
  module.exports = {
39
- sendMail
56
+ sendMail,
57
+ sendQyWechatMsg
40
58
  }
@@ -6,7 +6,7 @@
6
6
  <view class="ml-table-warpper" :style="tableStyle">
7
7
  <view class="table-header">
8
8
  <view class="table-column-header">
9
- <view class="table-tr">
9
+ <view class="ml-table-tr">
10
10
  <view v-for="(column, columnIndex) in tableColumn" :key="columnIndex" class="table-th" :class="{'is-sort': !!column.sortable}" :style="{width: getColWidth(column)}" @click="chickThEvent({ column, columnIndex })">
11
11
  <view class="th-title">{{ column.title }}</view>
12
12
  <view class="th-sort" v-if="column.sortable">
@@ -21,9 +21,9 @@
21
21
  </view>
22
22
  </view>
23
23
  <view v-if="headerData && headerData.length" class="table-body-top">
24
- <view class="table-tr" v-for="(row, rowIndex) in headerData" :key="rowIndex">
25
- <view class="table-td" v-for="(column, columnIndex) in tableColumn" :key="columnIndex" :style="{width: getColWidth(column)}" @click="cellHeaderTdClick({ type: 'header', row, rowIndex, column, columnIndex })">
26
- <view :class="['table-cell', column.align ? `align-${column.align}` : '', getHeaderCellClass({ type: 'header', row, rowIndex, column, columnIndex })]">
24
+ <view class="ml-table-tr" v-for="(row, rowIndex) in headerData" :key="rowIndex">
25
+ <view class="ml-table-td" v-for="(column, columnIndex) in tableColumn" :key="columnIndex" :style="{width: getColWidth(column)}" @click="cellHeaderTdClick({ type: 'header', row, rowIndex, column, columnIndex })">
26
+ <view :class="['ml-table-cell', column.align ? `align-${column.align}` : '', getHeaderCellClass({ type: 'header', row, rowIndex, column, columnIndex })]">
27
27
  <ml-amount-text v-if="column.cellRender && column.cellRender.name === 'MlAmountText'" :value="row[column.field]" :simplify="column.cellRender.props ? column.cellRender.props.simplify : false"></ml-amount-text>
28
28
  <text v-else>{{ getHeaderCellValue({ type: 'header', row, rowIndex, column, columnIndex }) }}</text>
29
29
  </view>
@@ -32,54 +32,56 @@
32
32
  </view>
33
33
  </view>
34
34
  <view class="table-body-contnet">
35
- <view class="table-tr" v-for="(row, rowIndex) in tableData" :key="rowIndex">
36
- <view class="table-td" v-for="(column, columnIndex) in tableColumn" :key="columnIndex" :style="{width: getColWidth(column), height: getColHeight(column)}" @click="cellTdClick({ type: 'body', row, rowIndex, column, columnIndex })">
37
- <view :class="['table-cell', column.align ? `align-${column.align}` : '', getCellClass({ type: 'body', row, rowIndex, column, columnIndex })]">
38
- <text v-if="column.type === 'seq'">{{ rowIndex + 1 }}</text>
39
- <text v-else-if="column.cellRender && column.cellRender.name === 'Underline'" class="is-underline">{{ getCellValue({ type: 'body', row, rowIndex, column, columnIndex }) }}</text>
40
- <text v-else-if="column.cellRender && column.cellRender.name === 'TextEllipsis'" class="text-ellipsis">{{ getTextEllipsis({ type: 'body', row, rowIndex, column, columnIndex }) }}</text>
41
- <ml-amount-text v-else-if="column.cellRender && column.cellRender.name === 'MlAmountText'" :value="row[column.field]" :simplify="column.cellRender.props ? column.cellRender.props.simplify : false"></ml-amount-text>
42
- <ml-progress-bar
43
- v-else-if="column.cellRender && column.cellRender.name === 'MlProgressBar'"
44
- :value="row[column.cellRender.field || column.field]"
45
- :title="row[column.cellRender.titleField] || ''"
46
- :titleUnderline="column.cellRender.props ? column.cellRender.props.titleUnderline : false"
47
- :showNum="column.cellRender.props ? column.cellRender.props.showNum : false"
48
- :max="column.cellRender.props && column.cellRender.props.max ? column.cellRender.props.max : 100"
49
- :activeColor="getBarActiveColor({ type: 'body', row, rowIndex, column, columnIndex })"
50
- :backgroundColor="column.cellRender.props ? column.cellRender.props.backgroundColor : ''">
51
- </ml-progress-bar>
52
- <ml-progress-bar
53
- v-else-if="column.cellRender && column.cellRender.name === 'MlProgressDiffBar'"
54
- :value="row[column.cellRender.field || column.field]"
55
- :title="row[column.cellRender.titleField] || ''"
56
- :max="row[column.cellRender.maxField] || ''"
57
- :titleUnderline="column.cellRender.props ? column.cellRender.props.titleUnderline : false"
58
- :showNum="column.cellRender.props ? column.cellRender.props.showNum : false"
59
- :activeColor="getBarActiveColor({ type: 'body', row, rowIndex, column, columnIndex }) || '#FA8C16'"
60
- :backgroundColor="(column.cellRender.props ? column.cellRender.props.backgroundColor : '') || '#1890FF'">
61
- </ml-progress-bar>
62
- <ml-button
63
- v-else-if="column.cellRender && column.cellRender.name === 'MlButton'"
64
- :type="column.cellRender.props ? column.cellRender.props.type : 'button'"
65
- :underline="column.cellRender.props ? column.cellRender.props.underline : false"
66
- :status="column.cellRender.props ? column.cellRender.props.status : ''"
67
- :content="column.cellRender.props ? column.cellRender.props.content : ''"
68
- @click="btnEvent({ type: 'body', row, rowIndex, column, columnIndex })">
69
- </ml-button>
70
- <ml-approval-type
71
- v-else-if="column.cellRender && column.cellRender.name === 'MlApprovalType'"
72
- :value="row[column.cellRender.field || column.field]">
73
- </ml-approval-type>
74
- <ml-dict-type
75
- v-else-if="column.cellRender && column.cellRender.name === 'MlDictType'"
76
- :options="column.cellRender.options || []"
77
- :value="row[column.cellRender.field || column.field]">
78
- </ml-dict-type>
79
- <text v-else>{{ getCellValue({ type: 'body', row, rowIndex, column, columnIndex }) }}</text>
35
+ <slot>
36
+ <view class="ml-table-tr" v-for="(row, rowIndex) in tableData" :key="rowIndex">
37
+ <view class="ml-table-td" v-for="(column, columnIndex) in tableColumn" :key="columnIndex" :style="{width: getColWidth(column), height: getColHeight(column)}" @click="cellTdClick({ type: 'body', row, rowIndex, column, columnIndex })">
38
+ <view :class="['ml-table-cell', column.align ? `align-${column.align}` : '', getCellClass({ type: 'body', row, rowIndex, column, columnIndex })]">
39
+ <text v-if="column.type === 'seq'">{{ rowIndex + 1 }}</text>
40
+ <text v-else-if="column.cellRender && column.cellRender.name === 'Underline'" class="is-underline">{{ getCellValue({ type: 'body', row, rowIndex, column, columnIndex }) }}</text>
41
+ <text v-else-if="column.cellRender && column.cellRender.name === 'TextEllipsis'" class="text-ellipsis">{{ getTextEllipsis({ type: 'body', row, rowIndex, column, columnIndex }) }}</text>
42
+ <ml-amount-text v-else-if="column.cellRender && column.cellRender.name === 'MlAmountText'" :value="row[column.field]" :simplify="column.cellRender.props ? column.cellRender.props.simplify : false"></ml-amount-text>
43
+ <ml-progress-bar
44
+ v-else-if="column.cellRender && column.cellRender.name === 'MlProgressBar'"
45
+ :value="row[column.cellRender.field || column.field]"
46
+ :title="row[column.cellRender.titleField] || ''"
47
+ :titleUnderline="column.cellRender.props ? column.cellRender.props.titleUnderline : false"
48
+ :showNum="column.cellRender.props ? column.cellRender.props.showNum : false"
49
+ :max="column.cellRender.props && column.cellRender.props.max ? column.cellRender.props.max : 100"
50
+ :activeColor="getBarActiveColor({ type: 'body', row, rowIndex, column, columnIndex })"
51
+ :backgroundColor="column.cellRender.props ? column.cellRender.props.backgroundColor : ''">
52
+ </ml-progress-bar>
53
+ <ml-progress-bar
54
+ v-else-if="column.cellRender && column.cellRender.name === 'MlProgressDiffBar'"
55
+ :value="row[column.cellRender.field || column.field]"
56
+ :title="row[column.cellRender.titleField] || ''"
57
+ :max="row[column.cellRender.maxField] || ''"
58
+ :titleUnderline="column.cellRender.props ? column.cellRender.props.titleUnderline : false"
59
+ :showNum="column.cellRender.props ? column.cellRender.props.showNum : false"
60
+ :activeColor="getBarActiveColor({ type: 'body', row, rowIndex, column, columnIndex }) || '#FA8C16'"
61
+ :backgroundColor="(column.cellRender.props ? column.cellRender.props.backgroundColor : '') || '#1890FF'">
62
+ </ml-progress-bar>
63
+ <ml-button
64
+ v-else-if="column.cellRender && column.cellRender.name === 'MlButton'"
65
+ :type="column.cellRender.props ? column.cellRender.props.type : 'button'"
66
+ :underline="column.cellRender.props ? column.cellRender.props.underline : false"
67
+ :status="column.cellRender.props ? column.cellRender.props.status : ''"
68
+ :content="column.cellRender.props ? column.cellRender.props.content : ''"
69
+ @click="btnEvent({ type: 'body', row, rowIndex, column, columnIndex })">
70
+ </ml-button>
71
+ <ml-approval-type
72
+ v-else-if="column.cellRender && column.cellRender.name === 'MlApprovalType'"
73
+ :value="row[column.cellRender.field || column.field]">
74
+ </ml-approval-type>
75
+ <ml-dict-type
76
+ v-else-if="column.cellRender && column.cellRender.name === 'MlDictType'"
77
+ :options="column.cellRender.options || []"
78
+ :value="row[column.cellRender.field || column.field]">
79
+ </ml-dict-type>
80
+ <text v-else>{{ getCellValue({ type: 'body', row, rowIndex, column, columnIndex }) }}</text>
81
+ </view>
80
82
  </view>
81
83
  </view>
82
- </view>
84
+ </slot>
83
85
  </view>
84
86
  </view>
85
87
  <view v-if="$slots.bottom" class="ml-table-bottom-warpper">
@@ -343,7 +345,7 @@ export default {
343
345
  background: #fff;
344
346
  &.is-border {
345
347
  .table-th,
346
- .table-td {
348
+ .ml-table-td {
347
349
  border-right: 1px solid rgba(126, 134, 142, 0.16);
348
350
  &:last-child {
349
351
  border-right: 0;
@@ -360,7 +362,7 @@ export default {
360
362
  }
361
363
  .table-body-top {
362
364
  background: #fff;
363
- .table-td {
365
+ .ml-table-td {
364
366
  height: 84rpx;
365
367
  }
366
368
  }
@@ -391,7 +393,7 @@ export default {
391
393
  white-space: nowrap;
392
394
  }
393
395
  }
394
- .table-tr {
396
+ .ml-table-tr {
395
397
  display: inline-flex;
396
398
  white-space: nowrap;
397
399
  width: 100%;
@@ -414,7 +416,7 @@ export default {
414
416
  }
415
417
  }
416
418
  }
417
- .table-td {
419
+ .ml-table-td {
418
420
  flex-shrink: 0;
419
421
  display: inline-flex;
420
422
  flex-direction: row;
@@ -427,7 +429,7 @@ export default {
427
429
  font-size: 24rpx;
428
430
  min-height: 84rpx;
429
431
  }
430
- .table-cell {
432
+ .ml-table-cell {
431
433
  display: block;
432
434
  width: 100%;
433
435
  white-space: normal;
@@ -1,15 +1,19 @@
1
1
  <template>
2
- <view class="table-td" :style="{width: cellWidth, height: cellHeight}" @click="clickEvent">
3
- <view :class="['table-cell', cellAlign ? `align-${cellAlign}` : '']">
2
+ <view class="ml-table-td" :class="{'is-border': cellBorder}" :style="{width: cellWidth, height: cellHeight}" @click="clickEvent">
3
+ <view :class="['ml-table-cell', cellAlign ? `align-${cellAlign}` : '', getCellClass({ type: 'body', renderType: 'custom' })]">
4
4
  <slot></slot>
5
5
  </view>
6
6
  </view>
7
7
  </template>
8
8
 
9
9
  <script>
10
+ import XEUtils from 'xe-utils'
10
11
 
11
12
  export default {
12
13
  name: 'MlTableTd',
14
+ options: {
15
+ virtualHost: true
16
+ },
13
17
  props: {
14
18
  align: String,
15
19
  width: [String, Number],
@@ -30,6 +34,20 @@ export default {
30
34
  }
31
35
  },
32
36
  computed: {
37
+ currColumn () {
38
+ const { $table, field } = this
39
+ if ($table) {
40
+ return $table.columns.find(column => column.field === field)
41
+ }
42
+ return null
43
+ },
44
+ cellBorder () {
45
+ const $table = this.$table
46
+ if ($table) {
47
+ return $table.border
48
+ }
49
+ return false
50
+ },
33
51
  cellAlign () {
34
52
  const $table = this.$table
35
53
  if ($table) {
@@ -38,8 +56,11 @@ export default {
38
56
  return this.align
39
57
  },
40
58
  cellWidth () {
41
- const { $table, width } = this
59
+ let { $table, width, currColumn } = this
42
60
  if ($table) {
61
+ if (!width && currColumn) {
62
+ width = currColumn.width
63
+ }
43
64
  if (width) {
44
65
  if (isNaN(width)) {
45
66
  return width
@@ -62,6 +83,24 @@ export default {
62
83
  }
63
84
  },
64
85
  methods: {
86
+ getCellClass (params) {
87
+ const { $table, currColumn } = this
88
+ const clss = []
89
+ const showOverflow = currColumn && XEUtils.isBoolean(currColumn.showOverflow) ? currColumn.showOverflow : ($table ? $table.showOverflow : false)
90
+ if (showOverflow) {
91
+ clss.push('is-ellipsis')
92
+ }
93
+ if ($table) {
94
+ if ($table.cellClass) {
95
+ if (XEUtils.isFunction($table.cellClass)) {
96
+ clss.push($table.cellClass.call(this.currVM, { ...params }))
97
+ } else {
98
+ clss.push(`${$table.cellClass}`)
99
+ }
100
+ }
101
+ }
102
+ return clss.join(' ')
103
+ },
65
104
  clickEvent () {
66
105
  const { $table } = this
67
106
  if ($table) {
@@ -71,3 +110,39 @@ export default {
71
110
  }
72
111
  }
73
112
  </script>
113
+
114
+ <style lang="scss">
115
+ .ml-table-td {
116
+ flex-shrink: 0;
117
+ display: inline-flex;
118
+ flex-direction: row;
119
+ align-items: center;
120
+ padding: 0 10rpx;
121
+ text-align: center;
122
+ color: rgba(39, 42, 48, 0.65);
123
+ border-bottom: 1px solid rgba(126, 134, 142, 0.16);
124
+ box-sizing: border-box;
125
+ font-size: 24rpx;
126
+ min-height: 84rpx;
127
+ }
128
+ .ml-table-cell {
129
+ display: block;
130
+ width: 100%;
131
+ white-space: normal;
132
+ word-break: break-all;
133
+ &.is-ellipsis {
134
+ overflow: hidden;
135
+ text-overflow: ellipsis;
136
+ white-space: nowrap;
137
+ }
138
+ &.align-left {
139
+ text-align: left;
140
+ }
141
+ &.align-center {
142
+ text-align: center;
143
+ }
144
+ &.align-right {
145
+ text-align: right;
146
+ }
147
+ }
148
+ </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="table-tr">
2
+ <view class="ml-table-tr">
3
3
  <slot></slot>
4
4
  </view>
5
5
  </template>
@@ -7,6 +7,9 @@
7
7
  <script>
8
8
  export default {
9
9
  name: 'MlTableTr',
10
+ options: {
11
+ virtualHost: true
12
+ },
10
13
  props: {
11
14
  },
12
15
  data () {
@@ -15,3 +18,11 @@ export default {
15
18
  }
16
19
  }
17
20
  </script>
21
+
22
+ <style lang="scss">
23
+ .ml-table-tr {
24
+ display: inline-flex;
25
+ white-space: nowrap;
26
+ width: 100%;
27
+ }
28
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.1.36",
3
+ "version": "1.1.37",
4
4
  "description": "码里UI-小程序组件库(vue2)",
5
5
  "files": [
6
6
  "lib",