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

stockQuery.vue 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  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 || org_id == 10088 || org_id== 10245">
  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 || org_id == 10088 || org_id == 10245">{{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. if(this.org_id == 9671 || this.org_id == 10138 || this.org_id == 10028 || this.org_id == 9675 || this.org_id == 4 || this.org_id ==3877 || this.org_id == 10243 || this.org_id == 10088 || this.org_id == 10245){
  328. this.tableList[i].outCount = this.getWareInfo(this.tableList[i].xt_warehouse_info) - this.getOverFlushInfo(this.tableList[i].xt_warehouse_info) + this.getCancelSotckInfo(this.tableList[i].cancel_stock_info)
  329. }else{
  330. this.tableList[i].outCount = this.getAutoCount(this.tableList[i].id) + this.getOutCount(this.tableList[i].id)
  331. }
  332. if(this.org_id == 9671 || this.org_id == 10138 || this.org_id == 10028 || this.org_id == 9675 || this.org_id == 4 || this.org_id ==3877 || this.org_id == 10243 || this.org_id == 10088 || this.org_id == 10245){
  333. this.tableList[i].overplus = this.getOverFlushInfo(this.tableList[i].xt_warehouse_info)
  334. }else{
  335. 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)
  336. }
  337. }
  338. const data = this.formatJson(filterVal, this.tableList)
  339. excel.export_json_to_excel({
  340. header: tHeader,
  341. data,
  342. filename: '库存查询'
  343. })
  344. this.downloadLoading = false
  345. })
  346. },
  347. formatJson(filterVal, jsonData) {
  348. return jsonData.map(v => filterVal.map(j => v[j]));
  349. },
  350. changeTypeName(){
  351. this.getlist()
  352. },
  353. toPrint(){
  354. window.sessionStorage.setItem('start_time',this.start_time)
  355. window.sessionStorage.setItem('end_time',this.end_time)
  356. 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)
  357. },
  358. getUnit(id){
  359. var name = ""
  360. for(let i=0;i<this.$store.getters.good_unit.length;i++){
  361. if(id == this.$store.getters.good_unit[i].id){
  362. name = this.$store.getters.good_unit[i].name
  363. }
  364. }
  365. return name
  366. },
  367. getTimestamp(time) {
  368. // 把时间日期转成时间戳
  369. return new Date(time).getTime() / 1000;
  370. },
  371. getGoodType(id){
  372. var name = ""
  373. for(let i=0;i<this.goodType.length;i++){
  374. if(id == this.goodType[i].id){
  375. name = this.goodType[i].type_name
  376. }
  377. }
  378. return name
  379. },
  380. getlist(){
  381. const params = {
  382. page: this.page,
  383. limit: this.limit,
  384. keywords: this.keywords,
  385. start_time:this.start_time,
  386. end_time:this.end_time,
  387. type:this.type_name,
  388. };
  389. getAllStockList(params).then(response=>{
  390. if(response.data.state == 1){
  391. var list = response.data.data.list
  392. // console.log("总库存数量",list)
  393. this.tableList = list
  394. var total = response.data.data.total
  395. this.total = total
  396. var manufacturerList = response.data.data.manufacturerList
  397. this.manufacturerList = manufacturerList
  398. }
  399. })
  400. },
  401. getManufacture(id){
  402. var name = ""
  403. for(let i=0;i<this.manufacturerList.length;i++){
  404. if(id == this.manufacturerList[i].id){
  405. name = this.manufacturerList[i].manufacturer_name
  406. }
  407. }
  408. return name
  409. },
  410. toClick(val){
  411. var manufacturer_name = ""
  412. var specification_name = ""
  413. for(let i=0;i<this.manufacturerList.length;i++){
  414. if(val.manufacturer == this.manufacturerList[i].id){
  415. manufacturer_name = this.manufacturerList[i].manufacturer_name
  416. }
  417. }
  418. specification_name = val.specification_name + "/" + val.packing_unit
  419. var overCount = this.getOverplus(val.xt_warehouse_info)
  420. window.sessionStorage.setItem('start_time',this.start_time)
  421. window.sessionStorage.setItem('end_time',this.end_time)
  422. 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})
  423. },
  424. toClickOne(val){
  425. var manufacturer_name = ""
  426. var specification_name = ""
  427. for(let i=0;i<this.manufacturerList.length;i++){
  428. if(val.manufacturer == this.manufacturerList[i].id){
  429. manufacturer_name = this.manufacturerList[i].manufacturer_name
  430. }
  431. }
  432. specification_name = val.specification_name + "/" + val.packing_unit
  433. var overCount = this.getOverplus(val.xt_warehouse_info)
  434. window.sessionStorage.setItem('start_time',this.start_time)
  435. window.sessionStorage.setItem('end_time',this.end_time)
  436. 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})
  437. },
  438. getStockDrugCount(){
  439. var params ={
  440. keywords: this.$route.query.keywords,
  441. start_time:this.start_time,
  442. end_time:this.end_time,
  443. }
  444. getStockDrugCount(params).then(response=>{
  445. if(response.data.state == 1){
  446. var outlist = response.data.data.outList
  447. // console.log("出库数量",outlist)
  448. this.outCountList = outlist
  449. var autoCount = response.data.data.autoCount
  450. // console.log("autoCount",autoCount)
  451. this.autoCountList = autoCount
  452. var totalCount = response.data.data.totalCount
  453. // console.log("totalcount",totalCount)
  454. this.cancelCountList = totalCount
  455. }
  456. })
  457. },
  458. getInCount(id){
  459. var count= 0
  460. for(let i=0;i<this.countList.length;i++){
  461. if(id == this.countList[i].good_id){
  462. count = this.countList[i].count
  463. }
  464. }
  465. return count
  466. },
  467. getOutCount(id){
  468. var count = 0
  469. for(let i=0;i<this.outCountList.length;i++){
  470. if(id == this.outCountList[i].good_id){
  471. count = this.outCountList[i].count
  472. }
  473. }
  474. return count
  475. },
  476. getAutoCount(id){
  477. var count= 0
  478. for(let i=0;i<this.autoCountList.length;i++){
  479. if(id == this.autoCountList[i].good_id){
  480. count = this.autoCountList[i].count
  481. }
  482. }
  483. return count
  484. },
  485. getCancelCount(id){
  486. var count = 0
  487. for(let i=0;i<this.cancelCountList.length;i++){
  488. if(id == this.cancelCountList[i].good_id){
  489. count = this.cancelCountList[i].count
  490. }
  491. }
  492. return count
  493. },
  494. getStockCount(id){
  495. var stock_count = 0
  496. for(let i=0;i<this.countList.length;i++){
  497. if(id == this.countList[i].good_id){
  498. stock_count = this.countList[i].stock_count
  499. }
  500. }
  501. return stock_count
  502. },
  503. getWareInfo(arr){
  504. var total = 0
  505. if(arr.length > 0){
  506. for(let i=0;i<arr.length;i++){
  507. total += parseInt(arr[i].warehousing_count)
  508. }
  509. }else{
  510. total = ""
  511. }
  512. return total
  513. },
  514. getOverplus(arr){
  515. var total = 0
  516. if(arr.length > 0){
  517. for(let i=0;i<arr.length;i++){
  518. total += arr[i].stock_count
  519. }
  520. }else{
  521. total = ""
  522. }
  523. return total
  524. },
  525. getCancelInfo(arr){
  526. var total = 0
  527. if(arr.length > 0){
  528. for(let i=0;i<arr.length;i++){
  529. total += arr[i].count
  530. }
  531. }else{
  532. total = ""
  533. }
  534. return total
  535. },
  536. getOverFlushInfo(arr){
  537. var total = 0
  538. if(arr.length >0){
  539. for(let i=0;i<arr.length;i++){
  540. total += arr[i].stock_count
  541. }
  542. }
  543. return total
  544. },
  545. getCancelSotckInfo(arr){
  546. console.log("2332323232322332",arr)
  547. var cancle_toal = 0
  548. if(arr.length >0){
  549. for(let z=0;z<arr.length;z++){
  550. cancle_toal += arr[z].count
  551. }
  552. }
  553. console.log("total",cancle_toal)
  554. return cancle_toal
  555. }
  556. }
  557. };
  558. </script>
  559. <style rel="stylesheet/css" lang="scss" scoped>
  560. .information {
  561. border: 1px #dcdfe6 solid;
  562. padding: 30px 20px 30px 20px;
  563. .border {
  564. border-bottom: 1px #dcdfe6 solid;
  565. margin: 0px 0 20px 0;
  566. }
  567. }
  568. .title {
  569. background: #409eff;
  570. height: 44px;
  571. line-height: 44px;
  572. padding: 0 0 0 10px;
  573. color: #fff;
  574. margin: 0 0 10px 0;
  575. }
  576. .edit_separater {
  577. border-top: 1px solid rgb(233, 233, 233);
  578. margin-top: 15px;
  579. margin-bottom: 15px;
  580. }
  581. </style>
  582. <style>
  583. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  584. font-size: 12px;
  585. }
  586. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  587. background: #6fb5fa;
  588. }
  589. .count {
  590. color: #bd2c00;
  591. }
  592. .el-table td,
  593. .el-table th.is-leaf,
  594. .el-table--border,
  595. .el-table--group {
  596. border-color: #d0d3da;
  597. }
  598. .el-table--border::after,
  599. .el-table--group::after,
  600. .el-table::before {
  601. background-color: #d0d3da;
  602. }
  603. </style>