From bc16d211c5a2b31f0e3127a102748806151eaecb Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 14 十二月 2023 16:23:19 +0800
Subject: [PATCH] 	modified:   src/const/crud/customerOrder/customerOrderForm.js 	modified:   src/views/plan/operationtask/operationtask-form.vue 	modified:   src/views/product/workbench/operation-task-pane.vue 	modified:   src/views/product/workbench/taskinfo-pane.vue 	modified:   src/views/product/workbench/workReportCard.vue 	modified:   src/views/quality/finishedProductInspection/finishedProduct-form.vue 	modified:   src/views/quality/newReport/ReportForm.vue 	modified:   src/views/quality/processInspect/processInspect-form.vue 	modified:   src/views/quality/rawMaterial/rawMaterial-form.vue 	modified:   src/views/quality/teststandard/standard-form.vue 	modified:   src/views/technology/completeproductstructure/completeproductstructure-form.vue 	modified:   src/views/technology/document/document-form.vue 	modified:   src/views/technology/operation/operation-form.vue 	modified:   src/views/technology/routing/routing-form.vue 	modified:   src/views/warehouse/changestock/index.vue

---
 src/views/quality/teststandard/standard-form.vue |  342 ++++++++++++++++++++++++++++++--------------------------
 1 files changed, 183 insertions(+), 159 deletions(-)

diff --git a/src/views/quality/teststandard/standard-form.vue b/src/views/quality/teststandard/standard-form.vue
index ceca1ce..4cc5f4c 100644
--- a/src/views/quality/teststandard/standard-form.vue
+++ b/src/views/quality/teststandard/standard-form.vue
@@ -44,7 +44,7 @@
       <el-form-item label="澶囨敞" prop="remark">
         <el-input v-model="dataForm.remark" placeholder=""></el-input>
       </el-form-item>
-      <el-form-item label="鍑芥暟">
+      <!-- <el-form-item label="鍑芥暟">
         <div style="display:flex;">
           <div
             v-for="(item, i) in funcs"
@@ -89,7 +89,7 @@
         <div style="color:red;">
           鐐瑰嚮杈撳叆妗嗗悗锛岄紶鏍囧彸閿彲閫夋嫨鍙傛暟椤�
         </div>
-      </el-form-item>
+      </el-form-item> -->
     </el-form>
     <span slot="footer" class="dialog-footer">
       <el-button @click="visible = false">鍙栨秷</el-button>
@@ -155,6 +155,23 @@
     ZttMonacoEditor,
     operationDialog
   },
+  watch:{
+    visible(newVal){
+      if(!newVal){
+        this.dataForm = {
+          id: 0,
+          standardName: '',
+          standardNo: '',
+          remark: '',
+          judgeFormula: '',
+          inspectionType: null,
+          operationId: null,
+          operationNo: null,
+          operationName: null,
+        }
+      }
+    }
+  },
   created() {
     this.funcs = funcForStandard()
     this.constants = constantForStandard()
@@ -197,11 +214,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 +254,169 @@
     // 琛ㄥ崟鎻愪氦
     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')
+            }).catch(error=>{
+              console.error(error);
+              this.isSubmit = false
+            })
+          } else {
+            addTestStandard(this.dataForm).then((data) => {
+              this.$message.success('娣诲姞鎴愬姛')
+              this.visible = false
+              this.isSubmit = false
+              this.$emit('refreshDataList')
+            }).catch(error=>{
+              console.error(error);
+              this.isSubmit = false
+            })
+          }
         } 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