1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429 |
- <template>
- <div class="main-contain">
- <div class="position">
- <bread-crumb :crumbs="crumbs"></bread-crumb>
- <div>
- <el-button
- size="small"
- class="filter-item"
- type="primary"
- @click="setting"
- >设置
- </el-button>
- <el-button
- size="small"
- class="filter-item"
- type="primary"
- icon="el-icon-printer"
- @click="printOrder"
- >打印
- </el-button>
- <el-button
- size="small"
- class="filter-item"
- type="primary"
- @click="exportStock"
- >导出
- </el-button>
- </div>
- </div>
- <div class="app-container">
- <div class="cell clearfix">
- <div>
- <span>仓库名称:</span>
- <el-select
- v-model="storehouse_id"
- style="width: 200px; margin-right: 10px"
- placeholder="请选择"
- filterable
- @change="changeStorehouseName"
- >
- <el-option
- v-for="item in storeList"
- :key="item.id"
- :label="item.storehouse_name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- <span>药品名称:</span>
- <el-select
- v-model="drug_id"
- style="width: 200px; margin-right: 10px"
- placeholder="请选择"
- filterable
- @change="changeDrugName"
- >
- <el-option
- v-for="item in medicalList"
- :key="item.id"
- :label="item.drug_name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </div>
- <!-- <el-select v-model="drug_type" style="width:160px;margin-right:10px;" placeholder="请选择" @change="changeDrug">
- <el-option
- v-for="(item,index) in drugTypeList"
- :key="index"
- :label="item.name"
- :value="item.id">
- </el-option>
- </el-select> -->
- <!-- <el-date-picker
- v-model="start_time"
- prefix-icon="el-icon-date"
- :editable="false"
- style="width: 196px;"
- type="date"
- placeholder="选择日期时间"
- align="right"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- @change="startTimeChange"
- ></el-date-picker>-
- <el-date-picker
- v-model="end_time"
- prefix-icon="el-icon-date"
- :editable="false"
- style="width: 196px;margin-right:10px;"
- type="date"
- placeholder="选择日期时间"
- align="right"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- @change="endTimeChange"
- ></el-date-picker> -->
- <!-- <el-input
- style="width: 200px;"
- class="filter-item"
- v-model.trim="keywords"
- placeholder="药品名称"
- />
- <el-button
- size="small"
- class="filter-item"
- type="primary"
- icon="el-icon-search"
- @click="search"
- >搜索
- </el-button> -->
- </div>
- <!-- <el-button @click="lili()">调试</el-button>-->
- <el-table
- :data="tableList"
- border
- style="width: 100%"
- :cell-class-name="cellStyle"
- >
- <el-table-column
- prop="drug_type"
- label="药品类型"
- width="100"
- align="center"
- >
- <template slot-scope="scope">
- {{ getDrugType(scope.row.drug_type) }}
- </template>
- </el-table-column>
- <el-table-column prop="drug_name" label="药品名称" align="center">
- <template slot-scope="scope">
- {{ scope.row.drug_name }}
- </template>
- </el-table-column>
- <el-table-column prop="drug_name" label="规格&&单位" align="center">
- <template slot-scope="scope">
- {{
- scope.row.dose +
- scope.row.dose_unit +
- "*" +
- scope.row.min_number +
- scope.row.min_unit +
- "/" +
- scope.row.max_unit
- }}
- </template>
- </el-table-column>
- <el-table-column prop="drug_name" label="国家编码" align="center">
- <template slot-scope="scope">
- {{ scope.row.medical_insurance_number }}
- </template>
- </el-table-column>
- <el-table-column prop="drug_name" label="进货单价" align="center">
- <template slot-scope="scope">
- {{ scope.row.last_price }}
- </template>
- </el-table-column>
- <el-table-column prop="drug_name" label="厂家" align="center">
- <template slot-scope="scope">
- {{ getManufacturerList(scope.row.manufacturer) }}
- </template>
- </el-table-column>
- <el-table-column prop="drug_name" label="仓库名称" align="center">
- <template slot-scope="scope">
- <tr
- style="background: none"
- v-for="(item, index) in scope.row.drug_warehouse"
- :key="index"
- >
- <td
- style="
- border-right: none;
- border-inline-end: none;
- text-align: center;
- "
- >
- {{ getHouseName(item.storehouse_id) }}
- </td>
- </tr>
- </template>
- </el-table-column>
- <el-table-column prop="drug_name" label="入库数量" align="center">
- <template slot-scope="scope">
- <tr
- style="background: none"
- v-for="(item, index) in scope.row.drug_warehouse"
- :key="index"
- >
- <td
- style="
- border-right: none;
- border-inline-end: none;
- text-align: center;
- "
- >
- {{
- getWarehoseInfoSeven(
- scope.row.drug_warehouse_info,
- scope.row.max_unit,
- scope.row.min_unit,
- scope.row.min_number,
- item.storehouse_id
- )
- }}
- </td>
- </tr>
- </template>
- </el-table-column>
- <el-table-column prop="drug_name" label="出库数量" align="center">
- <template slot-scope="scope">
- <tr
- style="background: none"
- v-for="(item, index) in scope.row.drug_warehouse"
- :key="index"
- >
- <td
- style="
- border-right: none;
- border-inline-end: none;
- text-align: center;
- "
- >
- <span>
- {{
- getOutFlushNight(
- scope.row.drug_warehouse_info,
- scope.row.max_unit,
- scope.row.min_unit,
- scope.row.min_number,
- scope.row.drug_cancel_stock_info,
- item.storehouse_id
- )
- }}
- </span>
- </td>
- </tr>
- </template>
- </el-table-column>
-
- <el-table-column prop="drug_name" label="剩余库存量" align="center">
- <template slot-scope="scope">
- <tr
- style="background: none"
- v-for="(item, index) in scope.row.drug_warehouse"
- :key="index"
- >
- <td
- style="
- border-right: none;
- border-inline-end: none;
- text-align: center;
- "
- >
- {{
- getOverFlushInfoEight(
- scope.row.drug_warehouse_info,
- scope.row.max_unit,
- scope.row.min_unit,
- scope.row.min_number,
- item.storehouse_id,
- scope.row.storehouse_id
- )
- }}
- </td>
- </tr>
- </template>
- </el-table-column>
-
- <el-table-column
- prop="drug_name"
- label="总库存量"
- align="center"
- v-if="showThree"
- >
- <template slot-scope="scope">
- <div v-if="getWarehoseInfo(scope.row.drug_warehouse_info) > 0">
- {{
- getOverFlushInfo(
- scope.row.drug_warehouse_info,
- scope.row.max_unit,
- scope.row.min_unit,
- scope.row.min_number
- )
- ? getOverFlushInfo(
- scope.row.drug_warehouse_info,
- scope.row.max_unit,
- scope.row.min_unit,
- scope.row.min_number
- )
- : 0
- }}
- </div>
- </template>
- </el-table-column>
- <el-table-column
- prop="drug_name"
- label="操作"
- align="center"
- width="200px"
- >
- <template slot-scope="scope">
- <el-button
- size="small"
- type="primary"
- @click="handleDetail(scope.row)"
- >库存流水
- </el-button>
- <el-button
- size="small"
- type="primary"
- @click="handleBatch(scope.row)"
- >批次
- </el-button>
- </template>
- </el-table-column>
- </el-table>
-
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :page-sizes="[10, 50, 100, 200, 500, 1000]"
- :page-size="10"
- background
- align="right"
- style="margin-top: 20px"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- >
- </el-pagination>
- </div>
-
- <setting-dialog ref="dialog"></setting-dialog>
- </div>
- </template>
-
- <script>
- import { uParseTime } from "@/utils/tools";
- import BreadCrumb from "@/xt_pages/components/bread-crumb";
- import { getDrugStockList, getDrugCountList } from "@/api/drug/drug_stock";
- import SettingDialog from "./settingDialog/index";
- import { getDictionaryDataConfig } from "@/utils/data";
- import { min } from "moment";
- export default {
- name: "stockIn",
- created() {
- if (this.$route.path == "/Pharmacy/MedicianManagement") {
- this.crumbs = [
- { path: false, name: "药品管理" },
- { path: "/stock/drugs/stock/query", name: "药品库存查询" },
- ];
- }
- var start_time = window.sessionStorage.getItem("start_time");
- var end_time = window.sessionStorage.getItem("end_time");
-
- if (start_time != null) {
- this.start_time = start_time;
- }
- if (end_time != null) {
- this.end_time = end_time;
- }
- window.sessionStorage.removeItem("start_time");
- window.sessionStorage.removeItem("end_time");
- this.getlist();
- var drugCategory = getDictionaryDataConfig("system", "drug_category");
- this.drugCategory.push(...drugCategory);
- var drugTypeList = getDictionaryDataConfig("system", "drug_type");
- this.drugTypeList.push(...drugTypeList);
- this.org_id = this.$store.getters.xt_user.org.id;
- },
- components: {
- SettingDialog,
- BreadCrumb,
- },
- data() {
- return {
- crumbs: [
- { path: false, name: "库存管理" },
- { path: "/stock/drugs/stock/query", name: "药品库存查询" },
- ],
- keywords: "",
-
- multipleSelection: [],
- signAndWeighBoxPatients: "sign-and-weigh-box-patients",
- start_time: "",
- end_time: "",
- page: 1,
- limit: 10,
- total: 0,
- goodType: [],
- goodInfo: [],
- tempArr: [],
- sameRowArr: [],
- WarehouseInfo: {
- loading: false,
- warehouseInfoDate: [],
- },
- tableData: [],
- drug_category: 0,
- drugCategory: [{ id: 0, name: "全部" }],
- drugTypeList: [{ id: 0, name: "全部" }],
- tableList: [],
- manufacturerList: [],
- countList: [],
- outCountList: [],
- autoCountList: [],
- keyword: "",
- drug_type: 0,
- minCount: [],
- drugOutList: [],
- cancelCountList: [],
- allCountList: [],
- org_id: "",
- showOne: true,
- showTwo: false,
- showThree: true,
- showFour: false,
- houseList: [],
- medicalList: [],
- storehouse_id: 0,
- drug_id: 0,
- storeList: [],
- };
- },
-
- methods: {
- lili(){
- console.log("调试:this.tanlelist",this.tableList)
- },
- //获取库存
- getlist() {
- const params = {
- page: this.page,
- limit: this.limit,
- keyword: this.keywords,
- drug_type: this.drug_type,
- start_time: this.start_time,
- end_time: this.end_time,
- drug_id: this.drug_id,
- storehouse_id: this.storehouse_id,
- };
- getDrugStockList(params).then((response) => {
- if (response.data.state == 1) {
- var list = response.data.data.list;
-
- for (let i = 0; i < list.length; i++) {
- for (let j = 0; j < list[i].drug_warehouse_info.length; j++) {
- if (list[i].max_unit == list[i].drug_warehouse_info[j].max_unit) {
- list[i].drug_warehouse_info[j].stock_max_number =
- list[i].min_number *
- list[i].drug_warehouse_info[j].stock_max_number;
- list[i].drug_warehouse_info[j].warehousing_count =
- list[i].min_number *
- list[i].drug_warehouse_info[j].warehousing_count;
- }
- }
- for (let y = 0; y < list[i].drug_warehouse_out.length; y++) {
- if (
- list[i].drug_warehouse_out[y].count_unit == list[i].max_unit
- ) {
- list[i].drug_warehouse_out[y].count =
- list[i].drug_warehouse_out[y].count * list[i].min_number;
- }
- }
- for (let z = 0; z < list[i].drug_cancel_stock_info.length; z++) {
- if (
- list[i].drug_cancel_stock_info[z].max_unit == list[i].max_unit
- ) {
- list[i].drug_cancel_stock_info[z].count =
- list[i].drug_cancel_stock_info[z].count * list[i].min_number;
- }
- }
- }
- var arr = [];
- for (let i = 0; i < list.length; i++) {
- if (list[i].drug_warehouse_info.length > 0) {
- arr.push(list[i]);
- }
- }
- this.tableList = arr;
- var total = response.data.data.total;
- this.total = total;
- this.manufacturerList = response.data.data.manufacturerList;
- this.houseList = [];
- this.storeList = [];
- var obj = {
- id: 0,
- storehouse_name: "全部",
- };
- var objOne = {
- id: 0,
- drug_name: "全部",
- };
-
- this.storeList.push(obj);
- for (let i = 0; i < response.data.data.houseList.length; i++) {
- this.houseList.push(response.data.data.houseList[i]);
- this.storeList.push(response.data.data.houseList[i]);
- }
- this.medicalList = [];
- this.medicalList.push(objOne);
- for (let i = 0; i < response.data.data.medicalList.length; i++) {
- for (
- let j = 0;
- j < response.data.data.manufacturerList.length;
- j++
- ) {
- if (
- response.data.data.medicalList[i].manufacturer ==
- response.data.data.manufacturerList[j].id
- ) {
- response.data.data.medicalList[i].manufacturer =
- response.data.data.manufacturerList[j].manufacturer_name;
- }
- }
- response.data.data.medicalList[i].drug_name =
- response.data.data.medicalList[i].drug_name +
- response.data.data.medicalList[i].dose +
- response.data.data.medicalList[i].dose_unit +
- "*" +
- response.data.data.medicalList[i].min_number +
- response.data.data.medicalList[i].min_unit +
- "/" +
- response.data.data.medicalList[i].max_unit +
- " " +
- response.data.data.medicalList[i].manufacturer;
- this.medicalList.push(response.data.data.medicalList[i]);
- }
- }
- });
- },
- handleSpanTempArr() {
- this.tempArr = [];
-
- for (let i = 0; i < this.WarehouseInfo.warehouseInfoDate.length; i++) {
- if (i === 0) {
- this.tempArr.push(1);
- this.pos = 0;
- } else {
- // 判断当前元素与上一个元素是否相同
- if (
- this.WarehouseInfo.warehouseInfoDate[i].drug_name ===
- this.WarehouseInfo.warehouseInfoDate[i - 1].drug_name
- ) {
- this.tempArr[this.pos] += 1;
- this.tempArr.push(0);
- } else {
- this.tempArr.push(1);
- this.pos = i;
- }
- }
- }
-
- let sameRowArr = [],
- sIdx = 0;
- this.WarehouseInfo.warehouseInfoDate.forEach((item, index) => {
- item.index = index;
- if (index === 0) {
- sameRowArr.push([index]);
- } else {
- if (
- item.drug_name ===
- this.WarehouseInfo.warehouseInfoDate[index - 1].drug_name
- ) {
- sameRowArr[sIdx].push(index);
- } else {
- sIdx = sIdx + 1;
- sameRowArr.push([index]);
- }
- }
- });
- this.sameRowArr = sameRowArr;
- },
- merge({ row, column, rowIndex, columnIndex }) {
- if (columnIndex === 0) {
- const _row = this.tempArr[rowIndex];
- const _col = _row > 0 ? 1 : 0;
- return {
- rowspan: _row,
- colspan: _col,
- };
- }
- },
-
- getSpecificationName: function (id) {
- let name = "";
- for (let i = 0; i < this.goodInfo.length; i++) {
- if (this.goodInfo[i].id == id) {
- name = this.goodInfo[i].specification_name;
- }
- }
- return name;
- },
- getTypeName: function (id) {
- let name = "";
- for (let i = 0; i < this.goodType.length; i++) {
- if (this.goodType[i].id == id) {
- name = this.goodType[i].type_name;
- }
- }
- return name;
- },
-
- handleBack: function () {
- this.$router.go(-1);
- },
- handleSizeChange(val) {
- this.limit = val;
- this.getlist();
- },
- handleCurrentChange(val) {
- this.page = val;
- this.getlist();
- },
- calculate: function (val) {
- return Math.round(parseFloat(val) * 100) / 100;
- },
-
- startTimeChange: function (val) {
- window.sessionStorage.removeItem("start_time");
- var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
- if (time > 0) {
- this.$message.error("开始时间不能大于结束时间");
- this.start_time = "";
- } else {
- this.getlist();
- }
- },
- endTimeChange: function (val) {
- window.sessionStorage.removeItem("end_time");
- var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
- if (time < 0) {
- this.$message.error("结束时间不能小于开始时间");
- this.end_time = "";
- } else {
- if (this.end_time == "") {
- this.showOne = true;
- this.showTwo = false;
- this.showThree = true;
- this.showFour = false;
- this.getlist();
- }
- if (this.end_time != "") {
- this.showOne = false;
- this.showTwo = true;
- this.showThree = false;
- this.showFour = true;
- this.getlist();
- this.getDrugCountList();
- }
- }
- },
- stockInCount: function (row) {
- let total = 0;
- for (let i = 0; i < row.query_drug_warehousing_info.length; i++) {
- total = total + row.query_drug_warehousing_info[i].warehousing_count;
- }
- return total;
- },
- salesReturnCount: function (row) {
- let total = 0;
-
- for (let i = 0; i < row.query_drug_sales_return_info.length; i++) {
- total = total + row.query_drug_sales_return_info[i].count;
- }
- return total;
- },
- stockOutCount: function (row) {
- let total = 0;
-
- for (let i = 0; i < row.query_drug_warehouseout_info.length; i++) {
- total = total + row.query_drug_warehouseout_info[i].count;
- }
- return total;
- },
- cancelStockCount: function (row) {
- let total = 0;
- for (let i = 0; i < row.query_drug_cancel_stock_info.length; i++) {
- total = total + row.query_drug_cancel_stock_info[i].count;
- }
- return total;
- },
- search: function () {
- this.getlist();
- },
- setting: function () {
- this.$refs.dialog.show();
- },
- exportStock() {
- for (let i = 0; i < this.tableList.length; i++) {
- this.tableList[i].index = i + 1;
- this.tableList[i].drug_type_name = this.getDrugType(
- this.tableList[i].drug_type
- );
- this.tableList[i].unit =
- this.tableList[i].dose +
- this.tableList[i].dose_unit +
- "*" +
- this.tableList[i].min_number +
- this.tableList[i].min_unit +
- "/" +
- this.tableList[i].max_unit;
- this.tableList[i].manufacturer_name = this.getManufacturerList(
- this.tableList[i].manufacturer
- );
- this.tableList[i].inCount = this.getWarehoseInfoOne(
- this.tableList[i].drug_warehouse_info,
- this.tableList[i].max_unit,
- this.tableList[i].min_unit,
- this.tableList[i].min_number
- );
- this.tableList[i].outCount = this.getWarehouseOutInfo(
- this.tableList[i].drug_warehouse_info,
- this.tableList[i].max_unit,
- this.tableList[i].min_unit,
- this.tableList[i].min_number
- );
- this.tableList[i].overplusCount = this.getOverFlushInfo(
- this.tableList[i].drug_warehouse_info,
- this.tableList[i].max_unit,
- this.tableList[i].min_unit,
- this.tableList[i].min_number
- );
-
- // if (this.end_time != 0) {
- // this.tableList[i].outCount =
- // this.getOutCount(this.tableList[i].id) +
- // this.getAutoCount(this.tableList[i].id);
- // this.tableList[i].overplusCount =
- // this.getWarehoseInfo(this.tableList[i].drug_warehouse_info) -
- // this.getOutCount(this.tableList[i].id) -
- // this.getAutoCount(this.tableList[i].id);
- // }
- }
- import("@/vendor/Export2Excel").then((excel) => {
- const tHeader = [
- "序号",
- "药品类型",
- "药品名称",
- "规格型号&单位",
- "国家编码",
- "进货单价",
- "厂家",
- "入库数量",
- "出库数量",
- "剩余库存量",
- ];
- const filterVal = [
- "index",
- "drug_type_name",
- "drug_name",
- "unit",
- "medical_insurance_number",
- "last_price",
- "manufacturer_name",
- "inCount",
- "outCount",
- "overplusCount",
- ];
-
- const data = this.formatJson(filterVal, this.tableList);
- excel.export_json_to_excel({
- header: tHeader,
- data,
- filename: "药品查询",
- });
- this.downloadLoading = false;
- });
- },
- formatJson(filterVal, jsonData) {
- return jsonData.map((v) => filterVal.map((j) => v[j]));
- },
- getDictionaryDataConfig(module, filed_name) {
- return getDictionaryDataConfig(module, filed_name);
- },
- getTimestamp(time) {
- // 把时间日期转成时间戳
- return new Date(time).getTime() / 1000;
- },
- changeDrug() {
- this.getlist();
- },
- printOrder() {
- window.sessionStorage.setItem("start_time", this.start_time);
- window.sessionStorage.setItem("end_time", this.end_time);
- this.$router.push({
- name: "drugQueryPrint",
- query: {
- drug_type: this.drug_type,
- keyword: this.keywords,
- start_time: this.start_time,
- end_time: this.end_time,
- page: this.page,
- limit: this.limit,
- },
- });
- },
- getDrugType(id) {
- var name = "";
- for (let i = 0; i < this.drugTypeList.length; i++) {
- if (this.drugTypeList[i].id == id) {
- name = this.drugTypeList[i].name;
- }
- }
-
- return name;
- },
- getManufacturerList(id) {
- var name = "";
- for (let i = 0; i < this.manufacturerList.length; i++) {
- if (id == this.manufacturerList[i].id) {
- name = this.manufacturerList[i].manufacturer_name;
- }
- }
- return name;
- },
- handleDetail(val) {
- console.log("val232332323223323", val);
- var manufacturer_name = "";
- for (let i = 0; i < this.manufacturerList.length; i++) {
- if (val.manufacturer == this.manufacturerList[i].id) {
- manufacturer_name = this.manufacturerList[i].manufacturer_name;
- }
- }
- var unit =
- val.dose +
- val.dose_unit +
- "*" +
- val.min_number +
- val.min_unit +
- "/" +
- val.max_unit;
- var over_plus = this.getOverFlushInfo(
- val.drug_warehouse_info,
- val.max_unit,
- val.min_unit,
- val.min_number
- );
- this.$router.push({
- path:
- "/drugstock/in/drugstockflow?drug_id=" +
- val.id +
- "&manufacturer=" +
- manufacturer_name +
- "&unit=" +
- unit +
- "&min_number=" +
- val.min_number +
- "&max_unit=" +
- val.max_unit +
- "&min_unit=" +
- val.min_unit +
- "&over_plus=" +
- over_plus,
- });
- window.sessionStorage.setItem("start_time", this.start_time);
- window.sessionStorage.setItem("end_time", this.end_time);
- },
- handleBatch(val) {
- console.log("val322332323232", val);
- var manufacturer_name = "";
- for (let i = 0; i < this.manufacturerList.length; i++) {
- if (val.manufacturer == this.manufacturerList[i].id) {
- manufacturer_name = this.manufacturerList[i].manufacturer_name;
- }
- }
- var unit =
- val.dose +
- val.dose_unit +
- "*" +
- val.min_number +
- val.min_unit +
- "/" +
- val.max_unit;
- var over_plus = this.getOverFlushInfo(
- val.drug_warehouse_info,
- val.max_unit,
- val.min_unit,
- val.min_number
- );
-
- window.sessionStorage.setItem("start_time", this.start_time);
- window.sessionStorage.setItem("end_time", this.end_time);
- this.$router.push({
- path:
- "/drugstock/in/drugbatchnumber?drug_id=" +
- val.id +
- "&manufacturer=" +
- manufacturer_name +
- "&unit=" +
- unit +
- "&min_number=" +
- val.min_number +
- "&max_unit=" +
- val.max_unit +
- "&min_unit=" +
- val.min_unit +
- "&over_plus=" +
- over_plus,
- });
- },
- getDrugCountList() {
- var params = {
- keyword: this.keywords,
- start_time: this.start_time,
- end_time: this.end_time,
- };
- console.log("paramsw2ww", params);
- getDrugCountList(params).then((response) => {
- if (response.data.state == 1) {
- var minCount = response.data.data.minCount;
- console.log("minCount", minCount);
- this.minCount = minCount;
- var cancelCountList = response.data.data.cancelCountList;
- this.cancelCountList = cancelCountList;
- var info = response.data.data.info;
- for (let i = 0; i < info.length; i++) {
- if (info[i].count_unit == info[i].max_unit) {
- info[i].count = info[i].count * info[i].min_number;
- }
- }
-
- this.outCountList = response.data.data.outCountList;
- console.log("手动出库", this.outCountList);
- this.auCountList = response.data.data.auCountList;
- console.log("自动出库", this.auCountList);
- this.drugOutList = info;
- }
- });
- },
- getInCount(id) {
- var count = 0;
- for (let i = 0; i < this.countList.length; i++) {
- if (id == this.countList[i].drug_id) {
- count = this.countList[i].count;
- }
- }
- return count;
- },
-
- getOutCount(id) {
- var count = 0;
- for (let i = 0; i < this.outCountList.length; i++) {
- if (id == this.outCountList[i].drug_id) {
- count = this.outCountList[i].count;
- }
- }
- return count;
- },
- getAutoCount(id) {
- var count = 0;
- for (let i = 0; i < this.autoCountList.length; i++) {
- if (id == this.autoCountList[i].drug_id) {
- count = this.autoCountList[i].count;
- }
- }
- return count;
- },
- getMinCount(id) {
- var count = 0;
- for (let i = 0; i < this.minCount.length; i++) {
- if (id == this.minCount[i].drug_id) {
- count = this.minCount[i].count;
- }
- }
- return count;
- },
- getCount(drug_id, min_number, max_unit, min_unit) {
- var total = 0;
- var str = "";
- var min_str = "";
- var arr = [];
- for (let i = 0; i < this.allCountList.length; i++) {
- if (drug_id == this.allCountList[i].drug_id) {
- arr.push(this.allCountList[i]);
- }
- }
- var arrTwo = [];
- for (let i = 0; i < arr.length; i++) {
- if (arr[i].drug_id == 1236) {
- arrTwo.push(arr[i]);
- }
- if (arr[i].count_unit == max_unit) {
- arr[i].count = arr[i].count * min_number;
- }
- if (arr[i].count_unit == min_unit) {
- arr[i].count = arr[i].count;
- }
- total += arr[i].count;
- }
- if (total < min_number) {
- str = "";
- min_str = total + min_unit;
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
-
- return str + min_str;
- },
-
- getCountOne(drug_id) {
- var count = 0;
- for (let i = 0; i < this.drugOutList.length; i++) {
- if (drug_id == this.drugOutList[i].drug_id) {
- count += parseInt(this.drugOutList[i].count);
- }
- }
- return count;
- },
- getCountTwo(drug_id, min_number, max_unit, min_unit) {
- var total_count = 0;
- var out_count = 0;
- var count = 0;
- var str = "";
- var str_min = "";
- total_count = this.getInCount(drug_id) * min_number;
-
- out_count = this.getCountOne(drug_id);
- count = total_count - out_count;
-
- if (parseInt(count / min_number) != 0) {
- str = parseInt(count / min_number) + max_unit;
- }
-
- if (count % min_number != 0) {
- str_min = (count % min_number) + min_unit;
- }
- return str + str_min;
- },
- getCancelCount(id) {
- var count = 0;
- for (let i = 0; i < this.cancelCountList.length; i++) {
- if (id == this.cancelCountList[i].drug_id) {
- count = this.cancelCountList[i].count;
- }
- }
- return count;
- },
- getWarehoseInfo(arr) {
- var total = 0;
- if (arr.length > 0) {
- for (let i = 0; i < arr.length; i++) {
- total += parseInt(arr[i].warehousing_count);
- }
- }
- if (total == 0) {
- total = "";
- }
-
- return total;
- },
-
- getWarehoseInfoOne(arr, max_unit, min_unit, min_number) {
- var total = 0;
- var max_str = "";
- var min_str = "";
- if (arr.length > 0) {
- for (let i = 0; i < arr.length; i++) {
- total += parseInt(arr[i].warehousing_count);
- }
- }
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
- return max_str + min_str;
- },
-
- getOverFlushInfo(arr, max_unit, min_unit, min_number) {
- var max_str = "";
- var min_str = "";
- var total = 0;
- if (arr!=null&&arr.length > 0) {
- for (let i = 0; i < arr.length; i++) {
- total += arr[i].stock_max_number + arr[i].stock_min_number;
- }
- }
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
- return max_str + min_str;
- },
- getWarehouseOutInfo(arr, max_unit, min_unit, min_number) {
- var min_str = "";
- var max_str = "";
- var total_one = 0;
- var total_two = 0
- var total =0
- if (arr!=null&&arr.length > 0) {
- for (let i = 0; i < arr.length; i++) {
- total_one += parseInt(arr[i].warehousing_count);
- }
- }
- if (arr!=null&&arr.length > 0) {
- for (let i = 0; i < arr.length; i++) {
- total_two += parseInt(arr[i].stock_max_number)+ parseInt(arr[i].stock_min_number);
- }
- }
-
- total = total_one - total_two
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
- return max_str + min_str;
- },
-
- getDrugOutList(arr, max_unit, min_unit, min_number) {
- var str = "";
- var str_min = "";
- if (arr.length > 0) {
- for (let i = 0; i < arr.length; i++) {
- if (parseInt(arr[i].count / min_number) != 0) {
- str = parseInt(arr[i].count / min_number) + max_unit;
- }
- if (arr[i].count % min_number != 0) {
- str_min = (arr[i].count % min_number) + min_unit;
- }
- }
- }
- return str + str_min;
- },
-
- getDrugChaCount(
- info,
- out_info,
- max_unit,
- min_unit,
- min_number,
- cancel_info
- ) {
- var total_info = 0;
- var total_out = 0;
- var cha_count = 0;
- var cancel_count = 0;
- if (info.length > 0) {
- for (let i = 0; i < info.length; i++) {
- total_info += info[i].warehousing_count * min_number;
- }
- }
- if (out_info.length > 0) {
- for (let j = 0; j < out_info.length; j++) {
- total_out += out_info[j].count;
- }
- }
- if (cancel_info.length > 0) {
- for (let z = 0; z < cancel_info.length; z++) {
- cancel_count += cancel_info[z].count;
- }
- }
- cha_count = total_info - total_out + cancel_count;
- var str = "";
- var str_min = "";
- if (parseInt(cha_count / min_number) != 0) {
- str = parseInt(cha_count / min_number) + max_unit;
- }
- if (cha_count % min_number != 0) {
- str_min = (cha_count % min_number) + min_unit;
- }
- return str + str_min;
- },
- getOutFlush(info, max_unit, min_unit, min_number, cancel_info) {
- var str = "";
- var str_min = "";
- //总库存
- var total = 0;
- var out_count = 0;
- var over_count = 0;
- var cancel_count = 0;
- for (let i = 0; i < info.length; i++) {
- total += info[i].warehousing_count;
- }
-
- for (let j = 0; j < info.length; j++) {
- out_count += info[j].stock_max_number + info[j].stock_min_number;
- }
-
- // for(let z=0;z<cancel_info.length;z++){
- // cancel_count += cancel_info[z].count
- // }
- // over_count = total - out_count + cancel_count
- over_count = total - out_count;
- if (parseInt(over_count / min_number) != 0) {
- str = parseInt(over_count / min_number) + max_unit;
- }
- if (over_count % min_number != 0) {
- str_min = (over_count % min_number) + min_unit;
- }
- return str + str_min;
- },
- getHouseName(id) {
- var storehouse_name = "";
- for (let i = 0; i < this.houseList.length; i++) {
- if (id == this.houseList[i].id) {
- storehouse_name = this.houseList[i].storehouse_name;
- }
- }
- return storehouse_name;
- },
- getWarehoseInfoSeven(arr, max_unit, min_unit, min_number, storehouse_id) {
- var total = 0;
- var max_str = "";
- var min_str = "";
- if (arr.length > 0) {
- for (let i = 0; i < arr.length; i++) {
- if (arr[i].storehouse_id == storehouse_id) {
- total += parseInt(arr[i].warehousing_count);
- }
- }
- }
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
- return max_str + min_str;
- },
-
- getOverFlushInfoEight(arr, max_unit, min_unit, min_number, storehouse_id) {
- var max_str = "";
- var min_str = "";
- var total = 0;
- var newarr = arr;
-
- if (newarr.length > 0) {
- for (let i = 0; i < newarr.length; i++) {
- if (newarr[i].storehouse_id == storehouse_id) {
- total += newarr[i].stock_max_number + newarr[i].stock_min_number;
- }
- }
- }
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
-
- return max_str + min_str;
- },
- getOutFlushNight(
- info,
- max_unit,
- min_unit,
- min_number,
- cancel_info,
- storehouse_id
- ) {
- var str = "";
- var str_min = "";
- //总库存
- var total = 0;
- var out_count = 0;
- var over_count = 0;
- var cancel_count = 0;
- for (let i = 0; i < info.length; i++) {
- if (info[i].storehouse_id == storehouse_id) {
- total += info[i].warehousing_count;
- }
- }
-
- for (let j = 0; j < info.length; j++) {
- if (info[j].storehouse_id == storehouse_id) {
- out_count += info[j].stock_max_number + info[j].stock_min_number;
- }
- }
-
- // for(let z=0;z<cancel_info.length;z++){
- // cancel_count += cancel_info[z].count
- // }
- // over_count = total - out_count + cancel_count
- over_count = total - out_count;
- if (parseInt(over_count / min_number) != 0) {
- str = parseInt(over_count / min_number) + max_unit;
- }
- if (over_count % min_number != 0) {
- str_min = (over_count % min_number) + min_unit;
- }
- return str + str_min;
- },
- changeStorehouseName() {
- this.getlist();
- },
- changeDrugName() {
- this.getlist();
- },
- // 合并单元格样式
- cellStyle({ row, column, rowIndex, columnIndex }) {
- let arr = [6, 7, 8, 9];
- if (arr.indexOf(columnIndex) > -1) {
- return "spanClass";
- }
- },
- },
- };
- </script>
-
- <style rel="stylesheet/css" lang="scss" scoped>
- .information {
- border: 1px #dcdfe6 solid;
- padding: 30px 20px 30px 20px;
-
- .border {
- border-bottom: 1px #dcdfe6 solid;
- margin: 0px 0 20px 0;
- }
- }
-
- .title {
- background: #409eff;
- height: 44px;
- line-height: 44px;
- padding: 0 0 0 10px;
- color: #fff;
- margin: 0 0 10px 0;
- }
-
- .edit_separater {
- border-top: 1px solid rgb(233, 233, 233);
- margin-top: 15px;
- margin-bottom: 15px;
- }
- </style>
-
- <style>
- .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
- font-size: 12px;
- }
-
- .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
- background: #6fb5fa;
- }
-
- .count {
- color: #bd2c00;
- }
-
- .el-table td,
- .el-table th.is-leaf,
- .el-table--border,
- .el-table--group {
- border-color: #d0d3da;
- }
-
- .el-table--border::after,
- .el-table--group::after,
- .el-table::before {
- background-color: #d0d3da;
- }
-
- /* 合并表格线样式 */
- .spanClass .cell {
- padding: 0 !important;
- }
-
- .spanClass .cell tr {
- display: inline-block;
- width: 100%;
- }
-
- .spanClass .cell tr td {
- padding: 10px 0;
- border-bottom: 1px solid #ebeef5;
- display: block;
- width: 100%;
- }
- .spanClass .cell tr:last-of-type td {
- border-bottom: none;
- }
- </style>
|