mali-applet-ui 1.1.36 → 1.1.38
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
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export function getEnvCode(mode: string): string
|
|
2
|
+
export function getEnvName(mode: string): string
|
|
3
|
+
export function getPlatformName(platform: string): string
|
|
4
|
+
export function getSubModuleName(module: string): string
|
|
5
|
+
export function parseEnv(dirPath: string): Record<string, string>
|
|
6
|
+
export function initEnv(dirPath: string, defaultEnv: Record<string, string>): Record<string, string>
|
|
7
|
+
export function initManifestEnv(dirPath: string, manifestJson: any): Record<string, string>
|
|
8
|
+
export function uploadWxMiniprogram(version: string): void
|
|
9
|
+
export function getSCSSAdditionalData(envConfig: any): string
|
|
4
10
|
export function sendMail(options: {
|
|
5
11
|
receivedBy: string | string[]
|
|
6
12
|
subject: string
|
|
7
13
|
html: string
|
|
14
|
+
})
|
|
15
|
+
export function sendQyWechatMsg(webhook: string, params: {
|
|
16
|
+
content: string
|
|
17
|
+
mentionedList?: string[]
|
|
18
|
+
mentionedMobileList?: string[]
|
|
8
19
|
})
|
package/env/index.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const fs = require('fs')
|
|
3
|
+
const dotenv = require('dotenv')
|
|
1
4
|
const axios = require('axios')
|
|
5
|
+
const XEUtils = require('xe-utils')
|
|
6
|
+
const compressing = require('compressing')
|
|
7
|
+
const ci = require('miniprogram-ci')
|
|
2
8
|
const nodemailer = require('nodemailer')
|
|
3
9
|
const smtpTransport = require('nodemailer-smtp-transport')
|
|
10
|
+
const pack = require('../package.json')
|
|
4
11
|
|
|
5
12
|
const currTransporter = new Promise((resolve, reject) => {
|
|
6
13
|
axios.get('http://192.168.10.217:3000/emai/getSmtpOptions').then(res => {
|
|
@@ -12,6 +19,225 @@ const currTransporter = new Promise((resolve, reject) => {
|
|
|
12
19
|
})
|
|
13
20
|
})
|
|
14
21
|
|
|
22
|
+
function getEnvCode (mode) {
|
|
23
|
+
const maps = {
|
|
24
|
+
dev: 'development',
|
|
25
|
+
test: 'testing',
|
|
26
|
+
demo: 'demo',
|
|
27
|
+
prod: 'production'
|
|
28
|
+
}
|
|
29
|
+
return maps[mode] || 'production'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function getEnvName (mode) {
|
|
33
|
+
const maps = {
|
|
34
|
+
dev: '开发环境',
|
|
35
|
+
test: '测试环境',
|
|
36
|
+
demo: '演示环境',
|
|
37
|
+
prod: '正式环境'
|
|
38
|
+
}
|
|
39
|
+
return maps[mode] || '正式环境'
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function getPlatformName (platform) {
|
|
43
|
+
const maps = {
|
|
44
|
+
'mp-weixin': '微信',
|
|
45
|
+
'mp-qiwei': '企微',
|
|
46
|
+
'mp-dingtalk': '钉钉'
|
|
47
|
+
}
|
|
48
|
+
return maps[platform] || platform
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function getSubModuleName (module) {
|
|
52
|
+
const maps = {
|
|
53
|
+
default: '',
|
|
54
|
+
labour: '码里劳务',
|
|
55
|
+
smart: '码里智慧',
|
|
56
|
+
market: '码里营销',
|
|
57
|
+
design: '码里设计',
|
|
58
|
+
jicai: '码里集采'
|
|
59
|
+
}
|
|
60
|
+
return `${maps[module]}`
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function getCustomName (custom) {
|
|
64
|
+
const maps = {
|
|
65
|
+
hengkun: '恒坤劳务',
|
|
66
|
+
beizhuang: '北装装饰',
|
|
67
|
+
zhongjian1: '中建一局',
|
|
68
|
+
guowenchuang: '国文创',
|
|
69
|
+
rongdu: '融都建设'
|
|
70
|
+
}
|
|
71
|
+
return `${maps[custom] || ''}`
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function parseEnvFile (dirPath, name) {
|
|
75
|
+
const targetPath = path.resolve(dirPath, name)
|
|
76
|
+
if (fs.existsSync(targetPath)) {
|
|
77
|
+
const content = fs.readFileSync(targetPath, { encoding: 'utf8' })
|
|
78
|
+
return dotenv.parse(content)
|
|
79
|
+
}
|
|
80
|
+
return {}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function parseJSONFile (dirPath, name) {
|
|
84
|
+
const targetPath = path.resolve(dirPath, name)
|
|
85
|
+
if (fs.existsSync(targetPath)) {
|
|
86
|
+
const content = fs.readFileSync(targetPath, { encoding: 'utf8' })
|
|
87
|
+
return JSON.parse(content)
|
|
88
|
+
}
|
|
89
|
+
return {}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function getSCSSAdditionalData () {
|
|
93
|
+
const rest = [
|
|
94
|
+
'@import "./src/uni.scss";',
|
|
95
|
+
`@import "${pack.name}/style/variable.scss";`,
|
|
96
|
+
`$global-static-url: '${process.env.VUE_APP_PUBLIC_RESOURCES_URL}';`
|
|
97
|
+
]
|
|
98
|
+
for (const name in process.env) {
|
|
99
|
+
if (/^VUE_SCSS_DEFINE_/.test(name)) {
|
|
100
|
+
const varName = name.replace('VUE_SCSS_DEFINE_', '').replace(/_/g, '-').toLowerCase()
|
|
101
|
+
rest.push(`$${varName}: ${process.env[name]};`)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return rest.join('\n')
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function parseEnv (rootPath) {
|
|
108
|
+
const envConfig = {}
|
|
109
|
+
envConfig.VUE_APP_MODE = process.env.VUE_APP_MODE || 'prod'
|
|
110
|
+
envConfig.VUE_APP_CUSTOM_MODULE = process.env.VUE_APP_CUSTOM_MODULE || 'default'
|
|
111
|
+
envConfig.VUE_APP_SUB_MODULE = process.env.VUE_APP_SUB_MODULE || 'default'
|
|
112
|
+
envConfig.VUE_APP_PLATFORM_NAME = process.env.VUE_APP_PLATFORM_NAME || 'default'
|
|
113
|
+
envConfig.VUE_APP_PUBLISH_DATE = XEUtils.toDateString(new Date(), 'yyyyMMddHHmmss')
|
|
114
|
+
|
|
115
|
+
const cusName = `.env.${envConfig.VUE_APP_CUSTOM_MODULE || 'default'}`
|
|
116
|
+
const envName = `${cusName}.${envConfig.VUE_APP_SUB_MODULE || 'default'}.${envConfig.VUE_APP_PLATFORM_NAME || 'default'}.${getEnvCode(envConfig.VUE_APP_MODE)}`
|
|
117
|
+
const globalDev = parseEnvFile(rootPath, '.env')
|
|
118
|
+
const defDev = parseEnvFile(rootPath, cusName)
|
|
119
|
+
const appEnv = parseEnvFile(rootPath, envName)
|
|
120
|
+
const localEnv = parseEnvFile(rootPath, `${envName}.local`)
|
|
121
|
+
|
|
122
|
+
return Object.assign({}, globalDev, defDev, appEnv, localEnv, envConfig)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function initEnv (rootPath) {
|
|
126
|
+
const envConfig = parseEnv(rootPath)
|
|
127
|
+
const conf = Object.assign(process.env, envConfig)
|
|
128
|
+
console.log('\n环境配置:')
|
|
129
|
+
console.log(`版本:${conf.VUE_APP_CUSTOM_MODULE}\n模块:${conf.VUE_APP_SUB_MODULE}\n平台:${conf.VUE_APP_PLATFORM_NAME}\n环境:${conf.VUE_APP_MODE}\n`)
|
|
130
|
+
return conf
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function initManifestEnv (rootPath, manifestJson) {
|
|
134
|
+
const envConfig = initEnv(rootPath)
|
|
135
|
+
if (process.env.VUE_APP_MP_APPID) {
|
|
136
|
+
const manifest = JSON.parse(fs.readFileSync(path.resolve(rootPath, 'src/manifest.json'), 'utf-8'))
|
|
137
|
+
manifest[process.env.UNI_PLATFORM] = {
|
|
138
|
+
...manifestJson[process.env.UNI_PLATFORM],
|
|
139
|
+
appid: process.env.VUE_APP_MP_APPID
|
|
140
|
+
}
|
|
141
|
+
manifest.name = [
|
|
142
|
+
getCustomName(process.env.VUE_APP_CUSTOM_MODULE),
|
|
143
|
+
getSubModuleName(process.env.VUE_APP_SUB_MODULE) || manifestJson.name,
|
|
144
|
+
getPlatformName(process.env.VUE_APP_PLATFORM_NAME),
|
|
145
|
+
getEnvName(process.env.VUE_APP_MODE)
|
|
146
|
+
].filter(v => v).join('-')
|
|
147
|
+
fs.writeFileSync(path.resolve(rootPath, 'src/manifest.json'), JSON.stringify(manifest, null, 2))
|
|
148
|
+
}
|
|
149
|
+
return envConfig
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function deleteFolder (filePath) {
|
|
153
|
+
let files = []
|
|
154
|
+
if (fs.existsSync(filePath)) {
|
|
155
|
+
files = fs.readdirSync(filePath)
|
|
156
|
+
files.forEach((file, index) => {
|
|
157
|
+
const curPath = filePath + '/' + file
|
|
158
|
+
if (fs.statSync(curPath).isDirectory()) {
|
|
159
|
+
deleteFolder(curPath)
|
|
160
|
+
} else {
|
|
161
|
+
fs.unlinkSync(curPath)
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
fs.rmdirSync(filePath)
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function uploadWxMiniprogram (rootPath, version) {
|
|
169
|
+
// 机器人编号
|
|
170
|
+
const robot = 1
|
|
171
|
+
const fixDesc = `自动发包机器人 ${XEUtils.toDateString(new Date(), 'yyyy-MM-dd HH:mm:ss')}`
|
|
172
|
+
|
|
173
|
+
const mainVersions = version.split('.')
|
|
174
|
+
return new Promise((resolve, reject) => {
|
|
175
|
+
if (['mp-weixin', 'mp-qiwei'].includes(process.env.VUE_APP_PLATFORM_NAME)) {
|
|
176
|
+
const projectConfig = parseJSONFile(rootPath, `${process.env.UNI_OUTPUT_DIR}/project.config.json`)
|
|
177
|
+
console.log('projectConfig', projectConfig)
|
|
178
|
+
console.log('projectPath=', path.resolve(rootPath, process.env.UNI_OUTPUT_DIR))
|
|
179
|
+
const options = {
|
|
180
|
+
appid: projectConfig.appid,
|
|
181
|
+
type: 'miniProgram',
|
|
182
|
+
projectPath: path.resolve(rootPath, process.env.UNI_OUTPUT_DIR),
|
|
183
|
+
privateKeyPath: `/applet/weixin/privatekey/private.${projectConfig.appid}.key`,
|
|
184
|
+
ignores: ['node_modules/**/*']
|
|
185
|
+
}
|
|
186
|
+
console.log(options)
|
|
187
|
+
const project = new ci.Project(options)
|
|
188
|
+
ci.getDevSourceMap({
|
|
189
|
+
project,
|
|
190
|
+
robot,
|
|
191
|
+
sourceMapSavePath: path.resolve(rootPath, 'sm.zip')
|
|
192
|
+
}).then((res) => {
|
|
193
|
+
console.log('sm==', path.resolve(rootPath, 'sm.zip'))
|
|
194
|
+
console.log('get success', res)
|
|
195
|
+
compressing.zip.uncompress(path.resolve(rootPath, 'sm.zip'), 'temp').then(() => {
|
|
196
|
+
const rest = JSON.parse(fs.readFileSync(path.resolve(rootPath, 'temp/__FULL__/app-service.js.map')))
|
|
197
|
+
const vArr = rest.wx.userVersion.match(/(\d+).(\d+).(\d+)/)
|
|
198
|
+
if (vArr) {
|
|
199
|
+
const newVersion = `${mainVersions[0]}.${mainVersions[1]}.${Number(mainVersions[1]) > Number(vArr[2]) ? 0 : (Number(vArr[3]) + 1)}.${XEUtils.toDateString(new Date(), 'yyMMdd')}`
|
|
200
|
+
ci.upload({
|
|
201
|
+
project,
|
|
202
|
+
version: newVersion,
|
|
203
|
+
desc: fixDesc,
|
|
204
|
+
robot
|
|
205
|
+
}).then((res) => {
|
|
206
|
+
console.log(res)
|
|
207
|
+
resolve()
|
|
208
|
+
})
|
|
209
|
+
} else {
|
|
210
|
+
const e = {}
|
|
211
|
+
console.error('version error')
|
|
212
|
+
reject(e)
|
|
213
|
+
}
|
|
214
|
+
deleteFolder(path.resolve(rootPath, 'temp'))
|
|
215
|
+
fs.unlinkSync(path.resolve(rootPath, 'sm.zip'))
|
|
216
|
+
resolve()
|
|
217
|
+
})
|
|
218
|
+
}).catch(e => {
|
|
219
|
+
if (e.message.indexOf('-80407') > -1) {
|
|
220
|
+
ci.upload({
|
|
221
|
+
project,
|
|
222
|
+
version: `${pack.version}.${XEUtils.toDateString(new Date(), 'yyMMdd')}`,
|
|
223
|
+
desc: '修复bug',
|
|
224
|
+
robot: 1
|
|
225
|
+
}).then((res) => {
|
|
226
|
+
console.log(res)
|
|
227
|
+
resolve()
|
|
228
|
+
})
|
|
229
|
+
} else {
|
|
230
|
+
console.log(e.message)
|
|
231
|
+
reject(e)
|
|
232
|
+
}
|
|
233
|
+
})
|
|
234
|
+
} else {
|
|
235
|
+
const e = {}
|
|
236
|
+
reject(e)
|
|
237
|
+
}
|
|
238
|
+
})
|
|
239
|
+
}
|
|
240
|
+
|
|
15
241
|
function sendMail ({ receivedBy, subject, html }) {
|
|
16
242
|
return new Promise((resolve, reject) => {
|
|
17
243
|
currTransporter.then((transporter) => {
|
|
@@ -33,8 +259,44 @@ function sendMail ({ receivedBy, subject, html }) {
|
|
|
33
259
|
})
|
|
34
260
|
}
|
|
35
261
|
|
|
262
|
+
function sendQyWechatMsg (webhook, params) {
|
|
263
|
+
if (!webhook) {
|
|
264
|
+
throw new Error('企微机器人 webhook 地址不能为空')
|
|
265
|
+
}
|
|
266
|
+
return axios.post(webhook, {
|
|
267
|
+
msgtype: 'markdown',
|
|
268
|
+
markdown: {
|
|
269
|
+
content: params.content || '',
|
|
270
|
+
mentioned_list: params.mentionedList || [],
|
|
271
|
+
mentioned_mobile_list: params.mentionedMobileList || []
|
|
272
|
+
}
|
|
273
|
+
}).then(res => {
|
|
274
|
+
return res.data
|
|
275
|
+
})
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
exports.getEnvCode = getEnvCode
|
|
279
|
+
exports.getEnvName = getEnvName
|
|
280
|
+
exports.getPlatformName = getPlatformName
|
|
281
|
+
exports.getSubModuleName = getSubModuleName
|
|
282
|
+
exports.parseEnv = parseEnv
|
|
283
|
+
exports.initEnv = initEnv
|
|
284
|
+
exports.initManifestEnv = initManifestEnv
|
|
285
|
+
exports.uploadWxMiniprogram = uploadWxMiniprogram
|
|
286
|
+
exports.getSCSSAdditionalData = getSCSSAdditionalData
|
|
36
287
|
exports.sendMail = sendMail
|
|
288
|
+
exports.sendQyWechatMsg = sendQyWechatMsg
|
|
37
289
|
|
|
38
290
|
module.exports = {
|
|
39
|
-
|
|
291
|
+
getEnvCode,
|
|
292
|
+
getEnvName,
|
|
293
|
+
getPlatformName,
|
|
294
|
+
getSubModuleName,
|
|
295
|
+
parseEnv,
|
|
296
|
+
initEnv,
|
|
297
|
+
initManifestEnv,
|
|
298
|
+
uploadWxMiniprogram,
|
|
299
|
+
getSCSSAdditionalData,
|
|
300
|
+
sendMail,
|
|
301
|
+
sendQyWechatMsg
|
|
40
302
|
}
|
|
@@ -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
|
-
<
|
|
36
|
-
<view class="table-
|
|
37
|
-
<view
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
</
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "1.1.38",
|
|
4
4
|
"description": "码里UI-小程序组件库(vue2)",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
"axios": "^0.26.1",
|
|
38
38
|
"nodemailer": "^6.9.4",
|
|
39
39
|
"nodemailer-smtp-transport": "^2.7.4",
|
|
40
|
+
"compressing": "~1.6.3",
|
|
41
|
+
"miniprogram-ci": "~1.9.8",
|
|
40
42
|
"xe-utils": "^3.5.11"
|
|
41
43
|
},
|
|
42
44
|
"devDependencies": {
|