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

query.vue 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <div>
  6. <el-button
  7. size="small"
  8. class="filter-item"
  9. type="primary"
  10. icon="el-icon-search"
  11. @click="setting"
  12. >设置
  13. </el-button
  14. >
  15. <el-button
  16. size="small"
  17. class="filter-item"
  18. type="primary"
  19. icon="el-icon-search"
  20. @click="printOrder"
  21. >打印
  22. </el-button>
  23. <el-button
  24. size="small"
  25. class="filter-item"
  26. type="primary"
  27. icon="el-icon-search"
  28. @click="exportStock"
  29. >导出
  30. </el-button>
  31. </div>
  32. </div>
  33. <div class="app-container ">
  34. <div class="cell clearfix">
  35. <el-select v-model="drug_category" style="width:160px;margin-right:10px;" placeholder="请选择" @change="changeDrug">
  36. <el-option
  37. v-for="(item,index) in drugCategory"
  38. :key="index"
  39. :label="item.name"
  40. :value="item.id">
  41. </el-option>
  42. </el-select>
  43. <el-date-picker
  44. v-model="start_time"
  45. prefix-icon="el-icon-date"
  46. :editable="false"
  47. style="width: 196px;"
  48. type="date"
  49. placeholder="选择日期时间"
  50. align="right"
  51. format="yyyy-MM-dd"
  52. value-format="yyyy-MM-dd"
  53. @change="startTimeChange"
  54. ></el-date-picker>-
  55. <el-date-picker
  56. v-model="end_time"
  57. prefix-icon="el-icon-date"
  58. :editable="false"
  59. style="width: 196px;margin-right:10px;"
  60. type="date"
  61. placeholder="选择日期时间"
  62. align="right"
  63. format="yyyy-MM-dd"
  64. value-format="yyyy-MM-dd"
  65. @change="endTimeChange"
  66. ></el-date-picker>
  67. <el-input
  68. style="width: 200px;"
  69. class="filter-item"
  70. v-model.trim="keywords"
  71. placeholder="商品名称/规格名称"
  72. />
  73. <el-button
  74. size="small"
  75. class="filter-item"
  76. type="primary"
  77. icon="el-icon-search"
  78. @click="search"
  79. >搜索
  80. </el-button>
  81. </div>
  82. <el-table :data="tableList" border style="width: 100%">
  83. <!-- <el-table-column prop="date" label="药品编号" width="180">
  84. <template slot-scope="scope">
  85. </template>
  86. </el-table-column> -->
  87. <el-table-column prop="drug_type" label="药品类型" width="180" align="center">
  88. <template slot-scope="scope">
  89. {{getDrugType(scope.row.drug_type)}}
  90. </template>
  91. </el-table-column>
  92. <el-table-column prop="drug_name" label="药品名称" align="center">
  93. <template slot-scope="scope">
  94. {{scope.row.drug_name}}
  95. </template>
  96. </el-table-column>
  97. <el-table-column prop="drug_name" label="规格&&单位" align="center">
  98. <template slot-scope="scope">
  99. {{scope.row.dose + scope.row.dose_unit +"*"+scope.row.min_number+scope.row.min_unit+"/"+scope.row.max_unit}}
  100. </template>
  101. </el-table-column>
  102. <el-table-column prop="drug_name" label="进货单价" align="center">
  103. <template slot-scope="scope">
  104. {{scope.row.last_price}}
  105. </template>
  106. </el-table-column>
  107. <el-table-column prop="drug_name" label="厂家" align="center">
  108. <template slot-scope="scope">
  109. {{getManufacturerList(scope.row.manufacturer)}}
  110. </template>
  111. </el-table-column>
  112. <el-table-column prop="drug_name" label="剩余库存量" align="center">
  113. <template slot-scope="scope">
  114. <span v-if="scope.row.stock_max_number!=''">
  115. {{scope.row.stock_max_number}}{{scope.row.max_unit}}
  116. <span v-if="scope.row.stock_min_number!=''">
  117. {{scope.row.stock_min_number}}{{scope.row.min_unit}}
  118. </span>
  119. </span>
  120. </template>
  121. </el-table-column>
  122. <el-table-column prop="drug_name" label="操作" align="center">
  123. <template slot-scope="scope">
  124. <el-button
  125. size="small"
  126. type="primary"
  127. @click="handleDetail(scope.row.drug_id)"
  128. >库存流水
  129. </el-button>
  130. <el-button
  131. size="small"
  132. type="primary"
  133. @click="handleBatch(scope.row.drug_id)"
  134. >批次
  135. </el-button>
  136. </template>
  137. </el-table-column>
  138. </el-table>
  139. <el-pagination
  140. @size-change="handleSizeChange"
  141. @current-change="handleCurrentChange"
  142. :page-sizes="[10, 50, 100,500,1000]"
  143. :page-size="10"
  144. background
  145. align="right"
  146. style="margin-top:20px;"
  147. layout="total, sizes, prev, pager, next, jumper"
  148. :total="total"
  149. >
  150. </el-pagination>
  151. </div>
  152. <setting-dialog
  153. ref="dialog"
  154. ></setting-dialog>
  155. </div>
  156. </template>
  157. <script>
  158. import { uParseTime } from '@/utils/tools'
  159. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  160. import { getAllDrugStockQueryList,getDrugStockList } from '@/api/drug/drug_stock'
  161. import SettingDialog from './settingDialog/index'
  162. import { getDictionaryDataConfig } from "@/utils/data";
  163. export default {
  164. name: 'stockIn',
  165. created() {
  166. var drugCategory = getDictionaryDataConfig('system','drug_category')
  167. this.drugCategory.push(...drugCategory)
  168. this.drugTypeList = getDictionaryDataConfig('system','drug_type')
  169. this.getlist()
  170. },
  171. components: {
  172. SettingDialog,
  173. BreadCrumb
  174. },
  175. data() {
  176. return {
  177. crumbs: [
  178. { path: false, name: '库存管理' },
  179. { path: '/stock/drugs/stock/query', name: '药品库存查询' }
  180. ],
  181. keywords: '',
  182. total: 0,
  183. multipleSelection: [],
  184. signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
  185. start_time: '',
  186. end_time: '',
  187. page: 1,
  188. limit: 10,
  189. goodType: [],
  190. goodInfo: [],
  191. tempArr: [],
  192. sameRowArr: [],
  193. WarehouseInfo: {
  194. loading: false,
  195. warehouseInfoDate: []
  196. },
  197. tableData:[],
  198. drug_category:0,
  199. drugCategory:[
  200. {id:0,name:"全部"}
  201. ],
  202. drugTypeList:[],
  203. tableList:[],
  204. manufacturerList:[]
  205. }
  206. },
  207. methods: {
  208. handleSpanTempArr() {
  209. this.tempArr = []
  210. for (let i = 0; i < this.WarehouseInfo.warehouseInfoDate.length; i++) {
  211. if (i === 0) {
  212. this.tempArr.push(1)
  213. this.pos = 0
  214. } else {
  215. // 判断当前元素与上一个元素是否相同
  216. if (this.WarehouseInfo.warehouseInfoDate[i].drug_name === this.WarehouseInfo.warehouseInfoDate[i - 1].drug_name) {
  217. this.tempArr[this.pos] += 1
  218. this.tempArr.push(0)
  219. } else {
  220. this.tempArr.push(1)
  221. this.pos = i
  222. }
  223. }
  224. }
  225. let sameRowArr = [], sIdx = 0
  226. this.WarehouseInfo.warehouseInfoDate.forEach((item, index) => {
  227. item.index = index
  228. if (index === 0) {
  229. sameRowArr.push([index])
  230. } else {
  231. if (item.drug_name === this.WarehouseInfo.warehouseInfoDate[index - 1].drug_name) {
  232. sameRowArr[sIdx].push(index)
  233. } else {
  234. sIdx = sIdx + 1
  235. sameRowArr.push([index])
  236. }
  237. }
  238. })
  239. this.sameRowArr = sameRowArr
  240. },
  241. merge({ row, column, rowIndex, columnIndex }) {
  242. if (columnIndex === 0) {
  243. const _row = this.tempArr[rowIndex]
  244. const _col = _row > 0 ? 1 : 0
  245. return {
  246. rowspan: _row,
  247. colspan: _col
  248. }
  249. }
  250. },
  251. GetAllDrugStockQueryList: function() {
  252. const Params = {
  253. page: this.page,
  254. limit: this.limit,
  255. keyword: this.keywords,
  256. drug_category:this.drug_category,
  257. start_time:this.start_time,
  258. end_time:this.end_time,
  259. }
  260. this.WarehouseInfo.loading = true
  261. this.WarehouseInfo.warehouseInfoDate = []
  262. getAllDrugStockQueryList(Params).then(response => {
  263. if (response.data.state == 0) {
  264. this.WarehouseInfo.loading = false
  265. this.$message.error(response.data.msg)
  266. return false
  267. } else {
  268. this.WarehouseInfo.loading = false
  269. this.total = response.data.data.total
  270. var arr = []
  271. for (let i = 0; i < response.data.data.list.length; i++) {
  272. this.WarehouseInfo.warehouseInfoDate.push(response.data.data.list[i])
  273. arr.push(response.data.data.list[i])
  274. }
  275. for(let i=0;i<arr.length;i++){
  276. arr[i].stockInCount = this.stockInCount(arr[i])
  277. arr[i].salesReturnCount = this.salesReturnCount(arr[i])
  278. arr[i].reactCount = (this.stockInCount(arr[i]) - this.salesReturnCount(arr[i]))?this.stockInCount(arr[i]) - this.salesReturnCount(arr[i]):0
  279. arr[i].stockOutCount = this.stockOutCount(arr[i])
  280. arr[i].cancelStockCount = this.cancelStockCount(arr[i])?this.cancelStockCount(arr[i]):0
  281. arr[i].reactOutCount = (this.stockOutCount(arr[i]) - this.cancelStockCount(arr[i]))?(this.stockOutCount(arr[i]) - this.cancelStockCount(arr[i])):0
  282. arr[i].overplusCount = (this.stockInCount(arr[i])-this.salesReturnCount(arr[i])-this.stockOutCount(arr[i])+this.cancelStockCount(arr[i]))?this.stockInCount(arr[i])-this.salesReturnCount(arr[i])-this.stockOutCount(arr[i])+this.cancelStockCount(arr[i]):0
  283. }
  284. this.tableData = arr
  285. this.handleSpanTempArr()
  286. }
  287. })
  288. },
  289. getSpecificationName: function(id) {
  290. let name = ''
  291. for (let i = 0; i < this.goodInfo.length; i++) {
  292. if (this.goodInfo[i].id == id) {
  293. name = this.goodInfo[i].specification_name
  294. }
  295. }
  296. return name
  297. },
  298. getTypeName: function(id) {
  299. let name = ''
  300. for (let i = 0; i < this.goodType.length; i++) {
  301. if (this.goodType[i].id == id) {
  302. name = this.goodType[i].type_name
  303. }
  304. }
  305. return name
  306. },
  307. handleBack: function() {
  308. this.$router.go(-1)
  309. },
  310. handleSizeChange(val) {
  311. this.limit = val
  312. // this.GetAllDrugStockQueryList()
  313. this.getlist()
  314. },
  315. handleCurrentChange(val) {
  316. this.page = val
  317. // this.GetAllDrugStockQueryList()
  318. this.getlist()
  319. },
  320. calculate: function(val) {
  321. return Math.round(parseFloat(val) * 100) / 100
  322. },
  323. startTimeChange: function(val) {
  324. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  325. if (time > 0) {
  326. this.$message.error("开始时间不能大于结束时间");
  327. this.start_time = "";
  328. } else {
  329. // this.GetAllDrugStockQueryList();
  330. this.getlist()
  331. }
  332. },
  333. endTimeChange: function(val) {
  334. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  335. if (time < 0) {
  336. this.$message.error("结束时间不能小于开始时间");
  337. this.end_time = "";
  338. } else {
  339. // this.GetAllDrugStockQueryList();
  340. this.getlist()
  341. }
  342. },
  343. stockInCount: function(row) {
  344. let total = 0
  345. for (let i = 0; i < row.query_drug_warehousing_info.length; i++) {
  346. total = total + row.query_drug_warehousing_info[i].warehousing_count
  347. }
  348. return total
  349. },
  350. salesReturnCount: function(row) {
  351. let total = 0
  352. for (let i = 0; i < row.query_drug_sales_return_info.length; i++) {
  353. total = total + row.query_drug_sales_return_info[i].count
  354. }
  355. return total
  356. },
  357. stockOutCount: function(row) {
  358. let total = 0
  359. for (let i = 0; i < row.query_drug_warehouseout_info.length; i++) {
  360. total = total + row.query_drug_warehouseout_info[i].count
  361. }
  362. return total
  363. },
  364. cancelStockCount: function(row) {
  365. let total = 0
  366. for (let i = 0; i < row.query_drug_cancel_stock_info.length; i++) {
  367. total = total + row.query_drug_cancel_stock_info[i].count
  368. }
  369. return total
  370. },
  371. showStockInDetailDialog: function(val) {
  372. },
  373. showSaleReturnDetailDialog: function() {
  374. },
  375. showStockOutDetailDialog: function() {
  376. },
  377. showCancelStockDetailDialog: function() {
  378. },
  379. search: function() {
  380. // this.GetAllDrugStockQueryList()
  381. this.getlist()
  382. },
  383. setting: function() {
  384. this.$refs.dialog.show()
  385. },
  386. exportStock(){
  387. import('@/vendor/Export2Excel').then(excel => {
  388. const tHeader = ['药品名称', '规格名称', '入库数量','单价','入库退货','实际入库','出库数量','出库退库','实际出库','剩余库存']
  389. const filterVal = ['drug_name', 'drug_spec', 'stockInCount','last_price','salesReturnCount','reactCount','stockOutCount','cancelStockCount','reactOutCount','overplusCount']
  390. const data = this.formatJson(filterVal, this.tableData)
  391. // console.log("data",data)
  392. excel.export_json_to_excel({
  393. header: tHeader,
  394. data,
  395. filename: '药品查询'
  396. })
  397. this.downloadLoading = false
  398. })
  399. },
  400. formatJson(filterVal, jsonData) {
  401. return jsonData.map(v => filterVal.map(j => v[j]));
  402. },
  403. getDictionaryDataConfig(module, filed_name) {
  404. return getDictionaryDataConfig(module, filed_name)
  405. },
  406. getTimestamp(time) { // 把时间日期转成时间戳
  407. return (new Date(time)).getTime() / 1000
  408. },
  409. changeDrug(){
  410. this.getlist()
  411. },
  412. printOrder(){
  413. this.$router.push({
  414. name: "drugQueryPrint",
  415. query: {drug_category:this.drug_category,keyword:this.keywords,start_time:this.start_time,end_time:this.end_time,page:this.page,limit:this.limit}
  416. });
  417. },
  418. //获取库存
  419. getlist(){
  420. const params = {
  421. page: this.page,
  422. limit: this.limit,
  423. keyword: this.keywords,
  424. drug_category:this.drug_category,
  425. start_time:this.start_time,
  426. end_time:this.end_time,
  427. }
  428. getDrugStockList(params).then(response=>{
  429. if(response.data.state == 1){
  430. var list = response.data.data.list
  431. console.log("list99999",list)
  432. this.tableList = list
  433. var total = response.data.data.total
  434. console.log("total",total)
  435. this.total = total
  436. this.manufacturerList = response.data.data.manufacturerList
  437. }
  438. })
  439. },
  440. getDrugType(id){
  441. var name = ""
  442. for(let i=0;i<this.drugTypeList.length;i++){
  443. if(this.drugTypeList[i].id == id){
  444. name = this.drugTypeList[i].name
  445. }
  446. }
  447. return name
  448. },
  449. getManufacturerList(id){
  450. var name = ""
  451. for(let i=0;i<this.manufacturerList.length;i++){
  452. if(id == this.manufacturerList[i].id){
  453. name = this.manufacturerList[i].manufacturer_name
  454. }
  455. }
  456. return name
  457. },
  458. handleDetail(id){
  459. this.$router.push({path:'/drugstock/in/drugstockflow?drug_id='+id})
  460. },
  461. handleBatch(id){
  462. this.$router.push({path:'/drugstock/in/drugbatchnumber?drug_id='+id})
  463. }
  464. }
  465. }
  466. </script>
  467. <style rel="stylesheet/css" lang="scss" scoped>
  468. .information {
  469. border: 1px #dcdfe6 solid;
  470. padding: 30px 20px 30px 20px;
  471. .border {
  472. border-bottom: 1px #dcdfe6 solid;
  473. margin: 0px 0 20px 0;
  474. }
  475. }
  476. .title {
  477. background: #409eff;
  478. height: 44px;
  479. line-height: 44px;
  480. padding: 0 0 0 10px;
  481. color: #fff;
  482. margin: 0 0 10px 0;
  483. }
  484. .edit_separater {
  485. border-top: 1px solid rgb(233, 233, 233);
  486. margin-top: 15px;
  487. margin-bottom: 15px;
  488. }
  489. </style>
  490. <style>
  491. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  492. font-size: 12px;
  493. }
  494. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  495. background: #6fb5fa;
  496. }
  497. .count {
  498. color: #bd2c00;
  499. }
  500. .el-table td,
  501. .el-table th.is-leaf,
  502. .el-table--border,
  503. .el-table--group {
  504. border-color: #d0d3da;
  505. }
  506. .el-table--border::after,
  507. .el-table--group::after,
  508. .el-table::before {
  509. background-color: #d0d3da;
  510. }
  511. </style>