From 226afbfb5ce732b0cd8317db57c645aca8b8d8e2 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期四, 25 四月 2024 16:16:04 +0800
Subject: [PATCH] 要求值加上文字提示

---
 src/views/technology/document/teststandard.vue |  131 ++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 122 insertions(+), 9 deletions(-)

diff --git a/src/views/technology/document/teststandard.vue b/src/views/technology/document/teststandard.vue
index 4607896..61b085a 100644
--- a/src/views/technology/document/teststandard.vue
+++ b/src/views/technology/document/teststandard.vue
@@ -6,6 +6,7 @@
           :table="table"
           @handleSelectionChange="handleSelectionChange"
           @currentChange="handleCurrentChange"
+          @shoudonggouxuan="handleCurrentChange"
           :uploadInfo="uploadInfo"
           :prelang="prelang"
           :options="options"
@@ -18,14 +19,30 @@
         </ttable>
       </el-col>
       <el-col :span="12" style="padding-left: 10px">
+        <div style="float: right;margin-bottom: 8px;" v-if="editable && currentRow&&currentRow.id">
+        <el-button
+            style="padding: 3px 0"
+            type="text"
+            size="medium"
+            @click="saveAllParamChange"
+            >淇濆瓨
+        </el-button>
+        <!-- <el-button
+            style="padding: 3px 0"
+            type="text"
+            size="medium"
+            @click="openTempalteParamDialog"
+            >娣诲姞
+        </el-button> -->
+        </div>
         <el-table
           :data="testStandardParams"
           id="testStandardParamTable"
           ref="testStandardParam"
           :default-sort="{ prop: 'index' }"
           highlight-current-row
-          height="500"
-          style="width: 100%"
+          max-height="500"
+          style="width: 100%;overflow-x: auto;"
         >
           <el-table-column
             prop="index"
@@ -34,14 +51,67 @@
             width="50"
           />
           <el-table-column label="鍙傛暟缂栧彿" prop="code" align="center" />
-          <el-table-column label="鍙傛暟椤�" prop="parameterItem" align="center" />
-          <el-table-column label="妫�娴嬬被鍨�" prop="paramType" align="center" />
+          <el-table-column label="鍙傛暟椤�" prop="parameterItem" align="center"/>
           <el-table-column
-            label="妫�娴嬭寖鍥�"
+            label="瑕佹眰鍊�"
             prop="referenceValue"
             align="center"
-          />
-          <el-table-column label="鍗曚綅" prop="unit" align="center" />
+            width="120px"
+          >
+          <template slot-scope="scope">
+            <el-tooltip class="item" effect="dark" :content="scope.row.referenceValue" >
+                <el-input
+                v-model="scope.row.referenceValue"
+                placeholder="鍊�"
+                :disabled="!editable"
+                ></el-input>
+                </el-tooltip>
+            </template>
+            </el-table-column>
+          <el-table-column label="鍗曚綅" prop="unit" align="center" width="120px">
+            <template slot-scope="scope">
+              <el-tooltip class="item" effect="dark" :content="scope.row.unit" >
+                <el-input
+                v-model="scope.row.unit"
+                placeholder="鍗曚綅"
+                :disabled="!editable"
+                ></el-input>
+                </el-tooltip>
+            </template>
+          </el-table-column>
+          <el-table-column label="娴嬭瘯鏂规硶" prop="method" align="center">
+            <template slot-scope="scope">
+              <el-tooltip class="item" effect="dark" :content="scope.row.method" >
+                <el-input
+                v-model="scope.row.method"
+                placeholder=""
+                :disabled="!editable"
+                ></el-input>
+                </el-tooltip>
+            </template>
+          </el-table-column>
+          <el-table-column label="娴嬭瘯鐩殑" prop="purpose" align="center">
+            <template slot-scope="scope">
+              <el-tooltip class="item" effect="dark" :content="scope.row.purpose" >
+                <el-input
+                v-model="scope.row.purpose"
+                placeholder=""
+                :disabled="!editable"
+                ></el-input>
+                </el-tooltip>
+            </template>
+          </el-table-column>
+          <el-table-column label="鎿嶄綔" align="center" fixed="right">
+        <template slot-scope="scope">
+            <el-button
+            type="text"
+            size="mini"
+            v-if="editable && currentRow&&currentRow.id"
+            @click.stop="handleParamDelete(scope.row, scope.$index)"
+            >鍒犻櫎
+            </el-button>
+        </template>
+        </el-table-column>
         </el-table>
       </el-col>
     </el-row>
@@ -52,13 +122,16 @@
   /></basic-container>
 </template>
 <script>
-import { getTestStandardParams } from '@/api/quality/teststandard'
+//import { getTestStandardParams } from '@/api/quality/teststandard'
 import ttable from '@/views/common/ztt-table.vue'
 import { mapGetters } from 'vuex'
 import {
   deleteTestStandard,
   getTestStand,
-  saveTestStandard
+  saveTestStandard,
+  getTestStandardParams,
+  deleteTestStandardParam,
+  saveTestStandardParam,
 } from '@/api/technology/document'
 import qualityStandardDialog from '@/views/common/teststandardradio.vue'
 
@@ -287,6 +360,46 @@
     handleSelectionChange(val) {
       // 澶氳閫変腑
       this.multipleSelection = val
+    },
+    saveAllParamChange(){
+        this.testStandardParams.forEach(e=>{
+        if(e.referenceValue!=null){
+        e.referenceValue=e.referenceValue.replace(',','锛�').replace('(','锛�').replace(')','锛�')
+          if (!isNaN(e.referenceValue)) {
+            e.referenceValue='='+e.referenceValue
+          }
+        }
+      })
+      saveTestStandardParam(this.testStandardParams).then((response) => {
+        const data = response.data
+        if (data.code == 0) {
+          this.$message.success('淇濆瓨鎴愬姛')
+          this.getTestStandardParamData(this.currentRow.id)
+        } else {
+          this.$message.error('淇濆瓨澶辫触')
+        }
+      })
+    },
+    openTempalteParamDialog(){},
+    handleParamDelete(row, index){
+        this.$confirm('鏄惁纭鍒犻櫎鍙傛暟椤逛负' + row.parameterItem, '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      })
+        .then(function() {
+          return deleteTestStandardParam(row.id)
+        })
+        .then((response) => {
+          const data = response.data
+          if (data.code == 0) {
+            // 鍒犻櫎褰撳墠琛�
+            this.testStandardParams.splice(index, 1)
+            this.$message.success('鍒犻櫎鎴愬姛')
+          } else {
+            this.$message.error('鍒犻櫎澶辫触')
+          }
+        })
     }
   }
 }

--
Gitblit v1.9.3