lxf %!s(int64=2) %!d(string=hai) anos
pai
achega
5cd141697a

+ 2 - 1
src/main.js

@@ -44,7 +44,7 @@ import {
   selectDictLabels
 } from '@/utils/ruoyi'
 
-import { dictDataEcho, moneyFormat, calculationWeek,getDict } from '@/utils/util'
+import { dictDataEcho, dictValueLabel, moneyFormat, calculationWeek,getDict } from '@/utils/util'
 
 // 分页组件
 import Pagination from '@/components/Pagination'
@@ -76,6 +76,7 @@ app.config.globalProperties.selectDictLabel = selectDictLabel
 app.config.globalProperties.selectDictLabels = selectDictLabels
 //字典回显
 app.config.globalProperties.dictDataEcho = dictDataEcho
+app.config.globalProperties.dictValueLabel = dictValueLabel
 app.config.globalProperties.moneyFormat = moneyFormat
 app.config.globalProperties.calculationWeek = calculationWeek
 app.config.globalProperties.getDict = getDict

+ 36 - 28
src/utils/util.js

@@ -1,10 +1,7 @@
 import moment from "moment";
 
-import {
-  post,
-  get
-} from '@/utils/request'
-import Cookies from 'js-cookie'
+import { post, get } from "@/utils/request";
+import Cookies from "js-cookie";
 
 //根据value值回显字典label值
 export function dictDataEcho(value, arr) {
@@ -19,44 +16,55 @@ export function dictDataEcho(value, arr) {
   return "";
 }
 
+//根据value值回显字典label值
+export function dictValueLabel(value, arr) {
+  if ((value || value === 0) && arr) {
+    const current = arr.filter((x) => x.value == value);
+    if (current && current.length > 0) {
+      return current[0].label;
+    }
+    return "";
+  }
+  return "";
+}
+
 export function getDict(key) {
   return new Promise((resolve, reject) => {
-    let dictObj = {}
-    let arr = {}
-    let num = 0
-    if(!sessionStorage.getItem('dict')) {
-      sessionStorage.setItem('dict', JSON.stringify(dictObj))
-    }else{
-      dictObj = JSON.parse(sessionStorage.getItem('dict'))
+    let dictObj = {};
+    let arr = {};
+    let num = 0;
+    if (!sessionStorage.getItem("dict")) {
+      sessionStorage.setItem("dict", JSON.stringify(dictObj));
+    } else {
+      dictObj = JSON.parse(sessionStorage.getItem("dict"));
     }
     for (let i = 0; i < key.length; i++) {
       const element = key[i];
-      if(dictObj[element]) {
-        arr[element] = dictObj[element]
-        num++
-        if(num === key.length) {
+      if (dictObj[element]) {
+        arr[element] = dictObj[element];
+        num++;
+        if (num === key.length) {
           resolve(arr);
         }
-      }else{
+      } else {
         post("/dictTenantData/page", {
           pageNum: 1,
           pageSize: 999,
-          tenantId: Cookies.get('tenantId'),
+          tenantId: Cookies.get("tenantId"),
           dictCode: element,
-        }).then(res => {
-          dictObj[element] = res.rows
-          arr[element] = res.rows
-          sessionStorage.setItem('dict', JSON.stringify(dictObj))
-          num++
-          console.log(num)
-          if(num === key.length) {
+        }).then((res) => {
+          dictObj[element] = res.rows;
+          arr[element] = res.rows;
+          sessionStorage.setItem("dict", JSON.stringify(dictObj));
+          num++;
+          console.log(num);
+          if (num === key.length) {
             resolve(arr);
           }
-        })
+        });
       }
     }
-  })
-  
+  });
 }
 
 // 金额千分符

+ 293 - 0
src/views/purchaseSales/outAndInWarehouse/waitingForDelivery/index.vue

@@ -0,0 +1,293 @@
+<template>
+  <div class="tenant">
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        :selectConfig="selectConfig"
+        highlight-current-row
+        @get-list="getList">
+      </byTable>
+    </div>
+
+    <el-dialog title="出库" v-if="dialogVisible" v-model="dialogVisible" width="400" v-loading="loadingDialog">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit"> </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button type="primary" @click="submitForm()" size="large">确 定</el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import { computed, ref } from "vue";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import { ElMessage } from "element-plus";
+
+const { proxy } = getCurrentInstance();
+const warehouseList = ref([]);
+const status = ref([
+  {
+    label: "待出库",
+    value: 0,
+  },
+  {
+    label: "部分出库",
+    value: 1,
+  },
+  {
+    label: "出库完成",
+    value: 2,
+  },
+]);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+    keyword: "",
+    status: "",
+    type: 2
+  },
+});
+const loading = ref(false);
+const selectConfig = computed(() => {
+  return [
+    {
+      label: "出库类型",
+      prop: "status",
+      data: status.value,
+    },
+  ];
+});
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "数据来源",
+        prop: "aaaaaaa",
+        width: 120,
+      },
+    },
+    {
+      attrs: {
+        label: "单号",
+        prop: "businessCode",
+        width: 160,
+      },
+    },
+    {
+      attrs: {
+        label: "物品类型",
+        prop: "aaaaaaa",
+        width: 120,
+      },
+    },
+    {
+      attrs: {
+        label: "物品编码",
+        prop: "productCode",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "物品名称",
+        prop: "productName",
+        "min-width": 200,
+      },
+    },
+    {
+      attrs: {
+        label: "规格型号",
+        prop: "productModel",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "单位",
+        prop: "unit",
+        width: 120,
+      },
+    },
+    {
+      attrs: {
+        label: "待出库数量",
+        prop: "quantity",
+        width: 120,
+      },
+    },
+    {
+      attrs: {
+        label: "出库状态",
+        prop: "status",
+        width: 140,
+      },
+      render(type) {
+        return proxy.dictValueLabel(type, status.value);
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "80",
+        align: "center",
+      },
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "出库",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              clickOperation(row);
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+const getDict = () => {
+  proxy.post("/warehouse/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    if (res.rows && res.rows.length > 0) {
+      warehouseList.value = res.rows.map((item) => {
+        return {
+          label: item.name,
+          value: item.id,
+        };
+      });
+    }
+  });
+};
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy.post("/stockWait/page", sourceList.value.pagination).then((res) => {
+    sourceList.value.data = res.rows;
+    sourceList.value.pagination.total = res.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
+getDict();
+getList();
+const dialogVisible = ref(false);
+const loadingDialog = ref(false);
+const submit = ref(null);
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const formData = reactive({
+  data: {},
+});
+const formConfig = computed(() => {
+  return [
+    {
+      label: "待出库信息",
+    },
+    {
+      type: "input",
+      prop: "aaaaaaa",
+      label: "数据来源",
+      itemType: "text",
+      disabled: true,
+    },
+    {
+      type: "input",
+      prop: "businessCode",
+      label: "单号",
+      itemType: "text",
+      disabled: true,
+    },
+    {
+      type: "input",
+      prop: "productName",
+      label: "物品名称",
+      itemType: "text",
+      disabled: true,
+    },
+    {
+      type: "input",
+      prop: "quantity",
+      label: "待出库数量",
+      itemType: "text",
+      disabled: true,
+    },
+    {
+      label: "本次出库",
+    },
+    {
+      type: "select",
+      prop: "warehouseId",
+      label: "仓库名称",
+      required: true,
+      data: warehouseList.value,
+    },
+    {
+      type: "number",
+      prop: "warehousingQuantity",
+      label: "出库数量",
+      precision: 0,
+      min: 0,
+      controls: false,
+    },
+  ];
+});
+const rules = ref({
+  warehouseId: [{ required: true, message: "请选择仓库", trigger: "change" }],
+  warehousingQuantity: [{ required: true, message: "请输入出库数量", trigger: "blur" }],
+});
+const submitForm = () => {
+  submit.value.handleSubmit(() => {
+    loadingDialog.value = true;
+    proxy
+      .post("/stockWait/add", {
+        id: formData.data.id,
+        warehouseId: formData.data.warehouseId,
+        quantity: formData.data.warehousingQuantity,
+      })
+      .then(
+        () => {
+          ElMessage({
+            message: "提交成功",
+            type: "success",
+          });
+          dialogVisible.value = false;
+          getList();
+        },
+        (err) => {
+          console.log(err);
+          loadingDialog.value = false;
+        }
+      );
+  });
+};
+const clickOperation = (row) => {
+  formData.data = row;
+  loadingDialog.value = false;
+  dialogVisible.value = true;
+};
+</script>
+
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+::v-deep(.el-input-number .el-input__inner) {
+  text-align: left;
+}
+</style>

+ 294 - 0
src/views/purchaseSales/outAndInWarehouse/waitingForStorage/index.vue

@@ -0,0 +1,294 @@
+<template>
+  <div class="tenant">
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        :selectConfig="selectConfig"
+        highlight-current-row
+        @get-list="getList">
+      </byTable>
+    </div>
+
+    <el-dialog title="入库" v-if="dialogVisible" v-model="dialogVisible" width="400" v-loading="loadingDialog">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit"> </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button type="primary" @click="submitForm()" size="large">确 定</el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import { computed, ref } from "vue";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import { ElMessage } from "element-plus";
+
+const { proxy } = getCurrentInstance();
+const warehouseList = ref([]);
+const status = ref([
+  {
+    label: "待入库",
+    value: 0,
+  },
+  {
+    label: "部分入库",
+    value: 1,
+  },
+  {
+    label: "入库完成",
+    value: 2,
+  },
+]);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+    keyword: "",
+    status: "",
+    type: 1,
+  },
+});
+const loading = ref(false);
+const selectConfig = computed(() => {
+  return [
+    {
+      label: "入库类型",
+      prop: "status",
+      data: status.value,
+    },
+  ];
+});
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "数据来源",
+        prop: "aaaaaaa",
+        width: 120,
+      },
+    },
+    {
+      attrs: {
+        label: "单号",
+        prop: "businessCode",
+        width: 160,
+      },
+    },
+    {
+      attrs: {
+        label: "物品类型",
+        prop: "aaaaaaa",
+        width: 120,
+      },
+    },
+    {
+      attrs: {
+        label: "物品编码",
+        prop: "productCode",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "物品名称",
+        prop: "productName",
+        "min-width": 200,
+      },
+    },
+    {
+      attrs: {
+        label: "规格型号",
+        prop: "productModel",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "单位",
+        prop: "unit",
+        width: 120,
+      },
+    },
+    {
+      attrs: {
+        label: "待入库数量",
+        prop: "quantity",
+        width: 120,
+      },
+    },
+    {
+      attrs: {
+        label: "入库状态",
+        prop: "status",
+        width: 140,
+      },
+      render(type) {
+        return proxy.dictValueLabel(type, status.value);
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "80",
+        align: "center",
+      },
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "入库",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              clickOperation(row);
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+const getDict = () => {
+  proxy.post("/warehouse/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    if (res.rows && res.rows.length > 0) {
+      warehouseList.value = res.rows.map((item) => {
+        return {
+          label: item.name,
+          value: item.id,
+        };
+      });
+    }
+  });
+};
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy.post("/stockWait/page", sourceList.value.pagination).then((res) => {
+    sourceList.value.data = res.rows;
+    sourceList.value.pagination.total = res.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
+getDict();
+getList();
+const modalType = ref("add");
+const dialogVisible = ref(false);
+const loadingDialog = ref(false);
+const submit = ref(null);
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const formData = reactive({
+  data: {},
+});
+const formConfig = computed(() => {
+  return [
+    {
+      label: "待入库信息",
+    },
+    {
+      type: "input",
+      prop: "aaaaaaa",
+      label: "数据来源",
+      itemType: "text",
+      disabled: true,
+    },
+    {
+      type: "input",
+      prop: "businessCode",
+      label: "单号",
+      itemType: "text",
+      disabled: true,
+    },
+    {
+      type: "input",
+      prop: "productName",
+      label: "物品名称",
+      itemType: "text",
+      disabled: true,
+    },
+    {
+      type: "input",
+      prop: "quantity",
+      label: "待入库数量",
+      itemType: "text",
+      disabled: true,
+    },
+    {
+      label: "本次入库",
+    },
+    {
+      type: "select",
+      prop: "warehouseId",
+      label: "仓库名称",
+      required: true,
+      data: warehouseList.value,
+    },
+    {
+      type: "number",
+      prop: "warehousingQuantity",
+      label: "入库数量",
+      precision: 0,
+      min: 0,
+      controls: false,
+    },
+  ];
+});
+const rules = ref({
+  warehouseId: [{ required: true, message: "请选择仓库", trigger: "change" }],
+  warehousingQuantity: [{ required: true, message: "请输入入库数量", trigger: "blur" }],
+});
+const submitForm = () => {
+  submit.value.handleSubmit(() => {
+    loadingDialog.value = true;
+    proxy
+      .post("/stockWait/add", {
+        id: formData.data.id,
+        warehouseId: formData.data.warehouseId,
+        quantity: formData.data.warehousingQuantity,
+      })
+      .then(
+        () => {
+          ElMessage({
+            message: "提交成功",
+            type: "success",
+          });
+          dialogVisible.value = false;
+          getList();
+        },
+        (err) => {
+          console.log(err);
+          loadingDialog.value = false;
+        }
+      );
+  });
+};
+const clickOperation = (row) => {
+  formData.data = row;
+  loadingDialog.value = false;
+  dialogVisible.value = true;
+};
+</script>
+
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+::v-deep(.el-input-number .el-input__inner) {
+  text-align: left;
+}
+</style>