Browse Source

待出入库

cz 2 years ago
parent
commit
d1d0fd5e1b

+ 10 - 1
src/router/index.js

@@ -80,7 +80,16 @@ const routes = [{
 				name: '待入库>入库',
 				component: () => import('../views/purchase-sales/inbound-outbound/waitInbound/add.vue')
 			},
-
+			{
+				path: 'waitOutbound',
+				name: '待出库',
+				component: () => import('../views/purchase-sales/inbound-outbound/waitOutbound/index.vue')
+			},
+			{
+				path: 'waitOutboundAdd',
+				name: '待出库>出库',
+				component: () => import('../views/purchase-sales/inbound-outbound/waitOutbound/add.vue')
+			},
 			{
 				path: 'transferWarehouse',
 				name: '调仓',

+ 6 - 9
src/views/purchase-sales/inbound-outbound/waitInbound/add.vue

@@ -12,7 +12,7 @@
         <van-field v-model="formData.businessType" readonly label="数据来源" />
         <van-field v-model="formData.businessCode" readonly label="单号" />
         <van-field v-model="formData.productName" readonly label="物品名称" />
-        <van-field v-model="formData.quantity" readonly label="待入库数量" />
+        <van-field v-model="formData.inQuantity" readonly label="待入库数量" />
       </van-cell-group>
       <div style="padding: 5px 0 5px 15px; color: #999999">本次入库</div>
       <van-cell-group inset>
@@ -34,7 +34,7 @@
           />
         </van-popup>
         <van-field
-          v-model="formData.warehouseName"
+          v-model="formData.quantity"
           label="入库数量"
           placeholder="请输入入库数量"
           :rules="[{ required: true, message: '入库数量不能为空' }]"
@@ -58,11 +58,7 @@ import { useRoute } from "vue-router";
 const proxy = getCurrentInstance().proxy;
 const route = useRoute();
 const typeModal = ref(false);
-const formData = ref({
-  warehouseId: "",
-  type: "1",
-  warehouseName: "",
-});
+const formData = ref({});
 
 const getDict = () => {
   proxy.post("/warehouse/page", { pageNum: 1, pageSize: 9999 }).then((res) => {
@@ -77,6 +73,7 @@ const getDict = () => {
 
 const getDetails = (id) => {
   proxy.post("/stockWait/detail", { id }).then((res) => {
+    res.data.inQuantity = res.data.quantity;
     formData.value = res.data;
   });
 };
@@ -92,11 +89,11 @@ const onConfirm = ({ selectedOptions }) => {
 const onClickLeft = () => history.back();
 
 const onSubmit = () => {
-  proxy.post("/stock/add", formData.value).then(
+  proxy.post("/stockWait/add", formData.value).then(
     (res) => {
       setTimeout(() => {
         showSuccessToast("入库成功");
-        proxy.$router.push("/main/manualInbound");
+        proxy.$router.push("/main/waitInbound");
       }, 500);
     },
     (err) => {

+ 24 - 117
src/views/purchase-sales/inbound-outbound/waitOutbound/add.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="form">
     <van-nav-bar
-      title="手动入库"
+      title="待出库"
       left-text="返回"
       left-arrow
       @click-left="onClickLeft"
@@ -9,6 +9,13 @@
     </van-nav-bar>
     <van-form @submit="onSubmit" label-align="top" style="margin-top: 20px">
       <van-cell-group inset>
+        <van-field v-model="formData.businessType" readonly label="数据来源" />
+        <van-field v-model="formData.businessCode" readonly label="单号" />
+        <van-field v-model="formData.productName" readonly label="物品名称" />
+        <van-field v-model="formData.inQuantity" readonly label="待入库数量" />
+      </van-cell-group>
+      <div style="padding: 5px 0 5px 15px; color: #999999">本次入库</div>
+      <van-cell-group inset>
         <van-field
           v-model="formData.warehouseName"
           is-link
@@ -26,59 +33,15 @@
             @confirm="onConfirm"
           />
         </van-popup>
-        <!-- 明细列表 -->
-        <div v-for="(item, index) in list" :key="index">
-          <div class="row">
-            <div class="title">明细{{ index + 1 }}</div>
-            <div
-              class="delete"
-              @click.native="handleDel(index)"
-              v-if="!route.query.id"
-            >
-              <van-icon name="cross" />
-            </div>
-          </div>
-          <van-field
-            v-model="list[index].productName"
-            is-link
-            readonly
-            label="物品名称"
-            placeholder="选择物品名称"
-            @click="handleSelect(index)"
-            :rules="[{ required: true, message: '物品名称不能为空' }]"
-            required
-          />
-
-          <van-field
-            v-model="list[index].quantity"
-            label="入库数量"
-            placeholder="请输入入库数量"
-            :rules="[{ required: true, message: '入库数量不能为空' }]"
-            required
-          />
-        </div>
-        <van-popup v-model:show="typeModalOne" round position="bottom">
-          <van-picker
-            :columns="columnsOne"
-            @cancel="typeModalOne = false"
-            @confirm="(data) => onConfirmOne(data, index)"
-          />
-        </van-popup>
+        <van-field
+          v-model="formData.quantity"
+          label="入库数量"
+          placeholder="请输入入库数量"
+          :rules="[{ required: true, message: '入库数量不能为空' }]"
+          required
+        />
       </van-cell-group>
-
-      <div style="text-align: center; line-height: 28px" v-if="!route.query.id">
-        <van-button
-          icon="plus"
-          type="primary"
-          plain
-          size="mini"
-          style="margin-top: 10px"
-          @click="handleAddRow"
-          >添加明细</van-button
-        >
-      </div>
-
-      <div style="margin: 16px" v-if="!route.query.id">
+      <div style="margin: 16px">
         <van-button round block type="primary" native-type="submit">
           提交
         </van-button>
@@ -94,23 +57,9 @@ import { useRoute } from "vue-router";
 
 const proxy = getCurrentInstance().proxy;
 const route = useRoute();
-const showPicker = ref(false);
 const typeModal = ref(false);
-const typeModalOne = ref(false);
-let selectIndex = ref(null);
-const formData = ref({
-  warehouseId: "",
-  type: "1",
-  warehouseName: "",
-});
-const list = ref([]);
-const handleAddRow = () => {
-  list.value.push({
-    productId: "",
-    productName: "",
-    quantity: "",
-  });
-};
+const formData = ref({});
+
 const getDict = () => {
   proxy.post("/warehouse/page", { pageNum: 1, pageSize: 9999 }).then((res) => {
     columns.value = res.data.rows.map((item) => {
@@ -119,39 +68,17 @@ const getDict = () => {
         value: item.id,
       };
     });
-    // formData.value.warehouseName = formData.value.warehouseId
-    //   ? columns.value.find((item) => item.value == formData.value.warehouseId).name
-    //   : null;
   });
-
-  proxy
-    .post("/productInfo/page", { pageNum: 1, pageSize: 9999, definition: "1" })
-    .then((res) => {
-      columnsOne.value = res.data.rows.map((item) => {
-        return {
-          text: item.name,
-          value: item.id,
-        };
-      });
-      // formData.value.warehouseName = formData.value.warehouseId
-      //   ? columns.value.find((item) => item.value == formData.value.warehouseId).name
-      //   : null;
-    });
 };
 
 const getDetails = (id) => {
-  proxy.post("/stockJournal/detail", { id }).then((res) => {
+  proxy.post("/stockWait/detail", { id }).then((res) => {
+    res.data.inQuantity = res.data.quantity;
     formData.value = res.data;
-    list.value = res.data.list.map((x) => ({
-      productId: x.productId,
-      productName: x.productName,
-      quantity: x.quantity,
-    }));
   });
 };
 
 const columns = ref([]);
-const columnsOne = ref([]);
 
 const onConfirm = ({ selectedOptions }) => {
   formData.value.warehouseId = selectedOptions[0].value;
@@ -159,35 +86,14 @@ const onConfirm = ({ selectedOptions }) => {
   typeModal.value = false;
 };
 
-const onConfirmOne = ({ selectedOptions }, index) => {
-  list.value[selectIndex.value].productId = selectedOptions[0].value;
-  list.value[selectIndex.value].productName = selectedOptions[0].text;
-  typeModalOne.value = false;
-};
-
-const handleSelect = (index) => {
-  selectIndex.value = index;
-  typeModalOne.value = true;
-};
-
-const handleDel = (index) => {
-  list.value.splice(index, 1);
-};
-
 const onClickLeft = () => history.back();
 
 const onSubmit = () => {
-  if (!list.value.length > 0) return showFailToast("请添加明细!");
-  formData.value.list = list.value.map((x) => ({
-    productId: x.productId,
-    quantity: x.quantity,
-  }));
-  formData.value.type = "1";
-  proxy.post("/stock/add", formData.value).then(
+  proxy.post("/stockWait/add", formData.value).then(
     (res) => {
       setTimeout(() => {
-        showSuccessToast("库成功");
-        proxy.$router.push("/main/manualInbound");
+        showSuccessToast("出库成功");
+        proxy.$router.push("/main/waitOutbound");
       }, 500);
     },
     (err) => {
@@ -195,6 +101,7 @@ const onSubmit = () => {
     }
   );
 };
+
 onMounted(() => {
   getDetails(route.query.id);
   getDict();

+ 12 - 17
src/views/purchase-sales/inbound-outbound/waitOutbound/index.vue

@@ -1,12 +1,6 @@
 <template>
-  <van-nav-bar
-    title="手动入库"
-    left-text=""
-    left-arrow
-    @click-left="onClickLeft"
-    @click-right="onClickRight"
-  >
-    <template #right> 添加 </template>
+  <van-nav-bar title="待出库" left-text="" left-arrow @click-left="onClickLeft">
+    <!-- <template #right> 添加 </template> -->
   </van-nav-bar>
   <van-search
     v-model="req.keyword"
@@ -27,6 +21,7 @@
           @onClick="toDtl"
           :config="listConfig"
         ></commonList>
+        <div></div>
       </van-list>
     </div>
   </van-pull-refresh>
@@ -39,7 +34,7 @@ const loading = ref(false);
 const router = useRoute();
 const req = ref({
   pageNum: 1,
-  type: "1",
+  type: "2",
   keyword: null,
 });
 const finished = ref(false);
@@ -48,16 +43,16 @@ const listData = ref([]);
 
 const listConfig = ref([
   {
-    label: "仓库名称",
-    prop: "warehouseName",
+    label: "数据来源",
+    prop: "businessType",
   },
   {
-    label: "入库时间",
-    prop: "createTime",
+    label: "物品名称",
+    prop: "productName",
   },
   {
-    label: "操作人",
-    prop: "userName",
+    label: "代办数量",
+    prop: "quantity",
   },
 ]);
 const onRefresh = () => {
@@ -77,7 +72,7 @@ const onClickRight = () => {
 
 const toDtl = (row) => {
   proxy.$router.push({
-    path: "manualInboundAdd",
+    path: "waitOutboundAdd",
     query: {
       id: row.id,
     },
@@ -87,7 +82,7 @@ const toDtl = (row) => {
 const getList = (type) => {
   loading.value = true;
   proxy
-    .post("/stockJournal/page", req.value)
+    .post("/stockWait/page", req.value)
     .then((res) => {
       console.log(req.value);
       listData.value =