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
| <template>
| <div>
| <el-dialog v-model="isShow"
| title="产出"
| @close="closeModal">
| <PIMTable rowKey="id"
| :column="tableColumn"
| :tableData="data"
| :page="page"
| :tableLoading="tableLoading"
| @pagination="pagination"></PIMTable>
| <template #footer>
| <div class="dialog-footer">
| <el-button type="primary"
| @click="closeModal">关闭</el-button>
| </div>
| </template>
| </el-dialog>
| </div>
| </template>
|
| <script setup>
| import { ref, computed, onMounted } from "vue";
| import { productionProductOutputListPage } from "@/api/productionManagement/productionProductOutput.js";
|
| const props = defineProps({
| visible: {
| type: Boolean,
| required: true,
| },
| productionProductMainId: {
| type: Number,
| required: true,
| },
| });
|
| const emit = defineEmits(["update:visible", "completed"]);
|
| const page = reactive({
| current: 1,
| size: 100,
| total: 0,
| });
|
| const pagination = obj => {
| page.current = obj.page;
| page.size = obj.limit;
| fetchData();
| };
|
| const tableLoading = ref(false);
|
| const tableColumn = [
| {
| label: "报工单号",
| prop: "productNo",
| },
| {
| label: "产品型号",
| prop: "model",
| },
| {
| label: "产出数量",
| prop: "quantity",
| },
| ];
|
| const isShow = computed({
| get() {
| return props.visible;
| },
| set(val) {
| emit("update:visible", val);
| },
| });
|
| const data = ref([]);
|
| const closeModal = () => {
| isShow.value = false;
| };
|
| const fetchData = () => {
| tableLoading.value = true;
| const params = { productMainId: props.productionProductMainId, ...page };
|
| productionProductOutputListPage(params)
| .then(res => {
| tableLoading.value = false;
| data.value = res.data.records;
| page.total = res.data.total;
| })
| .catch(err => {
| tableLoading.value = false;
| });
| };
|
| defineExpose({
| closeModal,
| isShow,
| });
|
| onMounted(() => {
| fetchData();
| });
| </script>
|
|