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

stockQuery.vue 14KB

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