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

dialysisParameter.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. <template>
  2. <div class="page_consumables">
  3. <div class="cell clearfix">
  4. <label class="title"> <span class="name">排班班次</span> : </label>
  5. <div class="time">
  6. <ul class>
  7. <li
  8. :class="item.value == schedulType ? 'active' : ''"
  9. @click="selectSchedulType(item.value)"
  10. v-for="item in schedulArr"
  11. :key="item.value"
  12. >
  13. {{ item.label }}
  14. </li>
  15. </ul>
  16. </div>
  17. <label class="title"><span class="name">日期查询</span> : </label>
  18. <el-date-picker size="small" v-model="selected_date" prefix-icon="el-icon-date" @change="handleScheduleDateChange"
  19. :editable="false" :clearable="false" style="width: 196px;margin-right:10px;" type="date"
  20. format="yyyy-MM-dd"
  21. value-format="yyyy-MM-dd"
  22. placeholder="选择日期时间" align="right"></el-date-picker>
  23. <el-input size="small" style="width: 180px;" @keyup.enter.native='searchAction' v-model.trim="search_input"
  24. class="filter-item" v-model="query.keywords"/>
  25. <el-button size="small" class="filter-item" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
  26. </div>
  27. <div class="cell clearfix" style="justify-content: space-between;">
  28. <div style="display:flex;">
  29. <label class="title"> <span class="name">分区</span> : </label>
  30. <div class="time">
  31. <ul class>
  32. <li
  33. :class="item.id == partitionType ? 'active' : ''"
  34. @click="selectPartitionType(item.id)"
  35. v-for="item in partitionArr"
  36. :key="item.id"
  37. >
  38. {{ item.name }}
  39. </li>
  40. </ul>
  41. </div>
  42. </div>
  43. <div>
  44. <el-button size="small" icon="el-icon-printer" @click="exportList" type="primary">导出</el-button>
  45. <el-button size="small" type="primary" @click="statistics">统计表</el-button>
  46. </div>
  47. </div>
  48. <div class="cell clearfix" style="justify-content: space-between;">
  49. <div style="display:flex;">
  50. <label class="title"> <span class="name">出库状态</span> : </label>
  51. <div class="time">
  52. <ul class>
  53. <li
  54. :class="item.id == goodType ? 'active' : ''"
  55. @click="selectGoodType(item.id)"
  56. v-for="item in goodList"
  57. :key="item.id"
  58. >
  59. {{ item.name }}
  60. </li>
  61. </ul>
  62. </div>
  63. </div>
  64. </div>
  65. <div>
  66. <el-table
  67. :data="list"
  68. border
  69. :row-style="{ color: '#303133' }"
  70. :header-cell-style="{
  71. backgroundColor: 'rgb(245, 247, 250)',
  72. color: '#606266'
  73. }"
  74. >
  75. <el-table-column
  76. align="center"
  77. type="selection"
  78. width="55">
  79. </el-table-column>
  80. <el-table-column
  81. align="center"
  82. prop="name"
  83. v-for="(item,index) in good_types"
  84. :key="index"
  85. :label="item"
  86. >
  87. <template slot-scope="scope">
  88. <span>{{scope.row.good_type[index].name}}</span>
  89. </template>
  90. </el-table-column>
  91. </el-table>
  92. </div>
  93. <el-pagination
  94. @size-change="handleSizeChange"
  95. @current-change="handleCurrentChange"
  96. :page-sizes="[10, 50, 100]"
  97. :page-size="10"
  98. background
  99. align="right"
  100. style="margin-top:20px;"
  101. layout="total, sizes, prev, pager, next, jumper"
  102. :total="total"
  103. >
  104. </el-pagination>
  105. </div>
  106. </template>
  107. <script>
  108. import { GetAllZone,GetDialysisgoods } from '@/api/dialysis'
  109. import { uParseTime } from "@/utils/tools";
  110. export default {
  111. components: {
  112. },
  113. data() {
  114. return {
  115. query:{
  116. total:"",
  117. schedule_date:"",
  118. schedule_type:0,
  119. partition_id:0,
  120. page:1,
  121. limit:10,
  122. keywords:"",
  123. good_type:0,
  124. },
  125. schedulType: 0,
  126. schedulArr: [
  127. { value: 0, label: '全部' },
  128. { value: 1, label: '上午' },
  129. { value: 2, label: '下午' },
  130. { value: 3, label: '晚上' }
  131. ],
  132. selected_date: "",
  133. partitionArr: [],
  134. goodList:[
  135. { id: 0, name: '全部' },
  136. { id: 1, name: '已出库' },
  137. { id: 2, name: '未出库' },
  138. ],
  139. partitionType: 0,
  140. goodType:0,
  141. tableData: [{
  142. date: '2016-05-03',
  143. name: '王小虎',
  144. address: '上海市普陀区金沙江路 1518 弄'
  145. }
  146. ],
  147. search_input: '',
  148. searchAction: '',
  149. allGoodInfo:[],
  150. list:[],
  151. new_list:[],
  152. good_types: [],
  153. arrKey:[],
  154. arrList:[],
  155. total:0,
  156. }
  157. },
  158. created() {
  159. this.getAllZone()
  160. let date = uParseTime(new Date(), "{y}-{m}-{d}")
  161. var newDate = new Date();
  162. var y = newDate.getFullYear();
  163. var m = newDate.getMonth() + 1;
  164. var d = newDate.getDate();
  165. var schedule_date =
  166. y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d);
  167. this.selected_date = date
  168. this.query.schedule_date = schedule_date
  169. this.query.schedule_type = 0
  170. this.query.partition_id = 0
  171. this.query.page = 1
  172. this.GetDialysisgoods()
  173. },
  174. methods: {
  175. handleSizeChange(val) {
  176. this.query.limit = val;
  177. this.GetDialysisgoods();
  178. },
  179. handleCurrentChange(val) {
  180. this.query.page = val;
  181. this.GetDialysisgoods();
  182. },
  183. calCount(query_warehouseout_info) {
  184. let total = 0
  185. var array = []
  186. array = query_warehouseout_info
  187. for (let i = 0; i < array.length; i++) {
  188. total = total + array[i].count
  189. }
  190. return total
  191. },
  192. getGoodUserInfo(good_type_id,good_user,last_good_user) {
  193. var arrlist =[]
  194. if (good_user != null && good_user.length > 0) {
  195. let desc = ""
  196. for (let b = 0; b < good_user.length; b++){
  197. if(good_type_id == good_user[b].good_type_id)
  198. desc = desc + "\n" + good_user[b].info.specification_name +"*" +good_user[b].count
  199. }
  200. arrlist.push(desc)
  201. return desc
  202. }
  203. return ""
  204. // else if (good_user != null && good_user.length <= 0) {
  205. // if (last_good_user != null && last_good_user.length > 0) {
  206. // let desc = ""
  207. // for (let b = 0; b < last_good_user.length; b++){
  208. // if(good_type_id == last_good_user[b].good_type_id)
  209. // desc = desc+ "\n" + last_good_user[b].info.specification_name +"*" +last_good_user[b].count
  210. // }
  211. // console.log(desc)
  212. //
  213. // return desc
  214. //
  215. // }
  216. // return ""
  217. // }
  218. },
  219. GetDialysisgoods() {
  220. GetDialysisgoods(this.query).then(response => {
  221. if (response.data.state == 0) {
  222. this.$message.error(response.data.msg)
  223. return false
  224. } else {
  225. this.list = []
  226. this.good_types = []
  227. this.allGoodInfo = []
  228. var res = response.data
  229. this.total = res.data.total
  230. this.good_types.push("姓名")
  231. var arr = []
  232. arr.push("name")
  233. for (let a = 0; a < res.data.good_type.length; a++){
  234. Object.keys(res.data.good_type[a]).map(item => {
  235. if(item == 'type_name'){
  236. arr.push('name')
  237. }
  238. })
  239. this.good_types.push(res.data.good_type[a].type_name)
  240. }
  241. this.arrKey.push(...arr)
  242. this.allGoodInfo = res.data.dialysis_goods
  243. for(let i = 0; i < res.data.dialysis_goods.length; i++){
  244. let arr =[]
  245. let obj = {
  246. id:0,
  247. name: res.data.dialysis_goods[i].patient.name,
  248. }
  249. arr.push(obj)
  250. for (let a = 0; a < res.data.good_type.length; a++){
  251. let obj = {
  252. id:res.data.good_type[a].id,
  253. name:""
  254. }
  255. arr.push(obj)
  256. }
  257. let newObj = {
  258. "good_type":arr,
  259. "good_user":res.data.dialysis_goods[i].good_user,
  260. "last_good_user":res.data.dialysis_goods[i].last_good_user,
  261. "good_user_detail":res.data.dialysis_goods[i].good_user_detail,
  262. "last_good_user_detail":res.data.dialysis_goods[i].last_good_user_detail,
  263. }
  264. this.list.push(newObj)
  265. }
  266. for (let a = 0; a < this.list.length; a++){
  267. for (let b = 0; b < this.list[a].good_type.length; b++){
  268. if(this.list[a].good_type[b].id > 0){
  269. this.list[a].good_type[b].name = this.getGoodUserInfo(this.list[a].good_type[b].id,this.list[a].good_user,this.list[a].last_good_user)
  270. }
  271. }
  272. }
  273. // console.log("99999999",this.list)
  274. let a = []
  275. this.list.map(item => {
  276. a.push(item.good_type)
  277. })
  278. // console.log('aaaaaaaaa',a)
  279. let b = []
  280. a.map(item => {
  281. let obj = []
  282. item.map((it,index) => {
  283. let i = 0
  284. let c = {}
  285. let str = 'name' + index
  286. c[str] = it.name
  287. obj.push(c)
  288. })
  289. b.push(obj)
  290. })
  291. var temp = []
  292. // console.log('bbbbbbbbbb',b)
  293. for(let i=0;i<b.length;i++){
  294. var objC = {...b[i]}
  295. temp.push(objC)
  296. }
  297. // console.log("temp--------",temp)
  298. var tempTwo = []
  299. temp.map(item => {
  300. let obj = []
  301. Object.values(item).map(it => {
  302. obj.push(it)
  303. })
  304. let obj2 = {}
  305. obj.map((i,ind) => {
  306. let str = 'name' + ind
  307. obj2[str] = i[str]
  308. })
  309. tempTwo.push(obj2)
  310. // console.log(325556574342354234234,tempTwo)
  311. })
  312. this.arrList.push(...tempTwo)
  313. console.log("cccccccc",this.arrList)
  314. }
  315. })
  316. },
  317. selectSchedulType(scheduleType) {
  318. this.schedulType = scheduleType
  319. this.query.schedule_type = scheduleType
  320. this.query.page = 1
  321. this.GetDialysisgoods()
  322. },
  323. selectPartitionType(partitionType) {
  324. this.partitionType = partitionType
  325. this.query.partition_id = partitionType
  326. this.query.page = 1
  327. this.GetDialysisgoods()
  328. },
  329. selectGoodType(goodType){
  330. this.goodType = goodType
  331. this.query.good_type = goodType
  332. this.GetDialysisgoods()
  333. },
  334. getAllZone: function() {
  335. GetAllZone().then(response => {
  336. if (response.data.state == 0) {
  337. this.$message.error(response.data.msg)
  338. return false
  339. } else {
  340. this.partitionArr = response.data.data.zone
  341. this.partitionArr.unshift({ id: 0, name: '全部' })
  342. }
  343. })
  344. },
  345. statistics() {
  346. this.$refs.consumables.show()
  347. },
  348. handleScheduleDateChange(val) {
  349. this.query.schedule_date = val
  350. this.query.page = 1
  351. this.GetDialysisgoods()
  352. },
  353. search() {
  354. this.query.page = 1
  355. this.GetDialysisgoods()
  356. },
  357. exportList(){
  358. import('@/vendor/Export2Excel').then(excel => {
  359. var arrTwo = []
  360. for(let i=0;i<this.arrKey.length;i++){
  361. arrTwo.push('name'+i)
  362. }
  363. console.log("arrKey88888",arrTwo)
  364. // console.log("9999999",this.list)
  365. const tHeader = this.good_types
  366. const filterVal = arrTwo
  367. console.log("thedad",tHeader)
  368. console.log("filterval",filterVal)
  369. console.log("33333",this.arrList)
  370. const data = this.formatJson(filterVal,this.arrList)
  371. console.log("data",data)
  372. excel.export_json_to_excel({
  373. header: tHeader,
  374. data,
  375. filename: '透析耗材查询'
  376. })
  377. this.downloadLoading = false
  378. })
  379. },
  380. formatJson(filterVal, jsonData) {
  381. return jsonData.map(v => filterVal.map(j => v[j]));
  382. },
  383. }
  384. }
  385. </script>
  386. <style lang="scss" scoped>
  387. .page_consumables {
  388. .clearfix:after {
  389. content: none;
  390. }
  391. }
  392. </style>