drugQuery.vue 57KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760
  1. <template>
  2. <div class="main-contain">
  3. <div class="app-container " style="padding-left:0px;margin:0px;" v-loading="loading"
  4. element-loading-text="拼命加载中">
  5. <div style="justify-content: space-between;margin: 0px 0 12px 0;display: flex;align-items: center;">
  6. <div>
  7. <span style="font-size:14px;color:#606266">仓库:</span>
  8. <el-select v-model="storehouse_id" style="width:200px;margin-right:10px;" placeholder="请选择"
  9. filterable
  10. @change="changeStorehouseName">
  11. <el-option
  12. v-for="item in houseList"
  13. :key="item.id"
  14. :label="item.storehouse_name"
  15. :value="item.id">
  16. </el-option>
  17. </el-select>
  18. <span style="font-size:14px;color:#606266">库存预警:</span>
  19. <el-select v-model="good_type" style="width:250px;margin-right:10px;" placeholder="请选择"
  20. filterable
  21. @change="changeGoodName">
  22. <el-option
  23. v-for="item in goodList"
  24. :key="item.id"
  25. :label="item.name"
  26. :value="item.id">
  27. </el-option>
  28. </el-select>
  29. <el-input v-model="keyword" style="width:200px" placeholder="请输入药品名称或生产厂商" ></el-input>
  30. <el-button type="primary" icon="el-icon-search" @click="seach">搜索</el-button>
  31. </div>
  32. <div>
  33. <!-- <el-button
  34. size="small"
  35. class="filter-item"
  36. type="primary"
  37. @click="toCheck"
  38. >调试
  39. </el-button> -->
  40. <el-button
  41. size="small"
  42. class="filter-item"
  43. type="primary"
  44. @click="toSet"
  45. >设置
  46. </el-button>
  47. <el-button
  48. size="small"
  49. class="filter-item"
  50. type="primary"
  51. icon="el-icon-printer"
  52. @click="printOrder"
  53. >打印
  54. </el-button>
  55. <el-button
  56. size="small"
  57. class="filter-item"
  58. type="primary"
  59. @click="exportStock"
  60. >导出
  61. </el-button>
  62. </div>
  63. </div>
  64. <el-table
  65. :row-style="{ color: '#303133' }"
  66. :header-cell-style="{
  67. backgroundColor: 'rgb(245, 247, 250)',
  68. color: '#606266'
  69. }"
  70. :data="tableList"
  71. :class="signAndWeighBoxPatients"
  72. border
  73. :cell-class-name="cellStyle"
  74. >
  75. <el-table-column label="药品类型" align="center">
  76. <template slot-scope="scope">
  77. {{getDrugTypeName(scope.row.drug_type)}}
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="药品名称" align="center">
  81. <template slot-scope="scope">
  82. {{scope.row.drug_name}}
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="规格&单位" align="center">
  86. <template slot-scope="scope">
  87. {{scope.row.dose}}{{scope.row.dose_unit}}*{{scope.row.min_number}}{{scope.row.min_unit}}/{{scope.row.max_unit}}
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="生产厂商" align="center">
  91. <template slot-scope="scope">
  92. {{getManufacturName(scope.row.manufacturer)}}
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="经销商" align="center" v-if="org_id ==10485">
  96. <template slot-scope="scope">
  97. {{getDearName(scope.row.dealer)}}
  98. </template>
  99. </el-table-column>
  100. <el-table-column label="批准文号" align="center">
  101. <template slot-scope="scope">
  102. {{scope.row.number}}
  103. </template>
  104. </el-table-column>
  105. <el-table-column label="国家编码" align="center">
  106. <template slot-scope="scope">
  107. {{scope.row.medical_insurance_number}}
  108. </template>
  109. </el-table-column>
  110. <el-table-column label="仓库名称" align="center">
  111. <template slot-scope="scope">
  112. <tr style="background: none" v-for="(item, index) in scope.row.drug_stock_info" :key="index">
  113. <td style="border-right: none;border-inline-end: none;text-align: center;">
  114. {{ getHouseName(item.storehouse_id) }}
  115. </td>
  116. </tr>
  117. </template>
  118. </el-table-column>
  119. <el-table-column label="入库数量" align="center">
  120. <template slot-scope="scope">
  121. <tr style="background: none" v-for="(item, index) in scope.row.drug_stock_info" :key="index">
  122. <td style="border-right: none;border-inline-end: none;text-align: center; ">
  123. {{getDrugIn(item.storehouse_id,scope.row.drug_stock_count,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}
  124. </td>
  125. </tr>
  126. </template>
  127. </el-table-column>
  128. <el-table-column label="出库数量" align="center">
  129. <template slot-scope="scope">
  130. <tr style="background: none" v-for="(item, index) in scope.row.drug_stock_info" :key="index">
  131. <td style="border-right: none;border-inline-end: none;text-align: center;">
  132. <span>
  133. {{getActOut(item.storehouse_id,scope.row.drug_stock_count,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}
  134. </span>
  135. </td>
  136. </tr>
  137. </template>
  138. </el-table-column>
  139. <el-table-column label="退库数量" align="center">
  140. <template slot-scope="scope">
  141. <tr style="background: none" v-for="(item, index) in scope.row.drug_stock_info" :key="index">
  142. <td style="border-right: none;border-inline-end: none;text-align: center;">
  143. {{getDrugCancel(item.storehouse_id,scope.row.drug_stock_count,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}
  144. </td>
  145. </tr>
  146. </template>
  147. </el-table-column>
  148. <el-table-column label="实际出库" align="center">
  149. <template slot-scope="scope">
  150. <tr style="background: none" v-for="(item, index) in scope.row.drug_stock_info" :key="index">
  151. <td style="border-right: none;border-inline-end: none;text-align: center;">
  152. <span style="color:#0099FF" @click="toDialogClick(scope.row.id,scope.row.drug_name,scope.row.dose,scope.row.dose_unit,scope.row.min_number,scope.row.min_unit,scope.row.max_unit,item.storehouse_id)">
  153. {{getDrugOut(item.storehouse_id,scope.row.drug_stock_count,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}
  154. </span>
  155. </td>
  156. </tr>
  157. </template>
  158. </el-table-column>
  159. <el-table-column label="剩余库存" align="center">
  160. <template slot-scope="scope">
  161. <tr style="background: none" v-for="(item, index) in scope.row.drug_stock_info" :key="index">
  162. <td style="border-right: none;border-inline-end: none;text-align: center;">
  163. {{getFlushCount(item.storehouse_id,scope.row.drug_stock_count,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}
  164. </td>
  165. </tr>
  166. </template>
  167. </el-table-column>
  168. <el-table-column label="总库存量" align="center">
  169. <template slot-scope="scope">
  170. <div v-if="getWarehoseInfo(scope.row.drug_warehouse_info) > 0">
  171. <span v-if="scope.row.sum_count<= (parseInt(scope.row.drug_stock_limit)*scope.row.min_number)" style="color:red">{{getSumCount(scope.row.drug_stock_count,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}<i class="el-icon-warning"></i></span>
  172. <span v-if="scope.row.sum_count > (parseInt(scope.row.drug_stock_limit)*scope.row.min_number)">{{getSumCount(scope.row.drug_stock_count,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}</span>
  173. </div>
  174. </template>
  175. </el-table-column>
  176. <el-table-column
  177. prop="drug_name"
  178. label="操作"
  179. align="center"
  180. width="200px"
  181. >
  182. <template slot-scope="scope">
  183. <el-button
  184. size="small"
  185. type="primary"
  186. @click="handleDetail(scope.row)"
  187. >库存流水
  188. </el-button>
  189. <el-button
  190. size="small"
  191. type="primary"
  192. @click="handleBatch(scope.row)"
  193. >批次
  194. </el-button>
  195. <!-- <el-button
  196. size="small"
  197. type="primary"
  198. @click="handleCheckBatch(scope.row)"
  199. >自查
  200. </el-button> -->
  201. </template>
  202. </el-table-column>
  203. </el-table>
  204. <el-pagination
  205. @size-change="handleSizeChange"
  206. @current-change="handleCurrentChange"
  207. :page-sizes="[10, 50, 100,200,300,400,500,1000]"
  208. :page-size="10"
  209. background
  210. align="right"
  211. style="margin-top:20px;"
  212. layout="total, sizes, prev, pager, next, jumper"
  213. :total="total"
  214. >
  215. </el-pagination>
  216. </div>
  217. <el-dialog
  218. title="出库详情"
  219. :visible.sync="dialogVisible"
  220. width="70%">
  221. <span>
  222. 药品名称:{{drug_name}}
  223. 规格&单位:{{specification_name}}
  224. 查询日期:
  225. <el-date-picker
  226. size="small"
  227. v-model="start_first_time"
  228. prefix-icon="el-icon-date"
  229. :editable="false"
  230. style="width: 150px;"
  231. type="date"
  232. placeholder="选择日期时间"
  233. align="right"
  234. format="yyyy-MM-dd"
  235. value-format="yyyy-MM-dd"
  236. @change="startFirstTimeChange"
  237. ></el-date-picker>
  238. <span>-</span>
  239. <el-date-picker
  240. size="small"
  241. v-model="end_first_time"
  242. prefix-icon="el-icon-date"
  243. :editable="false"
  244. style="width: 150px;"
  245. type="date"
  246. placeholder="选择日期时间"
  247. align="right"
  248. format="yyyy-MM-dd"
  249. value-format="yyyy-MM-dd"
  250. @change="endEndTimeChange"
  251. ></el-date-picker>
  252. </span>
  253. <el-divider></el-divider>
  254. <el-table
  255. :row-style="{ color: '#303133' }"
  256. :header-cell-style="{
  257. backgroundColor: 'rgb(245, 247, 250)',
  258. color: '#606266'
  259. }"
  260. :data="tableData"
  261. :class="signAndWeighBoxPatients"
  262. border
  263. >
  264. <el-table-column label="序号" align="center">
  265. <template slot-scope="scope">
  266. {{scope.$index + 1}}
  267. </template>
  268. </el-table-column>
  269. <el-table-column label="单据编号" align="center">
  270. <template slot-scope="scope">
  271. {{scope.row.warehouse_out_order_number}}
  272. </template>
  273. </el-table-column>
  274. <el-table-column label="操作时间" align="center">
  275. <template slot-scope="scope">
  276. {{getTimeOne(scope.row.ctime)}}
  277. </template>
  278. </el-table-column>
  279. <el-table-column label="出库数量" align="center">
  280. <template slot-scope="scope">
  281. {{scope.row.count}}{{scope.row.count_unit}}
  282. </template>
  283. </el-table-column>
  284. <el-table-column label="库存数量" align="center">
  285. <template slot-scope="scope">
  286. <span v-if="parseInt(scope.row.over_count/scope.row.drug.min_number) > 0">{{parseInt(scope.row.over_count/scope.row.drug.min_number)}}{{scope.row.drug.max_unit}}</span>
  287. <span v-if="scope.row.over_count%scope.row.drug.min_number > 0">{{scope.row.over_count%scope.row.drug.min_number}}{{scope.row.drug.min_unit}}</span>
  288. </template>
  289. </el-table-column>
  290. <el-table-column label="使用人" align="center">
  291. <template slot-scope="scope">
  292. {{getName(scope.row.patient_id)}}
  293. </template>
  294. </el-table-column>
  295. <el-table-column label="备注" align="center">
  296. <template slot-scope="scope">
  297. {{scope.row.remark}}
  298. </template>
  299. </el-table-column>
  300. </el-table>
  301. <el-pagination
  302. @size-change="handleSizeChangeOne"
  303. @current-change="handleCurrentChangeOne"
  304. :page-sizes="[10, 50, 100,200,500,1000]"
  305. :page-size="10"
  306. background
  307. align="right"
  308. style="margin-top:20px;"
  309. layout="total, sizes, prev, pager, next, jumper"
  310. :total="totalone"
  311. >
  312. </el-pagination>
  313. <span slot="footer" class="dialog-footer">
  314. <el-button @click="dialogVisible = false">取 消</el-button>
  315. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  316. </span>
  317. </el-dialog>
  318. <el-dialog title="设置" :visible.sync="visibility" :close-on-click-modal="isClose"
  319. :close-on-press-escape="isClose">
  320. <div style="text-align: center;">
  321. <div>
  322. <el-button type="primary" v-if="!is_open" @click="changeOpen(1)">启用自动扣减</el-button>
  323. <el-button type="danger" v-if="is_open" @click="changeOpen(2)">关闭自动扣减</el-button>
  324. <div style="margin-top: 40px;"><p style="color:#909399;text-align: center;">
  325. 启用“药品管理”后,在开透析医嘱时,医生可以选择药品后将自动产生出库单</p></div>
  326. </div>
  327. </div>
  328. <span slot="footer" class="dialog-footer">
  329. <el-button @click="hide()">取 消</el-button>
  330. </span>
  331. </el-dialog>
  332. <el-dialog
  333. title="自查数据"
  334. :visible.sync="checkdialogVisible"
  335. width="50%">
  336. <span>
  337. <span>ID:{{drug_id}}</span>
  338. <el-table
  339. :data="checkData"
  340. border
  341. style="width: 100%">
  342. <el-table-column prop="date" label="开药日期" width="180" align="center">
  343. <template slot-scope="scope" >
  344. {{ getTime(scope.row.advice_date) }}
  345. </template>
  346. </el-table-column>
  347. <el-table-column prop="date" label="时间搓" width="180" align="center">
  348. <template slot-scope="scope" >
  349. {{scope.row.advice_date}}
  350. </template>
  351. </el-table-column>
  352. <el-table-column prop="name" label="开药数量" width="180" align="center">
  353. <template slot-scope="scope" >
  354. {{ scope.row.check_count }}
  355. </template>
  356. </el-table-column>
  357. <el-table-column prop="address" label="出库数量" align="center">
  358. <template slot-scope="scope" >
  359. {{getCount(scope.row.advice_date)}}
  360. </template>
  361. </el-table-column>
  362. <el-table-column prop="address" label="是否异常" align="center">
  363. <template slot-scope="scope" >
  364. <span v-if="scope.row.check_count==getCount(scope.row.advice_date)">否</span>
  365. <span v-if="scope.row.check_count!=getCount(scope.row.advice_date)" style="color:red">是</span>
  366. </template>
  367. </el-table-column>
  368. </el-table>
  369. </span>
  370. <span slot="footer" class="dialog-footer">
  371. <el-button @click="checkdialogVisible = false">取 消</el-button>
  372. <el-button type="primary" @click="checkdialogVisible = false">确 定</el-button>
  373. </span>
  374. </el-dialog>
  375. </div>
  376. </template>
  377. <script>
  378. import { getStorehouseList,getDrugNewQuery,getDrugWarehouseOutInfoById } from "@/api/drug/drug"
  379. import { createDrugStockAutomaticReduceConfig, getDrugStockAutomaticReduceConfig,getDrugInitDataList,getCheckDrugBatchList } from '@/api/drug/drug_stock'
  380. import { uParseTime } from '@/utils/tools'
  381. import { max } from 'moment'
  382. const moment = require('moment')
  383. export default {
  384. data(){
  385. return{
  386. tableList:[],
  387. goodList:[
  388. {id:1,name:"全部药品"},
  389. {id:2,name:"库存预警"},
  390. {id:3,name:"库存为零"},
  391. {id:4,name:"库存不为零"},
  392. ],
  393. houseList:[],
  394. storehouse_id:0,
  395. good_type:1,
  396. multipleSelection: [],
  397. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  398. manufacturerList:[],
  399. limit:10,
  400. page:1,
  401. total:0,
  402. limitone:10,
  403. pageone:1,
  404. totalone:0,
  405. keyword:"",
  406. goodTypeList:[],
  407. start_time:"",
  408. end_time:"",
  409. countList:[],
  410. outCountList:[],
  411. autoCountList:[],
  412. cancelCountList:[],
  413. org_id:this.$store.getters.xt_user.org_id,
  414. dialogVisible:false,
  415. start_first_time:moment().startOf('month').format("YYYY-MM-DD"),
  416. end_first_time:moment().endOf('month').format("YYYY-MM-DD"),
  417. tableData:[],
  418. drug_id:0,
  419. patientList:[],
  420. drug_name:"",
  421. specification_name:"",
  422. drugTypeList:[],
  423. loading:false,
  424. flushList:[],
  425. flushListOne:[],
  426. dose:"",
  427. dose_unit:"",
  428. min_number:0,
  429. max_unit:"",
  430. min_unit:"",
  431. is_open: false,
  432. visibility: false,
  433. isClose: false,
  434. drug_type: 0,
  435. storehouseId:0,
  436. dealerList:[],
  437. checkdialogVisible:false,
  438. checkData:[],
  439. outData:[],
  440. drug_id:0,
  441. }
  442. },
  443. methods:{
  444. changeStorehouseName(){
  445. this.getlist()
  446. },
  447. changeGoodName(){
  448. this.getlist()
  449. },
  450. toClick(val){
  451. var manufacturer_name = ""
  452. var specification_name = ""
  453. for(let i=0;i<this.manufacturerList.length;i++){
  454. if(val.manufacturer == this.manufacturerList[i].id){
  455. manufacturer_name = this.manufacturerList[i].manufacturer_name
  456. }
  457. }
  458. specification_name = val.specification_name + "/" + val.packing_unit
  459. var overCount = this.getOverplus(val.xt_warehouse_info)
  460. // window.sessionStorage.setItem('start_time',this.start_time)
  461. // window.sessionStorage.setItem('end_time',this.end_time)
  462. this.$router.push({path:"/stock/in/stockflow?id="+val.id+"&manufacturer="+manufacturer_name+"&packing_unit="+val.packing_unit+"&overCount="+overCount})
  463. },
  464. toClickOne(val){
  465. var manufacturer_name = ""
  466. var specification_name = ""
  467. for(let i=0;i<this.manufacturerList.length;i++){
  468. if(val.manufacturer == this.manufacturerList[i].id){
  469. manufacturer_name = this.manufacturerList[i].manufacturer_name
  470. }
  471. }
  472. specification_name = val.specification_name + "/" + val.packing_unit
  473. var overCount = this.getOverplus(val.xt_warehouse_info)
  474. // window.sessionStorage.setItem('start_time',this.start_time)
  475. // window.sessionStorage.setItem('end_time',this.end_time)
  476. this.$router.push({path:"/stock/in/stockbatchnumber?id="+val.id+"&manufacturer="+manufacturer_name+"&packing_unit="+val.packing_unit+"&overCount="+overCount})
  477. },
  478. getStorehouseList(){
  479. getStorehouseList().then(response=>{
  480. if(response.data.state == 1){
  481. var houseList = response.data.data.list
  482. var obj = {id:0,storehouse_name:"全部"}
  483. this.houseList.push(obj)
  484. for(let i=0;i<houseList.length;i++){
  485. this.houseList.push(houseList[i])
  486. }
  487. this.manufacturerList = response.data.data.manufacturerList
  488. this.goodTypeList = response.data.data.goodTypeList
  489. this.patientList = response.data.data.patientList
  490. this.dealerList = response.data.data.dealerList
  491. }
  492. })
  493. },
  494. getlist(){
  495. this.loading = true
  496. var params = {
  497. storehouse_id:this.storehouse_id,
  498. good_type:this.good_type,
  499. keyword:this.keyword,
  500. page:this.page,
  501. limit:this.limit,
  502. start_time:this.start_time,
  503. end_time:this.end_time,
  504. }
  505. this.tableList = []
  506. getDrugNewQuery(params).then(response=>{
  507. if(response.data.state == 1){
  508. this.loading = false
  509. // var list = response.data.data.list
  510. var countList = response.data.data.countList
  511. console.log("countList999999999999",countList)
  512. for (let i = 0; i < countList.length; i++) {
  513. if(countList[i].drug_stock_limit == ""){
  514. countList[i].drug_stock_limit = 0
  515. }
  516. for (let j = 0; j < countList[i].drug_warehouse_info.length; j++) {
  517. if (countList[i].max_unit == countList[i].drug_warehouse_info[j].max_unit) {
  518. countList[i].drug_warehouse_info[j].stock_max_number =countList[i].min_number *countList[i].drug_warehouse_info[j].stock_max_number
  519. countList[i].drug_warehouse_info[j].warehousing_count =countList[i].min_number *countList[i].drug_warehouse_info[j].warehousing_count
  520. }
  521. }
  522. }
  523. this.tableList = countList
  524. // for (let i = 0; i < list.length; i++) {
  525. // for (let j = 0; j < list[i].drug_warehouse_info.length; j++) {
  526. // if (list[i].max_unit == list[i].drug_warehouse_info[j].max_unit) {
  527. // list[i].drug_warehouse_info[j].stock_max_number =list[i].min_number *list[i].drug_warehouse_info[j].stock_max_number
  528. // list[i].drug_warehouse_info[j].warehousing_count =list[i].min_number *list[i].drug_warehouse_info[j].warehousing_count
  529. // }
  530. // }
  531. // for (let y = 0; y < list[i].drug_warehouse_out.length; y++) {
  532. // if (list[i].drug_warehouse_out[y].count_unit == list[i].max_unit) {
  533. // list[i].drug_warehouse_out[y].count =list[i].drug_warehouse_out[y].count * list[i].min_number
  534. // }
  535. // }
  536. // for (let z = 0; z < list[i].drug_cancel_stock_info.length; z++) {
  537. // if (list[i].drug_cancel_stock_info[z].max_unit == list[i].max_unit) {
  538. // list[i].drug_cancel_stock_info[z].count =list[i].drug_cancel_stock_info[z].count * list[i].min_number
  539. // }
  540. // }
  541. // for (let m = 0; m < list[i].drug_flow_info.length; m++) {
  542. // if (list[i].drug_flow_info[m].max_unit == list[i].max_unit) {
  543. // list[i].drug_flow_info[m].count =list[i].drug_flow_info[m].count * list[i].min_number
  544. // }
  545. // }
  546. // for (let n = 0; n< list[i].drug_act_flow_info.length; n++) {
  547. // if (list[i].drug_act_flow_info[n].max_unit == list[i].max_unit) {
  548. // list[i].drug_act_flow_info[n].count =list[i].drug_act_flow_info[n].count * list[i].min_number
  549. // }
  550. // }
  551. // }
  552. // var arr = [];
  553. // for (let i = 0; i < list.length; i++) {
  554. // if (list[i].drug_warehouse_info.length > 0) {
  555. // arr.push(list[i]);
  556. // }
  557. // }
  558. // this.tableList = arr;
  559. this.total = response.data.data.total
  560. this.drugTypeList = response.data.data.drugTypeList
  561. }
  562. })
  563. },
  564. getManufacturName(id){
  565. var manufacturer_name = ""
  566. for(let i=0;i<this.manufacturerList.length;i++){
  567. if(id == this.manufacturerList[i].id){
  568. manufacturer_name = this.manufacturerList[i].manufacturer_name
  569. }
  570. }
  571. return manufacturer_name
  572. },
  573. handleSizeChange(val) {
  574. this.limit = val;
  575. this.getlist()
  576. },
  577. handleCurrentChange(val) {
  578. this.page = val;
  579. this.getlist()
  580. },
  581. handleSizeChangeOne(val) {
  582. this.limitone = val;
  583. this.toDialogClick(this.drug_id,this.drug_name,this.dose,this.dose_unit,this.min_number,this.min_unit,this.max_unit,this.storehouseId)
  584. },
  585. handleCurrentChangeOne(val) {
  586. this.pageone = val;
  587. this.toDialogClick(this.drug_id,this.drug_name,this.dose,this.dose_unit,this.min_number,this.min_unit,this.max_unit,this.storehouseId)
  588. },
  589. seach(){
  590. this.getlist()
  591. },
  592. getGoodTypeName(id){
  593. var type_name = ""
  594. for(let i=0;i<this.goodTypeList.length;i++){
  595. if(id == this.goodTypeList[i].id){
  596. type_name = this.goodTypeList[i].type_name
  597. }
  598. }
  599. return type_name
  600. },
  601. getHouseName(id){
  602. var storehouse_name = ""
  603. for(let i=0;i<this.houseList.length;i++){
  604. if(id == this.houseList[i].id){
  605. storehouse_name = this.houseList[i].storehouse_name
  606. }
  607. }
  608. return storehouse_name
  609. },
  610. getWareInfoCount(val,storehouse_id){
  611. var count = 0
  612. if(val.length > 0){
  613. for(let i=0;i<val.length;i++){
  614. if(val[i].storehouse_id == storehouse_id){
  615. count +=val[i].warehousing_count
  616. }
  617. }
  618. }
  619. if(count > 0){
  620. return count
  621. }else{
  622. return ""
  623. }
  624. },
  625. getOverFlushInfo(arr, max_unit, min_unit, min_number) {
  626. console.log("ar232323232323232wo",arr)
  627. var max_str = "";
  628. var min_str = "";
  629. var total = 0;
  630. var newarr = arr;
  631. if (newarr.length > 0) {
  632. for (let i = 0; i < newarr.length; i++) {
  633. total += newarr[i].stock_max_number + newarr[i].stock_min_number;
  634. }
  635. }
  636. if (total < min_number) {
  637. min_str = total + min_unit;
  638. }
  639. if (total == 0) {
  640. min_str = "";
  641. max_str = "";
  642. }
  643. if (total >= min_number) {
  644. if (parseInt(total / min_number) != 0) {
  645. max_str = parseInt(total / min_number) + max_unit;
  646. }
  647. if (total % min_number != 0) {
  648. min_str = (total % min_number) + min_unit;
  649. }
  650. }
  651. return max_str + min_str;
  652. },
  653. toDialogClick(id,drug_name,dose,dose_unit,min_number,min_unit,max_unit,storehouse_id){
  654. this.drug_id = id
  655. this.drug_name = drug_name
  656. this.dose = dose
  657. this.dose_unit = dose_unit
  658. this.min_number = min_number
  659. this.min_unit = min_unit
  660. this.max_unit = max_unit
  661. this.specification_name = dose + dose_unit + "*"+min_number+min_unit +"/"+ max_unit
  662. this.storehouseId = storehouse_id
  663. var params = {
  664. drug_id:id,
  665. limit:this.limitone,
  666. page:this.pageone,
  667. start_first_time:this.start_first_time,
  668. end_first_time:this.end_first_time,
  669. storehouse_id:storehouse_id,
  670. }
  671. getDrugWarehouseOutInfoById(params).then(response=>{
  672. if(response.data.state == 1){
  673. var list = response.data.data.list
  674. console.log("list23233233232w",list)
  675. this.tableData = list
  676. var flushList = response.data.data.flushList
  677. console.log("flushList",flushList)
  678. this.flushList = flushList
  679. var flushListOne = response.data.data.flushListOne
  680. this.flushListOne = flushListOne
  681. this.totalone = response.data.data.total
  682. this.dialogVisible = true
  683. }
  684. })
  685. },
  686. startFirstTimeChange(){
  687. this.toDialogClick(this.drug_id,this.drug_name,this.dose,this.dose_unit,this.min_number,this.min_unit,this.max_unit,this.storehouseId)
  688. },
  689. endEndTimeChange(){
  690. this.toDialogClick(this.drug_id,this.drug_name,this.dose,this.dose_unit,this.min_number,this.min_unit,this.max_unit,this.storehouseId)
  691. },
  692. getTime(val) {
  693. if(val < 0){
  694. return ""
  695. }
  696. if(val == ""){
  697. return ""
  698. }else {
  699. return uParseTime(val, '{y}-{m}-{d}')
  700. }
  701. },
  702. getTimeOne(val) {
  703. if(val < 0){
  704. return ""
  705. }
  706. if(val == ""){
  707. return ""
  708. }else {
  709. return uParseTime(val, '{y}-{m}-{d} {h}:{i}')
  710. }
  711. },
  712. getName(id){
  713. var name = ""
  714. for(let i=0;i<this.patientList.length;i++){
  715. if(id == this.patientList[i].id){
  716. name = this.patientList[i].name
  717. }
  718. }
  719. return name
  720. },
  721. getDrugTypeName(id){
  722. var type_name = ""
  723. for(let i=0;i<this.drugTypeList.length;i++){
  724. if(id == this.drugTypeList[i].value){
  725. type_name = this.drugTypeList[i].name
  726. }
  727. }
  728. return type_name
  729. },
  730. getWarehoseInfoSeven(arr, max_unit, min_unit, min_number, storehouse_id) {
  731. var total = 0;
  732. var max_str = "";
  733. var min_str = "";
  734. if (arr.length > 0) {
  735. for (let i = 0; i < arr.length; i++) {
  736. if (arr[i].storehouse_id == storehouse_id) {
  737. total += parseInt(arr[i].warehousing_count);
  738. }
  739. }
  740. }
  741. if (total < min_number) {
  742. min_str = total + min_unit;
  743. }
  744. if (total == 0) {
  745. min_str = "";
  746. max_str = "";
  747. }
  748. if (total >= min_number) {
  749. if (parseInt(total / min_number) != 0) {
  750. max_str = parseInt(total / min_number) + max_unit;
  751. }
  752. if (total % min_number != 0) {
  753. min_str = (total % min_number) + min_unit;
  754. }
  755. }
  756. return max_str + min_str;
  757. },
  758. getOutFlushNightSix(info, max_unit, min_unit,min_number,storehouse_id,val){
  759. var str = "";
  760. var str_min = "";
  761. //总库存
  762. var total = 0;
  763. var total_one = 0
  764. var total_two = 0
  765. for (let i = 0; i < info.length; i++) {
  766. if (info[i].storehouse_id == storehouse_id) {
  767. total_one += info[i].count;
  768. }
  769. }
  770. if(val!=null && val.length > 0){
  771. for (let i = 0; i < val.length; i++) {
  772. if (val[i].storehouse_id == storehouse_id) {
  773. total_two += val[i].count;
  774. }
  775. }
  776. }
  777. if((total_one - total_two) > 0){
  778. total = total_one - total_two
  779. }
  780. if (parseInt(total / min_number) != 0) {
  781. str = parseInt(total / min_number) + max_unit;
  782. }
  783. if (total % min_number != 0) {
  784. str_min = (total % min_number) + min_unit;
  785. }
  786. return str + str_min;
  787. },
  788. getOutFlushNightSeven(info, max_unit, min_unit,min_number,storehouse_id){
  789. var str = "";
  790. var str_min = "";
  791. //总库存
  792. var total = 0;
  793. var totalOne = 0
  794. var totalTwo = 0
  795. if(info!=null && info.length > 0){
  796. for (let i = 0; i < info.length; i++) {
  797. if (info[i].storehouse_id == storehouse_id) {
  798. totalOne += info[i].count;
  799. }
  800. }
  801. }
  802. total = totalOne
  803. if (parseInt(total / min_number) != 0) {
  804. str = parseInt(total / min_number) + max_unit;
  805. }
  806. if (total % min_number != 0) {
  807. str_min = (total % min_number) + min_unit;
  808. }
  809. return str + str_min;
  810. },
  811. getOutFlushNight(info, max_unit, min_unit,min_number, cancel_info,storehouse_id){
  812. var str = "";
  813. var str_min = "";
  814. //总库存
  815. var total = 0;
  816. var out_count = 0;
  817. var over_count = 0;
  818. var cancel_count = 0;
  819. for (let i = 0; i < info.length; i++) {
  820. if (info[i].storehouse_id == storehouse_id) {
  821. total += info[i].warehousing_count;
  822. }
  823. }
  824. for (let j = 0; j < info.length; j++) {
  825. if (info[j].storehouse_id == storehouse_id) {
  826. out_count += info[j].stock_max_number + info[j].stock_min_number;
  827. }
  828. }
  829. over_count = total - out_count;
  830. if (parseInt(over_count / min_number) != 0) {
  831. str = parseInt(over_count / min_number) + max_unit;
  832. }
  833. if (over_count % min_number != 0) {
  834. str_min = (over_count % min_number) + min_unit;
  835. }
  836. return str + str_min;
  837. },
  838. getOverFlushInfoEight(arr, max_unit, min_unit, min_number, storehouse_id) {
  839. var max_str = "";
  840. var min_str = "";
  841. var total = 0;
  842. var newarr = arr;
  843. if (newarr.length > 0) {
  844. for (let i = 0; i < newarr.length; i++) {
  845. if (newarr[i].storehouse_id == storehouse_id) {
  846. total += newarr[i].stock_max_number + newarr[i].stock_min_number;
  847. }
  848. }
  849. }
  850. if (total < min_number) {
  851. min_str = total + min_unit;
  852. }
  853. if (total == 0) {
  854. min_str = "";
  855. max_str = "";
  856. }
  857. if (total >= min_number) {
  858. if (parseInt(total / min_number) != 0) {
  859. max_str = parseInt(total / min_number) + max_unit;
  860. }
  861. if (total % min_number != 0) {
  862. min_str = (total % min_number) + min_unit;
  863. }
  864. }
  865. return max_str + min_str;
  866. },
  867. getWarehoseInfo(arr) {
  868. var total = 0;
  869. if (arr.length > 0) {
  870. for (let i = 0; i < arr.length; i++) {
  871. total += parseInt(arr[i].warehousing_count);
  872. }
  873. }
  874. if (total == 0) {
  875. total = "";
  876. }
  877. return total;
  878. },
  879. getOutFlushTen(info, max_unit, min_unit,min_number,storehouse_id){
  880. var str = "";
  881. var str_min = "";
  882. //总库存
  883. var total = 0;
  884. for (let i = 0; i < info.length; i++) {
  885. if (info[i].storehouse_id == storehouse_id) {
  886. total += info[i].count;
  887. }
  888. }
  889. if (parseInt(total / min_number) != 0) {
  890. str = parseInt(total / min_number) + max_unit;
  891. }
  892. if (total % min_number != 0) {
  893. str_min = (total % min_number) + min_unit;
  894. }
  895. return str + str_min;
  896. },
  897. getDrugOut(info, max_unit, min_unit,min_number,storehouse_id,cancel_stock_info){
  898. var str = "";
  899. var str_min = "";
  900. var cancel_count = 0
  901. var cha_count = 0
  902. //总库存
  903. var total = 0;
  904. for (let i = 0; i < info.length; i++) {
  905. if (info[i].storehouse_id == storehouse_id) {
  906. total += info[i].count;
  907. }
  908. }
  909. for (let i = 0; i < cancel_stock_info.length; i++) {
  910. if(cancel_stock_info[i].storehouse_id == storehouse_id) {
  911. cancel_count += cancel_stock_info[i].count;
  912. }
  913. }
  914. cha_count = total - cancel_count
  915. if (parseInt(cha_count / min_number) != 0) {
  916. str = parseInt(cha_count / min_number) + max_unit;
  917. }
  918. if (cha_count % min_number != 0) {
  919. str_min = (cha_count % min_number) + min_unit;
  920. }
  921. return str + str_min;
  922. },
  923. handleDetail(val) {
  924. var manufacturer_name = "";
  925. for (let i = 0; i < this.manufacturerList.length; i++) {
  926. if (val.manufacturer == this.manufacturerList[i].id) {
  927. manufacturer_name = this.manufacturerList[i].manufacturer_name;
  928. }
  929. }
  930. var over_plus = this.getOverFlushInfo(
  931. val.drug_warehouse_info,
  932. val.max_unit,
  933. val.min_unit,
  934. val.min_number
  935. );
  936. this.$router.push({
  937. path:
  938. "/drugstock/in/drugstockflow?drug_id=" +
  939. val.id +
  940. "&manufacturer=" +
  941. manufacturer_name +
  942. "&min_number=" +
  943. val.min_number +
  944. "&max_unit=" +
  945. val.max_unit +
  946. "&min_unit=" +
  947. val.min_unit +
  948. "&over_plus=" +
  949. over_plus,
  950. });
  951. window.sessionStorage.setItem("start_time", this.start_time);
  952. window.sessionStorage.setItem("end_time", this.end_time);
  953. },
  954. handleBatch(val) {
  955. var manufacturer_name = "";
  956. for (let i = 0; i < this.manufacturerList.length; i++) {
  957. if (val.manufacturer == this.manufacturerList[i].id) {
  958. manufacturer_name = this.manufacturerList[i].manufacturer_name;
  959. }
  960. }
  961. var unit =
  962. val.dose +
  963. val.dose_unit +
  964. "*" +
  965. val.min_number +
  966. val.min_unit +
  967. "/" +
  968. val.max_unit;
  969. var over_plus = this.getOverFlushInfo(
  970. val.drug_warehouse_info,
  971. val.max_unit,
  972. val.min_unit,
  973. val.min_number
  974. );
  975. window.sessionStorage.setItem("start_time", this.start_time);
  976. window.sessionStorage.setItem("end_time", this.end_time);
  977. this.$router.push({
  978. path:
  979. "/drugstock/in/drugbatchnumber?drug_id=" +
  980. val.id +
  981. "&manufacturer=" +
  982. manufacturer_name +
  983. "&unit=" +
  984. unit +
  985. "&min_number=" +
  986. val.min_number +
  987. "&max_unit=" +
  988. val.max_unit +
  989. "&min_unit=" +
  990. val.min_unit +
  991. "&over_plus=" +
  992. over_plus,
  993. });
  994. },
  995. handleCheckBatch(row){
  996. this.drug_id = row.id
  997. getCheckDrugBatchList(row.id).then(response=>{
  998. if(response.data.state ==1){
  999. var advicelist = response.data.data.advicelist
  1000. var baseDrugList = response.data.data.baseDrugList
  1001. var newArr= []
  1002. var newArrOne = []
  1003. if (advicelist.length >0){
  1004. for(let i=0;i<advicelist.length;i++){
  1005. advicelist[i].is_check_count =0
  1006. if(advicelist[i].prescribing_number_unit == baseDrugList.max_unit && baseDrugList.max_unit!=baseDrugList.min_unit){
  1007. advicelist[i].is_check_count = advicelist[i].prescribing_number * baseDrugList.min_number
  1008. }
  1009. if(advicelist[i].prescribing_number_unit == baseDrugList.min_unit && baseDrugList.max_unit!=baseDrugList.min_unit){
  1010. advicelist[i].is_check_count = advicelist[i].prescribing_number
  1011. }
  1012. if(advicelist[i].prescribing_number_unit == baseDrugList.max_unit && baseDrugList.max_unit==baseDrugList.min_unit){
  1013. advicelist[i].is_check_count = advicelist[i].prescribing_number
  1014. }
  1015. }
  1016. console.log("advicelist",advicelist)
  1017. let dataInfoOne = {}
  1018. advicelist.forEach((item, index) => {
  1019. let { advice_date } = item
  1020. if (!dataInfoOne[advice_date]) {
  1021. dataInfoOne[advice_date] = {
  1022. advice_date:item.advice_date,
  1023. check_count:0,
  1024. child:[]
  1025. }
  1026. }
  1027. })
  1028. let hisarr = Object.values(dataInfoOne)
  1029. if(hisarr!=null && hisarr.length>0){
  1030. for(let i=0;i<hisarr.length;i++){
  1031. for(let j=0;j<advicelist.length;j++){
  1032. if(hisarr[i].advice_date == advicelist[j].advice_date){
  1033. hisarr[i].child.push(advicelist[j])
  1034. }
  1035. }
  1036. }
  1037. }
  1038. for(let i=0;i<hisarr.length;i++){
  1039. for(let j=0;j<hisarr[i].child.length;j++){
  1040. hisarr[i].check_count +=hisarr[i].child[j].is_check_count
  1041. }
  1042. }
  1043. console.log("00000000000000000",hisarr)
  1044. newArr=hisarr
  1045. this.checkData = []
  1046. this.checkData = hisarr
  1047. }
  1048. var outInfo = response.data.data.outInfo
  1049. if(outInfo.length>0){
  1050. for(let i=0;i<outInfo.length;i++){
  1051. outInfo[i].is_check_count =0
  1052. if(outInfo[i].count_unit == baseDrugList.max_unit && baseDrugList.max_unit!=baseDrugList.min_unit){
  1053. outInfo[i].is_check_count = outInfo[i].count * baseDrugList.min_number
  1054. }
  1055. if(outInfo[i].count_unit == baseDrugList.min_unit && baseDrugList.max_unit!=baseDrugList.min_unit){
  1056. outInfo[i].is_check_count = outInfo[i].count
  1057. }
  1058. if(outInfo[i].count_unit == baseDrugList.max_unit && baseDrugList.max_unit==baseDrugList.min_unit){
  1059. outInfo[i].is_check_count = outInfo[i].count
  1060. }
  1061. }
  1062. let dataInfoOne = {}
  1063. outInfo.forEach((item, index) => {
  1064. let { sys_record_time } = item
  1065. if (!dataInfoOne[sys_record_time]) {
  1066. dataInfoOne[sys_record_time] = {
  1067. sys_record_time:item.sys_record_time,
  1068. check_count:0,
  1069. child:[]
  1070. }
  1071. }
  1072. })
  1073. let hisarr = Object.values(dataInfoOne)
  1074. if(hisarr!=null && hisarr.length>0){
  1075. for(let i=0;i<hisarr.length;i++){
  1076. for(let j=0;j<outInfo.length;j++){
  1077. if(hisarr[i].sys_record_time == outInfo[j].sys_record_time){
  1078. hisarr[i].child.push(outInfo[j])
  1079. }
  1080. }
  1081. }
  1082. }
  1083. for(let i=0;i<hisarr.length;i++){
  1084. for(let j=0;j<hisarr[i].child.length;j++){
  1085. hisarr[i].check_count +=hisarr[i].child[j].is_check_count
  1086. }
  1087. }
  1088. console.log("00000000000000000",hisarr)
  1089. newArrOne = hisarr
  1090. this.outData=[]
  1091. this.outData = hisarr
  1092. }
  1093. console.log("newArrOne",newArrOne)
  1094. console.log("newarr",newArr)
  1095. var outInfoOne = response.data.data.outInfoOne
  1096. var drugflow = response.data.data.drugflow
  1097. this.checkdialogVisible = true
  1098. }
  1099. })
  1100. },
  1101. getCount(advice_date){
  1102. var count = 0
  1103. for(let i=0;i<this.outData.length;i++){
  1104. if(advice_date == this.outData[i].sys_record_time){
  1105. count = this.outData[i].check_count
  1106. }
  1107. }
  1108. return count
  1109. },
  1110. // 合并单元格样式
  1111. cellStyle({ row, column, rowIndex, columnIndex }) {
  1112. let arr = [5,6, 7, 8, 9,10,11];
  1113. if (arr.indexOf(columnIndex) > -1) {
  1114. return "spanClass";
  1115. }
  1116. },
  1117. hide: function() {
  1118. this.visibility = false
  1119. },
  1120. toSet: function() {
  1121. this.getConfig()
  1122. this.visibility = true
  1123. }, changeOpen(val) {
  1124. var message = ''
  1125. if (val == 1) {
  1126. message = '启用药品自动扣减功能'
  1127. } else {
  1128. message = '关闭药品自动扣减功能'
  1129. }
  1130. this.$confirm(message, '提示', {
  1131. confirmButtonText: '确定',
  1132. cancelButtonText: '取消',
  1133. type: 'info'
  1134. }).then(() => {
  1135. createDrugStockAutomaticReduceConfig(val).then(response => {
  1136. if (response.data.state == 0) {
  1137. this.$message.error(response.data.msg)
  1138. return false
  1139. } else {
  1140. if (response.data.data.is_open == 1) {
  1141. this.is_open = true
  1142. this.$message({
  1143. type: 'success',
  1144. message: '已启用'
  1145. })
  1146. } else {
  1147. this.is_open = false
  1148. this.$message({
  1149. type: 'success',
  1150. message: '已关闭'
  1151. })
  1152. }
  1153. }
  1154. })
  1155. }).catch(() => {
  1156. })
  1157. },
  1158. getConfig() {
  1159. getDrugStockAutomaticReduceConfig().then(response => {
  1160. if (response.data.state == 0) {
  1161. this.$message.error(response.data.msg)
  1162. return false
  1163. } else {
  1164. var config = response.data.data.config
  1165. if (config.is_open == 1) {
  1166. this.is_open = true
  1167. } else {
  1168. this.is_open = false
  1169. }
  1170. }
  1171. })
  1172. },
  1173. printOrder() {
  1174. this.$router.push("/drugs/query/print?start_time="+this.start_time+"&end_time="+this.end_time+"&keyword="+this.keyword+"&storehouse_id="+this.storehouse_id+"&page="+this.page+"&limit="+this.limit+"&good_type="+this.good_type)
  1175. },
  1176. exportStock() {
  1177. console.log("tablelist23322332",this.tableList)
  1178. if(this.tableList!=null && this.tableList.length > 0){
  1179. for(let i=0;i<this.tableList.length;i++){
  1180. this.tableList[i].index = i +1
  1181. this.tableList[i].drug_type_name = this.getDrugTypeName(this.tableList[i].drug_type)
  1182. this.tableList[i].specification_name = this.tableList[i].dose + this.tableList[i].dose_unit + "*" +this.tableList[i].min_number + this.tableList[i].min_unit +"/"+this.tableList[i].max_unit
  1183. this.tableList[i].manufacturer_name = this.getManufacturName(this.tableList[i].manufacturer)
  1184. this.tableList[i].dealer_name = this.getDearName(this.tableList[i].dealer)
  1185. this.tableList[i].stock_in_count = this.getStockIn(this.tableList[i].drug_stock_count, this.tableList[i].max_unit, this.tableList[i].min_unit,this.tableList[i].min_number);
  1186. this.tableList[i].stock_out_count = this.getActCount(this.tableList[i].drug_stock_count,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number)
  1187. this.tableList[i].cancle_out_count = this.getCancleOut(this.tableList[i].drug_stock_count,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number)
  1188. this.tableList[i].act_cout = this.getStockOut(this.tableList[i].drug_stock_count,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number,this.tableList[i].drug_cancel_stock_info)
  1189. this.tableList[i].over_count = this.getOverCount(this.tableList[i].drug_stock_count,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number)
  1190. this.tableList[i].sum_count = this.getOverCount(this.tableList[i].drug_stock_count,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number)
  1191. }
  1192. }
  1193. import("@/vendor/Export2Excel").then((excel) => {
  1194. const tHeader = [
  1195. "序号",
  1196. "药品类型",
  1197. "药品名称",
  1198. "规格&单位",
  1199. "生产厂商",
  1200. "经销商",
  1201. "批准文号",
  1202. "国家编码",
  1203. "入库数量",
  1204. "出库数量",
  1205. "退库数量",
  1206. "实际出库",
  1207. "剩余库存",
  1208. "总库存",
  1209. ];
  1210. const filterVal = [
  1211. "index",
  1212. "drug_type_name",
  1213. "drug_name",
  1214. "specification_name",
  1215. "manufacturer_name",
  1216. "dealer_name",
  1217. "number",
  1218. "medical_insurance_number",
  1219. "stock_in_count",
  1220. "stock_out_count",
  1221. "cancle_out_count",
  1222. "act_cout",
  1223. "over_count",
  1224. "sum_count",
  1225. ];
  1226. const data = this.formatJson(filterVal, this.tableList);
  1227. excel.export_json_to_excel({
  1228. header: tHeader,
  1229. data,
  1230. filename: "药品查询",
  1231. });
  1232. this.downloadLoading = false;
  1233. });
  1234. },
  1235. formatJson(filterVal, jsonData) {
  1236. return jsonData.map((v) => filterVal.map((j) => v[j]));
  1237. },
  1238. getDrugType(id) {
  1239. var name = "";
  1240. for (let i = 0; i < this.drugTypeList.length; i++) {
  1241. if (this.drugTypeList[i].id == id) {
  1242. name = this.drugTypeList[i].name;
  1243. }
  1244. }
  1245. return name;
  1246. },
  1247. getManufacturerList(id) {
  1248. var name = "";
  1249. for (let i = 0; i < this.manufacturerList.length; i++) {
  1250. if (id == this.manufacturerList[i].id) {
  1251. name = this.manufacturerList[i].manufacturer_name;
  1252. }
  1253. }
  1254. return name;
  1255. },
  1256. getWarehoseInfoOne(arr, max_unit, min_unit, min_number) {
  1257. var total = 0;
  1258. var max_str = "";
  1259. var min_str = "";
  1260. if (arr.length > 0) {
  1261. for (let i = 0; i < arr.length; i++) {
  1262. total += parseInt(arr[i].warehousing_count);
  1263. }
  1264. }
  1265. if (total < min_number) {
  1266. min_str = total + min_unit;
  1267. }
  1268. if (total == 0) {
  1269. min_str = "";
  1270. max_str = "";
  1271. }
  1272. if (total >= min_number) {
  1273. if (parseInt(total / min_number) != 0) {
  1274. max_str = parseInt(total / min_number) + max_unit;
  1275. }
  1276. if (total % min_number != 0) {
  1277. min_str = (total % min_number) + min_unit;
  1278. }
  1279. }
  1280. return max_str + min_str;
  1281. },
  1282. getWarehouseOutInfo(arr, max_unit, min_unit, min_number) {
  1283. var min_str = "";
  1284. var max_str = "";
  1285. var total = 0;
  1286. if (arr.length > 0) {
  1287. for (let i = 0; i < arr.length; i++) {
  1288. total += parseInt(arr[i].count);
  1289. }
  1290. }
  1291. if (total < min_number) {
  1292. min_str = total + min_unit;
  1293. }
  1294. if (total == 0) {
  1295. min_str = "";
  1296. max_str = "";
  1297. }
  1298. if (total >= min_number) {
  1299. if (parseInt(total / min_number) != 0) {
  1300. max_str = parseInt(total / min_number) + max_unit;
  1301. }
  1302. if (total % min_number != 0) {
  1303. min_str = (total % min_number) + min_unit;
  1304. }
  1305. }
  1306. return max_str + min_str;
  1307. },
  1308. getStockIn(arr, max_unit, min_unit, min_number) {
  1309. var total = 0;
  1310. var max_str = "";
  1311. var min_str = "";
  1312. if (arr.length > 0) {
  1313. for (let i = 0; i < arr.length; i++) {
  1314. total += parseInt(arr[i].sum_in_count);
  1315. }
  1316. }
  1317. if (total < min_number) {
  1318. min_str = total + min_unit;
  1319. }
  1320. if (total == 0) {
  1321. min_str = "";
  1322. max_str = "";
  1323. }
  1324. if (total >= min_number) {
  1325. if (parseInt(total / min_number) != 0) {
  1326. max_str = parseInt(total / min_number) + max_unit;
  1327. }
  1328. if (total % min_number != 0) {
  1329. min_str = (total % min_number) + min_unit;
  1330. }
  1331. }
  1332. return max_str + min_str;
  1333. },
  1334. getStockOut(info, max_unit, min_unit,min_number,val){
  1335. var str = "";
  1336. var str_min = "";
  1337. //总库存
  1338. var total = 0;
  1339. var totalOne = 0
  1340. // var totalTwo = 0
  1341. if(info!=null && info.length > 0){
  1342. for (let i = 0; i < info.length; i++) {
  1343. totalOne += info[i].sum_out_count;
  1344. }
  1345. }
  1346. // if(val!=null && val.length > 0){
  1347. // for (let i = 0; i < val.length; i++) {
  1348. // totalTwo += val[i].sum_cancel_count;
  1349. // }
  1350. // }
  1351. total = totalOne
  1352. if (parseInt(total / min_number) != 0) {
  1353. str = parseInt(total / min_number) + max_unit;
  1354. }
  1355. if (total % min_number != 0) {
  1356. str_min = (total % min_number) + min_unit;
  1357. }
  1358. return str + str_min;
  1359. },
  1360. getCancleOut(info, max_unit, min_unit,min_number){
  1361. var str = "";
  1362. var str_min = "";
  1363. //总库存
  1364. var total = 0;
  1365. for (let i = 0; i < info.length; i++) {
  1366. total += info[i].sum_cancel_count;
  1367. }
  1368. if (parseInt(total / min_number) != 0) {
  1369. str = parseInt(total / min_number) + max_unit;
  1370. }
  1371. if (total % min_number != 0) {
  1372. str_min = (total % min_number) + min_unit;
  1373. }
  1374. return str + str_min;
  1375. },
  1376. getActCount(info, max_unit, min_unit,min_number){
  1377. var str = "";
  1378. var str_min = "";
  1379. //总库存
  1380. var total = 0;
  1381. for (let i = 0; i < info.length; i++) {
  1382. total += info[i].sum_act_out_count;
  1383. }
  1384. if (parseInt(total / min_number) != 0) {
  1385. str = parseInt(total / min_number) + max_unit;
  1386. }
  1387. if (total % min_number != 0) {
  1388. str_min = (total % min_number) + min_unit;
  1389. }
  1390. return str + str_min;
  1391. },
  1392. getOverCount(arr, max_unit, min_unit, min_number) {
  1393. var max_str = "";
  1394. var min_str = "";
  1395. var total = 0;
  1396. if (arr.length > 0) {
  1397. for (let i = 0; i < arr.length; i++) {
  1398. total += arr[i].flush_count
  1399. }
  1400. }
  1401. if (total < min_number) {
  1402. min_str = total + min_unit;
  1403. }
  1404. if (total == 0) {
  1405. min_str = "";
  1406. max_str = "";
  1407. }
  1408. if (total >= min_number) {
  1409. if (parseInt(total / min_number) != 0) {
  1410. max_str = parseInt(total / min_number) + max_unit;
  1411. }
  1412. if (total % min_number != 0) {
  1413. min_str = (total % min_number) + min_unit;
  1414. }
  1415. }
  1416. return max_str + min_str;
  1417. },
  1418. //修改后的
  1419. getDrugIn(storehouse_id,val,max_unit,min_unit,min_number){
  1420. var max_str = "";
  1421. var min_str = "";
  1422. var total = 0;
  1423. if(val!=null && val!=undefined){
  1424. for(let i=0;i<val.length;i++){
  1425. if(storehouse_id == val[i].storehouse_id){
  1426. total = val[i].sum_in_count
  1427. }
  1428. }
  1429. }
  1430. if (total < min_number) {
  1431. min_str = total + min_unit;
  1432. }
  1433. if (total == 0) {
  1434. min_str = "";
  1435. max_str = "";
  1436. }
  1437. if (total >= min_number) {
  1438. if (parseInt(total / min_number) != 0) {
  1439. max_str = parseInt(total / min_number) + max_unit;
  1440. }
  1441. if (total % min_number != 0) {
  1442. min_str = (total % min_number) + min_unit;
  1443. }
  1444. }
  1445. return max_str + min_str;
  1446. },
  1447. getDrugOut(storehouse_id,val,max_unit,min_unit,min_number){
  1448. var max_str = "";
  1449. var min_str = "";
  1450. var total = 0;
  1451. if(val!=null && val!=undefined){
  1452. for(let i=0;i<val.length;i++){
  1453. if(storehouse_id == val[i].storehouse_id){
  1454. total = val[i].sum_out_count
  1455. }
  1456. }
  1457. }
  1458. if (total < min_number) {
  1459. min_str = total + min_unit;
  1460. }
  1461. if (total == 0) {
  1462. min_str = "";
  1463. max_str = "";
  1464. }
  1465. if (total >= min_number) {
  1466. if (parseInt(total / min_number) != 0) {
  1467. max_str = parseInt(total / min_number) + max_unit;
  1468. }
  1469. if (total % min_number != 0) {
  1470. min_str = (total % min_number) + min_unit;
  1471. }
  1472. }
  1473. return max_str + min_str;
  1474. },
  1475. getDrugCancel(storehouse_id,val,max_unit,min_unit,min_number){
  1476. var max_str = "";
  1477. var min_str = "";
  1478. var total = 0;
  1479. if(val!=null && val!=undefined){
  1480. for(let i=0;i<val.length;i++){
  1481. if(storehouse_id == val[i].storehouse_id){
  1482. total = val[i].sum_cancel_count
  1483. }
  1484. }
  1485. }
  1486. if (total < min_number) {
  1487. min_str = total + min_unit;
  1488. }
  1489. if (total == 0) {
  1490. min_str = "";
  1491. max_str = "";
  1492. }
  1493. if (total >= min_number) {
  1494. if (parseInt(total / min_number) != 0) {
  1495. max_str = parseInt(total / min_number) + max_unit;
  1496. }
  1497. if (total % min_number != 0) {
  1498. min_str = (total % min_number) + min_unit;
  1499. }
  1500. }
  1501. return max_str + min_str;
  1502. },
  1503. getActOut(storehouse_id,val,max_unit,min_unit,min_number){
  1504. var max_str = "";
  1505. var min_str = "";
  1506. var total = 0;
  1507. if(val!=null && val!=undefined){
  1508. for(let i=0;i<val.length;i++){
  1509. if(storehouse_id == val[i].storehouse_id){
  1510. total = val[i].sum_act_out_count
  1511. }
  1512. }
  1513. }
  1514. if (total < min_number) {
  1515. min_str = total + min_unit;
  1516. }
  1517. if (total == 0) {
  1518. min_str = "";
  1519. max_str = "";
  1520. }
  1521. if (total >= min_number) {
  1522. if (parseInt(total / min_number) != 0) {
  1523. max_str = parseInt(total / min_number) + max_unit;
  1524. }
  1525. if (total % min_number != 0) {
  1526. min_str = (total % min_number) + min_unit;
  1527. }
  1528. }
  1529. return max_str + min_str;
  1530. },
  1531. getFlushCount(storehouse_id,val,max_unit,min_unit,min_number){
  1532. var max_str = "";
  1533. var min_str = "";
  1534. var total = 0;
  1535. if(val!=null && val!=undefined){
  1536. for(let i=0;i<val.length;i++){
  1537. if(storehouse_id == val[i].storehouse_id){
  1538. total = val[i].flush_count
  1539. }
  1540. }
  1541. }
  1542. if (total < min_number) {
  1543. min_str = total + min_unit;
  1544. }
  1545. if (total == 0) {
  1546. min_str = "";
  1547. max_str = "";
  1548. }
  1549. if (total >= min_number) {
  1550. if (parseInt(total / min_number) != 0) {
  1551. max_str = parseInt(total / min_number) + max_unit;
  1552. }
  1553. if (total % min_number != 0) {
  1554. min_str = (total % min_number) + min_unit;
  1555. }
  1556. }
  1557. return max_str + min_str;
  1558. },
  1559. getSumCount(val,max_unit,min_unit,min_number){
  1560. var max_str = "";
  1561. var min_str = "";
  1562. var total = 0;
  1563. if(val!=null && val!=undefined){
  1564. for(let i=0;i<val.length;i++){
  1565. total += val[i].flush_count
  1566. }
  1567. }
  1568. if (total < min_number) {
  1569. min_str = total + min_unit;
  1570. }
  1571. if (total == 0) {
  1572. min_str = "";
  1573. max_str = "";
  1574. }
  1575. if (total >= min_number) {
  1576. if (parseInt(total / min_number) != 0) {
  1577. max_str = parseInt(total / min_number) + max_unit;
  1578. }
  1579. if (total % min_number != 0) {
  1580. min_str = (total % min_number) + min_unit;
  1581. }
  1582. }
  1583. return max_str + min_str;
  1584. },
  1585. toCheck(){
  1586. getDrugInitDataList().then(response=>{
  1587. if(response.data.state == 1){
  1588. this.$message.success("保存成功!")
  1589. }
  1590. })
  1591. },
  1592. getDearName(id){
  1593. var dear_name = ""
  1594. for(let i=0;i<this.dealerList.length;i++){
  1595. if(id == this.dealerList[i].id){
  1596. dear_name = this.dealerList[i].dealer_name
  1597. }
  1598. }
  1599. return dear_name
  1600. },
  1601. },
  1602. created(){
  1603. this.getStorehouseList()
  1604. this.getlist()
  1605. }
  1606. }
  1607. </script>
  1608. <style>
  1609. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1610. font-size: 12px;
  1611. }
  1612. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1613. background: #6fb5fa;
  1614. }
  1615. .count {
  1616. color: #bd2c00;
  1617. }
  1618. .el-table td,
  1619. .el-table th.is-leaf,
  1620. .el-table--border,
  1621. .el-table--group {
  1622. border-color: #d0d3da;
  1623. }
  1624. .el-table--border::after,
  1625. .el-table--group::after,
  1626. .el-table::before {
  1627. background-color: #d0d3da;
  1628. }
  1629. /* 合并表格线样式 */
  1630. .spanClass .cell {
  1631. padding: 0 !important;
  1632. }
  1633. .spanClass .cell tr {
  1634. display: inline-block;
  1635. width: 100%;
  1636. }
  1637. .spanClass .cell tr td {
  1638. padding: 10px 0;
  1639. border-bottom: 1px solid #ebeef5;
  1640. display: block;
  1641. width: 100%;
  1642. }
  1643. .spanClass .cell tr:last-of-type td {
  1644. border-bottom: none;
  1645. }
  1646. </style>