123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347 |
- <template>
- <div class="main-contain">
- <div class="position">
- <bread-crumb :crumbs="crumbs"></bread-crumb>
- <el-row style="float: right">
- <el-col :span="24">
- <el-button
- size="small"
- icon="el-icon-printer"
- type="primary"
- @click="printAction"
- >打印</el-button
- >
- </el-col>
- </el-row>
- </div>
- <div
- class="app-container"
- style="background-color: white"
- v-loading="loading"
- >
- <div id="print_content">
- <div class="print_main_content">
- <div class="order_title_panl">
- <span class="main_title">药品管理查询表</span>
- </div>
- <div style="text-align: right; margin-bottom: 20px; font-size: 14px">
- <span class="time_p">打印时间:{{ time_now }}</span>
- </div>
- <div class="table_panel">
- <table class="table">
- <thead>
- <tr>
- <td width="5%">序号</td>
- <td width="6%">药品类型</td>
- <td width="10%">药品名称</td>
- <td width="9%">规格&单位</td>
- <td width="13%">生产厂商</td>
- <td width="10%">批准文号</td>
- <td width="6%">国家编码</td>
- <td width="6%">仓库名称</td>
- <td width="6%">入库数量</td>
- <td width="6%">出库数量</td>
- <td width="6%">退库数量</td>
- <td width="6%">实际出库</td>
- <td width="6%">剩余库存</td>
- <td width="9%">总库存量</td>
- </tr>
- </thead>
- <tbody>
- <tr v-for="(item, index) in tableList" :key="index">
- <td>{{ index + 1 }}</td>
- <td>{{ getDrugTypeName(item.drug_type) }}</td>
- <td>{{ item.drug_name }}</td>
- <td>
- {{ item.dose }}{{ item.dose_unit }}*{{ item.min_number
- }}{{ item.min_unit }}/{{ item.max_unit }}
- </td>
- <td>
- {{ getManufacturName(item.manufacturer) }}
- </td>
- <!-- 批准文号 -->
- <td >{{item.number}}</td>
- <td >{{ item.medical_insurance_number }}</td>
- <!-- 仓库名称 -->
- <td style="padding: 0;text-align:center;">
- <table class="ware_table" style="width: 100%; border-collapse: collapse">
- <tr v-for="(it, i) in item.drug_stock_info" :key="i" style="width: 100%">
- <td :style="[{border:i===(item.drug_stock_info.length)-1?'none':''},{borderStyle:i===(item.drug_stock_info.length)-1?'initial':'hidden'},{borderBottom:i===(item.drug_stock_info.length)-1?'none':'1px solid'}]">
- {{ getHouseName(it.storehouse_id) }}
- </td>
- </tr>
- </table>
- </td>
- <!-- 入库数量 -->
- <td style="padding: 0">
- <table style="width: 100%; border-collapse: collapse">
- <tr
- style="width: 100%;"
- v-for="(it, i) in item.drug_stock_info"
- :key="i"
- >
- <td :style="[{border:i===(item.drug_stock_info.length)-1?'none':''},{borderStyle:i===(item.drug_stock_info.length)-1?'initial':'hidden'},{borderBottom:i===(item.drug_stock_info.length)-1?'none':'1px solid'}]"
- >
- <!-- {{getWarehoseInfoSeven(item.drug_warehouse_info, item.max_unit, item.min_unit,item.min_number,it.storehouse_id)}} -->
- {{
- getDrugIn(
- it.storehouse_id,
- item.drug_stock_count,
- item.max_unit,
- item.min_unit,
- item.min_number
- )?getDrugIn(
- it.storehouse_id,
- item.drug_stock_count,
- item.max_unit,
- item.min_unit,
- item.min_number
- ):' '
- }}
- </td>
- </tr>
- </table>
- </td>
- <!-- 出库数量 -->
- <td style="padding: 0">
- <table style="width: 100%; border-collapse: collapse">
- <tr
- style="width: 100%; border-bottom: 1px"
- v-for="(it, i) in item.drug_stock_info"
- :key="i"
- >
- <td :style="[{border:i===(item.drug_stock_info.length)-1?'none':''},{borderStyle:i===(item.drug_stock_info.length)-1?'initial':'hidden'},{borderBottom:i===(item.drug_stock_info.length)-1?'none':'1px solid'}]"
- >
- <!-- {{getOutFlushNightSeven(item.drug_warehouse_out,item.max_unit,item.min_unit,item.min_number,it.storehouse_id,item.drug_cancel_stock_info)}} -->
- {{
- getActOut(
- it.storehouse_id,
- item.drug_stock_count,
- item.max_unit,
- item.min_unit,
- item.min_number
- )?getActOut(
- it.storehouse_id,
- item.drug_stock_count,
- item.max_unit,
- item.min_unit,
- item.min_number
- ):' '
- }}
- </td>
- </tr>
- </table>
- </td>
- <!-- 退库数量 -->
- <td style="padding: 0">
- <table style="width: 100%; border-collapse: collapse">
- <tr
- style="width: 100%; border-bottom: 1px"
- v-for="(it, i) in item.drug_stock_info"
- :key="i"
- >
- <td :style="[{border:i===(item.drug_stock_info.length)-1?'none':''},{borderStyle:i===(item.drug_stock_info.length)-1?'initial':'hidden'},{borderBottom:i===(item.drug_stock_info.length)-1?'none':'1px solid'}]"
- >
- <!-- {{getOutFlushTen(item.drug_cancel_stock_info,item.max_unit,item.min_unit,item.min_number,it.storehouse_id)}} -->
- {{
- getDrugCancel(
- it.storehouse_id,
- item.drug_stock_count,
- item.max_unit,
- item.min_unit,
- item.min_number
- )?getDrugCancel(
- it.storehouse_id,
- item.drug_stock_count,
- item.max_unit,
- item.min_unit,
- item.min_number
- ):' '
- }}
- </td>
- </tr>
- </table>
- </td>
- <!-- 实际出库 -->
- <td style="padding: 0">
- <table style="width: 100%; border-collapse: collapse">
- <tr
- style="width: 100%; border-bottom: 1px"
- v-for="(it, i) in item.drug_stock_info"
- :key="i"
- >
- <td :style="[{border:i===(item.drug_stock_info.length)-1?'none':''},{borderStyle:i===(item.drug_stock_info.length)-1?'initial':'hidden'},{borderBottom:i===(item.drug_stock_info.length)-1?'none':'1px solid'}]"
- >
- <!-- {{getOutFlushNightSix(item.drug_warehouse_out,item.max_unit,item.min_unit,item.min_number,it.storehouse_id)}} </span> -->
- {{
- getDrugOut(
- it.storehouse_id,
- item.drug_stock_count,
- item.max_unit,
- item.min_unit,
- item.min_number
- )?getDrugOut(
- it.storehouse_id,
- item.drug_stock_count,
- item.max_unit,
- item.min_unit,
- item.min_number
- ):' '
- }}
- </td>
- </tr>
- </table>
- </td>
- <!--剩余库存 -->
- <td style="padding: 0">
- <table style="width: 100%; border-collapse: collapse">
- <tr
- style="width: 100%; border-bottom: 1px"
- v-for="(it, i) in item.drug_stock_info"
- :key="i"
- >
- <td :style="[{border:i===(item.drug_stock_info.length)-1?'none':''},{borderStyle:i===(item.drug_stock_info.length)-1?'initial':'hidden'},{borderBottom:i===(item.drug_stock_info.length)-1?'none':'1px solid'}]"
- >
- <!-- {{getOverFlushInfoEight(item.drug_warehouse_info,item.max_unit,item.min_unit,item.min_number,it.storehouse_id)}} -->
- {{
- getFlushCount(
- it.storehouse_id,
- item.drug_stock_count,
- item.max_unit,
- item.min_unit,
- item.min_number
- )?getFlushCount(
- it.storehouse_id,
- item.drug_stock_count,
- item.max_unit,
- item.min_unit,
- item.min_number
- ):' '
- }}
- </td>
- </tr>
- </table>
- </td>
- <!-- 总库存量 -->
- <td style="padding: 0">
- <table style="width: 100%; border-collapse: collapse">
- <td
- style="
- border: 0;
- text-align: center;
- border-bottom: 1px;
- width: 100%;
- "
- >
- <!-- {{getOverFlushInfo(item.drug_warehouse_info,item.max_unit,item.min_unit,item.min_number)? getOverFlushInfo(item.drug_warehouse_info,item.max_unit,item.min_unit,item.min_number): 0}} -->
- {{
- getSumCount(
- item.drug_stock_count,
- item.max_unit,
- item.min_unit,
- item.min_number
- )
- }}
- </td>
- </table>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
-
- <script>
- import BreadCrumb from "@/xt_pages/components/bread-crumb";
- import {
- getStorehouseList,
- getDrugNewQuery,
- getDrugWarehouseOutInfoById,
- } from "@/api/drug/drug";
-
- import print from "print-js";
- const moment = require("moment");
- export default {
- components: {
- BreadCrumb,
- },
- data() {
- return {
- crumbs: [
- { path: false, name: "库存管理" },
- { path: false, name: "库存查询" },
- { path: false, name: "库存查询打印" },
- ],
- start_time: "",
- end_time: "",
- drug_name: "",
- drug_spec: "",
- keyword: "",
- tableData: [],
- time_now: moment(new Date()).add("year", 0).format("YYYY-MM-DD"),
- type_name: "",
- limit: "",
- page: "",
- tableList: [],
- manufacturerList: [],
- countList: [],
- outCountList: [],
- autoCountList: [],
- cancelCountList: [],
- org_id: 0,
- patient_id: 0,
- storehouse_id: [],
- loding: false,
- good_type: 0,
- drugTypeList: [],
- houseList: [],
- };
- },
- methods: {
- printAction: function () {
- const style =
- "@media print {.print_main_content{ background-color: white;min-width:1500px;margin:0 auto; padding: 0 0 20px 0; } .order_title_panl { text-align: center; } .time_p{font-size:16px;} .main_title { font-size: 18px; line-height: 40px; font-weight: 500; } .table_panel { } .table { width: 100%; border: 1px solid; border-collapse: collapse; padding: 2px; } thead tr td { border: 1px solid; text-align: center; font-size: 16px; padding: 3px 0px; } tbody tr td { border: 1px solid; text-align: center; font-size: 16px; padding: 3px 0px;} .proj { padding: 3px 0; text-align: left; } .proj_title { font-size: 16px; font-weight: 500; line-height: 25px; } .proj_item { font-size: 15px; line-height: 20px; } .zone_name { font-weight: 500; } }";
- printJS({
- printable: "print_content",
- type: "html",
- documentTitle: " ",
- style: style,
- scanStyles: false,
- });
- },
- getStorehouseList() {
- getStorehouseList().then((response) => {
- if (response.data.state == 1) {
- var houseList = response.data.data.list;
- var obj = { id: 0, storehouse_name: "全部" };
- this.houseList.push(obj);
- for (let i = 0; i < houseList.length; i++) {
- this.houseList.push(houseList[i]);
- }
- this.manufacturerList = response.data.data.manufacturerList;
- this.goodTypeList = response.data.data.goodTypeList;
- this.patientList = response.data.data.patientList;
- }
- });
- },
- getlist() {
- this.loading = true;
- var params = {
- storehouse_id: this.storehouse_id,
- good_type: this.good_type,
- keyword: this.keyword,
- page: this.page,
- limit: this.limit,
- start_time: this.start_time,
- end_time: this.end_time,
- };
- getDrugNewQuery(params).then((response) => {
- if (response.data.state == 1) {
- this.loading = false;
- var list = response.data.data.list;
- var countList = response.data.data.countList;
- // if(list!=null){
- // 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 = countList;
- this.total = response.data.data.total;
- this.drugTypeList = response.data.data.drugTypeList;
- }
- });
- },
- getManufacturName(id) {
- var manufacturer_name = "";
- for (let i = 0; i < this.manufacturerList.length; i++) {
- if (id == this.manufacturerList[i].id) {
- manufacturer_name = this.manufacturerList[i].manufacturer_name;
- }
- }
- return manufacturer_name;
- },
- seach() {
- this.getlist();
- },
- getGoodTypeName(id) {
- var type_name = "";
- for (let i = 0; i < this.goodTypeList.length; i++) {
- if (id == this.goodTypeList[i].id) {
- type_name = this.goodTypeList[i].type_name;
- }
- }
- return type_name;
- },
- 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;
- },
- getWareInfoCount(val, storehouse_id) {
- var count = 0;
- if (val.length > 0) {
- for (let i = 0; i < val.length; i++) {
- if (val[i].storehouse_id == storehouse_id) {
- count += val[i].warehousing_count;
- }
- }
- }
- if (count > 0) {
- return count;
- } else {
- return "";
- }
- },
- getOverFlushInfo(arr, max_unit, min_unit, min_number) {
- var max_str = "";
- var min_str = "";
- var total = 0;
- var newarr = arr;
- if (newarr.length > 0) {
- for (let i = 0; i < newarr.length; i++) {
- 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;
- },
- getTime(val) {
- if (val < 0) {
- return "";
- }
- if (val == "") {
- return "";
- } else {
- return uParseTime(val, "{y}-{m}-{d}");
- }
- },
- getName(id) {
- var name = "";
- for (let i = 0; i < this.patientList.length; i++) {
- if (id == this.patientList[i].id) {
- name = this.patientList[i].name;
- }
- }
- return name;
- },
- getDrugTypeName(id) {
- var type_name = "";
- for (let i = 0; i < this.drugTypeList.length; i++) {
- if (id == this.drugTypeList[i].value) {
- type_name = this.drugTypeList[i].name;
- }
- }
- return type_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;
- },
- getOutFlushNightSix(info, max_unit, min_unit, min_number, storehouse_id) {
- var str = "";
- var str_min = "";
- //总库存
- var total = 0;
- for (let i = 0; i < info.length; i++) {
- if (info[i].storehouse_id == storehouse_id) {
- total += info[i].count;
- }
- }
-
- if (parseInt(total / min_number) != 0) {
- str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- str_min = (total % min_number) + min_unit;
- }
- return str + str_min;
- },
- getOutFlushNightSeven(
- info,
- max_unit,
- min_unit,
- min_number,
- storehouse_id,
- val
- ) {
- var str = "";
- var str_min = "";
- //总库存
- var total = 0;
- var totalOne = 0;
- var totalTwo = 0;
- if (info != null && info.length > 0) {
- for (let i = 0; i < info.length; i++) {
- if (info[i].storehouse_id == storehouse_id) {
- totalOne += info[i].count;
- }
- }
- }
-
- if (val != null && val.length > 0) {
- for (let i = 0; i < val.length; i++) {
- if (val[i].storehouse_id == storehouse_id) {
- totalTwo += val[i].count;
- }
- }
- }
-
- total = totalOne + totalTwo;
-
- if (parseInt(total / min_number) != 0) {
- str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- str_min = (total % min_number) + min_unit;
- }
- return str + str_min;
- },
- 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;
- }
- }
- 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;
- },
- 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;
- },
-
- 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;
- },
- getOutFlushTen(info, max_unit, min_unit, min_number, storehouse_id) {
- var str = "";
- var str_min = "";
- //总库存
- var total = 0;
- for (let i = 0; i < info.length; i++) {
- if (info[i].storehouse_id == storehouse_id) {
- total += info[i].count;
- }
- }
- if (parseInt(total / min_number) != 0) {
- str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- str_min = (total % min_number) + min_unit;
- }
- return str + str_min;
- },
- getDrugOut(
- info,
- max_unit,
- min_unit,
- min_number,
- storehouse_id,
- cancel_stock_info
- ) {
- var str = "";
- var str_min = "";
- var cancel_count = 0;
- var cha_count = 0;
- //总库存
- var total = 0;
- for (let i = 0; i < info.length; i++) {
- if (info[i].storehouse_id == storehouse_id) {
- total += info[i].count;
- }
- }
- for (let i = 0; i < cancel_stock_info.length; i++) {
- if (cancel_stock_info[i].storehouse_id == storehouse_id) {
- cancel_count += cancel_stock_info[i].count;
- }
- }
- cha_count = total - cancel_count;
-
- 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;
- },
- handleDetail(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) {
- 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,
- });
- },
- // 合并单元格样式
- cellStyle({ row, column, rowIndex, columnIndex }) {
- let arr = [5, 6, 7, 8, 9, 10, 11];
- if (arr.indexOf(columnIndex) > -1) {
- return "spanClass";
- }
- },
- getCount(
- patient_id,
- warehouse_out_id,
- sys_record_time,
- max_unit,
- min_unit,
- drug_id,
- count,
- min_number,
- warehouse_info_id
- ) {
- var stock_max_number = "";
- var stock_min_number = "";
- var total = 0;
- var min_str = "";
- var max_str = "";
- if (this.flushList != null && this.flushList.length > 0) {
- for (let i = 0; i < this.flushList.length; i++) {
- if (
- patient_id == this.flushList[i].patient_id &&
- drug_id == this.flushList[i].drug_id &&
- patient_id == this.flushList[i].patient_id &&
- warehouse_out_id == this.flushList[i].warehouse_out_id &&
- sys_record_time == this.flushList[i].system_time &&
- this.flushList[i].count == count &&
- this.flushList[i].batch_number_id == warehouse_info_id
- ) {
- stock_max_number = this.flushList[i].drug_max_number * min_number;
- stock_min_number = this.flushList[i].drug_min_number;
- }
- }
- console.log("oo233322332332", stock_max_number, stock_min_number);
- total = stock_max_number + 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;
- }
- },
- hide: function () {
- this.visibility = false;
- },
- show: function () {
- this.getConfig();
- this.visibility = true;
- },
- changeOpen(val) {
- var message = "";
- if (val == 1) {
- message = "启用药品自动扣减功能";
- } else {
- message = "关闭药品自动扣减功能";
- }
-
- this.$confirm(message, "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "info",
- })
- .then(() => {
- createDrugStockAutomaticReduceConfig(val).then((response) => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- if (response.data.data.is_open == 1) {
- this.is_open = true;
- this.$message({
- type: "success",
- message: "已启用",
- });
- } else {
- this.is_open = false;
- this.$message({
- type: "success",
- message: "已关闭",
- });
- }
- }
- });
- })
- .catch(() => {});
- },
- getConfig() {
- getDrugStockAutomaticReduceConfig().then((response) => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- var config = response.data.data.config;
- if (config.is_open == 1) {
- this.is_open = true;
- } else {
- this.is_open = false;
- }
- }
- });
- },
- printOrder() {
- this.$router.push(
- "/drugs/query/print?start_time=" +
- this.start_time +
- "&end_time=" +
- this.end_time +
- "&keyword=" +
- this.keyword +
- "&storehouse_id=" +
- this.storehouse_id +
- "&page=" +
- this.page +
- "&limit=" +
- this.limit +
- "&good_type=" +
- this.good_type
- );
- },
- 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
- );
- if (this.end_time == 0) {
- this.tableList[i].outCount = this.getWarehouseOutInfo(
- this.tableList[i].drug_warehouse_out,
- 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]));
- },
- 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;
- },
- 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;
- },
- getWarehouseOutInfo(arr, max_unit, min_unit, min_number) {
- var min_str = "";
- var max_str = "";
- var total = 0;
- if (arr.length > 0) {
- for (let i = 0; i < arr.length; i++) {
- total += parseInt(arr[i].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;
- },
-
- //修改后的
- getDrugIn(storehouse_id, val, max_unit, min_unit, min_number) {
- var max_str = "";
- var min_str = "";
- var total = 0;
-
- if (val != null && val != undefined) {
- for (let i = 0; i < val.length; i++) {
- if (storehouse_id == val[i].storehouse_id) {
- total = val[i].sum_in_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;
- },
- getDrugOut(storehouse_id, val, max_unit, min_unit, min_number) {
- var max_str = "";
- var min_str = "";
- var total = 0;
-
- if (val != null && val != undefined) {
- for (let i = 0; i < val.length; i++) {
- if (storehouse_id == val[i].storehouse_id) {
- total = val[i].sum_out_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;
- },
- getDrugCancel(storehouse_id, val, max_unit, min_unit, min_number) {
- var max_str = "";
- var min_str = "";
- var total = 0;
-
- if (val != null && val != undefined) {
- for (let i = 0; i < val.length; i++) {
- if (storehouse_id == val[i].storehouse_id) {
- total = val[i].sum_cancel_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;
- },
- getActOut(storehouse_id, val, max_unit, min_unit, min_number) {
- var max_str = "";
- var min_str = "";
- var total = 0;
-
- if (val != null && val != undefined) {
- for (let i = 0; i < val.length; i++) {
- if (storehouse_id == val[i].storehouse_id) {
- total = val[i].sum_act_out_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;
- },
- getFlushCount(storehouse_id, val, max_unit, min_unit, min_number) {
- var max_str = "";
- var min_str = "";
- var total = 0;
-
- if (val != null && val != undefined) {
- for (let i = 0; i < val.length; i++) {
- if (storehouse_id == val[i].storehouse_id) {
- total = val[i].flush_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;
- },
- getSumCount(val, max_unit, min_unit, min_number) {
- var max_str = "";
- var min_str = "";
- var total = 0;
- if (val != null && val != undefined) {
- for (let i = 0; i < val.length; i++) {
- total += val[i].flush_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;
- },
- },
- created() {
- this.org_id = this.$store.getters.xt_user.org_id;
-
- var starttime = this.$route.query.start_time;
- this.start_time = starttime;
- var endtime = this.$route.query.end_time;
- this.end_time = endtime;
- var storehouse_id = parseInt(this.$route.query.storehouse_id);
- this.storehouse_id = storehouse_id;
- this.good_type = parseInt(this.$route.query.good_type);
- var keyword = this.$route.query.keyword;
- this.keyword = keyword;
- this.page = parseInt(this.$route.query.page);
- this.limit = parseInt(this.$route.query.limit);
- this.getStorehouseList();
- this.getlist();
- },
- };
- </script>
-
-
- <style rel="stylesheet/scss" lang="scss" scoped>
- .print_main_content {
- background-color: white;
- max-width: 1500px;
- margin: 0 auto;
- padding: 0 0 20px 0;
-
- .order_title_panl {
- text-align: center;
-
- .main_title {
- font-size: 18px;
- line-height: 40px;
- font-weight: 500;
- }
- }
- .table_panel {
- .table {
- width: 100%;
- border: 1px solid;
- border-collapse: collapse;
- padding: 2px;
-
- thead {
- tr {
- td {
- border: 1px solid;
- text-align: center;
- font-size: 14px;
- padding: 3px 0px;
- }
- }
- }
- tbody {
- tr {
- td {
- border: 1px solid;
- text-align: center;
- font-size: 14px;
- padding: 3px 0px;
- white-space: pre-line;
- .proj {
- padding: 5px 0;
- text-align: left;
-
- .proj_title {
- font-size: 16px;
- font-weight: 500;
- line-height: 25px;
- }
-
- .proj_item {
- font-size: 15px;
- line-height: 20px;
-
- .zone_name {
- font-weight: 500;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- </style>
|