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

stockQuery.vue 16KB

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