| | |
| | | import {ref, computed} from "vue"; |
| | | import useUserStore from "@/store/modules/user.js"; |
| | | import { getCurrentDate } from "@/utils/index.js"; |
| | | // import {userListNoPageByTenantId} from "@/api/system/user.js"; // 暂时注释掉,使用假数据 |
| | | // import {expiryAfterSalesAdd, expiryAfterSalesUpdate} from "@/api/customerService/index.js"; // 暂时注释掉,使用假数据 |
| | | import {userListNoPageByTenantId} from "@/api/system/user.js"; |
| | | import {expiryAfterSalesAdd, expiryAfterSalesUpdate} from "@/api/customerService/index.js"; |
| | | const { proxy } = getCurrentInstance() |
| | | const emit = defineEmits(['close']) |
| | | const dialogFormVisible = ref(false); |
| | |
| | | operationType.value = type; |
| | | dialogFormVisible.value = true; |
| | | |
| | | // 模拟获取用户列表 |
| | | userList.value = [ |
| | | { userId: 1, nickName: "张三" }, |
| | | { userId: 2, nickName: "李四" }, |
| | | { userId: 3, nickName: "王五" }, |
| | | { userId: 4, nickName: "赵六" }, |
| | | { userId: 5, nickName: "孙八" } |
| | | ]; |
| | | // 获取用户列表 |
| | | userListNoPageByTenantId().then(res => { |
| | | userList.value = res.data; |
| | | }); |
| | | |
| | | if (type === 'add') { |
| | | // 新增时重置表单 |
| | |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | if (valid) { |
| | | // 模拟提交操作 |
| | | setTimeout(() => { |
| | | console.log("模拟提交的数据:", form.value); |
| | | const submitData = { |
| | | id: form.value.id, |
| | | productName: form.value.productName, |
| | | batchNumber: form.value.batchNumber, |
| | | expireDate: form.value.expiryDate, |
| | | stockQuantity: form.value.stockQuantity, |
| | | customerName: form.value.customerName, |
| | | contactPhone: form.value.contactPhone, |
| | | disRes: form.value.problemDesc, |
| | | status: form.value.status, |
| | | disposeUserId: form.value.handlerId, |
| | | disposeNickName: userList.value.find(item => item.userId === form.value.handlerId)?.nickName, |
| | | disposeResult: form.value.handleResult, |
| | | disDate: form.value.handleDate |
| | | }; |
| | | |
| | | const apiCall = operationType.value === 'add' ? expiryAfterSalesAdd : expiryAfterSalesUpdate; |
| | | apiCall(submitData).then(() => { |
| | | proxy.$modal.msgSuccess(operationType.value === 'add' ? "新增成功" : "更新成功"); |
| | | closeDia(); |
| | | }, 300); |
| | | }).catch(error => { |
| | | console.error('提交数据失败:', error); |
| | | proxy.$modal.msgError('提交数据失败,请稍后重试'); |
| | | }); |
| | | } |
| | | }); |
| | | } |