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

query.vue 40KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <div>
  6. <el-button
  7. size="small"
  8. class="filter-item"
  9. type="primary"
  10. @click="setting"
  11. >设置
  12. </el-button>
  13. <el-button
  14. size="small"
  15. class="filter-item"
  16. type="primary"
  17. icon="el-icon-printer"
  18. @click="printOrder"
  19. >打印
  20. </el-button>
  21. <el-button
  22. size="small"
  23. class="filter-item"
  24. type="primary"
  25. @click="exportStock"
  26. >导出
  27. </el-button>
  28. </div>
  29. </div>
  30. <div class="app-container">
  31. <div class="cell clearfix">
  32. <div>
  33. <span>仓库名称:</span>
  34. <el-select
  35. v-model="storehouse_id"
  36. style="width: 200px; margin-right: 10px"
  37. placeholder="请选择"
  38. filterable
  39. @change="changeStorehouseName"
  40. >
  41. <el-option
  42. v-for="item in storeList"
  43. :key="item.id"
  44. :label="item.storehouse_name"
  45. :value="item.id"
  46. >
  47. </el-option>
  48. </el-select>
  49. <span>药品名称:</span>
  50. <el-select
  51. v-model="drug_id"
  52. style="width: 200px; margin-right: 10px"
  53. placeholder="请选择"
  54. filterable
  55. @change="changeDrugName"
  56. >
  57. <el-option
  58. v-for="item in medicalList"
  59. :key="item.id"
  60. :label="item.drug_name"
  61. :value="item.id"
  62. >
  63. </el-option>
  64. </el-select>
  65. </div>
  66. <!-- <el-select v-model="drug_type" style="width:160px;margin-right:10px;" placeholder="请选择" @change="changeDrug">
  67. <el-option
  68. v-for="(item,index) in drugTypeList"
  69. :key="index"
  70. :label="item.name"
  71. :value="item.id">
  72. </el-option>
  73. </el-select> -->
  74. <!-- <el-date-picker
  75. v-model="start_time"
  76. prefix-icon="el-icon-date"
  77. :editable="false"
  78. style="width: 196px;"
  79. type="date"
  80. placeholder="选择日期时间"
  81. align="right"
  82. format="yyyy-MM-dd"
  83. value-format="yyyy-MM-dd"
  84. @change="startTimeChange"
  85. ></el-date-picker>-
  86. <el-date-picker
  87. v-model="end_time"
  88. prefix-icon="el-icon-date"
  89. :editable="false"
  90. style="width: 196px;margin-right:10px;"
  91. type="date"
  92. placeholder="选择日期时间"
  93. align="right"
  94. format="yyyy-MM-dd"
  95. value-format="yyyy-MM-dd"
  96. @change="endTimeChange"
  97. ></el-date-picker> -->
  98. <!-- <el-input
  99. style="width: 200px;"
  100. class="filter-item"
  101. v-model.trim="keywords"
  102. placeholder="药品名称"
  103. />
  104. <el-button
  105. size="small"
  106. class="filter-item"
  107. type="primary"
  108. icon="el-icon-search"
  109. @click="search"
  110. >搜索
  111. </el-button> -->
  112. </div>
  113. <el-table
  114. :data="tableList"
  115. border
  116. style="width: 100%"
  117. :cell-class-name="cellStyle"
  118. >
  119. <el-table-column
  120. prop="drug_type"
  121. label="药品类型"
  122. width="100"
  123. align="center"
  124. >
  125. <template slot-scope="scope">
  126. {{ getDrugType(scope.row.drug_type) }}
  127. </template>
  128. </el-table-column>
  129. <el-table-column prop="drug_name" label="药品名称" align="center">
  130. <template slot-scope="scope">
  131. {{ scope.row.drug_name }}
  132. </template>
  133. </el-table-column>
  134. <el-table-column prop="drug_name" label="规格&&单位" align="center">
  135. <template slot-scope="scope">
  136. {{
  137. scope.row.dose +
  138. scope.row.dose_unit +
  139. "*" +
  140. scope.row.min_number +
  141. scope.row.min_unit +
  142. "/" +
  143. scope.row.max_unit
  144. }}
  145. </template>
  146. </el-table-column>
  147. <el-table-column prop="drug_name" label="国家编码" align="center">
  148. <template slot-scope="scope">
  149. {{ scope.row.medical_insurance_number }}
  150. </template>
  151. </el-table-column>
  152. <el-table-column prop="drug_name" label="进货单价" align="center">
  153. <template slot-scope="scope">
  154. {{ scope.row.last_price }}
  155. </template>
  156. </el-table-column>
  157. <el-table-column prop="drug_name" label="厂家" align="center">
  158. <template slot-scope="scope">
  159. {{ getManufacturerList(scope.row.manufacturer) }}
  160. </template>
  161. </el-table-column>
  162. <el-table-column prop="drug_name" label="仓库名称" align="center">
  163. <template slot-scope="scope">
  164. <tr
  165. style="background: none"
  166. v-for="(item, index) in scope.row.drug_warehouse"
  167. :key="index"
  168. >
  169. <td
  170. style="
  171. border-right: none;
  172. border-inline-end: none;
  173. text-align: center;
  174. "
  175. >
  176. {{ getHouseName(item.storehouse_id) }}
  177. </td>
  178. </tr>
  179. </template>
  180. </el-table-column>
  181. <el-table-column prop="drug_name" label="入库数量" align="center">
  182. <template slot-scope="scope">
  183. <tr
  184. style="background: none"
  185. v-for="(item, index) in scope.row.drug_warehouse"
  186. :key="index"
  187. >
  188. <td
  189. style="
  190. border-right: none;
  191. border-inline-end: none;
  192. text-align: center;
  193. "
  194. >
  195. {{
  196. getWarehoseInfoSeven(
  197. scope.row.drug_warehouse_info,
  198. scope.row.max_unit,
  199. scope.row.min_unit,
  200. scope.row.min_number,
  201. item.storehouse_id
  202. )
  203. }}&nbsp;
  204. </td>
  205. </tr>
  206. </template>
  207. </el-table-column>
  208. <el-table-column prop="drug_name" label="出库数量" align="center">
  209. <template slot-scope="scope">
  210. <tr
  211. style="background: none"
  212. v-for="(item, index) in scope.row.drug_warehouse"
  213. :key="index"
  214. >
  215. <td
  216. style="
  217. border-right: none;
  218. border-inline-end: none;
  219. text-align: center;
  220. "
  221. >
  222. {{
  223. getOutFlushNight(
  224. scope.row.drug_warehouse_info,
  225. scope.row.max_unit,
  226. scope.row.min_unit,
  227. scope.row.min_number,
  228. scope.row.drug_cancel_stock_info,
  229. item.storehouse_id
  230. )
  231. }}&nbsp;
  232. </td>
  233. </tr>
  234. </template>
  235. </el-table-column>
  236. <el-table-column prop="drug_name" label="剩余库存量" align="center">
  237. <template slot-scope="scope">
  238. <tr
  239. style="background: none"
  240. v-for="(item, index) in scope.row.drug_warehouse"
  241. :key="index"
  242. >
  243. <td
  244. style="
  245. border-right: none;
  246. border-inline-end: none;
  247. text-align: center;
  248. "
  249. >
  250. {{
  251. getOverFlushInfoEight(
  252. scope.row.drug_warehouse_info,
  253. scope.row.max_unit,
  254. scope.row.min_unit,
  255. scope.row.min_number,
  256. item.storehouse_id,
  257. scope.row.storehouse_id
  258. )
  259. }}&nbsp;
  260. </td>
  261. </tr>
  262. </template>
  263. </el-table-column>
  264. <el-table-column
  265. prop="drug_name"
  266. label="总库存量"
  267. align="center"
  268. v-if="showThree"
  269. >
  270. <template slot-scope="scope">
  271. <div v-if="getWarehoseInfo(scope.row.drug_warehouse_info) > 0">
  272. {{
  273. getOverFlushInfo(
  274. scope.row.drug_warehouse_info,
  275. scope.row.max_unit,
  276. scope.row.min_unit,
  277. scope.row.min_number
  278. )
  279. ? getOverFlushInfo(
  280. scope.row.drug_warehouse_info,
  281. scope.row.max_unit,
  282. scope.row.min_unit,
  283. scope.row.min_number
  284. )
  285. : 0
  286. }}
  287. </div>
  288. </template>
  289. </el-table-column>
  290. <el-table-column
  291. prop="drug_name"
  292. label="操作"
  293. align="center"
  294. width="200px"
  295. >
  296. <template slot-scope="scope">
  297. <el-button
  298. size="small"
  299. type="primary"
  300. @click="handleDetail(scope.row)"
  301. >库存流水
  302. </el-button>
  303. <el-button
  304. size="small"
  305. type="primary"
  306. @click="handleBatch(scope.row)"
  307. >批次
  308. </el-button>
  309. </template>
  310. </el-table-column>
  311. </el-table>
  312. <el-pagination
  313. @size-change="handleSizeChange"
  314. @current-change="handleCurrentChange"
  315. :page-sizes="[10, 50, 100, 200, 500, 1000]"
  316. :page-size="10"
  317. background
  318. align="right"
  319. style="margin-top: 20px"
  320. layout="total, sizes, prev, pager, next, jumper"
  321. :total="total"
  322. >
  323. </el-pagination>
  324. </div>
  325. <setting-dialog ref="dialog"></setting-dialog>
  326. </div>
  327. </template>
  328. <script>
  329. import { uParseTime } from "@/utils/tools";
  330. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  331. import { getDrugStockList, getDrugCountList } from "@/api/drug/drug_stock";
  332. import SettingDialog from "./settingDialog/index";
  333. import { getDictionaryDataConfig } from "@/utils/data";
  334. import { min } from "moment";
  335. export default {
  336. name: "stockIn",
  337. created() {
  338. if (this.$route.path == "/Pharmacy/MedicianManagement") {
  339. this.crumbs = [
  340. { path: false, name: "药品管理" },
  341. { path: "/stock/drugs/stock/query", name: "药品库存查询" },
  342. ];
  343. }
  344. var start_time = window.sessionStorage.getItem("start_time");
  345. var end_time = window.sessionStorage.getItem("end_time");
  346. if (start_time != null) {
  347. this.start_time = start_time;
  348. }
  349. if (end_time != null) {
  350. this.end_time = end_time;
  351. }
  352. window.sessionStorage.removeItem("start_time");
  353. window.sessionStorage.removeItem("end_time");
  354. this.getlist();
  355. var drugCategory = getDictionaryDataConfig("system", "drug_category");
  356. this.drugCategory.push(...drugCategory);
  357. var drugTypeList = getDictionaryDataConfig("system", "drug_type");
  358. this.drugTypeList.push(...drugTypeList);
  359. this.org_id = this.$store.getters.xt_user.org.id;
  360. },
  361. components: {
  362. SettingDialog,
  363. BreadCrumb,
  364. },
  365. data() {
  366. return {
  367. crumbs: [
  368. { path: false, name: "库存管理" },
  369. { path: "/stock/drugs/stock/query", name: "药品库存查询" },
  370. ],
  371. keywords: "",
  372. multipleSelection: [],
  373. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  374. start_time: "",
  375. end_time: "",
  376. page: 1,
  377. limit: 10,
  378. total: 0,
  379. goodType: [],
  380. goodInfo: [],
  381. tempArr: [],
  382. sameRowArr: [],
  383. WarehouseInfo: {
  384. loading: false,
  385. warehouseInfoDate: [],
  386. },
  387. tableData: [],
  388. drug_category: 0,
  389. drugCategory: [{ id: 0, name: "全部" }],
  390. drugTypeList: [{ id: 0, name: "全部" }],
  391. tableList: [],
  392. manufacturerList: [],
  393. countList: [],
  394. outCountList: [],
  395. autoCountList: [],
  396. keyword: "",
  397. drug_type: 0,
  398. minCount: [],
  399. drugOutList: [],
  400. cancelCountList: [],
  401. allCountList: [],
  402. org_id: "",
  403. showOne: true,
  404. showTwo: false,
  405. showThree: true,
  406. showFour: false,
  407. houseList: [],
  408. medicalList: [],
  409. storehouse_id: 0,
  410. drug_id: 0,
  411. storeList: [],
  412. };
  413. },
  414. methods: {
  415. //获取库存
  416. getlist() {
  417. const params = {
  418. page: this.page,
  419. limit: this.limit,
  420. keyword: this.keywords,
  421. drug_type: this.drug_type,
  422. start_time: this.start_time,
  423. end_time: this.end_time,
  424. drug_id: this.drug_id,
  425. storehouse_id: this.storehouse_id,
  426. };
  427. getDrugStockList(params).then((response) => {
  428. if (response.data.state == 1) {
  429. var list = response.data.data.list;
  430. for (let i = 0; i < list.length; i++) {
  431. for (let j = 0; j < list[i].drug_warehouse_info.length; j++) {
  432. if (list[i].max_unit == list[i].drug_warehouse_info[j].max_unit) {
  433. list[i].drug_warehouse_info[j].stock_max_number =
  434. list[i].min_number *
  435. list[i].drug_warehouse_info[j].stock_max_number;
  436. list[i].drug_warehouse_info[j].warehousing_count =
  437. list[i].min_number *
  438. list[i].drug_warehouse_info[j].warehousing_count;
  439. }
  440. }
  441. for (let y = 0; y < list[i].drug_warehouse_out.length; y++) {
  442. if (
  443. list[i].drug_warehouse_out[y].count_unit == list[i].max_unit
  444. ) {
  445. list[i].drug_warehouse_out[y].count =
  446. list[i].drug_warehouse_out[y].count * list[i].min_number;
  447. }
  448. }
  449. for (let z = 0; z < list[i].drug_cancel_stock_info.length; z++) {
  450. if (
  451. list[i].drug_cancel_stock_info[z].max_unit == list[i].max_unit
  452. ) {
  453. list[i].drug_cancel_stock_info[z].count =
  454. list[i].drug_cancel_stock_info[z].count * list[i].min_number;
  455. }
  456. }
  457. }
  458. var arr = [];
  459. for (let i = 0; i < list.length; i++) {
  460. if (list[i].drug_warehouse_info.length > 0) {
  461. arr.push(list[i]);
  462. }
  463. }
  464. this.tableList = arr;
  465. var total = response.data.data.total;
  466. this.total = total;
  467. this.manufacturerList = response.data.data.manufacturerList;
  468. this.houseList = [];
  469. this.storeList = [];
  470. var obj = {
  471. id: 0,
  472. storehouse_name: "全部",
  473. };
  474. var objOne = {
  475. id: 0,
  476. drug_name: "全部",
  477. };
  478. this.storeList.push(obj);
  479. for (let i = 0; i < response.data.data.houseList.length; i++) {
  480. this.houseList.push(response.data.data.houseList[i]);
  481. this.storeList.push(response.data.data.houseList[i]);
  482. }
  483. this.medicalList = [];
  484. this.medicalList.push(objOne);
  485. for (let i = 0; i < response.data.data.medicalList.length; i++) {
  486. for (
  487. let j = 0;
  488. j < response.data.data.manufacturerList.length;
  489. j++
  490. ) {
  491. if (
  492. response.data.data.medicalList[i].manufacturer ==
  493. response.data.data.manufacturerList[j].id
  494. ) {
  495. response.data.data.medicalList[i].manufacturer =
  496. response.data.data.manufacturerList[j].manufacturer_name;
  497. }
  498. }
  499. response.data.data.medicalList[i].drug_name =
  500. response.data.data.medicalList[i].drug_name +
  501. response.data.data.medicalList[i].dose +
  502. response.data.data.medicalList[i].dose_unit +
  503. "*" +
  504. response.data.data.medicalList[i].min_number +
  505. response.data.data.medicalList[i].min_unit +
  506. "/" +
  507. response.data.data.medicalList[i].max_unit +
  508. " " +
  509. response.data.data.medicalList[i].manufacturer;
  510. this.medicalList.push(response.data.data.medicalList[i]);
  511. }
  512. }
  513. });
  514. },
  515. handleSpanTempArr() {
  516. this.tempArr = [];
  517. for (let i = 0; i < this.WarehouseInfo.warehouseInfoDate.length; i++) {
  518. if (i === 0) {
  519. this.tempArr.push(1);
  520. this.pos = 0;
  521. } else {
  522. // 判断当前元素与上一个元素是否相同
  523. if (
  524. this.WarehouseInfo.warehouseInfoDate[i].drug_name ===
  525. this.WarehouseInfo.warehouseInfoDate[i - 1].drug_name
  526. ) {
  527. this.tempArr[this.pos] += 1;
  528. this.tempArr.push(0);
  529. } else {
  530. this.tempArr.push(1);
  531. this.pos = i;
  532. }
  533. }
  534. }
  535. let sameRowArr = [],
  536. sIdx = 0;
  537. this.WarehouseInfo.warehouseInfoDate.forEach((item, index) => {
  538. item.index = index;
  539. if (index === 0) {
  540. sameRowArr.push([index]);
  541. } else {
  542. if (
  543. item.drug_name ===
  544. this.WarehouseInfo.warehouseInfoDate[index - 1].drug_name
  545. ) {
  546. sameRowArr[sIdx].push(index);
  547. } else {
  548. sIdx = sIdx + 1;
  549. sameRowArr.push([index]);
  550. }
  551. }
  552. });
  553. this.sameRowArr = sameRowArr;
  554. },
  555. merge({ row, column, rowIndex, columnIndex }) {
  556. if (columnIndex === 0) {
  557. const _row = this.tempArr[rowIndex];
  558. const _col = _row > 0 ? 1 : 0;
  559. return {
  560. rowspan: _row,
  561. colspan: _col,
  562. };
  563. }
  564. },
  565. getSpecificationName: function (id) {
  566. let name = "";
  567. for (let i = 0; i < this.goodInfo.length; i++) {
  568. if (this.goodInfo[i].id == id) {
  569. name = this.goodInfo[i].specification_name;
  570. }
  571. }
  572. return name;
  573. },
  574. getTypeName: function (id) {
  575. let name = "";
  576. for (let i = 0; i < this.goodType.length; i++) {
  577. if (this.goodType[i].id == id) {
  578. name = this.goodType[i].type_name;
  579. }
  580. }
  581. return name;
  582. },
  583. handleBack: function () {
  584. this.$router.go(-1);
  585. },
  586. handleSizeChange(val) {
  587. this.limit = val;
  588. this.getlist();
  589. },
  590. handleCurrentChange(val) {
  591. this.page = val;
  592. this.getlist();
  593. },
  594. calculate: function (val) {
  595. return Math.round(parseFloat(val) * 100) / 100;
  596. },
  597. startTimeChange: function (val) {
  598. window.sessionStorage.removeItem("start_time");
  599. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  600. if (time > 0) {
  601. this.$message.error("开始时间不能大于结束时间");
  602. this.start_time = "";
  603. } else {
  604. this.getlist();
  605. }
  606. },
  607. endTimeChange: function (val) {
  608. window.sessionStorage.removeItem("end_time");
  609. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  610. if (time < 0) {
  611. this.$message.error("结束时间不能小于开始时间");
  612. this.end_time = "";
  613. } else {
  614. if (this.end_time == "") {
  615. this.showOne = true;
  616. this.showTwo = false;
  617. this.showThree = true;
  618. this.showFour = false;
  619. this.getlist();
  620. }
  621. if (this.end_time != "") {
  622. this.showOne = false;
  623. this.showTwo = true;
  624. this.showThree = false;
  625. this.showFour = true;
  626. this.getlist();
  627. this.getDrugCountList();
  628. }
  629. }
  630. },
  631. stockInCount: function (row) {
  632. let total = 0;
  633. for (let i = 0; i < row.query_drug_warehousing_info.length; i++) {
  634. total = total + row.query_drug_warehousing_info[i].warehousing_count;
  635. }
  636. return total;
  637. },
  638. salesReturnCount: function (row) {
  639. let total = 0;
  640. for (let i = 0; i < row.query_drug_sales_return_info.length; i++) {
  641. total = total + row.query_drug_sales_return_info[i].count;
  642. }
  643. return total;
  644. },
  645. stockOutCount: function (row) {
  646. let total = 0;
  647. for (let i = 0; i < row.query_drug_warehouseout_info.length; i++) {
  648. total = total + row.query_drug_warehouseout_info[i].count;
  649. }
  650. return total;
  651. },
  652. cancelStockCount: function (row) {
  653. let total = 0;
  654. for (let i = 0; i < row.query_drug_cancel_stock_info.length; i++) {
  655. total = total + row.query_drug_cancel_stock_info[i].count;
  656. }
  657. return total;
  658. },
  659. search: function () {
  660. this.getlist();
  661. },
  662. setting: function () {
  663. this.$refs.dialog.show();
  664. },
  665. exportStock() {
  666. for (let i = 0; i < this.tableList.length; i++) {
  667. this.tableList[i].index = i + 1;
  668. this.tableList[i].drug_type_name = this.getDrugType(
  669. this.tableList[i].drug_type
  670. );
  671. this.tableList[i].unit =
  672. this.tableList[i].dose +
  673. this.tableList[i].dose_unit +
  674. "*" +
  675. this.tableList[i].min_number +
  676. this.tableList[i].min_unit +
  677. "/" +
  678. this.tableList[i].max_unit;
  679. this.tableList[i].manufacturer_name = this.getManufacturerList(
  680. this.tableList[i].manufacturer
  681. );
  682. this.tableList[i].inCount = this.getWarehoseInfoOne(
  683. this.tableList[i].drug_warehouse_info,
  684. this.tableList[i].max_unit,
  685. this.tableList[i].min_unit,
  686. this.tableList[i].min_number
  687. );
  688. if (this.end_time == 0) {
  689. this.tableList[i].outCount = this.getWarehouseOutInfo(
  690. this.tableList[i].drug_warehouse_out,
  691. this.tableList[i].max_unit,
  692. this.tableList[i].min_unit,
  693. this.tableList[i].min_number
  694. );
  695. this.tableList[i].overplusCount = this.getOverFlushInfo(
  696. this.tableList[i].drug_warehouse_info,
  697. this.tableList[i].max_unit,
  698. this.tableList[i].min_unit,
  699. this.tableList[i].min_number
  700. );
  701. }
  702. if (this.end_time != 0) {
  703. this.tableList[i].outCount =
  704. this.getOutCount(this.tableList[i].id) +
  705. this.getAutoCount(this.tableList[i].id);
  706. this.tableList[i].overplusCount =
  707. this.getWarehoseInfo(this.tableList[i].drug_warehouse_info) -
  708. this.getOutCount(this.tableList[i].id) -
  709. this.getAutoCount(this.tableList[i].id);
  710. }
  711. }
  712. import("@/vendor/Export2Excel").then((excel) => {
  713. const tHeader = [
  714. "序号",
  715. "药品类型",
  716. "药品名称",
  717. "规格型号&单位",
  718. "国家编码",
  719. "进货单价",
  720. "厂家",
  721. "入库数量",
  722. "出库数量",
  723. "剩余库存量",
  724. ];
  725. const filterVal = [
  726. "index",
  727. "drug_type_name",
  728. "drug_name",
  729. "unit",
  730. "medical_insurance_number",
  731. "last_price",
  732. "manufacturer_name",
  733. "inCount",
  734. "outCount",
  735. "overplusCount",
  736. ];
  737. const data = this.formatJson(filterVal, this.tableList);
  738. excel.export_json_to_excel({
  739. header: tHeader,
  740. data,
  741. filename: "药品查询",
  742. });
  743. this.downloadLoading = false;
  744. });
  745. },
  746. formatJson(filterVal, jsonData) {
  747. return jsonData.map((v) => filterVal.map((j) => v[j]));
  748. },
  749. getDictionaryDataConfig(module, filed_name) {
  750. return getDictionaryDataConfig(module, filed_name);
  751. },
  752. getTimestamp(time) {
  753. // 把时间日期转成时间戳
  754. return new Date(time).getTime() / 1000;
  755. },
  756. changeDrug() {
  757. this.getlist();
  758. },
  759. printOrder() {
  760. window.sessionStorage.setItem("start_time", this.start_time);
  761. window.sessionStorage.setItem("end_time", this.end_time);
  762. this.$router.push({
  763. name: "drugQueryPrint",
  764. query: {
  765. drug_type: this.drug_type,
  766. keyword: this.keywords,
  767. start_time: this.start_time,
  768. end_time: this.end_time,
  769. page: this.page,
  770. limit: this.limit,
  771. },
  772. });
  773. },
  774. getDrugType(id) {
  775. var name = "";
  776. for (let i = 0; i < this.drugTypeList.length; i++) {
  777. if (this.drugTypeList[i].id == id) {
  778. name = this.drugTypeList[i].name;
  779. }
  780. }
  781. return name;
  782. },
  783. getManufacturerList(id) {
  784. var name = "";
  785. for (let i = 0; i < this.manufacturerList.length; i++) {
  786. if (id == this.manufacturerList[i].id) {
  787. name = this.manufacturerList[i].manufacturer_name;
  788. }
  789. }
  790. return name;
  791. },
  792. handleDetail(val) {
  793. console.log("val232332323223323", val);
  794. var manufacturer_name = "";
  795. for (let i = 0; i < this.manufacturerList.length; i++) {
  796. if (val.manufacturer == this.manufacturerList[i].id) {
  797. manufacturer_name = this.manufacturerList[i].manufacturer_name;
  798. }
  799. }
  800. var unit =
  801. val.dose +
  802. val.dose_unit +
  803. "*" +
  804. val.min_number +
  805. val.min_unit +
  806. "/" +
  807. val.max_unit;
  808. var over_plus = this.getOverFlushInfo(
  809. val.drug_warehouse_info,
  810. val.max_unit,
  811. val.min_unit,
  812. val.min_number
  813. );
  814. this.$router.push({
  815. path:
  816. "/drugstock/in/drugstockflow?drug_id=" +
  817. val.id +
  818. "&manufacturer=" +
  819. manufacturer_name +
  820. "&unit=" +
  821. unit +
  822. "&min_number=" +
  823. val.min_number +
  824. "&max_unit=" +
  825. val.max_unit +
  826. "&min_unit=" +
  827. val.min_unit +
  828. "&over_plus=" +
  829. over_plus,
  830. });
  831. window.sessionStorage.setItem("start_time", this.start_time);
  832. window.sessionStorage.setItem("end_time", this.end_time);
  833. },
  834. handleBatch(val) {
  835. console.log("val322332323232", val);
  836. var manufacturer_name = "";
  837. for (let i = 0; i < this.manufacturerList.length; i++) {
  838. if (val.manufacturer == this.manufacturerList[i].id) {
  839. manufacturer_name = this.manufacturerList[i].manufacturer_name;
  840. }
  841. }
  842. var unit =
  843. val.dose +
  844. val.dose_unit +
  845. "*" +
  846. val.min_number +
  847. val.min_unit +
  848. "/" +
  849. val.max_unit;
  850. var over_plus = this.getOverFlushInfo(
  851. val.drug_warehouse_info,
  852. val.max_unit,
  853. val.min_unit,
  854. val.min_number
  855. );
  856. window.sessionStorage.setItem("start_time", this.start_time);
  857. window.sessionStorage.setItem("end_time", this.end_time);
  858. this.$router.push({
  859. path:
  860. "/drugstock/in/drugbatchnumber?drug_id=" +
  861. val.id +
  862. "&manufacturer=" +
  863. manufacturer_name +
  864. "&unit=" +
  865. unit +
  866. "&min_number=" +
  867. val.min_number +
  868. "&max_unit=" +
  869. val.max_unit +
  870. "&min_unit=" +
  871. val.min_unit +
  872. "&over_plus=" +
  873. over_plus,
  874. });
  875. },
  876. getDrugCountList() {
  877. var params = {
  878. keyword: this.keywords,
  879. start_time: this.start_time,
  880. end_time: this.end_time,
  881. };
  882. console.log("paramsw2ww", params);
  883. getDrugCountList(params).then((response) => {
  884. if (response.data.state == 1) {
  885. var minCount = response.data.data.minCount;
  886. console.log("minCount", minCount);
  887. this.minCount = minCount;
  888. var cancelCountList = response.data.data.cancelCountList;
  889. this.cancelCountList = cancelCountList;
  890. var info = response.data.data.info;
  891. for (let i = 0; i < info.length; i++) {
  892. if (info[i].count_unit == info[i].max_unit) {
  893. info[i].count = info[i].count * info[i].min_number;
  894. }
  895. }
  896. this.outCountList = response.data.data.outCountList;
  897. console.log("手动出库", this.outCountList);
  898. this.auCountList = response.data.data.auCountList;
  899. console.log("自动出库", this.auCountList);
  900. this.drugOutList = info;
  901. }
  902. });
  903. },
  904. getInCount(id) {
  905. var count = 0;
  906. for (let i = 0; i < this.countList.length; i++) {
  907. if (id == this.countList[i].drug_id) {
  908. count = this.countList[i].count;
  909. }
  910. }
  911. return count;
  912. },
  913. getOutCount(id) {
  914. var count = 0;
  915. for (let i = 0; i < this.outCountList.length; i++) {
  916. if (id == this.outCountList[i].drug_id) {
  917. count = this.outCountList[i].count;
  918. }
  919. }
  920. return count;
  921. },
  922. getAutoCount(id) {
  923. var count = 0;
  924. for (let i = 0; i < this.autoCountList.length; i++) {
  925. if (id == this.autoCountList[i].drug_id) {
  926. count = this.autoCountList[i].count;
  927. }
  928. }
  929. return count;
  930. },
  931. getMinCount(id) {
  932. var count = 0;
  933. for (let i = 0; i < this.minCount.length; i++) {
  934. if (id == this.minCount[i].drug_id) {
  935. count = this.minCount[i].count;
  936. }
  937. }
  938. return count;
  939. },
  940. getCount(drug_id, min_number, max_unit, min_unit) {
  941. var total = 0;
  942. var str = "";
  943. var min_str = "";
  944. var arr = [];
  945. for (let i = 0; i < this.allCountList.length; i++) {
  946. if (drug_id == this.allCountList[i].drug_id) {
  947. arr.push(this.allCountList[i]);
  948. }
  949. }
  950. var arrTwo = [];
  951. for (let i = 0; i < arr.length; i++) {
  952. if (arr[i].drug_id == 1236) {
  953. arrTwo.push(arr[i]);
  954. }
  955. if (arr[i].count_unit == max_unit) {
  956. arr[i].count = arr[i].count * min_number;
  957. }
  958. if (arr[i].count_unit == min_unit) {
  959. arr[i].count = arr[i].count;
  960. }
  961. total += arr[i].count;
  962. }
  963. if (total < min_number) {
  964. str = "";
  965. min_str = total + min_unit;
  966. }
  967. if (total >= min_number) {
  968. if (parseInt(total / min_number) != 0) {
  969. str = parseInt(total / min_number) + max_unit;
  970. }
  971. if (total % min_number != 0) {
  972. min_str = (total % min_number) + min_unit;
  973. }
  974. }
  975. return str + min_str;
  976. },
  977. getCountOne(drug_id) {
  978. var count = 0;
  979. for (let i = 0; i < this.drugOutList.length; i++) {
  980. if (drug_id == this.drugOutList[i].drug_id) {
  981. count += parseInt(this.drugOutList[i].count);
  982. }
  983. }
  984. return count;
  985. },
  986. getCountTwo(drug_id, min_number, max_unit, min_unit) {
  987. var total_count = 0;
  988. var out_count = 0;
  989. var count = 0;
  990. var str = "";
  991. var str_min = "";
  992. total_count = this.getInCount(drug_id) * min_number;
  993. out_count = this.getCountOne(drug_id);
  994. count = total_count - out_count;
  995. if (parseInt(count / min_number) != 0) {
  996. str = parseInt(count / min_number) + max_unit;
  997. }
  998. if (count % min_number != 0) {
  999. str_min = (count % min_number) + min_unit;
  1000. }
  1001. return str + str_min;
  1002. },
  1003. getCancelCount(id) {
  1004. var count = 0;
  1005. for (let i = 0; i < this.cancelCountList.length; i++) {
  1006. if (id == this.cancelCountList[i].drug_id) {
  1007. count = this.cancelCountList[i].count;
  1008. }
  1009. }
  1010. return count;
  1011. },
  1012. getWarehoseInfo(arr) {
  1013. var total = 0;
  1014. if (arr.length > 0) {
  1015. for (let i = 0; i < arr.length; i++) {
  1016. total += parseInt(arr[i].warehousing_count);
  1017. }
  1018. }
  1019. if (total == 0) {
  1020. total = "";
  1021. }
  1022. return total;
  1023. },
  1024. getWarehoseInfoOne(arr, max_unit, min_unit, min_number) {
  1025. var total = 0;
  1026. var max_str = "";
  1027. var min_str = "";
  1028. if (arr.length > 0) {
  1029. for (let i = 0; i < arr.length; i++) {
  1030. total += parseInt(arr[i].warehousing_count);
  1031. }
  1032. }
  1033. if (total < min_number) {
  1034. min_str = total + min_unit;
  1035. }
  1036. if (total == 0) {
  1037. min_str = "";
  1038. max_str = "";
  1039. }
  1040. if (total >= min_number) {
  1041. if (parseInt(total / min_number) != 0) {
  1042. max_str = parseInt(total / min_number) + max_unit;
  1043. }
  1044. if (total % min_number != 0) {
  1045. min_str = (total % min_number) + min_unit;
  1046. }
  1047. }
  1048. return max_str + min_str;
  1049. },
  1050. getOverFlushInfo(arr, max_unit, min_unit, min_number) {
  1051. var max_str = "";
  1052. var min_str = "";
  1053. var total = 0;
  1054. var newarr = arr;
  1055. if (newarr.length > 0) {
  1056. for (let i = 0; i < newarr.length; i++) {
  1057. total += newarr[i].stock_max_number + newarr[i].stock_min_number;
  1058. }
  1059. }
  1060. if (total < min_number) {
  1061. min_str = total + min_unit;
  1062. }
  1063. if (total == 0) {
  1064. min_str = "";
  1065. max_str = "";
  1066. }
  1067. if (total >= min_number) {
  1068. if (parseInt(total / min_number) != 0) {
  1069. max_str = parseInt(total / min_number) + max_unit;
  1070. }
  1071. if (total % min_number != 0) {
  1072. min_str = (total % min_number) + min_unit;
  1073. }
  1074. }
  1075. return max_str + min_str;
  1076. },
  1077. getWarehouseOutInfo(arr, max_unit, min_unit, min_number) {
  1078. var min_str = "";
  1079. var max_str = "";
  1080. var total = 0;
  1081. if (arr.length > 0) {
  1082. for (let i = 0; i < arr.length; i++) {
  1083. total += parseInt(arr[i].count);
  1084. }
  1085. }
  1086. if (total < min_number) {
  1087. min_str = total + min_unit;
  1088. }
  1089. if (total == 0) {
  1090. min_str = "";
  1091. max_str = "";
  1092. }
  1093. if (total >= min_number) {
  1094. if (parseInt(total / min_number) != 0) {
  1095. max_str = parseInt(total / min_number) + max_unit;
  1096. }
  1097. if (total % min_number != 0) {
  1098. min_str = (total % min_number) + min_unit;
  1099. }
  1100. }
  1101. return max_str + min_str;
  1102. },
  1103. getDrugOutList(arr, max_unit, min_unit, min_number) {
  1104. var str = "";
  1105. var str_min = "";
  1106. if (arr.length > 0) {
  1107. for (let i = 0; i < arr.length; i++) {
  1108. if (parseInt(arr[i].count / min_number) != 0) {
  1109. str = parseInt(arr[i].count / min_number) + max_unit;
  1110. }
  1111. if (arr[i].count % min_number != 0) {
  1112. str_min = (arr[i].count % min_number) + min_unit;
  1113. }
  1114. }
  1115. }
  1116. return str + str_min;
  1117. },
  1118. getDrugChaCount(
  1119. info,
  1120. out_info,
  1121. max_unit,
  1122. min_unit,
  1123. min_number,
  1124. cancel_info
  1125. ) {
  1126. var total_info = 0;
  1127. var total_out = 0;
  1128. var cha_count = 0;
  1129. var cancel_count = 0;
  1130. if (info.length > 0) {
  1131. for (let i = 0; i < info.length; i++) {
  1132. total_info += info[i].warehousing_count * min_number;
  1133. }
  1134. }
  1135. if (out_info.length > 0) {
  1136. for (let j = 0; j < out_info.length; j++) {
  1137. total_out += out_info[j].count;
  1138. }
  1139. }
  1140. if (cancel_info.length > 0) {
  1141. for (let z = 0; z < cancel_info.length; z++) {
  1142. cancel_count += cancel_info[z].count;
  1143. }
  1144. }
  1145. cha_count = total_info - total_out + cancel_count;
  1146. var str = "";
  1147. var str_min = "";
  1148. if (parseInt(cha_count / min_number) != 0) {
  1149. str = parseInt(cha_count / min_number) + max_unit;
  1150. }
  1151. if (cha_count % min_number != 0) {
  1152. str_min = (cha_count % min_number) + min_unit;
  1153. }
  1154. return str + str_min;
  1155. },
  1156. getOutFlush(info, max_unit, min_unit, min_number, cancel_info) {
  1157. var str = "";
  1158. var str_min = "";
  1159. //总库存
  1160. var total = 0;
  1161. var out_count = 0;
  1162. var over_count = 0;
  1163. var cancel_count = 0;
  1164. for (let i = 0; i < info.length; i++) {
  1165. total += info[i].warehousing_count;
  1166. }
  1167. for (let j = 0; j < info.length; j++) {
  1168. out_count += info[j].stock_max_number + info[j].stock_min_number;
  1169. }
  1170. // for(let z=0;z<cancel_info.length;z++){
  1171. // cancel_count += cancel_info[z].count
  1172. // }
  1173. // over_count = total - out_count + cancel_count
  1174. over_count = total - out_count;
  1175. if (parseInt(over_count / min_number) != 0) {
  1176. str = parseInt(over_count / min_number) + max_unit;
  1177. }
  1178. if (over_count % min_number != 0) {
  1179. str_min = (over_count % min_number) + min_unit;
  1180. }
  1181. return str + str_min;
  1182. },
  1183. getHouseName(id) {
  1184. var storehouse_name = "";
  1185. for (let i = 0; i < this.houseList.length; i++) {
  1186. if (id == this.houseList[i].id) {
  1187. storehouse_name = this.houseList[i].storehouse_name;
  1188. }
  1189. }
  1190. return storehouse_name;
  1191. },
  1192. getWarehoseInfoSeven(arr, max_unit, min_unit, min_number, storehouse_id) {
  1193. var total = 0;
  1194. var max_str = "";
  1195. var min_str = "";
  1196. if (arr.length > 0) {
  1197. for (let i = 0; i < arr.length; i++) {
  1198. if (arr[i].storehouse_id == storehouse_id) {
  1199. total += parseInt(arr[i].warehousing_count);
  1200. }
  1201. }
  1202. }
  1203. if (total < min_number) {
  1204. min_str = total + min_unit;
  1205. }
  1206. if (total == 0) {
  1207. min_str = "";
  1208. max_str = "";
  1209. }
  1210. if (total >= min_number) {
  1211. if (parseInt(total / min_number) != 0) {
  1212. max_str = parseInt(total / min_number) + max_unit;
  1213. }
  1214. if (total % min_number != 0) {
  1215. min_str = (total % min_number) + min_unit;
  1216. }
  1217. }
  1218. return max_str + min_str;
  1219. },
  1220. getOverFlushInfoEight(arr, max_unit, min_unit, min_number, storehouse_id) {
  1221. var max_str = "";
  1222. var min_str = "";
  1223. var total = 0;
  1224. var newarr = arr;
  1225. if (newarr.length > 0) {
  1226. for (let i = 0; i < newarr.length; i++) {
  1227. if (newarr[i].storehouse_id == storehouse_id) {
  1228. total += newarr[i].stock_max_number + newarr[i].stock_min_number;
  1229. }
  1230. }
  1231. }
  1232. if (total < min_number) {
  1233. min_str = total + min_unit;
  1234. }
  1235. if (total == 0) {
  1236. min_str = "";
  1237. max_str = "";
  1238. }
  1239. if (total >= min_number) {
  1240. if (parseInt(total / min_number) != 0) {
  1241. max_str = parseInt(total / min_number) + max_unit;
  1242. }
  1243. if (total % min_number != 0) {
  1244. min_str = (total % min_number) + min_unit;
  1245. }
  1246. }
  1247. return max_str + min_str;
  1248. },
  1249. getOutFlushNight(
  1250. info,
  1251. max_unit,
  1252. min_unit,
  1253. min_number,
  1254. cancel_info,
  1255. storehouse_id
  1256. ) {
  1257. var str = "";
  1258. var str_min = "";
  1259. //总库存
  1260. var total = 0;
  1261. var out_count = 0;
  1262. var over_count = 0;
  1263. var cancel_count = 0;
  1264. for (let i = 0; i < info.length; i++) {
  1265. if (info[i].storehouse_id == storehouse_id) {
  1266. total += info[i].warehousing_count;
  1267. }
  1268. }
  1269. for (let j = 0; j < info.length; j++) {
  1270. if (info[j].storehouse_id == storehouse_id) {
  1271. out_count += info[j].stock_max_number + info[j].stock_min_number;
  1272. }
  1273. }
  1274. // for(let z=0;z<cancel_info.length;z++){
  1275. // cancel_count += cancel_info[z].count
  1276. // }
  1277. // over_count = total - out_count + cancel_count
  1278. over_count = total - out_count;
  1279. if (parseInt(over_count / min_number) != 0) {
  1280. str = parseInt(over_count / min_number) + max_unit;
  1281. }
  1282. if (over_count % min_number != 0) {
  1283. str_min = (over_count % min_number) + min_unit;
  1284. }
  1285. return str + str_min;
  1286. },
  1287. changeStorehouseName() {
  1288. this.getlist();
  1289. },
  1290. changeDrugName() {
  1291. this.getlist();
  1292. },
  1293. // 合并单元格样式
  1294. cellStyle({ row, column, rowIndex, columnIndex }) {
  1295. let arr = [6, 7, 8, 9];
  1296. if (arr.indexOf(columnIndex) > -1) {
  1297. return "spanClass";
  1298. }
  1299. },
  1300. },
  1301. };
  1302. </script>
  1303. <style rel="stylesheet/css" lang="scss" scoped>
  1304. .information {
  1305. border: 1px #dcdfe6 solid;
  1306. padding: 30px 20px 30px 20px;
  1307. .border {
  1308. border-bottom: 1px #dcdfe6 solid;
  1309. margin: 0px 0 20px 0;
  1310. }
  1311. }
  1312. .title {
  1313. background: #409eff;
  1314. height: 44px;
  1315. line-height: 44px;
  1316. padding: 0 0 0 10px;
  1317. color: #fff;
  1318. margin: 0 0 10px 0;
  1319. }
  1320. .edit_separater {
  1321. border-top: 1px solid rgb(233, 233, 233);
  1322. margin-top: 15px;
  1323. margin-bottom: 15px;
  1324. }
  1325. </style>
  1326. <style>
  1327. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1328. font-size: 12px;
  1329. }
  1330. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1331. background: #6fb5fa;
  1332. }
  1333. .count {
  1334. color: #bd2c00;
  1335. }
  1336. .el-table td,
  1337. .el-table th.is-leaf,
  1338. .el-table--border,
  1339. .el-table--group {
  1340. border-color: #d0d3da;
  1341. }
  1342. .el-table--border::after,
  1343. .el-table--group::after,
  1344. .el-table::before {
  1345. background-color: #d0d3da;
  1346. }
  1347. /* 合并表格线样式 */
  1348. .spanClass .cell {
  1349. padding: 0 !important;
  1350. }
  1351. .spanClass .cell tr {
  1352. display: inline-block;
  1353. width: 100%;
  1354. }
  1355. .spanClass .cell tr td {
  1356. padding: 10px 0;
  1357. border-bottom: 1px solid #ebeef5;
  1358. display: block;
  1359. width: 100%;
  1360. }
  1361. .spanClass .cell tr:last-of-type td {
  1362. border-bottom: none;
  1363. }
  1364. </style>