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

consumables.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  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. <consumables-dialog ref="consumables" :list="new_list"></consumables-dialog>
  106. </div>
  107. </template>
  108. <script>
  109. import { GetAllZone,GetDialysisgoods } from '@/api/dialysis'
  110. import consumablesDialog from './consumablesDialog'
  111. import { uParseTime } from "@/utils/tools";
  112. export default {
  113. components: {
  114. consumablesDialog
  115. },
  116. data() {
  117. return {
  118. query:{
  119. total:"",
  120. schedule_date:"",
  121. schedule_type:0,
  122. partition_id:0,
  123. page:1,
  124. limit:10,
  125. keywords:"",
  126. good_type:0,
  127. },
  128. schedulType: 0,
  129. schedulArr: [
  130. { value: 0, label: '全部' },
  131. { value: 1, label: '上午' },
  132. { value: 2, label: '下午' },
  133. { value: 3, label: '晚上' }
  134. ],
  135. selected_date: "",
  136. partitionArr: [],
  137. goodList:[
  138. { id: 0, name: '全部' },
  139. { id: 1, name: '已出库' },
  140. { id: 2, name: '未出库' },
  141. ],
  142. partitionType: 0,
  143. goodType:0,
  144. tableData: [{
  145. date: '2016-05-03',
  146. name: '王小虎',
  147. address: '上海市普陀区金沙江路 1518 弄'
  148. }
  149. ],
  150. search_input: '',
  151. searchAction: '',
  152. allGoodInfo:[],
  153. list:[],
  154. new_list:[],
  155. good_types: [],
  156. arrKey:[],
  157. arrList:[],
  158. total:0,
  159. }
  160. },
  161. created() {
  162. this.getAllZone()
  163. let date = uParseTime(new Date(), "{y}-{m}-{d}")
  164. var newDate = new Date();
  165. var y = newDate.getFullYear();
  166. var m = newDate.getMonth() + 1;
  167. var d = newDate.getDate();
  168. var schedule_date =
  169. y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d);
  170. this.selected_date = date
  171. this.query.schedule_date = schedule_date
  172. this.query.schedule_type = 0
  173. this.query.partition_id = 0
  174. this.query.page = 1
  175. this.GetDialysisgoods()
  176. },
  177. methods: {
  178. handleSizeChange(val) {
  179. this.query.limit = val;
  180. this.GetDialysisgoods();
  181. },
  182. handleCurrentChange(val) {
  183. this.query.page = val;
  184. this.GetDialysisgoods();
  185. },
  186. calCount(query_warehouseout_info) {
  187. let total = 0
  188. var array = []
  189. array = query_warehouseout_info
  190. for (let i = 0; i < array.length; i++) {
  191. total = total + array[i].count
  192. }
  193. return total
  194. },
  195. getGoodUserInfo(good_type_id,good_user,last_good_user) {
  196. var arrlist =[]
  197. if (good_user != null && good_user.length > 0) {
  198. let desc = ""
  199. for (let b = 0; b < good_user.length; b++){
  200. if(good_type_id == good_user[b].good_type_id)
  201. desc = desc + "\n" + good_user[b].info.specification_name +"*" +good_user[b].count
  202. }
  203. arrlist.push(desc)
  204. return desc
  205. }
  206. return ""
  207. // else if (good_user != null && good_user.length <= 0) {
  208. // if (last_good_user != null && last_good_user.length > 0) {
  209. // let desc = ""
  210. // for (let b = 0; b < last_good_user.length; b++){
  211. // if(good_type_id == last_good_user[b].good_type_id)
  212. // desc = desc+ "\n" + last_good_user[b].info.specification_name +"*" +last_good_user[b].count
  213. // }
  214. // console.log(desc)
  215. //
  216. // return desc
  217. //
  218. // }
  219. // return ""
  220. // }
  221. },
  222. GetDialysisgoods() {
  223. GetDialysisgoods(this.query).then(response => {
  224. if (response.data.state == 0) {
  225. this.$message.error(response.data.msg)
  226. return false
  227. } else {
  228. this.list = []
  229. this.good_types = []
  230. this.allGoodInfo = []
  231. var res = response.data
  232. this.total = res.data.total
  233. this.good_types.push("姓名")
  234. var arr = []
  235. arr.push("name")
  236. for (let a = 0; a < res.data.good_type.length; a++){
  237. Object.keys(res.data.good_type[a]).map(item => {
  238. if(item == 'type_name'){
  239. arr.push('name')
  240. }
  241. })
  242. this.good_types.push(res.data.good_type[a].type_name)
  243. }
  244. this.arrKey.push(...arr)
  245. this.allGoodInfo = res.data.dialysis_goods
  246. for(let i = 0; i < res.data.dialysis_goods.length; i++){
  247. let arr =[]
  248. let obj = {
  249. id:0,
  250. name: res.data.dialysis_goods[i].patient.name,
  251. }
  252. arr.push(obj)
  253. for (let a = 0; a < res.data.good_type.length; a++){
  254. let obj = {
  255. id:res.data.good_type[a].id,
  256. name:""
  257. }
  258. arr.push(obj)
  259. }
  260. let newObj = {
  261. "good_type":arr,
  262. "good_user":res.data.dialysis_goods[i].good_user,
  263. "last_good_user":res.data.dialysis_goods[i].last_good_user,
  264. "good_user_detail":res.data.dialysis_goods[i].good_user_detail,
  265. "last_good_user_detail":res.data.dialysis_goods[i].last_good_user_detail,
  266. }
  267. this.list.push(newObj)
  268. }
  269. for (let a = 0; a < this.list.length; a++){
  270. for (let b = 0; b < this.list[a].good_type.length; b++){
  271. if(this.list[a].good_type[b].id > 0){
  272. 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)
  273. }
  274. }
  275. }
  276. console.log("99999999",this.list)
  277. let a = []
  278. this.list.map(item => {
  279. a.push(item.good_type)
  280. })
  281. console.log('aaaaaaaaa',a)
  282. let b = []
  283. a.map(item => {
  284. let obj = []
  285. item.map((it,index) => {
  286. let i = 0
  287. let c = {}
  288. let str = 'name' + index
  289. c[str] = it.name
  290. obj.push(c)
  291. })
  292. b.push(obj)
  293. })
  294. var temp = []
  295. console.log('bbbbbbbbbb',b)
  296. for(let i=0;i<b.length;i++){
  297. var objC = {...b[i]}
  298. temp.push(objC)
  299. }
  300. // console.log("temp--------",temp)
  301. var tempTwo = []
  302. temp.map(item => {
  303. let obj = []
  304. Object.values(item).map(it => {
  305. obj.push(it)
  306. })
  307. let obj2 = {}
  308. obj.map((i,ind) => {
  309. let str = 'name' + ind
  310. obj2[str] = i[str]
  311. })
  312. tempTwo.push(obj2)
  313. })
  314. this.arrList.push(...tempTwo)
  315. // console.log("cccccccc",this.arrList)
  316. }
  317. })
  318. },
  319. selectSchedulType(scheduleType) {
  320. this.schedulType = scheduleType
  321. this.query.schedule_type = scheduleType
  322. this.query.page = 1
  323. this.GetDialysisgoods()
  324. },
  325. selectPartitionType(partitionType) {
  326. this.partitionType = partitionType
  327. this.query.partition_id = partitionType
  328. this.query.page = 1
  329. this.GetDialysisgoods()
  330. },
  331. selectGoodType(goodType){
  332. this.goodType = goodType
  333. this.query.good_type = goodType
  334. this.GetDialysisgoods()
  335. },
  336. getAllZone: function() {
  337. GetAllZone().then(response => {
  338. if (response.data.state == 0) {
  339. this.$message.error(response.data.msg)
  340. return false
  341. } else {
  342. this.partitionArr = response.data.data.zone
  343. this.partitionArr.unshift({ id: 0, name: '全部' })
  344. }
  345. })
  346. },
  347. statistics() {
  348. this.$refs.consumables.show()
  349. },
  350. handleScheduleDateChange(val) {
  351. this.query.schedule_date = val
  352. this.query.page = 1
  353. this.GetDialysisgoods()
  354. },
  355. search() {
  356. this.query.page = 1
  357. this.GetDialysisgoods()
  358. },
  359. exportList(){
  360. import('@/vendor/Export2Excel').then(excel => {
  361. var arrTwo = []
  362. for(let i=0;i<this.arrKey.length;i++){
  363. arrTwo.push('name'+i)
  364. }
  365. console.log("arrKey88888",arrTwo)
  366. // console.log("9999999",this.list)
  367. const tHeader = this.good_types
  368. const filterVal = arrTwo
  369. console.log("thedad",tHeader)
  370. console.log("filterval",filterVal)
  371. console.log("33333",this.arrList)
  372. const data = this.formatJson(filterVal,this.arrList)
  373. console.log("data",data)
  374. excel.export_json_to_excel({
  375. header: tHeader,
  376. data,
  377. filename: '透析耗材查询'
  378. })
  379. this.downloadLoading = false
  380. })
  381. },
  382. formatJson(filterVal, jsonData) {
  383. return jsonData.map(v => filterVal.map(j => v[j]));
  384. },
  385. }
  386. }
  387. </script>
  388. <style lang="scss" scoped>
  389. .page_consumables {
  390. .clearfix:after {
  391. content: none;
  392. }
  393. }
  394. </style>