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

stockQuery.vue 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  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="WarehouseInfo.warehouseInfoDate"
  72. :class="signAndWeighBoxPatients"
  73. border
  74. v-loading="WarehouseInfo.loading"
  75. >
  76. <el-table-column label="商品编码" align="center">
  77. <template slot-scope="scope">
  78. {{ scope.row.good_code }}
  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.type.type_name }}</span>
  89. </template>
  90. </el-table-column>
  91. <el-table-column label="规格型号" align="center">
  92. <template slot-scope="scope">
  93. <span>{{ scope.row.specification_name }}</span>
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="单位" align="center">
  97. <template slot-scope="scope">
  98. <span>{{getUnit(scope.row.good_unit)}}</span>
  99. </template>
  100. </el-table-column>
  101. <el-table-column label="进货价" align="center">
  102. <template slot-scope="scope">
  103. <span v-if="scope.row.query_warehousing_info.length>0">{{scope.row.query_warehousing_info[0].price?scope.row.query_warehousing_info[0].price:""}}</span>
  104. </template>
  105. </el-table-column>
  106. <el-table-column label="入库数量" align="center">
  107. <template slot-scope="scope">
  108. <span
  109. @click="showStockInDetailDialog(scope.row.good_id)"
  110. >{{ stockInCount(scope.row) }}</span
  111. >
  112. </template>
  113. </el-table-column>
  114. <el-table-column label="入库退货" align="center">
  115. <template slot-scope="scope">
  116. <span
  117. @click="showSaleReturnDetailDialog(scope.row)"
  118. >{{ salesReturnCount(scope.row) }}</span
  119. >
  120. </template>
  121. </el-table-column>
  122. <el-table-column label="实际入库" align="center">
  123. <template slot-scope="scope">
  124. {{ stockInCount(scope.row) - salesReturnCount(scope.row) }}
  125. </template>
  126. </el-table-column>
  127. <el-table-column label="出库数量" align="center">
  128. <template slot-scope="scope">
  129. <span
  130. @click="showStockOutDetailDialog(scope.row.good_id)"
  131. >{{ stockOutCount(scope.row) }}</span
  132. >
  133. </template>
  134. </el-table-column>
  135. <el-table-column label="出库退库" align="center">
  136. <template slot-scope="scope">
  137. <span
  138. @click="showCancelStockDetailDialog(scope.row)"
  139. >{{ cancelStockCount(scope.row) }}</span
  140. >
  141. </template>
  142. </el-table-column>
  143. <el-table-column label="实际出库" align="center">
  144. <template slot-scope="scope">
  145. {{ stockOutCount(scope.row) - cancelStockCount(scope.row) }}
  146. </template>
  147. </el-table-column>
  148. <el-table-column label="剩余库存" align="center">
  149. <template slot-scope="scope">
  150. <span>{{stockInCount(scope.row) - stockOutCount(scope.row) }}</span>
  151. </template>
  152. </el-table-column>
  153. </el-table> -->
  154. <el-table
  155. :row-style="{ color: '#303133' }"
  156. :header-cell-style="{
  157. backgroundColor: 'rgb(245, 247, 250)',
  158. color: '#606266'
  159. }"
  160. :data="tableList"
  161. :class="signAndWeighBoxPatients"
  162. border
  163. v-loading="WarehouseInfo.loading"
  164. >
  165. <el-table-column label="耗材类型" align="center">
  166. <template slot-scope="scope">
  167. <span>{{getGoodType(scope.row.good_type_id)}}</span>
  168. </template>
  169. </el-table-column>
  170. <el-table-column label="耗材名称" align="center">
  171. <template slot-scope="scope">
  172. {{ scope.row.good_name }}
  173. </template>
  174. </el-table-column>
  175. <el-table-column label="规格&单位" align="center">
  176. <template slot-scope="scope">
  177. <span>{{ scope.row.specification_name }}*{{scope.row.min_number}}{{scope.row.min_unit}}</span>
  178. </template>
  179. </el-table-column>
  180. <el-table-column label="进货单价" align="center">
  181. <template slot-scope="scope">
  182. {{scope.row.price}}
  183. </template>
  184. </el-table-column>
  185. <el-table-column label="厂商" align="center">
  186. <template slot-scope="scope">
  187. {{getManufacture(scope.row.manufacturer)}}
  188. </template>
  189. </el-table-column>
  190. <el-table-column label="剩余库存量" align="center">
  191. <template slot-scope="scope">
  192. <span v-if="scope.row.stock_count!=0">{{scope.row.stock_count}}</span>
  193. </template>
  194. </el-table-column>
  195. <el-table-column label="操作" align="center" width="260px">
  196. <template slot-scope="scope">
  197. <el-button
  198. size="small"
  199. type="primary"
  200. @click="toClick(scope.row)"
  201. >库存流水
  202. </el-button>
  203. <el-button
  204. size="small"
  205. type="primary"
  206. @click="toClickOne(scope.row)"
  207. >批次
  208. </el-button>
  209. </template>
  210. </el-table-column>
  211. </el-table>
  212. <el-pagination
  213. @size-change="handleSizeChange"
  214. @current-change="handleCurrentChange"
  215. :page-sizes="[10, 50, 100,200,500,1000]"
  216. :page-size="10"
  217. background
  218. align="right"
  219. style="margin-top:20px;"
  220. layout="total, sizes, prev, pager, next, jumper"
  221. :total="total"
  222. >
  223. </el-pagination>
  224. </div>
  225. </div>
  226. </template>
  227. <script>
  228. import { uParseTime } from "@/utils/tools";
  229. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  230. import {
  231. GetAllGoodInfo,
  232. GetAllGoodType,
  233. getAllStockQueryList,
  234. getAllStockList
  235. } from "@/api/stock";
  236. export default {
  237. name: "stockIn",
  238. created() {
  239. // this.GetAllStockQuery();
  240. this.GetAllGoodInfo();
  241. this.GetAllGoodType();
  242. this.getlist()
  243. },
  244. components: {
  245. BreadCrumb
  246. },
  247. data() {
  248. return {
  249. crumbs: [
  250. { path: false, name: "库存管理" },
  251. { path: "/stock/query", name: "库存查询" }
  252. ],
  253. keywords: "",
  254. total: 0,
  255. multipleSelection: [],
  256. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  257. start_time: "",
  258. end_time: "",
  259. page: 1,
  260. limit: 10,
  261. goodType: [],
  262. goodInfo: [],
  263. WarehouseInfo: {
  264. loading: false,
  265. warehouseInfoDate: []
  266. },
  267. options:[],
  268. value:"",
  269. type_name:0,
  270. types:[],
  271. tableList:[],
  272. manufacturerList:[]
  273. };
  274. },
  275. methods: {
  276. GetAllStockQuery: function() {
  277. console.log(this.keywords);
  278. const Params = {
  279. page: this.page,
  280. limit: this.limit,
  281. keyword: this.keywords,
  282. start_time:this.start_time,
  283. end_time:this.end_time,
  284. type_name:this.type_name,
  285. };
  286. this.WarehouseInfo.loading = true;
  287. this.WarehouseInfo.warehouseInfoDate = [];
  288. getAllStockQueryList(Params).then(response => {
  289. if (response.data.state == 0) {
  290. this.WarehouseInfo.loading = false;
  291. this.$message.error(response.data.msg);
  292. return false;
  293. } else {
  294. this.WarehouseInfo.loading = false;
  295. this.total = response.data.data.total;
  296. for (let i = 0; i < response.data.data.list.length; i++) {
  297. this.WarehouseInfo.warehouseInfoDate.push( response.data.data.list[i]);
  298. }
  299. }
  300. console.log("数据源头",this.WarehouseInfo.warehouseInfoDate)
  301. for(let i=0;i<this.WarehouseInfo.warehouseInfoDate.length;i++){
  302. this.WarehouseInfo.warehouseInfoDate[i].type_name = this.WarehouseInfo.warehouseInfoDate[i].type.type_name
  303. this.WarehouseInfo.warehouseInfoDate[i].stockInCount = this.stockInCount(this.WarehouseInfo.warehouseInfoDate[i])
  304. this.WarehouseInfo.warehouseInfoDate[i].salesReturnCount = this.salesReturnCount(this.WarehouseInfo.warehouseInfoDate[i])
  305. this.WarehouseInfo.warehouseInfoDate[i].realCount = this.stockInCount(this.WarehouseInfo.warehouseInfoDate[i]) - this.salesReturnCount(this.WarehouseInfo.warehouseInfoDate[i])
  306. this.WarehouseInfo.warehouseInfoDate[i].stockOutCount = this.stockOutCount(this.WarehouseInfo.warehouseInfoDate[i])
  307. this.WarehouseInfo.warehouseInfoDate[i].cancelStockCount = this.cancelStockCount(this.WarehouseInfo.warehouseInfoDate[i])
  308. this.WarehouseInfo.warehouseInfoDate[i].realOutCount = this.stockOutCount(this.WarehouseInfo.warehouseInfoDate[i]) - this.cancelStockCount(this.WarehouseInfo.warehouseInfoDate[i])
  309. this.WarehouseInfo.warehouseInfoDate[i].overplus = this.stockInCount(this.WarehouseInfo.warehouseInfoDate[i]) -this.salesReturnCount(this.WarehouseInfo.warehouseInfoDate[i]) - this.stockOutCount(this.WarehouseInfo.warehouseInfoDate[i]) + this.cancelStockCount(this.WarehouseInfo.warehouseInfoDate[i])
  310. if(this.WarehouseInfo.warehouseInfoDate[i].query_warehousing_info.length>0){
  311. this.WarehouseInfo.warehouseInfoDate[i].price = this.WarehouseInfo.warehouseInfoDate[i].query_warehousing_info[0].price
  312. this.WarehouseInfo.warehouseInfoDate[i].all_price = (this.stockInCount(this.WarehouseInfo.warehouseInfoDate[i]) * this.WarehouseInfo.warehouseInfoDate[i].query_warehousing_info[0].price).toFixed(2)
  313. }else{
  314. this.WarehouseInfo.warehouseInfoDate[i].price = ""
  315. this.WarehouseInfo.warehouseInfoDate[i].all_price = ""
  316. }
  317. }
  318. console.log("数据2222222",this.WarehouseInfo.warehouseInfoDate)
  319. });
  320. },
  321. GetAllGoodType: function() {
  322. GetAllGoodType().then(response => {
  323. if (response.data.state == 0) {
  324. this.$message.error(response.data.msg);
  325. return false;
  326. } else {
  327. var obj = {
  328. id:0,
  329. type_name:'全部'
  330. }
  331. this.types.push(obj)
  332. for (let i = 0; i < response.data.data.goodType.length; i++) {
  333. this.goodType.push(response.data.data.goodType[i]);
  334. this.types.push(response.data.data.goodType[i])
  335. }
  336. console.log("商品类型",this.types)
  337. }
  338. });
  339. },
  340. GetAllGoodInfo: function() {
  341. GetAllGoodInfo().then(response => {
  342. if (response.data.state == 0) {
  343. this.$message.error(response.data.msg);
  344. return false;
  345. } else {
  346. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  347. this.goodInfo.push(response.data.data.goodInfo[i]);
  348. }
  349. }
  350. });
  351. },
  352. handleBack: function() {
  353. this.$router.go(-1);
  354. },
  355. handleSizeChange(val) {
  356. this.limit = val;
  357. this.getlist()
  358. },
  359. handleCurrentChange(val) {
  360. this.page = val;
  361. this.getlist()
  362. },
  363. calculate: function(val) {
  364. return Math.round(parseFloat(val) * 100) / 100;
  365. },
  366. startTimeChange: function(val) {
  367. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  368. if (time > 0) {
  369. this.$message.error("开始时间不能大于结束时间");
  370. this.start_time = "";
  371. } else {
  372. this.start_time = val
  373. this.getlist()
  374. }
  375. },
  376. endTimeChange: function(val) {
  377. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  378. if (time < 0) {
  379. this.$message.error("结束时间不能小于开始时间");
  380. this.end_time = "";
  381. } else {
  382. this.end_time = val
  383. this.getlist()
  384. }
  385. },
  386. stockInCount: function(row) {
  387. let total = 0;
  388. for (let i = 0; i < row.query_warehousing_info.length; i++) {
  389. total = total + row.query_warehousing_info[i].warehousing_count;
  390. }
  391. return total;
  392. },
  393. salesReturnCount: function(row) {
  394. let total = 0;
  395. for (let i = 0; i < row.query_sales_return_info.length; i++) {
  396. total = total + row.query_sales_return_info[i].count;
  397. }
  398. return total;
  399. },
  400. stockOutCount: function(row) {
  401. let total = 0;
  402. for (let i = 0; i < row.query_warehouseout_info.length; i++) {
  403. total = total + row.query_warehouseout_info[i].count;
  404. }
  405. return total;
  406. },
  407. cancelStockCount: function(row) {
  408. let total = 0;
  409. for (let i = 0; i < row.query_cancel_stock_info.length; i++) {
  410. total = total + row.query_cancel_stock_info[i].count;
  411. }
  412. return total;
  413. },
  414. showStockInDetailDialog: function(val) {},
  415. showSaleReturnDetailDialog: function() {},
  416. showStockOutDetailDialog: function() {},
  417. showCancelStockDetailDialog: function() {},
  418. search: function() {
  419. this.getlist()
  420. },
  421. exportList(){
  422. import('@/vendor/Export2Excel').then(excel => {
  423. const tHeader = ['商品编码', '耗材名称', '耗材类型','规格型号','入库数量','进货价','入库退货','实际入库','出库数量','出库退库','实际出库','剩余库存']
  424. const filterVal = ['good_code', 'good_name', 'type_name','specification_name','stockInCount','price','salesReturnCount','realCount','stockOutCount','cancelStockCount','realOutCount','overplus']
  425. const data = this.formatJson(filterVal, this.WarehouseInfo.warehouseInfoDate)
  426. console.log("data",data)
  427. excel.export_json_to_excel({
  428. header: tHeader,
  429. data,
  430. filename: '库存查询'
  431. })
  432. this.downloadLoading = false
  433. })
  434. },
  435. formatJson(filterVal, jsonData) {
  436. return jsonData.map(v => filterVal.map(j => v[j]));
  437. },
  438. changeTypeName(){
  439. this.GetAllStockQuery()
  440. },
  441. toPrint(){
  442. 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)
  443. },
  444. getUnit(id){
  445. var name = ""
  446. for(let i=0;i<this.$store.getters.good_unit.length;i++){
  447. if(id == this.$store.getters.good_unit[i].id){
  448. name = this.$store.getters.good_unit[i].name
  449. }
  450. }
  451. return name
  452. },
  453. getTimestamp(time) {
  454. // 把时间日期转成时间戳
  455. return new Date(time).getTime() / 1000;
  456. },
  457. getGoodType(id){
  458. var name = ""
  459. for(let i=0;i<this.goodType.length;i++){
  460. if(id == this.goodType[i].id){
  461. name = this.goodType[i].type_name
  462. }
  463. }
  464. return name
  465. },
  466. getlist(){
  467. const params = {
  468. page: this.page,
  469. limit: this.limit,
  470. keywords: this.keywords,
  471. start_time:this.start_time,
  472. end_time:this.end_time,
  473. type_name:this.type_name,
  474. };
  475. console.log("params",params)
  476. getAllStockList(params).then(response=>{
  477. if(response.data.state == 1){
  478. var list = response.data.data.list
  479. console.log("list22222",list)
  480. this.tableList = list
  481. var total = response.data.data.total
  482. console.log("total",total)
  483. this.total = total
  484. var manufacturerList = response.data.data.manufacturerList
  485. this.manufacturerList = manufacturerList
  486. }
  487. })
  488. },
  489. getManufacture(id){
  490. var name = ""
  491. for(let i=0;i<this.manufacturerList.length;i++){
  492. if(id == this.manufacturerList[i].id){
  493. name = this.manufacturerList[i].manufacturer_name
  494. }
  495. }
  496. return name
  497. },
  498. toClick(val){
  499. this.$router.push({path:"/stock/in/stockflow?id="+val.good_id+"&good_name="+val.good_name})
  500. },
  501. toClickOne(val){
  502. this.$router.push({path:"/stock/in/stockbatchnumber?id="+val.good_id+"&good_name="+val.good_name})
  503. }
  504. }
  505. };
  506. </script>
  507. <style rel="stylesheet/css" lang="scss" scoped>
  508. .information {
  509. border: 1px #dcdfe6 solid;
  510. padding: 30px 20px 30px 20px;
  511. .border {
  512. border-bottom: 1px #dcdfe6 solid;
  513. margin: 0px 0 20px 0;
  514. }
  515. }
  516. .title {
  517. background: #409eff;
  518. height: 44px;
  519. line-height: 44px;
  520. padding: 0 0 0 10px;
  521. color: #fff;
  522. margin: 0 0 10px 0;
  523. }
  524. .edit_separater {
  525. border-top: 1px solid rgb(233, 233, 233);
  526. margin-top: 15px;
  527. margin-bottom: 15px;
  528. }
  529. </style>
  530. <style>
  531. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  532. font-size: 12px;
  533. }
  534. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  535. background: #6fb5fa;
  536. }
  537. .count {
  538. color: #bd2c00;
  539. }
  540. .el-table td,
  541. .el-table th.is-leaf,
  542. .el-table--border,
  543. .el-table--group {
  544. border-color: #d0d3da;
  545. }
  546. .el-table--border::after,
  547. .el-table--group::after,
  548. .el-table::before {
  549. background-color: #d0d3da;
  550. }
  551. </style>