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

query.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <el-button
  6. size="small"
  7. class="filter-item"
  8. type="primary"
  9. icon="el-icon-search"
  10. @click="setting"
  11. >设置
  12. </el-button
  13. >
  14. <!-- <el-button
  15. size="small"
  16. class="filter-item"
  17. type="primary"
  18. icon="el-icon-search"
  19. @click="exportStock"
  20. >导出
  21. </el-button> -->
  22. </div>
  23. <div class="app-container ">
  24. <div class="cell clearfix">
  25. <el-input
  26. size="small"
  27. style="width: 400px;"
  28. class="filter-item"
  29. v-model.trim="keywords"
  30. placeholder="商品名称/规格名称"
  31. />
  32. <el-button
  33. size="small"
  34. class="filter-item"
  35. type="primary"
  36. icon="el-icon-search"
  37. @click="search"
  38. >搜索
  39. </el-button
  40. >
  41. </div>
  42. <el-table
  43. :row-style="{ color: '#303133' }"
  44. :header-cell-style="{
  45. backgroundColor: 'rgb(245, 247, 250)',
  46. color: '#606266'
  47. }"
  48. :data="WarehouseInfo.warehouseInfoDate"
  49. :class="signAndWeighBoxPatients"
  50. border
  51. v-loading="WarehouseInfo.loading"
  52. :span-method="merge"
  53. >
  54. <el-table-column label="药品名称" align="center">
  55. <template slot-scope="scope">
  56. {{ scope.row.drug_name }}
  57. </template>
  58. </el-table-column>
  59. <el-table-column label="规格名称" align="center">
  60. <template slot-scope="scope">
  61. <span>{{ scope.row.drug_spec }}</span>
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="入库数量" align="center">
  65. <template slot-scope="scope">
  66. <span
  67. @click="showStockInDetailDialog(scope.row.drug_id)"
  68. >{{ stockInCount(scope.row) }}</span
  69. >
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="入库退货" align="center">
  73. <template slot-scope="scope">
  74. <span
  75. @click="showSaleReturnDetailDialog(scope.row)"
  76. >{{ salesReturnCount(scope.row) }}</span
  77. >
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="实际入库" align="center">
  81. <template slot-scope="scope">
  82. {{ stockInCount(scope.row) - salesReturnCount(scope.row) }}
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="出库数量" align="center">
  86. <template slot-scope="scope">
  87. <span
  88. @click="showStockOutDetailDialog(scope.row.drug_id)"
  89. >{{ stockOutCount(scope.row) }}</span
  90. >
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="出库退库" align="center">
  94. <template slot-scope="scope">
  95. <span
  96. @click="showCancelStockDetailDialog(scope.row)"
  97. >{{ cancelStockCount(scope.row) }}</span
  98. >
  99. </template>
  100. </el-table-column>
  101. <el-table-column label="实际出库" align="center">
  102. <template slot-scope="scope">
  103. {{ stockOutCount(scope.row) - cancelStockCount(scope.row) }}
  104. </template>
  105. </el-table-column>
  106. <el-table-column label="剩余库存" align="center">
  107. <template slot-scope="scope">
  108. <span>{{
  109. stockInCount(scope.row) -
  110. salesReturnCount(scope.row) -
  111. stockOutCount(scope.row) +
  112. cancelStockCount(scope.row)
  113. }}</span>
  114. </template>
  115. </el-table-column>
  116. </el-table>
  117. <el-pagination
  118. @size-change="handleSizeChange"
  119. @current-change="handleCurrentChange"
  120. :page-sizes="[10, 50, 100]"
  121. :page-size="10"
  122. background
  123. align="right"
  124. style="margin-top:20px;"
  125. layout="total, sizes, prev, pager, next, jumper"
  126. :total="total"
  127. >
  128. </el-pagination>
  129. </div>
  130. <setting-dialog
  131. ref="dialog"
  132. ></setting-dialog>
  133. </div>
  134. </template>
  135. <script>
  136. import { uParseTime } from '@/utils/tools'
  137. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  138. import { getAllDrugStockQueryList } from '@/api/drug/drug_stock'
  139. import SettingDialog from './settingDialog/index'
  140. export default {
  141. name: 'stockIn',
  142. created() {
  143. this.GetAllDrugStockQueryList()
  144. },
  145. components: {
  146. SettingDialog,
  147. BreadCrumb
  148. },
  149. data() {
  150. return {
  151. crumbs: [
  152. { path: false, name: '库存管理' },
  153. { path: '/stock/drugs/stock/query', name: '药品库存查询' }
  154. ],
  155. keywords: '',
  156. total: 0,
  157. multipleSelection: [],
  158. signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
  159. start_time: '',
  160. end_time: '',
  161. page: 1,
  162. limit: 10,
  163. goodType: [],
  164. goodInfo: [],
  165. tempArr: [],
  166. sameRowArr: [],
  167. WarehouseInfo: {
  168. loading: false,
  169. warehouseInfoDate: []
  170. },
  171. tableData:[]
  172. }
  173. },
  174. methods: {
  175. handleSpanTempArr() {
  176. this.tempArr = []
  177. for (let i = 0; i < this.WarehouseInfo.warehouseInfoDate.length; i++) {
  178. if (i === 0) {
  179. this.tempArr.push(1)
  180. this.pos = 0
  181. } else {
  182. // 判断当前元素与上一个元素是否相同
  183. if (this.WarehouseInfo.warehouseInfoDate[i].drug_name === this.WarehouseInfo.warehouseInfoDate[i - 1].drug_name) {
  184. this.tempArr[this.pos] += 1
  185. this.tempArr.push(0)
  186. } else {
  187. this.tempArr.push(1)
  188. this.pos = i
  189. }
  190. }
  191. }
  192. let sameRowArr = [], sIdx = 0
  193. this.WarehouseInfo.warehouseInfoDate.forEach((item, index) => {
  194. item.index = index
  195. if (index === 0) {
  196. sameRowArr.push([index])
  197. } else {
  198. if (item.drug_name === this.WarehouseInfo.warehouseInfoDate[index - 1].drug_name) {
  199. sameRowArr[sIdx].push(index)
  200. } else {
  201. sIdx = sIdx + 1
  202. sameRowArr.push([index])
  203. }
  204. }
  205. })
  206. this.sameRowArr = sameRowArr
  207. },
  208. merge({ row, column, rowIndex, columnIndex }) {
  209. if (columnIndex === 0) {
  210. const _row = this.tempArr[rowIndex]
  211. const _col = _row > 0 ? 1 : 0
  212. return {
  213. rowspan: _row,
  214. colspan: _col
  215. }
  216. }
  217. },
  218. GetAllDrugStockQueryList: function() {
  219. console.log(this.keywords)
  220. const Params = {
  221. page: this.page,
  222. limit: this.limit,
  223. keyword: this.keywords
  224. }
  225. this.WarehouseInfo.loading = true
  226. this.WarehouseInfo.warehouseInfoDate = []
  227. getAllDrugStockQueryList(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. var arr = []
  236. for (let i = 0; i < response.data.data.list.length; i++) {
  237. this.WarehouseInfo.warehouseInfoDate.push(
  238. response.data.data.list[i]
  239. )
  240. arr.push(response.data.data.list[i])
  241. }
  242. console.log("数据源头",arr)
  243. // for(let i=0;i<arr.length;i++){
  244. // arr[i].stockInCount =
  245. // }
  246. this.handleSpanTempArr()
  247. }
  248. })
  249. },
  250. getSpecificationName: function(id) {
  251. let name = ''
  252. for (let i = 0; i < this.goodInfo.length; i++) {
  253. if (this.goodInfo[i].id == id) {
  254. name = this.goodInfo[i].specification_name
  255. }
  256. }
  257. return name
  258. },
  259. getTypeName: function(id) {
  260. let name = ''
  261. for (let i = 0; i < this.goodType.length; i++) {
  262. if (this.goodType[i].id == id) {
  263. name = this.goodType[i].type_name
  264. }
  265. }
  266. return name
  267. },
  268. handleBack: function() {
  269. this.$router.go(-1)
  270. },
  271. handleSizeChange(val) {
  272. this.limit = val
  273. this.GetAllDrugStockQueryList()
  274. },
  275. handleCurrentChange(val) {
  276. this.page = val
  277. this.GetAllDrugStockQueryList()
  278. },
  279. calculate: function(val) {
  280. return Math.round(parseFloat(val) * 100) / 100
  281. },
  282. startTimeChange: function() {
  283. this.GetAllDrugStockQueryList()
  284. },
  285. endTimeChange: function() {
  286. this.GetAllDrugStockQueryList()
  287. },
  288. stockInCount: function(row) {
  289. let total = 0
  290. for (let i = 0; i < row.query_drug_warehousing_info.length; i++) {
  291. total = total + row.query_drug_warehousing_info[i].warehousing_count
  292. }
  293. return total
  294. },
  295. salesReturnCount: function(row) {
  296. let total = 0
  297. for (let i = 0; i < row.query_drug_sales_return_info.length; i++) {
  298. total = total + row.query_drug_sales_return_info[i].count
  299. }
  300. return total
  301. },
  302. stockOutCount: function(row) {
  303. let total = 0
  304. for (let i = 0; i < row.query_drug_warehouseout_info.length; i++) {
  305. total = total + row.query_drug_warehouseout_info[i].count
  306. }
  307. return total
  308. },
  309. cancelStockCount: function(row) {
  310. let total = 0
  311. for (let i = 0; i < row.query_drug_cancel_stock_info.length; i++) {
  312. total = total + row.query_drug_cancel_stock_info[i].count
  313. }
  314. return total
  315. },
  316. showStockInDetailDialog: function(val) {
  317. },
  318. showSaleReturnDetailDialog: function() {
  319. },
  320. showStockOutDetailDialog: function() {
  321. },
  322. showCancelStockDetailDialog: function() {
  323. },
  324. search: function() {
  325. this.GetAllDrugStockQueryList()
  326. }, setting: function() {
  327. this.$refs.dialog.show()
  328. },
  329. // exportStock(){
  330. // import('@/vendor/Export2Excel').then(excel => {
  331. // const tHeader = ['药品名称', '规格名称', '入库数量','入库退货','实际入库','出库数量','出库退货','实际出库','剩余库存']
  332. // const filterVal = ['index', 'dialysis_no', 'name','drug_name','drug_spec','Total','Count','margin','margin']
  333. // // for(let i=0;i<this.tableData.length;i++){
  334. // // this.tableData[i].margin = (this.tableData[i].Total?this.tableData[i].Total:0) - this.tableData[i].Count
  335. // // }
  336. // const data = this.formatJson(filterVal, this.tableData)
  337. // excel.export_json_to_excel({
  338. // header: tHeader,
  339. // data,
  340. // filename: '自备药查询'
  341. // })
  342. // this.downloadLoading = false
  343. // })
  344. // },
  345. // formatJson(filterVal, jsonData) {
  346. // return jsonData.map(v => filterVal.map(j => v[j]));
  347. // },
  348. }
  349. }
  350. </script>
  351. <style rel="stylesheet/css" lang="scss" scoped>
  352. .information {
  353. border: 1px #dcdfe6 solid;
  354. padding: 30px 20px 30px 20px;
  355. .border {
  356. border-bottom: 1px #dcdfe6 solid;
  357. margin: 0px 0 20px 0;
  358. }
  359. }
  360. .title {
  361. background: #409eff;
  362. height: 44px;
  363. line-height: 44px;
  364. padding: 0 0 0 10px;
  365. color: #fff;
  366. margin: 0 0 10px 0;
  367. }
  368. .edit_separater {
  369. border-top: 1px solid rgb(233, 233, 233);
  370. margin-top: 15px;
  371. margin-bottom: 15px;
  372. }
  373. </style>
  374. <style>
  375. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  376. font-size: 12px;
  377. }
  378. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  379. background: #6fb5fa;
  380. }
  381. .count {
  382. color: #bd2c00;
  383. }
  384. .el-table td,
  385. .el-table th.is-leaf,
  386. .el-table--border,
  387. .el-table--group {
  388. border-color: #d0d3da;
  389. }
  390. .el-table--border::after,
  391. .el-table--group::after,
  392. .el-table::before {
  393. background-color: #d0d3da;
  394. }
  395. </style>