| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, reactive, toRefs, getCurrentInstance } from "vue"; |
| | | import { onMounted, ref, reactive, toRefs, getCurrentInstance, computed } from "vue"; |
| | | import NewProcess from "@/views/productionManagement/productionProcess/New.vue"; |
| | | import EditProcess from "@/views/productionManagement/productionProcess/Edit.vue"; |
| | | import ImportDialog from "@/components/Dialog/ImportDialog.vue"; |
| | |
| | | downloadTemplate, |
| | | } from "@/api/productionManagement/productionProcess.js"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { getDeviceLedger } from "@/api/equipmentManagement/ledger"; |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | |
| | | prop: "name", |
| | | }, |
| | | { |
| | | label: "工序机台", |
| | | prop: "deviceName", |
| | | }, |
| | | { |
| | | label: "工序类型", |
| | | prop: "typeText", |
| | | }, |
| | | { |
| | | label: "工资定额", |
| | | prop: "salaryQuota", |
| | | }, |
| | | { |
| | | label: "工序", |
| | | prop: "process", |
| | | }, |
| | | { |
| | | label: "是否质检", |
| | |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const deviceList = ref([]); |
| | | const deviceNameMap = computed(() => { |
| | | const map = new Map(); |
| | | (deviceList.value || []).forEach((d) => { |
| | | if (d?.id == null) return; |
| | | map.set(d.id, d.deviceName ?? ""); |
| | | }); |
| | | return map; |
| | | }); |
| | | const tableLoading = ref(false); |
| | | const isShowNewModal = ref(false); |
| | | const isShowEditModal = ref(false); |
| | |
| | | total: 0, |
| | | }); |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | const loadDeviceList = async () => { |
| | | try { |
| | | const res = await getDeviceLedger(); |
| | | deviceList.value = Array.isArray(res?.data) ? res.data : []; |
| | | } catch (e) { |
| | | deviceList.value = []; |
| | | } |
| | | }; |
| | | |
| | | // 导入相关配置 |
| | | const importAction = |
| | |
| | | listPage(params) |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records.map(item => ({ |
| | | const records = Array.isArray(res?.data?.records) ? res.data.records : []; |
| | | const map = deviceNameMap.value; |
| | | tableData.value = records.map(item => { |
| | | const deviceName = item?.deviceName ?? map.get(item?.deviceId) ?? ""; |
| | | return { |
| | | ...item, |
| | | deviceName, |
| | | typeText: item.type !== undefined && item.type !== null ? (item.type === 0 ? "计时" : "计件") : "", |
| | | })); |
| | | }; |
| | | }); |
| | | page.total = res.data.total; |
| | | }) |
| | | .catch(err => { |
| | |
| | | importDialogRef.value.submit(); |
| | | } |
| | | }; |
| | | |
| | | // 导入成功 |
| | | const handleImportSuccess = response => { |
| | | if (response.code === 200) { |
| | |
| | | // }; |
| | | |
| | | onMounted(() => { |
| | | loadDeviceList().finally(() => { |
| | | getList(); |
| | | }); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped></style> |