Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

stockQuery.vue 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. </div>
  6. <div class="app-container ">
  7. <div style="justify-content: space-between;margin: 0px 0 12px 0;display: flex;align-items: center;">
  8. <div>
  9. <el-select v-model="type_name" style="width:140px;margin-right:10px;" placeholder="请选择"
  10. @change="changeTypeName">
  11. <el-option
  12. v-for="item in types"
  13. :key="item.id"
  14. :label="item.type_name"
  15. :value="item.id">
  16. </el-option>
  17. </el-select>
  18. <el-date-picker
  19. size="small"
  20. v-model="start_time"
  21. prefix-icon="el-icon-date"
  22. :editable="false"
  23. style="width: 196px;"
  24. type="date"
  25. placeholder="选择日期时间"
  26. align="right"
  27. format="yyyy-MM-dd"
  28. value-format="yyyy-MM-dd"
  29. @change="startTimeChange"
  30. ></el-date-picker>-
  31. <el-date-picker
  32. size="small"
  33. v-model="end_time"
  34. prefix-icon="el-icon-date"
  35. :editable="false"
  36. style="width: 196px;"
  37. type="date"
  38. placeholder="选择日期时间"
  39. align="right"
  40. format="yyyy-MM-dd"
  41. value-format="yyyy-MM-dd"
  42. @change="endTimeChange"
  43. ></el-date-picker>
  44. <el-input
  45. size="small"
  46. style="width: 200px;margin-left:10px;"
  47. class="filter-item"
  48. v-model.trim="keywords"
  49. placeholder="耗材名称"
  50. />
  51. <el-button
  52. size="small"
  53. class="filter-item"
  54. type="primary"
  55. icon="el-icon-search"
  56. @click="search"
  57. >搜索</el-button
  58. >
  59. </div>
  60. <div>
  61. <el-button size="small" type="primary" @click="exportList">导出</el-button>
  62. <el-button size="small" type="primary" @click="toPrint">打印</el-button>
  63. </div>
  64. </div>
  65. <el-table
  66. :row-style="{ color: '#303133' }"
  67. :header-cell-style="{
  68. backgroundColor: 'rgb(245, 247, 250)',
  69. color: '#606266'
  70. }"
  71. :data="tableList"
  72. :class="signAndWeighBoxPatients"
  73. border
  74. v-loading="WarehouseInfo.loading"
  75. >
  76. <el-table-column label="耗材类型" align="center">
  77. <template slot-scope="scope">
  78. <span>{{getGoodType(scope.row.good_type_id)}}</span>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="耗材名称" align="center">
  82. <template slot-scope="scope">
  83. {{ scope.row.good_name }}
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="规格&单位" align="center">
  87. <template slot-scope="scope">
  88. <span>{{ scope.row.specification_name }} / {{scope.row.packing_unit}}</span>
  89. </template>
  90. </el-table-column>
  91. <el-table-column label="进货单价" align="center">
  92. <template slot-scope="scope">
  93. {{scope.row.buy_price}}
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="生产商" align="center">
  97. <template slot-scope="scope">
  98. {{getManufacture(scope.row.manufacturer)}}
  99. </template>
  100. </el-table-column>
  101. <el-table-column label="入库数量" align="center">
  102. <template slot-scope="scope">
  103. <span v-if="getWareInfo(scope.row.xt_warehouse_info)>0">{{getWareInfo(scope.row.xt_warehouse_info)}}{{scope.row.packing_unit}}</span>
  104. </template>
  105. </el-table-column>
  106. <el-table-column label="出库数量" align="center">
  107. <template slot-scope="scope">
  108. <span v-if="org_id == 9671 || org_id == 10138 || org_id == 10028 || org_id == 9675 || org_id == 4 || org_id == 3877 || org_id == 10243">
  109. <span>
  110. {{getWareInfo(scope.row.xt_warehouse_info) - getOverFlushInfo(scope.row.xt_warehouse_info) + getCancelSotckInfo(scope.row.cancel_stock_info) }}
  111. </span>
  112. </span>
  113. <span v-else>{{getAutoCount(scope.row.id) + getOutCount(scope.row.id)}} </span>
  114. </template>
  115. </el-table-column>
  116. <el-table-column label="剩余库存量" align="center">
  117. <template slot-scope="scope">
  118. <span v-if="org_id == 9671 || org_id == 10138 || org_id == 10028 || org_id == 9675 || org_id == 4 || org_id == 3877 || org_id == 10243">{{getOverFlushInfo(scope.row.xt_warehouse_info)}}</span>
  119. <span v-else>{{getWareInfo(scope.row.xt_warehouse_info) - getAutoCount(scope.row.id) - getOutCount(scope.row.id) + getCancelCount(scope.row.id) }}</span>
  120. </template>
  121. </el-table-column>
  122. <el-table-column label="操作" align="center" width="260px">
  123. <template slot-scope="scope">
  124. <el-button
  125. size="small"
  126. type="primary"
  127. @click="toClick(scope.row)"
  128. >库存流水
  129. </el-button>
  130. <el-button
  131. size="small"
  132. type="primary"
  133. @click="toClickOne(scope.row)"
  134. >批次
  135. </el-button>
  136. </template>
  137. </el-table-column>
  138. </el-table>
  139. <el-pagination
  140. @size-change="handleSizeChange"
  141. @current-change="handleCurrentChange"
  142. :page-sizes="[10, 50, 100,200,500,1000]"
  143. :page-size="10"
  144. background
  145. align="right"
  146. style="margin-top:20px;"
  147. layout="total, sizes, prev, pager, next, jumper"
  148. :total="total"
  149. >
  150. </el-pagination>
  151. </div>
  152. </div>
  153. </template>
  154. <script>
  155. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  156. import {
  157. GetAllGoodType,
  158. getAllStockList,
  159. getStockDrugCount
  160. } from "@/api/stock";
  161. export default {
  162. name: "stockIn",
  163. created() {
  164. this.org_id = this.$store.getters.xt_user.org_id
  165. var start_time = window.sessionStorage.getItem('start_time')
  166. var end_time = window.sessionStorage.getItem('end_time')
  167. if(start_time !=null){
  168. this.start_time = start_time
  169. }
  170. if(end_time!=null){
  171. this.end_time = end_time
  172. }
  173. window.sessionStorage.removeItem('start_time')
  174. window.sessionStorage.removeItem('end_time')
  175. this.GetAllGoodType();
  176. this.getlist()
  177. this.getStockDrugCount()
  178. },
  179. components: {
  180. BreadCrumb
  181. },
  182. data() {
  183. return {
  184. crumbs: [
  185. { path: false, name: "库存管理" },
  186. { path: "/stock/query", name: "库存查询" }
  187. ],
  188. keywords: "",
  189. total: 0,
  190. multipleSelection: [],
  191. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  192. start_time: "",
  193. end_time: "",
  194. page: 1,
  195. limit: 10,
  196. goodType: [],
  197. goodInfo: [],
  198. WarehouseInfo: {
  199. loading: false,
  200. warehouseInfoDate: []
  201. },
  202. options:[],
  203. value:"",
  204. type_name:0,
  205. types:[],
  206. tableList:[],
  207. manufacturerList:[],
  208. countList:[],
  209. outCountList:[],
  210. autoCountList:[],
  211. cancelCountList:[],
  212. org_id:0,
  213. };
  214. },
  215. methods: {
  216. GetAllGoodType: function() {
  217. GetAllGoodType().then(response => {
  218. if (response.data.state == 0) {
  219. this.$message.error(response.data.msg);
  220. return false;
  221. } else {
  222. var obj = {
  223. id:0,
  224. type_name:'全部'
  225. }
  226. this.types.push(obj)
  227. for (let i = 0; i < response.data.data.goodType.length; i++) {
  228. this.goodType.push(response.data.data.goodType[i]);
  229. this.types.push(response.data.data.goodType[i])
  230. }
  231. }
  232. });
  233. },
  234. GetAllGoodInfo: function() {
  235. GetAllGoodInfo().then(response => {
  236. if (response.data.state == 0) {
  237. this.$message.error(response.data.msg);
  238. return false;
  239. } else {
  240. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  241. this.goodInfo.push(response.data.data.goodInfo[i]);
  242. }
  243. }
  244. });
  245. },
  246. handleBack: function() {
  247. this.$router.go(-1);
  248. },
  249. handleSizeChange(val) {
  250. this.limit = val;
  251. this.getlist()
  252. this.getStockDrugCount()
  253. },
  254. handleCurrentChange(val) {
  255. this.page = val;
  256. this.getlist()
  257. this.getStockDrugCount()
  258. },
  259. calculate: function(val) {
  260. return Math.round(parseFloat(val) * 100) / 100;
  261. },
  262. startTimeChange: function(val) {
  263. window.sessionStorage.removeItem('start_time')
  264. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  265. if (time > 0) {
  266. this.$message.error("开始时间不能大于结束时间");
  267. this.start_time = "";
  268. } else {
  269. this.start_time = val
  270. this.getlist()
  271. this.getStockDrugCount()
  272. }
  273. },
  274. endTimeChange: function(val) {
  275. window.sessionStorage.removeItem('end_time')
  276. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  277. if (time < 0) {
  278. this.$message.error("结束时间不能小于开始时间");
  279. this.end_time = "";
  280. } else {
  281. this.end_time = val
  282. this.getlist()
  283. this.getStockDrugCount()
  284. }
  285. },
  286. stockInCount: function(row) {
  287. let total = 0;
  288. for (let i = 0; i < row.query_warehousing_info.length; i++) {
  289. total = total + row.query_warehousing_info[i].warehousing_count;
  290. }
  291. return total;
  292. },
  293. salesReturnCount: function(row) {
  294. let total = 0;
  295. for (let i = 0; i < row.query_sales_return_info.length; i++) {
  296. total = total + row.query_sales_return_info[i].count;
  297. }
  298. return total;
  299. },
  300. stockOutCount: function(row) {
  301. let total = 0;
  302. for (let i = 0; i < row.query_warehouseout_info.length; i++) {
  303. total = total + row.query_warehouseout_info[i].count;
  304. }
  305. return total;
  306. },
  307. cancelStockCount: function(row) {
  308. let total = 0;
  309. for (let i = 0; i < row.query_cancel_stock_info.length; i++) {
  310. total = total + row.query_cancel_stock_info[i].count;
  311. }
  312. return total;
  313. },
  314. search: function() {
  315. this.getlist()
  316. this.getStockDrugCount()
  317. },
  318. exportList(){
  319. import('@/vendor/Export2Excel').then(excel => {
  320. const tHeader = ['耗材类型', '耗材名称', '规格&单位','进货单价','生产商','入库数量','出库数量','库存剩余量']
  321. const filterVal = ['type_name', 'good_name', 'unit','buy_price','prodect_name','inCount','outCount','overplus']
  322. for(let i=0;i<this.tableList.length;i++){
  323. this.tableList[i].type_name = this.getGoodType(this.tableList[i].good_type_id)
  324. this.tableList[i].unit = this.tableList[i].specification_name + "/" + this.tableList[i].packing_unit
  325. this.tableList[i].prodect_name = this.getManufacture(this.tableList[i].manufacturer)
  326. this.tableList[i].inCount = this.getWareInfo(this.tableList[i].xt_warehouse_info)
  327. this.tableList[i].outCount = this.getAutoCount(this.tableList[i].id) + this.getOutCount(this.tableList[i].id)
  328. if(this.getWareInfo(this.tableList[i].xt_warehouse_info) > 0){
  329. this.tableList[i].overplus = this.getWareInfo(this.tableList[i].xt_warehouse_info) - this.getAutoCount(this.tableList[i].id) - this.getOutCount(this.tableList[i].id) + this.getCancelCount(this.tableList[i].id)
  330. }else{
  331. this.tableList[i].overplus = 0
  332. }
  333. }
  334. const data = this.formatJson(filterVal, this.tableList)
  335. excel.export_json_to_excel({
  336. header: tHeader,
  337. data,
  338. filename: '库存查询'
  339. })
  340. this.downloadLoading = false
  341. })
  342. },
  343. formatJson(filterVal, jsonData) {
  344. return jsonData.map(v => filterVal.map(j => v[j]));
  345. },
  346. changeTypeName(){
  347. this.getlist()
  348. },
  349. toPrint(){
  350. window.sessionStorage.setItem('start_time',this.start_time)
  351. window.sessionStorage.setItem('end_time',this.end_time)
  352. this.$router.push("/stock/stockprint?start_time="+this.start_time+"&end_time="+this.end_time+"&keyword="+this.keywords+"&type_name="+this.type_name+"&page="+this.page+"&limit="+this.limit)
  353. },
  354. getUnit(id){
  355. var name = ""
  356. for(let i=0;i<this.$store.getters.good_unit.length;i++){
  357. if(id == this.$store.getters.good_unit[i].id){
  358. name = this.$store.getters.good_unit[i].name
  359. }
  360. }
  361. return name
  362. },
  363. getTimestamp(time) {
  364. // 把时间日期转成时间戳
  365. return new Date(time).getTime() / 1000;
  366. },
  367. getGoodType(id){
  368. var name = ""
  369. for(let i=0;i<this.goodType.length;i++){
  370. if(id == this.goodType[i].id){
  371. name = this.goodType[i].type_name
  372. }
  373. }
  374. return name
  375. },
  376. getlist(){
  377. const params = {
  378. page: this.page,
  379. limit: this.limit,
  380. keywords: this.keywords,
  381. start_time:this.start_time,
  382. end_time:this.end_time,
  383. type:this.type_name,
  384. };
  385. getAllStockList(params).then(response=>{
  386. if(response.data.state == 1){
  387. var list = response.data.data.list
  388. console.log("总库存数量",list)
  389. this.tableList = list
  390. var total = response.data.data.total
  391. this.total = total
  392. var manufacturerList = response.data.data.manufacturerList
  393. this.manufacturerList = manufacturerList
  394. }
  395. })
  396. },
  397. getManufacture(id){
  398. var name = ""
  399. for(let i=0;i<this.manufacturerList.length;i++){
  400. if(id == this.manufacturerList[i].id){
  401. name = this.manufacturerList[i].manufacturer_name
  402. }
  403. }
  404. return name
  405. },
  406. toClick(val){
  407. var manufacturer_name = ""
  408. var specification_name = ""
  409. for(let i=0;i<this.manufacturerList.length;i++){
  410. if(val.manufacturer == this.manufacturerList[i].id){
  411. manufacturer_name = this.manufacturerList[i].manufacturer_name
  412. }
  413. }
  414. specification_name = val.specification_name + "/" + val.packing_unit
  415. var overCount = this.getOverplus(val.xt_warehouse_info)
  416. window.sessionStorage.setItem('start_time',this.start_time)
  417. window.sessionStorage.setItem('end_time',this.end_time)
  418. this.$router.push({path:"/stock/in/stockflow?id="+val.id+"&good_name="+val.good_name+"&manufacturer="+manufacturer_name+"&specification_name="+specification_name+"&packing_unit="+val.packing_unit+"&overCount="+overCount})
  419. },
  420. toClickOne(val){
  421. var manufacturer_name = ""
  422. var specification_name = ""
  423. for(let i=0;i<this.manufacturerList.length;i++){
  424. if(val.manufacturer == this.manufacturerList[i].id){
  425. manufacturer_name = this.manufacturerList[i].manufacturer_name
  426. }
  427. }
  428. specification_name = val.specification_name + "/" + val.packing_unit
  429. var overCount = this.getOverplus(val.xt_warehouse_info)
  430. window.sessionStorage.setItem('start_time',this.start_time)
  431. window.sessionStorage.setItem('end_time',this.end_time)
  432. this.$router.push({path:"/stock/in/stockbatchnumber?id="+val.id+"&good_name="+val.good_name+"&manufacturer="+manufacturer_name+"&specification_name="+specification_name+"&packing_unit="+val.packing_unit+"&overCount="+overCount})
  433. },
  434. getStockDrugCount(){
  435. var params ={
  436. keywords: this.$route.query.keywords,
  437. start_time:this.start_time,
  438. end_time:this.end_time,
  439. }
  440. getStockDrugCount(params).then(response=>{
  441. if(response.data.state == 1){
  442. var outlist = response.data.data.outList
  443. // console.log("出库数量",outlist)
  444. this.outCountList = outlist
  445. var autoCount = response.data.data.autoCount
  446. // console.log("autoCount",autoCount)
  447. this.autoCountList = autoCount
  448. var totalCount = response.data.data.totalCount
  449. // console.log("totalcount",totalCount)
  450. this.cancelCountList = totalCount
  451. }
  452. })
  453. },
  454. getInCount(id){
  455. var count= 0
  456. for(let i=0;i<this.countList.length;i++){
  457. if(id == this.countList[i].good_id){
  458. count = this.countList[i].count
  459. }
  460. }
  461. return count
  462. },
  463. getOutCount(id){
  464. var count = 0
  465. for(let i=0;i<this.outCountList.length;i++){
  466. if(id == this.outCountList[i].good_id){
  467. count = this.outCountList[i].count
  468. }
  469. }
  470. return count
  471. },
  472. getAutoCount(id){
  473. var count= 0
  474. for(let i=0;i<this.autoCountList.length;i++){
  475. if(id == this.autoCountList[i].good_id){
  476. count = this.autoCountList[i].count
  477. }
  478. }
  479. return count
  480. },
  481. getCancelCount(id){
  482. var count = 0
  483. for(let i=0;i<this.cancelCountList.length;i++){
  484. if(id == this.cancelCountList[i].good_id){
  485. count = this.cancelCountList[i].count
  486. }
  487. }
  488. return count
  489. },
  490. getStockCount(id){
  491. var stock_count = 0
  492. for(let i=0;i<this.countList.length;i++){
  493. if(id == this.countList[i].good_id){
  494. stock_count = this.countList[i].stock_count
  495. }
  496. }
  497. return stock_count
  498. },
  499. getWareInfo(arr){
  500. var total = 0
  501. if(arr.length > 0){
  502. for(let i=0;i<arr.length;i++){
  503. total += parseInt(arr[i].warehousing_count)
  504. }
  505. }else{
  506. total = ""
  507. }
  508. return total
  509. },
  510. getOverplus(arr){
  511. var total = 0
  512. if(arr.length > 0){
  513. for(let i=0;i<arr.length;i++){
  514. total += arr[i].stock_count
  515. }
  516. }else{
  517. total = ""
  518. }
  519. return total
  520. },
  521. getCancelInfo(arr){
  522. var total = 0
  523. if(arr.length > 0){
  524. for(let i=0;i<arr.length;i++){
  525. total += arr[i].count
  526. }
  527. }else{
  528. total = ""
  529. }
  530. return total
  531. },
  532. getOverFlushInfo(arr){
  533. var total = 0
  534. if(arr.length >0){
  535. for(let i=0;i<arr.length;i++){
  536. total += arr[i].stock_count
  537. }
  538. }
  539. return total
  540. },
  541. getCancelSotckInfo(arr){
  542. console.log("2332323232322332",arr)
  543. var cancle_toal = 0
  544. if(arr.length >0){
  545. for(let z=0;z<arr.length;z++){
  546. cancle_toal += arr[z].count
  547. }
  548. }
  549. console.log("total",cancle_toal)
  550. return cancle_toal
  551. }
  552. }
  553. };
  554. </script>
  555. <style rel="stylesheet/css" lang="scss" scoped>
  556. .information {
  557. border: 1px #dcdfe6 solid;
  558. padding: 30px 20px 30px 20px;
  559. .border {
  560. border-bottom: 1px #dcdfe6 solid;
  561. margin: 0px 0 20px 0;
  562. }
  563. }
  564. .title {
  565. background: #409eff;
  566. height: 44px;
  567. line-height: 44px;
  568. padding: 0 0 0 10px;
  569. color: #fff;
  570. margin: 0 0 10px 0;
  571. }
  572. .edit_separater {
  573. border-top: 1px solid rgb(233, 233, 233);
  574. margin-top: 15px;
  575. margin-bottom: 15px;
  576. }
  577. </style>
  578. <style>
  579. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  580. font-size: 12px;
  581. }
  582. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  583. background: #6fb5fa;
  584. }
  585. .count {
  586. color: #bd2c00;
  587. }
  588. .el-table td,
  589. .el-table th.is-leaf,
  590. .el-table--border,
  591. .el-table--group {
  592. border-color: #d0d3da;
  593. }
  594. .el-table--border::after,
  595. .el-table--group::after,
  596. .el-table::before {
  597. background-color: #d0d3da;
  598. }
  599. </style>