|
|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
+ <div class="medicine-editor-wrapper">
|
|
|
<div class="table-container">
|
|
|
<div class="t-con-header flex-vertical-between">
|
|
|
<div class="t-con-radio flex-vertical-center-l" v-if="false">
|
|
|
@@ -75,7 +75,7 @@
|
|
|
|
|
|
<div
|
|
|
class="table-choose3"
|
|
|
- v-if="scope.row.key"
|
|
|
+ v-if="index === scope.row.id - 1"
|
|
|
:style="medIndex==0?'':{top:(medIndex*35)+'px'}"
|
|
|
>
|
|
|
<div class="table-choose-h flex-vertical-between">
|
|
|
@@ -124,7 +124,7 @@
|
|
|
<template slot-scope="scope" v-if="scope.row.name">
|
|
|
<div
|
|
|
@click="clickName(scope)"
|
|
|
- v-if="!scope.row.showSearch"
|
|
|
+ v-if="index !== scope.row.id - 1"
|
|
|
:style="{'color':scope.row.color?scope.row.color:''}"
|
|
|
>{{scope.row.name}}</div>
|
|
|
<div v-else class="flex-vertical-between">
|
|
|
@@ -144,7 +144,6 @@
|
|
|
<!-- v-model="scope.row.key" -->
|
|
|
<div
|
|
|
class="table-choose3"
|
|
|
- v-if="scope.row.key"
|
|
|
:style="medIndex==0?'':{top:(medIndex*35)+'px'}"
|
|
|
>
|
|
|
<div class="table-choose-h flex-vertical-between">
|
|
|
@@ -320,7 +319,7 @@
|
|
|
|
|
|
<div
|
|
|
class="table-choose3"
|
|
|
- v-if="scope.row.key"
|
|
|
+ v-if="index === scope.row.id - 1"
|
|
|
:style="medIndex==0?'':{top:(medIndex*35)+'px'}"
|
|
|
>
|
|
|
<div class="table-choose-h flex-vertical-between">
|
|
|
@@ -369,7 +368,7 @@
|
|
|
<template slot-scope="scope" v-if="scope.row.name">
|
|
|
<div
|
|
|
@click="clickName(scope)"
|
|
|
- v-if="!scope.row.showSearch"
|
|
|
+ v-if="index !== scope.row.id - 1"
|
|
|
:style="{'color':scope.row.color?scope.row.color:''}"
|
|
|
>{{scope.row.name}}</div>
|
|
|
<div v-else class="flex-vertical-between">
|
|
|
@@ -389,7 +388,6 @@
|
|
|
<!-- v-model="scope.row.key" -->
|
|
|
<div
|
|
|
class="table-choose3"
|
|
|
- v-if="scope.row.key"
|
|
|
:style="medIndex==0?'':{top:(medIndex*35)+'px'}"
|
|
|
>
|
|
|
<div class="table-choose-h flex-vertical-between">
|
|
|
@@ -563,6 +561,8 @@ import { debounce } from "@/utils/format.js";
|
|
|
import { mapState, mapGetters, mapActions, mapMutations } from "vuex";
|
|
|
import popup from "@/components/Propup.vue";
|
|
|
import accompanied from "./ui/accompanied.vue";
|
|
|
+
|
|
|
+let medicineBlurTimer;
|
|
|
export default {
|
|
|
components: {
|
|
|
popup,
|
|
|
@@ -673,7 +673,7 @@ export default {
|
|
|
}
|
|
|
], // 处方 tabs
|
|
|
recipe_tabs_c: 0, // 处方 tabs 下标
|
|
|
- index: 0, // 全局index 下拉加载时使用
|
|
|
+ index: -1, // 全局index 下拉加载时使用
|
|
|
|
|
|
provinceList1: [], // 全局省列表 赋值用
|
|
|
countWay: "1", // 计算方式
|
|
|
@@ -706,6 +706,20 @@ export default {
|
|
|
},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
|
+ _splitDataToView(totalData) {
|
|
|
+ if (!Array.isArray(totalData)) totalData = this.recipe_tabs[this.recipe_tabs_c].totalTableD;
|
|
|
+ const forceUpdate = (data) => Object.assign({}, data);
|
|
|
+ this.recipe_tabs[this.recipe_tabs_c].tableData = totalData.filter(
|
|
|
+ (item, index) => {
|
|
|
+ return item.id % 2 !== 0;
|
|
|
+ }
|
|
|
+ ).map(forceUpdate);
|
|
|
+ this.recipe_tabs[this.recipe_tabs_c].tableData1 = totalData.filter(
|
|
|
+ (item, index) => {
|
|
|
+ return item.id % 2 === 0;
|
|
|
+ }
|
|
|
+ ).map(forceUpdate);
|
|
|
+ },
|
|
|
// 打开父级安全合理用药监测
|
|
|
openSafeDrug() {
|
|
|
this.$parent.opensafeD();
|
|
|
@@ -772,6 +786,8 @@ export default {
|
|
|
},
|
|
|
// 监听键盘事件
|
|
|
drugDown(e, scope) {
|
|
|
+ e.stopPropagation();
|
|
|
+ e.preventDefault();
|
|
|
let index = scope.row.id ? scope.row.id - 1 : 0;
|
|
|
|
|
|
let totalData = this.recipe_tabs[this.recipe_tabs_c].totalTableD;
|
|
|
@@ -795,36 +811,22 @@ export default {
|
|
|
|
|
|
// 表格 fixed 时 去 下标 为 1
|
|
|
|
|
|
- // if (totalData[index].drugList.length > 5) {
|
|
|
- // document.querySelectorAll(
|
|
|
- // `#infiniteList${scope.row.id}`
|
|
|
- // )[1].scrollTop += 36;
|
|
|
-
|
|
|
- // console.log(
|
|
|
- // document.querySelectorAll(`#infiniteList${scope.row.id}`)[1]
|
|
|
- // .scrollTop,
|
|
|
- // "top"
|
|
|
- // );
|
|
|
- // }
|
|
|
+ if (totalData[index].drugList.length > 5) {
|
|
|
+ const el = document.querySelectorAll(`.medicine-editor-wrapper #infiniteList${scope.row.id}`)[0];
|
|
|
+ if (el) el.scrollTop += 36;
|
|
|
+ }
|
|
|
this.recipe_tabs[this.recipe_tabs_c].totalTableD = totalData;
|
|
|
totalData.filter((item, index) => {
|
|
|
// this.getSelectType('中药药品用法', index)
|
|
|
return (item.id = index + 1);
|
|
|
});
|
|
|
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData = totalData.filter(
|
|
|
- (item, index) => {
|
|
|
- return item.id % 2 != 0;
|
|
|
- }
|
|
|
- );
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData1 = totalData.filter(
|
|
|
- (item, index) => {
|
|
|
- return item.id % 2 == 0;
|
|
|
- }
|
|
|
- );
|
|
|
+ this._splitDataToView(totalData);
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
drugUp(e, scope) {
|
|
|
+ e.stopPropagation();
|
|
|
+ e.preventDefault();
|
|
|
let index = scope.row.id ? scope.row.id - 1 : 0;
|
|
|
let totalData = this.recipe_tabs[this.recipe_tabs_c].totalTableD;
|
|
|
// 如果到最后一个 判断是否需要分页
|
|
|
@@ -834,30 +836,16 @@ export default {
|
|
|
totalData[index].search_i -= 1;
|
|
|
}
|
|
|
|
|
|
- if (
|
|
|
- document.querySelectorAll(`#infiniteList${scope.row.id}`)[1].scrollTop >
|
|
|
- 0
|
|
|
- ) {
|
|
|
- document.querySelectorAll(
|
|
|
- `#infiniteList${scope.row.id}`
|
|
|
- )[1].scrollTop -= 36;
|
|
|
- }
|
|
|
+
|
|
|
+ const el = document.querySelectorAll(`.medicine-editor-wrapper #infiniteList${scope.row.id}`)[0];
|
|
|
+ if (el && el.scrollTop > 0) el.scrollTop -= 36;
|
|
|
this.recipe_tabs[this.recipe_tabs_c].totalTableD = totalData;
|
|
|
totalData.filter((item, index) => {
|
|
|
// this.getSelectType('中药药品用法', index)
|
|
|
return (item.id = index + 1);
|
|
|
});
|
|
|
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData = totalData.filter(
|
|
|
- (item, index) => {
|
|
|
- return item.id % 2 != 0;
|
|
|
- }
|
|
|
- );
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData1 = totalData.filter(
|
|
|
- (item, index) => {
|
|
|
- return item.id % 2 == 0;
|
|
|
- }
|
|
|
- );
|
|
|
+ this._splitDataToView(totalData);
|
|
|
},
|
|
|
drugEnter(scope) {
|
|
|
this.chooseDis1(
|
|
|
@@ -872,16 +860,7 @@ export default {
|
|
|
|
|
|
this.recipe_tabs[this.recipe_tabs_c].totalTableD[index].usage = e;
|
|
|
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData = totalData.filter(
|
|
|
- (item, index) => {
|
|
|
- return item.id % 2 != 0;
|
|
|
- }
|
|
|
- );
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData1 = totalData.filter(
|
|
|
- (item, index) => {
|
|
|
- return item.id % 2 == 0;
|
|
|
- }
|
|
|
- );
|
|
|
+ this._splitDataToView(totalData);
|
|
|
},
|
|
|
doseFocus(scope) {
|
|
|
let width = window.innerWidth;
|
|
|
@@ -926,17 +905,17 @@ export default {
|
|
|
this.recipe_tabs[this.recipe_tabs_c].totalTableD.length - 1
|
|
|
) {
|
|
|
// console.log(document.querySelectorAll('#searchD' + (scope.row.id + 1)), '啦啦啦')
|
|
|
- document.querySelectorAll("#searchD" + (scope.row.id + 1))[0].focus();
|
|
|
+ document.querySelectorAll(".medicine-editor-wrapper #searchD" + (scope.row.id + 1))[0].focus();
|
|
|
} else {
|
|
|
try {
|
|
|
this.recipe_tabs[this.recipe_tabs_c].totalTableD.forEach(item => {
|
|
|
if (item.name && !item.dose && scope.row.id < item.id) {
|
|
|
- document.querySelectorAll("#dose" + item.id)[0].focus();
|
|
|
+ document.querySelectorAll(".medicine-editor-wrapper #dose" + item.id)[0].focus();
|
|
|
throw Error();
|
|
|
}
|
|
|
if (!item.name) {
|
|
|
// console.log(document.querySelectorAll('#searchD' + item.id), '啦啦啦')
|
|
|
- document.querySelectorAll("#searchD" + item.id)[0].focus();
|
|
|
+ document.querySelectorAll(".medicine-editor-wrapper #searchD" + item.id)[0].focus();
|
|
|
throw Error();
|
|
|
}
|
|
|
});
|
|
|
@@ -1063,7 +1042,7 @@ export default {
|
|
|
},
|
|
|
// 清空处方
|
|
|
clearRecipe() {
|
|
|
- this.index = 0;
|
|
|
+ this.index = -1;
|
|
|
this.recipe_tabs[this.recipe_tabs_c].disable = false;
|
|
|
this.recipe_tabs[this.recipe_tabs_c].isMyMade = true;
|
|
|
this.recipe_tabs[this.recipe_tabs_c].totalTableD.splice(
|
|
|
@@ -1145,6 +1124,7 @@ export default {
|
|
|
this.countNowRecipeMoney();
|
|
|
},
|
|
|
load() {
|
|
|
+ if (this.index === -1) return;
|
|
|
console.log("进入");
|
|
|
let key = this.recipe_tabs[this.recipe_tabs_c].totalTableD[this.index]
|
|
|
.key;
|
|
|
@@ -1270,13 +1250,13 @@ export default {
|
|
|
if (Number(e) > Number(kucun)) {
|
|
|
this.$message.warning("当前库存不足");
|
|
|
|
|
|
- document.querySelectorAll("#dose" + scope.row.id)[0].style.border =
|
|
|
+ document.querySelectorAll(".medicine-editor-wrapper #dose" + scope.row.id)[0].style.border =
|
|
|
"1px solid red";
|
|
|
- document.querySelectorAll("#dose" + scope.row.id)[0].style.color =
|
|
|
+ document.querySelectorAll(".medicine-editor-wrapper #dose" + scope.row.id)[0].style.color =
|
|
|
"red";
|
|
|
} else {
|
|
|
- document.querySelectorAll("#dose" + scope.row.id)[0].style.border = "";
|
|
|
- document.querySelectorAll("#dose" + scope.row.id)[0].style.color = "";
|
|
|
+ document.querySelectorAll(".medicine-editor-wrapper #dose" + scope.row.id)[0].style.border = "";
|
|
|
+ document.querySelectorAll(".medicine-editor-wrapper #dose" + scope.row.id)[0].style.color = "";
|
|
|
}
|
|
|
|
|
|
let price = this.recipe_tabs[this.recipe_tabs_c].totalTableD[
|
|
|
@@ -1300,22 +1280,13 @@ export default {
|
|
|
scope.row.id - 1
|
|
|
].total = total;
|
|
|
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData = totalData.filter(
|
|
|
- (item, index) => {
|
|
|
- return item.id % 2 != 0;
|
|
|
- }
|
|
|
- );
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData1 = totalData.filter(
|
|
|
- (item, index) => {
|
|
|
- return item.id % 2 == 0;
|
|
|
- }
|
|
|
- );
|
|
|
+ this._splitDataToView(totalData);
|
|
|
|
|
|
if (this.recipe_tabs[this.recipe_tabs_c].bottom_form.doseNum) {
|
|
|
- this.countNowRecipeMoney();
|
|
|
+ // this.countNowRecipeMoney();
|
|
|
}
|
|
|
- },
|
|
|
- // 表一 选中药品
|
|
|
+ this.countNowRecipeMoney();
|
|
|
+ },// 表一 选中药品
|
|
|
chooseDis1(scope, index, item, from = "now") {
|
|
|
let totalData = this.recipe_tabs[this.recipe_tabs_c].totalTableD;
|
|
|
let isHas = false;
|
|
|
@@ -1326,17 +1297,26 @@ export default {
|
|
|
});
|
|
|
if (isHas) {
|
|
|
this.$message.warning("请勿重复添加药品");
|
|
|
+ clearTimeout(medicineBlurTimer);
|
|
|
+ let index = scope.row.id ? scope.row.id - 1 : 0;
|
|
|
+ const el = document.querySelectorAll(`.medicine-editor-wrapper #searchD${index+1}`)[0];
|
|
|
+ if (el) el.focus();
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
let obj = {
|
|
|
- color: "#000",
|
|
|
+ color: item.kc == 0 ? "red" : "#000",
|
|
|
id: scope.row.id,
|
|
|
name: item.ypmc,
|
|
|
spec: item.gg, // 规格
|
|
|
- dose: "", // 剂量
|
|
|
+ // dose: "", // 剂量
|
|
|
+ dose: scope.row.color == "red" ? scope.row.dose : "",
|
|
|
unit: item.dw, // 单位
|
|
|
- // usage: item.usagestr, // 用法
|
|
|
- usage: "",
|
|
|
+ usage:
|
|
|
+ scope.row.color == "red"
|
|
|
+ ? this.usageList[0].key
|
|
|
+ : scope.row.usage || item.usagestr || this.usageList[0].key, // 用法
|
|
|
+ //usage: "",
|
|
|
// price: item.lsjg,
|
|
|
price: item.price,
|
|
|
total: 0,
|
|
|
@@ -1351,7 +1331,6 @@ export default {
|
|
|
Object.assign(totalData[scope.row.id - 1], obj);
|
|
|
|
|
|
// 调用 父级合理用药接口
|
|
|
- let father = this.$parent;
|
|
|
|
|
|
if (scope.row.id == totalData.length) {
|
|
|
totalData.push({
|
|
|
@@ -1371,22 +1350,16 @@ export default {
|
|
|
return (item.id = index + 1);
|
|
|
});
|
|
|
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData = totalData.filter(
|
|
|
- (item, index) => {
|
|
|
- return item.id % 2 != 0;
|
|
|
- }
|
|
|
- );
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData1 = totalData.filter(
|
|
|
- (item, index) => {
|
|
|
- return item.id % 2 == 0;
|
|
|
- }
|
|
|
- );
|
|
|
+ this._splitDataToView(totalData);
|
|
|
|
|
|
if (from != "now") return;
|
|
|
setTimeout(() => {
|
|
|
- let ids = document.querySelectorAll("#dose" + scope.row.id);
|
|
|
- document.querySelectorAll("#dose" + scope.row.id)[0].focus();
|
|
|
+ const el = document.querySelectorAll(".medicine-editor-wrapper #dose" + scope.row.id)[0];
|
|
|
+ if (el) el.focus();
|
|
|
+ this.index = -1;
|
|
|
}, 500);
|
|
|
+
|
|
|
+ this.countNowRecipeMoney();
|
|
|
},
|
|
|
// 表一和表二 数据添加
|
|
|
addDis1(scope, type = "click") {
|
|
|
@@ -1429,29 +1402,20 @@ export default {
|
|
|
|
|
|
this.recipe_tabs[this.recipe_tabs_c].totalTableD = totalData;
|
|
|
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData = totalData.filter(
|
|
|
- (item, index) => {
|
|
|
- return item.id % 2 != 0;
|
|
|
- }
|
|
|
- );
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData1 = totalData.filter(
|
|
|
- (item, index) => {
|
|
|
- return item.id % 2 == 0;
|
|
|
- }
|
|
|
- );
|
|
|
+ this._splitDataToView(totalData);
|
|
|
if (type != "click") return;
|
|
|
setTimeout(() => {
|
|
|
if (
|
|
|
scope.row.id ==
|
|
|
this.recipe_tabs[this.recipe_tabs_c].totalTableD.length - 1
|
|
|
) {
|
|
|
- document.querySelectorAll("#searchD" + (scope.row.id + 1))[0].focus();
|
|
|
+ document.querySelectorAll(".medicine-editor-wrapper #searchD" + (scope.row.id + 1))[0].focus();
|
|
|
} else {
|
|
|
try {
|
|
|
this.recipe_tabs[this.recipe_tabs_c].totalTableD.forEach(item => {
|
|
|
if (!item.name) {
|
|
|
// console.log(document.querySelectorAll('#searchD' + item.id), '啦啦啦')
|
|
|
- document.querySelectorAll("#searchD" + item.id)[0].focus();
|
|
|
+ document.querySelectorAll(".medicine-editor-wrapper #searchD" + item.id)[0].focus();
|
|
|
throw Error();
|
|
|
}
|
|
|
});
|
|
|
@@ -1476,19 +1440,11 @@ export default {
|
|
|
// father.getRationalMed(item.medid)
|
|
|
return (item.id = index + 1);
|
|
|
});
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData = totalData.filter(
|
|
|
- (item, index) => {
|
|
|
- return item.id % 2 != 0;
|
|
|
- }
|
|
|
- );
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData1 = totalData.filter(
|
|
|
- (item, index) => {
|
|
|
- return item.id % 2 == 0;
|
|
|
- }
|
|
|
- );
|
|
|
+ this._splitDataToView(totalData);
|
|
|
this.countNowRecipeMoney();
|
|
|
},
|
|
|
clickName(scope) {
|
|
|
+ if (medicineBlurTimer) clearTimeout(medicineBlurTimer);
|
|
|
// 隐藏滚动条
|
|
|
if (scope.row.id % 2 == 0) {
|
|
|
document.getElementsByClassName(
|
|
|
@@ -1499,27 +1455,19 @@ export default {
|
|
|
"el-table__body-wrapper"
|
|
|
)[0].style.overflow = "hidden";
|
|
|
}
|
|
|
+ let index = scope.row.id ? scope.row.id - 1 : 0;
|
|
|
+ this.index = index;
|
|
|
|
|
|
this.medIndex = scope.$index;
|
|
|
this.clickPid = scope.row.medid;
|
|
|
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].totalTableD[
|
|
|
- scope.row.id - 1
|
|
|
- ].showSearch = !this.recipe_tabs[this.recipe_tabs_c].totalTableD[
|
|
|
- scope.row.id - 1
|
|
|
- ].showSearch;
|
|
|
+ const totalData = this.recipe_tabs[this.recipe_tabs_c].totalTableD;
|
|
|
+ totalData[index].showSearch = !totalData[index].showSearch;
|
|
|
+ totalData[index].key = scope.row.name;
|
|
|
+ totalData[index].search_i = 0;
|
|
|
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].totalTableD[scope.row.id - 1].key =
|
|
|
- scope.row.name;
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].totalTableD[
|
|
|
- scope.row.id - 1
|
|
|
- ].search_i = 0;
|
|
|
-
|
|
|
- debounce(this.getTableDrug(scope.row.key, 1, scope.row.id - 1), 10000);
|
|
|
- setTimeout(() => {
|
|
|
- // console.log(document.querySelectorAll('#searchD' + scope.row.id));
|
|
|
- document.querySelectorAll("#searchD" + scope.row.id)[0].focus();
|
|
|
- }, 800);
|
|
|
+ if (!scope.row.key) scope.row.key = scope.row.name;
|
|
|
+ debounce(this.getTableDrug(scope.row.key, 1, index), 10000);
|
|
|
},
|
|
|
// 输入框获取 药品列表
|
|
|
searchDrug(e, scope) {
|
|
|
@@ -1536,8 +1484,7 @@ export default {
|
|
|
let index = scope.row.id ? scope.row.id - 1 : 0;
|
|
|
// console.log(this.recipe_tabs[this.recipe_tabs_c].totalTableD[index], '我是key')
|
|
|
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].totalTableD[index].key = e;
|
|
|
- let ids = document.querySelectorAll("#operate2");
|
|
|
+ let ids = document.querySelectorAll(".medicine-editor-wrapper #operate2");
|
|
|
ids.forEach((item, index) => {
|
|
|
item.style["z-index"] = "auto";
|
|
|
});
|
|
|
@@ -1551,100 +1498,34 @@ export default {
|
|
|
// ].showSearch = false
|
|
|
// }
|
|
|
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData = this.recipe_tabs[
|
|
|
- this.recipe_tabs_c
|
|
|
- ].totalTableD.filter((item, index) => {
|
|
|
- return item.id % 2 != 0;
|
|
|
- });
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData1 = this.recipe_tabs[
|
|
|
- this.recipe_tabs_c
|
|
|
- ].totalTableD.filter((item, index) => {
|
|
|
- return item.id % 2 == 0;
|
|
|
- });
|
|
|
- this.index = scope.row.id - 1;
|
|
|
+ const totalData = this.recipe_tabs[this.recipe_tabs_c].totalTableD;
|
|
|
+ totalData[index].key = e;
|
|
|
+ totalData[index].search_i = 0;
|
|
|
+ this._splitDataToView(totalData);
|
|
|
+ this.index = index;
|
|
|
|
|
|
// this.getTableDrug(scope.row.key, 1, scope.row.id - 1)
|
|
|
|
|
|
- debounce(this.getTableDrug(scope.row.key, 1, index), 10000);
|
|
|
+ debounce(this.getTableDrug(e, 1, index), 10000);
|
|
|
},
|
|
|
drugFocus(scope) {
|
|
|
this.medIndex = scope.$index;
|
|
|
},
|
|
|
drugBlur(e, scope) {
|
|
|
- // 调用 父级合理用药接口
|
|
|
-
|
|
|
- // father.getRationalMedForPlat(scope.row.medid)
|
|
|
- // 失去焦点 释放滚动条
|
|
|
- if (scope.row.id % 2 == 0) {
|
|
|
- document.getElementsByClassName(
|
|
|
- "el-table__body-wrapper"
|
|
|
- )[1].style.overflow = "auto";
|
|
|
- } else {
|
|
|
- document.getElementsByClassName(
|
|
|
- "el-table__body-wrapper"
|
|
|
- )[0].style.overflow = "auto";
|
|
|
- }
|
|
|
- setTimeout(() => {
|
|
|
- let index = scope.row.id ? scope.row.id - 1 : 0;
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].totalTableD[index].key = "";
|
|
|
-
|
|
|
- let ids = document.querySelectorAll("#operate2");
|
|
|
- ids.forEach((item, index) => {
|
|
|
- item.style["z-index"] = "99";
|
|
|
- });
|
|
|
-
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].totalTableD.forEach(item => {
|
|
|
- item.drugList = [];
|
|
|
- });
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData = this.recipe_tabs[
|
|
|
- this.recipe_tabs_c
|
|
|
- ].totalTableD.filter((item, index) => {
|
|
|
- return item.id % 2 != 0;
|
|
|
- });
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData1 = this.recipe_tabs[
|
|
|
- this.recipe_tabs_c
|
|
|
- ].totalTableD.filter((item, index) => {
|
|
|
- return item.id % 2 == 0;
|
|
|
- });
|
|
|
- }, 500);
|
|
|
+ return this.drugBlur1(e, scope)
|
|
|
},
|
|
|
drugBlur1(e, scope) {
|
|
|
- // 调用 父级合理用药接口
|
|
|
-
|
|
|
- // 失去焦点 展示滚动条
|
|
|
- if (scope.row.id % 2 == 0) {
|
|
|
- document.getElementsByClassName(
|
|
|
- "el-table__body-wrapper"
|
|
|
- )[1].style.overflow = "auto";
|
|
|
- } else {
|
|
|
- document.getElementsByClassName(
|
|
|
- "el-table__body-wrapper"
|
|
|
- )[0].style.overflow = "auto";
|
|
|
- }
|
|
|
- setTimeout(() => {
|
|
|
+ medicineBlurTimer = setTimeout(() => {
|
|
|
+ this.index = -1;
|
|
|
let index = scope.row.id ? scope.row.id - 1 : 0;
|
|
|
this.recipe_tabs[this.recipe_tabs_c].totalTableD[index].key = "";
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].totalTableD[
|
|
|
- index
|
|
|
- ].showSearch = false;
|
|
|
+ this.recipe_tabs[this.recipe_tabs_c].totalTableD[index].showSearch = false;
|
|
|
+ this.recipe_tabs[this.recipe_tabs_c].totalTableD[index].drugList = [];
|
|
|
let ids = document.querySelectorAll("#operate2");
|
|
|
ids.forEach((item, index) => {
|
|
|
item.style["z-index"] = "99";
|
|
|
});
|
|
|
-
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].totalTableD.forEach(item => {
|
|
|
- item.drugList = [];
|
|
|
- });
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData = this.recipe_tabs[
|
|
|
- this.recipe_tabs_c
|
|
|
- ].totalTableD.filter((item, index) => {
|
|
|
- return item.id % 2 != 0;
|
|
|
- });
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData1 = this.recipe_tabs[
|
|
|
- this.recipe_tabs_c
|
|
|
- ].totalTableD.filter((item, index) => {
|
|
|
- return item.id % 2 == 0;
|
|
|
- });
|
|
|
+ this._splitDataToView();
|
|
|
}, 500);
|
|
|
},
|
|
|
// 合并表一 表二
|
|
|
@@ -1994,7 +1875,11 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 切换中药类型时 切换 药房 获取 药品里面有没有这条数据
|
|
|
- async changePharmacy(type) {
|
|
|
+ async changePharmacy(type, val) {
|
|
|
+ if (!type) type = this.recipe_tabs[this.recipe_tabs_c].lastType || '';
|
|
|
+ if (!val) val = this.recipe_tabs[this.recipe_tabs_c].radio || '';
|
|
|
+ this.recipe_tabs[this.recipe_tabs_c].radio = val;
|
|
|
+
|
|
|
let drugIds = [];
|
|
|
const loading = this.$loading({
|
|
|
lock: true,
|
|
|
@@ -2005,7 +1890,7 @@ export default {
|
|
|
|
|
|
this.recipe_tabs[this.recipe_tabs_c].totalTableD.forEach(item => {
|
|
|
if (item.name) {
|
|
|
- let idDose = item.medid + "&" + (item.dose || item.oldDose);
|
|
|
+ let idDose = item.medid + "&" + (item.dose || item.oldDose) + "&" + (item.usage || "");
|
|
|
// drugIds.push(item.medid)
|
|
|
item.oldDose = item.dose;
|
|
|
drugIds.push(idDose);
|
|
|
@@ -2013,8 +1898,7 @@ export default {
|
|
|
});
|
|
|
|
|
|
let pharmacyName = "";
|
|
|
- let type1 = "";
|
|
|
- type1 = this.recipe_tabs[this.recipe_tabs_c].radio.split("@")[1];
|
|
|
+ val = val.split("@")[1];
|
|
|
type = type.split("@")[1];
|
|
|
|
|
|
this.recipe_tabs[this.recipe_tabs_c].pharmacyID = this.recipe_tabs[
|
|
|
@@ -2022,7 +1906,7 @@ export default {
|
|
|
].radio.split("@")[0];
|
|
|
|
|
|
let params = {
|
|
|
- type: type1,
|
|
|
+ type: val || type,
|
|
|
pharmacyid: this.recipe_tabs[this.recipe_tabs_c].pharmacyID,
|
|
|
drugIds,
|
|
|
preType: this.recipe_tabs[this.recipe_tabs_c].preType,
|
|
|
@@ -2035,6 +1919,12 @@ export default {
|
|
|
this.recipe_tabs[this.recipe_tabs_c].totalTableD.forEach(
|
|
|
(item1, index1) => {
|
|
|
if (item1.name) {
|
|
|
+ const getUsage = (function (list = [], value = '') {
|
|
|
+ if (!Array.isArray(list) || list.length === 0) return void 0;
|
|
|
+ const option = value && list.find(item => item.value === value || item.key == value);
|
|
|
+ return option ? option.key : list[0].key;
|
|
|
+ }).bind(null, this.usageList);
|
|
|
+
|
|
|
res.Data.forEach((item, index) => {
|
|
|
if (item == item1.medid) {
|
|
|
item1.color = "red";
|
|
|
@@ -2049,7 +1939,7 @@ export default {
|
|
|
spec: item.gg, // 规格
|
|
|
dose: item.dose, // 剂量
|
|
|
unit: item.dw, // 单位
|
|
|
- usage: item1.usagestr || item1.usage || "", // 用法
|
|
|
+ usage: item.usagestr || item.usage, // || this.usegeList[0].key, // 用法
|
|
|
// usage: "",
|
|
|
// price: item.lsjg,
|
|
|
price: item.price,
|
|
|
@@ -2063,6 +1953,7 @@ export default {
|
|
|
usageList: [],
|
|
|
oldDose: item1.oldDose
|
|
|
};
|
|
|
+ /* 修正 */ item1.usage = item1.useage = getUsage(item1.usage);
|
|
|
|
|
|
item1.color = "#000";
|
|
|
}
|
|
|
@@ -2082,16 +1973,7 @@ export default {
|
|
|
return (item.id = index + 1);
|
|
|
}
|
|
|
);
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData = this.recipe_tabs[
|
|
|
- this.recipe_tabs_c
|
|
|
- ].totalTableD.filter((item, index) => {
|
|
|
- return item.id % 2 != 0;
|
|
|
- });
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData1 = this.recipe_tabs[
|
|
|
- this.recipe_tabs_c
|
|
|
- ].totalTableD.filter((item, index) => {
|
|
|
- return item.id % 2 == 0;
|
|
|
- });
|
|
|
+ this._splitDataToView();
|
|
|
|
|
|
// this.recipe_tabs[this.recipe_tabs_c].lastType = this.recipe_tabs[this.recipe_tabs_c]
|
|
|
// .radio // 存储这一次的 药房类型
|
|
|
@@ -2100,7 +1982,7 @@ export default {
|
|
|
].radio; // 存储这一次的 药房类型
|
|
|
loading.close();
|
|
|
// console.log(this.recipe_tabs[this.recipe_tabs_c].totalTableD);
|
|
|
- this.getPharmacyMsg(this.recipe_tabs[this.recipe_tabs_c].pharmacyID);
|
|
|
+ await this.getPharmacyMsg(this.recipe_tabs[this.recipe_tabs_c].pharmacyID);
|
|
|
setTimeout(() => {
|
|
|
this.countNowRecipeMoney();
|
|
|
}, 500);
|
|
|
@@ -2125,6 +2007,7 @@ export default {
|
|
|
},
|
|
|
// 获取表格药品列表
|
|
|
async getTableDrug(key, page, index, load = true) {
|
|
|
+ if (medicineBlurTimer) clearTimeout(medicineBlurTimer);
|
|
|
if (!load) return;
|
|
|
let pharmacyName = "";
|
|
|
// let type = 0
|
|
|
@@ -2143,6 +2026,7 @@ export default {
|
|
|
pharmacyid: this.recipe_tabs[this.recipe_tabs_c].pharmacyID
|
|
|
};
|
|
|
let res = await getTableDrug(params);
|
|
|
+ if (this.index !== index) return;
|
|
|
|
|
|
if (res.ResultCode == 0) {
|
|
|
// 计算方式3
|
|
|
@@ -2175,22 +2059,23 @@ export default {
|
|
|
return (item.id = index + 1);
|
|
|
}
|
|
|
);
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData = this.recipe_tabs[
|
|
|
- this.recipe_tabs_c
|
|
|
- ].totalTableD.filter((item, index) => {
|
|
|
- return item.id % 2 != 0;
|
|
|
- });
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].tableData1 = this.recipe_tabs[
|
|
|
- this.recipe_tabs_c
|
|
|
- ].totalTableD.filter((item, index) => {
|
|
|
- return item.id % 2 == 0;
|
|
|
- });
|
|
|
+ this._splitDataToView();
|
|
|
} else {
|
|
|
this.recipe_tabs[this.recipe_tabs_c].totalTableD[
|
|
|
index
|
|
|
].loadMore = false;
|
|
|
}
|
|
|
+
|
|
|
+ if (page === 1) {
|
|
|
+ const el = document.querySelectorAll(`.medicine-editor-wrapper #infiniteList${index+1}`)[0];
|
|
|
+ if (el && el.scrollTop > 0) el.scrollTop = 0;
|
|
|
+ }
|
|
|
}
|
|
|
+ setTimeout(() => {
|
|
|
+ const el = document.querySelectorAll(`.medicine-editor-wrapper #searchD${index+1}`)[0];
|
|
|
+ console.log(el);
|
|
|
+ if (el) el.focus();
|
|
|
+ }, 100);
|
|
|
},
|
|
|
// 获取省数据
|
|
|
async getProver() {
|