123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- <template>
- <div>
- <banner></banner>
- <div class="antibody_box" ref="tablePar">
-
- <el-form :inline="true" :model="form" class="demo-form-inline">
- <el-form-item label="Antibody:">
- <el-input class="input-with-select" v-model="form.keyword" placeholder="">
-
- </el-input>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" icon="el-icon-search" @click="onSubmit">Search</el-button>
- <el-button type="danger" icon="el-icon-refresh" @click="reset">{{ $t("nav.reset") }}</el-button>
- </el-form-item>
- </el-form>
-
- <table-list
- v-loading="tableLoading"
- :list="list"
- type="2"
- @my-sort-change="onSortFieldChange"
- />
-
- <div
- class="load_b"
- v-if="list.length > 0 && pageable.page + 1 !== moreParams.totalPages"
- @click="loadList"
- >
- <i v-if="loadShow" class="el-icon-loading"></i>
- <span class="load">{{ $t("table.load") }}</span>
- </div>
- </div>
- </div>
- </template>
- <script>
- import tableList from "@/components/tableList";
- import banner from "@/components/banner";
- let timer = null;
- export default {
- components: {
- tableList,
- banner
- },
- name: "antibody",
- data() {
- return {
- form: {
- keyword: "",
- sortKey: undefined,
- sortValue: undefined
- },
- pageable: {
- page: 0,
- size: 10
- },
- list: [],
- tableLoading: false,
- loadShow: false,
- moreParams: {},
- resultObj: {}
- };
- },
- methods: {
-
- reset() {
- this.form = {
- keyword: ""
- };
- this.pageable.page = 0;
- this.postlist();
- },
-
- onSubmit() {
- this.pageable.page = 0;
- this.postlist();
- },
- onSortFieldChange(params) {
- console.log(params);
- this.form.sortKey = params.field || undefined;
- this.form.sortValue = params.value || undefined;
- this.pageable.page = 0;
- this.postlist();
- },
-
- loadList() {
- this.loadShow = true;
- this.pageable.page++;
- this.postlist();
- },
-
- postlist() {
- let that = this;
- that.tableLoading = true;
- this.$api
- .post("basb/pageListProducts", {
- criteria: this.form,
- pageable: this.pageable
- })
- .then(res => {
- if (res.code === 0) {
- const resDataContent = (res.data.content || []).map(item => {
- return {
- ...item,
- skuDefault: item.skuList && item.skuList.length > 0 ? 0 : ""
- };
- });
- if (that.pageable.page === 0) {
- this.list = resDataContent;
- } else {
- this.list = this.list.concat(resDataContent);
- console.log(this.list);
- }
- this.moreParams = res.data.more_params;
- this.loadShow = false;
- }
- that.tableLoading = false;
- })
- .catch(() => {
- that.tableLoading = false;
- });
- },
-
- handleScroll() {
- if (timer) {
- clearTimeout(timer);
- }
- timer = setTimeout(() => {
- var scrollTop =
- window.pageYOffset ||
- document.documentElement.scrollTop ||
- document.body.scrollTop;
- var windowHeight =
- window.innerHeight ||
- document.documentElement.clientHeight ||
- document.body.clientHeight;
- var scrollHeight =
- document.documentElement.scrollHeight || document.body.scrollHeight;
- if (
- this.pageable.page + 1 == this.moreParams.totalPages ||
- this.list.length < 10
- ) {
- clearTimeout(timer);
- window.removeEventListener("scroll", this.handleScroll);
- return;
- }
- if (scrollTop + windowHeight >= scrollHeight && !this.loadShow) {
-
- this.loadShow = true;
- this.pageable.page++;
- this.postlist();
- }
- }, 300);
- }
- },
- mounted() {
- this.postlist();
-
- window.addEventListener("scroll", this.handleScroll);
- },
- created() {
-
- },
- beforeDestroy() {
-
- window.removeEventListener("scroll", this.handleScroll);
- }
- };
- </script>
- <style lang="scss" scoped>
- .antibody_box {
- display: block !important;
- width: 1200px;
- margin: auto ;
- .demo-form-inline{
- padding-top: 40px;
- position: sticky;
- top: 80px;
- background: #fff;
- z-index: 999;
- display: flex;
- align-self: center;
- }
- .input-with-select /deep/{
- width: 300px;
- border:1px solid #007BC4;
- border-radius: 4px;
- overflow: hidden;
- .el-input__inner{
- border: none!important;
- }
- // .el-input__inner{
- // border-color: #007BC4 !important;
- // border-right: none !important;
- // }
- // .el-input-group__append {
- // border-color: #007BC4 !important;
- // border-left: none !important;
- // }
- // .but_search {
- // background-color: #007BC4;
- // border: #007BC4;
- // color: #fff;
- // }
- }
- .clout_box {
- margin-bottom: 2rem;
- .title {
- word-wrap: break-word;
- word-break: normal;
- width: 100%;
- background: #f3f3f3;
- padding: 1.5rem 2rem;
- font-size: 16px;
- font-family: Arial;
- color: #313131;
- }
- }
- }
- .load_b {
- margin: 1.2rem 0;
- font-size: 14px;
- font-family: Arial;
- color: #005bab;
- text-align: center;
- cursor: pointer;
- .el-icon-loading {
- font-size: 24px;
- }
- .load {
- display: block;
- line-height: 32px;
- }
- }
- .menu_box /deep/ {
- // 菜单
- border: 1px solid #dbdbdb;
- margin-bottom: 2rem;
- .menu_b {
- .list {
- border: none;
- }
- }
- }
- @media screen and (min-width: 751px) and (max-width: 9999px) {
- .menu_box_pmd {
- display: none;
- }
- }
- @media screen and (min-width: 0px) and (max-width: 750px) {
- .antibody_box {
- .clout_box {
- margin-bottom: 20px;
- .title {
- padding: 10px !important;
- }
- }
- }
- .load_b {
- margin: 20px 0;
- }
- .menu_box /deep/ {
- // 菜单
- border: none;
- margin-bottom: 0;
- }
- }
- </style>
|