cz 2 年之前
父节点
当前提交
22cc85d37b

+ 11 - 0
src/router/index.js

@@ -67,6 +67,17 @@ const routes = [{
 				component: () => import('../views/purchase-sales/inbound-outbound/manualInbound/add.vue')
 			},
 			{
+				path: 'waitInbound',
+				name: '待入库',
+				component: () => import('../views/purchase-sales/inbound-outbound/waitInbound/index.vue')
+			},
+			{
+				path: 'waitInboundAdd',
+				name: '入库',
+				component: () => import('../views/purchase-sales/inbound-outbound/waitInbound/add.vue')
+			},
+
+			{
 				path: 'transferWarehouse',
 				name: '调仓',
 				component: () => import('../views/purchase-sales/inbound-outbound/transferWarehouse/index.vue')

+ 5 - 9
src/views/purchase-sales/inbound-outbound/transferWarehouse/add.vue

@@ -169,21 +169,17 @@ const columnsOne = ref([]);
 
 const onConfirm = ({ selectedOptions }) => {
   if (isTo.value) {
+    if (formData.value.toWarehouseId === selectedOptions[0].value) {
+      return showFailToast("仓库不可相同!");
+    }
     formData.value.toWarehouseId = selectedOptions[0].value;
     formData.value.toWarehouseName = selectedOptions[0].text;
-    if (formData.value.toWarehouseId === formData.value.warehouseId) {
-      formData.value.toWarehouseId = "";
-      formData.value.toWarehouseName = "";
+  } else {
+    if (formData.value.toWarehouseId === selectedOptions[0].value) {
       return showFailToast("仓库不可相同!");
     }
-  } else {
     formData.value.warehouseId = selectedOptions[0].value;
     formData.value.warehouseName = selectedOptions[0].text;
-    if (formData.value.toWarehouseId === formData.value.warehouseId) {
-      formData.value.warehouseId = "";
-      formData.value.warehouseName = "";
-      return showFailToast("仓库不可相同!");
-    }
   }
 
   typeModal.value = false;

+ 218 - 0
src/views/purchase-sales/inbound-outbound/waitInbound/add.vue

@@ -0,0 +1,218 @@
+<template>
+  <div class="form">
+    <van-nav-bar
+      title="手动入库"
+      left-text="返回"
+      left-arrow
+      @click-left="onClickLeft"
+    >
+    </van-nav-bar>
+    <van-form @submit="onSubmit" label-align="top" style="margin-top: 20px">
+      <van-cell-group inset>
+        <van-field
+          v-model="formData.warehouseName"
+          is-link
+          readonly
+          label="仓库名称"
+          placeholder="选择仓库名称"
+          @click="typeModal = true"
+          :rules="[{ required: true, message: '仓库名称不能为空' }]"
+          required
+        />
+        <van-popup v-model:show="typeModal" round position="bottom">
+          <van-picker
+            :columns="columns"
+            @cancel="typeModal = false"
+            @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-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">
+        <van-button round block type="primary" native-type="submit">
+          提交
+        </van-button>
+      </div>
+    </van-form>
+  </div>
+</template>
+
+<script setup>
+import { ref, getCurrentInstance, onMounted } from "vue";
+import { showSuccessToast, showFailToast } from "vant";
+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 getDict = () => {
+  proxy.post("/warehouse/page", { pageNum: 1, pageSize: 9999 }).then((res) => {
+    columns.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;
+  });
+
+  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) => {
+    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;
+  formData.value.warehouseName = selectedOptions[0].text;
+  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(
+    (res) => {
+      setTimeout(() => {
+        showSuccessToast("入库成功");
+        proxy.$router.push("/main/manualInbound");
+      }, 500);
+    },
+    (err) => {
+      return showFailToast(err.message);
+    }
+  );
+};
+onMounted(() => {
+  getDetails(route.query.id);
+  getDict();
+});
+</script>
+<style lang="scss" scoped>
+.row {
+  display: flex;
+  padding: 5px 10px 0 10px;
+  justify-content: space-between;
+  align-items: center;
+  .title {
+    flex: 1;
+  }
+  .delete {
+    width: 20px;
+    cursor: pointer;
+    text-align: center;
+  }
+}
+</style>

+ 108 - 0
src/views/purchase-sales/inbound-outbound/waitInbound/index.vue

@@ -0,0 +1,108 @@
+<template>
+  <van-nav-bar title="待入库" left-text="" left-arrow @click-left="onClickLeft">
+    <!-- <template #right> 添加 </template> -->
+  </van-nav-bar>
+  <van-search
+    v-model="req.keyword"
+    placeholder="请输入搜索关键词"
+    @search="onRefresh"
+  />
+  <van-pull-refresh v-model="loading" @refresh="onRefresh">
+    <div class="list">
+      <van-list
+        v-model:loading="loading"
+        :finished="finished"
+        finished-text="没有更多了"
+        @load="onLoad"
+        style="margin-bottom: 60px"
+      >
+        <commonList
+          :data="listData"
+          @onClick="toDtl"
+          :config="listConfig"
+        ></commonList>
+      </van-list>
+    </div>
+  </van-pull-refresh>
+</template>
+<script setup>
+import { ref, getCurrentInstance, onMounted } from "vue";
+import commonList from "@/components/common-list.vue";
+import { useRoute } from "vue-router";
+const loading = ref(false);
+const router = useRoute();
+const req = ref({
+  pageNum: 1,
+  type: "1",
+  keyword: null,
+});
+const finished = ref(false);
+const proxy = getCurrentInstance().proxy;
+const listData = ref([]);
+
+const listConfig = ref([
+  {
+    label: "数据来源",
+    prop: "warehouseName",
+  },
+  {
+    label: "入库时间",
+    prop: "createTime",
+  },
+  {
+    label: "操作人",
+    prop: "userName",
+  },
+]);
+const onRefresh = () => {
+  req.value.pageNum = 1;
+  finished.value = false;
+  getList("refresh");
+};
+const onLoad = () => {
+  getList();
+};
+
+const onClickLeft = () => proxy.$router.push("/main/working");
+
+const onClickRight = () => {
+  proxy.$router.push("/main/manualInboundAdd");
+};
+
+const toDtl = (row) => {
+  proxy.$router.push({
+    path: "manualInboundAdd",
+    query: {
+      id: row.id,
+    },
+  });
+};
+
+const getList = (type) => {
+  loading.value = true;
+  proxy
+    .post("/stockWait/page", req.value)
+    .then((res) => {
+      console.log(req.value);
+      listData.value =
+        type === "refresh"
+          ? res.data.rows
+          : listData.value.concat(res.data.rows);
+      if (req.value.pageNum * 10 >= res.data.total) {
+        finished.value = true;
+      }
+      req.value.pageNum++;
+      loading.value = false;
+    })
+    .catch((err) => {
+      loading.value = false;
+    });
+};
+getList();
+</script>
+
+<style lang="scss" scoped>
+.list {
+  min-height: 70vh;
+}
+</style>

+ 218 - 0
src/views/purchase-sales/inbound-outbound/waitOutbound/add.vue

@@ -0,0 +1,218 @@
+<template>
+  <div class="form">
+    <van-nav-bar
+      title="手动入库"
+      left-text="返回"
+      left-arrow
+      @click-left="onClickLeft"
+    >
+    </van-nav-bar>
+    <van-form @submit="onSubmit" label-align="top" style="margin-top: 20px">
+      <van-cell-group inset>
+        <van-field
+          v-model="formData.warehouseName"
+          is-link
+          readonly
+          label="仓库名称"
+          placeholder="选择仓库名称"
+          @click="typeModal = true"
+          :rules="[{ required: true, message: '仓库名称不能为空' }]"
+          required
+        />
+        <van-popup v-model:show="typeModal" round position="bottom">
+          <van-picker
+            :columns="columns"
+            @cancel="typeModal = false"
+            @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-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">
+        <van-button round block type="primary" native-type="submit">
+          提交
+        </van-button>
+      </div>
+    </van-form>
+  </div>
+</template>
+
+<script setup>
+import { ref, getCurrentInstance, onMounted } from "vue";
+import { showSuccessToast, showFailToast } from "vant";
+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 getDict = () => {
+  proxy.post("/warehouse/page", { pageNum: 1, pageSize: 9999 }).then((res) => {
+    columns.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;
+  });
+
+  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) => {
+    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;
+  formData.value.warehouseName = selectedOptions[0].text;
+  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(
+    (res) => {
+      setTimeout(() => {
+        showSuccessToast("入库成功");
+        proxy.$router.push("/main/manualInbound");
+      }, 500);
+    },
+    (err) => {
+      return showFailToast(err.message);
+    }
+  );
+};
+onMounted(() => {
+  getDetails(route.query.id);
+  getDict();
+});
+</script>
+<style lang="scss" scoped>
+.row {
+  display: flex;
+  padding: 5px 10px 0 10px;
+  justify-content: space-between;
+  align-items: center;
+  .title {
+    flex: 1;
+  }
+  .delete {
+    width: 20px;
+    cursor: pointer;
+    text-align: center;
+  }
+}
+</style>

+ 114 - 0
src/views/purchase-sales/inbound-outbound/waitOutbound/index.vue

@@ -0,0 +1,114 @@
+<template>
+  <van-nav-bar
+    title="手动入库"
+    left-text=""
+    left-arrow
+    @click-left="onClickLeft"
+    @click-right="onClickRight"
+  >
+    <template #right> 添加 </template>
+  </van-nav-bar>
+  <van-search
+    v-model="req.keyword"
+    placeholder="请输入搜索关键词"
+    @search="onRefresh"
+  />
+  <van-pull-refresh v-model="loading" @refresh="onRefresh">
+    <div class="list">
+      <van-list
+        v-model:loading="loading"
+        :finished="finished"
+        finished-text="没有更多了"
+        @load="onLoad"
+        style="margin-bottom: 60px"
+      >
+        <commonList
+          :data="listData"
+          @onClick="toDtl"
+          :config="listConfig"
+        ></commonList>
+      </van-list>
+    </div>
+  </van-pull-refresh>
+</template>
+<script setup>
+import { ref, getCurrentInstance, onMounted } from "vue";
+import commonList from "@/components/common-list.vue";
+import { useRoute } from "vue-router";
+const loading = ref(false);
+const router = useRoute();
+const req = ref({
+  pageNum: 1,
+  type: "1",
+  keyword: null,
+});
+const finished = ref(false);
+const proxy = getCurrentInstance().proxy;
+const listData = ref([]);
+
+const listConfig = ref([
+  {
+    label: "仓库名称",
+    prop: "warehouseName",
+  },
+  {
+    label: "入库时间",
+    prop: "createTime",
+  },
+  {
+    label: "操作人",
+    prop: "userName",
+  },
+]);
+const onRefresh = () => {
+  req.value.pageNum = 1;
+  finished.value = false;
+  getList("refresh");
+};
+const onLoad = () => {
+  getList();
+};
+
+const onClickLeft = () => proxy.$router.push("/main/working");
+
+const onClickRight = () => {
+  proxy.$router.push("/main/manualInboundAdd");
+};
+
+const toDtl = (row) => {
+  proxy.$router.push({
+    path: "manualInboundAdd",
+    query: {
+      id: row.id,
+    },
+  });
+};
+
+const getList = (type) => {
+  loading.value = true;
+  proxy
+    .post("/stockJournal/page", req.value)
+    .then((res) => {
+      console.log(req.value);
+      listData.value =
+        type === "refresh"
+          ? res.data.rows
+          : listData.value.concat(res.data.rows);
+      if (req.value.pageNum * 10 >= res.data.total) {
+        finished.value = true;
+      }
+      req.value.pageNum++;
+      loading.value = false;
+    })
+    .catch((err) => {
+      loading.value = false;
+    });
+};
+getList();
+</script>
+
+<style lang="scss" scoped>
+.list {
+  min-height: 70vh;
+}
+</style>