drugQuery.vue 61KB

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