huminmin
14 小时以前 ce6a2bac234c48dce836f6c5d45c63da7c1e7424
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
<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 { productionProductInputListPage } from "@/api/productionManagement/productionProductInput";
 
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: 'productName',
  },
  {
    label: '投入产品型号',
    prop: 'model',
  },
  {
    label: 'UID码',
    prop: 'uidNo',
  },
  {
    label: '供应商',
    prop: 'customer',
  },
  {
    label: '批号',
    prop: 'batchNo',
  },
  {
    label: '投入数量',
    prop: 'quantity',
  },
  {
    label: '单位',
    prop: 'unit',
  },
  {
    label: '备注',
    prop: 'remark',
  },
]
 
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 };
 
  productionProductInputListPage(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>