|
|
@@ -6,14 +6,14 @@
|
|
|
<div class="screening-item flex-vertical-center-l">
|
|
|
<span>方剂名称:</span>
|
|
|
<div class="input">
|
|
|
- <el-input size="mini" v-model="form.name" placeholder="请输入"></el-input>
|
|
|
+ <el-input size="mini" v-model="form.name" placeholder="请输入" @keydown.enter.native="search()"></el-input>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="screening-item flex-vertical-center-l">
|
|
|
<span>功效:</span>
|
|
|
<div class="input">
|
|
|
- <el-input size="mini" v-model="form.gongxiao" placeholder="请输入"></el-input>
|
|
|
+ <el-input size="mini" v-model="form.gongxiao" placeholder="请输入" @keydown.enter.native="search()"></el-input>
|
|
|
</div>
|
|
|
</div>
|
|
|
<el-button size="mini" type="primary" @click="search">搜索</el-button>
|
|
|
@@ -37,7 +37,7 @@
|
|
|
>{{item.name}}</div>
|
|
|
</div>
|
|
|
<!-- 底部数据表格 -->
|
|
|
- <div class="table-data">
|
|
|
+ <div ref="scrollableElement" class="table-data" :date-loading="loading" v-loading="loading">
|
|
|
<div
|
|
|
class="flex-center ellipsis-line1"
|
|
|
v-for="(item,index) in list"
|
|
|
@@ -49,12 +49,17 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import useScroll from '@/mixins/useScroll';
|
|
|
import { getEffectQuery, getPrescriptionsList } from "@/api/knowledge.js";
|
|
|
-import { setTimeout } from "timers";
|
|
|
import {addRecipeFrom} from '@/api/dataAnalysis';
|
|
|
+
|
|
|
+let controller;
|
|
|
+
|
|
|
export default {
|
|
|
+ mixins: [useScroll],
|
|
|
data() {
|
|
|
return {
|
|
|
+ loading: false,
|
|
|
form: {
|
|
|
name: "",
|
|
|
|
|
|
@@ -80,18 +85,25 @@ export default {
|
|
|
|
|
|
gongxiao: ""
|
|
|
};
|
|
|
- this.getPrescriptionsList();
|
|
|
+ this.search();
|
|
|
},
|
|
|
search() {
|
|
|
this.tab_current = this.tabs.length - 1;
|
|
|
this.getPrescriptionsList();
|
|
|
},
|
|
|
tabCahnge(index) {
|
|
|
- this.tab_current = index;
|
|
|
- this.getPrescriptionsList();
|
|
|
+ if (this.tab_current === index) this.scroll(0);
|
|
|
+ else {
|
|
|
+ this.tab_current = index;
|
|
|
+ this.getPrescriptionsList();
|
|
|
+ }
|
|
|
},
|
|
|
// 获取列表
|
|
|
async getPrescriptionsList() {
|
|
|
+ if (controller) controller.abort();
|
|
|
+ controller = new AbortController();
|
|
|
+ this.scroll(0, 'instant');
|
|
|
+ this.loading = true;
|
|
|
let params = {
|
|
|
pageid: 1,
|
|
|
pagesize: 9999,
|
|
|
@@ -100,11 +112,12 @@ export default {
|
|
|
effected: this.tabs[this.tab_current] ? this.tabs[this.tab_current].effectid : null,
|
|
|
effect: this.form.gongxiao
|
|
|
};
|
|
|
- let res = await getPrescriptionsList(params);
|
|
|
+ let res = await getPrescriptionsList(params, controller.signal);
|
|
|
if (res.code == 0) {
|
|
|
this.list = res.data.pres;
|
|
|
this.totalNum = res.data.presnum;
|
|
|
}
|
|
|
+ this.loading = false;
|
|
|
},
|
|
|
// 获取分类
|
|
|
async getEffectQuery() {
|
|
|
@@ -160,6 +173,10 @@ export default {
|
|
|
height: 57vh;
|
|
|
overflow: auto;
|
|
|
|
|
|
+ &[date-loading="true"] {
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+
|
|
|
div {
|
|
|
display: inline-block;
|
|
|
line-height: 44px;
|