query.vue 29KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <div>
  6. <el-button
  7. size="small"
  8. class="filter-item"
  9. type="primary"
  10. @click="setting"
  11. >设置
  12. </el-button
  13. >
  14. <el-button
  15. size="small"
  16. class="filter-item"
  17. type="primary"
  18. icon="el-icon-printer"
  19. @click="printOrder"
  20. >打印
  21. </el-button>
  22. <el-button
  23. size="small"
  24. class="filter-item"
  25. type="primary"
  26. @click="exportStock"
  27. >导出
  28. </el-button>
  29. </div>
  30. </div>
  31. <div class="app-container ">
  32. <div class="cell clearfix">
  33. <el-select v-model="drug_type" style="width:160px;margin-right:10px;" placeholder="请选择" @change="changeDrug">
  34. <el-option
  35. v-for="(item,index) in drugTypeList"
  36. :key="index"
  37. :label="item.name"
  38. :value="item.id">
  39. </el-option>
  40. </el-select>
  41. <el-date-picker
  42. v-model="start_time"
  43. prefix-icon="el-icon-date"
  44. :editable="false"
  45. style="width: 196px;"
  46. type="date"
  47. placeholder="选择日期时间"
  48. align="right"
  49. format="yyyy-MM-dd"
  50. value-format="yyyy-MM-dd"
  51. @change="startTimeChange"
  52. ></el-date-picker>-
  53. <el-date-picker
  54. v-model="end_time"
  55. prefix-icon="el-icon-date"
  56. :editable="false"
  57. style="width: 196px;margin-right:10px;"
  58. type="date"
  59. placeholder="选择日期时间"
  60. align="right"
  61. format="yyyy-MM-dd"
  62. value-format="yyyy-MM-dd"
  63. @change="endTimeChange"
  64. ></el-date-picker>
  65. <el-input
  66. style="width: 200px;"
  67. class="filter-item"
  68. v-model.trim="keywords"
  69. placeholder="药品名称"
  70. />
  71. <el-button
  72. size="small"
  73. class="filter-item"
  74. type="primary"
  75. icon="el-icon-search"
  76. @click="search"
  77. >搜索
  78. </el-button>
  79. </div>
  80. <el-table :data="tableList" border style="width: 100%">
  81. <el-table-column prop="drug_type" label="药品类型" width="180" align="center">
  82. <template slot-scope="scope">
  83. {{getDrugType(scope.row.drug_type)}}
  84. </template>
  85. </el-table-column>
  86. <el-table-column prop="drug_name" label="药品名称" align="center">
  87. <template slot-scope="scope">
  88. {{scope.row.drug_name}}
  89. </template>
  90. </el-table-column>
  91. <el-table-column prop="drug_name" label="规格&&单位" align="center">
  92. <template slot-scope="scope">
  93. {{scope.row.dose + scope.row.dose_unit +"*"+scope.row.min_number+scope.row.min_unit+"/"+scope.row.max_unit}}
  94. </template>
  95. </el-table-column>
  96. <el-table-column prop="drug_name" label="进货单价" align="center">
  97. <template slot-scope="scope">
  98. {{scope.row.last_price}}
  99. </template>
  100. </el-table-column>
  101. <el-table-column prop="drug_name" label="厂家" align="center">
  102. <template slot-scope="scope">
  103. {{getManufacturerList(scope.row.manufacturer)}}
  104. </template>
  105. </el-table-column>
  106. <el-table-column prop="drug_name" label="入库数量" align="center">
  107. <template slot-scope="scope">
  108. <span v-if="getWarehoseInfo(scope.row.drug_warehouse_info)>0">{{getWarehoseInfo(scope.row.drug_warehouse_info)}}{{scope.row.max_unit}}</span>
  109. </template>
  110. </el-table-column>
  111. <el-table-column prop="drug_name" label="出库数量" align="center" v-if="showOne">
  112. <template slot-scope="scope">
  113. <span>
  114. {{getOutFlush(scope.row.drug_warehouse_info,scope.row.max_unit,scope.row.min_unit,scope.row.min_number,scope.row.drug_cancel_stock_info)}}
  115. </span>
  116. </template>
  117. </el-table-column>
  118. <el-table-column prop="drug_name" label="出库数量" align="center" v-if="showTwo">
  119. <template slot-scope="scope">
  120. <span>{{getOutCount(scope.row.id)+getAutoCount(scope.row.id)}}{{scope.row.max_unit}}</span>
  121. </template>
  122. </el-table-column>
  123. <el-table-column prop="drug_name" label="剩余库存量" align="center" v-if="showThree">
  124. <template slot-scope="scope">
  125. <div v-if="getWarehoseInfo(scope.row.drug_warehouse_info)>0">
  126. {{ getOverFlushInfo(scope.row.drug_warehouse_info,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)?getOverFlushInfo(scope.row.drug_warehouse_info,scope.row.max_unit,scope.row.min_unit,scope.row.min_number):0}}
  127. </div>
  128. </template>
  129. </el-table-column>
  130. <el-table-column prop="drug_name" label="剩余库存量" align="center" v-if="showFour">
  131. <template slot-scope="scope">
  132. <div v-if="getWarehoseInfo(scope.row.drug_warehouse_info) >0">
  133. <span>{{getWarehoseInfo(scope.row.drug_warehouse_info) - getOutCount(scope.row.id) - getAutoCount(scope.row.id)}}{{scope.row.max_unit}} </span>
  134. </div>
  135. </template>
  136. </el-table-column>
  137. <el-table-column prop="drug_name" label="操作" align="center" width="200px">
  138. <template slot-scope="scope">
  139. <el-button
  140. size="small"
  141. type="primary"
  142. @click="handleDetail(scope.row)"
  143. >库存流水
  144. </el-button>
  145. <el-button
  146. size="small"
  147. type="primary"
  148. @click="handleBatch(scope.row)"
  149. >批次
  150. </el-button>
  151. </template>
  152. </el-table-column>
  153. </el-table>
  154. <el-pagination
  155. @size-change="handleSizeChange"
  156. @current-change="handleCurrentChange"
  157. :page-sizes="[10, 50, 100,200,500,1000]"
  158. :page-size="10"
  159. background
  160. align="right"
  161. style="margin-top:20px;"
  162. layout="total, sizes, prev, pager, next, jumper"
  163. :total="total"
  164. >
  165. </el-pagination>
  166. </div>
  167. <setting-dialog
  168. ref="dialog"
  169. ></setting-dialog>
  170. </div>
  171. </template>
  172. <script>
  173. import { uParseTime } from '@/utils/tools'
  174. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  175. import { getDrugStockList,getDrugCountList } from '@/api/drug/drug_stock'
  176. import SettingDialog from './settingDialog/index'
  177. import { getDictionaryDataConfig } from "@/utils/data";
  178. import { min } from 'moment'
  179. export default {
  180. name: 'stockIn',
  181. created() {
  182. var start_time = window.sessionStorage.getItem('start_time')
  183. var end_time = window.sessionStorage.getItem('end_time')
  184. console.log("start_time",start_time,end_time)
  185. if(start_time !=null){
  186. this.start_time = start_time
  187. }
  188. if(end_time!=null){
  189. this.end_time = end_time
  190. }
  191. window.sessionStorage.removeItem('start_time')
  192. window.sessionStorage.removeItem('end_time')
  193. this.getlist()
  194. var drugCategory = getDictionaryDataConfig('system','drug_category')
  195. this.drugCategory.push(...drugCategory)
  196. var drugTypeList = getDictionaryDataConfig('system','drug_type')
  197. this.drugTypeList.push(...drugTypeList)
  198. this.org_id = this.$store.getters.xt_user.org.id
  199. console.log("机构ID",this.org_id)
  200. // this.getDrugCountList()
  201. },
  202. components: {
  203. SettingDialog,
  204. BreadCrumb
  205. },
  206. data() {
  207. return {
  208. crumbs: [
  209. { path: false, name: '库存管理' },
  210. { path: '/stock/drugs/stock/query', name: '药品库存查询' }
  211. ],
  212. keywords: '',
  213. multipleSelection: [],
  214. signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
  215. start_time: '',
  216. end_time: '',
  217. page: 1,
  218. limit: 10,
  219. total: 0,
  220. goodType: [],
  221. goodInfo: [],
  222. tempArr: [],
  223. sameRowArr: [],
  224. WarehouseInfo: {
  225. loading: false,
  226. warehouseInfoDate: []
  227. },
  228. tableData:[],
  229. drug_category:0,
  230. drugCategory:[
  231. {id:0,name:"全部"}
  232. ],
  233. drugTypeList:[
  234. {id:0,name:"全部"}
  235. ],
  236. tableList:[],
  237. manufacturerList:[],
  238. countList:[],
  239. outCountList:[],
  240. autoCountList:[],
  241. keyword:"",
  242. drug_type:0,
  243. minCount:[],
  244. drugOutList:[],
  245. cancelCountList:[],
  246. allCountList:[],
  247. org_id:"",
  248. showOne:true,
  249. showTwo:false,
  250. showThree:true,
  251. showFour:false,
  252. }
  253. },
  254. methods: {
  255. //获取库存
  256. getlist(){
  257. const params = {
  258. page: this.page,
  259. limit: this.limit,
  260. keyword: this.keywords,
  261. drug_type:this.drug_type,
  262. start_time:this.start_time,
  263. end_time:this.end_time,
  264. }
  265. getDrugStockList(params).then(response=>{
  266. if(response.data.state == 1){
  267. var list = response.data.data.list
  268. console.log("list99999",list)
  269. for(let i=0;i<list.length;i++){
  270. for(let j=0;j<list[i].drug_warehouse_info.length;j++){
  271. list[i].drug_warehouse_info[j].stock_max_number = list[i].min_number * list[i].drug_warehouse_info[j].stock_max_number
  272. }
  273. for(let y=0;y<list[i].drug_warehouse_out.length;y++){
  274. if(list[i].drug_warehouse_out[y].count_unit == list[i].max_unit){
  275. list[i].drug_warehouse_out[y].count = list[i].drug_warehouse_out[y].count * list[i].min_number
  276. }
  277. }
  278. for(let z=0;z<list[i].drug_cancel_stock_info.length;z++){
  279. if(list[i].drug_cancel_stock_info[z].max_unit == list[i].max_unit){
  280. list[i].drug_cancel_stock_info[z].count = list[i].drug_cancel_stock_info[z].count * list[i].min_number
  281. }
  282. }
  283. }
  284. console.log("列表list232323323232323223",list)
  285. this.tableList = list
  286. var total = response.data.data.total
  287. this.total = total
  288. this.manufacturerList = response.data.data.manufacturerList
  289. }
  290. })
  291. },
  292. handleSpanTempArr() {
  293. this.tempArr = []
  294. for (let i = 0; i < this.WarehouseInfo.warehouseInfoDate.length; i++) {
  295. if (i === 0) {
  296. this.tempArr.push(1)
  297. this.pos = 0
  298. } else {
  299. // 判断当前元素与上一个元素是否相同
  300. if (this.WarehouseInfo.warehouseInfoDate[i].drug_name === this.WarehouseInfo.warehouseInfoDate[i - 1].drug_name) {
  301. this.tempArr[this.pos] += 1
  302. this.tempArr.push(0)
  303. } else {
  304. this.tempArr.push(1)
  305. this.pos = i
  306. }
  307. }
  308. }
  309. let sameRowArr = [], sIdx = 0
  310. this.WarehouseInfo.warehouseInfoDate.forEach((item, index) => {
  311. item.index = index
  312. if (index === 0) {
  313. sameRowArr.push([index])
  314. } else {
  315. if (item.drug_name === this.WarehouseInfo.warehouseInfoDate[index - 1].drug_name) {
  316. sameRowArr[sIdx].push(index)
  317. } else {
  318. sIdx = sIdx + 1
  319. sameRowArr.push([index])
  320. }
  321. }
  322. })
  323. this.sameRowArr = sameRowArr
  324. },
  325. merge({ row, column, rowIndex, columnIndex }) {
  326. if (columnIndex === 0) {
  327. const _row = this.tempArr[rowIndex]
  328. const _col = _row > 0 ? 1 : 0
  329. return {
  330. rowspan: _row,
  331. colspan: _col
  332. }
  333. }
  334. },
  335. getSpecificationName: function(id) {
  336. let name = ''
  337. for (let i = 0; i < this.goodInfo.length; i++) {
  338. if (this.goodInfo[i].id == id) {
  339. name = this.goodInfo[i].specification_name
  340. }
  341. }
  342. return name
  343. },
  344. getTypeName: function(id) {
  345. let name = ''
  346. for (let i = 0; i < this.goodType.length; i++) {
  347. if (this.goodType[i].id == id) {
  348. name = this.goodType[i].type_name
  349. }
  350. }
  351. return name
  352. },
  353. handleBack: function() {
  354. this.$router.go(-1)
  355. },
  356. handleSizeChange(val) {
  357. this.limit = val
  358. this.getlist()
  359. },
  360. handleCurrentChange(val) {
  361. this.page = val
  362. this.getlist()
  363. },
  364. calculate: function(val) {
  365. return Math.round(parseFloat(val) * 100) / 100
  366. },
  367. startTimeChange: function(val) {
  368. window.sessionStorage.removeItem('start_time')
  369. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  370. if (time > 0) {
  371. this.$message.error("开始时间不能大于结束时间");
  372. this.start_time = "";
  373. } else {
  374. this.getlist()
  375. }
  376. },
  377. endTimeChange: function(val) {
  378. window.sessionStorage.removeItem('end_time')
  379. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  380. if (time < 0) {
  381. this.$message.error("结束时间不能小于开始时间");
  382. this.end_time = "";
  383. } else {
  384. if(this.end_time == ""){
  385. this.showOne = true
  386. this.showTwo = false
  387. this.showThree = true
  388. this.showFour = false
  389. this.getlist()
  390. }
  391. if(this.end_time !=""){
  392. this.showOne = false
  393. this.showTwo = true
  394. this.showThree = false
  395. this.showFour = true
  396. this.getlist()
  397. this.getDrugCountList()
  398. }
  399. }
  400. },
  401. stockInCount: function(row) {
  402. let total = 0
  403. for (let i = 0; i < row.query_drug_warehousing_info.length; i++) {
  404. total = total + row.query_drug_warehousing_info[i].warehousing_count
  405. }
  406. return total
  407. },
  408. salesReturnCount: function(row) {
  409. let total = 0
  410. for (let i = 0; i < row.query_drug_sales_return_info.length; i++) {
  411. total = total + row.query_drug_sales_return_info[i].count
  412. }
  413. return total
  414. },
  415. stockOutCount: function(row) {
  416. let total = 0
  417. for (let i = 0; i < row.query_drug_warehouseout_info.length; i++) {
  418. total = total + row.query_drug_warehouseout_info[i].count
  419. }
  420. return total
  421. },
  422. cancelStockCount: function(row) {
  423. let total = 0
  424. for (let i = 0; i < row.query_drug_cancel_stock_info.length; i++) {
  425. total = total + row.query_drug_cancel_stock_info[i].count
  426. }
  427. return total
  428. },
  429. search: function() {
  430. this.getlist()
  431. },
  432. setting: function() {
  433. this.$refs.dialog.show()
  434. },
  435. exportStock(){
  436. for(let i=0;i<this.tableList.length;i++){
  437. this.tableList[i].index = i+1
  438. this.tableList[i].drug_type_name = this.getDrugType(this.tableList[i].drug_type)
  439. this.tableList[i].unit = this.tableList[i].dose + this.tableList[i].dose_unit +"*"+this.tableList[i].min_number+this.tableList[i].min_unit+"/"+this.tableList[i].max_unit
  440. this.tableList[i].manufacturer_name = this.getManufacturerList(this.tableList[i].manufacturer)
  441. this.tableList[i].inCount = this.getWarehoseInfo(this.tableList[i].drug_warehouse_info)
  442. if(this.end_time == 0){
  443. this.tableList[i].outCount = this.getWarehouseOutInfo(this.tableList[i].drug_warehouse_out,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number)
  444. this.tableList[i].overplusCount = this.getOverFlushInfo(this.tableList[i].drug_warehouse_info,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number)
  445. }
  446. if(this.end_time!=0){
  447. this.tableList[i].outCount = this.getOutCount(this.tableList[i].id)+ this.getAutoCount(this.tableList[i].id)
  448. this.tableList[i].overplusCount = this.getWarehoseInfo(this.tableList[i].drug_warehouse_info) - this.getOutCount(this.tableList[i].id) - this.getAutoCount(this.tableList[i].id)
  449. }
  450. }
  451. import('@/vendor/Export2Excel').then(excel => {
  452. const tHeader = ['序号', '药品类型', '药品名称','规格型号&单位','进货单价','厂家','入库数量','出库数量','剩余库存量']
  453. const filterVal = ['index', 'drug_type_name', 'drug_name','unit','last_price','manufacturer_name','inCount','outCount','overplusCount']
  454. const data = this.formatJson(filterVal, this.tableList)
  455. excel.export_json_to_excel({
  456. header: tHeader,
  457. data,
  458. filename: '药品查询'
  459. })
  460. this.downloadLoading = false
  461. })
  462. },
  463. formatJson(filterVal, jsonData) {
  464. return jsonData.map(v => filterVal.map(j => v[j]));
  465. },
  466. getDictionaryDataConfig(module, filed_name) {
  467. return getDictionaryDataConfig(module, filed_name)
  468. },
  469. getTimestamp(time) { // 把时间日期转成时间戳
  470. return (new Date(time)).getTime() / 1000
  471. },
  472. changeDrug(){
  473. this.getlist()
  474. },
  475. printOrder(){
  476. window.sessionStorage.setItem('start_time',this.start_time)
  477. window.sessionStorage.setItem('end_time',this.end_time)
  478. this.$router.push({
  479. name: "drugQueryPrint",
  480. query: {drug_type:this.drug_type,keyword:this.keywords,start_time:this.start_time,end_time:this.end_time,page:this.page,limit:this.limit}
  481. });
  482. },
  483. getDrugType(id){
  484. var name = ""
  485. for(let i=0;i<this.drugTypeList.length;i++){
  486. if(this.drugTypeList[i].id == id){
  487. name = this.drugTypeList[i].name
  488. }
  489. }
  490. return name
  491. },
  492. getManufacturerList(id){
  493. var name = ""
  494. for(let i=0;i<this.manufacturerList.length;i++){
  495. if(id == this.manufacturerList[i].id){
  496. name = this.manufacturerList[i].manufacturer_name
  497. }
  498. }
  499. return name
  500. },
  501. handleDetail(val){
  502. console.log("val232332323223323",val)
  503. var manufacturer_name = ""
  504. for(let i=0;i<this.manufacturerList.length;i++){
  505. if(val.manufacturer == this.manufacturerList[i].id){
  506. manufacturer_name = this.manufacturerList[i].manufacturer_name
  507. }
  508. }
  509. var unit = val.dose + val.dose_unit +"*"+val.min_number+val.min_unit+"/"+val.max_unit
  510. var over_plus = this.getOverFlushInfo(val.drug_warehouse_info,val.max_unit,val.min_unit,val.min_number)
  511. this.$router.push({path:'/drugstock/in/drugstockflow?drug_id='+val.id+"&manufacturer="+manufacturer_name+"&unit="+unit+"&min_number="+val.min_number+"&max_unit="+val.max_unit+"&min_unit="+val.min_unit+"&over_plus="+over_plus})
  512. window.sessionStorage.setItem('start_time',this.start_time)
  513. window.sessionStorage.setItem('end_time',this.end_time)
  514. },
  515. handleBatch(val){
  516. var manufacturer_name = ""
  517. for(let i=0;i<this.manufacturerList.length;i++){
  518. if(val.manufacturer == this.manufacturerList[i].id){
  519. manufacturer_name = this.manufacturerList[i].manufacturer_name
  520. }
  521. }
  522. var unit = val.dose + val.dose_unit +"*"+val.min_number+val.min_unit+"/"+val.max_unit
  523. var over_plus = this.getOverFlushInfo(val.drug_warehouse_info,val.max_unit,val.min_unit,val.min_number)
  524. window.sessionStorage.setItem('start_time',this.start_time)
  525. window.sessionStorage.setItem('end_time',this.end_time)
  526. this.$router.push({path:'/drugstock/in/drugbatchnumber?drug_id='+val.id+"&manufacturer="+manufacturer_name+"&unit="+unit+"&min_number="+val.min_number+"&max_unit="+val.max_unit+"&min_unit="+val.min_unit+"&over_plus="+over_plus})
  527. },
  528. getDrugCountList(){
  529. var params = {
  530. keyword: this.keywords,
  531. start_time:this.start_time,
  532. end_time:this.end_time,
  533. }
  534. console.log("paramsw2ww",params)
  535. getDrugCountList(params).then(response=>{
  536. if(response.data.state == 1){
  537. var minCount = response.data.data.minCount
  538. console.log("minCount",minCount)
  539. this.minCount = minCount
  540. var cancelCountList = response.data.data.cancelCountList
  541. this.cancelCountList = cancelCountList
  542. var info = response.data.data.info
  543. for(let i=0;i<info.length;i++){
  544. if(info[i].count_unit == info[i].max_unit){
  545. info[i].count = info[i].count * info[i].min_number
  546. }
  547. }
  548. this.outCountList = response.data.data.outCountList
  549. console.log("手动出库",this.outCountList)
  550. this.auCountList = response.data.data.auCountList
  551. console.log("自动出库",this.auCountList)
  552. this.drugOutList = info
  553. }
  554. })
  555. },
  556. getInCount(id){
  557. var count = 0
  558. for(let i=0;i<this.countList.length;i++){
  559. if(id == this.countList[i].drug_id){
  560. count = this.countList[i].count
  561. }
  562. }
  563. return count
  564. },
  565. getOutCount(id){
  566. var count = 0
  567. for(let i=0;i<this.outCountList.length;i++){
  568. if(id == this.outCountList[i].drug_id){
  569. count = this.outCountList[i].count
  570. }
  571. }
  572. return count
  573. },
  574. getAutoCount(id){
  575. var count= 0
  576. for(let i=0;i<this.autoCountList.length;i++){
  577. if(id == this.autoCountList[i].drug_id){
  578. count = this.autoCountList[i].count
  579. }
  580. }
  581. return count
  582. },
  583. getMinCount(id){
  584. var count= 0
  585. for(let i=0;i<this.minCount.length;i++){
  586. if(id == this.minCount[i].drug_id){
  587. count = this.minCount[i].count
  588. }
  589. }
  590. return count
  591. },
  592. getCount(drug_id,min_number,max_unit,min_unit){
  593. var total= 0
  594. var str = ""
  595. var min_str = ""
  596. var arr = []
  597. for(let i=0;i<this.allCountList.length;i++){
  598. if(drug_id == this.allCountList[i].drug_id){
  599. arr.push(this.allCountList[i])
  600. }
  601. }
  602. var arrTwo = []
  603. for(let i=0;i<arr.length;i++){
  604. if(arr[i].drug_id == 1236){
  605. arrTwo.push(arr[i])
  606. }
  607. if(arr[i].count_unit == max_unit){
  608. arr[i].count = arr[i].count * min_number
  609. }
  610. if(arr[i].count_unit == min_unit){
  611. arr[i].count = arr[i].count
  612. }
  613. total += arr[i].count
  614. }
  615. if(total<min_number){
  616. str = ""
  617. min_str = total + min_unit
  618. }
  619. if(total >= min_number){
  620. if(parseInt(total/min_number)!=0){
  621. str = parseInt(total/min_number)+ max_unit
  622. }
  623. if((total%min_number)!=0){
  624. min_str = total%min_number + min_unit
  625. }
  626. }
  627. return str + min_str
  628. },
  629. getCountOne(drug_id){
  630. var count= 0
  631. for(let i=0;i<this.drugOutList.length;i++){
  632. if(drug_id == this.drugOutList[i].drug_id){
  633. count += parseInt(this.drugOutList[i].count)
  634. }
  635. }
  636. return count
  637. },
  638. getCountTwo(drug_id,min_number,max_unit,min_unit){
  639. var total_count = 0
  640. var out_count = 0
  641. var count = 0
  642. var str = ""
  643. var str_min = ""
  644. total_count = this.getInCount(drug_id) * min_number
  645. out_count = this.getCountOne(drug_id)
  646. count = total_count-out_count
  647. if(parseInt(count/min_number)!=0){
  648. str = parseInt(count/min_number) + max_unit
  649. }
  650. if((count%min_number)!=0){
  651. str_min = count%min_number + min_unit
  652. }
  653. return str+str_min
  654. },
  655. getCancelCount(id){
  656. var count= 0
  657. for(let i=0;i<this.cancelCountList.length;i++){
  658. if(id == this.cancelCountList[i].drug_id){
  659. count = this.cancelCountList[i].count
  660. }
  661. }
  662. return count
  663. },
  664. getWarehoseInfo(arr){
  665. var total = 0
  666. if (arr.length > 0) {
  667. for(let i=0;i<arr.length;i++){
  668. total += parseInt(arr[i].warehousing_count)
  669. }
  670. }
  671. if(total == 0){
  672. total = ""
  673. }
  674. return total
  675. },
  676. getOverFlushInfo(arr,max_unit,min_unit,min_number){
  677. var max_str= ""
  678. var min_str = ""
  679. var total = 0
  680. var newarr = arr
  681. if(newarr.length > 0 ){
  682. for(let i=0;i<newarr.length;i++){
  683. total += (newarr[i].stock_max_number+newarr[i].stock_min_number)
  684. }
  685. }
  686. if (total < min_number){
  687. min_str = total + min_unit
  688. }
  689. if (total == 0) {
  690. min_str = ""
  691. max_str = ""
  692. }
  693. if (total >=min_number) {
  694. if(parseInt(total/min_number)!=0){
  695. max_str = parseInt(total/min_number) + max_unit
  696. }
  697. if(total%min_number!=0){
  698. min_str = total%min_number + min_unit
  699. }
  700. }
  701. return max_str + min_str
  702. },
  703. getWarehouseOutInfo(arr,max_unit,min_unit,min_number){
  704. var min_str = ""
  705. var max_str = ""
  706. var total = 0
  707. if (arr.length > 0) {
  708. for(let i=0;i<arr.length;i++){
  709. total += parseInt(arr[i].count)
  710. }
  711. }
  712. if (total < min_number){
  713. min_str = total + min_unit
  714. }
  715. if (total == 0) {
  716. min_str = ""
  717. max_str = ""
  718. }
  719. if (total >=min_number) {
  720. if(parseInt(total/min_number)!=0){
  721. max_str = parseInt(total/min_number) + max_unit
  722. }
  723. if(total%min_number!=0){
  724. min_str = total%min_number + min_unit
  725. }
  726. }
  727. return max_str + min_str
  728. },
  729. getDrugOutList(arr,max_unit,min_unit,min_number){
  730. var str = ""
  731. var str_min = ""
  732. if(arr.length > 0){
  733. for(let i=0;i<arr.length;i++){
  734. if(parseInt(arr[i].count/min_number)!=0){
  735. str = parseInt(arr[i].count/min_number)+ max_unit
  736. }
  737. if(arr[i].count%min_number !=0){
  738. str_min = arr[i].count%min_number + min_unit
  739. }
  740. }
  741. }
  742. return str + str_min
  743. },
  744. getDrugChaCount(info,out_info,max_unit,min_unit,min_number,cancel_info){
  745. var total_info = 0
  746. var total_out = 0
  747. var cha_count = 0
  748. var cancel_count = 0
  749. if(info.length > 0 ){
  750. for(let i=0;i<info.length;i++){
  751. total_info += info[i].warehousing_count * min_number
  752. }
  753. }
  754. if(out_info.length>0){
  755. for(let j=0;j<out_info.length;j++){
  756. total_out += out_info[j].count
  757. }
  758. }
  759. if(cancel_info.length >0){
  760. for(let z=0;z<cancel_info.length;z++){
  761. cancel_count +=cancel_info[z].count
  762. }
  763. }
  764. cha_count = total_info - total_out + cancel_count
  765. var str = ""
  766. var str_min = ""
  767. if(parseInt(cha_count/min_number)!=0){
  768. str = parseInt(cha_count/min_number)+ max_unit
  769. }
  770. if(cha_count%min_number !=0){
  771. str_min = cha_count%min_number + min_unit
  772. }
  773. return str + str_min
  774. },
  775. getOutFlush(info,max_unit,min_unit,min_number,cancel_info){
  776. var str = ""
  777. var str_min = ""
  778. //总库存
  779. var total = 0
  780. var out_count = 0
  781. var over_count = 0
  782. var cancel_count = 0
  783. for(let i=0;i<info.length;i++){
  784. total += (info[i].warehousing_count * min_number)
  785. }
  786. for(let j=0;j<info.length;j++){
  787. out_count += (info[j].stock_max_number + info[j].stock_min_number)
  788. }
  789. // for(let z=0;z<cancel_info.length;z++){
  790. // cancel_count += cancel_info[z].count
  791. // }
  792. // over_count = total - out_count + cancel_count
  793. over_count = total - out_count
  794. if(parseInt(over_count/min_number)!=0){
  795. str = parseInt(over_count/min_number)+ max_unit
  796. }
  797. if(over_count%min_number !=0){
  798. str_min = over_count%min_number + min_unit
  799. }
  800. return str+str_min
  801. }
  802. }
  803. }
  804. </script>
  805. <style rel="stylesheet/css" lang="scss" scoped>
  806. .information {
  807. border: 1px #dcdfe6 solid;
  808. padding: 30px 20px 30px 20px;
  809. .border {
  810. border-bottom: 1px #dcdfe6 solid;
  811. margin: 0px 0 20px 0;
  812. }
  813. }
  814. .title {
  815. background: #409eff;
  816. height: 44px;
  817. line-height: 44px;
  818. padding: 0 0 0 10px;
  819. color: #fff;
  820. margin: 0 0 10px 0;
  821. }
  822. .edit_separater {
  823. border-top: 1px solid rgb(233, 233, 233);
  824. margin-top: 15px;
  825. margin-bottom: 15px;
  826. }
  827. </style>
  828. <style>
  829. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  830. font-size: 12px;
  831. }
  832. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  833. background: #6fb5fa;
  834. }
  835. .count {
  836. color: #bd2c00;
  837. }
  838. .el-table td,
  839. .el-table th.is-leaf,
  840. .el-table--border,
  841. .el-table--group {
  842. border-color: #d0d3da;
  843. }
  844. .el-table--border::after,
  845. .el-table--group::after,
  846. .el-table::before {
  847. background-color: #d0d3da;
  848. }
  849. </style>