goodNewQuery.vue 34KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155
  1. <template>
  2. <div class="main-contain">
  3. <div class="app-container" style="padding-left:0px;margin: 0px;"
  4. v-loading="loading"
  5. element-loading-text="拼命加载中">
  6. <div style="justify-content: space-between;margin: 0px 0 12px 0;display: flex;align-items: center;">
  7. <div>
  8. <span style="font-size:14px;color:#606266">仓库:</span>
  9. <el-select v-model="storehouse_id" style="width:200px;margin-right:10px;" placeholder="请选择"
  10. filterable
  11. @change="changeStorehouseName">
  12. <el-option
  13. v-for="item in houseList"
  14. :key="item.id"
  15. :label="item.storehouse_name"
  16. :value="item.id">
  17. </el-option>
  18. </el-select>
  19. <span style="font-size:14px;color:#606266">库存预警:</span>
  20. <el-select v-model="good_type" style="width:250px;margin-right:10px;" placeholder="请选择"
  21. filterable
  22. @change="changeGoodName">
  23. <el-option
  24. v-for="item in goodList"
  25. :key="item.id"
  26. :label="item.name"
  27. :value="item.id">
  28. </el-option>
  29. </el-select>
  30. <el-input v-model="keyword" style="width:200px" placeholder="请输入耗材名称或生产厂商" ></el-input>
  31. <el-button type="primary" icon="el-icon-search" @click="seach">搜索</el-button>
  32. </div>
  33. <div>
  34. <!-- <el-button size="small" type="primary" @click="toClickTwo">脚本</el-button> -->
  35. <el-button size="small" type="primary" @click="exportList">导出</el-button>
  36. <el-button size="small" type="primary" @click="toPrint">打印</el-button>
  37. </div>
  38. </div>
  39. <el-table
  40. :row-style="{ color: '#303133' }"
  41. :header-cell-style="{
  42. backgroundColor: 'rgb(245, 247, 250)',
  43. color: '#606266'
  44. }"
  45. :data="tableList"
  46. :class="signAndWeighBoxPatients"
  47. border
  48. :cell-class-name="cellStyle"
  49. >
  50. <el-table-column label="耗材类型" align="center">
  51. <template slot-scope="scope">
  52. {{getGoodTypeName(scope.row.good_type_id)}}
  53. </template>
  54. </el-table-column>
  55. <el-table-column label="耗材名称" align="center">
  56. <template slot-scope="scope">
  57. {{scope.row.good_name}}
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="规格&单位" align="center">
  61. <template slot-scope="scope">
  62. {{scope.row.specification_name}}/{{scope.row.packing_unit}}
  63. </template>
  64. </el-table-column>
  65. <el-table-column label="生产厂商" align="center">
  66. <template slot-scope="scope">
  67. {{getManufacturName(scope.row.manufacturer)}}
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="批准文号" align="center">
  71. <template slot-scope="scope">
  72. {{scope.row.number}}
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="国家编码" align="center">
  76. <template slot-scope="scope">
  77. {{scope.row.social_security_directory_code}}
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="仓库名称" align="center">
  81. <template slot-scope="scope">
  82. <tr style="background: none" v-for="(item,index) in scope.row.xt_good_stock_info" :key="index">
  83. <td style="border-right: none; border-inline-end: none;text-align: center" >
  84. {{getHouseName(item.storehouse_id)}}
  85. </td>
  86. </tr>
  87. </template>
  88. </el-table-column>
  89. <el-table-column label="入库数量" align="center">
  90. <template slot-scope="scope">
  91. <tr style="background: none" v-for="(item,index) in scope.row.xt_good_stock_info" :key="index">
  92. <td style="border-right: none; border-inline-end: none;text-align: center">
  93. {{getGoodIn(scope.row.xt_good_stock,item.storehouse_id)}}
  94. </td>
  95. </tr>
  96. </template>
  97. </el-table-column>
  98. <el-table-column label="出库数量" align="center">
  99. <template slot-scope="scope">
  100. <span>
  101. <tr style="background: none" v-for="(item,index) in scope.row.xt_good_stock_info" :key="index">
  102. <td style="border-right: none; border-inline-end: none;text-align: center">
  103. <span>
  104. {{getGoodAct(scope.row.xt_good_stock,item.storehouse_id)}}
  105. </span>
  106. </td>
  107. </tr>
  108. </span>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="退库数量" align="center">
  112. <template slot-scope="scope">
  113. <tr style="background: none" v-for="(item,index) in scope.row.xt_good_stock_info" :key="index">
  114. <td style="border-right: none; border-inline-end: none;text-align: center">
  115. {{getGoodCancel(scope.row.xt_good_stock,item.storehouse_id)}}
  116. </td>
  117. </tr>
  118. </template>
  119. </el-table-column>
  120. <el-table-column label="实际出库" align="center">
  121. <template slot-scope="scope">
  122. <span>
  123. <tr style="background: none" v-for="(item,index) in scope.row.xt_good_stock_info" :key="index">
  124. <td style="border-right: none; border-inline-end: none;text-align: center">
  125. <span style="color:#0099FF" @click="toDialogClick(scope.row.id,scope.row.good_name,scope.row.specification_name,item.storehouse_id)">
  126. {{getGoodOut(scope.row.xt_good_stock,item.storehouse_id)}}
  127. </span>
  128. </td>
  129. </tr>
  130. </span>
  131. </template>
  132. </el-table-column>
  133. <el-table-column label="剩余库存" align="center">
  134. <template slot-scope="scope">
  135. <span>
  136. <tr style="background: none" v-for="(item,index) in scope.row.xt_good_stock_info" :key="index">
  137. <td style="border-right: none; border-inline-end: none;text-align: center">
  138. {{getGoodFlush(scope.row.xt_good_stock,item.storehouse_id)}}
  139. </td>
  140. </tr>
  141. </span>
  142. </template>
  143. </el-table-column>
  144. <el-table-column label="总库存量" align="center">
  145. <template slot-scope="scope">
  146. <span>
  147. <span v-if="getOverFlushInfo(scope.row.xt_warehouse_info) <= scope.row.stock_warn_count" style="color:red">
  148. {{getSumCount(scope.row.xt_good_stock,scope.row.id)}}
  149. <i class="el-icon-warning"></i>
  150. </span>
  151. <span v-if="getOverFlushInfo(scope.row.xt_warehouse_info) > scope.row.stock_warn_count">
  152. {{getSumCount(scope.row.xt_good_stock,scope.row.id)}}
  153. </span>
  154. </span>
  155. </template>
  156. </el-table-column>
  157. <el-table-column label="操作" align="center" width="200px">
  158. <template slot-scope="scope">
  159. <el-button
  160. size="small"
  161. type="primary"
  162. @click="toClick(scope.row)"
  163. >库存流水
  164. </el-button>
  165. <el-button
  166. size="small"
  167. type="primary"
  168. @click="toClickOne(scope.row)"
  169. >批次
  170. </el-button>
  171. </template>
  172. </el-table-column>
  173. </el-table>
  174. <el-pagination
  175. @size-change="handleSizeChange"
  176. @current-change="handleCurrentChange"
  177. :page-sizes="[10, 50, 100,200,500,1000]"
  178. :page-size="10"
  179. background
  180. align="right"
  181. style="margin-top:20px;"
  182. layout="total, sizes, prev, pager, next, jumper"
  183. :total="total"
  184. >
  185. </el-pagination>
  186. </div>
  187. <el-dialog
  188. title="出库详情"
  189. :visible.sync="dialogVisible"
  190. width="70%">
  191. <span>
  192. 耗材名称:{{good_name}}
  193. 规格&单位:{{specification_name}}
  194. 查询日期:
  195. <el-date-picker
  196. size="small"
  197. v-model="start_first_time"
  198. prefix-icon="el-icon-date"
  199. :editable="false"
  200. style="width: 150px;"
  201. type="date"
  202. placeholder="选择日期时间"
  203. align="right"
  204. format="yyyy-MM-dd"
  205. value-format="yyyy-MM-dd"
  206. @change="startFirstTimeChange"
  207. ></el-date-picker>
  208. <span>-</span>
  209. <el-date-picker
  210. size="small"
  211. v-model="end_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="endEndTimeChange"
  221. ></el-date-picker>
  222. </span>
  223. <el-divider></el-divider>
  224. <el-table
  225. :row-style="{ color: '#303133' }"
  226. :header-cell-style="{
  227. backgroundColor: 'rgb(245, 247, 250)',
  228. color: '#606266'
  229. }"
  230. :data="tableData"
  231. :class="signAndWeighBoxPatients"
  232. border
  233. >
  234. <el-table-column label="序号" align="center">
  235. <template slot-scope="scope">
  236. {{scope.$index + 1}}
  237. </template>
  238. </el-table-column>
  239. <el-table-column label="单据编号" align="center">
  240. <template slot-scope="scope">
  241. {{scope.row.warehouse_out_order_number}}
  242. </template>
  243. </el-table-column>
  244. <el-table-column label="操作时间" align="center">
  245. <template slot-scope="scope">
  246. {{getTimeOne(scope.row.ctime)}}
  247. </template>
  248. </el-table-column>
  249. <el-table-column label="出库数量" align="center">
  250. <template slot-scope="scope">
  251. {{scope.row.count}}{{scope.row.GoodInfo.packing_unit}}
  252. </template>
  253. </el-table-column>
  254. <el-table-column label="库存数量" align="center">
  255. <template slot-scope="scope">
  256. {{scope.row.over_count}}
  257. </template>
  258. </el-table-column>
  259. <el-table-column label="使用人" align="center">
  260. <template slot-scope="scope">
  261. {{getName(scope.row.patient_id)}}
  262. </template>
  263. </el-table-column>
  264. <el-table-column label="备注" align="center">
  265. <template slot-scope="scope">
  266. {{scope.row.remark}}
  267. </template>
  268. </el-table-column>
  269. </el-table>
  270. <el-pagination
  271. @size-change="handleSizeChangeOne"
  272. @current-change="handleCurrentChangeOne"
  273. :page-sizes="[10, 50, 100,200,500,1000]"
  274. :page-size="10"
  275. background
  276. align="right"
  277. style="margin-top:20px;"
  278. layout="total, sizes, prev, pager, next, jumper"
  279. :total="totalone"
  280. >
  281. </el-pagination>
  282. <span slot="footer" class="dialog-footer">
  283. <el-button @click="dialogVisible = false">取 消</el-button>
  284. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  285. </span>
  286. </el-dialog>
  287. </div>
  288. </template>
  289. <script>
  290. import { getStorehouseList,getGoodNewQuery,getGoodWarehouseOutInfoById,toSendGoodInfomation } from "@/api/drug/drug"
  291. import {
  292. getStockDrugCount
  293. } from "@/api/stock";
  294. import { uParseTime } from '@/utils/tools'
  295. const moment = require('moment')
  296. export default {
  297. data(){
  298. return{
  299. tableList:[],
  300. goodList:[
  301. {id:1,name:"全部耗材"},
  302. {id:2,name:"库存预警"},
  303. ],
  304. houseList:[],
  305. storehouse_id:0,
  306. good_type:1,
  307. multipleSelection: [],
  308. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  309. manufacturerList:[],
  310. limit:10,
  311. page:1,
  312. total:0,
  313. limitone:10,
  314. pageone:1,
  315. totalone:0,
  316. keyword:"",
  317. goodTypeList:[],
  318. start_time:"",
  319. end_time:"",
  320. countList:[],
  321. outCountList:[],
  322. autoCountList:[],
  323. cancelCountList:[],
  324. org_id:this.$store.getters.xt_user.org_id,
  325. dialogVisible:false,
  326. start_first_time:moment().startOf('month').format("YYYY-MM-DD"),
  327. end_first_time:moment().endOf('month').format("YYYY-MM-DD"),
  328. tableData:[],
  329. good_id:0,
  330. patientList:[],
  331. good_name:"",
  332. specification_name:"",
  333. loading:false,
  334. warehouseInfoByList:[],
  335. cancelStockInfoByList:[],
  336. warehouseOutByList:[],
  337. flushList:[],
  338. type_name:0,
  339. storehouseId:0
  340. }
  341. },
  342. methods:{
  343. changeStorehouseName(){
  344. this.getlist()
  345. },
  346. changeGoodName(){
  347. this.getlist()
  348. },
  349. toClick(val){
  350. var manufacturer_name = ""
  351. var specification_name = ""
  352. for(let i=0;i<this.manufacturerList.length;i++){
  353. if(val.manufacturer == this.manufacturerList[i].id){
  354. manufacturer_name = this.manufacturerList[i].manufacturer_name
  355. }
  356. }
  357. specification_name = val.specification_name + "/" + val.packing_unit
  358. var overCount = this.getOverplus(val.xt_warehouse_info)
  359. // window.sessionStorage.setItem('start_time',this.start_time)
  360. // window.sessionStorage.setItem('end_time',this.end_time)
  361. this.$router.push({path:"/stock/in/stockflow?id="+val.id+"&manufacturer="+manufacturer_name+"&packing_unit="+val.packing_unit+"&overCount="+overCount})
  362. },
  363. toClickOne(val){
  364. var manufacturer_name = ""
  365. var specification_name = ""
  366. for(let i=0;i<this.manufacturerList.length;i++){
  367. if(val.manufacturer == this.manufacturerList[i].id){
  368. manufacturer_name = this.manufacturerList[i].manufacturer_name
  369. }
  370. }
  371. specification_name = val.specification_name + "/" + val.packing_unit
  372. var overCount = this.getOverplus(val.xt_warehouse_info)
  373. // window.sessionStorage.setItem('start_time',this.start_time)
  374. // window.sessionStorage.setItem('end_time',this.end_time)
  375. this.$router.push({path:"/stock/in/stockbatchnumber?id="+val.id+"&manufacturer="+manufacturer_name+"&packing_unit="+val.packing_unit+"&overCount="+overCount})
  376. },
  377. getStorehouseList(){
  378. getStorehouseList().then(response=>{
  379. if(response.data.state == 1){
  380. var houseList = response.data.data.list
  381. var obj = {id:0,storehouse_name:"全部"}
  382. this.houseList.push(obj)
  383. for(let i=0;i<houseList.length;i++){
  384. this.houseList.push(houseList[i])
  385. }
  386. this.manufacturerList = response.data.data.manufacturerList
  387. this.goodTypeList = response.data.data.goodTypeList
  388. this.patientList = response.data.data.patientList
  389. }
  390. })
  391. },
  392. getlist(){
  393. this.loading = true
  394. var params = {
  395. storehouse_id:this.storehouse_id,
  396. good_type:this.good_type,
  397. keyword:this.keyword,
  398. page:this.page,
  399. limit:this.limit,
  400. start_time:this.start_time,
  401. end_time:this.end_time,
  402. }
  403. getGoodNewQuery(params).then(response=>{
  404. if(response.data.state == 1){
  405. // var list = response.data.data.list
  406. var list = response.data.data.stockList
  407. this.loading = false
  408. this.tableList = list
  409. this.total = response.data.data.total
  410. }
  411. })
  412. },
  413. getManufacturName(id){
  414. var manufacturer_name = ""
  415. for(let i=0;i<this.manufacturerList.length;i++){
  416. if(id == this.manufacturerList[i].id){
  417. manufacturer_name = this.manufacturerList[i].manufacturer_name
  418. }
  419. }
  420. return manufacturer_name
  421. },
  422. handleSizeChange(val) {
  423. this.limit = val;
  424. this.getlist()
  425. },
  426. handleCurrentChange(val) {
  427. this.page = val;
  428. this.getlist()
  429. },
  430. handleSizeChangeOne(val) {
  431. this.limitone = val;
  432. this.toDialogClick(this.good_id,this.good_name,this.specification_name,this.storehouseId)
  433. },
  434. handleCurrentChangeOne(val) {
  435. this.pageone = val;
  436. this.toDialogClick(this.good_id,this.good_name,this.specification_name,this.storehouseId)
  437. },
  438. seach(){
  439. this.getlist()
  440. },
  441. getGoodTypeName(id){
  442. var type_name = ""
  443. for(let i=0;i<this.goodTypeList.length;i++){
  444. if(id == this.goodTypeList[i].id){
  445. type_name = this.goodTypeList[i].type_name
  446. }
  447. }
  448. return type_name
  449. },
  450. getHouseName(id){
  451. var storehouse_name = ""
  452. for(let i=0;i<this.houseList.length;i++){
  453. if(id == this.houseList[i].id){
  454. storehouse_name = this.houseList[i].storehouse_name
  455. }
  456. }
  457. return storehouse_name
  458. },
  459. getWareInfoCount(val,storehouse_id){
  460. var count = 0
  461. if(val!=null&&val.length > 0){
  462. for(let i=0;i<val.length;i++){
  463. if(val[i].storehouse_id == storehouse_id){
  464. count +=val[i].warehousing_count
  465. }
  466. }
  467. }
  468. if(count > 0){
  469. return count
  470. }else{
  471. return ""
  472. }
  473. },
  474. getStockDrugCount(){
  475. var params ={
  476. keywords: this.keywords,
  477. start_time:this.start_time,
  478. end_time:this.end_time,
  479. }
  480. getStockDrugCount(params).then(response=>{
  481. if(response.data.state == 1){
  482. var outlist = response.data.data.outList
  483. this.outCountList = outlist
  484. var autoCount = response.data.data.autoCount
  485. this.autoCountList = autoCount
  486. var totalCount = response.data.data.totalCount
  487. this.cancelCountList = totalCount
  488. }
  489. })
  490. },
  491. getWareInfoCountOne(val,storehouse_id){
  492. var count = 0
  493. if(val!=null&&val.length > 0){
  494. for(let i=0;i<val.length;i++){
  495. if(val[i].storehouse_id == storehouse_id){
  496. count +=val[i].stock_count
  497. }
  498. }
  499. }
  500. if(count > 0){
  501. return count
  502. }else{
  503. return ""
  504. }
  505. },
  506. getOutCount(id){
  507. var count = 0
  508. for(let i=0;i<this.outCountList.length;i++){
  509. if(id == this.outCountList[i].good_id){
  510. count = this.outCountList[i].count
  511. }
  512. }
  513. return count
  514. },
  515. getAutoCount(id){
  516. var count= 0
  517. for(let i=0;i<this.autoCountList.length;i++){
  518. if(id == this.autoCountList[i].good_id){
  519. count = this.autoCountList[i].count
  520. }
  521. }
  522. return count
  523. },
  524. getCancelCount(id){
  525. var count = 0
  526. for(let i=0;i<this.cancelCountList.length;i++){
  527. if(id == this.cancelCountList[i].good_id){
  528. count = this.cancelCountList[i].count
  529. }
  530. }
  531. return count
  532. },
  533. getCancelCountInfo(cancel_stock_info,storehouse_id){
  534. var count = 0
  535. if(cancel_stock_info!=null && cancel_stock_info.length >0){
  536. for(let i=0;i<cancel_stock_info.length;i++){
  537. if(cancel_stock_info[i].storehouse_id == storehouse_id){
  538. count += cancel_stock_info[i].count
  539. }
  540. }
  541. }
  542. return count
  543. },
  544. getWareOutInfoCount(warehouse_out_info,storehouse_id){
  545. var count = 0
  546. if(warehouse_out_info!=null && warehouse_out_info.length > 0){
  547. for(let i=0;i<warehouse_out_info.length;i++){
  548. if(storehouse_id == warehouse_out_info[i].storehouse_id){
  549. count +=warehouse_out_info[i].count
  550. }
  551. }
  552. }
  553. return count
  554. },
  555. getInCount(id){
  556. var count= 0
  557. for(let i=0;i<this.countList.length;i++){
  558. if(id == this.countList[i].good_id){
  559. count = this.countList[i].count
  560. }
  561. }
  562. return count
  563. },
  564. getOutCount(id){
  565. var count = 0
  566. for(let i=0;i<this.outCountList.length;i++){
  567. if(id == this.outCountList[i].good_id){
  568. count = this.outCountList[i].count
  569. }
  570. }
  571. return count
  572. },
  573. getAutoCount(id){
  574. var count= 0
  575. for(let i=0;i<this.autoCountList.length;i++){
  576. if(id == this.autoCountList[i].good_id){
  577. count = this.autoCountList[i].count
  578. }
  579. }
  580. return count
  581. },
  582. getCancelCount(id){
  583. var count = 0
  584. for(let i=0;i<this.cancelCountList.length;i++){
  585. if(id == this.cancelCountList[i].good_id){
  586. count = this.cancelCountList[i].count
  587. }
  588. }
  589. return count
  590. },
  591. getStockCount(id){
  592. var stock_count = 0
  593. for(let i=0;i<this.countList.length;i++){
  594. if(id == this.countList[i].good_id){
  595. stock_count = this.countList[i].stock_count
  596. }
  597. }
  598. return stock_count
  599. },
  600. getWareInfo(arr){
  601. var total = 0
  602. if(arr.length > 0){
  603. for(let i=0;i<arr.length;i++){
  604. total += parseInt(arr[i].warehousing_count)
  605. }
  606. }else{
  607. total = ""
  608. }
  609. return total
  610. },
  611. getOverplus(arr){
  612. var total = 0
  613. if(arr.length > 0){
  614. for(let i=0;i<arr.length;i++){
  615. total += arr[i].stock_count
  616. }
  617. }else{
  618. total = ""
  619. }
  620. return total
  621. },
  622. getCancelInfo(arr){
  623. var total = 0
  624. if(arr.length > 0){
  625. for(let i=0;i<arr.length;i++){
  626. total += arr[i].count
  627. }
  628. }else{
  629. total = ""
  630. }
  631. return total
  632. },
  633. getOverFlushInfo(arr){
  634. var total = 0
  635. if(arr!=null&&arr.length >0){
  636. for(let i=0;i<arr.length;i++){
  637. total += arr[i].stock_count
  638. }
  639. }
  640. return total
  641. },
  642. toDialogClick(id,good_name,specification_name,storehouse_id){
  643. this.good_id = id
  644. this.good_name = good_name
  645. this.specification_name = specification_name
  646. this.storehouseId = storehouse_id
  647. var params = {
  648. good_id:id,
  649. limit:this.limitone,
  650. page:this.pageone,
  651. start_first_time:this.start_first_time,
  652. end_first_time:this.end_first_time,
  653. storehouse_id:storehouse_id,
  654. }
  655. getGoodWarehouseOutInfoById(params).then(response=>{
  656. if(response.data.state == 1){
  657. this.dialogVisible = true
  658. var list = response.data.data.list
  659. this.tableData = list
  660. this.totalone = response.data.data.total
  661. // this.flushList = response.data.data.flushList
  662. }
  663. })
  664. },
  665. startFirstTimeChange(){
  666. this.toDialogClick(this.good_id,this.good_name,this.specification_name,this.storehouseId)
  667. },
  668. endEndTimeChange(){
  669. this.toDialogClick(this.good_id,this.good_name,this.specification_name,this.storehouseId)
  670. },
  671. getTime(val) {
  672. if(val < 0){
  673. return ""
  674. }
  675. if(val == ""){
  676. return ""
  677. }else {
  678. return uParseTime(val, '{y}-{m}-{d}')
  679. }
  680. },
  681. getTimeOne(val) {
  682. if(val < 0){
  683. return ""
  684. }
  685. if(val == ""){
  686. return ""
  687. }else {
  688. return uParseTime(val, '{y}-{m}-{d} {h}:{i}')
  689. }
  690. },
  691. getName(id){
  692. var name = ""
  693. for(let i=0;i<this.patientList.length;i++){
  694. if(id == this.patientList[i].id){
  695. name = this.patientList[i].name
  696. }
  697. }
  698. return name
  699. },
  700. getCount(ctime){
  701. var arr = []
  702. var arrOut = []
  703. var total_in = 0
  704. var total_out = 0
  705. for(let i=0;i<this.warehouseInfoByList.length;i++){
  706. if(ctime >= this.warehouseInfoByList[i].ctime){
  707. arr.push(this.warehouseInfoByList[i])
  708. }
  709. }
  710. if(arr.length > 0){
  711. for(let i=0;i<arr.length;i++){
  712. total_in +=arr[i].warehousing_count
  713. }
  714. }
  715. for(let i=0;i<this.warehouseOutByList.length;i++){
  716. if(ctime <=this.warehouseOutByList[i].ctime){
  717. arrOut.push(this.warehouseOutByList[i])
  718. }
  719. }
  720. if(arrOut.length >0){
  721. for(let i=0;i<arrOut.length;i++){
  722. total_out +=arrOut[i].count
  723. }
  724. }
  725. console.log("total23323223",total_in)
  726. return total_in - total_out
  727. },
  728. getStockCountOne(warehouse_out_id,good_id,patient_id,sys_record_time){
  729. var flush_count = 0
  730. if(this.flushList!=null && this.flushList.length > 0){
  731. for(let i=0;i<this.flushList.length;i++){
  732. if(warehouse_out_id == this.flushList[i].warehouse_out_id && good_id == this.flushList[i].good_id && patient_id == this.flushList[i].patient_id && sys_record_time == this.flushList[i].system_time){
  733. flush_count = this.flushList[i].flush_count
  734. }
  735. }
  736. }
  737. return flush_count
  738. },
  739. // 合并单元格样式
  740. cellStyle({ row, column, rowIndex, columnIndex }) {
  741. let arr = [5,6, 7, 8, 9,10,11];
  742. if (arr.indexOf(columnIndex) > -1) {
  743. return "spanClass";
  744. }
  745. },
  746. exportList(){
  747. import('@/vendor/Export2Excel').then(excel => {
  748. if(this.tableList!=null && this.tableList.length > 0){
  749. for(let i=0;i<this.tableList.length;i++){
  750. this.tableList[i].index = i+1
  751. this.tableList[i].type_name = this.getGoodTypeName(this.tableList[i].good_type_id)
  752. this.tableList[i].spec = this.tableList[i].specification_name +"/"+ this.tableList[i].packing_unit
  753. this.tableList[i].manufacturer_name = this.getManufacturName(this.tableList[i].manufacturer)
  754. this.tableList[i].stock_in_count = this.GetExportStockInCount(this.tableList[i].xt_good_stock,this.tableList[i].id)
  755. this.tableList[i].stock_out_count =this.getExportStockOutCount(this.tableList[i].xt_good_stock,this.tableList[i].id)
  756. this.tableList[i].stock_cancel_count = this.getExportCancelStockInfo(this.tableList[i].xt_good_stock,this.tableList[i].id)
  757. this.tableList[i].act_out_count = this.getExportActStockOutCount(this.tableList[i].xt_good_stock,this.tableList[i].id)
  758. this.tableList[i].over_count = this.getExportOverCount(this.tableList[i].xt_good_stock,this.tableList[i].id)
  759. this.tableList[i].sum_count = this.getOverCount(this.tableList[i].xt_warehouse_info)
  760. }
  761. }
  762. const tHeader = ['序号','耗材类型', '耗材名称', '规格&单位','生产厂商','批准文号','国家编码','入库数量','出库数量','退库数量','实际出库','剩余库存','总库存']
  763. const filterVal = ['index','type_name', 'good_name', 'spec','manufacturer_name','number','social_security_directory_code','stock_in_count','act_out_count','stock_cancel_count','stock_out_count','over_count','sum_count']
  764. const data = this.formatJson(filterVal, this.tableList)
  765. excel.export_json_to_excel({
  766. header: tHeader,
  767. data,
  768. filename: '库存查询'
  769. })
  770. this.downloadLoading = false
  771. })
  772. },
  773. formatJson(filterVal, jsonData) {
  774. return jsonData.map(v => filterVal.map(j => v[j]));
  775. },
  776. toPrint(){
  777. this.$router.push("/good/new/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)
  778. },
  779. getCancelSotckInfo(arr){
  780. var cancle_toal = 0
  781. if(arr.length >0){
  782. for(let z=0;z<arr.length;z++){
  783. cancle_toal += arr[z].count
  784. }
  785. }
  786. return cancle_toal
  787. },
  788. getStockOutFlow(arr,storehouse_id){
  789. var count = 0
  790. if(arr!=null && arr.length > 0){
  791. for(let i=0;i<arr.length;i++){
  792. if(arr[i].storehouse_id == storehouse_id){
  793. count +=arr[i].count
  794. }
  795. }
  796. }
  797. if(count > 0){
  798. return count
  799. }else{
  800. return 0
  801. }
  802. },
  803. GetStockInCount(val){
  804. var count = 0
  805. if(val!=null && val.length >0){
  806. for(let i=0;i<val.length;i++){
  807. count +=val[i].warehousing_count
  808. }
  809. }
  810. if(count > 0){
  811. return count
  812. }else{
  813. return 0
  814. }
  815. },
  816. getStockOutCount(val){
  817. var count = 0
  818. if(val!=null && val.length >0){
  819. for(let i=0;i<val.length;i++){
  820. count +=val[i].count
  821. }
  822. }
  823. if(count > 0){
  824. return count
  825. }else{
  826. return 0
  827. }
  828. },
  829. getCancelStockInfo(val){
  830. var count = 0
  831. if(val!=null && val.length >0){
  832. for(let i=0;i<val.length;i++){
  833. count +=val[i].count
  834. }
  835. }
  836. if(count > 0){
  837. return count
  838. }else{
  839. return 0
  840. }
  841. },
  842. getOverCount(val){
  843. var count = 0
  844. if(val!=null && val.length >0){
  845. for(let i=0;i<val.length;i++){
  846. count +=val[i].stock_count
  847. }
  848. }
  849. if(count > 0){
  850. return count
  851. }else{
  852. return 0
  853. }
  854. },
  855. // 修改后接口
  856. getGoodIn(val,storehouse_id){
  857. var sum_count = 0
  858. if(val!=null && val!=undefined){
  859. for(let i=0;i<val.length;i++){
  860. if(storehouse_id == val[i].storehouse_id){
  861. sum_count = val[i].stock_in_count
  862. }
  863. }
  864. }
  865. if(sum_count > 0){
  866. return sum_count
  867. }else{
  868. return 0
  869. }
  870. },
  871. getGoodOut(val,storehouse_id){
  872. var sum_count = 0
  873. if(val!=null && val!=undefined){
  874. for(let i=0;i<val.length;i++){
  875. if(storehouse_id == val[i].storehouse_id){
  876. sum_count = val[i].stock_out_count
  877. }
  878. }
  879. }
  880. if(sum_count > 0){
  881. return sum_count
  882. }else{
  883. return 0
  884. }
  885. },
  886. getGoodCancel(val,storehouse_id){
  887. var sum_count = 0
  888. if(val!=null && val!=undefined){
  889. for(let i=0;i<val.length;i++){
  890. if(storehouse_id == val[i].storehouse_id){
  891. sum_count = val[i].stock_cancel_count
  892. }
  893. }
  894. }
  895. if(sum_count > 0){
  896. return sum_count
  897. }else{
  898. return 0
  899. }
  900. },
  901. getGoodAct(val,storehouse_id){
  902. var sum_count = 0
  903. if(val!=null && val!=undefined){
  904. for(let i=0;i<val.length;i++){
  905. if(storehouse_id == val[i].storehouse_id){
  906. sum_count = val[i].stock_act_out_count
  907. }
  908. }
  909. }
  910. if(sum_count > 0){
  911. return sum_count
  912. }else{
  913. return 0
  914. }
  915. },
  916. getGoodFlush(val,storehouse_id){
  917. var sum_count = 0
  918. if(val!=null && val!=undefined){
  919. for(let i=0;i<val.length;i++){
  920. if(storehouse_id == val[i].storehouse_id){
  921. sum_count = val[i].flush_count
  922. }
  923. }
  924. }
  925. if(sum_count > 0){
  926. return sum_count
  927. }else{
  928. return 0
  929. }
  930. },
  931. getSumCount(val,good_id){
  932. var sum_count = 0
  933. var arr = []
  934. if(val!=null && val!=undefined){
  935. for(let i=0;i<val.length;i++){
  936. if(good_id == val[i].good_id){
  937. arr.push(val[i])
  938. }
  939. }
  940. }
  941. for(let i=0;i<arr.length;i++){
  942. sum_count +=arr[i].flush_count
  943. }
  944. if(sum_count > 0){
  945. return sum_count
  946. }else{
  947. return 0
  948. }
  949. },
  950. toClickTwo(){
  951. toSendGoodInfomation().then(response=>{
  952. if(response.data.state == 1){
  953. var msg = response.data.data.msg
  954. console.log("脚本保存成功!")
  955. }
  956. })
  957. },
  958. //导出
  959. GetExportStockInCount(val,id){
  960. var sum_count = 0
  961. var arr = []
  962. if(val!=null && val.length > 0){
  963. for(let i=0;i<val.length;i++){
  964. if(val[i].good_id == id){
  965. arr.push(val[i])
  966. }
  967. }
  968. }
  969. for(let i=0;i<arr.length;i++){
  970. sum_count +=arr[i].stock_in_count
  971. }
  972. if(sum_count > 0){
  973. return sum_count
  974. }else{
  975. return 0
  976. }
  977. },
  978. getExportStockOutCount(val,id){
  979. var sum_count = 0
  980. var arr = []
  981. if(val!=null && val.length > 0){
  982. for(let i=0;i<val.length;i++){
  983. if(val[i].good_id == id){
  984. arr.push(val[i])
  985. }
  986. }
  987. }
  988. for(let i=0;i<arr.length;i++){
  989. sum_count +=arr[i].stock_out_count
  990. }
  991. if(sum_count > 0){
  992. return sum_count
  993. }else{
  994. return 0
  995. }
  996. },
  997. getExportCancelStockInfo(val,id){
  998. var sum_count = 0
  999. var arr = []
  1000. if(val!=null && val.length > 0){
  1001. for(let i=0;i<val.length;i++){
  1002. if(val[i].good_id == id){
  1003. arr.push(val[i])
  1004. }
  1005. }
  1006. }
  1007. for(let i=0;i<arr.length;i++){
  1008. sum_count +=arr[i].stock_cancel_count
  1009. }
  1010. if(sum_count > 0){
  1011. return sum_count
  1012. }else{
  1013. return 0
  1014. }
  1015. },
  1016. getExportActStockOutCount(val,id){
  1017. var sum_count = 0
  1018. var arr = []
  1019. if(val!=null && val.length > 0){
  1020. for(let i=0;i<val.length;i++){
  1021. if(val[i].good_id == id){
  1022. arr.push(val[i])
  1023. }
  1024. }
  1025. }
  1026. for(let i=0;i<arr.length;i++){
  1027. sum_count +=arr[i].stock_act_out_count
  1028. }
  1029. if(sum_count > 0){
  1030. return sum_count
  1031. }else{
  1032. return 0
  1033. }
  1034. },
  1035. getExportOverCount(val,id){
  1036. var sum_count = 0
  1037. var arr = []
  1038. if(val!=null && val.length > 0){
  1039. for(let i=0;i<val.length;i++){
  1040. if(val[i].good_id == id){
  1041. arr.push(val[i])
  1042. }
  1043. }
  1044. }
  1045. for(let i=0;i<arr.length;i++){
  1046. sum_count +=arr[i].flush_count
  1047. }
  1048. if(sum_count > 0){
  1049. return sum_count
  1050. }else{
  1051. return 0
  1052. }
  1053. }
  1054. },
  1055. created(){
  1056. this.houseList = []
  1057. this.getStorehouseList()
  1058. this.getlist()
  1059. var org_id = this.$store.getters.xt_user.org_id
  1060. if(org_id == 9583 || org_id == 3907){
  1061. this.getStockDrugCount()
  1062. }
  1063. }
  1064. }
  1065. </script>
  1066. <style>
  1067. .app-container{
  1068. /* padding-left: 0;
  1069. margin-left: 0; */
  1070. }
  1071. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1072. font-size: 12px;
  1073. }
  1074. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1075. background: #6fb5fa;
  1076. }
  1077. .count {
  1078. color: #bd2c00;
  1079. }
  1080. .el-table td,
  1081. .el-table th.is-leaf,
  1082. .el-table--border,
  1083. .el-table--group {
  1084. border-color: #d0d3da;
  1085. }
  1086. .el-table--border::after,
  1087. .el-table--group::after,
  1088. .el-table::before {
  1089. background-color: #d0d3da;
  1090. }
  1091. /* 合并表格线样式 */
  1092. .spanClass .cell {
  1093. padding: 0 !important;
  1094. }
  1095. .spanClass .cell tr {
  1096. display: inline-block;
  1097. width: 100%;
  1098. }
  1099. .spanClass .cell tr td {
  1100. padding: 10px 0;
  1101. border-bottom: 1px solid #ebeef5;
  1102. display: block;
  1103. width: 100%;
  1104. }
  1105. .spanClass .cell tr:last-of-type td {
  1106. border-bottom: none;
  1107. }
  1108. </style>