Browse Source

change: PO创建模块. 更换商品/供应商模糊搜索接口. 样式调整.

peter 1 year ago
parent
commit
3a0f0840b4
1 changed files with 100 additions and 111 deletions
  1. 100 111
      src/pages/purchase-order/edit.vue

+ 100 - 111
src/pages/purchase-order/edit.vue

@@ -161,7 +161,9 @@
                     clearable
                   ></el-select-v2>
                 </el-form-item>
-                <div class="">{{ computedVendor.PDF_display }}</div>
+                <div style="white-space: pre-wrap">
+                  {{ computedVendor.PDF_display }}
+                </div>
               </div>
               <div class="form-area-right">
                 <el-form-item label="采购订单 #:">
@@ -540,87 +542,87 @@
               </tr>
             </table>
           </div>
-          <div class="form-area">
-            <table
-              border="0"
-              cellspacing="0"
-            >
-              <tr>
-                <td class="column-vendor">供应商(乙方) :</td>
-                <td class="column-form-label">采购订单 #:</td>
-                <td class="column-form-value">
+          <div class="form-area flex start">
+            <div class="flex-auto">
+              <div>供应商(乙方) :</div>
+              <div
+                v-if="computedVendor.Primary_Contact_name"
+                class="column-vendor"
+              >
+                {{ computedVendor.Primary_Contact_name }}
+              </div>
+
+              <div class="column-vendor">
+                {{ computedVendor.label }}
+              </div>
+              <div class="column-vendor">
+                {{ computedVendor.PDF_display }}
+              </div>
+            </div>
+            <div class="flex-auto">
+              <div class="flex">
+                <div class="column-form-label">采购订单 #:</div>
+                <div class="column-form-value">
                   {{ longPONumber || '' }}
-                </td>
-              </tr>
-              <tr>
-                <td class="column-vendor">
-                  {{ computedVendor.Primary_Contact_name }}
-                </td>
-                <td class="column-form-label">订单号 # :</td>
-                <td class="column-form-value">
+                </div>
+              </div>
+              <div class="flex">
+                <div class="column-form-label">订单号 # :</div>
+                <div class="column-form-value">
                   {{ form.saleOrderId }}
-                </td>
-              </tr>
-              <tr>
-                <td class="column-vendor">
-                  {{ computedVendor.label }}
-                </td>
-                <td class="column-form-label">日期 :</td>
-                <td class="column-form-value">
+                </div>
+              </div>
+              <div class="flex">
+                <div class="column-form-label">日期 :</div>
+                <div class="column-form-value">
                   {{ form.PO_Date }}
-                </td>
-              </tr>
-              <tr>
-                <td
-                  class="column-vendor"
-                  rowspan="7"
-                >
-                  {{ computedVendor.PDF_display }}
-                </td>
-                <td class="column-form-label">付款方式 :</td>
-                <td class="column-form-value">
+                </div>
+              </div>
+              <div class="flex">
+                <div class="column-form-label">付款方式 :</div>
+                <div class="column-form-value">
                   {{
                     form.Payment_Terms !== '-None-' ? form.Payment_Terms : ''
                   }}
-                </td>
-              </tr>
-              <tr>
-                <td class="column-form-label">参考 :</td>
-                <td class="column-form-value">
+                </div>
+              </div>
+              <div class="flex start">
+                <div class="column-form-label">参考 :</div>
+                <div class="column-form-value">
                   {{ form.Title }}
-                </td>
-              </tr>
+                </div>
+              </div>
 
               <template
                 v-if="typeof computedCompany.taxReimbursement === 'undefined'"
               >
-                <tr>
-                  <td class="column-form-label">收货详情 :</td>
-                  <td class="column-form-value">
+                <div class="flex start">
+                  <div class="column-form-label">收货详情 :</div>
+                  <div class="column-form-value">
                     {{ form.field9 }}
-                  </td>
-                </tr>
-                <tr>
-                  <td class="column-form-label">收件人 :</td>
-                  <td class="column-form-value">
+                  </div>
+                </div>
+                <div class="flex">
+                  <div class="column-form-label">收件人 :</div>
+                  <div class="column-form-value">
                     {{ form.field7 }}
-                  </td>
-                </tr>
-                <tr>
-                  <td class="column-form-label">联系电话 :</td>
-                  <td class="column-form-value">
+                  </div>
+                </div>
+                <div class="flex">
+                  <div class="column-form-label">联系电话 :</div>
+                  <div class="column-form-value">
                     {{ form.field8 }}
-                  </td>
-                </tr>
+                  </div>
+                </div>
               </template>
 
-              <tr>
-                <td class="column-form-label">工厂交货日期 :</td>
-                <td class="column-form-value">
+              <div class="flex">
+                <div class="column-form-label">工厂交货日期 :</div>
+                <div class="column-form-value">
                   {{ form.field6 }}
-                </td>
-              </tr>
-            </table>
+                </div>
+              </div>
+            </div>
           </div>
           <div class="product-table-separator"></div>
           <div class="product-table">
@@ -768,7 +770,7 @@
           class="preview-area2"
         >
           <div class="supplier-name">
