瀏覽代碼

完善校验

fenghy 3 年之前
父節點
當前提交
db44f12db4

+ 4 - 3
src/util/validate.js

@@ -201,9 +201,10 @@ export function isvalidatemobile(phone) {
  * 判断姓名是否正确
  */
 export function validatename(name) {
-    var regName = /^[\u4e00-\u9fa5]{2,4}$/;
-    if (!regName.test(name)) return false;
-    return true;
+    var regName = /^[\u4e00-\u9fa5]{2,10}$/;
+    console.log(!regName.test(name))
+    if (!regName.test(name)) return true;
+    return false;
 }
 /**
  * 判断是否为整数

+ 8 - 2
src/views/exportTrade/customerInquiry/config/customerContact.json

@@ -17,7 +17,7 @@
     },
     {
       "label": "产品编号",
-      "prop": "itemId",
+      "prop": "code",
       "index": 2,
       "minWidth": 80,
       "overHidden":true
@@ -35,7 +35,13 @@
       "index": 4,
       "minWidth": 80,
       "overHidden":true,
-      "cell": true
+      "cell": true,
+      "type": "select",
+      "dicUrl": "/api/blade-system/dict-biz/dictionary?code=product_properties",
+      "props": {
+        "label": "dictValue",
+        "value": "dictKey"
+      }
     },
     {
       "label": "产品照片",

+ 15 - 15
src/views/exportTrade/customerInquiry/config/mainList.json

@@ -16,15 +16,15 @@
       "index": 1,
       "minWidth": 60,
       "overHidden": true
-    },
-    {
-      "label": "订单状态",
-      "prop": "status",
+    }, {
+      "label": "客户名称",
+      "prop": "corpId",
       "search": true,
       "index": 2,
       "minWidth": 80,
       "overHidden": true
-    }, {
+    },
+    {
       "label": "发票号(PI)",
       "prop": "proformInvoice",
       "search": true,
@@ -32,12 +32,18 @@
       "minWidth": 80,
       "overHidden": true
     }, {
-      "label": "客户名称",
-      "prop": "corpId",
+      "label": "订单状态",
+      "prop": "orderStatus",
       "search": true,
       "index": 4,
       "minWidth": 80,
-      "overHidden": true
+      "overHidden": true,
+      "type": "select",
+      "dicUrl": "/api/blade-system/dict-biz/dictionary?code=order_status",
+      "props": {
+        "label": "dictValue",
+        "value": "dictValue"
+      }
     }, {
       "label": "联系人",
       "prop": "corpAttn",
@@ -106,13 +112,7 @@
       "prop": "paymentType",
       "index": 14,
       "minWidth": 80,
-      "overHidden": true,
-      "type": "select",
-      "dicUrl": "/api/blade-system/dict/dictionary?code=payment_term",
-      "props": {
-        "label": "dictValue",
-        "value": "dictKey"
-      }
+      "overHidden": true
     }, {
       "label": "币别",
       "prop": "currency",

+ 55 - 13
src/views/exportTrade/customerInquiry/detailsPage.vue

@@ -24,7 +24,17 @@
       <basic-container style="margin-bottom: 10px">
         <avue-form ref="form" v-model="form" :option="option">
           <template slot="corpId">
-            <select-component v-model="form.corpId" :configuration="configuration"></select-component>
+            <select-component
+              v-model="form.corpId"
+              :configuration="configuration"
+            ></select-component>
+          </template>
+          <template slot="exchangeRate">
+            <el-input
+              size="mini"
+              v-model="form.exchangeRate"
+              oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d{1,2}).*$/, "$1.$2")'
+            />
           </template>
         </avue-form>
       </basic-container>
@@ -49,7 +59,7 @@
               icon="el-icon-printer"
               size="small"
               @click.stop="openReport()"
-              >打 印</el-button
+              >报 表</el-button
             >
           </template>
           <template slot="menu" slot-scope="{ row, label, dic, $index }">
@@ -135,9 +145,30 @@ import {
 } from "@/api/basicData/customerInquiry";
 import { orderStates } from "@/enums/order-stauts";
 import reportDialog from "@/components/report-dialog/main";
+import { isvalidatemobile, validatename } from "@/util/validate";
 export default {
   name: "detailsPageEdit",
   data() {
+    const validatePhone = (rule, value, callback) => {
+      if (value != "") {
+        if (isvalidatemobile(value)[0]) {
+          this.$message.error("手机号码格式不正确");
+          callback(new Error(isvalidatemobile(value)[1]));
+        } else {
+          callback();
+        }
+      }
+    };
+    const validateName = (rule, value, callback) => {
+      if (value != "") {
+        if (validatename(value)) {
+          this.$message.error("联系人格式不正确");
+          callback(new Error(validatename(value)));
+        } else {
+          callback();
+        }
+      }
+    };
     return {
       configuration: {
         multipleChoices: false,
@@ -162,14 +193,14 @@ export default {
           },
           {
             label: "订单状态",
-            prop: "status",
+            prop: "orderStatus",
             span: 8,
             type: "select",
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=order_status",
             props: {
-              label: "name",
-              value: "code"
-            },
-            dicData: orderStates
+              label: "dictValue",
+              value: "dictValue"
+            }
           },
           {
             label: "发票号(PI)",
@@ -186,17 +217,20 @@ export default {
                 trigger: "blur"
               }
             ],
-            span: 8
+            span: 8,
+            slot: true
           },
           {
             label: "联系人",
             prop: "corpAttn",
-            span: 8
+            span: 8,
+            rules: [{ validator: validateName, trigger: "blur" }]
           },
           {
             label: "电话",
             prop: "corpTel",
-            span: 8
+            span: 8,
+            rules: [{ validator: validatePhone, trigger: "blur" }]
           },
           {
             label: "起运港",
@@ -286,12 +320,19 @@ export default {
           {
             label: "币别",
             prop: "currency",
-            span: 8
+            span: 8,
+            type: "select",
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=currency",
+            props: {
+              label: "dictValue",
+              value: "dictValue"
+            }
           },
           {
             label: "汇率",
             prop: "exchangeRate",
-            span: 8
+            span: 8,
+            slot: true
           },
           {
             label: "信用证编号",
@@ -398,7 +439,7 @@ export default {
     },
     selectionChange(list) {
       list.map(e => {
-        e.itemId = e.code;
+        e.itemId = e.id;
         e.priceCategory = e.goodsTypeName;
         e.itemUrl = e.url;
         e.itemProp = null;
@@ -448,6 +489,7 @@ export default {
       detail(id).then(res => {
         this.form = res.data.data;
         this.data = res.data.data.orderItemsList;
+        this.configuration.dicData = this.form.corpName;
       });
     },
     //修改提交触发

+ 22 - 11
src/views/exportTrade/customerInquiry/index.vue

@@ -22,6 +22,15 @@
           >新 建</el-button
         >
       </template>
+      <template slot="corpIdSearch">
+        <select-component
+          v-model="search.corpId"
+          :configuration="configuration"
+        ></select-component>
+      </template>
+      <template slot-scope="scope" slot="corpId">
+        {{ scope.row.corpsName }}
+      </template>
       <template slot-scope="scope" slot="menu">
         <el-button
           type="text"
@@ -52,12 +61,19 @@
 <script>
 import option from "./config/mainList.json";
 import { getList, remove } from "@/api/basicData/customerInquiry";
-import { orderStateFormat} from "@/enums/order-stauts";
+import { orderStateFormat } from "@/enums/order-stauts";
 
 export default {
   name: "customerInformation",
   data() {
     return {
+      configuration: {
+        multipleChoices: false,
+        multiple: false,
+        collapseTags: false,
+        placeholder: "请点击右边按钮选择",
+        dicData: []
+      },
       search: {},
       option: option,
       parentId: 0,
@@ -69,15 +85,6 @@ export default {
       }
     };
   },
-  mounted() {
-    this.option.column.map(e => {
-      if (e.prop == "status") {
-        e.formatter = function(row) {
-          return orderStateFormat(row.status);
-        };
-      }
-    });
-  },
   methods: {
     //删除列表后面的删除按钮触发触发(row, index, done)
     rowDel(row, index, done) {
@@ -152,4 +159,8 @@ export default {
 };
 </script>
 
-<style scoped></style>
+<style scoped>
+::v-deep .select-component {
+  display: flex;
+}
+</style>