w-ui-v1 1.1.12 → 1.1.14

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,18 +1,18 @@
1
- {
2
- "name": "w-ui-v1",
3
- "version": "1.1.12",
4
- "description": "w-ui",
5
- "author": "wgxshh",
6
- "license": "ISC",
7
- "main": "index.ts",
8
-
9
- "peerDependencies": {
10
- "wot-design-uni": "^1.7.0",
11
- "z-paging": "^2.8.5"
12
- },
13
- "dependencies": {
14
- "dayjs": "^1.11.13",
15
- "jsencrypt": "^3.3.2",
16
- "lodash-es": "^4.17.21"
17
- }
18
- }
1
+ {
2
+ "name": "w-ui-v1",
3
+ "version": "1.1.14",
4
+ "description": "w-ui",
5
+ "author": "wgxshh",
6
+ "license": "ISC",
7
+ "main": "index.ts",
8
+
9
+ "peerDependencies": {
10
+ "wot-design-uni": "^1.7.0",
11
+ "z-paging": "^2.8.5"
12
+ },
13
+ "dependencies": {
14
+ "dayjs": "^1.11.13",
15
+ "jsencrypt": "^3.3.2",
16
+ "lodash-es": "^4.17.21"
17
+ }
18
+ }
@@ -1,6 +1,6 @@
1
1
  //注意:需要在插件市场 安装 安卓原生插件“iData条码扫描插件”,https://ext.dcloud.net.cn/plugin?id=3898#
