123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443 |
- <template>
- <div class="page_consumables">
- <div class="cell clearfix">
- <label class="title"> <span class="name">排班班次</span> : </label>
- <div class="time">
- <ul class>
- <li
- :class="item.value == schedulType ? 'active' : ''"
- @click="selectSchedulType(item.value)"
- v-for="item in schedulArr"
- :key="item.value"
- >
- {{ item.label }}
- </li>
- </ul>
- </div>
-
- <label class="title"><span class="name">日期查询</span> : </label>
- <el-date-picker size="small" v-model="selected_date" prefix-icon="el-icon-date" @change="handleScheduleDateChange"
- :editable="false" :clearable="false" style="width: 196px;margin-right:10px;" type="date"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- placeholder="选择日期时间" align="right"></el-date-picker>
- <el-input size="small" style="width: 180px;" @keyup.enter.native='searchAction' v-model.trim="search_input"
- class="filter-item" v-model="query.keywords"/>
- <el-button size="small" class="filter-item" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
- </div>
- <div class="cell clearfix" style="justify-content: space-between;">
- <div style="display:flex;">
- <label class="title"> <span class="name">分区</span> : </label>
- <div class="time">
- <ul class>
- <li
- :class="item.id == partitionType ? 'active' : ''"
- @click="selectPartitionType(item.id)"
- v-for="item in partitionArr"
- :key="item.id"
- >
- {{ item.name }}
- </li>
- </ul>
- </div>
- </div>
- <div>
- <el-button size="small" icon="el-icon-printer" @click="exportList" type="primary">导出</el-button>
- <el-button size="small" type="primary" @click="statistics">统计表</el-button>
- </div>
- </div>
- <div class="cell clearfix" style="justify-content: space-between;">
- <div style="display:flex;">
- <label class="title"> <span class="name">出库状态</span> : </label>
- <div class="time">
- <ul class>
- <li
- :class="item.id == goodType ? 'active' : ''"
- @click="selectGoodType(item.id)"
- v-for="item in goodList"
- :key="item.id"
- >
- {{ item.name }}
- </li>
- </ul>
- </div>
- </div>
- </div>
- <div>
- <el-table
- :data="list"
- border
- :row-style="{ color: '#303133' }"
- :header-cell-style="{
- backgroundColor: 'rgb(245, 247, 250)',
- color: '#606266'
- }"
- >
- <el-table-column
- align="center"
- type="selection"
- width="55">
- </el-table-column>
- <el-table-column
- align="center"
- prop="name"
- v-for="(item,index) in good_types"
- :key="index"
- :label="item"
- >
- <template slot-scope="scope">
- <span>{{scope.row.good_type[index].name}}</span>
- </template>
-
- </el-table-column>
-
- </el-table>
- </div>
-
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :page-sizes="[10, 50, 100]"
- :page-size="10"
- background
- align="right"
- style="margin-top:20px;"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- >
- </el-pagination>
-
- <consumables-dialog ref="consumables" :list="new_list"></consumables-dialog>
- </div>
- </template>
-
-
- <script>
- import { GetAllZone,GetDialysisgoods } from '@/api/dialysis'
- import consumablesDialog from './consumablesDialog'
- import { uParseTime } from "@/utils/tools";
-
- export default {
- components: {
- consumablesDialog
- },
- data() {
- return {
- query:{
- total:"",
- schedule_date:"",
- schedule_type:0,
- partition_id:0,
- page:1,
- limit:10,
- keywords:"",
- good_type:0,
- },
- schedulType: 0,
- schedulArr: [
- { value: 0, label: '全部' },
- { value: 1, label: '上午' },
- { value: 2, label: '下午' },
- { value: 3, label: '晚上' }
- ],
- selected_date: "",
- partitionArr: [],
- goodList:[
- { id: 0, name: '全部' },
- { id: 1, name: '已出库' },
- { id: 2, name: '未出库' },
- ],
- partitionType: 0,
- goodType:0,
- tableData: [{
- date: '2016-05-03',
- name: '王小虎',
- address: '上海市普陀区金沙江路 1518 弄'
- }
- ],
- search_input: '',
- searchAction: '',
- allGoodInfo:[],
- list:[],
- new_list:[],
-
- good_types: [],
- arrKey:[],
- arrList:[],
- total:0,
-
- }
- },
- created() {
- this.getAllZone()
- let date = uParseTime(new Date(), "{y}-{m}-{d}")
- var newDate = new Date();
- var y = newDate.getFullYear();
- var m = newDate.getMonth() + 1;
- var d = newDate.getDate();
- var schedule_date =
- y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d);
-
- this.selected_date = date
- this.query.schedule_date = schedule_date
- this.query.schedule_type = 0
- this.query.partition_id = 0
- this.query.page = 1
- this.GetDialysisgoods()
- },
- methods: {
-
- handleSizeChange(val) {
- this.query.limit = val;
- this.GetDialysisgoods();
- },
- handleCurrentChange(val) {
- this.query.page = val;
- this.GetDialysisgoods();
- },
-
- calCount(query_warehouseout_info) {
- let total = 0
- var array = []
- array = query_warehouseout_info
- for (let i = 0; i < array.length; i++) {
- total = total + array[i].count
- }
- return total
-
- },
- getGoodUserInfo(good_type_id,good_user,last_good_user) {
- var arrlist =[]
- if (good_user != null && good_user.length > 0) {
- let desc = ""
- for (let b = 0; b < good_user.length; b++){
- if(good_type_id == good_user[b].good_type_id)
- desc = desc + "\n" + good_user[b].info.specification_name +"*" +good_user[b].count
- }
- arrlist.push(desc)
- return desc
- }
- return ""
-
- // else if (good_user != null && good_user.length <= 0) {
- // if (last_good_user != null && last_good_user.length > 0) {
- // let desc = ""
- // for (let b = 0; b < last_good_user.length; b++){
- // if(good_type_id == last_good_user[b].good_type_id)
- // desc = desc+ "\n" + last_good_user[b].info.specification_name +"*" +last_good_user[b].count
- // }
- // console.log(desc)
- //
- // return desc
- //
- // }
- // return ""
- // }
- },
- GetDialysisgoods() {
- GetDialysisgoods(this.query).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg)
- return false
- } else {
-
- this.list = []
- this.good_types = []
- this.allGoodInfo = []
-
- var res = response.data
- this.total = res.data.total
- this.good_types.push("姓名")
- var arr = []
- arr.push("name")
- for (let a = 0; a < res.data.good_type.length; a++){
- Object.keys(res.data.good_type[a]).map(item => {
- if(item == 'type_name'){
- arr.push('name')
- }
- })
- this.good_types.push(res.data.good_type[a].type_name)
- }
-
- this.arrKey.push(...arr)
-
- this.allGoodInfo = res.data.dialysis_goods
-
- for(let i = 0; i < res.data.dialysis_goods.length; i++){
- let arr =[]
- let obj = {
- id:0,
- name: res.data.dialysis_goods[i].patient.name,
- }
- arr.push(obj)
-
- for (let a = 0; a < res.data.good_type.length; a++){
- let obj = {
- id:res.data.good_type[a].id,
- name:""
-
- }
- arr.push(obj)
- }
-
-
-
- let newObj = {
- "good_type":arr,
- "good_user":res.data.dialysis_goods[i].good_user,
- "last_good_user":res.data.dialysis_goods[i].last_good_user,
- "good_user_detail":res.data.dialysis_goods[i].good_user_detail,
- "last_good_user_detail":res.data.dialysis_goods[i].last_good_user_detail,
- }
-
- this.list.push(newObj)
- }
-
-
- for (let a = 0; a < this.list.length; a++){
- for (let b = 0; b < this.list[a].good_type.length; b++){
-
- if(this.list[a].good_type[b].id > 0){
- 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)
- }
-
- }
- }
-
- console.log("99999999",this.list)
- let a = []
- this.list.map(item => {
- a.push(item.good_type)
- })
- console.log('aaaaaaaaa',a)
- let b = []
-
- a.map(item => {
- let obj = []
- item.map((it,index) => {
- let i = 0
- let c = {}
- let str = 'name' + index
- c[str] = it.name
- obj.push(c)
-
- })
-
- b.push(obj)
- })
- var temp = []
- console.log('bbbbbbbbbb',b)
- for(let i=0;i<b.length;i++){
- var objC = {...b[i]}
- temp.push(objC)
- }
-
- // console.log("temp--------",temp)
- var tempTwo = []
- temp.map(item => {
- let obj = []
- Object.values(item).map(it => {
- obj.push(it)
- })
- let obj2 = {}
- obj.map((i,ind) => {
-
- let str = 'name' + ind
- obj2[str] = i[str]
- })
- tempTwo.push(obj2)
- })
-
- this.arrList.push(...tempTwo)
- // console.log("cccccccc",this.arrList)
- }
- })
- },
- selectSchedulType(scheduleType) {
- this.schedulType = scheduleType
- this.query.schedule_type = scheduleType
- this.query.page = 1
- this.GetDialysisgoods()
-
- },
- selectPartitionType(partitionType) {
- this.partitionType = partitionType
- this.query.partition_id = partitionType
- this.query.page = 1
-
- this.GetDialysisgoods()
-
- },
- selectGoodType(goodType){
- this.goodType = goodType
- this.query.good_type = goodType
- this.GetDialysisgoods()
- },
- getAllZone: function() {
- GetAllZone().then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg)
- return false
- } else {
- this.partitionArr = response.data.data.zone
- this.partitionArr.unshift({ id: 0, name: '全部' })
- }
- })
- },
- statistics() {
- this.$refs.consumables.show()
- },
- handleScheduleDateChange(val) {
- this.query.schedule_date = val
- this.query.page = 1
- this.GetDialysisgoods()
- },
- search() {
- this.query.page = 1
- this.GetDialysisgoods()
- },
-
- exportList(){
- import('@/vendor/Export2Excel').then(excel => {
- var arrTwo = []
- for(let i=0;i<this.arrKey.length;i++){
- arrTwo.push('name'+i)
- }
- console.log("arrKey88888",arrTwo)
-
- // console.log("9999999",this.list)
- const tHeader = this.good_types
- const filterVal = arrTwo
- console.log("thedad",tHeader)
- console.log("filterval",filterVal)
- console.log("33333",this.arrList)
- const data = this.formatJson(filterVal,this.arrList)
- console.log("data",data)
-
- excel.export_json_to_excel({
- header: tHeader,
- data,
- filename: '透析耗材查询'
- })
- this.downloadLoading = false
- })
- },
- formatJson(filterVal, jsonData) {
- return jsonData.map(v => filterVal.map(j => v[j]));
- },
-
- }
- }
- </script>
-
-
- <style lang="scss" scoped>
- .page_consumables {
-
- .clearfix:after {
- content: none;
- }
-
- }
- </style>
|