Browse Source

交接单

lxf 2 years ago
parent
commit
5aaf7a94a9
1 changed files with 67 additions and 28 deletions
  1. 67 28
      src/views/purchaseManage/purchaseManage/handoverSlip/index.vue

+ 67 - 28
src/views/purchaseManage/purchaseManage/handoverSlip/index.vue

@@ -33,7 +33,7 @@
               <el-table-column prop="productCode" label="物品编码" width="140" />
               <el-table-column prop="productName" label="物品名称" min-width="220" />
               <el-table-column prop="productUnit" label="单位" width="100" />
-              <el-table-column prop="productUnit" label="待处理数量" width="120" />
+              <el-table-column prop="expendQuantity" label="待处理数量" width="120" />
               <el-table-column label="转生产数量" width="160">
                 <template #default="{ row, $index }">
                   <div style="width: 100%">
@@ -46,8 +46,8 @@
               <el-table-column label="完工期限" width="160">
                 <template #default="{ row, $index }">
                   <div style="width: 100%">
-                    <el-form-item :prop="'list.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
-                      <el-date-picker v-model="row.quantity" type="date" placeholder="请选择完工期限" value-format="YYYY-MM-DD" />
+                    <el-form-item :prop="'list.' + $index + '.time'" :rules="rules.time" :inline-message="true">
+                      <el-date-picker v-model="row.time" type="date" placeholder="请选择完工期限" value-format="YYYY-MM-DD" :disabled="true" />
                     </el-form-item>
                   </div>
                 </template>
@@ -94,7 +94,7 @@ const config = computed(() => {
     {
       attrs: {
         label: "外销合同编号",
-        prop: "subscribeCode",
+        prop: "contractCode",
       },
     },
     {
@@ -106,13 +106,13 @@ const config = computed(() => {
     {
       attrs: {
         label: "业务员",
-        prop: "subscribeCode",
+        prop: "userName",
       },
     },
     {
       attrs: {
         label: "版本号",
-        prop: "subscribeCode",
+        prop: "contractVersion",
       },
     },
     {
@@ -136,13 +136,13 @@ const config = computed(() => {
     {
       attrs: {
         label: "待处理数量",
-        prop: "count",
+        prop: "expendQuantity",
       },
     },
     {
       attrs: {
         label: "详情",
-        prop: "count",
+        prop: "remark",
       },
     },
     {
@@ -184,7 +184,7 @@ const config = computed(() => {
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
-  proxy.post("/subscribeDetail/page", sourceList.value.pagination).then((message) => {
+  proxy.post("/contractProduct/page", sourceList.value.pagination).then((message) => {
     console.log(message);
     sourceList.value.data = message.rows;
     sourceList.value.pagination.total = message.total;
@@ -225,25 +225,27 @@ const formOption = reactive({
   rules: [],
 });
 const formData = reactive({
-  data: {},
+  data: {
+    list: [],
+  },
 });
 const formConfig = computed(() => {
   return [
-    {
-      label: "基本信息",
-    },
-    {
-      type: "select",
-      prop: "warehouseId",
-      label: "工单类型",
-      data: [],
-    },
-    {
-      type: "input",
-      prop: "remark",
-      label: "备注",
-      itemType: "textarea",
-    },
+    // {
+    //   label: "基本信息",
+    // },
+    // {
+    //   type: "select",
+    //   prop: "warehouseId",
+    //   label: "工单类型",
+    //   data: [],
+    // },
+    // {
+    //   type: "input",
+    //   prop: "remark",
+    //   label: "备注",
+    //   itemType: "textarea",
+    // },
     {
       type: "slot",
       slotName: "details",
@@ -252,15 +254,49 @@ const formConfig = computed(() => {
   ];
 });
 const rules = ref({
-  warehouseId: [{ required: true, message: "请选择仓库", trigger: "change" }],
+  quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
 });
 const transferToProduction = (row) => {
-  console.log(selectData.value, row);
+  if (row && row.id) {
+    formData.data = {
+      list: [
+        {
+          sourceId: "1",
+          source: "1",
+          productId: row.productId,
+          productCode: row.productCode,
+          productName: row.productName,
+          productUnit: row.productUnit,
+          expendQuantity: row.expendQuantity,
+          quantity: undefined,
+        },
+      ],
+    };
+  } else {
+    formData.data = {
+      list: selectData.value.map((item) => {
+        return {
+          sourceId: "1",
+          source: "1",
+          productId: item.productId,
+          productCode: item.productCode,
+          productName: item.productName,
+          productUnit: item.productUnit,
+          expendQuantity: item.expendQuantity,
+          quantity: undefined,
+        };
+      }),
+    };
+  }
+  dialogVisible.value = true;
 };
 const submitForm = () => {
   submit.value.handleSubmit(() => {
+    if (!(formData.data.list && formData.data.list.length > 0)) {
+      return ElMessage('请至少添加一条产品明细')
+    }
     loadingDialog.value = true;
-    proxy.post("/stock/stockTransfer", formData.data).then(
+    proxy.post("/workOrder/addBatch", formData.data.list).then(
       () => {
         ElMessage({
           message: "提交成功",
@@ -285,4 +321,7 @@ const handleDelete = (index) => {
 .tenant {
   margin: 20px;
 }
+::v-deep(.el-input-number .el-input__inner) {
+  text-align: left;
+}
 </style>