2
- interface callback {
3
- (scanData:any): void;
2
+ interface callback {
3
+ (scanData:any): void;
4
4
  }
5
5
  let barcodeModel=null
6
6
  let globalEvent=null
package/utils/nfc.ts CHANGED
@@ -1,270 +1,270 @@
1
- var NfcAdapter;
2
- var NdefRecord;
3
- var NdefMessage;
4
- var _getCardNo;
5
-
6
- export default {
7
- initNFC() {
8
- if (uni.getSystemInfoSync().platform == 'android') {
9
- listenNFCStatus()
10
- }
11
- },
12
- readNFC(callback) {
13
- if (uni.getSystemInfoSync().platform == 'android') {
14
- readData(callback);
15
- }
16
- },
17
- closeNFC() {
18
- if (uni.getSystemInfoSync().platform == 'android') {
19
- closeReadAndWrite();
20
- }
21
- }
22
- }
23
-
24
- function listenNFCStatus() {
25
- try {
26
- var main = plus.android.runtimeMainActivity();
27
- var Intent = plus.android.importClass('android.content.Intent');
28
- var Activity = plus.android.importClass('android.app.Activity');
29
- var PendingIntent = plus.android.importClass('android.app.PendingIntent');
30
- var IntentFilter = plus.android.importClass('android.content.IntentFilter');
31
- NfcAdapter = plus.android.importClass('android.nfc.NfcAdapter');
32
- var nfcAdapter = NfcAdapter.getDefaultAdapter(main);
33
-
34
- if (nfcAdapter == null) {
35
- uni.showToast({
36
- title: '设备不支持NFC!',
37
- icon: 'none'
38
- })
39
- return;
40
- }
41
-
42
- if (!nfcAdapter.isEnabled()) {
43
- uni.showToast({
44
- title: '请在系统设置中先启用NFC功能!',
45
- icon: 'none'
46
- });
47
- return;
48
- }
49
-
50
- var intent = new Intent(main, main.getClass());
51
- intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
52
- var pendingIntent = PendingIntent.getActivity(main, 0, intent, 0);
53
- var ndef = new IntentFilter("android.nfc.action.TECH_DISCOVERED");
54
- ndef.addDataType("*/*");
55
- var intentFiltersArray = [ndef];
56
- var techListsArray = [
57
- ["android.nfc.tech.IsoDep"],
58
- ["android.nfc.tech.NfcA"],
59
- ["android.nfc.tech.NfcB"],
60
- ["android.nfc.tech.NfcF"],
61
- ["android.nfc.tech.Nfcf"],
62
- ["android.nfc.tech.NfcV"],
63
- ["android.nfc.tech.NdefFormatable"],
64
- ["android.nfc.tech.MifareClassic"],
65
- ["android.nfc.tech.MifareUltralight"]
66
- ];
67
- plus.globalEvent.addEventListener("newintent",
68
- function() {
69
- setTimeout(handle_nfc_data1, 1000);
70
- }, false);
71
- plus.globalEvent.addEventListener("pause", function(e) {
72
- if (nfcAdapter) {
73
- nfcAdapter.disableForegroundDispatch(main);
74
- }
75
- }, false);
76
- plus.globalEvent.addEventListener("resume", function(e) {
77
- if (nfcAdapter) {
78
- //console.log('resume');
79
- nfcAdapter.enableForegroundDispatch(main, pendingIntent, intentFiltersArray, techListsArray);
80
- }
81
- }, false);
82
- nfcAdapter.enableForegroundDispatch(main, pendingIntent, intentFiltersArray, techListsArray);
83
- } catch (e) {
84
- console.error(e);
85
- }
86
- }
87
-
88
- function handle_nfc_data1() {
89
- NdefRecord = plus.android.importClass("android.nfc.NdefRecord");
90
- NdefMessage = plus.android.importClass("android.nfc.NdefMessage");
91
- var main = plus.android.runtimeMainActivity();
92
- var intent = main.getIntent();
93
- //console.log("action type:" + intent.getAction());
94
- if ("android.nfc.action.TECH_DISCOVERED" == intent.getAction()) {
95
- if (readyWriteData) {
96
- //__write(intent);
97
- readyWriteData = false;
98
- } else if (readyRead) {
99
- __read(intent);
100
- readyRead = false;
101
- }
102
- }
103
- }
104
-
105
- function showToast(msg) {
106
- plus.nativeUI.toast(msg);
107
- }
108
-
109
- // function __write(intent) {
110
- // try {
111
- // waiting.setTitle('请勿移开标签\n正在写入...');
112
- // var text = document.getElementById('text').value;
113
- // console.log("text=" + text);
114
- // var textBytes = plus.android.invoke(text, "getBytes");
115
- // var textRecord = new NdefRecord(NdefRecord.TNF_MIME_MEDIA,
116
- // plus.android.invoke("text/plain", "getBytes"), plus.android.invoke("", "getBytes"), textBytes);
117
- // var message = new NdefMessage([textRecord]);
118
- // var Ndef = plus.android.importClass('android.nfc.tech.Ndef');
119
- // var NdefFormatable = plus.android.importClass('android.nfc.tech.NdefFormatable');
120
- // var tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
121
- // var ndef = Ndef.get(tag);
122
- // if (ndef != null) {
123
- // var size = message.toByteArray().length;
124
- // console.log("size=" + size);
125
- // ndef.connect();
126
- // if (!ndef.isWritable()) {
127
- // showToast("tag不允许写入");
128
- // waiting.close();
129
- // return;
130
- // }
131
- // if (ndef.getMaxSize() < size) {
132
- // showToast("文件大小超出容量");
133
- // waiting.close();
134
- // return;
135
- // }
136
-
137
- // ndef.writeNdefMessage(message);
138
- // waiting.close();
139
- // showToast("写入数据成功.");
140
- // return;
141
- // } else {
142
- // var format = NdefFormatable.get(tag);
143
- // if (format != null) {
144
- // try {
145
- // format.connect();
146
- // format.format(message);
147
- // showToast("格式化tag并且写入message");
148
- // waiting.close();
149
- // return;
150
- // } catch (e) {
151
- // showToast("格式化tag失败.");
152
- // waiting.close();
153
- // return;
154
- // }
155
- // } else {
156
- // showToast("Tag不支持NDEF");
157
- // waiting.close();
158
- // return;
159
- // }
160
- // }
161
- // } catch (e) {
162
- // console.log("error=" + e);
163
- // waiting.close();
164
- // alert('写入失败');
165
- // }
166
-
167
- // }
168
-
169
- function __read(intent) {
170
- try {
171
- var content = "";
172
- waiting.setTitle('请勿移开卡\n正在读取数据...');
173
- var tag = plus.android.importClass("android.nfc.Tag");
174
- tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
175
- var bytesId = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID);
176
- waiting.close();
177
- var tagid = bytesToDecimalString(tag.getId())
178
- if (typeof _getCardNo === 'function') {
179
- _getCardNo(tagid);
180
- }
181
- } catch (e) {
182
- uni.showToast({
183
- title: e,
184
- icon: 'none'
185
- });
186
- }
187
- }
188
-
189
- // function bytesToHexString(inarray) {
190
- // var i, j, x;
191
- // var hex = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A",
192
- // "B", "C", "D", "E", "F"
193
- // ];
194
- // var out = "";
195
- // for (j = 0; j < inarray.length; ++j) {
196
- // x = parseInt(inarray[j]) & 0xff;
197
- // i = (x >> 4) & 0x0f;
198
- // out += hex[i];
199
- // i = x & 0x0f;
200
- // out += hex[i];
201
- // }
202
- // return out;
1
+ var NfcAdapter;
2
+ var NdefRecord;
3
+ var NdefMessage;
4
+ var _getCardNo;
5
+
6
+ export default {
7
+ initNFC() {
8
+ if (uni.getSystemInfoSync().platform == 'android') {
9
+ listenNFCStatus()
10
+ }
11
+ },
12
+ readNFC(callback) {
13
+ if (uni.getSystemInfoSync().platform == 'android') {
14
+ readData(callback);
15
+ }
16
+ },
17
+ closeNFC() {
18
+ if (uni.getSystemInfoSync().platform == 'android') {
19
+ closeReadAndWrite();
20
+ }
21
+ }
22
+ }
23
+
24
+ function listenNFCStatus() {
25
+ try {
26
+ var main = plus.android.runtimeMainActivity();
27
+ var Intent = plus.android.importClass('android.content.Intent');
28
+ var Activity = plus.android.importClass('android.app.Activity');
29
+ var PendingIntent = plus.android.importClass('android.app.PendingIntent');
30
+ var IntentFilter = plus.android.importClass('android.content.IntentFilter');
31
+ NfcAdapter = plus.android.importClass('android.nfc.NfcAdapter');
32
+ var nfcAdapter = NfcAdapter.getDefaultAdapter(main);
33
+
34
+ if (nfcAdapter == null) {
35
+ uni.showToast({
36
+ title: '设备不支持NFC!',
37
+ icon: 'none'
38
+ })
39
+ return;
40
+ }
41
+
42
+ if (!nfcAdapter.isEnabled()) {
43
+ uni.showToast({
44
+ title: '请在系统设置中先启用NFC功能!',
45
+ icon: 'none'
46
+ });
47
+ return;
48
+ }
49
+
50
+ var intent = new Intent(main, main.getClass());
51
+ intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
52
+ var pendingIntent = PendingIntent.getActivity(main, 0, intent, 0);
53
+ var ndef = new IntentFilter("android.nfc.action.TECH_DISCOVERED");
54
+ ndef.addDataType("*/*");
55
+ var intentFiltersArray = [ndef];
56
+ var techListsArray = [
57
+ ["android.nfc.tech.IsoDep"],
58
+ ["android.nfc.tech.NfcA"],
59
+ ["android.nfc.tech.NfcB"],
60
+ ["android.nfc.tech.NfcF"],
61
+ ["android.nfc.tech.Nfcf"],
62
+ ["android.nfc.tech.NfcV"],
63
+ ["android.nfc.tech.NdefFormatable"],
64
+ ["android.nfc.tech.MifareClassic"],
65
+ ["android.nfc.tech.MifareUltralight"]
66
+ ];
67
+ plus.globalEvent.addEventListener("newintent",
68
+ function() {
69
+ setTimeout(handle_nfc_data1, 1000);
70
+ }, false);
71
+ plus.globalEvent.addEventListener("pause", function(e) {
72
+ if (nfcAdapter) {
73
+ nfcAdapter.disableForegroundDispatch(main);
74
+ }
75
+ }, false);
76
+ plus.globalEvent.addEventListener("resume", function(e) {
77
+ if (nfcAdapter) {
78
+ //console.log('resume');
79
+ nfcAdapter.enableForegroundDispatch(main, pendingIntent, intentFiltersArray, techListsArray);
80
+ }
81
+ }, false);
82
+ nfcAdapter.enableForegroundDispatch(main, pendingIntent, intentFiltersArray, techListsArray);
83
+ } catch (e) {
84
+ console.error(e);
85
+ }
86
+ }
87
+
88
+ function handle_nfc_data1() {
89
+ NdefRecord = plus.android.importClass("android.nfc.NdefRecord");
90
+ NdefMessage = plus.android.importClass("android.nfc.NdefMessage");
91
+ var main = plus.android.runtimeMainActivity();
92
+ var intent = main.getIntent();
93
+ //console.log("action type:" + intent.getAction());
94
+ if ("android.nfc.action.TECH_DISCOVERED" == intent.getAction()) {
95
+ if (readyWriteData) {
96
+ //__write(intent);
97
+ readyWriteData = false;
98
+ } else if (readyRead) {
99
+ __read(intent);
100
+ readyRead = false;
101
+ }
102
+ }
103
+ }
104
+
105
+ function showToast(msg) {
106
+ plus.nativeUI.toast(msg);
107
+ }
108
+
109
+ // function __write(intent) {
110
+ // try {
111
+ // waiting.setTitle('请勿移开标签\n正在写入...');
112
+ // var text = document.getElementById('text').value;
113
+ // console.log("text=" + text);
114
+ // var textBytes = plus.android.invoke(text, "getBytes");
115
+ // var textRecord = new NdefRecord(NdefRecord.TNF_MIME_MEDIA,
116
+ // plus.android.invoke("text/plain", "getBytes"), plus.android.invoke("", "getBytes"), textBytes);
117
+ // var message = new NdefMessage([textRecord]);
118
+ // var Ndef = plus.android.importClass('android.nfc.tech.Ndef');
119
+ // var NdefFormatable = plus.android.importClass('android.nfc.tech.NdefFormatable');
120
+ // var tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
121
+ // var ndef = Ndef.get(tag);
122
+ // if (ndef != null) {
123
+ // var size = message.toByteArray().length;
124
+ // console.log("size=" + size);
125
+ // ndef.connect();
126
+ // if (!ndef.isWritable()) {
127
+ // showToast("tag不允许写入");
128
+ // waiting.close();
129
+ // return;
130
+ // }
131
+ // if (ndef.getMaxSize() < size) {
132
+ // showToast("文件大小超出容量");
133
+ // waiting.close();
134
+ // return;
135
+ // }
136
+
137
+ // ndef.writeNdefMessage(message);
138
+ // waiting.close();
139
+ // showToast("写入数据成功.");
140
+ // return;
141
+ // } else {
142
+ // var format = NdefFormatable.get(tag);
143
+ // if (format != null) {
144
+ // try {
145
+ // format.connect();
146
+ // format.format(message);
147
+ // showToast("格式化tag并且写入message");
148
+ // waiting.close();
149
+ // return;
150
+ // } catch (e) {
151
+ // showToast("格式化tag失败.");
152
+ // waiting.close();
153
+ // return;
154
+ // }
155
+ // } else {
156
+ // showToast("Tag不支持NDEF");
157
+ // waiting.close();
158
+ // return;
159
+ // }
160
+ // }
161
+ // } catch (e) {
162
+ // console.log("error=" + e);
163
+ // waiting.close();
164
+ // alert('写入失败');
165
+ // }
166
+
203
167
  // }
