From 9b094a282f0911817eea227e25d172598f431ee1 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期三, 22 十一月 2023 10:41:49 +0800
Subject: [PATCH] Merge branch 'master' of http://114.132.189.42:9002/r/mes-ocea-before
---
src/views/quality/teststandard/standard-form.vue | 315 ++++++++++++++++++++++++++--------------------------
1 files changed, 158 insertions(+), 157 deletions(-)
diff --git a/src/views/quality/teststandard/standard-form.vue b/src/views/quality/teststandard/standard-form.vue
index 4abc0be..f6875e5 100644
--- a/src/views/quality/teststandard/standard-form.vue
+++ b/src/views/quality/teststandard/standard-form.vue
@@ -197,11 +197,11 @@
if (this.dataForm.id) {
getTestStandard(this.dataForm.id).then((response) => {
this.dataForm = response.data.data
- this.$refs.templateJudgmentCondition.setVal(
- this.dataForm.judgeFormula == null
- ? ''
- : this.dataForm.judgeFormula
- )
+ // this.$refs.templateJudgmentCondition.setVal(
+ // this.dataForm.judgeFormula == null
+ // ? ''
+ // : this.dataForm.judgeFormula
+ // )
})
this.params = []
getTestStandardParams(
@@ -237,162 +237,163 @@
// 琛ㄥ崟鎻愪氦
dataFormSubmit() {
this.isSubmit = true
- // 鏍¢獙鍒ゅ畾鍏紡
- let judgeFormula = this.$refs.templateJudgmentCondition.getVal()
- // 鏇挎崲鍏紡涓殑pi甯搁噺涓�3.14
- if (judgeFormula.length > 0) {
- const piExistIndex = judgeFormula.indexOf('pi')
- if (piExistIndex >= 0) {
- judgeFormula = judgeFormula.replace(/pi/g, '3.14')
- }
- }
- // 鏇挎崲鍏紡涓殑passAll()鍑芥暟涓簍rue
- if (judgeFormula.length > 0) {
- const piExistIndex = judgeFormula.indexOf('passAll()')
- if (piExistIndex >= 0) {
- judgeFormula = judgeFormula.replace(/passAll[(][)]/g, 'true')
- }
- }
- // 鍏堝垽瀹氬叕寮忎腑鍑芥暟鏍煎紡鏄惁姝g‘锛屽啀鐢ㄩ粯璁ゅ�艰绠楀嚭鍑芥暟鍊硷紝鏇挎崲杩涘叕寮忥紝鏈�鍚庡皢鍏紡涓墿浣欑殑鍙傛暟杩涜榛樿鍊兼浛鎹紝鍒╃敤js eval鍑芥暟杩涜鍏紡鏍¢獙
- let flag = true
- let funcEl
- for (let j = 0; j < this.funcs.length; j++) {
- funcEl = this.funcs[j]
- // 璁$畻鍑芥暟鍏抽敭鍦ㄥ叕寮忎腑鍑虹幇鐨勬鏁�
- const num = this.getNumCharInStr(judgeFormula, funcEl.name, 0)
- // for寰幆娆℃暟鏍¢獙鏇挎崲
- for (let k = 0; k < num; k++) {
- const existIndex = judgeFormula.indexOf(funcEl.name)
- if (existIndex >= 0) {
- // 鍑芥暟鍏抽敭瀛楀湪鍏紡涓瓨鍦�
- const prefixStr = judgeFormula.substring(0, existIndex)
- const startToEndStr = judgeFormula.substring(
- existIndex + funcEl.name.length
- )
- if (startToEndStr.length > 0) {
- const paramStartIndex = startToEndStr.indexOf('(')
- const paramEndIndex = startToEndStr.indexOf(')')
- if (paramStartIndex === 0 && paramEndIndex > 0) {
- const suffixStr = startToEndStr.substring(paramEndIndex + 1)
- const paramStr = startToEndStr.substring(
- paramStartIndex + 1,
- paramEndIndex
- )
- if (paramStr.trim() !== '') {
- const paramArr = paramStr.split(',')
- if (paramArr.length > 0) {
- if (
- (funcEl.singleParam && paramArr.length === 1) ||
- !funcEl.singleParam
- ) {
- let paramFlag = true
- for (let i = 0; i < paramArr.length; i++) {
- const param = this.params.find(
- (item) =>
- paramArr[i].trim() === 'V[' + item.code + ']'
- )
- if (param !== undefined) {
- } else {
- flag = false
- paramFlag = false
- this.$message.error('鍑芥暟鍙傛暟涓嶅瓨鍦�')
- }
- }
- if (paramFlag) {
- if (funcEl.returnType === 'number') {
- judgeFormula = prefixStr + '1' + suffixStr
- } else {
- judgeFormula = prefixStr + 'true' + suffixStr
- }
- } else {
- break
- }
- } else {
- flag = false
- this.$message.error('鍑芥暟鍙傛暟涓暟涓嶆纭�')
- break
- }
- } else {
- break
- }
- } else {
- flag = false
- this.$message.error('鍑芥暟蹇呴』瑕佹湁鍙傛暟')
- break
- }
- } else {
- flag = false
- this.$message.error(
- '鍑芥暟闇�鍖呭惈宸﹀彸灏忔嫭鍙凤紝涓斿乏渚у皬鎷彿闇�绱ч偦鍑芥暟'
- )
- break
- }
- } else {
- flag = false
- this.$message.error('鍑芥暟闇�鍖呭惈宸﹀彸灏忔嫭鍙�')
- break
- }
- }
- }
- }
- if (flag) {
- // 灏嗗叕寮忎腑鍓╀綑鐨勫弬鏁拌繘琛岄粯璁ゅ�兼浛鎹�
- let param
- for (let x = 0; x < this.params.length; x++) {
- param = this.params[x]
- // 璁$畻鍙傛暟鍦ㄥ叕寮忎腑鍑虹幇鐨勬鏁�
- const num = this.getNumCharInStr(
- judgeFormula,
- 'V[' + param.code + ']',
- 0
- )
- // for寰幆娆℃暟鏍¢獙鏇挎崲
- for (let y = 0; y < num; y++) {
- const existIndex = judgeFormula.indexOf('V[' + param.code + ']')
- if (existIndex >= 0) {
- const prefixStr = judgeFormula.substring(0, existIndex)
- const suffixStr = judgeFormula.substring(
- existIndex + ('V[' + param.code + ']').length
- )
- judgeFormula = prefixStr + this.getRandom() + suffixStr
- }
- }
- }
- try {
- eval(judgeFormula)
- } catch (exception) {
- flag = false
- }
- if (flag) {
- this.dataForm.judgeFormula = this.$refs.templateJudgmentCondition.getVal()
- this.$refs.dataForm.validate((valid) => {
- if (valid) {
- if (this.dataForm.id) {
- putTestStandard(this.dataForm).then((data) => {
- this.$message.success('淇敼鎴愬姛')
- this.visible = false
- this.isSubmit = false
- this.$emit('refreshDataList')
- })
- } else {
- addTestStandard(this.dataForm).then((data) => {
- this.$message.success('娣诲姞鎴愬姛')
- this.visible = false
- this.isSubmit = false
- this.$emit('refreshDataList')
- })
- }
- } else {
+ this.$refs.dataForm.validate((valid) => {
+ if (valid) {
+ if (this.dataForm.id) {
+ putTestStandard(this.dataForm).then((data) => {
+ this.$message.success('淇敼鎴愬姛')
+ this.visible = false
this.isSubmit = false
- }
- })
+ this.$emit('refreshDataList')
+ })
+ } else {
+ addTestStandard(this.dataForm).then((data) => {
+ this.$message.success('娣诲姞鎴愬姛')
+ this.visible = false
+ this.isSubmit = false
+ this.$emit('refreshDataList')
+ })
+ }
} else {
this.isSubmit = false
- this.$message.error('鍏紡鏍煎紡閿欒锛岃浠旂粏妫�鏌�')
}
- } else {
- this.isSubmit = false
- }
+ })
+ // 鏍¢獙鍒ゅ畾鍏紡
+ // let judgeFormula = this.$refs.templateJudgmentCondition.getVal()
+ // // 鏇挎崲鍏紡涓殑pi甯搁噺涓�3.14
+ // if (judgeFormula.length > 0) {
+ // const piExistIndex = judgeFormula.indexOf('pi')
+ // if (piExistIndex >= 0) {
+ // judgeFormula = judgeFormula.replace(/pi/g, '3.14')
+ // }
+ // }
+ // // 鏇挎崲鍏紡涓殑passAll()鍑芥暟涓簍rue
+ // if (judgeFormula.length > 0) {
+ // const piExistIndex = judgeFormula.indexOf('passAll()')
+ // if (piExistIndex >= 0) {
+ // judgeFormula = judgeFormula.replace(/passAll[(][)]/g, 'true')
+ // }
+ // }
+ // // 鍏堝垽瀹氬叕寮忎腑鍑芥暟鏍煎紡鏄惁姝g‘锛屽啀鐢ㄩ粯璁ゅ�艰绠楀嚭鍑芥暟鍊硷紝鏇挎崲杩涘叕寮忥紝鏈�鍚庡皢鍏紡涓墿浣欑殑鍙傛暟杩涜榛樿鍊兼浛鎹紝鍒╃敤js eval鍑芥暟杩涜鍏紡鏍¢獙
+ // let flag = true
+ // let funcEl
+ // for (let j = 0; j < this.funcs.length; j++) {
+ // funcEl = this.funcs[j]
+ // // 璁$畻鍑芥暟鍏抽敭鍦ㄥ叕寮忎腑鍑虹幇鐨勬鏁�
+ // const num = this.getNumCharInStr(judgeFormula, funcEl.name, 0)
+ // // for寰幆娆℃暟鏍¢獙鏇挎崲
+ // for (let k = 0; k < num; k++) {
+ // const existIndex = judgeFormula.indexOf(funcEl.name)
+ // if (existIndex >= 0) {
+ // // 鍑芥暟鍏抽敭瀛楀湪鍏紡涓瓨鍦�
+ // const prefixStr = judgeFormula.substring(0, existIndex)
+ // const startToEndStr = judgeFormula.substring(
+ // existIndex + funcEl.name.length
+ // )
+ // if (startToEndStr.length > 0) {
+ // const paramStartIndex = startToEndStr.indexOf('(')
+ // const paramEndIndex = startToEndStr.indexOf(')')
+ // if (paramStartIndex === 0 && paramEndIndex > 0) {
+ // const suffixStr = startToEndStr.substring(paramEndIndex + 1)
+ // const paramStr = startToEndStr.substring(
+ // paramStartIndex + 1,
+ // paramEndIndex
+ // )
+ // if (paramStr.trim() !== '') {
+ // const paramArr = paramStr.split(',')
+ // if (paramArr.length > 0) {
+ // if (
+ // (funcEl.singleParam && paramArr.length === 1) ||
+ // !funcEl.singleParam
+ // ) {
+ // let paramFlag = true
+ // for (let i = 0; i < paramArr.length; i++) {
+ // const param = this.params.find(
+ // (item) =>
+ // paramArr[i].trim() === 'V[' + item.code + ']'
+ // )
+ // if (param !== undefined) {
+ // } else {
+ // flag = false
+ // paramFlag = false
+ // this.$message.error('鍑芥暟鍙傛暟涓嶅瓨鍦�')
+ // }
+ // }
+ // if (paramFlag) {
+ // if (funcEl.returnType === 'number') {
+ // judgeFormula = prefixStr + '1' + suffixStr
+ // } else {
+ // judgeFormula = prefixStr + 'true' + suffixStr
+ // }
+ // } else {
+ // break
+ // }
+ // } else {
+ // flag = false
+ // this.$message.error('鍑芥暟鍙傛暟涓暟涓嶆纭�')
+ // break
+ // }
+ // } else {
+ // break
+ // }
+ // } else {
+ // flag = false
+ // this.$message.error('鍑芥暟蹇呴』瑕佹湁鍙傛暟')
+ // break
+ // }
+ // } else {
+ // flag = false
+ // this.$message.error(
+ // '鍑芥暟闇�鍖呭惈宸﹀彸灏忔嫭鍙凤紝涓斿乏渚у皬鎷彿闇�绱ч偦鍑芥暟'
+ // )
+ // break
+ // }
+ // } else {
+ // flag = false
+ // this.$message.error('鍑芥暟闇�鍖呭惈宸﹀彸灏忔嫭鍙�')
+ // break
+ // }
+ // }
+ // }
+ // }
+ // if (flag) {
+ // // 灏嗗叕寮忎腑鍓╀綑鐨勫弬鏁拌繘琛岄粯璁ゅ�兼浛鎹�
+ // let param
+ // for (let x = 0; x < this.params.length; x++) {
+ // param = this.params[x]
+ // // 璁$畻鍙傛暟鍦ㄥ叕寮忎腑鍑虹幇鐨勬鏁�
+ // const num = this.getNumCharInStr(
+ // judgeFormula,
+ // 'V[' + param.code + ']',
+ // 0
+ // )
+ // // for寰幆娆℃暟鏍¢獙鏇挎崲
+ // for (let y = 0; y < num; y++) {
+ // const existIndex = judgeFormula.indexOf('V[' + param.code + ']')
+ // if (existIndex >= 0) {
+ // const prefixStr = judgeFormula.substring(0, existIndex)
+ // const suffixStr = judgeFormula.substring(
+ // existIndex + ('V[' + param.code + ']').length
+ // )
+ // judgeFormula = prefixStr + this.getRandom() + suffixStr
+ // }
+ // }
+ // }
+ // try {
+ // eval(judgeFormula)
+ // } catch (exception) {
+ // flag = false
+ // }
+ // if (flag) {
+ // this.dataForm.judgeFormula = this.$refs.templateJudgmentCondition.getVal()
+
+ // } else {
+ // this.isSubmit = false
+ // this.$message.error('鍏紡鏍煎紡閿欒锛岃浠旂粏妫�鏌�')
+ // }
+ // } else {
+ // this.isSubmit = false
+ // }
},
openOperationDialog() {
this.showOperate = true
--
Gitblit v1.9.3