张诺
7 小时以前 2a3018105d22625b566752d9d841e12e2c80e1f3
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
<template>
  <div>
    <el-dialog
        v-model="dialogFormVisible"
        title="检定校准记录"
        width="50%"
        @close="closeDia"
    >
      <PIMTable
          rowKey="id"
          :column="tableColumn"
          :tableData="tableData"
          :tableLoading="tableLoading"
          @selection-change="handleSelectionChange"
          height="500"
          :isPagination="false"
      >
      </PIMTable>
      <pagination
          style="margin: 10px 0"
          v-show="total > 0"
          @pagination="paginationSearch"
          :total="total"
          :page="page.current"
          :limit="page.size"
      />
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="closeDia">取消</el-button>
        </div>
      </template>
    </el-dialog>
    <filePreview ref="filePreviewRef" />
  </div>
</template>
 
<script setup>
import {ref} from "vue";
import filePreview from '@/components/filePreview/index.vue'
import {ledgerRecordListPage} from "@/api/equipmentManagement/calibration.js";
import Pagination from "@/components/PIMTable/Pagination.vue";
const emit = defineEmits(['close'])
 
const dialogFormVisible = ref(false);
const currentId = ref('')
const selectedRows = ref([]);
const filePreviewRef = ref()
const tableColumn = ref([
  {
    label: "检定日期",
    prop: "recordDate",
    width: 130,
  },
  {
    label: "计量器具编号",
    prop: "code",
    width: 150,
  },
  {
    label: "计量器具名称",
    prop: "name",
    width: 200,
  },
  {
    label: "规格型号",
    prop: "model",
    width:200
  },
  {
    label: "有效期",
    prop: "valid",
    width: 100,
  },
  {
    label: "录入人",
    prop: "userName",
  },
  {
    label: "录入日期",
    prop: "entryDate",
    width: 130,
  },
]);
const page = reactive({
  current: 1,
  size: 100,
});
const total = ref(0);
const tableData = ref([]);
const tableLoading = ref(false);
 
// 打开弹框
const openDialog = (row,type) => {
  dialogFormVisible.value = true;
  currentId.value = row.id;
  getList()
}
const paginationSearch = (obj) => {
  page.current = obj.page;
  page.size = obj.limit;
  getList();
};
const getList = () => {
  let query = {
    measuringInstrumentLedgerId:currentId.value,
    current : page.current,
    size : page.size
  }
  ledgerRecordListPage(query).then(res => {
    tableData.value = res?.data?.records || [];
    total.value = res?.data?.total;
  })
}
// 表格选择数据
const handleSelectionChange = (selection) => {
  selectedRows.value = selection;
};
 
// 关闭弹框
const closeDia = () => {
  dialogFormVisible.value = false;
  emit('close')
};
 
defineExpose({
  openDialog,
});
</script>