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

query.vue 41KB

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