goodDetail.vue 8.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <div>
  3. <div style="display: flex;justify-content: space-between;margin-bottom:10px;">
  4. <div>
  5. <el-input size="small" style="width:150px;" v-model="keywords"
  6. placeholder="请输入耗材名称"
  7. class="filter-item"/>
  8. <el-button size="small" class="filter-item" type="primary" @click="searchAction">搜索</el-button>
  9. <el-date-picker
  10. v-model="chargeDate"
  11. type="daterange"
  12. value-format="yyyy-MM-dd"
  13. range-separator="至"
  14. start-placeholder="开始日期"
  15. @change="changeDate"
  16. end-placeholder="结束日期">
  17. </el-date-picker>
  18. </div>
  19. </div>
  20. <el-table :data="tableData" border :row-style="{ color: '#303133' }" ref="table"
  21. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  22. max-height="600"
  23. highlight-current-row>
  24. <el-table-column align="center" prop="name" label="序号">
  25. <template slot-scope="scope">
  26. {{scope.$index +1}}
  27. </template>
  28. </el-table-column>
  29. <el-table-column align="center" prop="name" label="日期">
  30. <template slot-scope="scope">
  31. {{getTime(scope.row.record_date)}}
  32. </template>
  33. </el-table-column>
  34. <el-table-column align="center" prop="name" label="耗材类型">
  35. <template slot-scope="scope">
  36. {{getGoodType(scope.row.project_id)}}
  37. </template>
  38. </el-table-column>
  39. <el-table-column align="center" prop="name" label="耗材名称">
  40. <template slot-scope="scope">
  41. {{getGoodName(scope.row.project_id)}}
  42. </template>
  43. </el-table-column>
  44. <el-table-column align="center" prop="name" label="规格">
  45. <template slot-scope="scope">
  46. {{getSpecificatioName(scope.row.project_id)}}
  47. </template>
  48. </el-table-column>
  49. <el-table-column align="center" prop="name" label="数量">
  50. <template slot-scope="scope">
  51. {{getCount(scope.row.child)}}
  52. </template>
  53. </el-table-column>
  54. <el-table-column align="center" prop="name" label="单位">
  55. <template slot-scope="scope">
  56. {{getUnit(scope.row.project_id)}}
  57. </template>
  58. </el-table-column>
  59. <el-table-column align="center" prop="total" label="操作">
  60. <template slot-scope="scope">
  61. <div style="color: #589ff8" @click="jump(scope.row.child,scope.row.project_id)">使用明细</div>
  62. </template>
  63. </el-table-column>
  64. </el-table>
  65. <el-dialog
  66. title="耗材明细"
  67. :visible.sync="dialogVisible"
  68. width="60%">
  69. <div style="margin-bottom:10px"> <span>耗材类型:{{getGoodType(good_id)}}</span>
  70. <span>耗材名称:{{getGoodName(good_id)}}</span>
  71. </div>
  72. <span>
  73. <el-table :data="tableList" border :row-style="{ color: '#303133' }" ref="table"
  74. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  75. max-height="600"
  76. highlight-current-row>
  77. <el-table-column align="center" prop="name" label="序号">
  78. <template slot-scope="scope">
  79. {{scope.$index + 1}}
  80. </template>
  81. </el-table-column>
  82. <el-table-column align="center" prop="name" label="使用日期">
  83. <template slot-scope="scope">
  84. {{getTime(scope.row.record_date)}}
  85. </template>
  86. </el-table-column>
  87. <el-table-column align="center" prop="name" label="患者名字">
  88. <template slot-scope="scope">
  89. {{getPatientName(scope.row.patient_id)}}
  90. </template>
  91. </el-table-column>
  92. <el-table-column align="center" prop="name" label="数量">
  93. <template slot-scope="scope">
  94. {{scope.row.count}}
  95. </template>
  96. </el-table-column>
  97. <el-table-column align="center" prop="name" label="单位">
  98. <template slot-scope="scope">
  99. {{getUnit(scope.row.project_id)}}
  100. </template>
  101. </el-table-column>
  102. </el-table>
  103. </span>
  104. <span slot="footer" class="dialog-footer">
  105. <el-button @click="dialogVisible = false">取 消</el-button>
  106. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  107. </span>
  108. </el-dialog>
  109. </div>
  110. </template>
  111. <script>
  112. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  113. const moment = require('moment')
  114. import {getGoodDetailSummary} from "@/api/stock"
  115. import { uParseTime } from '@/utils/tools'
  116. export default {
  117. components: {
  118. BreadCrumb
  119. },
  120. data() {
  121. return {
  122. detail_loading: false,
  123. tempArr: [],
  124. pos: 0,
  125. sameRowArr: [],
  126. keywords: '',
  127. tableData: [],
  128. chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
  129. limit:1000,
  130. page:1,
  131. total:0,
  132. goodList:[],
  133. patients:[],
  134. good_id:0,
  135. goodType:[],
  136. dialogVisible:false,
  137. tableList:[],
  138. }
  139. },
  140. methods:{
  141. changeDate(){
  142. this.tableData = []
  143. this.getlist()
  144. },
  145. getlist(){
  146. let start_time = this.chargeDate[0]
  147. let end_time = this.chargeDate[1]
  148. var params = {
  149. start_time: start_time,
  150. end_time: end_time,
  151. keyword: this.keywords,
  152. limit:this.limit,
  153. page:this.page,
  154. }
  155. getGoodDetailSummary(params).then(response=>{
  156. if(response.data.state == 1){
  157. var list = response.data.data.list
  158. this.total = response.data.data.total
  159. this.goodList = response.data.data.good
  160. this.goodType = response.data.data.goodType
  161. for(let i=0;i<list.length;i++){
  162. for(let j=0;j<this.goodList.length;j++){
  163. if(list[i].project_id == this.goodList[j].id){
  164. this.tableData.push(list[i])
  165. }
  166. }
  167. }
  168. this.patients = response.data.data.patients
  169. console.log("@33232322332",this.tableData)
  170. }
  171. })
  172. },
  173. jump(val,good_id){
  174. this.dialogVisible = true
  175. this.tableList= val
  176. this.good_id = good_id
  177. },
  178. getPatientName(id){
  179. var name = ""
  180. for(let i=0;i<this.patients.length;i++){
  181. if(id == this.patients[i].id){
  182. name = this.patients[i].name
  183. }
  184. }
  185. return name
  186. },
  187. getTime(val) {
  188. if(val < 0){
  189. return ""
  190. }
  191. if(val == ""){
  192. return ""
  193. }else {
  194. return uParseTime(val, '{y}-{m}-{d}')
  195. }
  196. },
  197. getGoodType(id){
  198. var good_type = 0
  199. for(let i=0;i<this.goodList.length;i++){
  200. if(id == this.goodList[i].id){
  201. good_type = this.goodList[i].good_type_id
  202. }
  203. }
  204. var type_name = ""
  205. for(let i=0;i<this.goodType.length;i++){
  206. if(good_type == this.goodType[i].id){
  207. type_name = this.goodType[i].type_name
  208. }
  209. }
  210. return type_name
  211. },
  212. getGoodName(good_id){
  213. var good_name = ""
  214. for(let i=0;i<this.goodList.length;i++){
  215. if(good_id == this.goodList[i].id){
  216. good_name = this.goodList[i].good_name
  217. }
  218. }
  219. return good_name
  220. },
  221. getSpecificatioName(good_id){
  222. var specification_name = ""
  223. for(let i=0;i<this.goodList.length;i++){
  224. if(good_id == this.goodList[i].id){
  225. specification_name = this.goodList[i].specification_name
  226. }
  227. }
  228. return specification_name
  229. },
  230. getCount(val){
  231. var total = 0
  232. for(let i=0;i<val.length;i++){
  233. total += parseInt(val[i].count)
  234. }
  235. return total
  236. },
  237. getUnit(id){
  238. var packing_unit = ""
  239. for(let i=0;i<this.goodList.length;i++){
  240. if(id == this.goodList[i].id){
  241. packing_unit = this.goodList[i].packing_unit
  242. }
  243. }
  244. return packing_unit
  245. },
  246. searchAction(){
  247. this.tableData = []
  248. this.getlist()
  249. }
  250. },
  251. created() {
  252. this.getlist()
  253. }
  254. }
  255. </script>