|
|
@@ -1143,6 +1143,24 @@ export default {
|
|
|
},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
|
+ async loaded(props) {
|
|
|
+ if (!this.pharmacyTypes.length) await this.customerQuery(props).catch(() => void 0);
|
|
|
+ return this;
|
|
|
+ },
|
|
|
+ _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();
|
|
|
@@ -1209,6 +1227,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;
|
|
|
@@ -1233,15 +1253,8 @@ 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"
|
|
|
- );
|
|
|
+ const el = document.querySelectorAll(`#infiniteList${scope.row.id}`)[0];
|
|
|
+ if (el) el.scrollTop += 36;
|
|
|
}
|
|
|
this.recipe_tabs[this.recipe_tabs_c].totalTableD = totalData;
|
|
|
totalData.filter((item, index) => {
|
|
|
@@ -1249,19 +1262,12 @@ 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);
|
|
|
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;
|
|
|
// 如果到最后一个 判断是否需要分页
|
|
|
@@ -1271,30 +1277,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(`#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(
|
|
|
@@ -1309,16 +1301,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;
|
|
|
@@ -1810,17 +1793,7 @@ export default {
|
|
|
scope.row.id - 1
|
|
|
].total = total;
|
|
|
|
|
|
- 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);
|
|
|
+ this._splitDataToView(totalData);
|
|
|
|
|
|
if (this.recipe_tabs[this.recipe_tabs_c].bottom_form.doseNum) {
|
|
|
// this.countNowRecipeMoney();
|
|
|
@@ -1905,16 +1878,7 @@ 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(() => {
|
|
|
@@ -1965,16 +1929,7 @@ 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 (
|
|
|
@@ -2017,16 +1972,7 @@ 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) {
|
|
|
@@ -2057,10 +2003,6 @@ export default {
|
|
|
].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);
|
|
|
},
|
|
|
// 输入框获取 药品列表
|
|
|
searchDrug(e, scope) {
|
|
|
@@ -2077,7 +2019,6 @@ 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");
|
|
|
ids.forEach((item, index) => {
|
|
|
item.style["z-index"] = "auto";
|
|
|
@@ -2092,21 +2033,15 @@ 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;
|
|
|
- });
|
|
|
+ const totalData = this.recipe_tabs[this.recipe_tabs_c].totalTableD;
|
|
|
+ totalData[index].key = e;
|
|
|
+ totalData[index].search_i = 0;
|
|
|
+ this._splitDataToView(totalData);
|
|
|
this.index = scope.row.id - 1;
|
|
|
|
|
|
// 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;
|
|
|
@@ -2137,16 +2072,7 @@ export default {
|
|
|
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);
|
|
|
},
|
|
|
drugBlur1(e, scope) {
|
|
|
@@ -2176,16 +2102,7 @@ export default {
|
|
|
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);
|
|
|
},
|
|
|
// 合并表一 表二
|
|
|
@@ -2492,7 +2409,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 选择药房
|
|
|
- async customerQuery() {
|
|
|
+ async customerQuery(defaultProps = {}) {
|
|
|
let res = await customerQuery({
|
|
|
type: 0
|
|
|
});
|
|
|
@@ -2508,10 +2425,10 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
-
|
|
|
+ defaultProps = {...pharmacyTypes[0], ...defaultProps};
|
|
|
this.recipe_tabs[this.recipe_tabs_c].pharmacyID = res.Data[0].pid;
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].radio = pharmacyTypes[0].ptype;
|
|
|
- this.recipe_tabs[this.recipe_tabs_c].lastType = pharmacyTypes[0].ptype;
|
|
|
+ this.recipe_tabs[this.recipe_tabs_c].radio = defaultProps.ptype;
|
|
|
+ this.recipe_tabs[this.recipe_tabs_c].lastType = defaultProps.ptype;
|
|
|
this.pharmacyList = res.Data;
|
|
|
this.pharmacyTypes = pharmacyTypes;
|
|
|
this.$forceUpdate();
|
|
|
@@ -2535,6 +2452,7 @@ export default {
|
|
|
|
|
|
// 切换中药类型时 切换 药房 获取 药品里面有没有这条数据
|
|
|
async changePharmacy(type, val) {
|
|
|
+ // TODO 此处 if 不会调用 触发在 [this.$emit("updateDp", res.Data)](src/components/ChineseMedicine.vue:2831)
|
|
|
if (this.recipe_tabs[this.recipe_tabs_c].radio == val) {
|
|
|
this.$parent.openAddress();
|
|
|
return;
|
|
|
@@ -2584,6 +2502,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";
|
|
|
@@ -2598,7 +2522,7 @@ export default {
|
|
|
spec: item.gg, // 规格
|
|
|
dose: item.dose, // 剂量
|
|
|
unit: item.dw, // 单位
|
|
|
- usage: item.usagestr || item.usage || this.usegeList[0].key, // 用法
|
|
|
+ usage: item.usagestr || item.usage, // || this.usegeList[0].key, // 用法
|
|
|
// usage: "",
|
|
|
// price: item.lsjg,
|
|
|
price: item.price,
|
|
|
@@ -2612,6 +2536,7 @@ export default {
|
|
|
usageList: [],
|
|
|
oldDose: item1.oldDose
|
|
|
};
|
|
|
+ /* 修正 */ item1.usage = item1.useage = getUsage(item1.usage);
|
|
|
|
|
|
item1.color = "#000";
|
|
|
}
|
|
|
@@ -2631,16 +2556,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 // 存储这一次的 药房类型
|
|
|
@@ -2724,22 +2640,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(`#infiniteList${index+1}`)[0];
|
|
|
+ if (el && el.scrollTop > 0) el.scrollTop = 0;
|
|
|
+ }
|
|
|
}
|
|
|
+ setTimeout(() => {
|
|
|
+ const el = document.querySelectorAll(`#searchD${index+1}`)[0];
|
|
|
+ console.log(el);
|
|
|
+ if (el) el.focus();
|
|
|
+ }, 100);
|
|
|
},
|
|
|
// 获取省数据
|
|
|
async getProver() {
|