|
@@ -0,0 +1,86 @@
|
|
|
+<template>
|
|
|
+ <el-card class="box-card">
|
|
|
+ <div style="position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); width: 30vw">
|
|
|
+ <el-form :model="formData.data" label-width="120px" :rules="rules" ref="submit">
|
|
|
+ <el-form-item label="万里牛订单号:" prop="str">
|
|
|
+ <el-input v-model="formData.data.str" :rows="4" type="textarea" placeholder="请输入万里牛订单号" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="仓库:" prop="warehouseId">
|
|
|
+ <el-select v-model="formData.data.warehouseId" placeholder="请选择仓库" style="width: 100%">
|
|
|
+ <el-option v-for="item in warehouseList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="事业部:" prop="departmentId">
|
|
|
+ <el-select v-model="formData.data.departmentId" placeholder="请选择事业部" style="width: 100%">
|
|
|
+ <el-option v-for="item in departmentList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div style="padding: 8px; text-align: center">
|
|
|
+ <el-button @click="clickReset()">重 置</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm()" v-preReClick>提 交</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { ElMessage } from "element-plus";
|
|
|
+
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
+const warehouseList = ref([]);
|
|
|
+const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
|
|
|
+const getDemandData = () => {
|
|
|
+ proxy.post("/warehouse/page", { pageNum: 1, pageSize: 999 }).then((res) => {
|
|
|
+ if (res.rows && res.rows.length > 0) {
|
|
|
+ warehouseList.value = res.rows.map((item) => {
|
|
|
+ return {
|
|
|
+ dictKey: item.id,
|
|
|
+ dictValue: item.name,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
|
|
|
+ if (res.rows && res.rows.length > 0) {
|
|
|
+ departmentList.value = departmentList.value.concat(
|
|
|
+ res.rows.map((item) => {
|
|
|
+ return {
|
|
|
+ dictKey: item.id,
|
|
|
+ dictValue: item.name,
|
|
|
+ };
|
|
|
+ })
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+getDemandData();
|
|
|
+const formData = reactive({
|
|
|
+ data: {},
|
|
|
+});
|
|
|
+const rules = ref({
|
|
|
+ str: [{ required: true, message: "请输入万里牛订单号", trigger: "blur" }],
|
|
|
+ warehouseId: [{ required: true, message: "请选择仓库", trigger: "change" }],
|
|
|
+ departmentId: [{ required: true, message: "请选择事业部", trigger: "change" }],
|
|
|
+});
|
|
|
+const clickReset = () => {
|
|
|
+ formData.data = {};
|
|
|
+};
|
|
|
+const submitForm = () => {
|
|
|
+ proxy.$refs.submit.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ proxy.post("/inventory/add", formData.data).then(
|
|
|
+ () => {
|
|
|
+ ElMessage({ message: "添加成功", type: "success" });
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ console.log(err);
|
|
|
+ ElMessage("添加失败");
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped></style>
|