|
@@ -1,13 +1,59 @@
|
|
<template>
|
|
<template>
|
|
<div>
|
|
<div>
|
|
- <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit"> </byForm>
|
|
|
|
|
|
+ <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
|
|
|
|
+ <template #materiel>
|
|
|
|
+ <div style="width: 100%">
|
|
|
|
+ <div style="margin-bottom: 10px">
|
|
|
|
+ <el-button type="primary" @click="clickMateriel()" v-preReClick>选择物料</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ <el-table :data="formData.data.applyBuyBomList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
|
|
|
|
+ <el-table-column label="品号" prop="bomSpecCode" width="140" />
|
|
|
|
+ <el-table-column label="品名" prop="bomSpecName" min-width="220" />
|
|
|
|
+ <el-table-column label="颜色" prop="bomSpecColour" width="160" />
|
|
|
|
+ <el-table-column label="尺寸(长宽高,cm)" prop="name" width="160">
|
|
|
|
+ <template #default="{ row }">
|
|
|
|
+ <div>{{ row.bomSpecLength }} * {{ row.bomSpecWidth }} * {{ row.bomSpecHeight }}</div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="申购数量" width="160">
|
|
|
|
+ <template #default="{ row, $index }">
|
|
|
|
+ <el-form-item :prop="'applyBuyBomList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true" style="width: 100%">
|
|
|
|
+ <el-input-number
|
|
|
|
+ onmousewheel="return false;"
|
|
|
|
+ v-model="row.quantity"
|
|
|
|
+ placeholder="申购数量"
|
|
|
|
+ style="width: 100%"
|
|
|
|
+ :controls="false"
|
|
|
|
+ :min="0"
|
|
|
|
+ :precision="0" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="操作" align="center" fixed="right" width="60">
|
|
|
|
+ <template #default="{ $index }">
|
|
|
|
+ <el-button type="danger" @click="clickDelete($index)" text>删除</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </byForm>
|
|
|
|
+
|
|
|
|
+ <el-dialog title="选择物料" v-if="openMateriel" v-model="openMateriel" width="90%">
|
|
|
|
+ <SelectBOM :selectStatus="true" @selectBOM="selectMateriel"></SelectBOM>
|
|
|
|
+ <template #footer>
|
|
|
|
+ <el-button @click="openMateriel = false" size="large">关 闭</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
import byForm from "@/components/byForm/index";
|
|
import byForm from "@/components/byForm/index";
|
|
import { useRoute } from "vue-router";
|
|
import { useRoute } from "vue-router";
|
|
-// import { ElMessage } from "element-plus";
|
|
|
|
|
|
+import moment from "moment";
|
|
|
|
+import SelectBOM from "@/views/group/BOM/management/index";
|
|
|
|
+import { ElMessage } from "element-plus";
|
|
|
|
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
// 接收父组件的传值
|
|
// 接收父组件的传值
|
|
@@ -16,7 +62,12 @@ const props = defineProps({
|
|
});
|
|
});
|
|
const { proxy } = getCurrentInstance();
|
|
const { proxy } = getCurrentInstance();
|
|
const formData = reactive({
|
|
const formData = reactive({
|
|
- data: {},
|
|
|
|
|
|
+ data: {
|
|
|
|
+ applyName: proxy.useUserStore().user.nickName,
|
|
|
|
+ applyTime: moment().format("yyyy-MM-DD HH:mm:ss"),
|
|
|
|
+ remark: "",
|
|
|
|
+ applyBuyBomList: [],
|
|
|
|
+ },
|
|
});
|
|
});
|
|
const judgeStatus = () => {
|
|
const judgeStatus = () => {
|
|
if (route.query.processType == 20 || route.query.processType == 10) {
|
|
if (route.query.processType == 20 || route.query.processType == 10) {
|
|
@@ -32,9 +83,10 @@ const judgeStatus = () => {
|
|
};
|
|
};
|
|
const formOption = reactive({
|
|
const formOption = reactive({
|
|
inline: true,
|
|
inline: true,
|
|
- labelWidth: 100,
|
|
|
|
|
|
+ labelWidth: "120px",
|
|
itemWidth: 100,
|
|
itemWidth: 100,
|
|
rules: [],
|
|
rules: [],
|
|
|
|
+ labelPosition: "right",
|
|
disabled: false,
|
|
disabled: false,
|
|
});
|
|
});
|
|
const formConfig = computed(() => {
|
|
const formConfig = computed(() => {
|
|
@@ -45,41 +97,79 @@ const formConfig = computed(() => {
|
|
label: "",
|
|
label: "",
|
|
},
|
|
},
|
|
{
|
|
{
|
|
|
|
+ type: "input",
|
|
|
|
+ prop: "applyName",
|
|
|
|
+ label: "申购人",
|
|
|
|
+ itemType: "text",
|
|
|
|
+ itemWidth: 51,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: "date",
|
|
|
|
+ prop: "applyTime",
|
|
|
|
+ label: "申购时间",
|
|
|
|
+ format: "YYYY-MM-DD HH:mm:ss",
|
|
|
|
+ itemType: "datetime",
|
|
|
|
+ itemWidth: 51,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: "input",
|
|
|
|
+ prop: "remark",
|
|
|
|
+ label: "申购说明",
|
|
|
|
+ itemType: "textarea",
|
|
|
|
+ itemWidth: 51,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
type: "title",
|
|
type: "title",
|
|
title: "申购清单",
|
|
title: "申购清单",
|
|
label: "",
|
|
label: "",
|
|
},
|
|
},
|
|
|
|
+ {
|
|
|
|
+ type: "slot",
|
|
|
|
+ slotName: "materiel",
|
|
|
|
+ },
|
|
];
|
|
];
|
|
});
|
|
});
|
|
const rules = ref({
|
|
const rules = ref({
|
|
- countryId: [{ required: true, message: "请选择国家", trigger: "change" }],
|
|
|
|
- sellAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
|
|
|
|
|
|
+ applyName: [{ required: true, message: "请输入申购人", trigger: "blur" }],
|
|
|
|
+ applyTime: [{ required: true, message: "请选择申购时间", trigger: "change" }],
|
|
|
|
+ quantity: [{ required: true, message: "请输入申购数量", trigger: "blur" }],
|
|
});
|
|
});
|
|
|
|
+const openMateriel = ref(false);
|
|
|
|
+const clickMateriel = () => {
|
|
|
|
+ openMateriel.value = true;
|
|
|
|
+};
|
|
|
|
+const selectMateriel = (row) => {
|
|
|
|
+ if (formData.data.applyBuyBomList && formData.data.applyBuyBomList.length > 0) {
|
|
|
|
+ let list = formData.data.applyBuyBomList.filter((item) => item.bomSpecId === row.id);
|
|
|
|
+ if (list && list.length > 0) {
|
|
|
|
+ return ElMessage("请勿重复添加!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ formData.data.applyBuyBomList.push({
|
|
|
|
+ bomSpecId: row.id,
|
|
|
|
+ bomSpecCode: row.code,
|
|
|
|
+ bomSpecName: row.name,
|
|
|
|
+ bomSpecColour: row.colour,
|
|
|
|
+ bomSpecLength: row.length,
|
|
|
|
+ bomSpecWidth: row.width,
|
|
|
|
+ bomSpecHeight: row.height,
|
|
|
|
+ quantity: undefined,
|
|
|
|
+ });
|
|
|
|
+ ElMessage({ message: "选择完成", type: "success" });
|
|
|
|
+};
|
|
|
|
+const clickDelete = (index) => {
|
|
|
|
+ formData.data.applyBuyBomList.splice(index, 1);
|
|
|
|
+};
|
|
const handleSubmit = async (flag) => {
|
|
const handleSubmit = async (flag) => {
|
|
if (flag) {
|
|
if (flag) {
|
|
return true;
|
|
return true;
|
|
} else {
|
|
} else {
|
|
let status = await proxy.$refs.submit.handleSubmit(() => {});
|
|
let status = await proxy.$refs.submit.handleSubmit(() => {});
|
|
if (status) {
|
|
if (status) {
|
|
- // if (!(formData.data.contractProductList && formData.data.contractProductList.length > 0)) {
|
|
|
|
- // ElMessage("请添加至少一件商品");
|
|
|
|
- // return false;
|
|
|
|
- // }
|
|
|
|
- // if (formData.data.contractShipmentList && formData.data.contractShipmentList.length > 0) {
|
|
|
|
- // for (let i = 0; i < formData.data.contractProductList.length; i++) {
|
|
|
|
- // let data = formData.data.contractShipmentList.filter((item) => item.productId === formData.data.contractProductList[i].productId);
|
|
|
|
- // if (data && data.length > 0) {
|
|
|
|
- // let quantity = 0;
|
|
|
|
- // for (let j = 0; j < data.length; j++) {
|
|
|
|
- // quantity = parseFloat(Number(quantity) + Number(data[j].quantity));
|
|
|
|
- // }
|
|
|
|
- // if (quantity > formData.data.contractProductList[i].quantity) {
|
|
|
|
- // ElMessage("出货数量不能大于商品数量");
|
|
|
|
- // return false;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
|
|
+ if (!(formData.data.applyBuyBomList && formData.data.applyBuyBomList.length > 0)) {
|
|
|
|
+ ElMessage("请添加物料");
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
return true;
|
|
return true;
|
|
} else {
|
|
} else {
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
@@ -96,20 +186,10 @@ const getFormData = () => {
|
|
watch(
|
|
watch(
|
|
() => props.queryData,
|
|
() => props.queryData,
|
|
(newValue) => {
|
|
(newValue) => {
|
|
- console.log(proxy.deepClone(newValue));
|
|
|
|
- // formOption.disabled = judgeStatus();
|
|
|
|
- // if (props.queryData && ["10", "20", "30"].includes(route.query.processType)) {
|
|
|
|
- // for (var text in props.queryData) {
|
|
|
|
- // formData.data[text] = props.queryData[text];
|
|
|
|
- // }
|
|
|
|
- // if (formData.data.countryId) {
|
|
|
|
- // getCityData(formData.data.countryId, "20");
|
|
|
|
- // }
|
|
|
|
- // if (formData.data.provinceId) {
|
|
|
|
- // getCityData(formData.data.provinceId, "30");
|
|
|
|
- // }
|
|
|
|
- // getDecisionAids();
|
|
|
|
- // }
|
|
|
|
|
|
+ formOption.disabled = judgeStatus();
|
|
|
|
+ if (props.queryData && ["10", "20", "30"].includes(route.query.processType)) {
|
|
|
|
+ formData.data = proxy.deepClone(newValue)
|
|
|
|
+ }
|
|
},
|
|
},
|
|
{
|
|
{
|
|
deep: true,
|
|
deep: true,
|
|
@@ -124,4 +204,8 @@ defineExpose({ getFormData, handleSubmit });
|
|
::v-deep(.el-input-number .el-input__inner) {
|
|
::v-deep(.el-input-number .el-input__inner) {
|
|
text-align: left;
|
|
text-align: left;
|
|
}
|
|
}
|
|
|
|
+:deep(.el-dialog) {
|
|
|
|
+ margin-top: 10px !important;
|
|
|
|
+ margin-bottom: 10px !important;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|