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

stockQuery.vue 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  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>{{
  151. stockInCount(scope.row)- stockOutCount(scope.row) + cancelStockCount(scope.row)
  152. }}</span>
  153. </template>
  154. </el-table-column>
  155. </el-table>
  156. <el-pagination
  157. @size-change="handleSizeChange"
  158. @current-change="handleCurrentChange"
  159. :page-sizes="[10, 50, 100,200,500,1000]"
  160. :page-size="10"
  161. background
  162. align="right"
  163. style="margin-top:20px;"
  164. layout="total, sizes, prev, pager, next, jumper"
  165. :total="total"
  166. >
  167. </el-pagination>
  168. </div>
  169. </div>
  170. </template>
  171. <script>
  172. import { uParseTime } from "@/utils/tools";
  173. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  174. import {
  175. GetAllGoodInfo,
  176. GetAllGoodType,
  177. getAllStockQueryList
  178. } from "@/api/stock";
  179. export default {
  180. name: "stockIn",
  181. created() {
  182. this.GetAllStockQuery();
  183. this.GetAllGoodInfo();
  184. this.GetAllGoodType();
  185. },
  186. components: {
  187. BreadCrumb
  188. },
  189. data() {
  190. return {
  191. crumbs: [
  192. { path: false, name: "库存管理" },
  193. { path: "/stock/query", name: "库存查询" }
  194. ],
  195. keywords: "",
  196. total: 0,
  197. multipleSelection: [],
  198. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  199. start_time: "",
  200. end_time: "",
  201. page: 1,
  202. limit: 10,
  203. goodType: [],
  204. goodInfo: [],
  205. WarehouseInfo: {
  206. loading: false,
  207. warehouseInfoDate: []
  208. },
  209. options:[],
  210. value:"",
  211. type_name:"",
  212. types:[],
  213. };
  214. },
  215. methods: {
  216. GetAllStockQuery: function() {
  217. console.log(this.keywords);
  218. const Params = {
  219. page: this.page,
  220. limit: this.limit,
  221. keyword: this.keywords,
  222. start_time:this.start_time,
  223. end_time:this.end_time,
  224. type_name:this.type_name,
  225. };
  226. this.WarehouseInfo.loading = true;
  227. this.WarehouseInfo.warehouseInfoDate = [];
  228. getAllStockQueryList(Params).then(response => {
  229. if (response.data.state == 0) {
  230. this.WarehouseInfo.loading = false;
  231. this.$message.error(response.data.msg);
  232. return false;
  233. } else {
  234. this.WarehouseInfo.loading = false;
  235. this.total = response.data.data.total;
  236. for (let i = 0; i < response.data.data.list.length; i++) {
  237. this.WarehouseInfo.warehouseInfoDate.push( response.data.data.list[i]);
  238. }
  239. }
  240. console.log("数据源头",this.WarehouseInfo.warehouseInfoDate)
  241. for(let i=0;i<this.WarehouseInfo.warehouseInfoDate.length;i++){
  242. this.WarehouseInfo.warehouseInfoDate[i].type_name = this.WarehouseInfo.warehouseInfoDate[i].type.type_name
  243. this.WarehouseInfo.warehouseInfoDate[i].stockInCount = this.stockInCount(this.WarehouseInfo.warehouseInfoDate[i])
  244. this.WarehouseInfo.warehouseInfoDate[i].salesReturnCount = this.salesReturnCount(this.WarehouseInfo.warehouseInfoDate[i])
  245. this.WarehouseInfo.warehouseInfoDate[i].realCount = this.stockInCount(this.WarehouseInfo.warehouseInfoDate[i]) - this.salesReturnCount(this.WarehouseInfo.warehouseInfoDate[i])
  246. this.WarehouseInfo.warehouseInfoDate[i].stockOutCount = this.stockOutCount(this.WarehouseInfo.warehouseInfoDate[i])
  247. this.WarehouseInfo.warehouseInfoDate[i].cancelStockCount = this.cancelStockCount(this.WarehouseInfo.warehouseInfoDate[i])
  248. this.WarehouseInfo.warehouseInfoDate[i].realOutCount = this.stockOutCount(this.WarehouseInfo.warehouseInfoDate[i]) - this.cancelStockCount(this.WarehouseInfo.warehouseInfoDate[i])
  249. 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])
  250. if(this.WarehouseInfo.warehouseInfoDate[i].query_warehousing_info.length>0){
  251. this.WarehouseInfo.warehouseInfoDate[i].price = this.WarehouseInfo.warehouseInfoDate[i].query_warehousing_info[0].price
  252. this.WarehouseInfo.warehouseInfoDate[i].all_price = (this.stockInCount(this.WarehouseInfo.warehouseInfoDate[i]) * this.WarehouseInfo.warehouseInfoDate[i].query_warehousing_info[0].price).toFixed(2)
  253. }else{
  254. this.WarehouseInfo.warehouseInfoDate[i].price = ""
  255. this.WarehouseInfo.warehouseInfoDate[i].all_price = ""
  256. }
  257. }
  258. console.log("数据2222222",this.WarehouseInfo.warehouseInfoDate)
  259. });
  260. },
  261. GetAllGoodType: function() {
  262. GetAllGoodType().then(response => {
  263. if (response.data.state == 0) {
  264. this.$message.error(response.data.msg);
  265. return false;
  266. } else {
  267. var obj = {
  268. id:0,
  269. type_name:'全部'
  270. }
  271. this.types.push(obj)
  272. for (let i = 0; i < response.data.data.goodType.length; i++) {
  273. this.goodType.push(response.data.data.goodType[i]);
  274. this.types.push(response.data.data.goodType[i])
  275. }
  276. console.log("商品类型",this.types)
  277. }
  278. });
  279. },
  280. GetAllGoodInfo: function() {
  281. GetAllGoodInfo().then(response => {
  282. if (response.data.state == 0) {
  283. this.$message.error(response.data.msg);
  284. return false;
  285. } else {
  286. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  287. this.goodInfo.push(response.data.data.goodInfo[i]);
  288. }
  289. }
  290. });
  291. },
  292. handleBack: function() {
  293. this.$router.go(-1);
  294. },
  295. handleSizeChange(val) {
  296. this.limit = val;
  297. this.GetAllStockQuery();
  298. },
  299. handleCurrentChange(val) {
  300. this.page = val;
  301. this.GetAllStockQuery();
  302. },
  303. calculate: function(val) {
  304. return Math.round(parseFloat(val) * 100) / 100;
  305. },
  306. startTimeChange: function(val) {
  307. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  308. if (time > 0) {
  309. this.$message.error("开始时间不能大于结束时间");
  310. this.start_time = "";
  311. } else {
  312. this.start_time = val
  313. this.GetAllStockQuery();
  314. }
  315. },
  316. endTimeChange: function(val) {
  317. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  318. if (time < 0) {
  319. this.$message.error("结束时间不能小于开始时间");
  320. this.end_time = "";
  321. } else {
  322. this.end_time = val
  323. this.GetAllStockQuery();
  324. }
  325. },
  326. stockInCount: function(row) {
  327. let total = 0;
  328. for (let i = 0; i < row.query_warehousing_info.length; i++) {
  329. total = total + row.query_warehousing_info[i].warehousing_count;
  330. }
  331. return total;
  332. },
  333. salesReturnCount: function(row) {
  334. let total = 0;
  335. for (let i = 0; i < row.query_sales_return_info.length; i++) {
  336. total = total + row.query_sales_return_info[i].count;
  337. }
  338. return total;
  339. },
  340. stockOutCount: function(row) {
  341. let total = 0;
  342. for (let i = 0; i < row.query_warehouseout_info.length; i++) {
  343. total = total + row.query_warehouseout_info[i].count;
  344. }
  345. return total;
  346. },
  347. cancelStockCount: function(row) {
  348. let total = 0;
  349. for (let i = 0; i < row.query_cancel_stock_info.length; i++) {
  350. total = total + row.query_cancel_stock_info[i].count;
  351. }
  352. return total;
  353. },
  354. showStockInDetailDialog: function(val) {},
  355. showSaleReturnDetailDialog: function() {},
  356. showStockOutDetailDialog: function() {},
  357. showCancelStockDetailDialog: function() {},
  358. search: function() {
  359. this.GetAllStockQuery();
  360. },
  361. exportList(){
  362. import('@/vendor/Export2Excel').then(excel => {
  363. const tHeader = ['商品编码', '耗材名称', '耗材类型','规格型号','入库数量','进货价','入库退货','实际入库','出库数量','出库退库','实际出库','剩余库存']
  364. const filterVal = ['good_code', 'good_name', 'type_name','specification_name','stockInCount','price','salesReturnCount','realCount','stockOutCount','cancelStockCount','realOutCount','overplus']
  365. const data = this.formatJson(filterVal, this.WarehouseInfo.warehouseInfoDate)
  366. console.log("data",data)
  367. excel.export_json_to_excel({
  368. header: tHeader,
  369. data,
  370. filename: '库存查询'
  371. })
  372. this.downloadLoading = false
  373. })
  374. },
  375. formatJson(filterVal, jsonData) {
  376. return jsonData.map(v => filterVal.map(j => v[j]));
  377. },
  378. changeTypeName(){
  379. this.GetAllStockQuery()
  380. },
  381. toPrint(){
  382. 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)
  383. },
  384. getUnit(id){
  385. var name = ""
  386. for(let i=0;i<this.$store.getters.good_unit.length;i++){
  387. if(id == this.$store.getters.good_unit[i].id){
  388. name = this.$store.getters.good_unit[i].name
  389. }
  390. }
  391. return name
  392. },
  393. getTimestamp(time) {
  394. // 把时间日期转成时间戳
  395. return new Date(time).getTime() / 1000;
  396. },
  397. }
  398. };
  399. </script>
  400. <style rel="stylesheet/css" lang="scss" scoped>
  401. .information {
  402. border: 1px #dcdfe6 solid;
  403. padding: 30px 20px 30px 20px;
  404. .border {
  405. border-bottom: 1px #dcdfe6 solid;
  406. margin: 0px 0 20px 0;
  407. }
  408. }
  409. .title {
  410. background: #409eff;
  411. height: 44px;
  412. line-height: 44px;
  413. padding: 0 0 0 10px;
  414. color: #fff;
  415. margin: 0 0 10px 0;
  416. }
  417. .edit_separater {
  418. border-top: 1px solid rgb(233, 233, 233);
  419. margin-top: 15px;
  420. margin-bottom: 15px;
  421. }
  422. </style>
  423. <style>
  424. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  425. font-size: 12px;
  426. }
  427. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  428. background: #6fb5fa;
  429. }
  430. .count {
  431. color: #bd2c00;
  432. }
  433. .el-table td,
  434. .el-table th.is-leaf,
  435. .el-table--border,
  436. .el-table--group {
  437. border-color: #d0d3da;
  438. }
  439. .el-table--border::after,
  440. .el-table--group::after,
  441. .el-table::before {
  442. background-color: #d0d3da;
  443. }
  444. </style>