br-dionysus 1.17.6 → 1.17.7
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/dist/br-dionysus.es.js +1 -0
- package/dist/br-dionysus.umd.js +1 -1
- package/mock/ajax/index.ts +48 -0
- package/mock/index.ts +51 -0
- package/mock/interface/enum.ts +4 -0
- package/mock/interface/type.ts +32 -0
- package/mock/mockData/book.ts +48 -0
- package/package.json +3 -1
- package/packages/MSelectTable/docs/DemoTest1.vue +25 -43
- package/packages/MSelectTable/docs/DemoTest2.vue +25 -43
- package/packages/MSelectTable/docs/DemoTest3.vue +29 -45
- package/packages/MSelectTable/docs/DemoTest4.vue +32 -39
- package/packages/MSelectTable/docs/DemoTest5.vue +37 -50
- package/packages/MSelectTable/docs/DemoTest6.vue +29 -44
- package/packages/MSelectTable/src/MSelectTable.vue +3 -0
- package/packages/Tool/moneyFormat/moneyFormat.ts +2 -1
- package/src/global.d.ts +0 -2
- package/vite.config.ts +1 -1
- package/web-types.json +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import Axios from 'axios'
|
|
2
|
+
import { RequestFunc, ResultData } from '../interface/type'
|
|
3
|
+
import { Method } from '../interface/enum'
|
|
4
|
+
|
|
5
|
+
// 是否存在未关闭的弹窗
|
|
6
|
+
let isExistModal: boolean = false
|
|
7
|
+
const ajax: RequestFunc = (
|
|
8
|
+
{ url, method, baseUrl } = { url: '', method: Method.GET, baseUrl: '' },
|
|
9
|
+
data = { query: {}, body: {}, headers: {} }
|
|
10
|
+
) => {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
Axios({
|
|
13
|
+
baseURL: baseUrl,
|
|
14
|
+
url,
|
|
15
|
+
method,
|
|
16
|
+
params: data.query || (method === Method.GET ? data : {}),
|
|
17
|
+
data: data.body || (method === Method.POST ? data : {}),
|
|
18
|
+
timeout: 1000 * 60 * 3,
|
|
19
|
+
headers: {
|
|
20
|
+
...(data.headers || {})
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
.then((res: ResultData) => {
|
|
24
|
+
res.data.code = Number(res.data.code)
|
|
25
|
+
const code = res.data.code
|
|
26
|
+
if (code === 401 || code === 1001) {
|
|
27
|
+
if (isExistModal) return
|
|
28
|
+
isExistModal = true
|
|
29
|
+
return false
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (code !== 200) {
|
|
33
|
+
// 业务异常
|
|
34
|
+
reject(res.data)
|
|
35
|
+
return false
|
|
36
|
+
}
|
|
37
|
+
resolve(res.data)
|
|
38
|
+
})
|
|
39
|
+
.catch((err: any) => {
|
|
40
|
+
// http异常
|
|
41
|
+
// 请在此处处理http异常
|
|
42
|
+
console.log(err)
|
|
43
|
+
reject(err.response?.data ?? err)
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default ajax
|
package/mock/index.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import Axios from 'axios'
|
|
2
|
+
import MockAdapter from 'axios-mock-adapter'
|
|
3
|
+
import ajax from './ajax'
|
|
4
|
+
import { Method } from './interface/enum'
|
|
5
|
+
import { BookList, bookList } from './mockData/book'
|
|
6
|
+
import { Parameter, ResultData } from './interface/type'
|
|
7
|
+
|
|
8
|
+
/** 列表返回 */
|
|
9
|
+
interface ListData<T> {
|
|
10
|
+
rows: T;
|
|
11
|
+
total: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const mock = new MockAdapter(Axios, { delayResponse: 500 })
|
|
15
|
+
|
|
16
|
+
const listHandler = (config: any): [number, any] => {
|
|
17
|
+
const params = (config && (config as any).params) || {}
|
|
18
|
+
const keyword = params.keyword || ''
|
|
19
|
+
const page = Number(params.page || 1)
|
|
20
|
+
const pageSize = Number(params.pageSize || 20)
|
|
21
|
+
|
|
22
|
+
const toLower = (v: any) => String(v || '').toLowerCase()
|
|
23
|
+
const like = (a: any, b: any) => toLower(a).includes(toLower(b))
|
|
24
|
+
|
|
25
|
+
let rows = bookList.filter(b =>
|
|
26
|
+
!keyword || like(b.name, keyword) || like(b.sn, keyword) || like(b.author, keyword)
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
const total = rows.length
|
|
30
|
+
const start = Math.max(0, (page - 1) * pageSize)
|
|
31
|
+
rows = rows.slice(start, start + pageSize)
|
|
32
|
+
|
|
33
|
+
return [200, { code: 200, data: { rows, total }, msg: '' }]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
mock.onGet('/api/v1/book/list').reply(listHandler)
|
|
37
|
+
mock.onAny().passThrough()
|
|
38
|
+
|
|
39
|
+
export const getBookList = (data: Parameter = {}): Promise<ResultData<ListData<BookList>>> => {
|
|
40
|
+
return ajax(
|
|
41
|
+
{
|
|
42
|
+
url: '/api/v1/book/list',
|
|
43
|
+
method: Method.GET
|
|
44
|
+
},
|
|
45
|
+
data
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default {
|
|
50
|
+
getBookList
|
|
51
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Method } from './enum'
|
|
2
|
+
|
|
3
|
+
export interface Result {
|
|
4
|
+
code?: string | number | null;
|
|
5
|
+
msg?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface ResultData<T = any> extends Result {
|
|
9
|
+
data?: T;
|
|
10
|
+
code?: string | number | null;
|
|
11
|
+
msg?: any;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface Parameter {
|
|
15
|
+
query?: Record<any, any>;
|
|
16
|
+
body?: Record<any, any>;
|
|
17
|
+
headers?: Record<string, any>;
|
|
18
|
+
[propName: string]: any;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface RequestFunc {
|
|
22
|
+
(
|
|
23
|
+
api: {
|
|
24
|
+
url: string;
|
|
25
|
+
method: Method;
|
|
26
|
+
baseUrl?: string;
|
|
27
|
+
responseType?: string;
|
|
28
|
+
},
|
|
29
|
+
data: Parameter,
|
|
30
|
+
showErrMsg?: boolean
|
|
31
|
+
): Promise<any>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface Book {
|
|
2
|
+
id: number;
|
|
3
|
+
/** 书名 */
|
|
4
|
+
name: string;
|
|
5
|
+
/** 入库时间 */
|
|
6
|
+
date: string;
|
|
7
|
+
/** 作者 */
|
|
8
|
+
author: string;
|
|
9
|
+
/** 发行地 */
|
|
10
|
+
address: string;
|
|
11
|
+
/** 编码 */
|
|
12
|
+
sn: string;
|
|
13
|
+
}
|
|
14
|
+
export type BookList = Book[]
|
|
15
|
+
|
|
16
|
+
export const bookList: BookList = [
|
|
17
|
+
{ id: 1, name: '哈利波特', date: '2023-10-24 22:55:33', author: '绫波丽', address: '中国 上海', sn: 'sn2310240001' },
|
|
18
|
+
{ id: 2, name: '三体', date: '2023-10-25 10:15:20', author: '刘慈欣', address: '中国 北京', sn: 'sn2310250002' },
|
|
19
|
+
{ id: 3, name: '红楼梦', date: '2023-10-26 09:05:11', author: '曹雪芹', address: '中国 北京', sn: 'sn2310260003' },
|
|
20
|
+
{ id: 4, name: '西游记', date: '2023-10-27 14:22:45', author: '吴承恩', address: '中国 江苏', sn: 'sn2310270004' },
|
|
21
|
+
{ id: 5, name: '水浒传', date: '2023-10-28 18:33:02', author: '施耐庵', address: '中国 山东', sn: 'sn2310280005' },
|
|
22
|
+
{ id: 6, name: '斗罗大陆', date: '2023-10-29 12:40:59', author: '唐家三少', address: '中国 上海', sn: 'sn2310290006' },
|
|
23
|
+
{ id: 7, name: '全职高手', date: '2023-10-30 08:12:37', author: '蝴蝶蓝', address: '中国 上海', sn: 'sn2310300007' },
|
|
24
|
+
{ id: 8, name: '庆余年', date: '2023-10-31 20:51:13', author: '猫腻', address: '中国 北京', sn: 'sn2310310008' },
|
|
25
|
+
{ id: 9, name: '雪中悍刀行', date: '2023-11-01 07:44:26', author: '烽火戏诸侯', address: '中国 浙江', sn: 'sn2311010009' },
|
|
26
|
+
{ id: 10, name: '平凡的世界', date: '2023-11-02 16:17:58', author: '路遥', address: '中国 陕西', sn: 'sn2311020010' },
|
|
27
|
+
{ id: 11, name: '围城', date: '2023-11-03 11:08:21', author: '钱钟书', address: '中国 上海', sn: 'sn2311030011' },
|
|
28
|
+
{ id: 12, name: '小王子', date: '2023-11-04 13:33:47', author: '圣埃克苏佩里', address: '法国 巴黎', sn: 'sn2311040012' },
|
|
29
|
+
{ id: 13, name: '百年孤独', date: '2023-11-05 19:25:10', author: '加西亚·马尔克斯', address: '哥伦比亚 波哥大', sn: 'sn2311050013' },
|
|
30
|
+
{ id: 14, name: '悲惨世界', date: '2023-11-06 21:41:33', author: '维克多·雨果', address: '法国 巴黎', sn: 'sn2311060014' },
|
|
31
|
+
{ id: 15, name: '格林童话', date: '2023-11-07 09:59:05', author: '格林兄弟', address: '德国 柏林', sn: 'sn2311070015' },
|
|
32
|
+
{ id: 16, name: '老人与海', date: '2023-11-08 22:12:40', author: '海明威', address: '美国 纽约', sn: 'sn2311080016' },
|
|
33
|
+
{ id: 17, name: '呼啸山庄', date: '2023-11-09 15:36:18', author: '艾米莉·勃朗特', address: '英国 伦敦', sn: 'sn2311090017' },
|
|
34
|
+
{ id: 18, name: '傲慢与偏见', date: '2023-11-10 08:48:52', author: '简·奥斯汀', address: '英国 牛津', sn: 'sn2311100018' },
|
|
35
|
+
{ id: 19, name: '追风筝的人', date: '2023-11-11 17:02:33', author: '卡勒德·胡赛尼', address: '美国 旧金山', sn: 'sn2311110019' },
|
|
36
|
+
{ id: 20, name: '解忧杂货店', date: '2023-11-12 10:27:44', author: '东野圭吾', address: '日本 东京', sn: 'sn2311120020' },
|
|
37
|
+
{ id: 21, name: '嫌疑人X的献身', date: '2023-11-13 11:39:28', author: '东野圭吾', address: '日本 大阪', sn: 'sn2311130021' },
|
|
38
|
+
{ id: 22, name: '霍乱时期的爱情', date: '2023-11-14 20:03:07', author: '加西亚·马尔克斯', address: '哥伦比亚 卡塔赫纳', sn: 'sn2311140022' },
|
|
39
|
+
{ id: 23, name: '人类简史', date: '2023-11-15 09:14:59', author: '尤瓦尔·赫拉利', address: '以色列 耶路撒冷', sn: 'sn2311150023' },
|
|
40
|
+
{ id: 24, name: '未来简史', date: '2023-11-16 12:01:01', author: '尤瓦尔·赫拉利', address: '以色列 特拉维夫', sn: 'sn2311160024' },
|
|
41
|
+
{ id: 25, name: '刀锋', date: '2023-11-17 07:20:40', author: '毛姆', address: '英国 伦敦', sn: 'sn2311170025' },
|
|
42
|
+
{ id: 26, name: '局外人', date: '2023-11-18 18:44:12', author: '加缪', address: '法国 里昂', sn: 'sn2311180026' },
|
|
43
|
+
{ id: 27, name: '挪威的森林', date: '2023-11-19 22:58:06', author: '村上春树', address: '日本 神户', sn: 'sn2311190027' },
|
|
44
|
+
{ id: 28, name: '小岛经济学', date: '2023-11-20 08:09:33', author: '彼得·希夫', address: '美国 波士顿', sn: 'sn2311200028' },
|
|
45
|
+
{ id: 29, name: '围棋人生', date: '2023-11-21 16:46:27', author: '阿城', address: '中国 北京', sn: 'sn2311210029' },
|
|
46
|
+
{ id: 30, name: '白夜行', date: '2023-11-22 13:31:19', author: '东野圭吾', address: '日本 东京', sn: 'sn2311220030' },
|
|
47
|
+
{ id: 31, name: '解密', date: '2023-11-23 10:05:55', author: '麦家', address: '中国 杭州', sn: 'sn2311230031' }
|
|
48
|
+
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "br-dionysus",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.7",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite --config vite.config.ts",
|
|
6
6
|
"build:doc": "vue-tsc --noEmit && vite build --config ./build/doc.config.ts && node script/copyDir.js",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@element-plus/icons-vue": "2.3.1",
|
|
20
|
+
"@types/big.js": "^6.2.2",
|
|
20
21
|
"@vue/compiler-sfc": "~3.4.27",
|
|
21
22
|
"big.js": "~6.2.1",
|
|
22
23
|
"dayjs": "~1.11.10",
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
"@vue/test-utils": "~2.4.6",
|
|
38
39
|
"archiver": "~7.0.1",
|
|
39
40
|
"axios": "~1.7.0",
|
|
41
|
+
"axios-mock-adapter": "^2.1.0",
|
|
40
42
|
"connect-history-api-fallback": "~2.0.0",
|
|
41
43
|
"cypress": "~13.13.2",
|
|
42
44
|
"eslint": "~8.49.0",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
v-model="code"
|
|
8
8
|
:tableTitle="commodityOptionsTitle"
|
|
9
9
|
:options="options"
|
|
10
|
-
:keywords="{ label: '
|
|
10
|
+
:keywords="{ label: 'name', value: 'sn' }"
|
|
11
11
|
:total="total"
|
|
12
12
|
scrollbarAlwaysOn
|
|
13
13
|
filterable
|
|
@@ -23,65 +23,47 @@
|
|
|
23
23
|
<script setup lang="ts">
|
|
24
24
|
import { ref } from 'vue'
|
|
25
25
|
import { Page } from './../../typings/class'
|
|
26
|
+
import { getBookList } from '../../../mock'
|
|
27
|
+
import { Book, BookList } from '../../../mock/mockData/book'
|
|
26
28
|
|
|
27
|
-
const commodityOptionsTitle: TableTitle[] = [{
|
|
28
|
-
prop: '
|
|
29
|
-
label: '
|
|
29
|
+
const commodityOptionsTitle: TableTitle<Book>[] = [{
|
|
30
|
+
prop: 'sn',
|
|
31
|
+
label: '编码'
|
|
30
32
|
}, {
|
|
31
|
-
prop: '
|
|
32
|
-
label: '
|
|
33
|
+
prop: 'name',
|
|
34
|
+
label: '书名'
|
|
33
35
|
}, {
|
|
34
|
-
prop: '
|
|
35
|
-
label: '
|
|
36
|
+
prop: 'author',
|
|
37
|
+
label: '作者'
|
|
36
38
|
}, {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
// prop: 'address',
|
|
40
|
+
// label: '发行地'
|
|
41
|
+
// }, {
|
|
42
|
+
prop: 'date',
|
|
43
|
+
label: '入库时间'
|
|
39
44
|
}]
|
|
40
45
|
|
|
41
46
|
const code = ref<string>('')
|
|
42
47
|
|
|
43
|
-
const total = ref(0)
|
|
44
|
-
const options = ref<
|
|
45
|
-
interface RowDataType {
|
|
46
|
-
/** 单据类型 */
|
|
47
|
-
PRDocType: string;
|
|
48
|
-
/** 请购单号 */
|
|
49
|
-
DocNo: number;
|
|
50
|
-
/** 名称 */
|
|
51
|
-
ApprovedQtyPU: string;
|
|
52
|
-
/** 货币 */
|
|
53
|
-
ACCode: string;
|
|
54
|
-
}
|
|
55
|
-
const mockData: RowDataType[] = []
|
|
56
|
-
for (let i = 0; i < 1000; i++) {
|
|
57
|
-
mockData.push({
|
|
58
|
-
PRDocType: '测试数据' + (i + 1),
|
|
59
|
-
DocNo: i + 1,
|
|
60
|
-
ApprovedQtyPU: 'ApprovedQtyPU' + (i + 1),
|
|
61
|
-
ACCode: 'ACCode'
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
const getData = async (query: string, page: Page) => {
|
|
65
|
-
return new Promise<void>((resolve) => {
|
|
66
|
-
setTimeout(() => {
|
|
67
|
-
const start = (page.currentPage - 1) * page.pageSize
|
|
68
|
-
options.value = mockData.filter(item => item.ApprovedQtyPU.includes(query) || item.PRDocType.includes(query)).slice(start, start + page.pageSize)
|
|
69
|
-
total.value = mockData.length
|
|
70
|
-
resolve()
|
|
71
|
-
}, 500)
|
|
72
|
-
})
|
|
73
|
-
}
|
|
48
|
+
const total = ref<number>(0)
|
|
49
|
+
const options = ref<BookList>([])
|
|
74
50
|
|
|
75
51
|
const selected = (value: string) => {
|
|
76
52
|
console.log(value)
|
|
77
53
|
}
|
|
78
54
|
|
|
79
55
|
const toPage = (page: Page, str: any) => {
|
|
80
|
-
|
|
56
|
+
remoteMethod(str, page)
|
|
81
57
|
}
|
|
82
58
|
|
|
83
59
|
const remoteMethod = async (query: string, page: Page = new Page()) => {
|
|
84
|
-
await
|
|
60
|
+
const res = await getBookList({
|
|
61
|
+
keyword: query,
|
|
62
|
+
page: page.currentPage,
|
|
63
|
+
pageSize: page.pageSize
|
|
64
|
+
})
|
|
65
|
+
options.value = res.data?.rows ?? []
|
|
66
|
+
total.value = res.data?.total ?? 0
|
|
85
67
|
}
|
|
86
68
|
</script>
|
|
87
69
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
:name="name"
|
|
10
10
|
:tableTitle="commodityOptionsTitle"
|
|
11
11
|
:options="options"
|
|
12
|
-
:keywords="{ label: '
|
|
12
|
+
:keywords="{ label: 'name', value: 'sn' }"
|
|
13
13
|
:total="total"
|
|
14
14
|
scrollbarAlwaysOn
|
|
15
15
|
filterable
|
|
@@ -25,66 +25,48 @@
|
|
|
25
25
|
<script setup lang="ts">
|
|
26
26
|
import { ref } from 'vue'
|
|
27
27
|
import { Page } from './../../typings/class'
|
|
28
|
+
import { getBookList } from '../../../mock'
|
|
29
|
+
import { Book, BookList } from '../../../mock/mockData/book'
|
|
28
30
|
|
|
29
|
-
const commodityOptionsTitle: TableTitle[] = [{
|
|
30
|
-
prop: '
|
|
31
|
-
label: '
|
|
31
|
+
const commodityOptionsTitle: TableTitle<Book>[] = [{
|
|
32
|
+
prop: 'sn',
|
|
33
|
+
label: '编码'
|
|
32
34
|
}, {
|
|
33
|
-
prop: '
|
|
34
|
-
label: '
|
|
35
|
+
prop: 'name',
|
|
36
|
+
label: '书名'
|
|
35
37
|
}, {
|
|
36
|
-
prop: '
|
|
37
|
-
label: '
|
|
38
|
+
prop: 'author',
|
|
39
|
+
label: '作者'
|
|
38
40
|
}, {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
// prop: 'address',
|
|
42
|
+
// label: '发行地'
|
|
43
|
+
// }, {
|
|
44
|
+
prop: 'date',
|
|
45
|
+
label: '入库时间'
|
|
41
46
|
}]
|
|
42
47
|
|
|
43
48
|
const code = ref<string>('')
|
|
44
49
|
const name = ref<string>('这是name')
|
|
45
50
|
|
|
46
|
-
const total = ref(0)
|
|
47
|
-
const options = ref<
|
|
48
|
-
interface RowDataType {
|
|
49
|
-
/** 单据类型 */
|
|
50
|
-
PRDocType: string;
|
|
51
|
-
/** 请购单号 */
|
|
52
|
-
DocNo: number;
|
|
53
|
-
/** 名称 */
|
|
54
|
-
ApprovedQtyPU: string;
|
|
55
|
-
/** 货币 */
|
|
56
|
-
ACCode: string;
|
|
57
|
-
}
|
|
58
|
-
const mockData: RowDataType[] = []
|
|
59
|
-
for (let i = 0; i < 1000; i++) {
|
|
60
|
-
mockData.push({
|
|
61
|
-
PRDocType: '测试数据' + (i + 1),
|
|
62
|
-
DocNo: i + 1,
|
|
63
|
-
ApprovedQtyPU: 'ApprovedQtyPU' + (i + 1),
|
|
64
|
-
ACCode: 'ACCode'
|
|
65
|
-
})
|
|
66
|
-
}
|
|
67
|
-
const getData = async (query: string, page: any) => {
|
|
68
|
-
return new Promise<void>((resolve) => {
|
|
69
|
-
setTimeout(() => {
|
|
70
|
-
const start = (page.currentPage - 1) * page.pageSize
|
|
71
|
-
options.value = mockData.filter(item => item.ApprovedQtyPU.includes(query) || item.PRDocType.includes(query)).slice(start, start + page.pageSize)
|
|
72
|
-
total.value = mockData.length
|
|
73
|
-
resolve()
|
|
74
|
-
}, 500)
|
|
75
|
-
})
|
|
76
|
-
}
|
|
51
|
+
const total = ref<number>(0)
|
|
52
|
+
const options = ref<BookList>([])
|
|
77
53
|
|
|
78
54
|
const selected = (value: string) => {
|
|
79
55
|
console.log(value)
|
|
80
56
|
}
|
|
81
57
|
|
|
82
58
|
const toPage = (page: Page, str: any) => {
|
|
83
|
-
|
|
59
|
+
remoteMethod(str, page)
|
|
84
60
|
}
|
|
85
61
|
|
|
86
62
|
const remoteMethod = async (query: string, page: Page = new Page()) => {
|
|
87
|
-
await
|
|
63
|
+
const res = await getBookList({
|
|
64
|
+
keyword: query,
|
|
65
|
+
page: page.currentPage,
|
|
66
|
+
pageSize: page.pageSize
|
|
67
|
+
})
|
|
68
|
+
options.value = res.data?.rows ?? []
|
|
69
|
+
total.value = res.data?.total ?? 0
|
|
88
70
|
}
|
|
89
71
|
</script>
|
|
90
72
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
v-model="code"
|
|
8
8
|
:tableTitle="commodityOptionsTitle"
|
|
9
9
|
:options="options"
|
|
10
|
-
:keywords="{ label: '
|
|
10
|
+
:keywords="{ label: 'name', value: 'sn' }"
|
|
11
11
|
:total="total"
|
|
12
12
|
scrollbarAlwaysOn
|
|
13
13
|
filterable
|
|
@@ -30,47 +30,36 @@
|
|
|
30
30
|
<script setup lang="ts">
|
|
31
31
|
import { ref } from 'vue'
|
|
32
32
|
import { Page } from './../../typings/class'
|
|
33
|
+
import { Book, BookList } from '../../../mock/mockData/book'
|
|
34
|
+
import { getBookList } from '../../../mock'
|
|
33
35
|
|
|
34
|
-
const commodityOptionsTitle: TableTitle[] = [{
|
|
35
|
-
prop: '
|
|
36
|
-
label: '
|
|
36
|
+
const commodityOptionsTitle: TableTitle<Book>[] = [{
|
|
37
|
+
prop: 'sn',
|
|
38
|
+
label: '编码'
|
|
37
39
|
}, {
|
|
38
|
-
prop: '
|
|
39
|
-
label: '
|
|
40
|
+
prop: 'name',
|
|
41
|
+
label: '书名'
|
|
40
42
|
}, {
|
|
41
|
-
prop: '
|
|
42
|
-
label: '
|
|
43
|
+
prop: 'author',
|
|
44
|
+
label: '作者'
|
|
43
45
|
}, {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
// prop: 'address',
|
|
47
|
+
// label: '发行地'
|
|
48
|
+
// }, {
|
|
49
|
+
prop: 'date',
|
|
50
|
+
label: '入库时间'
|
|
46
51
|
}]
|
|
47
52
|
|
|
48
53
|
const code = ref<string | number | Array<string | number>>([])
|
|
49
54
|
|
|
50
|
-
const total = ref(0)
|
|
51
|
-
const options = ref<
|
|
52
|
-
const mockData: any[] = []
|
|
53
|
-
for (let i = 0; i < 1000; i++) {
|
|
54
|
-
mockData.push({
|
|
55
|
-
PRDocType: '测试数据' + (i + 1),
|
|
56
|
-
DocNo: i + 1,
|
|
57
|
-
ApprovedQtyPU: 'ApprovedQtyPU' + (i + 1),
|
|
58
|
-
ACCode: 'ACCode'
|
|
59
|
-
})
|
|
60
|
-
}
|
|
55
|
+
const total = ref<number>(0)
|
|
56
|
+
const options = ref<BookList>([])
|
|
61
57
|
|
|
62
58
|
setTimeout(() => {
|
|
63
|
-
options.value = [
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
ACCode: 'xxxACCode1'
|
|
68
|
-
}, {
|
|
69
|
-
PRDocType: 'xxxPRDocType2',
|
|
70
|
-
DocNo: 2,
|
|
71
|
-
ApprovedQtyPU: 'xxxApprovedQtyPU2',
|
|
72
|
-
ACCode: 'xxxACCode2'
|
|
73
|
-
}]
|
|
59
|
+
options.value = [
|
|
60
|
+
{ id: 4, name: '西游记', date: '2023-10-27 14:22:45', author: '吴承恩', address: '中国 江苏', sn: 'sn2310270004' },
|
|
61
|
+
{ id: 5, name: '水浒传', date: '2023-10-28 18:33:02', author: '施耐庵', address: '中国 山东', sn: 'sn2310280005' }
|
|
62
|
+
]
|
|
74
63
|
}, 100)
|
|
75
64
|
|
|
76
65
|
const selected = (value: string | number | Array<number | string>) => {
|
|
@@ -78,30 +67,25 @@ const selected = (value: string | number | Array<number | string>) => {
|
|
|
78
67
|
}
|
|
79
68
|
|
|
80
69
|
const toPage = (page: Page, str: any) => {
|
|
81
|
-
|
|
82
|
-
getData(str, page)
|
|
70
|
+
remoteMethod(str, page)
|
|
83
71
|
}
|
|
84
72
|
const selectMultiple = (value: string | number | Array<number | string>) => {
|
|
85
73
|
code.value = value
|
|
86
74
|
}
|
|
87
75
|
|
|
88
76
|
const remoteMethod = async (query: string, page: Page = new Page()) => {
|
|
89
|
-
await
|
|
77
|
+
const res = await getBookList({
|
|
78
|
+
keyword: query,
|
|
79
|
+
page: page.currentPage,
|
|
80
|
+
pageSize: page.pageSize
|
|
81
|
+
})
|
|
82
|
+
options.value = res.data?.rows ?? []
|
|
83
|
+
total.value = res.data?.total ?? 0
|
|
90
84
|
}
|
|
91
85
|
|
|
92
86
|
const selectChange = (value: string | number | Array<number | string>) => {
|
|
93
87
|
console.log('选择变化事件触发,注意,绑定值没有发生变化', value)
|
|
94
88
|
}
|
|
95
|
-
const getData = async (query: string, page: any) => {
|
|
96
|
-
return new Promise<void>((resolve) => {
|
|
97
|
-
setTimeout(() => {
|
|
98
|
-
const start = (page.currentPage - 1) * page.pageSize
|
|
99
|
-
options.value = mockData.filter(item => item.PRDocType.includes(query)).slice(start, start + page.pageSize)
|
|
100
|
-
total.value = mockData.length
|
|
101
|
-
resolve()
|
|
102
|
-
}, 500)
|
|
103
|
-
})
|
|
104
|
-
}
|
|
105
89
|
</script>
|
|
106
90
|
|
|
107
91
|
<style>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
v-model="code"
|
|
8
8
|
:tableTitle="commodityOptionsTitle"
|
|
9
9
|
:options="options"
|
|
10
|
-
:keywords="{ label: '
|
|
10
|
+
:keywords="{ label: 'name', value: 'sn' }"
|
|
11
11
|
:total="total"
|
|
12
12
|
scrollbarAlwaysOn
|
|
13
13
|
filterable
|
|
@@ -25,44 +25,42 @@
|
|
|
25
25
|
<script setup lang="ts">
|
|
26
26
|
import { ref, onMounted } from 'vue'
|
|
27
27
|
import { Page } from './../../typings/class'
|
|
28
|
+
import { Book, BookList } from '../../../mock/mockData/book'
|
|
29
|
+
import { getBookList } from '../../../mock'
|
|
28
30
|
|
|
29
|
-
const commodityOptionsTitle: TableTitle[] = [{
|
|
30
|
-
prop: '
|
|
31
|
-
label: '
|
|
31
|
+
const commodityOptionsTitle: TableTitle<Book>[] = [{
|
|
32
|
+
prop: 'sn',
|
|
33
|
+
label: '编码'
|
|
32
34
|
}, {
|
|
33
|
-
prop: '
|
|
34
|
-
label: '
|
|
35
|
+
prop: 'name',
|
|
36
|
+
label: '书名'
|
|
35
37
|
}, {
|
|
36
|
-
prop: '
|
|
37
|
-
label: '
|
|
38
|
-
|
|
38
|
+
prop: 'author',
|
|
39
|
+
label: '作者'
|
|
39
40
|
}, {
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
// prop: 'address',
|
|
42
|
+
// label: '发行地'
|
|
43
|
+
// }, {
|
|
44
|
+
prop: 'date',
|
|
45
|
+
label: '入库时间'
|
|
42
46
|
}]
|
|
43
47
|
|
|
44
48
|
const code = ref<string | number | Array<string | number>>([])
|
|
45
49
|
|
|
46
|
-
const total = ref(0)
|
|
47
|
-
const options = ref<
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
ApprovedQtyPU: 'ApprovedQtyPU' + (i + 1),
|
|
54
|
-
ACCode: 'ACCode'
|
|
55
|
-
})
|
|
56
|
-
}
|
|
57
|
-
const getDataList = (page: Page = new Page(), str: string = '') => {
|
|
58
|
-
setTimeout(() => {
|
|
59
|
-
options.value = mockData.filter(item => item.PRDocType.includes(str)).slice(0, page.pageSize)
|
|
60
|
-
total.value = mockData.length
|
|
50
|
+
const total = ref<number>(0)
|
|
51
|
+
const options = ref<BookList>([])
|
|
52
|
+
const getDataList = async (page: Page = new Page(), str: string = '') => {
|
|
53
|
+
const res = await getBookList({
|
|
54
|
+
keyword: str,
|
|
55
|
+
page: page.currentPage,
|
|
56
|
+
pageSize: page.pageSize
|
|
61
57
|
})
|
|
58
|
+
options.value = res.data?.rows ?? []
|
|
59
|
+
total.value = res.data?.total ?? 0
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
setTimeout(() => {
|
|
65
|
-
code.value = [
|
|
63
|
+
code.value = ['sn2311080016', 'sn2311090017']
|
|
66
64
|
}, 100)
|
|
67
65
|
|
|
68
66
|
const selected = (value: string | number | Array<number | string>) => {
|
|
@@ -70,25 +68,20 @@ const selected = (value: string | number | Array<number | string>) => {
|
|
|
70
68
|
}
|
|
71
69
|
|
|
72
70
|
const toPage = (page: Page, str: any) => {
|
|
73
|
-
|
|
71
|
+
remoteMethod(str, page)
|
|
74
72
|
}
|
|
75
73
|
const selectMultiple = (value: string | number | Array<number | string>) => {
|
|
76
74
|
code.value = value
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
const remoteMethod = async (query: string, page: Page = new Page()) => {
|
|
80
|
-
await
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return new Promise<void>((resolve) => {
|
|
85
|
-
setTimeout(() => {
|
|
86
|
-
const start = (page.currentPage - 1) * page.pageSize
|
|
87
|
-
options.value = mockData.filter(item => item.PRDocType.includes(query)).slice(start, start + page.pageSize)
|
|
88
|
-
total.value = mockData.length
|
|
89
|
-
resolve()
|
|
90
|
-
}, 500)
|
|
78
|
+
const res = await getBookList({
|
|
79
|
+
keyword: query,
|
|
80
|
+
page: page.currentPage,
|
|
81
|
+
pageSize: page.pageSize
|
|
91
82
|
})
|
|
83
|
+
options.value = res.data?.rows ?? []
|
|
84
|
+
total.value = res.data?.total ?? 0
|
|
92
85
|
}
|
|
93
86
|
|
|
94
87
|
onMounted(() => {
|