drugQuery.vue 49KB

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