File was renamed from Web/src/views/wcs/wcsStation/component/editDialog.vue |
| | |
| | | <template> |
| | | <div class="wcsStation-container"> |
| | | <div class="wcsPosition-container"> |
| | | <el-dialog v-model="isShowDialog" :width="800" draggable="" :close-on-click-modal="false"> |
| | | <template #header> |
| | | <div style="color: #fff"> |
| | |
| | | import { ref,onMounted } from "vue"; |
| | | import { ElMessage } from "element-plus"; |
| | | import type { FormRules } from "element-plus"; |
| | | import { addWcsStation, updateWcsStation, detailWcsStation } from "/@/api/wcs/wcsStation"; |
| | | import { getWcsDeviceDeviceIdDropdown } from '/@/api/wcs/wcsStation'; |
| | | import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils'; |
| | | import { getDictLabelByVal as dv } from '/@/utils/dict-utils'; |
| | | import { formatDate } from '/@/utils/formatTime'; |
| | | import { addWcsPosition, updateWcsPosition, detailWcsPosition } from "/@/api/wcs/wcsPosition"; |
| | | import { getWcsDeviceDeviceIdDropdown } from '/@/api/wcs/wcsPosition'; |
| | | import { getAPI } from '/@/utils/axios-utils'; |
| | | import { SysEnumApi } from '/@/api-services/api'; |
| | | |
| | | //父级传递来的参数 |
| | | var props = defineProps({ |
| | | title: { |
| | |
| | | const ruleForm = ref<any>({}); |
| | | //自行添加其他规则 |
| | | const rules = ref<FormRules>({ |
| | | stationNum: [{required: true, message: '请输入工位号!', trigger: 'blur',},], |
| | | plcPos: [{required: true, message: '请输入偏移量!', trigger: 'blur',},], |
| | | }); |
| | | |
| | | // 页面加载时 |
| | |
| | | // 改用detail获取最新数据来编辑 |
| | | let rowData = JSON.parse(JSON.stringify(row)); |
| | | if (rowData.id) |
| | | ruleForm.value = (await detailWcsStation(rowData.id)).data.result; |
| | | ruleForm.value = (await detailWcsPosition(rowData.id)).data.result; |
| | | else |
| | | ruleForm.value = rowData; |
| | | isShowDialog.value = true; |
| | |
| | | if (isValid) { |
| | | let values = ruleForm.value; |
| | | if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) { |
| | | await addWcsStation(values); |
| | | await addWcsPosition(values); |
| | | } else { |
| | | await updateWcsStation(values); |
| | | await updateWcsPosition(values); |
| | | } |
| | | closeDialog(); |
| | | } else { |