From 616a71ebbb82d6143768a17bf4ab84b860bb82e0 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期二, 21 五月 2024 14:53:12 +0800
Subject: [PATCH] 修改产品追溯
---
src/views/technology/document/teststandard.vue | 146 ++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 134 insertions(+), 12 deletions(-)
diff --git a/src/views/technology/document/teststandard.vue b/src/views/technology/document/teststandard.vue
index 2a7da1a..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&¤tRow.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&¤tRow.id"
+ @click.stop="handleParamDelete(scope.row, scope.$index)"
+ >鍒犻櫎
+ </el-button>
+ </template>
+ </el-table-column>
</el-table>
</el-col>
</el-row>
@@ -52,14 +122,17 @@
/></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
-} from '../../../api/technology/document'
+ saveTestStandard,
+ getTestStandardParams,
+ deleteTestStandardParam,
+ saveTestStandardParam,
+} from '@/api/technology/document'
import qualityStandardDialog from '@/views/common/teststandardradio.vue'
export default {
@@ -75,7 +148,7 @@
},
data() {
return {
- paramObj: { documentId: this.documentId },
+ paramObj: {documentId : this.documentId},
showQualityStandard: false,
testStandardParams: [],
ajaxFun: getTestStand,
@@ -184,7 +257,16 @@
computed: {
...mapGetters(['permissions'])
},
- created() {},
+ created() {
+ this.$nextTick(()=>{
+ getTestStand(this.paramObj)
+ })
+ },
+ mounted(){
+ this.$nextTick(()=>{
+ getTestStand(this.paramObj)
+ })
+ },
methods: {
// 鑾峰彇鏁版嵁鍒楄〃
getData() {
@@ -278,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