w-ui-v1 1.0.25 → 1.0.26
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/index.ts +7 -1
- package/package.json +1 -1
- package/utils/apis/pageConfig.ts +28 -0
- package/utils/http.ts +0 -1
- package/w-add/w-add.vue +10 -25
- package/w-card/utils/utils.ts +155 -90
- package/w-card/w-card.vue +115 -53
- package/w-detail/w-detail.vue +106 -129
- package/w-edit/w-edit.vue +253 -0
- package/w-form-control/w-form-control.vue +47 -16
- package/w-form-message-box/w-form-message-box.vue +106 -0
- package/w-menu/w-menu.vue +43 -24
- package/w-search/w-search.vue +70 -67
- package/w-select-picker/w-select-picker-old.vue +461 -0
- package/w-select-picker/w-select-picker.vue +429 -397
- package/w-table/w-selectTable.vue +33 -18
- package/w-table/w-table.vue +22 -14
package/index.ts
CHANGED
|
@@ -9,6 +9,9 @@ import wDetail from './w-detail/w-detail.vue'
|
|
|
9
9
|
import wAdd from './w-add/w-add.vue'
|
|
10
10
|
import WSearch from './w-search/w-search.vue'
|
|
11
11
|
import WUser from './w-user/w-user.vue'
|
|
12
|
+
import wEdit from './w-edit/w-edit.vue'
|
|
13
|
+
import wSelectTable from './w-table/w-selectTable.vue'
|
|
14
|
+
import WFormMessageBox from './w-form-message-box/w-form-message-box.vue'
|
|
12
15
|
const coms: any[] = [
|
|
13
16
|
wTest,
|
|
14
17
|
wLogin,
|
|
@@ -19,7 +22,10 @@ const coms: any[] = [
|
|
|
19
22
|
wDetail,
|
|
20
23
|
wAdd,
|
|
21
24
|
WSearch,
|
|
22
|
-
WUser
|
|
25
|
+
WUser,
|
|
26
|
+
wEdit,
|
|
27
|
+
wSelectTable,
|
|
28
|
+
WFormMessageBox
|
|
23
29
|
]
|
|
24
30
|
// 批量组件注册
|
|
25
31
|
function install(Vue: App) {
|
package/package.json
CHANGED
package/utils/apis/pageConfig.ts
CHANGED
|
@@ -45,6 +45,13 @@ export function detailPageData(sourceId: string,code: string) {
|
|
|
45
45
|
})
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
//编辑页面详细配置
|
|
49
|
+
export function editPageConfig(sourceId: string,code: string) {
|
|
50
|
+
return request({
|
|
51
|
+
url: `/v3/dtmpl/config?sourceId=${sourceId}&code=${code}`,
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
|
|
48
55
|
|
|
49
56
|
// 获取页面数据key
|
|
50
57
|
export function getPageKey(sourceId: string, query: string='') {
|
|
@@ -75,3 +82,24 @@ export function getEnum(mstrucIds:string) {
|
|
|
75
82
|
data: mstrucIds
|
|
76
83
|
})
|
|
77
84
|
}
|
|
85
|
+
|
|
86
|
+
//删除
|
|
87
|
+
export function deletePageData(sourceId: string,code: string) {
|
|
88
|
+
return request({
|
|
89
|
+
url: `/v3/ltmpl/data?sourceId=${sourceId}&codes=${code}`,
|
|
90
|
+
method: 'DELETE',
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
//自定义按钮提交
|
|
95
|
+
export function customButtonSave(sourceId: string,codes:string, data: any) {
|
|
96
|
+
return request({
|
|
97
|
+
url: `/v3/action`,
|
|
98
|
+
method: 'POST',
|
|
99
|
+
data:{
|
|
100
|
+
sourceId,
|
|
101
|
+
codes,
|
|
102
|
+
...data
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
}
|
package/utils/http.ts
CHANGED
|
@@ -24,7 +24,6 @@ export default function request(options: any): Promise<any> {
|
|
|
24
24
|
responseType: 'json',
|
|
25
25
|
// #endif
|
|
26
26
|
success: (res: any) => {
|
|
27
|
-
console.log('request', res)
|
|
28
27
|
// 判断状态
|
|
29
28
|
if (res.statusCode >= 200 && res.statusCode < 300) {
|
|
30
29
|
if(res.data.message==='权限不足或没有资源'){
|
package/w-add/w-add.vue
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
<view v-if="loading" style="height: 100px;display: flex;justify-content: center;align-items: center;">
|
|
4
4
|
<wd-loading />
|
|
5
5
|
</view>
|
|
6
|
-
<
|
|
6
|
+
<view v-else>
|
|
7
|
+
<wd-collapse v-model="value" >
|
|
7
8
|
<wd-collapse-item :title="item.title" :name="item.id" v-for="(item, index) in pageConf.groups" :key="index">
|
|
8
9
|
<view
|
|
9
10
|
v-if="item.type === 'fieldGroup'">
|
|
@@ -55,24 +56,14 @@
|
|
|
55
56
|
<view class="footer-button">
|
|
56
57
|
<wd-button block @click="handleSubmit" icon="save">保存</wd-button>
|
|
57
58
|
</view>
|
|
59
|
+
</view>
|
|
58
60
|
<wd-message-box />
|
|
59
|
-
<wd-popup safe-area-inset-bottom position="right" v-model="showSelectRow" custom-style="width: 100vw;">
|
|
60
|
-
<WSelectTable :sourceId="pointSourceId">
|
|
61
|
-
<template #close>
|
|
62
|
-
<view style="display: flex;justify-content: flex-end;">
|
|
63
|
-
<wd-button type="icon" icon="close" @click="showSelectRow = false"></wd-button>
|
|
64
|
-
</view>
|
|
65
|
-
|
|
66
|
-
</template>
|
|
67
|
-
</WSelectTable>
|
|
68
|
-
</wd-popup>
|
|
69
61
|
<wd-toast />
|
|
70
62
|
</view>
|
|
71
63
|
</template>
|
|
72
64
|
|
|
73
65
|
<script setup lang="ts">
|
|
74
66
|
import wFromControl from '../w-form-control/w-form-control.vue'
|
|
75
|
-
import wSelectPicker from '../w-select-picker/w-select-picker.vue'
|
|
76
67
|
import WSelectTable from '../w-table/w-selectTable.vue';
|
|
77
68
|
import { onLoad } from '@dcloudio/uni-app'
|
|
78
69
|
import { ref, defineProps, reactive } from 'vue';
|
|
@@ -82,7 +73,6 @@ import {
|
|
|
82
73
|
addPageDataSave
|
|
83
74
|
} from '../utils/apis/pageConfig'
|
|
84
75
|
import { useMessage } from 'wot-design-uni'
|
|
85
|
-
import dayjs from 'dayjs/esm/index'
|
|
86
76
|
import { useToast } from 'wot-design-uni'
|
|
87
77
|
const toast = useToast()
|
|
88
78
|
const message = useMessage()
|
|
@@ -101,10 +91,12 @@ const pageConf = ref({ groups: [] })
|
|
|
101
91
|
const form = ref()//基本数据表单
|
|
102
92
|
//表单数据
|
|
103
93
|
const model = ref({})
|
|
94
|
+
const modelsRef={
|
|
95
|
+
|
|
96
|
+
}
|
|
104
97
|
const loading = ref(false)
|
|
105
98
|
const value = ref([])
|
|
106
99
|
const Enumcolumn = ref({})
|
|
107
|
-
const showSelectRow = ref(false)
|
|
108
100
|
const pointSourceId = ref('')
|
|
109
101
|
onLoad((option: any) => {
|
|
110
102
|
sourceId.value = props.sourceId || option.sourceId
|
|
@@ -128,6 +120,7 @@ function getPageConfig() {
|
|
|
128
120
|
relation[item.id] = t
|
|
129
121
|
}
|
|
130
122
|
if (item.type === 'fieldGroup') {
|
|
123
|
+
|
|
131
124
|
item.fields.forEach((subItem: any) => {
|
|
132
125
|
if (subItem.extControlType === 'datetime') {
|
|
133
126
|
fieldGroup[subItem.id] = null
|
|
@@ -163,16 +156,6 @@ async function getEnumer() {
|
|
|
163
156
|
Enumcolumn.value = res.data?.enumMap || {}
|
|
164
157
|
}
|
|
165
158
|
|
|
166
|
-
//wSelectPicker组件确定事件
|
|
167
|
-
const wSelectPickerconfirmData = ref([])//暂存wSelectPicker组件选中的数据
|
|
168
|
-
const wSelectPickerconfirm = (e) => {
|
|
169
|
-
console.log(e)
|
|
170
|
-
if (Array.isArray(e.selectedItems)) {
|
|
171
|
-
wSelectPickerconfirmData.value.push(...e.selectedItems)
|
|
172
|
-
} else {
|
|
173
|
-
wSelectPickerconfirmData.value.push(e.selectedItems)
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
159
|
|
|
177
160
|
//保存
|
|
178
161
|
async function handleSubmit() {
|
|
@@ -210,7 +193,9 @@ async function handleSubmit() {
|
|
|
210
193
|
//选择数据
|
|
211
194
|
function selectrow(item: any) {
|
|
212
195
|
pointSourceId.value = item.pointSourceId
|
|
213
|
-
|
|
196
|
+
uni.navigateTo({
|
|
197
|
+
url: `/pages/selectTable/selectTable?sourceId=${pointSourceId.value}`
|
|
198
|
+
})
|
|
214
199
|
}
|
|
215
200
|
|
|
216
201
|
//新加一行
|
package/w-card/utils/utils.ts
CHANGED
|
@@ -1,107 +1,172 @@
|
|
|
1
1
|
const hydrocarbonProgramToken = uni.getStorageSync('hydrocarbonProgramToken') || ''
|
|
2
2
|
const token = uni.getStorageSync('token') || ''
|
|
3
|
-
|
|
3
|
+
const baseUrl = uni.getStorageSync('baseUrl') || '/'
|
|
4
4
|
// 单项数据转换
|
|
5
5
|
export function getValue(content: any, title: any): any {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
return formatTime(content)
|
|
21
|
-
}
|
|
6
|
+
// 判断title 是否为字符串
|
|
7
|
+
if (typeof title === 'string') {
|
|
8
|
+
// 判断title 是否有 '时间'字符
|
|
9
|
+
if (title.includes('时间')) {
|
|
10
|
+
// 判断是否为数组
|
|
11
|
+
if (Array.isArray(content)) {
|
|
12
|
+
const newArr = content.map((item) => {
|
|
13
|
+
return formatTime(splitString(item))
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
// 数组转换为字符串
|
|
17
|
+
return newArr.join(',')
|
|
22
18
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// 判断是否为数组
|
|
26
|
-
if (Array.isArray(content)) {
|
|
27
|
-
const newArr = content.map((item) => {
|
|
28
|
-
return splitString(item)
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
// 数组转换为字符串
|
|
32
|
-
return newArr.join(',')
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// 判断是否为JSON字符串
|
|
36
|
-
if (typeof content === 'string' && content.startsWith('{') && content.endsWith('}')) {
|
|
37
|
-
// 解析JSON字符串
|
|
38
|
-
const obj = JSON.parse(content)
|
|
39
|
-
|
|
40
|
-
// 图片链接
|
|
41
|
-
if (obj.base?.path && (obj.base?.type.includes('jpg') || obj.base?.type.includes('png')||obj.base?.type.includes('jpeg'))) {
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
url: `${baseUrl}/v3/files${obj.base.path}?@token=${token}&@programToken=${hydrocarbonProgramToken}`,
|
|
45
|
-
type: '图片',
|
|
46
|
-
}
|
|
19
|
+
else {
|
|
20
|
+
return formatTime(content)
|
|
47
21
|
}
|
|
48
|
-
|
|
49
|
-
//文件链接
|
|
50
|
-
if (obj.base?.path && (obj.base?.type.includes('docx') )) {
|
|
51
|
-
|
|
52
|
-
return {
|
|
53
|
-
url: `${baseUrl}/v3/files${obj.base.path}?@token=${token}&@programToken=${hydrocarbonProgramToken}`,
|
|
54
|
-
name:obj.base.fileName,
|
|
55
|
-
type: '文件',
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
22
|
}
|
|
61
|
-
|
|
62
|
-
// 根据content中 "@R@" 分割字符串,取最后一项
|
|
63
|
-
return splitString(content)
|
|
64
23
|
}
|
|
65
24
|
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
25
|
+
// 判断是否为数组
|
|
26
|
+
if (Array.isArray(content)) {
|
|
27
|
+
const newArr = content.map((item) => {
|
|
28
|
+
return splitString(item)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
// 数组转换为字符串
|
|
32
|
+
return newArr.join(',')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 判断是否为JSON字符串
|
|
36
|
+
if (typeof content === 'string' && content.startsWith('{') && content.endsWith('}')) {
|
|
37
|
+
// 解析JSON字符串
|
|
38
|
+
const obj = JSON.parse(content)
|
|
39
|
+
|
|
40
|
+
// 图片链接
|
|
41
|
+
if (obj.base?.path && (obj.base?.type.includes('jpg') || obj.base?.type.includes('png') || obj.base?.type.includes('jpeg'))) {
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
url: `${baseUrl}/v3/files${obj.base.path}?@token=${token}&@programToken=${hydrocarbonProgramToken}`,
|
|
45
|
+
type: '图片',
|
|
46
|
+
}
|
|
72
47
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
48
|
+
|
|
49
|
+
//文件链接
|
|
50
|
+
if (obj.base?.path && (obj.base?.type.includes('docx')|| obj.base?.type.includes('txt'))) {
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
url: `${baseUrl}/v3/files${obj.base.path}?@token=${token}&@programToken=${hydrocarbonProgramToken}`,
|
|
54
|
+
name: obj.base.fileName,
|
|
55
|
+
type: '文件',
|
|
81
56
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
57
|
+
}
|
|
58
|
+
//判断音频链接
|
|
59
|
+
if (obj.base?.path && (obj.base?.type.includes('wav'))) {
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
url: `${baseUrl}/v3/files${obj.base.path}?@token=${token}&@programToken=${hydrocarbonProgramToken}`,
|
|
63
|
+
name: obj.base.fileName,
|
|
64
|
+
type: '音频',
|
|
65
|
+
author:uni.getStorageSync('userInfo').name
|
|
85
66
|
}
|
|
86
67
|
}
|
|
87
|
-
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// 根据content中 "@R@" 分割字符串,取最后一项
|
|
73
|
+
return splitString(content)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// 根据 "@R@" 分割字符串,取最后一项
|
|
77
|
+
function splitString(str: string) {
|
|
78
|
+
// 判断是否为字符串类型
|
|
79
|
+
if (typeof str !== 'string') {
|
|
80
|
+
// 如果不是字符串类型,直接返回
|
|
88
81
|
return str
|
|
89
82
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
83
|
+
|
|
84
|
+
if (str) {
|
|
85
|
+
// 判断是否有 "@R@"
|
|
86
|
+
if (str.includes('@R@')) {
|
|
87
|
+
// 分割字符串
|
|
88
|
+
const splitStr = str.split('@R@')
|
|
89
|
+
// 返回分割后的数组的最后一项
|
|
90
|
+
return splitStr[splitStr.length - 1]
|
|
96
91
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
// 格式化时间
|
|
101
|
-
function formatTime(str: string) {
|
|
102
|
-
if (typeof str === 'string') {
|
|
103
|
-
// 去掉小数点
|
|
104
|
-
return str.split('.')[0]
|
|
92
|
+
else {
|
|
93
|
+
// 返回原字符串
|
|
94
|
+
return str
|
|
105
95
|
}
|
|
106
|
-
|
|
107
|
-
|
|
96
|
+
}
|
|
97
|
+
// 返回原字符串
|
|
98
|
+
return str
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// 判断字符串中是否存在'y'字符
|
|
102
|
+
export function hasY(str: string) {
|
|
103
|
+
// 判断是否为字符串
|
|
104
|
+
if (typeof str === 'string') {
|
|
105
|
+
return str.includes('y')
|
|
106
|
+
}
|
|
107
|
+
return false
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// 格式化时间
|
|
111
|
+
function formatTime(str: string) {
|
|
112
|
+
if (typeof str === 'string') {
|
|
113
|
+
// 去掉小数点
|
|
114
|
+
return str.split('.')[0]
|
|
115
|
+
}
|
|
116
|
+
return str
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
//下载文件
|
|
120
|
+
export const downloadFile = (url: any) => {
|
|
121
|
+
uni.downloadFile({
|
|
122
|
+
url: url, // 文件的网络地址
|
|
123
|
+
success: (res) => {
|
|
124
|
+
if (res.statusCode === 200) {
|
|
125
|
+
console.log('下载成功', res.tempFilePath);
|
|
126
|
+
// 打开文件(如PDF、Word等)
|
|
127
|
+
uni.openDocument({
|
|
128
|
+
filePath: res.tempFilePath,
|
|
129
|
+
showMenu: true,
|
|
130
|
+
success: () => console.log('打开文件成功')
|
|
131
|
+
});
|
|
132
|
+
// // 将临时文件保存到本地
|
|
133
|
+
// uni.saveFile({
|
|
134
|
+
// tempFilePath: res.tempFilePath,
|
|
135
|
+
// success: (saveRes) => {
|
|
136
|
+
// console.log('文件保存成功', saveRes.savedFilePath);
|
|
137
|
+
// const savedFilePath = saveRes.savedFilePath; // 保存后的路径
|
|
138
|
+
// // 打开文件(如PDF、Word等)
|
|
139
|
+
// uni.openDocument({
|
|
140
|
+
// filePath: savedFilePath,
|
|
141
|
+
// success: () => console.log('打开文件成功')
|
|
142
|
+
// });
|
|
143
|
+
// uni.showToast({
|
|
144
|
+
// title: '文件保存成功',
|
|
145
|
+
// icon: 'success'
|
|
146
|
+
// });
|
|
147
|
+
// },
|
|
148
|
+
// fail: (saveErr) => {
|
|
149
|
+
// console.error('文件保存失败', saveErr);
|
|
150
|
+
// uni.showToast({
|
|
151
|
+
// title: '文件保存失败',
|
|
152
|
+
// icon: 'none'
|
|
153
|
+
// });
|
|
154
|
+
// }
|
|
155
|
+
// });
|
|
156
|
+
} else {
|
|
157
|
+
console.error('下载失败', res);
|
|
158
|
+
uni.showToast({
|
|
159
|
+
title: '下载失败',
|
|
160
|
+
icon: 'none'
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
fail: (err) => {
|
|
165
|
+
console.error('下载失败', err);
|
|
166
|
+
uni.showToast({
|
|
167
|
+
title: '下载失败',
|
|
168
|
+
icon: 'none'
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}
|