Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gs1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴迪
gs1
Commits
012ca3e4
Commit
012ca3e4
authored
Jan 04, 2022
by
tang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加分頁顯示
parent
ed68a4ad
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
10 deletions
+56
-10
internal.vue
src/views/Search/internal.vue
+17
-6
pagination.js
src/views/Search/pagination.js
+26
-0
shortcode.vue
src/views/Search/shortcode.vue
+13
-4
pages2.vue
src/views/comps/pages2.vue
+0
-0
No files found.
src/views/Search/internal.vue
View file @
012ca3e4
...
@@ -99,10 +99,10 @@
...
@@ -99,10 +99,10 @@
<div
class=
"result-box"
v-show=
"showResult && resultType === 'company'"
>
<div
class=
"result-box"
v-show=
"showResult && resultType === 'company'"
>
<div
class=
"result-box-title"
>
查询
{{
searchCodeShow
}}
结果
</div>
<div
class=
"result-box-title"
>
查询
{{
searchCodeShow
}}
结果
</div>
<div
class=
"result-box-body"
>
<div
class=
"result-box-body"
>
<template
v-if=
"
result
"
>
<template
v-if=
"
currentData
"
>
<!--结果表格-->
<!--结果表格-->
<el-table
<el-table
:data=
"
result
"
:data=
"
currentData
"
header-cell-class-name=
"search-table-hc"
header-cell-class-name=
"search-table-hc"
style=
"width: 100%"
style=
"width: 100%"
>
>
...
@@ -139,6 +139,8 @@
...
@@ -139,6 +139,8 @@
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
<pages2
:total=
"pagination.total"
:currPage=
"pagination.currPage"
:pageSize=
"pagination.pageSize"
@
getLimit=
'handlePageChange'
></pages2>
</template>
</template>
<span
style=
"color: rgb(255, 59, 48)"
v-else
>
{{ errorMsg }}
</span>
<span
style=
"color: rgb(255, 59, 48)"
v-else
>
{{ errorMsg }}
</span>
</div>
</div>
...
@@ -146,10 +148,10 @@
...
@@ -146,10 +148,10 @@
<div
class=
"result-box"
v-show=
"showResult && resultType === 'product'"
>
<div
class=
"result-box"
v-show=
"showResult && resultType === 'product'"
>
<div
class=
"result-box-title"
>
查询 {{ searchCodeShow }} 结果
</div>
<div
class=
"result-box-title"
>
查询 {{ searchCodeShow }} 结果
</div>
<div
class=
"result-box-body"
>
<div
class=
"result-box-body"
>
<
template
v-if=
"
result
"
>
<
template
v-if=
"
currentData
"
>
<!--结果表格-->
<!--结果表格-->
<el-table
<el-table
:data=
"
result
"
:data=
"
currentData
"
header-cell-class-name=
"search-table-hc"
header-cell-class-name=
"search-table-hc"
style=
"width: 100%"
style=
"width: 100%"
>
>
...
@@ -167,6 +169,8 @@
...
@@ -167,6 +169,8 @@
</el-table-column>
</el-table-column>
<el-table-column
prop=
"status"
label=
"状态"
></el-table-column>
<el-table-column
prop=
"status"
label=
"状态"
></el-table-column>
</el-table>
</el-table>
<pages2
:total=
"pagination.total"
:currPage=
"pagination.currPage"
:pageSize=
"pagination.pageSize"
@
getLimit=
'handlePageChange'
></pages2>
</template>
</template>
<span
style=
"color: rgb(255, 59, 48)"
v-else
>
{{ errorMsg }}
</span>
<span
style=
"color: rgb(255, 59, 48)"
v-else
>
{{ errorMsg }}
</span>
</div>
</div>
...
@@ -265,14 +269,16 @@
...
@@ -265,14 +269,16 @@
<
script
>
<
script
>
import
Vcode
from
"vue-puzzle-vcode"
;
import
Vcode
from
"vue-puzzle-vcode"
;
import
validation
from
"@/views/Search/validation"
;
import
validation
from
"@/views/Search/validation"
;
import
pagination
from
"@/views/Search/pagination"
;
import
moment
from
"moment"
;
import
moment
from
"moment"
;
import
Pages2
from
"@/views/comps/pages2"
;
const
CODE
=
'1'
;
const
CODE
=
'1'
;
const
NAME
=
'2'
;
const
NAME
=
'2'
;
const
ADDRESS
=
'3'
;
const
ADDRESS
=
'3'
;
export
default
{
export
default
{
mixins
:
[
validation
],
mixins
:
[
validation
,
pagination
],
data
()
{
data
()
{
return
{
return
{
CODE
,
CODE
,
...
@@ -306,6 +312,7 @@ export default {
...
@@ -306,6 +312,7 @@ export default {
};
};
},
},
components
:
{
components
:
{
Pages2
,
Vcode
,
Vcode
,
},
},
created
()
{
created
()
{
...
@@ -390,7 +397,11 @@ export default {
...
@@ -390,7 +397,11 @@ export default {
const
searchGlnRes
=
await
this
.
$api
.
search
.
searchInternal
(
params
);
const
searchGlnRes
=
await
this
.
$api
.
search
.
searchInternal
(
params
);
const
{
returnCode
,
data
}
=
searchGlnRes
;
const
{
returnCode
,
data
}
=
searchGlnRes
;
if
(
returnCode
===
"0"
||
returnCode
===
0
)
{
if
(
returnCode
===
"0"
||
returnCode
===
0
)
{
this
.
result
=
data
.
hits
.
hits
;
// this.result = data.hits.hits;
this
.
dataTotal
=
data
.
hits
.
hits
;
this
.
pagination
.
total
=
data
.
hits
.
hits
.
length
;
this
.
pagination
.
totalPage
=
Math
.
floor
(
data
.
hits
.
hits
.
length
/
this
.
pagination
.
pageSize
)
+
1
;
this
.
handlePageChange
(
1
);
}
else
{
}
else
{
this
.
errorMsg
=
this
.
errorMsg
=
searchGlnRes
.
returnMsg
||
searchGlnRes
.
returnMsg
||
...
...
src/views/Search/pagination.js
0 → 100644
View file @
012ca3e4
export
default
{
data
()
{
return
{
dataTotal
:
[],
currentData
:
null
,
pagination
:
{
total
:
0
,
totalPage
:
1
,
pageSize
:
10
,
page
:
1
},
}
},
methods
:
{
handlePageChange
(
page
)
{
const
start
=
(
page
-
1
)
*
this
.
pagination
.
pageSize
if
(
page
===
this
.
pagination
.
totalPage
)
{
this
.
currentData
=
this
.
dataTotal
.
slice
(
start
,
this
.
dataTotal
.
length
)
}
else
{
this
.
currentData
=
this
.
dataTotal
.
slice
(
start
,
start
+
this
.
pagination
.
pageSize
)
}
console
.
log
(
this
)
console
.
log
(
this
.
currentData
)
}
},
}
src/views/Search/shortcode.vue
View file @
012ca3e4
...
@@ -61,9 +61,9 @@
...
@@ -61,9 +61,9 @@
<div
class=
"result-box"
v-if=
"showResult"
>
<div
class=
"result-box"
v-if=
"showResult"
>
<div
class=
"result-box-title"
>
查询
{{
searchCodeShow
}}
结果
</div>
<div
class=
"result-box-title"
>
查询
{{
searchCodeShow
}}
结果
</div>
<div
class=
"result-box-body"
>
<div
class=
"result-box-body"
>
<template
v-if=
"
result
"
>
<template
v-if=
"
currentData
"
>
<el-table
<el-table
:data=
"
result
"
:data=
"
currentData
"
header-cell-class-name=
"search-table-hc"
header-cell-class-name=
"search-table-hc"
style=
"width: 100%"
style=
"width: 100%"
>
>
...
@@ -79,6 +79,8 @@
...
@@ -79,6 +79,8 @@
<el-table-column
prop=
"producePack"
label=
"包装"
width=
"100px"
></el-table-column>
<el-table-column
prop=
"producePack"
label=
"包装"
width=
"100px"
></el-table-column>
<el-table-column
prop=
"firmName"
label=
"厂商名称"
width=
"210px"
></el-table-column>
<el-table-column
prop=
"firmName"
label=
"厂商名称"
width=
"210px"
></el-table-column>
</el-table>
</el-table>
<pages2
:total=
"pagination.total"
:currPage=
"pagination.currPage"
:pageSize=
"pagination.pageSize"
@
getLimit=
'handlePageChange'
></pages2>
</template>
</template>
<span
class=
"error-msg"
v-else
>
{{ errorMsg }}
</span>
<span
class=
"error-msg"
v-else
>
{{ errorMsg }}
</span>
</div>
</div>
...
@@ -98,12 +100,15 @@
...
@@ -98,12 +100,15 @@
<
script
>
<
script
>
import
validation
from
"@/views/Search/validation"
;
import
validation
from
"@/views/Search/validation"
;
import
pagination
from
"@/views/Search/pagination"
;
import
pages2
from
"@/views/comps/pages2"
;
const
CODE
=
0
;
const
CODE
=
0
;
const
NAME
=
1
;
const
NAME
=
1
;
const
ADDRESS
=
2
;
const
ADDRESS
=
2
;
export
default
{
export
default
{
mixins
:
[
validation
],
mixins
:
[
validation
,
pagination
],
components
:
{
pages2
},
data
()
{
data
()
{
return
{
return
{
CODE
,
CODE
,
...
@@ -142,7 +147,11 @@ export default {
...
@@ -142,7 +147,11 @@ export default {
const
searchGlnRes
=
await
this
.
$api
.
search
.
searchGetList
(
params
);
const
searchGlnRes
=
await
this
.
$api
.
search
.
searchGetList
(
params
);
const
{
returnCode
,
data
}
=
searchGlnRes
;
const
{
returnCode
,
data
}
=
searchGlnRes
;
if
(
returnCode
===
"0"
)
{
if
(
returnCode
===
"0"
)
{
this
.
result
=
data
;
// this.result = data;
this
.
dataTotal
=
data
;
this
.
pagination
.
total
=
data
.
length
;
this
.
pagination
.
totalPage
=
Math
.
floor
(
data
.
length
/
this
.
pagination
.
pageSize
)
+
1
;
this
.
handlePageChange
(
1
);
}
else
{
}
else
{
this
.
errorMsg
=
this
.
errorMsg
=
searchGlnRes
.
returnMsg
||
searchGlnRes
.
returnMsg
||
...
...
src/views/comps/pages2.vue
View file @
012ca3e4
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment