From 14b15cb429be4c2cf9d7372afcd3bf1e6c53d6af Mon Sep 17 00:00:00 2001
From: lxp <1928192722@qq.com>
Date: 星期一, 12 八月 2024 13:29:41 +0800
Subject: [PATCH] modified: src/components/do/b1-ins-order/fiberoptic-config.vue
---
src/components/do/b1-ins-order/fiberoptic-config.vue | 210 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 209 insertions(+), 1 deletions(-)
diff --git a/src/components/do/b1-ins-order/fiberoptic-config.vue b/src/components/do/b1-ins-order/fiberoptic-config.vue
index a48781c..5aece9d 100644
--- a/src/components/do/b1-ins-order/fiberoptic-config.vue
+++ b/src/components/do/b1-ins-order/fiberoptic-config.vue
@@ -1665,6 +1665,208 @@
// this.$message.success('宸蹭繚瀛�')
// this.$emit('saveFiberopticConfig')
+
+
+ let flag = true
+ let flags = true
+
+ // 鍏夌氦妫�娴嬮」淇℃伅鏍¢獙
+ this.fiberList.forEach(item=>{
+ if(item.productList.length > 0){
+ item.productList.forEach(row=>{
+
+ // 濡傛灉妫�娴嬭姹傚惈鏈夋璐熷彿
+ if(row.tell.indexOf('卤') != -1) {
+ let left = row.tell.substring(0,row.tell.indexOf('卤'))
+ let right = row.tell.substring(row.tell.indexOf('卤')+1)
+ // 濡傛灉鍙互杞寲涓烘暟鍊�
+ if(!isNaN(Number(left)) && !isNaN(Number(right))) {
+ if(row.ask.indexOf('-') != -1) {
+ let left1 = row.ask.substring(0,row.ask.indexOf('-'))
+ let right1 = row.ask.substring(row.ask.indexOf('-')+1)
+ if(Number(left1) != (Number(left) - Number(right)) || Number(right1) != (Number(left) + Number(right))) {
+ // this.$message.error('11111')
+ flag = false
+ }
+ }else {
+ // this.$message.error('2222')
+ flag = false
+ return
+ }
+ }
+ // 濡傛灉瑕佹眰鎻忚堪宸﹁竟涓嶈兘杞寲涓烘暟鍊�
+ else if(isNaN(Number(left)) && !isNaN(Number(right))) {
+ const regex = /[~-]/
+ const match = left.match(regex)
+ // 宸﹁竟鍚湁 - ~ 绗﹀彿
+ if(match) {
+ let newLeft = '';
+ if(left.includes('锛�')) {
+ newLeft = left.replace('锛�','(')
+ }
+ if(left.includes('锛�')) {
+ newLeft = newLeft.replace('锛�',')')
+ }
+ const regexTwo = /\((\d+(\.\d+)?)([~-])(\d+(\.\d+)?)\)/;
+ const matchTwo = newLeft.match(regexTwo);
+ let leftTwo = Number(matchTwo[1]) - Number(right)
+ let rightTwo = Number(matchTwo[4]) + Number(right)
+ if(row.ask.indexOf('-') != -1) {
+ let left1 = row.ask.substring(0,row.ask.indexOf('-'))
+ let right1 = row.ask.substring(row.ask.indexOf('-')+1)
+ if(Number(left1) != leftTwo || Number(right1) != rightTwo) {
+ // this.$message.error('33333')
+ flag = false
+ }
+ }else {
+ // this.$message.error('44444')
+ flag = false
+ return
+ }
+ }
+ }
+ }
+ // 濡傛灉妫�娴嬭姹傚惈鏈夆墹 < 鈮� > 绗﹀彿
+ const regex = /[鈮�<鈮�>]/
+ const match = row.tell.match(regex)
+ if(match) {
+ // 绗﹀彿涓嶄竴鑷�
+ if( row.ask.indexOf(match[0]) != 0) {
+ // this.$message.error('555555')
+ flag = false
+ return
+ }else {
+ // 绗﹀彿涓�鑷�
+ const regex = new RegExp(`${match[0]}(\\d+(\\.\\d+)?)`, 'g')
+ const matchTow = row.tell.match(regex);
+ let right = Number(matchTow[0].split(match[0])[1])
+ let left = row.ask.substring(row.ask.indexOf(match[0])+1)
+ if(Number(left) != Number(right)) {
+ // this.$message.error('666666')
+ flag = false
+ }
+ }
+ }
+ // 濡傛灉瑕佹眰鎻忚堪鍚湁鑼冨洿
+ const regexTwo = /[~-]/
+ const matchTwo = row.tell.match(regexTwo)
+ const matchAsk = row.ask.match(regexTwo)
+ if(matchTwo) {
+ let left = row.tell.substring(0,row.tell.indexOf(matchTwo[0]))
+ let right = row.tell.substring(row.tell.indexOf(matchTwo[0])+1)
+ if(!isNaN(Number(left)) && !isNaN(Number(right))) {
+ let leftAsk = row.ask.substring(0,row.ask.indexOf(matchAsk[0]))
+ let rightAsk = row.ask.substring(row.ask.indexOf(matchAsk[0])+1)
+ if(Number(leftAsk) != Number(left) || Number(rightAsk) != Number(right)) {
+ // this.$message.error('777777')
+ flag = false
+ }
+ }
+ }
+ })
+ }
+ })
+
+ // 鍏夌氦甯︽娴嬮」淇℃伅鏍¢獙
+ this.fibersList.forEach(item=>{
+ if(item.productList.length > 0){
+ item.productList.forEach(row=>{
+
+ // 濡傛灉妫�娴嬭姹傚惈鏈夋璐熷彿
+ if(row.tell.indexOf('卤') != -1) {
+ let left = row.tell.substring(0,row.tell.indexOf('卤'))
+ let right = row.tell.substring(row.tell.indexOf('卤')+1)
+ // 濡傛灉鍙互杞寲涓烘暟鍊�
+ if(!isNaN(Number(left)) && !isNaN(Number(right))) {
+ if(row.ask.indexOf('-') != -1) {
+ let left1 = row.ask.substring(0,row.ask.indexOf('-'))
+ let right1 = row.ask.substring(row.ask.indexOf('-')+1)
+ if(Number(left1) != (Number(left) - Number(right)) || Number(right1) != (Number(left) + Number(right))) {
+ // this.$message.error('11111')
+ flags = false
+ }
+ }else {
+ // this.$message.error('2222')
+ flags = false
+ return
+ }
+ }
+ // 濡傛灉瑕佹眰鎻忚堪宸﹁竟涓嶈兘杞寲涓烘暟鍊�
+ else if(isNaN(Number(left)) && !isNaN(Number(right))) {
+ const regex = /[~-]/
+ const match = left.match(regex)
+ // 宸﹁竟鍚湁 - ~ 绗﹀彿
+ if(match) {
+ let newLeft = '';
+ if(left.includes('锛�')) {
+ newLeft = left.replace('锛�','(')
+ }
+ if(left.includes('锛�')) {
+ newLeft = newLeft.replace('锛�',')')
+ }
+ const regexTwo = /\((\d+(\.\d+)?)([~-])(\d+(\.\d+)?)\)/;
+ const matchTwo = newLeft.match(regexTwo);
+ let leftTwo = Number(matchTwo[1]) - Number(right)
+ let rightTwo = Number(matchTwo[4]) + Number(right)
+ if(row.ask.indexOf('-') != -1) {
+ let left1 = row.ask.substring(0,row.ask.indexOf('-'))
+ let right1 = row.ask.substring(row.ask.indexOf('-')+1)
+ if(Number(left1) != leftTwo || Number(right1) != rightTwo) {
+ // this.$message.error('33333')
+ flags = false
+ }
+ }else {
+ // this.$message.error('44444')
+ flags = false
+ return
+ }
+ }
+ }
+ }
+ // 濡傛灉妫�娴嬭姹傚惈鏈夆墹 < 鈮� > 绗﹀彿
+ const regex = /[鈮�<鈮�>]/
+ const match = row.tell.match(regex)
+ if(match) {
+ // 绗﹀彿涓嶄竴鑷�
+ if( row.ask.indexOf(match[0]) != 0) {
+ // this.$message.error('555555')
+ flags = false
+ return
+ }else {
+ // 绗﹀彿涓�鑷�
+ const regex = new RegExp(`${match[0]}(\\d+(\\.\\d+)?)`, 'g')
+ const matchTow = row.tell.match(regex);
+ let right = Number(matchTow[0].split(match[0])[1])
+ let left = row.ask.substring(row.ask.indexOf(match[0])+1)
+ if(Number(left) != Number(right)) {
+ // this.$message.error('666666')
+ flags = false
+ }
+ }
+ }
+ // 濡傛灉瑕佹眰鎻忚堪鍚湁鑼冨洿
+ const regexTwo = /[~-]/
+ const matchTwo = row.tell.match(regexTwo)
+ const matchAsk = row.ask.match(regexTwo)
+ if(matchTwo) {
+ let left = row.tell.substring(0,row.tell.indexOf(matchTwo[0]))
+ let right = row.tell.substring(row.tell.indexOf(matchTwo[0])+1)
+ if(!isNaN(Number(left)) && !isNaN(Number(right))) {
+ let leftAsk = row.ask.substring(0,row.ask.indexOf(matchAsk[0]))
+ let rightAsk = row.ask.substring(row.ask.indexOf(matchAsk[0])+1)
+ if(Number(leftAsk) != Number(left) || Number(rightAsk) != Number(right)) {
+ // this.$message.error('777777')
+ flags = false
+ }
+ }
+ }
+ })
+ }
+ })
+
+
+
+
if(this.bushing.length === 0){
this.$message.error('缂哄皯濂楃鏃犳硶淇濆瓨')
return
@@ -1686,8 +1888,14 @@
this.sample.forEach(a=>{
a.bushing = this.bushing
})
- this.$message.success('宸蹭繚瀛�')
+ if(flag && flags) {
+ this.$message.success('宸蹭繚瀛�')
this.$emit('saveFiberopticConfig')
+ }else if(!flag) {
+ this.$message.error('鍏夌氦淇濆瓨鐨勬娴嬮」涓惈鏈変笉绗﹀悎瑕佹眰鐨勬暟鎹�')
+ }else if(!flags) {
+ this.$message.error('鍏夌氦甯︿繚瀛樼殑妫�娴嬮」涓惈鏈変笉绗﹀悎瑕佹眰鐨勬暟鎹�')
+ }
},
beforeClose(done){
if (this.bsm1) {
--
Gitblit v1.9.3