Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

drugQueryPrint.vue 42KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <el-row style="float: right">
  6. <el-col :span="24">
  7. <el-button
  8. size="small"
  9. icon="el-icon-printer"
  10. type="primary"
  11. @click="printAction"
  12. >打印</el-button
  13. >
  14. </el-col>
  15. </el-row>
  16. </div>
  17. <div
  18. class="app-container"
  19. style="background-color: white"
  20. v-loading="loading"
  21. >
  22. <div id="print_content">
  23. <div class="print_main_content">
  24. <div class="order_title_panl">
  25. <span class="main_title">药品管理查询表</span>
  26. </div>
  27. <div style="text-align: right; margin-bottom: 20px; font-size: 14px">
  28. <span class="time_p">打印时间:{{ time_now }}</span>
  29. </div>
  30. <div class="table_panel">
  31. <table class="table">
  32. <thead>
  33. <tr>
  34. <td width="5%">序号</td>
  35. <td width="6%">药品类型</td>
  36. <td width="10%">药品名称</td>
  37. <td width="9%">规格&单位</td>
  38. <td width="13%">生产厂商</td>
  39. <td width="10%">批准文号</td>
  40. <td width="6%">国家编码</td>
  41. <td width="6%">仓库名称</td>
  42. <td width="6%">入库数量</td>
  43. <td width="6%">出库数量</td>
  44. <td width="6%">退库数量</td>
  45. <td width="6%">实际出库</td>
  46. <td width="6%">剩余库存</td>
  47. <td width="9%">总库存量</td>
  48. </tr>
  49. </thead>
  50. <tbody>
  51. <tr v-for="(item, index) in tableList" :key="index">
  52. <td>{{ index + 1 }}</td>
  53. <td>{{ getDrugTypeName(item.drug_type) }}</td>
  54. <td>{{ item.drug_name }}</td>
  55. <td>
  56. {{ item.dose }}{{ item.dose_unit }}*{{ item.min_number
  57. }}{{ item.min_unit }}/{{ item.max_unit }}
  58. </td>
  59. <td>
  60. {{ getManufacturName(item.manufacturer) }}
  61. </td>
  62. <!-- 批准文号 -->
  63. <td >{{item.number}}</td>
  64. <td >{{ item.medical_insurance_number }}</td>
  65. <!-- 仓库名称 -->
  66. <td style="padding: 0;text-align:center;">
  67. <table class="ware_table" style="width: 100%; border-collapse: collapse">
  68. <tr v-for="(it, i) in item.drug_stock_info" :key="i" style="width: 100%">
  69. <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'}]">
  70. {{ getHouseName(it.storehouse_id) }}
  71. </td>
  72. </tr>
  73. </table>
  74. </td>
  75. <!-- 入库数量 -->
  76. <td style="padding: 0">
  77. <table style="width: 100%; border-collapse: collapse">
  78. <tr
  79. style="width: 100%;"
  80. v-for="(it, i) in item.drug_stock_info"
  81. :key="i"
  82. >
  83. <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'}]"
  84. >
  85. <!-- {{getWarehoseInfoSeven(item.drug_warehouse_info, item.max_unit, item.min_unit,item.min_number,it.storehouse_id)}}&nbsp; -->
  86. {{
  87. getDrugIn(
  88. it.storehouse_id,
  89. item.drug_stock_count,
  90. item.max_unit,
  91. item.min_unit,
  92. item.min_number
  93. )?getDrugIn(
  94. it.storehouse_id,
  95. item.drug_stock_count,
  96. item.max_unit,
  97. item.min_unit,
  98. item.min_number
  99. ):'&nbsp;'
  100. }}
  101. </td>
  102. </tr>
  103. </table>
  104. </td>
  105. <!-- 出库数量 -->
  106. <td style="padding: 0">
  107. <table style="width: 100%; border-collapse: collapse">
  108. <tr
  109. style="width: 100%; border-bottom: 1px"
  110. v-for="(it, i) in item.drug_stock_info"
  111. :key="i"
  112. >
  113. <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'}]"
  114. >
  115. <!-- {{getOutFlushNightSeven(item.drug_warehouse_out,item.max_unit,item.min_unit,item.min_number,it.storehouse_id,item.drug_cancel_stock_info)}} -->
  116. {{
  117. getActOut(
  118. it.storehouse_id,
  119. item.drug_stock_count,
  120. item.max_unit,
  121. item.min_unit,
  122. item.min_number
  123. )?getActOut(
  124. it.storehouse_id,
  125. item.drug_stock_count,
  126. item.max_unit,
  127. item.min_unit,
  128. item.min_number
  129. ):'&nbsp;'
  130. }}
  131. </td>
  132. </tr>
  133. </table>
  134. </td>
  135. <!-- 退库数量 -->
  136. <td style="padding: 0">
  137. <table style="width: 100%; border-collapse: collapse">
  138. <tr
  139. style="width: 100%; border-bottom: 1px"
  140. v-for="(it, i) in item.drug_stock_info"
  141. :key="i"
  142. >
  143. <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'}]"
  144. >
  145. <!-- {{getOutFlushTen(item.drug_cancel_stock_info,item.max_unit,item.min_unit,item.min_number,it.storehouse_id)}}&nbsp; -->
  146. {{
  147. getDrugCancel(
  148. it.storehouse_id,
  149. item.drug_stock_count,
  150. item.max_unit,
  151. item.min_unit,
  152. item.min_number
  153. )?getDrugCancel(
  154. it.storehouse_id,
  155. item.drug_stock_count,
  156. item.max_unit,
  157. item.min_unit,
  158. item.min_number
  159. ):'&nbsp;'
  160. }}
  161. </td>
  162. </tr>
  163. </table>
  164. </td>
  165. <!-- 实际出库 -->
  166. <td style="padding: 0">
  167. <table style="width: 100%; border-collapse: collapse">
  168. <tr
  169. style="width: 100%; border-bottom: 1px"
  170. v-for="(it, i) in item.drug_stock_info"
  171. :key="i"
  172. >
  173. <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'}]"
  174. >
  175. <!-- {{getOutFlushNightSix(item.drug_warehouse_out,item.max_unit,item.min_unit,item.min_number,it.storehouse_id)}}&nbsp;</span> -->
  176. {{
  177. getDrugOut(
  178. it.storehouse_id,
  179. item.drug_stock_count,
  180. item.max_unit,
  181. item.min_unit,
  182. item.min_number
  183. )?getDrugOut(
  184. it.storehouse_id,
  185. item.drug_stock_count,
  186. item.max_unit,
  187. item.min_unit,
  188. item.min_number
  189. ):'&nbsp;'
  190. }}
  191. </td>
  192. </tr>
  193. </table>
  194. </td>
  195. <!--剩余库存 -->
  196. <td style="padding: 0">
  197. <table style="width: 100%; border-collapse: collapse">
  198. <tr
  199. style="width: 100%; border-bottom: 1px"
  200. v-for="(it, i) in item.drug_stock_info"
  201. :key="i"
  202. >
  203. <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'}]"
  204. >
  205. <!-- {{getOverFlushInfoEight(item.drug_warehouse_info,item.max_unit,item.min_unit,item.min_number,it.storehouse_id)}}&nbsp; -->
  206. {{
  207. getFlushCount(
  208. it.storehouse_id,
  209. item.drug_stock_count,
  210. item.max_unit,
  211. item.min_unit,
  212. item.min_number
  213. )?getFlushCount(
  214. it.storehouse_id,
  215. item.drug_stock_count,
  216. item.max_unit,
  217. item.min_unit,
  218. item.min_number
  219. ):'&nbsp;'
  220. }}
  221. </td>
  222. </tr>
  223. </table>
  224. </td>
  225. <!-- 总库存量 -->
  226. <td style="padding: 0">
  227. <table style="width: 100%; border-collapse: collapse">
  228. <td
  229. style="
  230. border: 0;
  231. text-align: center;
  232. border-bottom: 1px;
  233. width: 100%;
  234. "
  235. >
  236. <!-- {{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}} -->
  237. {{
  238. getSumCount(
  239. item.drug_stock_count,
  240. item.max_unit,
  241. item.min_unit,
  242. item.min_number
  243. )
  244. }}
  245. </td>
  246. </table>
  247. </td>
  248. </tr>
  249. </tbody>
  250. </table>
  251. </div>
  252. </div>
  253. </div>
  254. </div>
  255. </div>
  256. </template>
  257. <script>
  258. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  259. import {
  260. getStorehouseList,
  261. getDrugNewQuery,
  262. getDrugWarehouseOutInfoById,
  263. } from "@/api/drug/drug";
  264. import print from "print-js";
  265. const moment = require("moment");
  266. export default {
  267. components: {
  268. BreadCrumb,
  269. },
  270. data() {
  271. return {
  272. crumbs: [
  273. { path: false, name: "库存管理" },
  274. { path: false, name: "库存查询" },
  275. { path: false, name: "库存查询打印" },
  276. ],
  277. start_time: "",
  278. end_time: "",
  279. drug_name: "",
  280. drug_spec: "",
  281. keyword: "",
  282. tableData: [],
  283. time_now: moment(new Date()).add("year", 0).format("YYYY-MM-DD"),
  284. type_name: "",
  285. limit: "",
  286. page: "",
  287. tableList: [],
  288. manufacturerList: [],
  289. countList: [],
  290. outCountList: [],
  291. autoCountList: [],
  292. cancelCountList: [],
  293. org_id: 0,
  294. patient_id: 0,
  295. storehouse_id: [],
  296. loding: false,
  297. good_type: 0,
  298. drugTypeList: [],
  299. houseList: [],
  300. };
  301. },
  302. methods: {
  303. printAction: function () {
  304. const style =
  305. "@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; } }";
  306. printJS({
  307. printable: "print_content",
  308. type: "html",
  309. documentTitle: " ",
  310. style: style,
  311. scanStyles: false,
  312. });
  313. },
  314. getStorehouseList() {
  315. getStorehouseList().then((response) => {
  316. if (response.data.state == 1) {
  317. var houseList = response.data.data.list;
  318. var obj = { id: 0, storehouse_name: "全部" };
  319. this.houseList.push(obj);
  320. for (let i = 0; i < houseList.length; i++) {
  321. this.houseList.push(houseList[i]);
  322. }
  323. this.manufacturerList = response.data.data.manufacturerList;
  324. this.goodTypeList = response.data.data.goodTypeList;
  325. this.patientList = response.data.data.patientList;
  326. }
  327. });
  328. },
  329. getlist() {
  330. this.loading = true;
  331. var params = {
  332. storehouse_id: this.storehouse_id,
  333. good_type: this.good_type,
  334. keyword: this.keyword,
  335. page: this.page,
  336. limit: this.limit,
  337. start_time: this.start_time,
  338. end_time: this.end_time,
  339. };
  340. getDrugNewQuery(params).then((response) => {
  341. if (response.data.state == 1) {
  342. this.loading = false;
  343. var list = response.data.data.list;
  344. var countList = response.data.data.countList;
  345. // if(list!=null){
  346. // for (let i = 0; i < list.length; i++) {
  347. // for (let j = 0; j < list[i].drug_warehouse_info.length; j++) {
  348. // if (list[i].max_unit == list[i].drug_warehouse_info[j].max_unit) {
  349. // list[i].drug_warehouse_info[j].stock_max_number =list[i].min_number *list[i].drug_warehouse_info[j].stock_max_number
  350. // list[i].drug_warehouse_info[j].warehousing_count =list[i].min_number *list[i].drug_warehouse_info[j].warehousing_count
  351. // }
  352. // }
  353. // for (let y = 0; y < list[i].drug_warehouse_out.length; y++) {
  354. // if (list[i].drug_warehouse_out[y].count_unit == list[i].max_unit) {
  355. // list[i].drug_warehouse_out[y].count =list[i].drug_warehouse_out[y].count * list[i].min_number
  356. // }
  357. // }
  358. // for (let z = 0; z < list[i].drug_cancel_stock_info.length; z++) {
  359. // if (list[i].drug_cancel_stock_info[z].max_unit == list[i].max_unit) {
  360. // list[i].drug_cancel_stock_info[z].count =list[i].drug_cancel_stock_info[z].count * list[i].min_number
  361. // }
  362. // }
  363. // }
  364. // }
  365. // var arr = [];
  366. // for (let i = 0; i < list.length; i++) {
  367. // if (list[i].drug_warehouse_info.length > 0) {
  368. // arr.push(list[i]);
  369. // }
  370. // }
  371. this.tableList = countList;
  372. this.total = response.data.data.total;
  373. this.drugTypeList = response.data.data.drugTypeList;
  374. }
  375. });
  376. },
  377. getManufacturName(id) {
  378. var manufacturer_name = "";
  379. for (let i = 0; i < this.manufacturerList.length; i++) {
  380. if (id == this.manufacturerList[i].id) {
  381. manufacturer_name = this.manufacturerList[i].manufacturer_name;
  382. }
  383. }
  384. return manufacturer_name;
  385. },
  386. seach() {
  387. this.getlist();
  388. },
  389. getGoodTypeName(id) {
  390. var type_name = "";
  391. for (let i = 0; i < this.goodTypeList.length; i++) {
  392. if (id == this.goodTypeList[i].id) {
  393. type_name = this.goodTypeList[i].type_name;
  394. }
  395. }
  396. return type_name;
  397. },
  398. getHouseName(id) {
  399. var storehouse_name = "";
  400. for (let i = 0; i < this.houseList.length; i++) {
  401. if (id == this.houseList[i].id) {
  402. storehouse_name = this.houseList[i].storehouse_name;
  403. }
  404. }
  405. return storehouse_name;
  406. },
  407. getWareInfoCount(val, storehouse_id) {
  408. var count = 0;
  409. if (val.length > 0) {
  410. for (let i = 0; i < val.length; i++) {
  411. if (val[i].storehouse_id == storehouse_id) {
  412. count += val[i].warehousing_count;
  413. }
  414. }
  415. }
  416. if (count > 0) {
  417. return count;
  418. } else {
  419. return "";
  420. }
  421. },
  422. getOverFlushInfo(arr, max_unit, min_unit, min_number) {
  423. var max_str = "";
  424. var min_str = "";
  425. var total = 0;
  426. var newarr = arr;
  427. if (newarr.length > 0) {
  428. for (let i = 0; i < newarr.length; i++) {
  429. total += newarr[i].stock_max_number + newarr[i].stock_min_number;
  430. }
  431. }
  432. if (total < min_number) {
  433. min_str = total + min_unit;
  434. }
  435. if (total == 0) {
  436. min_str = "";
  437. max_str = "";
  438. }
  439. if (total >= min_number) {
  440. if (parseInt(total / min_number) != 0) {
  441. max_str = parseInt(total / min_number) + max_unit;
  442. }
  443. if (total % min_number != 0) {
  444. min_str = (total % min_number) + min_unit;
  445. }
  446. }
  447. return max_str + min_str;
  448. },
  449. getTime(val) {
  450. if (val < 0) {
  451. return "";
  452. }
  453. if (val == "") {
  454. return "";
  455. } else {
  456. return uParseTime(val, "{y}-{m}-{d}");
  457. }
  458. },
  459. getName(id) {
  460. var name = "";
  461. for (let i = 0; i < this.patientList.length; i++) {
  462. if (id == this.patientList[i].id) {
  463. name = this.patientList[i].name;
  464. }
  465. }
  466. return name;
  467. },
  468. getDrugTypeName(id) {
  469. var type_name = "";
  470. for (let i = 0; i < this.drugTypeList.length; i++) {
  471. if (id == this.drugTypeList[i].value) {
  472. type_name = this.drugTypeList[i].name;
  473. }
  474. }
  475. return type_name;
  476. },
  477. getWarehoseInfoSeven(arr, max_unit, min_unit, min_number, storehouse_id) {
  478. var total = 0;
  479. var max_str = "";
  480. var min_str = "";
  481. if (arr.length > 0) {
  482. for (let i = 0; i < arr.length; i++) {
  483. if (arr[i].storehouse_id == storehouse_id) {
  484. total += parseInt(arr[i].warehousing_count);
  485. }
  486. }
  487. }
  488. if (total < min_number) {
  489. min_str = total + min_unit;
  490. }
  491. if (total == 0) {
  492. min_str = "";
  493. max_str = "";
  494. }
  495. if (total >= min_number) {
  496. if (parseInt(total / min_number) != 0) {
  497. max_str = parseInt(total / min_number) + max_unit;
  498. }
  499. if (total % min_number != 0) {
  500. min_str = (total % min_number) + min_unit;
  501. }
  502. }
  503. return max_str + min_str;
  504. },
  505. getOutFlushNightSix(info, max_unit, min_unit, min_number, storehouse_id) {
  506. var str = "";
  507. var str_min = "";
  508. //总库存
  509. var total = 0;
  510. for (let i = 0; i < info.length; i++) {
  511. if (info[i].storehouse_id == storehouse_id) {
  512. total += info[i].count;
  513. }
  514. }
  515. if (parseInt(total / min_number) != 0) {
  516. str = parseInt(total / min_number) + max_unit;
  517. }
  518. if (total % min_number != 0) {
  519. str_min = (total % min_number) + min_unit;
  520. }
  521. return str + str_min;
  522. },
  523. getOutFlushNightSeven(
  524. info,
  525. max_unit,
  526. min_unit,
  527. min_number,
  528. storehouse_id,
  529. val
  530. ) {
  531. var str = "";
  532. var str_min = "";
  533. //总库存
  534. var total = 0;
  535. var totalOne = 0;
  536. var totalTwo = 0;
  537. if (info != null && info.length > 0) {
  538. for (let i = 0; i < info.length; i++) {
  539. if (info[i].storehouse_id == storehouse_id) {
  540. totalOne += info[i].count;
  541. }
  542. }
  543. }
  544. if (val != null && val.length > 0) {
  545. for (let i = 0; i < val.length; i++) {
  546. if (val[i].storehouse_id == storehouse_id) {
  547. totalTwo += val[i].count;
  548. }
  549. }
  550. }
  551. total = totalOne + totalTwo;
  552. if (parseInt(total / min_number) != 0) {
  553. str = parseInt(total / min_number) + max_unit;
  554. }
  555. if (total % min_number != 0) {
  556. str_min = (total % min_number) + min_unit;
  557. }
  558. return str + str_min;
  559. },
  560. getOutFlushNight(
  561. info,
  562. max_unit,
  563. min_unit,
  564. min_number,
  565. cancel_info,
  566. storehouse_id
  567. ) {
  568. var str = "";
  569. var str_min = "";
  570. //总库存
  571. var total = 0;
  572. var out_count = 0;
  573. var over_count = 0;
  574. var cancel_count = 0;
  575. for (let i = 0; i < info.length; i++) {
  576. if (info[i].storehouse_id == storehouse_id) {
  577. total += info[i].warehousing_count;
  578. }
  579. }
  580. for (let j = 0; j < info.length; j++) {
  581. if (info[j].storehouse_id == storehouse_id) {
  582. out_count += info[j].stock_max_number + info[j].stock_min_number;
  583. }
  584. }
  585. over_count = total - out_count;
  586. if (parseInt(over_count / min_number) != 0) {
  587. str = parseInt(over_count / min_number) + max_unit;
  588. }
  589. if (over_count % min_number != 0) {
  590. str_min = (over_count % min_number) + min_unit;
  591. }
  592. return str + str_min;
  593. },
  594. getOverFlushInfoEight(arr, max_unit, min_unit, min_number, storehouse_id) {
  595. var max_str = "";
  596. var min_str = "";
  597. var total = 0;
  598. var newarr = arr;
  599. if (newarr.length > 0) {
  600. for (let i = 0; i < newarr.length; i++) {
  601. if (newarr[i].storehouse_id == storehouse_id) {
  602. total += newarr[i].stock_max_number + newarr[i].stock_min_number;
  603. }
  604. }
  605. }
  606. if (total < min_number) {
  607. min_str = total + min_unit;
  608. }
  609. if (total == 0) {
  610. min_str = "";
  611. max_str = "";
  612. }
  613. if (total >= min_number) {
  614. if (parseInt(total / min_number) != 0) {
  615. max_str = parseInt(total / min_number) + max_unit;
  616. }
  617. if (total % min_number != 0) {
  618. min_str = (total % min_number) + min_unit;
  619. }
  620. }
  621. return max_str + min_str;
  622. },
  623. getWarehoseInfo(arr) {
  624. var total = 0;
  625. if (arr.length > 0) {
  626. for (let i = 0; i < arr.length; i++) {
  627. total += parseInt(arr[i].warehousing_count);
  628. }
  629. }
  630. if (total == 0) {
  631. total = "";
  632. }
  633. return total;
  634. },
  635. getOutFlushTen(info, max_unit, min_unit, min_number, storehouse_id) {
  636. var str = "";
  637. var str_min = "";
  638. //总库存
  639. var total = 0;
  640. for (let i = 0; i < info.length; i++) {
  641. if (info[i].storehouse_id == storehouse_id) {
  642. total += info[i].count;
  643. }
  644. }
  645. if (parseInt(total / min_number) != 0) {
  646. str = parseInt(total / min_number) + max_unit;
  647. }
  648. if (total % min_number != 0) {
  649. str_min = (total % min_number) + min_unit;
  650. }
  651. return str + str_min;
  652. },
  653. getDrugOut(
  654. info,
  655. max_unit,
  656. min_unit,
  657. min_number,
  658. storehouse_id,
  659. cancel_stock_info
  660. ) {
  661. var str = "";
  662. var str_min = "";
  663. var cancel_count = 0;
  664. var cha_count = 0;
  665. //总库存
  666. var total = 0;
  667. for (let i = 0; i < info.length; i++) {
  668. if (info[i].storehouse_id == storehouse_id) {
  669. total += info[i].count;
  670. }
  671. }
  672. for (let i = 0; i < cancel_stock_info.length; i++) {
  673. if (cancel_stock_info[i].storehouse_id == storehouse_id) {
  674. cancel_count += cancel_stock_info[i].count;
  675. }
  676. }
  677. cha_count = total - cancel_count;
  678. if (parseInt(cha_count / min_number) != 0) {
  679. str = parseInt(cha_count / min_number) + max_unit;
  680. }
  681. if (cha_count % min_number != 0) {
  682. str_min = (cha_count % min_number) + min_unit;
  683. }
  684. return str + str_min;
  685. },
  686. handleDetail(val) {
  687. var manufacturer_name = "";
  688. for (let i = 0; i < this.manufacturerList.length; i++) {
  689. if (val.manufacturer == this.manufacturerList[i].id) {
  690. manufacturer_name = this.manufacturerList[i].manufacturer_name;
  691. }
  692. }
  693. var unit =
  694. val.dose +
  695. val.dose_unit +
  696. "*" +
  697. val.min_number +
  698. val.min_unit +
  699. "/" +
  700. val.max_unit;
  701. var over_plus = this.getOverFlushInfo(
  702. val.drug_warehouse_info,
  703. val.max_unit,
  704. val.min_unit,
  705. val.min_number
  706. );
  707. this.$router.push({
  708. path:
  709. "/drugstock/in/drugstockflow?drug_id=" +
  710. val.id +
  711. "&manufacturer=" +
  712. manufacturer_name +
  713. "&unit=" +
  714. unit +
  715. "&min_number=" +
  716. val.min_number +
  717. "&max_unit=" +
  718. val.max_unit +
  719. "&min_unit=" +
  720. val.min_unit +
  721. "&over_plus=" +
  722. over_plus,
  723. });
  724. window.sessionStorage.setItem("start_time", this.start_time);
  725. window.sessionStorage.setItem("end_time", this.end_time);
  726. },
  727. handleBatch(val) {
  728. var manufacturer_name = "";
  729. for (let i = 0; i < this.manufacturerList.length; i++) {
  730. if (val.manufacturer == this.manufacturerList[i].id) {
  731. manufacturer_name = this.manufacturerList[i].manufacturer_name;
  732. }
  733. }
  734. var unit =
  735. val.dose +
  736. val.dose_unit +
  737. "*" +
  738. val.min_number +
  739. val.min_unit +
  740. "/" +
  741. val.max_unit;
  742. var over_plus = this.getOverFlushInfo(
  743. val.drug_warehouse_info,
  744. val.max_unit,
  745. val.min_unit,
  746. val.min_number
  747. );
  748. window.sessionStorage.setItem("start_time", this.start_time);
  749. window.sessionStorage.setItem("end_time", this.end_time);
  750. this.$router.push({
  751. path:
  752. "/drugstock/in/drugbatchnumber?drug_id=" +
  753. val.id +
  754. "&manufacturer=" +
  755. manufacturer_name +
  756. "&unit=" +
  757. unit +
  758. "&min_number=" +
  759. val.min_number +
  760. "&max_unit=" +
  761. val.max_unit +
  762. "&min_unit=" +
  763. val.min_unit +
  764. "&over_plus=" +
  765. over_plus,
  766. });
  767. },
  768. // 合并单元格样式
  769. cellStyle({ row, column, rowIndex, columnIndex }) {
  770. let arr = [5, 6, 7, 8, 9, 10, 11];
  771. if (arr.indexOf(columnIndex) > -1) {
  772. return "spanClass";
  773. }
  774. },
  775. getCount(
  776. patient_id,
  777. warehouse_out_id,
  778. sys_record_time,
  779. max_unit,
  780. min_unit,
  781. drug_id,
  782. count,
  783. min_number,
  784. warehouse_info_id
  785. ) {
  786. var stock_max_number = "";
  787. var stock_min_number = "";
  788. var total = 0;
  789. var min_str = "";
  790. var max_str = "";
  791. if (this.flushList != null && this.flushList.length > 0) {
  792. for (let i = 0; i < this.flushList.length; i++) {
  793. if (
  794. patient_id == this.flushList[i].patient_id &&
  795. drug_id == this.flushList[i].drug_id &&
  796. patient_id == this.flushList[i].patient_id &&
  797. warehouse_out_id == this.flushList[i].warehouse_out_id &&
  798. sys_record_time == this.flushList[i].system_time &&
  799. this.flushList[i].count == count &&
  800. this.flushList[i].batch_number_id == warehouse_info_id
  801. ) {
  802. stock_max_number = this.flushList[i].drug_max_number * min_number;
  803. stock_min_number = this.flushList[i].drug_min_number;
  804. }
  805. }
  806. console.log("oo233322332332", stock_max_number, stock_min_number);
  807. total = stock_max_number + stock_min_number;
  808. if (total < min_number) {
  809. min_str = total + min_unit;
  810. }
  811. if (total == 0) {
  812. min_str = "";
  813. max_str = "";
  814. }
  815. if (total >= min_number) {
  816. if (parseInt(total / min_number) != 0) {
  817. max_str = parseInt(total / min_number) + max_unit;
  818. }
  819. if (total % min_number != 0) {
  820. min_str = (total % min_number) + min_unit;
  821. }
  822. }
  823. return max_str + min_str;
  824. }
  825. },
  826. hide: function () {
  827. this.visibility = false;
  828. },
  829. show: function () {
  830. this.getConfig();
  831. this.visibility = true;
  832. },
  833. changeOpen(val) {
  834. var message = "";
  835. if (val == 1) {
  836. message = "启用药品自动扣减功能";
  837. } else {
  838. message = "关闭药品自动扣减功能";
  839. }
  840. this.$confirm(message, "提示", {
  841. confirmButtonText: "确定",
  842. cancelButtonText: "取消",
  843. type: "info",
  844. })
  845. .then(() => {
  846. createDrugStockAutomaticReduceConfig(val).then((response) => {
  847. if (response.data.state == 0) {
  848. this.$message.error(response.data.msg);
  849. return false;
  850. } else {
  851. if (response.data.data.is_open == 1) {
  852. this.is_open = true;
  853. this.$message({
  854. type: "success",
  855. message: "已启用",
  856. });
  857. } else {
  858. this.is_open = false;
  859. this.$message({
  860. type: "success",
  861. message: "已关闭",
  862. });
  863. }
  864. }
  865. });
  866. })
  867. .catch(() => {});
  868. },
  869. getConfig() {
  870. getDrugStockAutomaticReduceConfig().then((response) => {
  871. if (response.data.state == 0) {
  872. this.$message.error(response.data.msg);
  873. return false;
  874. } else {
  875. var config = response.data.data.config;
  876. if (config.is_open == 1) {
  877. this.is_open = true;
  878. } else {
  879. this.is_open = false;
  880. }
  881. }
  882. });
  883. },
  884. printOrder() {
  885. this.$router.push(
  886. "/drugs/query/print?start_time=" +
  887. this.start_time +
  888. "&end_time=" +
  889. this.end_time +
  890. "&keyword=" +
  891. this.keyword +
  892. "&storehouse_id=" +
  893. this.storehouse_id +
  894. "&page=" +
  895. this.page +
  896. "&limit=" +
  897. this.limit +
  898. "&good_type=" +
  899. this.good_type
  900. );
  901. },
  902. exportStock() {
  903. for (let i = 0; i < this.tableList.length; i++) {
  904. this.tableList[i].index = i + 1;
  905. this.tableList[i].drug_type_name = this.getDrugType(
  906. this.tableList[i].drug_type
  907. );
  908. this.tableList[i].unit =
  909. this.tableList[i].dose +
  910. this.tableList[i].dose_unit +
  911. "*" +
  912. this.tableList[i].min_number +
  913. this.tableList[i].min_unit +
  914. "/" +
  915. this.tableList[i].max_unit;
  916. this.tableList[i].manufacturer_name = this.getManufacturerList(
  917. this.tableList[i].manufacturer
  918. );
  919. this.tableList[i].inCount = this.getWarehoseInfoOne(
  920. this.tableList[i].drug_warehouse_info,
  921. this.tableList[i].max_unit,
  922. this.tableList[i].min_unit,
  923. this.tableList[i].min_number
  924. );
  925. if (this.end_time == 0) {
  926. this.tableList[i].outCount = this.getWarehouseOutInfo(
  927. this.tableList[i].drug_warehouse_out,
  928. this.tableList[i].max_unit,
  929. this.tableList[i].min_unit,
  930. this.tableList[i].min_number
  931. );
  932. this.tableList[i].overplusCount = this.getOverFlushInfo(
  933. this.tableList[i].drug_warehouse_info,
  934. this.tableList[i].max_unit,
  935. this.tableList[i].min_unit,
  936. this.tableList[i].min_number
  937. );
  938. }
  939. if (this.end_time != 0) {
  940. this.tableList[i].outCount =
  941. this.getOutCount(this.tableList[i].id) +
  942. this.getAutoCount(this.tableList[i].id);
  943. this.tableList[i].overplusCount =
  944. this.getWarehoseInfo(this.tableList[i].drug_warehouse_info) -
  945. this.getOutCount(this.tableList[i].id) -
  946. this.getAutoCount(this.tableList[i].id);
  947. }
  948. }
  949. import("@/vendor/Export2Excel").then((excel) => {
  950. const tHeader = [
  951. "序号",
  952. "药品类型",
  953. "药品名称",
  954. "规格型号&单位",
  955. "国家编码",
  956. "进货单价",
  957. "厂家",
  958. "入库数量",
  959. "出库数量",
  960. "剩余库存量",
  961. ];
  962. const filterVal = [
  963. "index",
  964. "drug_type_name",
  965. "drug_name",
  966. "unit",
  967. "medical_insurance_number",
  968. "last_price",
  969. "manufacturer_name",
  970. "inCount",
  971. "outCount",
  972. "overplusCount",
  973. ];
  974. const data = this.formatJson(filterVal, this.tableList);
  975. excel.export_json_to_excel({
  976. header: tHeader,
  977. data,
  978. filename: "药品查询",
  979. });
  980. this.downloadLoading = false;
  981. });
  982. },
  983. formatJson(filterVal, jsonData) {
  984. return jsonData.map((v) => filterVal.map((j) => v[j]));
  985. },
  986. getDrugType(id) {
  987. var name = "";
  988. for (let i = 0; i < this.drugTypeList.length; i++) {
  989. if (this.drugTypeList[i].id == id) {
  990. name = this.drugTypeList[i].name;
  991. }
  992. }
  993. return name;
  994. },
  995. getManufacturerList(id) {
  996. var name = "";
  997. for (let i = 0; i < this.manufacturerList.length; i++) {
  998. if (id == this.manufacturerList[i].id) {
  999. name = this.manufacturerList[i].manufacturer_name;
  1000. }
  1001. }
  1002. return name;
  1003. },
  1004. getWarehoseInfoOne(arr, max_unit, min_unit, min_number) {
  1005. var total = 0;
  1006. var max_str = "";
  1007. var min_str = "";
  1008. if (arr.length > 0) {
  1009. for (let i = 0; i < arr.length; i++) {
  1010. total += parseInt(arr[i].warehousing_count);
  1011. }
  1012. }
  1013. if (total < min_number) {
  1014. min_str = total + min_unit;
  1015. }
  1016. if (total == 0) {
  1017. min_str = "";
  1018. max_str = "";
  1019. }
  1020. if (total >= min_number) {
  1021. if (parseInt(total / min_number) != 0) {
  1022. max_str = parseInt(total / min_number) + max_unit;
  1023. }
  1024. if (total % min_number != 0) {
  1025. min_str = (total % min_number) + min_unit;
  1026. }
  1027. }
  1028. return max_str + min_str;
  1029. },
  1030. getWarehouseOutInfo(arr, max_unit, min_unit, min_number) {
  1031. var min_str = "";
  1032. var max_str = "";
  1033. var total = 0;
  1034. if (arr.length > 0) {
  1035. for (let i = 0; i < arr.length; i++) {
  1036. total += parseInt(arr[i].count);
  1037. }
  1038. }
  1039. if (total < min_number) {
  1040. min_str = total + min_unit;
  1041. }
  1042. if (total == 0) {
  1043. min_str = "";
  1044. max_str = "";
  1045. }
  1046. if (total >= min_number) {
  1047. if (parseInt(total / min_number) != 0) {
  1048. max_str = parseInt(total / min_number) + max_unit;
  1049. }
  1050. if (total % min_number != 0) {
  1051. min_str = (total % min_number) + min_unit;
  1052. }
  1053. }
  1054. return max_str + min_str;
  1055. },
  1056. //修改后的
  1057. getDrugIn(storehouse_id, val, max_unit, min_unit, min_number) {
  1058. var max_str = "";
  1059. var min_str = "";
  1060. var total = 0;
  1061. if (val != null && val != undefined) {
  1062. for (let i = 0; i < val.length; i++) {
  1063. if (storehouse_id == val[i].storehouse_id) {
  1064. total = val[i].sum_in_count;
  1065. }
  1066. }
  1067. }
  1068. if (total < min_number) {
  1069. min_str = total + min_unit;
  1070. }
  1071. if (total == 0) {
  1072. min_str = "";
  1073. max_str = "";
  1074. }
  1075. if (total >= min_number) {
  1076. if (parseInt(total / min_number) != 0) {
  1077. max_str = parseInt(total / min_number) + max_unit;
  1078. }
  1079. if (total % min_number != 0) {
  1080. min_str = (total % min_number) + min_unit;
  1081. }
  1082. }
  1083. return max_str + min_str;
  1084. },
  1085. getDrugOut(storehouse_id, val, max_unit, min_unit, min_number) {
  1086. var max_str = "";
  1087. var min_str = "";
  1088. var total = 0;
  1089. if (val != null && val != undefined) {
  1090. for (let i = 0; i < val.length; i++) {
  1091. if (storehouse_id == val[i].storehouse_id) {
  1092. total = val[i].sum_out_count;
  1093. }
  1094. }
  1095. }
  1096. if (total < min_number) {
  1097. min_str = total + min_unit;
  1098. }
  1099. if (total == 0) {
  1100. min_str = "";
  1101. max_str = "";
  1102. }
  1103. if (total >= min_number) {
  1104. if (parseInt(total / min_number) != 0) {
  1105. max_str = parseInt(total / min_number) + max_unit;
  1106. }
  1107. if (total % min_number != 0) {
  1108. min_str = (total % min_number) + min_unit;
  1109. }
  1110. }
  1111. return max_str + min_str;
  1112. },
  1113. getDrugCancel(storehouse_id, val, max_unit, min_unit, min_number) {
  1114. var max_str = "";
  1115. var min_str = "";
  1116. var total = 0;
  1117. if (val != null && val != undefined) {
  1118. for (let i = 0; i < val.length; i++) {
  1119. if (storehouse_id == val[i].storehouse_id) {
  1120. total = val[i].sum_cancel_count;
  1121. }
  1122. }
  1123. }
  1124. if (total < min_number) {
  1125. min_str = total + min_unit;
  1126. }
  1127. if (total == 0) {
  1128. min_str = "";
  1129. max_str = "";
  1130. }
  1131. if (total >= min_number) {
  1132. if (parseInt(total / min_number) != 0) {
  1133. max_str = parseInt(total / min_number) + max_unit;
  1134. }
  1135. if (total % min_number != 0) {
  1136. min_str = (total % min_number) + min_unit;
  1137. }
  1138. }
  1139. return max_str + min_str;
  1140. },
  1141. getActOut(storehouse_id, val, max_unit, min_unit, min_number) {
  1142. var max_str = "";
  1143. var min_str = "";
  1144. var total = 0;
  1145. if (val != null && val != undefined) {
  1146. for (let i = 0; i < val.length; i++) {
  1147. if (storehouse_id == val[i].storehouse_id) {
  1148. total = val[i].sum_act_out_count;
  1149. }
  1150. }
  1151. }
  1152. if (total < min_number) {
  1153. min_str = total + min_unit;
  1154. }
  1155. if (total == 0) {
  1156. min_str = "";
  1157. max_str = "";
  1158. }
  1159. if (total >= min_number) {
  1160. if (parseInt(total / min_number) != 0) {
  1161. max_str = parseInt(total / min_number) + max_unit;
  1162. }
  1163. if (total % min_number != 0) {
  1164. min_str = (total % min_number) + min_unit;
  1165. }
  1166. }
  1167. return max_str + min_str;
  1168. },
  1169. getFlushCount(storehouse_id, val, max_unit, min_unit, min_number) {
  1170. var max_str = "";
  1171. var min_str = "";
  1172. var total = 0;
  1173. if (val != null && val != undefined) {
  1174. for (let i = 0; i < val.length; i++) {
  1175. if (storehouse_id == val[i].storehouse_id) {
  1176. total = val[i].flush_count;
  1177. }
  1178. }
  1179. }
  1180. if (total < min_number) {
  1181. min_str = total + min_unit;
  1182. }
  1183. if (total == 0) {
  1184. min_str = "";
  1185. max_str = "";
  1186. }
  1187. if (total >= min_number) {
  1188. if (parseInt(total / min_number) != 0) {
  1189. max_str = parseInt(total / min_number) + max_unit;
  1190. }
  1191. if (total % min_number != 0) {
  1192. min_str = (total % min_number) + min_unit;
  1193. }
  1194. }
  1195. return max_str + min_str;
  1196. },
  1197. getSumCount(val, max_unit, min_unit, min_number) {
  1198. var max_str = "";
  1199. var min_str = "";
  1200. var total = 0;
  1201. if (val != null && val != undefined) {
  1202. for (let i = 0; i < val.length; i++) {
  1203. total += val[i].flush_count;
  1204. }
  1205. }
  1206. if (total < min_number) {
  1207. min_str = total + min_unit;
  1208. }
  1209. if (total == 0) {
  1210. min_str = "";
  1211. max_str = "";
  1212. }
  1213. if (total >= min_number) {
  1214. if (parseInt(total / min_number) != 0) {
  1215. max_str = parseInt(total / min_number) + max_unit;
  1216. }
  1217. if (total % min_number != 0) {
  1218. min_str = (total % min_number) + min_unit;
  1219. }
  1220. }
  1221. return max_str + min_str;
  1222. },
  1223. },
  1224. created() {
  1225. this.org_id = this.$store.getters.xt_user.org_id;
  1226. var starttime = this.$route.query.start_time;
  1227. this.start_time = starttime;
  1228. var endtime = this.$route.query.end_time;
  1229. this.end_time = endtime;
  1230. var storehouse_id = parseInt(this.$route.query.storehouse_id);
  1231. this.storehouse_id = storehouse_id;
  1232. this.good_type = parseInt(this.$route.query.good_type);
  1233. var keyword = this.$route.query.keyword;
  1234. this.keyword = keyword;
  1235. this.page = parseInt(this.$route.query.page);
  1236. this.limit = parseInt(this.$route.query.limit);
  1237. this.getStorehouseList();
  1238. this.getlist();
  1239. },
  1240. };
  1241. </script>
  1242. <style rel="stylesheet/scss" lang="scss" scoped>
  1243. .print_main_content {
  1244. background-color: white;
  1245. max-width: 1500px;
  1246. margin: 0 auto;
  1247. padding: 0 0 20px 0;
  1248. .order_title_panl {
  1249. text-align: center;
  1250. .main_title {
  1251. font-size: 18px;
  1252. line-height: 40px;
  1253. font-weight: 500;
  1254. }
  1255. }
  1256. .table_panel {
  1257. .table {
  1258. width: 100%;
  1259. border: 1px solid;
  1260. border-collapse: collapse;
  1261. padding: 2px;
  1262. thead {
  1263. tr {
  1264. td {
  1265. border: 1px solid;
  1266. text-align: center;
  1267. font-size: 14px;
  1268. padding: 3px 0px;
  1269. }
  1270. }
  1271. }
  1272. tbody {
  1273. tr {
  1274. td {
  1275. border: 1px solid;
  1276. text-align: center;
  1277. font-size: 14px;
  1278. padding: 3px 0px;
  1279. white-space: pre-line;
  1280. .proj {
  1281. padding: 5px 0;
  1282. text-align: left;
  1283. .proj_title {
  1284. font-size: 16px;
  1285. font-weight: 500;
  1286. line-height: 25px;
  1287. }
  1288. .proj_item {
  1289. font-size: 15px;
  1290. line-height: 20px;
  1291. .zone_name {
  1292. font-weight: 500;
  1293. }
  1294. }
  1295. }
  1296. }
  1297. }
  1298. }
  1299. }
  1300. }
  1301. }
  1302. </style>