-            {{ computedVendor.Suppliers_Name }}
+            {{ computedVendor.Suppliers_Name || computedVendor.Vendor_Name }}
           </div>
           <div class="billing-addr">
             {{ computedVendor.Billing_Address || '' }}
@@ -1222,7 +1224,7 @@ const sendPDF = function (file: string, filename = `attachment_file`) {
     id: POID.value,
     file: new File([result], `${filename}.${extName}`, { type: mimeType }),
   }
-  console.log(data)
+
   return new Promise((resolve, reject) => {
     axios
       .post('/api/Purchase_orders/uploadAttachmentFile', data, {
@@ -1581,11 +1583,14 @@ const getProductList = utils.debounce(
   (keyword: string, target: IProductItem) => {
     productLoading.value = true
     const data = {
-      keyword: keyword.trim(),
+      value: keyword.trim(),
+      name: 'Products',
+      api_name: 'Product_name',
+      contains: 'contains',
+      page: 1,
       limit: 200,
     }
-    axios
-      .post('/api/common/getProductsLists', data)
+    getSearchData(data)
       .then((response) => {
         if (response.data.code !== 1) return
         const res = response.data.result
@@ -1593,7 +1598,7 @@ const getProductList = utils.debounce(
           return {
             ...item,
             label: item.Product_Name,
-            value: item.products_id,
+            value: item.products_id || item.id,
           }
         })
       })
@@ -1621,39 +1626,27 @@ const computedVendor = computed(() => {
 const vendorLoading = ref(false)
 const getSupplierLists = utils.debounce(function (string: string) {
   const data = {
-    keyword: string.trim(),
+    value: string.trim(),
+    name: 'Vendors',
+    api_name: 'Vendor_name',
+    contains: 'contains',
+    page: 1,
     limit: 200,
   }
   vendorLoading.value = true
-  axios
-    .post('/api/common/getSupplierLists', data)
+  getSearchData(data)
     .then((response) => {
       if (response.data.code !== 1) return
       const res = response.data.result
       vendorList.value = res.data.map((i: any) => {
         return {
-          label: i.Suppliers_Name,
-          value: i.supplier_id,
+          ...i,
+          label: i.Suppliers_Name || i.Vendor_Name,
+          value: i.supplier_id || i.id,
           Primary_Contact_name: i.Primary_Contact_name || '',
           PDF_display: i.PDF_display || '',
         }
       })
-
-      if (import.meta.env.MODE !== 'production') {
-        vendorList.value.unshift({
-          Primary_Contact_name: '彭攀巅',
-          PDF_display: '深圳市\n广东\nCN\n支付宝\nPay@keansilicone.com\n彭攀巅',
-          label: '测试供应商1',
-          value: '5757019000000428185',
-          Suppliers_Name: '测试供应商1',
-          Email: '2850335131@qq.com',
-          Phone: '135 3069 5330',
-          Payment_Terms: 'Prepaid',
-          Bank_Branch_Name: '支付宝',
-          Bank_Account: 'Pay@keansilicone.com',
-          Swift_Code_IBAN: '',
-        })
-      }
     })
     .finally(() => {
       vendorLoading.value = false
@@ -1661,6 +1654,12 @@ const getSupplierLists = utils.debounce(function (string: string) {
 }, 1000)
 getSupplierLists('')
 
+const getSearchData = async function (p: any) {
+  return await axios.post('/api/common/getPublicLists', p).then((response) => {
+    return response
+  })
+}
+
 const getPath = function (path: string) {
   return new URL(path, import.meta.url).href
 }
@@ -1870,16 +1869,7 @@ axios
         (item: any) => !productBlackList.includes(item.product.id),
       )
     }
-    console.log(temp)
-
-    if (import.meta.env.MODE !== 'production' && temp.length < 1) {
-      temp.unshift({
-        product_id: '5757019000000523001',
-        product_name: 'peter607',
-        quantity: 3,
-        rate: 2,
-      })
-    }
+
     if (!temp.length) return
     form.value.productList = []
     temp.forEach((item: any) => {
@@ -1895,7 +1885,6 @@ axios
           Product_Code: item.product.Product_Code,
           id: item.product.id,
           name: item.product.name,
-          // label: `(${item.product_Product_Code})${item.product_name}`,
           label: item.product.name,
           value: item.product.id,
           desc: item.product_description || '',
@@ -2173,21 +2162,21 @@ axios
     line-height: 14pt;
     $formAreaFontSize: 10pt;
     white-space: pre-wrap;
-    td {
-      font-size: $formAreaFontSize;
-      padding-bottom: 8pt;
+    font-size: $formAreaFontSize;
+    & > .flex-auto {
+      width: 50%;
+      & > div {
+        padding-bottom: 8pt;
+      }
     }
     .column-vendor {
-      width: 50%;
       vertical-align: top;
     }
     .column-form-label {
-      vertical-align: top;
-      width: 20%;
+      width: 40%;
     }
     .column-form-value {
-      vertical-align: top;
-      width: 30%;
+      width: 60%;
     }
   }
   .product-table-separator {