hejianhao
2025-04-16 dab2d210ca06c1faa514c6388fbd5de1ab355360
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<template>
  <div class="custom-scroll">
    <v-header
      title="领用记录"
      :bar="bar"
      search
      @on-search="onSearch"
    ></v-header>
    <div class="add fl-al mr-b-10">
      <el-button size="small" @click.stop="exportHandle">导出</el-button>
    </div>
    <div class="tab">
      <v-tool-table :trs="trs" :tds="tds">
        <template v-slot:time="item">
          <b>{{ is_time(item.scope.createAt) }}</b>
        </template>
        <template v-slot:image="item">
          <el-image
            v-if="item.scope.receiveUrl"
            style="width: 30px; height: 30px"
            :src="item.scope.receiveUrl"
            :preview-src-list="[item.scope.receiveUrl]"
            fit="cover"
          ></el-image>
          <span v-else>-</span>
        </template>
      </v-tool-table>
    </div>
    <v-tool-page :item="paged" @on-page="onPage"></v-tool-page>
  </div>
</template>
 
<script>
import { mapState } from "vuex";
import { dateTime } from "../../utils/common";
export default {
  props: {},
  components: {},
  data() {
    return {
      bar: [
        { title: "领用人/联系电话/领用物品/申领流水", name: "keyword" },
        { title: "实际领用时间", name: "errTime", type: "times" },
      ],
      trs: [
        { text: "序号", val: "id", width: "50px" },
        { text: "领用人", val: "applyName" },
        { text: "联系电话", val: "applyPhone" },
        { text: "领用物品", val: "item" },
        { text: "领用图片", val: "btn", slot: "image" },
        { text: "领用数量", val: "createTime" },
        { text: "实际领用时间", val: "actualTime" },
        { text: "主要困难", val: "reason" },
        { text: "申领流水", val: "id" },
        { text: "核销人员", val: "writeOffUserName" },
      ],
      tds: [],
      paged: { page: 0, total: 0, r: 0, limit: 10 },
      os: {},
      search: {},
    };
  },
  computed: {
    ...mapState({ vuex_page: "pageReset" }),
  },
  watch: {
    vuex_page: {
      handler(n) {
        if (n.page === this.$route.path) {
          this.init();
        }
      },
      deep: true,
    },
  },
  methods: {
    exportHandle() {
      this.$api.post("comActWarehouseApply/export", {}, (e) => {
        window.location.href = e;
      });
    },
    onSearch(v) {
      v.errTime ? (v.beginTime = v.errTime[0]) : (v.beginTime = "");
      v.errTime ? (v.endTime = v.errTime[1]) : (v.endTime = "");
      delete v.errTime;
      delete v.finishTime;
      this.search = demo.copy(v);
      this.paged.page = 1;
      this.init();
    },
    // 分页点击
    onPage(v) {
      if (v.page === this.paged.page && v.page && !v.reset) {
        return 0;
      }
      this.paged.page = v.page;
      this.paged.limit = v.limit;
      this.init();
    },
    // 获取数据
    init() {
      let v = demo.copy(
        Object.assign(this.os, this.search, {
          page: this.paged.page,
          size: this.paged.limit,
          goodsId: this.$route.query.gid,
        })
      );
      this.$api.post("comActWarehouseApply/queryAll", v, (e) => {
        this.paged.total = e.total;
        this.paged.r++;
        this.tds = e.records || [];
        this.tds.forEach((item) => {
          item.createTime = dateTime(item.createTime);
        });
      });
    },
  },
  mounted() {},
};
</script>
<style scoped>
.custom-scroll {
  overflow: scroll;
}
</style>