gaoluyang
2025-03-15 21e7326b415597938fba463ebb8b3507b7fdbdfd
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<template>
  <div class="capacity-scope">
    <div class="search">
      <div>
        <el-form :model="form" ref="form" size="small" :inline="true">
          <el-form-item label="物质名称">
            <el-input v-model="form.name"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button @click="reset">重 置</el-button>
            <el-button type="primary" @click="getTableData">查 询</el-button>
          </el-form-item>
        </el-form>
      </div>
      <div>
        <el-button icon="el-icon-plus" size="small" type="primary" @click="openDialog">添加验收</el-button>
        <el-button size="small" type="primary" @click="exportExcel">导出</el-button>
      </div>
    </div>
    <div class="table">
      <lims-table :tableData="tableData" :column="columns" :height="'calc(100vh - 250px)'" @pagination="pagination"
        :page="page" :tableLoading="tableLoading">
        <template slot="action" slot-scope="{ row }">
          <el-button type="text" @click="edit(row)">编辑</el-button>
        </template>
      </lims-table>
    </div>
    <AddRecord ref="addRecordRef" v-if="addRecordRef" @submit="submit"></AddRecord>
  </div>
</template>
 
<script>
import limsTable from '@/components/Table/lims-table.vue'
import AddRecord from './component/AddRecord.vue';
import {
  getPageAcceptance, getAcceptanceDetails, exportFeStandardSubstanceAcceptance, updateAcceptance, addAcceptance
} from '@/api/cnas/resourceDemand/standardMaterialAccept/standardMaterialAccept'
export default {
  components: {
    limsTable,
    AddRecord
  },
  data() {
    return {
      form: {
        name: undefined
      },
      addRecordRef: false,
      columns: [
        {
          label: "出场编号",
          prop: "factoryNum"
        },
        {
          label: "有效期",
          prop: "effectiveDate"
        },
        {
          label: "生产厂家",
          prop: "factoryManufacturer"
        },
        {
          label: "文档编号",
          prop: "fileNum"
        },
        {
          label: "标准物质名称",
          prop: "name"
        },
        {
          label: "规格型号",
          prop: "model"
        },
        {
          label: "管理编号",
          prop: "manageNum"
        },
        {
          label: "存放位置",
          prop: "position"
        },
        // {
        //     label: "序列号",
        //     prop: "manageNum"
        // },
        {
          label: "提交日期",
          prop: "acquisitionDate"
        },
        {
          label: "数量",
          prop: "quantity"
        },
        {
          fixed: "right",
          label: "操作",
          align: "center",
          dataType: "slot",
          slot: "action",
        },
      ],
      tableData: [],
      page: {
        total: 0,
        size: 10,
        current: 1
      },
      tableLoading: false,
    }
  },
  mounted() {
    this.getTableData()
  },
  methods: {
    getTableData() {
      getPageAcceptance({...this.form, ...this.page}).then(res => {
        this.tableData = res.data.records;
        this.page.total = res.data.total;
      })
    },
    openDialog() {
      this.addRecordRef = true;
      this.$nextTick(() => {
        this.$refs.addRecordRef.openDialog()
      })
    },
    submit() {
      this.addRecordRef = false;
      this.getTableData()
    },
    edit(row) {
      this.addRecordRef = true;
      this.$nextTick(() => {
        this.$refs.addRecordRef.openDialog(row.id)
      })
    },
    reset() {
      this.form.name = undefined
      this.getTableData()
    },
    async exportExcel() {
      exportFeStandardSubstanceAcceptance().then(res => {
        const blob = new Blob([res], { type: 'application/octet-stream' });
        this.$download.saveAs(blob, '标准物质验收.xlsx');
      })
    },
    // 分页切换
    pagination(page) {
      this.page.size = page.limit
      this.getTableData()
    },
  }
}
</script>
 
<style scoped>
.capacity-scope {
  padding: 20px !important;
}
 
.search {
  height: 46px;
  display: flex;
  justify-content: space-between;
}
</style>