xiaodai2022 hace 2 años
padre
commit
af849afa0b
Se han modificado 2 ficheros con 14 adiciones y 0 borrados
  1. 13 0
      src/utils/validate.js
  2. 1 0
      src/views/goodStore/goodsCost/columns.js

+ 13 - 0
src/utils/validate.js

@@ -2,6 +2,8 @@
  * Created by PanJiaChen on 16/11/18.
  */
 
+import { isatty } from "tty";
+
 /** https
  * @param {string} path
  * @returns {Boolean}
@@ -392,3 +394,14 @@ export function accMul(arg1, arg2) {
     Math.pow(10, m)
   );
 }
+
+export function isSpecialSymbol(s) {
+  const pattern = new RegExp(
+    "[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?%+_]"
+  );
+  let specialStr = "";
+  for (let i = 0; i < s.length; i++) {
+    specialStr += s.substr(i, 1).replace(pattern, "");
+  }
+  return s.length > specialStr.length;
+}

+ 1 - 0
src/views/goodStore/goodsCost/columns.js

@@ -299,6 +299,7 @@ const rules = {
       trigger: "blur",
     },
   ],
+  // isSpecialSymbol
   good_remark: [
     {
       required: true,