|
@@ -0,0 +1,237 @@
|
|
|
+<template>
|
|
|
+ <div style="width: 100%; padding: 0px 15px">
|
|
|
+ <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit"></byForm>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import byForm from "@/components/byForm/index";
|
|
|
+import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
+import SelectGoods from "@/components/product/SelectGoods";
|
|
|
+import useUserStore from "@/store/modules/user";
|
|
|
+
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
+const supplierList = ref([]);
|
|
|
+let formData = reactive({
|
|
|
+ data: {
|
|
|
+ supplyId: "",
|
|
|
+ deptName: "",
|
|
|
+ refundName: "",
|
|
|
+ amount: "",
|
|
|
+ remark: "",
|
|
|
+ refundTime: "",
|
|
|
+ refundDetailList: [],
|
|
|
+ },
|
|
|
+});
|
|
|
+const submit = ref(null);
|
|
|
+const formOption = reactive({
|
|
|
+ inline: true,
|
|
|
+ labelWidth: 100,
|
|
|
+ itemWidth: 100,
|
|
|
+ rules: [],
|
|
|
+});
|
|
|
+const formConfig = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ label: "供应商",
|
|
|
+ prop: "supplyId",
|
|
|
+ data: supplierList.value,
|
|
|
+ fn: (val) => {
|
|
|
+ changeSupply(val);
|
|
|
+ },
|
|
|
+ disabled: formData.data.id,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ label: "发票类型",
|
|
|
+ prop: "type",
|
|
|
+ data: invoiceType.value,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ prop: "money",
|
|
|
+ slotName: "money",
|
|
|
+ label: "开票金额",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ prop: "file",
|
|
|
+ slotName: "file",
|
|
|
+ label: "上传附件",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ prop: "information",
|
|
|
+ slotName: "information",
|
|
|
+ label: "发票信息",
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+let rules = ref({
|
|
|
+ supplyId: [{ required: true, message: "请选择供应商", trigger: "change" }],
|
|
|
+ count: [{ required: true, message: "请输入退货数量", trigger: "blur" }],
|
|
|
+ remark: [{ required: true, message: "请输入退货原因", trigger: "blur" }],
|
|
|
+});
|
|
|
+const getDict = () => {
|
|
|
+ // proxy
|
|
|
+ // .post("/dictTenantData/page", {
|
|
|
+ // pageNum: 1,
|
|
|
+ // pageSize: 999,
|
|
|
+ // dictCode: "invoice_type",
|
|
|
+ // tenantId: useUserStore().user.tenantId,
|
|
|
+ // })
|
|
|
+ // .then((res) => {
|
|
|
+ // if (res.rows && res.rows.length > 0) {
|
|
|
+ // invoiceType.value = res.rows.map((item) => {
|
|
|
+ // return {
|
|
|
+ // label: item.dictValue,
|
|
|
+ // value: item.dictKey,
|
|
|
+ // };
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ proxy.post("/supplierInfo/page", { pageNum: 1, pageSize: 999 }).then((res) => {
|
|
|
+ if (res.rows && res.rows.length > 0) {
|
|
|
+ supplierList.value = res.rows.map((item) => {
|
|
|
+ return {
|
|
|
+ label: item.name,
|
|
|
+ value: item.id,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+getDict();
|
|
|
+// const formOption = reactive({
|
|
|
+// inline: true,
|
|
|
+// labelWidth: 100,
|
|
|
+// itemWidth: 100,
|
|
|
+// });
|
|
|
+// const formConfig = computed(() => {
|
|
|
+// return [
|
|
|
+// {
|
|
|
+// type: "input",
|
|
|
+// prop: "returnDept",
|
|
|
+// label: "申请部门",
|
|
|
+// itemWidth: 25,
|
|
|
+// disabled: true,
|
|
|
+// style: {
|
|
|
+// "margin-right": "10px",
|
|
|
+// },
|
|
|
+// },
|
|
|
+// {
|
|
|
+// type: "input",
|
|
|
+// prop: "returnName",
|
|
|
+// label: "申请人",
|
|
|
+// itemWidth: 25,
|
|
|
+// disabled: true,
|
|
|
+// style: {
|
|
|
+// "margin-right": "10px",
|
|
|
+// },
|
|
|
+// },
|
|
|
+// {
|
|
|
+// type: "date",
|
|
|
+// prop: "purchaseTime",
|
|
|
+// label: "申请时间",
|
|
|
+// itemWidth: 25,
|
|
|
+// disabled: true,
|
|
|
+// style: {
|
|
|
+// "margin-right": "10px",
|
|
|
+// },
|
|
|
+// },
|
|
|
+// {
|
|
|
+// type: "select",
|
|
|
+// prop: "supplyId",
|
|
|
+// label: "供应商",
|
|
|
+// isLoad: {
|
|
|
+// url: "/supplierInfo/page",
|
|
|
+// req: {
|
|
|
+// pageNum: 1,
|
|
|
+// pageSize: 9999,
|
|
|
+// },
|
|
|
+// labelKey: "name",
|
|
|
+// labelVal: "id",
|
|
|
+// method: "post",
|
|
|
+// resUrl: "rows",
|
|
|
+// },
|
|
|
+// },
|
|
|
+// {
|
|
|
+// type: "slot",
|
|
|
+// slotName: "details",
|
|
|
+// label: "退货明细",
|
|
|
+// },
|
|
|
+// ];
|
|
|
+// });
|
|
|
+// const formDom = ref(null);
|
|
|
+// const handleSubmit = async () => {
|
|
|
+// 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);
|
|
|
+// const handleRemove = (index) => {
|
|
|
+// formData.data.salesReturnDetailList.splice(index, 1);
|
|
|
+// return ElMessage({
|
|
|
+// message: "删除成功!",
|
|
|
+// type: "success",
|
|
|
+// });
|
|
|
+// };
|
|
|
+// const pushGoods = (goods) => {
|
|
|
+// const arr = goods.map((x) => ({
|
|
|
+// goodType: x.goodType,
|
|
|
+// productCode: x.code,
|
|
|
+// productName: x.name,
|
|
|
+// productSpec: x.spec,
|
|
|
+// productUnit: x.unit,
|
|
|
+// count: 0,
|
|
|
+// bussinessId: x.id,
|
|
|
+// remark: "",
|
|
|
+// }));
|
|
|
+// formData.data.salesReturnDetailList =
|
|
|
+// formData.data.salesReturnDetailList.concat(arr);
|
|
|
+// return ElMessage({
|
|
|
+// message: "添加成功!",
|
|
|
+// type: "success",
|
|
|
+// });
|
|
|
+// };
|
|
|
+
|
|
|
+// // 接收父组件的传值
|
|
|
+// const props = defineProps({
|
|
|
+// 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({
|
|
|
+// submitData: formData.data,
|
|
|
+// handleSubmit,
|
|
|
+// });
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped></style>
|