lxf 2 роки тому
батько
коміт
1ecbcdac32

+ 6 - 7
src/views/purchaseSales/outAndInWarehouse/record/index.vue

@@ -26,7 +26,7 @@ import byTable from "@/components/byTable/index";
 
 const { proxy } = getCurrentInstance();
 const route = useRoute();
-const typeList = ref([
+const opTypeList = ref([
   {
     label: "入库",
     value: "1",
@@ -48,8 +48,7 @@ const typeList = ref([
     value: "5",
   },
 ]);
-// 1手动入库 2 3 4 5 6 7 8 9 10 11 12  13  14 15
-const businessType = ref([
+const typeList = ref([
   {
     label: "手动入库",
     value: "1",
@@ -138,21 +137,21 @@ const config = computed(() => {
     {
       attrs: {
         label: "操作类型",
-        prop: "type",
+        prop: "opType",
         width: 140,
       },
       render(type) {
-        return proxy.dictValueLabel(type, typeList.value);
+        return proxy.dictValueLabel(type, opTypeList.value);
       },
     },
     {
       attrs: {
         label: "出入库类型",
-        prop: "businessType",
+        prop: "type",
         width: 140,
       },
       render(type) {
-        return proxy.dictValueLabel(type, businessType.value);
+        return proxy.dictValueLabel(type, typeList.value);
       },
     },
     {

+ 306 - 0
src/views/salesMange/shipmentMange/document/index.vue

@@ -0,0 +1,306 @@
+<template>
+  <div class="tenant">
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        :action-list="[
+          {
+            text: '新增调仓',
+            action: () => openModal(),
+          },
+        ]"
+        @get-list="getList">
+      </byTable>
+    </div>
+
+    <el-dialog title="新增调仓" v-if="dialogVisible" v-model="dialogVisible" width="1000" v-loading="loadingDialog">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
+        <template #details>
+          <div style="width: 100%">
+            <el-table :data="formData.data.documentsProductList" style="width: 100%; margin-top: 16px">
+              <el-table-column label="货物描述" min-width="240">
+                <template #default="{ row, $index }">
+                  <div style="width: 100%">
+                    <el-form-item :prop="'documentsProductList.' + $index + '.describe'" :rules="rules.describe" :inline-message="true">
+                      <el-input v-model="row.describe" placeholder="请输入货物描述" />
+                    </el-form-item>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column label="副描述" min-width="200">
+                <template #default="{ row, $index }">
+                  <div style="width: 100%">
+                    <el-form-item :prop="'documentsProductList.' + $index + '.subDescribe'" :rules="rules.subDescribe" :inline-message="true">
+                      <el-input v-model="row.subDescribe" placeholder="请输入副描述" />
+                    </el-form-item>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column label="海关编码" width="160">
+                <template #default="{ row, $index }">
+                  <div style="width: 100%">
+                    <el-form-item :prop="'documentsProductList.' + $index + '.customsCode'" :rules="rules.customsCode" :inline-message="true">
+                      <el-input v-model="row.customsCode" placeholder="请输入海关编码" />
+                    </el-form-item>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column label="数量" width="160">
+                <template #default="{ row, $index }">
+                  <div style="width: 100%">
+                    <el-form-item :prop="'documentsProductList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
+                      <el-input-number v-model="row.quantity" placeholder="请输入数量" style="width: 100%" :precision="0" :controls="false" :min="0" />
+                    </el-form-item>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column label="单价" width="160">
+                <template #default="{ row, $index }">
+                  <div style="width: 100%">
+                    <el-form-item :prop="'documentsProductList.' + $index + '.price'" :rules="rules.price" :inline-message="true">
+                      <el-input-number v-model="row.price" placeholder="请输入单价" style="width: 100%" :precision="2" :controls="false" :min="0" />
+                    </el-form-item>
+                  </div>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </template>
+      </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, ElMessageBox } from "element-plus";
+
+const { proxy } = getCurrentInstance();
+const shipmentList = ref([]);
+const countryData = ref([]);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+    keyword: "",
+    warehouseId: "",
+    toWarehouseId: "",
+    type: "3",
+  },
+});
+const loading = ref(false);
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "归属公司",
+        prop: "sellCorporationName",
+        "min-width": 260,
+      },
+    },
+    {
+      attrs: {
+        label: "客户名称",
+        prop: "buyCorporationName",
+        "min-width": 200,
+      },
+    },
+    {
+      attrs: {
+        label: "主合同编号",
+        prop: "code",
+        "min-width": 200,
+      },
+    },
+    {
+      attrs: {
+        label: "货运详情",
+        prop: "acceptCode",
+        "min-width": 200,
+      },
+    },
+    {
+      attrs: {
+        label: "查看单证",
+        prop: "createTime",
+        "min-width": 200,
+      },
+    },
+    {
+      attrs: {
+        label: "创建时间",
+        prop: "createTime",
+        width: 160,
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "80",
+        align: "center",
+      },
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "删除",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              ElMessageBox.confirm("此操作将永久删除该数据, 是否继续?", "提示", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning",
+              }).then(() => {
+                proxy
+                  .post("/documents/delete", {
+                    id: row.id,
+                  })
+                  .then(() => {
+                    ElMessage({
+                      message: "删除成功",
+                      type: "success",
+                    });
+                    getList();
+                  });
+              });
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+const getDict = () => {
+  proxy.post("/packDetail/page", { pageNum: 1, pageSize: 999, shipmentStatus: 1 }).then((res) => {
+    if (res.rows && res.rows.length > 0) {
+      shipmentList.value = res.rows.map((item) => {
+        return {
+          label: item.contract,
+          value: item.id,
+        };
+      });
+    }
+  });
+  proxy.post("/areaInfo/list", { parentId: "0" }).then((res) => {
+    countryData.value = res;
+  });
+};
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy.post("/documents/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: {
+    documentsProductList: [],
+  },
+});
+const formConfig = computed(() => {
+  return [
+    {
+      type: "select",
+      prop: "contractId",
+      label: "出货主合同",
+      required: true,
+      data: shipmentList.value,
+    },
+    {
+      type: "slot",
+      slotName: "details",
+      label: "产品信息",
+    },
+    {
+      label: "唛头信息",
+    },
+    {
+      type: "select",
+      prop: "countryId",
+      label: "目的国",
+      required: true,
+      data: countryData.value,
+    },
+    {
+      type: "input",
+      prop: "remark",
+      label: "唛头明细",
+      itemType: "textarea",
+    },
+  ];
+});
+const rules = ref({
+  contractId: [{ required: true, message: "请选择出货主合同", trigger: "change" }],
+  countryId: [{ required: true, message: "请选择目的国", trigger: "change" }],
+  describe: [{ required: true, message: "请输入货物描述", trigger: "blur" }],
+  subDescribe: [{ required: true, message: "请输入副描述", trigger: "blur" }],
+  customsCode: [{ required: true, message: "请输入海关编码", trigger: "blur" }],
+  quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
+  price: [{ required: true, message: "请输入单价", trigger: "blur" }],
+});
+const openModal = () => {
+  formData.data = {
+    documentsProductList: [],
+  };
+  loadingDialog.value = false;
+  dialogVisible.value = true;
+};
+const submitForm = () => {
+  submit.value.handleSubmit(() => {
+    loadingDialog.value = true;
+    proxy.post("/documents/add", formData.data).then(
+      () => {
+        ElMessage({
+          message: "提交成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        getList();
+      },
+      (err) => {
+        console.log(err);
+        loadingDialog.value = false;
+      }
+    );
+  });
+};
+</script>
+
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+::v-deep(.el-input-number .el-input__inner) {
+  text-align: left;
+}
+</style>