204
- function bytesToDecimalString(inarray) {
205
- let result = BigInt(0);
206
- // 反转数组以适配大端序
207
- const reversed = [...inarray].reverse();
208
- for (let j = 0; j < reversed.length; j++) {
209
- const byte = BigInt(parseInt(reversed[j])) & BigInt(0xff);
210
- result = (result << BigInt(8)) | byte;
211
- }
212
- return result.toString();
213
- }
214
-
215
- function reverseTwo(str) {
216
-
217
- var str1 = "";
218
- for (var i = 1; i <= str.length; i++) {
219
- str1 += str[i - 1];
220
- if (i % 2 == 0) {
221
- if (i == str.length) {
222
- break;
223
- }
224
- str1 += ":";
225
- }
226
- }
227
- var str2 = "";
228
- for (var i = str1.split(":").length - 1; i >= 0; i--) {
229
- str2 += str1.split(":")[i];
230
- }
231
- return str2;
232
- }
233
-
234
- if (uni.getSystemInfoSync().platform == 'android') {
235
- //plus.globalEvent.addEventListener('plusready', listenNFCStatus, false);
236
- }
237
-
238
- var waiting;
239
- var readyWriteData = false;
240
- var readyRead = false;
241
-
242
- function writeData() {
243
- var textEle = plus.globalEvent.getElementById('text');
244
- if (!textEle.value) {
245
- uni.showToast({
246
- title: '请输入要写入的内容!',
247
- icon: 'none'
248
- });
249
- return;
250
- }
251
- readyWriteData = true;
252
- waiting = plus.nativeUI.showWaiting("请将卡靠近!");
253
- }
254
-
255
- function readData(getCardNo) {
256
- readyRead = true;
257
- _getCardNo = getCardNo
258
- waiting = plus.nativeUI.showWaiting("请将卡靠近!", {
259
- modal: false
260
- });
261
- }
262
-
263
- function closeReadAndWrite() {
264
- readyWriteData = false;
265
- readyRead = false;
266
-
267
- if (waiting) {
268
- waiting.close();
269
- }
168
+
169
+ function __read(intent) {
170
+ try {
171
+ var content = "";
172
+ waiting.setTitle('请勿移开卡\n正在读取数据...');
173
+ var tag = plus.android.importClass("android.nfc.Tag");
174
+ tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
175
+ var bytesId = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID);
176
+ waiting.close();
177
+ var tagid = bytesToDecimalString(tag.getId())
178
+ if (typeof _getCardNo === 'function') {
179
+ _getCardNo(tagid);
180
+ }
181
+ } catch (e) {
182
+ uni.showToast({
183
+ title: e,
184
+ icon: 'none'
185
+ });
186
+ }
187
+ }
188
+
189
+ // function bytesToHexString(inarray) {
190
+ // var i, j, x;
191
+ // var hex = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A",
192
+ // "B", "C", "D", "E", "F"
193
+ // ];
194
+ // var out = "";
195
+ // for (j = 0; j < inarray.length; ++j) {
196
+ // x = parseInt(inarray[j]) & 0xff;
197
+ // i = (x >> 4) & 0x0f;
198
+ // out += hex[i];
199
+ // i = x & 0x0f;
200
+ // out += hex[i];
201
+ // }
202
+ // return out;
203
+ // }
204
+ function bytesToDecimalString(inarray) {
205
+ let result = BigInt(0);
206
+ // 反转数组以适配大端序
207
+ const reversed = [...inarray].reverse();
208
+ for (let j = 0; j < reversed.length; j++) {
209
+ const byte = BigInt(parseInt(reversed[j])) & BigInt(0xff);
210
+ result = (result << BigInt(8)) | byte;
211
+ }
212
+ return result.toString();
213
+ }
214
+
215
+ function reverseTwo(str) {
216
+
217
+ var str1 = "";
218
+ for (var i = 1; i <= str.length; i++) {
219
+ str1 += str[i - 1];
220
+ if (i % 2 == 0) {
221
+ if (i == str.length) {
222
+ break;
223
+ }
224
+ str1 += ":";
225
+ }
226
+ }
227
+ var str2 = "";
228
+ for (var i = str1.split(":").length - 1; i >= 0; i--) {
229
+ str2 += str1.split(":")[i];
230
+ }
231
+ return str2;
232
+ }
233
+
234
+ if (uni.getSystemInfoSync().platform == 'android') {
235
+ //plus.globalEvent.addEventListener('plusready', listenNFCStatus, false);
236
+ }
237
+
238
+ var waiting;
239
+ var readyWriteData = false;
240
+ var readyRead = false;
241
+
242
+ function writeData() {
243
+ var textEle = plus.globalEvent.getElementById('text');
244
+ if (!textEle.value) {
245
+ uni.showToast({
246
+ title: '请输入要写入的内容!',
247
+ icon: 'none'
248
+ });
249
+ return;
250
+ }
251
+ readyWriteData = true;
252
+ waiting = plus.nativeUI.showWaiting("请将卡靠近!");
253
+ }
254
+
255
+ function readData(getCardNo) {
256
+ readyRead = true;
257
+ _getCardNo = getCardNo
258
+ waiting = plus.nativeUI.showWaiting("请将卡靠近!", {
259
+ modal: false
260
+ });
261
+ }
262
+
263
+ function closeReadAndWrite() {
264
+ readyWriteData = false;
265
+ readyRead = false;
266
+
267
+ if (waiting) {
268
+ waiting.close();
269
+ }
270
270
  }
