drugQuery.vue 50KB

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