|
@@ -16,16 +16,15 @@
|
|
>
|
|
>
|
|
添加物品
|
|
添加物品
|
|
</el-button>
|
|
</el-button>
|
|
- <el-table :data="formData.data.purchaseDetailList">
|
|
|
|
|
|
+ <el-table :data="formData.data.salesReturnDetailList">
|
|
<el-table-column prop="productCode" label="货品编码" />
|
|
<el-table-column prop="productCode" label="货品编码" />
|
|
<el-table-column prop="productName" label="货品名称" />
|
|
<el-table-column prop="productName" label="货品名称" />
|
|
<el-table-column prop="productSpec" label="规格型号" />
|
|
<el-table-column prop="productSpec" label="规格型号" />
|
|
<el-table-column prop="productUnit" label="单位" />
|
|
<el-table-column prop="productUnit" label="单位" />
|
|
-
|
|
|
|
<el-table-column prop="count" label="退货数量" min-width="150">
|
|
<el-table-column prop="count" label="退货数量" min-width="150">
|
|
<template #default="{ row, $index }">
|
|
<template #default="{ row, $index }">
|
|
<el-form-item
|
|
<el-form-item
|
|
- :prop="'purchaseDetailList.' + $index + '.count'"
|
|
|
|
|
|
+ :prop="'salesReturnDetailList.' + $index + '.count'"
|
|
:rules="rules.count"
|
|
:rules="rules.count"
|
|
:inline-message="true"
|
|
:inline-message="true"
|
|
>
|
|
>
|
|
@@ -41,7 +40,7 @@
|
|
<el-table-column prop="remark" label="退货原因" min-width="150">
|
|
<el-table-column prop="remark" label="退货原因" min-width="150">
|
|
<template #default="{ row, $index }">
|
|
<template #default="{ row, $index }">
|
|
<el-form-item
|
|
<el-form-item
|
|
- :prop="'purchaseDetailList.' + $index + '.remark'"
|
|
|
|
|
|
+ :prop="'salesReturnDetailList.' + $index + '.remark'"
|
|
:rules="rules.remark"
|
|
:rules="rules.remark"
|
|
:inline-message="true"
|
|
:inline-message="true"
|
|
>
|
|
>
|
|
@@ -76,17 +75,22 @@
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
import byForm from "@/components/byForm/index";
|
|
import byForm from "@/components/byForm/index";
|
|
|
|
+import { ElMessage, ElMessageBox } from "element-plus";
|
|
import SelectGoods from "@/components/product/SelectGoods";
|
|
import SelectGoods from "@/components/product/SelectGoods";
|
|
|
|
+import useUserStore from "@/store/modules/user";
|
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
|
|
|
let formData = reactive({
|
|
let formData = reactive({
|
|
data: {
|
|
data: {
|
|
supplyId: "",
|
|
supplyId: "",
|
|
- purchaseDetailList: [],
|
|
|
|
|
|
+ salesReturnDetailList: [],
|
|
returnName: "",
|
|
returnName: "",
|
|
},
|
|
},
|
|
});
|
|
});
|
|
let rules = ref({
|
|
let rules = ref({
|
|
supplyId: [{ required: true, message: "请选择供应商", trigger: "change" }],
|
|
supplyId: [{ required: true, message: "请选择供应商", trigger: "change" }],
|
|
|
|
+ count: [{ required: true, message: "请输入退货数量", trigger: "blur" }],
|
|
|
|
+ remark: [{ required: true, message: "请输入退货原因", trigger: "blur" }],
|
|
});
|
|
});
|
|
const formOption = reactive({
|
|
const formOption = reactive({
|
|
inline: true,
|
|
inline: true,
|
|
@@ -97,7 +101,7 @@ const formConfig = computed(() => {
|
|
return [
|
|
return [
|
|
{
|
|
{
|
|
type: "input",
|
|
type: "input",
|
|
- prop: "name",
|
|
|
|
|
|
+ prop: "returnDept",
|
|
label: "申请部门",
|
|
label: "申请部门",
|
|
itemWidth: 25,
|
|
itemWidth: 25,
|
|
disabled: true,
|
|
disabled: true,
|
|
@@ -107,7 +111,7 @@ const formConfig = computed(() => {
|
|
},
|
|
},
|
|
{
|
|
{
|
|
type: "input",
|
|
type: "input",
|
|
- prop: "name",
|
|
|
|
|
|
+ prop: "returnName",
|
|
label: "申请人",
|
|
label: "申请人",
|
|
itemWidth: 25,
|
|
itemWidth: 25,
|
|
disabled: true,
|
|
disabled: true,
|
|
@@ -117,7 +121,7 @@ const formConfig = computed(() => {
|
|
},
|
|
},
|
|
{
|
|
{
|
|
type: "date",
|
|
type: "date",
|
|
- prop: "name",
|
|
|
|
|
|
+ prop: "purchaseTime",
|
|
label: "申请时间",
|
|
label: "申请时间",
|
|
itemWidth: 25,
|
|
itemWidth: 25,
|
|
disabled: true,
|
|
disabled: true,
|
|
@@ -150,12 +154,32 @@ const formConfig = computed(() => {
|
|
});
|
|
});
|
|
const formDom = ref(null);
|
|
const formDom = ref(null);
|
|
const handleSubmit = async () => {
|
|
const handleSubmit = async () => {
|
|
- const vaild = await formDom.value.handleSubmit(() => {});
|
|
|
|
- console.log(vaild, "wqsds");
|
|
|
|
|
|
+ const vaild = await formDom.value.handleSubmit(() => {}); //拿到内部表单是否验证通过
|
|
|
|
+ if (vaild) {
|
|
|
|
+ if (formData.data.salesReturnDetailList.length > 0) {
|
|
|
|
+ const list = formData.data.salesReturnDetailList;
|
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
|
+ const e = list[i];
|
|
|
|
+ if (e.count == 0) {
|
|
|
|
+ ElMessage({
|
|
|
|
+ message: "退货数量不能为0!",
|
|
|
|
+ type: "info",
|
|
|
|
+ });
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ ElMessage({
|
|
|
|
+ message: "请添加退货明细!",
|
|
|
|
+ type: "info",
|
|
|
|
+ });
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
};
|
|
};
|
|
let openProduct = ref(false);
|
|
let openProduct = ref(false);
|
|
const handleRemove = (index) => {
|
|
const handleRemove = (index) => {
|
|
- formData.data.purchaseDetailList.splice(index, 1);
|
|
|
|
|
|
+ formData.data.salesReturnDetailList.splice(index, 1);
|
|
return ElMessage({
|
|
return ElMessage({
|
|
message: "删除成功!",
|
|
message: "删除成功!",
|
|
type: "success",
|
|
type: "success",
|
|
@@ -169,12 +193,11 @@ const pushGoods = (goods) => {
|
|
productSpec: x.spec,
|
|
productSpec: x.spec,
|
|
productUnit: x.unit,
|
|
productUnit: x.unit,
|
|
count: 0,
|
|
count: 0,
|
|
- price: 0,
|
|
|
|
bussinessId: x.id,
|
|
bussinessId: x.id,
|
|
- amount: 0,
|
|
|
|
|
|
+ remark: "",
|
|
}));
|
|
}));
|
|
- formData.data.purchaseDetailList =
|
|
|
|
- formData.data.purchaseDetailList.concat(arr);
|
|
|
|
|
|
+ formData.data.salesReturnDetailList =
|
|
|
|
+ formData.data.salesReturnDetailList.concat(arr);
|
|
return ElMessage({
|
|
return ElMessage({
|
|
message: "添加成功!",
|
|
message: "添加成功!",
|
|
type: "success",
|
|
type: "success",
|
|
@@ -186,6 +209,13 @@ const props = defineProps({
|
|
queryData: String,
|
|
queryData: String,
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+// 获取用户信息并赋默认值
|
|
|
|
+const userInfo = useUserStore().user;
|
|
|
|
+onMounted(() => {
|
|
|
|
+ formData.data.purchaseTime = proxy.parseTime(new Date());
|
|
|
|
+ formData.data.returnDept = userInfo.dept.deptName;
|
|
|
|
+ formData.data.returnName = userInfo.nickName;
|
|
|
|
+});
|
|
// 向父组件暴露
|
|
// 向父组件暴露
|
|
defineExpose({
|
|
defineExpose({
|
|
submitData: formData.data,
|
|
submitData: formData.data,
|