package/w-card/w-card.vue CHANGED
@@ -52,7 +52,8 @@ const props = defineProps({
52
52
  type:Object,
53
53
  default:{
54
54
  label:null,
55
- show:null
55
+ show:null,
56
+ clickAction:null
56
57
  }
57
58
  }
58
59
  })
@@ -151,6 +152,13 @@ function goto(type: string, item: any = {}, subItem: any = {}) {
151
152
  })
152
153
  break
153
154
  case 'edit':
155
+
156
+ if(props.editButtonConfig.clickAction){
157
+ props.editButtonConfig.clickAction(props.itemData)
158
+ return
159
+ }
160
+
161
+
154
162
  if (props.actionType === 'relation') {
155
163
  emits('edit')
156
164
 
@@ -357,6 +365,7 @@ function EditButtonLabel(){
357
365
  <wd-button :round="false" size="small" class="btn" v-if="props.page.buttons.includes('detail')" @click="goto('detail')">
358
366
  详情
359
367
  </wd-button>
368
+ <!-- //编辑按钮 -->
360
369
  <wd-button :round="false" type="warning" size="small" class="btn" v-if="isShowEditButton()"
361
370
  @click="goto('edit')">
362
371
  {{EditButtonLabel()}}
@@ -422,7 +431,7 @@ function EditButtonLabel(){
422
431
  }
423
432
 
424
433
  position: relative; // 添加定位上下文
425
- padding-bottom: 80rpx; // 为按钮预留空间
434
+ padding-bottom: 20rpx; // 为按钮预留空间
426
435
 
427
436
  .expand-btn-container {
428
437
  /* 尺寸调整 */
@@ -434,7 +443,7 @@ function EditButtonLabel(){
434
443
  position: absolute;
435
444
  right: 50%;
436
445
  transform: translateX(50%);
437
- bottom: 0;
446
+ bottom: -23px;
438
447
  width: auto !important;
439
448
  margin-top: 0;
440
449
 
@@ -135,7 +135,7 @@
135
135
 
136
136
  <script setup lang="ts">
137
137
  import wSelectPicker from '../w-select-picker/w-select-picker.vue'
138
- import dayjs from 'dayjs/esm/index'
138
+ import dayjs from 'dayjs/esm/index'
139
139
  import { defineProps, ref, defineEmits, computed } from 'vue'
140
140
  const props = defineProps({
141
141
  subItem: {
@@ -248,12 +248,12 @@ const success = (e: any) => {
248
248
  emit('update:modelValue', JSON.stringify({ valid: "new", fileKey: JSON.parse(e.file.response).fileKey, fileName: e.file.name, base: {...e.file } }))
249
249
  }
250
250
 
251
- const displayFormat1 = (value:any) => {
252
- return dayjs(value[0]).format('YYYY-MM-DD HH:mm:ss') + ' ~ ' + dayjs(value[1]).format('YYYY-MM-DD HH:mm:ss')
251
+ const displayFormat1 = (value:any) => {
252
+ return dayjs(value[0]).format('YYYY-MM-DD HH:mm:ss') + ' ~ ' + dayjs(value[1]).format('YYYY-MM-DD HH:mm:ss')
253
253
  }
254
254
 
255
- const displayFormat2=(value:any) => {
256
- return dayjs(value[0]).format('YYYY-MM-DD') + ' ~ ' + dayjs(value[1]).format('YYYY-MM-DD')
255
+ const displayFormat2=(value:any) => {
256
+ return dayjs(value[0]).format('YYYY-MM-DD') + ' ~ ' + dayjs(value[1]).format('YYYY-MM-DD')
257
257
  }
258
258
 
259
259
  //wSelectPicker组件确定事件
@@ -1,185 +1,185 @@
1
- @import 'wot-design-uni/components/common/abstracts/variable';
2
- @import 'wot-design-uni/components/common/abstracts/mixin';
3
-
4
- .wot-theme-dark {
5
- @include b(select-picker) {
6
- @include when(border) {
7
- .wd-select-picker__cell {
8
- @include halfPixelBorder('top', $-cell-padding, $-dark-border-color);
9
- }
10
- }
11
-
12
- @include e(cell) {
13
- background-color: $-dark-background2;
14
- color: $-dark-color;
15
- @include when(disabled) {
16
- .wd-select-picker__value {
17
- color: $-dark-color3;
18
- }
19
- }
20
- }
21
-
22
- @include e(label) {
23
- color: $-dark-color;
24
- }
25
- @include e(value) {
26
- color: $-dark-color;
27
- @include m(placeholder) {
28
- color: $-dark-color-gray;
29
- }
30
- }
31
-
32
- :deep(.wd-select-picker__arrow),
33
- :deep(.wd-select-picker__close),
34
- :deep(.wd-select-picker__clear) {
35
- color: $-dark-color;
36
- }
37
-
38
- }
39
-
40
- }
41
-
42
- @include b(select-picker) {
43
- @include when(border) {
44
- .wd-select-picker__cell {
45
- @include halfPixelBorder('top', $-cell-padding);
46
- }
47
- }
48
- @include e(cell) {
49
- position: relative;
50
- display: flex;
51
- padding: $-cell-wrapper-padding $-cell-padding;
52
- align-items: flex-start;
53
- background-color: $-color-white;
54
- text-decoration: none;
55
- color: $-cell-title-color;
56
- font-size: $-cell-title-fs;
57
- overflow: hidden;
58
- line-height: $-cell-line-height;
59
- }
60
- @include e(cell) {
61
- @include when(disabled) {
62
- .wd-select-picker__value {
63
- color: $-input-disabled-color;
64
- }
65
- }
66
- @include when(align-right) {
67
- .wd-select-picker__value {
68
- text-align: right;
69
- }
70
- }
71
- @include when(error) {
72
- .wd-select-picker__value {
73
- color: $-input-error-color;
74
- }
75
- :deep(.wd-select-picker__arrow) {
76
- color: $-input-error-color;
77
- }
78
- }
79
- @include when(large) {
80
- font-size: $-cell-title-fs-large;
81
-
82
- :deep(.wd-select-picker__arrow),
83
- :deep(.wd-select-picker__clear) {
84
- font-size: $-cell-icon-size-large;
85
- }
86
- }
87
- }
88
- @include e(error-message){
89
- color: $-form-item-error-message-color;
90
- font-size: $-form-item-error-message-font-size;
91
- line-height: $-form-item-error-message-line-height;
92
- text-align: left;
93
- vertical-align: middle;
94
- }
95
- @include e(label) {
96
- position: relative;
97
- width: $-input-cell-label-width;
98
- color: $-cell-title-color;
99
- margin-right: $-cell-padding;
100
- box-sizing: border-box;
101
-
102
- @include when(required) {
103
- padding-left: 12px;
104
-
105
- &::after {
106
- position: absolute;
107
- left: 0;
108
- top: 2px;
109
- content: '*';
110
- font-size: $-cell-required-size;
111
- line-height: 1.1;
112
- color: $-cell-required-color;
113
- }
114
- }
115
- }
116
- @include e(value-wraper) {
117
- display: flex;
118
- }
119
- @include e(value) {
120
- flex: 1;
121
- margin-right: 10px;
122
- color: $-cell-value-color;
123
-
124
- @include when(ellipsis) {
125
- @include lineEllipsis;
126
- }
127
- @include m(placeholder) {
128
- color: $-input-placeholder-color;
129
- }
130
- }
131
- @include e(body) {
132
- flex: 1;
133
- }
134
- @include edeep(arrow, clear) {
135
- display: block;
136
- font-size: $-cell-icon-size;
137
- color: $-cell-arrow-color;
138
- line-height: $-cell-line-height;
139
- }
140
-
141
- @include edeep(clear) {
142
- color: $-cell-clear-color;
143
- }
144
-
145
- @include e(loading) {
146
- position: absolute;
147
- display: flex;
148
- top: 0;
149
- right: 0;
150
- bottom: 0;
151
- left: 0;
152
- align-items: center;
153
- justify-content: center;
154
- z-index: 3;
155
- background: $-picker-loading-bg;
156
- }
157
- // selectPiceker多出的样式
158
- @include edeep(header) {
159
- height: 72px;
160
- line-height: 72px;
161
- }
162
- @include e(wrapper) {
163
- padding: 0 10px;
164
- position: relative;
165
- max-height: 356px;
166
- box-sizing: border-box;
167
- overflow: auto;
168
-
169
- @include when(filterable) {
170
- height: 314px;
171
- max-height: 314px;
172
- }
173
-
174
- @include when(loading) {
175
- overflow: hidden;
176
- }
177
- }
178
- @include e(text-active) {
179
- color: $-color-theme;
180
- }
181
-
182
- @include e(footer) {
183
- padding: 24px 15px;
184
- }
185
- }
1
+ @import 'wot-design-uni/components/common/abstracts/variable';
2
+ @import 'wot-design-uni/components/common/abstracts/mixin';
3
+
4
+ .wot-theme-dark {
5
+ @include b(select-picker) {
6
+ @include when(border) {
7
+ .wd-select-picker__cell {
8
+ @include halfPixelBorder('top', $-cell-padding, $-dark-border-color);
9
+ }
10
+ }
11
+
12
+ @include e(cell) {
13
+ background-color: $-dark-background2;
14
+ color: $-dark-color;
15
+ @include when(disabled) {
16
+ .wd-select-picker__value {
17
+ color: $-dark-color3;
18
+ }
19
+ }
20
+ }
21
+
22
+ @include e(label) {
23
+ color: $-dark-color;
24
+ }
25
+ @include e(value) {
26
+ color: $-dark-color;
27
+ @include m(placeholder) {
28
+ color: $-dark-color-gray;
29
+ }
30
+ }
31
+
32
+ :deep(.wd-select-picker__arrow),
33
+ :deep(.wd-select-picker__close),
34
+ :deep(.wd-select-picker__clear) {
35
+ color: $-dark-color;
36
+ }
37
+
38
+ }
39
+
40
+ }
41
+
42
+ @include b(select-picker) {
43
+ @include when(border) {
44
+ .wd-select-picker__cell {
45
+ @include halfPixelBorder('top', $-cell-padding);
46
+ }
47
+ }
48
+ @include e(cell) {
49
+ position: relative;
50
+ display: flex;
51
+ padding: $-cell-wrapper-padding $-cell-padding;
52
+ align-items: flex-start;
53
+ background-color: $-color-white;
54
+ text-decoration: none;
55
+ color: $-cell-title-color;
56
+ font-size: $-cell-title-fs;
57
+ overflow: hidden;
58
+ line-height: $-cell-line-height;
59
+ }
60
+ @include e(cell) {
61
+ @include when(disabled) {
62
+ .wd-select-picker__value {
63
+ color: $-input-disabled-color;
64
+ }
65
+ }
66
+ @include when(align-right) {
67
+ .wd-select-picker__value {
68
+ text-align: right;
69
+ }
70
+ }
71
+ @include when(error) {
72
+ .wd-select-picker__value {
73
+ color: $-input-error-color;
74
+ }
75
+ :deep(.wd-select-picker__arrow) {
76
+ color: $-input-error-color;
77
+ }
78
+ }
79
+ @include when(large) {
80
+ font-size: $-cell-title-fs-large;
81
+
82
+ :deep(.wd-select-picker__arrow),
83
+ :deep(.wd-select-picker__clear) {
84
+ font-size: $-cell-icon-size-large;
85
+ }
86
+ }
87
+ }
88
+ @include e(error-message){
89
+ color: $-form-item-error-message-color;
90
+ font-size: $-form-item-error-message-font-size;
91
+ line-height: $-form-item-error-message-line-height;
92
+ text-align: left;
93
+ vertical-align: middle;
94
+ }
95
+ @include e(label) {
96
+ position: relative;
97
+ width: $-input-cell-label-width;
98
+ color: $-cell-title-color;
99
+ margin-right: $-cell-padding;
100
+ box-sizing: border-box;
101
+
102
+ @include when(required) {
103
+ padding-left: 12px;
104
+
105
+ &::after {
106
+ position: absolute;
107
+ left: 0;
108
+ top: 2px;
109
+ content: '*';
110
+ font-size: $-cell-required-size;
111
+ line-height: 1.1;
112
+ color: $-cell-required-color;
113
+ }
114
+ }
115
+ }
116
+ @include e(value-wraper) {
117
+ display: flex;
118
+ }
119
+ @include e(value) {
120
+ flex: 1;
121
+ margin-right: 10px;
122
+ color: $-cell-value-color;
123
+
124
+ @include when(ellipsis) {
125
+ @include lineEllipsis;
126
+ }
127
+ @include m(placeholder) {
128
+ color: $-input-placeholder-color;
129
+ }
130
+ }
131
+ @include e(body) {
132
+ flex: 1;
133
+ }
134
+ @include edeep(arrow, clear) {
135
+ display: block;
136
+ font-size: $-cell-icon-size;
137
+ color: $-cell-arrow-color;
138
+ line-height: $-cell-line-height;
139
+ }
140
+
141
+ @include edeep(clear) {
142
+ color: $-cell-clear-color;
143
+ }
144
+
145
+ @include e(loading) {
146
+ position: absolute;
147
+ display: flex;
148
+ top: 0;
149
+ right: 0;
150
+ bottom: 0;
151
+ left: 0;
152
+ align-items: center;
153
+ justify-content: center;
154
+ z-index: 3;
155
+ background: $-picker-loading-bg;
156
+ }
157
+ // selectPiceker多出的样式
158
+ @include edeep(header) {
159
+ height: 72px;
160
+ line-height: 72px;
161
+ }
162
+ @include e(wrapper) {
163
+ padding: 0 10px;
164
+ position: relative;
165
+ max-height: 356px;
166
+ box-sizing: border-box;
167
+ overflow: auto;
168
+
169
+ @include when(filterable) {
170
+ height: 314px;
171
+ max-height: 314px;
172
+ }
173
+
174
+ @include when(loading) {
175
+ overflow: hidden;
176
+ }
177
+ }
178
+ @include e(text-active) {
179
+ color: $-color-theme;
180
+ }
181
+
182
+ @include e(footer) {
183
+ padding: 24px 15px;
184
+ }
185
+ }
@@ -1,105 +1,105 @@
1
- import type { ComponentPublicInstance, ExtractPropTypes, PropType } from 'vue'
2
- import { baseProps, makeArrayProp, makeBooleanProp, makeNumberProp, makeRequiredProp, makeStringProp } from 'wot-design-uni/components/common/props'
3
- import type { FormItemRule } from 'wot-design-uni/components/wd-form/types'
4
-
5
- export type SelectPickerType = 'checkbox' | 'radio'
6
-
7
- export const selectPickerProps = {
8
- ...baseProps,
9
- /** 选择器左侧文案 */
10
- label: String,
11
- /** 设置左侧标题宽度 */
12
- labelWidth: makeStringProp('33%'),
13
- /** 禁用 */
14
- disabled: makeBooleanProp(false),
15
- /** 只读 */
16
- readonly: Boolean,
17
- /** 选择器占位符 */
18
- placeholder: String,
19
- /** 弹出层标题 */
20
- title: String,
21
- /** 选择器的值靠右展示 */
22
- alignRight: makeBooleanProp(false),
23
- /** 是否为错误状态,错误状态时右侧内容为红色 */
24
- error: makeBooleanProp(false),
25
- /** 必填样式 */
26
- required: makeBooleanProp(false),
27
- /** 使用 label 插槽时设置该选项 */
28
- useLabelSlot: makeBooleanProp(false),
29
- /** 使用默认插槽时设置该选项 */
30
- useDefaultSlot: makeBooleanProp(false),
31
- /** 设置选择器大小 */
32
- size: String,
33
- /** 选中的颜色(单/复选框) */
34
- checkedColor: String,
35
- /** 最小选中的数量(仅在复选框类型下生效,`type`类型为`checkbox`) */
36
- min: makeNumberProp(0),
37
- /** 最大选中的数量,0 为无限数量,默认为 0(仅在复选框类型下生效,`type`类型为`checkbox`) */
38
- max: makeNumberProp(0),
39
- /** 设置 picker 内部的选项组尺寸大小 (单/复选框) */
40
- selectSize: String,
41
- /** 加载中 */
42
- // loading: makeBooleanProp(false),
43
- /** 加载的颜色,只能使用十六进制的色值写法,且不能使用缩写 */
44
- loadingColor: makeStringProp('#4D80F0'),
45
- /** 点击遮罩是否关闭 */
46
- closeOnClickModal: makeBooleanProp(true),
47
- /** 选中项,`type`类型为`checkbox`时,类型为 array;`type`为`radio` 时 ,类型为 number / boolean / string */
48
- modelValue: makeRequiredProp([String, Number, Boolean, Array] as PropType<string | number | boolean | (string | number | boolean)[]>),
49
- /** 选择器数据,一维数组 */
50
- columns: makeArrayProp<Record<string, any>>(),
51
- /** 单复选选择器类型 */
52
- type: makeStringProp<SelectPickerType>('checkbox'),
53
- /** 选项对象中,value 对应的 key */
54
- valueKey: makeStringProp('value'),
55
- /** 选项对象中,展示的文本对应的 key */
56
- labelKey: makeStringProp('label'),
57
- /** 确认按钮文案 */
58
- confirmButtonText: String,
59
- /** 自定义展示文案的格式化函数,返回一个字符串 */
60
- displayFormat: Function as PropType<SelectPickerDisplayFormat>,
61
- /** 确定前校验函数,接收 (value, resolve) 参数,通过 resolve 继续执行 picker,resolve 接收 1 个 boolean 参数 */
62
- beforeConfirm: Function as PropType<SelectPickerBeforeConfirm>,
63
- /** 弹窗层级 */
64
- zIndex: makeNumberProp(15),
65
- /** 弹出面板是否设置底部安全距离(iphone X 类型的机型) */
66
- safeAreaInsetBottom: makeBooleanProp(true),
67
- /** 可搜索(目前只支持本地搜索) */
68
- filterable: makeBooleanProp(false),
69
- /** 搜索框占位符 */
70
- filterPlaceholder: String,
71
- /** 是否超出隐藏 */
72
- ellipsis: makeBooleanProp(false),
73
- /** 重新打开是否滚动到选中项 */
74
- scrollIntoView: makeBooleanProp(true),
75
- /** 表单域 `model` 字段名,在使用表单校验功能的情况下,该属性是必填的 */
76
- prop: String,
77
- /** 表单验证规则,结合`wd-form`组件使用 */
78
- rules: makeArrayProp<FormItemRule>(),
79
- /** 自定义内容样式类 */
80
- customContentClass: makeStringProp(''),
81
- /** 自定义标签样式类 */
82
- customLabelClass: makeStringProp(''),
83
- /** 自定义值样式类 */
84
- customValueClass: makeStringProp(''),
85
- /** 是否显示确认按钮(radio类型生效),默认值为:true */
86
- showConfirm: makeBooleanProp(true),
87
- /**
88
- * 显示清空按钮
89
- */
90
- clearable: makeBooleanProp(false)
91
- }
92
- export type SelectPickerProps = ExtractPropTypes<typeof selectPickerProps>
93
-
94
- export type SelectPickerDisplayFormat = (items: string | number | boolean | (string | number | boolean)[], columns: Record<string, any>[]) => string
95
-
96
- export type SelectPickerBeforeConfirm = (value: string | number | boolean | (string | number | boolean)[], resolve: (isPass: boolean) => void) => void
97
-
98
- export type SelectPickerExpose = {
99
- // 打开picker弹框
100
- open: () => void
101
- // 关闭picker弹框
102
- close: () => void
103
- }
104
-
105
- export type SelectPickerInstance = ComponentPublicInstance<SelectPickerExpose, SelectPickerProps>
1
+ import type { ComponentPublicInstance, ExtractPropTypes, PropType } from 'vue'
2
+ import { baseProps, makeArrayProp, makeBooleanProp, makeNumberProp, makeRequiredProp, makeStringProp } from 'wot-design-uni/components/common/props'
3
+ import type { FormItemRule } from 'wot-design-uni/components/wd-form/types'
4
+
5
+ export type SelectPickerType = 'checkbox' | 'radio'
6
+
7
+ export const selectPickerProps = {
8
+ ...baseProps,
9
+ /** 选择器左侧文案 */
10
+ label: String,
11
+ /** 设置左侧标题宽度 */
12
+ labelWidth: makeStringProp('33%'),
13
+ /** 禁用 */
14
+ disabled: makeBooleanProp(false),
15
+ /** 只读 */
16
+ readonly: Boolean,
17
+ /** 选择器占位符 */
18
+ placeholder: String,
19
+ /** 弹出层标题 */
20
+ title: String,
21
+ /** 选择器的值靠右展示 */
22
+ alignRight: makeBooleanProp(false),
23
+ /** 是否为错误状态,错误状态时右侧内容为红色 */
24
+ error: makeBooleanProp(false),
25
+ /** 必填样式 */
26
+ required: makeBooleanProp(false),
27
+ /** 使用 label 插槽时设置该选项 */
28
+ useLabelSlot: makeBooleanProp(false),
29
+ /** 使用默认插槽时设置该选项 */
30
+ useDefaultSlot: makeBooleanProp(false),
31
+ /** 设置选择器大小 */
32
+ size: String,
33
+ /** 选中的颜色(单/复选框) */
34
+ checkedColor: String,
35
+ /** 最小选中的数量(仅在复选框类型下生效,`type`类型为`checkbox`) */
36
+ min: makeNumberProp(0),
37
+ /** 最大选中的数量,0 为无限数量,默认为 0(仅在复选框类型下生效,`type`类型为`checkbox`) */
38
+ max: makeNumberProp(0),
39
+ /** 设置 picker 内部的选项组尺寸大小 (单/复选框) */
40
+ selectSize: String,
41
+ /** 加载中 */
42
+ // loading: makeBooleanProp(false),
43
+ /** 加载的颜色,只能使用十六进制的色值写法,且不能使用缩写 */
44
+ loadingColor: makeStringProp('#4D80F0'),
45
+ /** 点击遮罩是否关闭 */
46
+ closeOnClickModal: makeBooleanProp(true),
47
+ /** 选中项,`type`类型为`checkbox`时,类型为 array;`type`为`radio` 时 ,类型为 number / boolean / string */
48
+ modelValue: makeRequiredProp([String, Number, Boolean, Array] as PropType<string | number | boolean | (string | number | boolean)[]>),
49
+ /** 选择器数据,一维数组 */
50
+ columns: makeArrayProp<Record<string, any>>(),
51
+ /** 单复选选择器类型 */
52
+ type: makeStringProp<SelectPickerType>('checkbox'),
53
+ /** 选项对象中,value 对应的 key */
54
+ valueKey: makeStringProp('value'),
55
+ /** 选项对象中,展示的文本对应的 key */
56
+ labelKey: makeStringProp('label'),
57
+ /** 确认按钮文案 */
58
+ confirmButtonText: String,
59
+ /** 自定义展示文案的格式化函数,返回一个字符串 */
60
+ displayFormat: Function as PropType<SelectPickerDisplayFormat>,
61
+ /** 确定前校验函数,接收 (value, resolve) 参数,通过 resolve 继续执行 picker,resolve 接收 1 个 boolean 参数 */
62
+ beforeConfirm: Function as PropType<SelectPickerBeforeConfirm>,
63
+ /** 弹窗层级 */
64
+ zIndex: makeNumberProp(15),
65
+ /** 弹出面板是否设置底部安全距离(iphone X 类型的机型) */
66
+ safeAreaInsetBottom: makeBooleanProp(true),
67
+ /** 可搜索(目前只支持本地搜索) */
68
+ filterable: makeBooleanProp(false),
69
+ /** 搜索框占位符 */
70
+ filterPlaceholder: String,
71
+ /** 是否超出隐藏 */
72
+ ellipsis: makeBooleanProp(false),
73
+ /** 重新打开是否滚动到选中项 */
74
+ scrollIntoView: makeBooleanProp(true),
75
+ /** 表单域 `model` 字段名,在使用表单校验功能的情况下,该属性是必填的 */
76
+ prop: String,
77
+ /** 表单验证规则,结合`wd-form`组件使用 */
78
+ rules: makeArrayProp<FormItemRule>(),
79
+ /** 自定义内容样式类 */
80
+ customContentClass: makeStringProp(''),
81
+ /** 自定义标签样式类 */
82
+ customLabelClass: makeStringProp(''),
83
+ /** 自定义值样式类 */
84
+ customValueClass: makeStringProp(''),
85
+ /** 是否显示确认按钮(radio类型生效),默认值为:true */
86
+ showConfirm: makeBooleanProp(true),
87
+ /**
88
+ * 显示清空按钮
89
+ */
90
+ clearable: makeBooleanProp(false)
91
+ }
92
+ export type SelectPickerProps = ExtractPropTypes<typeof selectPickerProps>
93
+
94
+ export type SelectPickerDisplayFormat = (items: string | number | boolean | (string | number | boolean)[], columns: Record<string, any>[]) => string
95
+
96
+ export type SelectPickerBeforeConfirm = (value: string | number | boolean | (string | number | boolean)[], resolve: (isPass: boolean) => void) => void
97
+
98
+ export type SelectPickerExpose = {
99
+ // 打开picker弹框
100
+ open: () => void
101
+ // 关闭picker弹框
102
+ close: () => void
103
+ }
104
+
105
+ export type SelectPickerInstance = ComponentPublicInstance<SelectPickerExpose, SelectPickerProps>
@@ -46,7 +46,8 @@ const props = defineProps({
46
46
  type:Object,
47
47
  default:{
48
48
  label:"",
49
- show:null
49
+ show:null,
50
+ clickAction:null
50
51
  }
51
52
  }
52
53
  })