|
|
@@ -1,19 +1,21 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <div class="reagentChange">
|
|
|
+ <div v-if="show" class="reagentChange">
|
|
|
<el-row type="flex">
|
|
|
- <el-col style="margin:0 0 5px 0">
|
|
|
- <div class="button">
|
|
|
- <el-button v-if="!disabled" type="primary" size="mini" icon="ibps-icon-calculator" @click="computedResult">计算结果</el-button>
|
|
|
- <el-button v-else type="primary" size="mini" icon="ibps-icon-edit" @click="disabled=false">编辑</el-button>
|
|
|
+ <el-col class="button">
|
|
|
+ <div class="title">平行实验/留样再测</div>
|
|
|
+ <div v-if="nodeId === 'Activity_0xkc1ji' || readonly" />
|
|
|
+ <div v-else>
|
|
|
+ <el-button type="primary" size="mini" icon="ibps-icon-edit" @click="openDialog">配置样品</el-button>
|
|
|
<el-button type="success" size="mini" icon="ibps-icon-plus" @click="generateData">生成数据</el-button>
|
|
|
- <el-button type="danger" size="mini" icon="ibps-icon-edit" @click="openDialog">配置样品</el-button>
|
|
|
+ <el-button v-if="!disabled" type="danger" size="mini" icon="ibps-icon-calculator" @click="computedResult">计算结果</el-button>
|
|
|
+ <el-button v-else type="danger" size="mini" icon="ibps-icon-edit" @click="disabled=false">编辑</el-button>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row type="flex">
|
|
|
<el-col>
|
|
|
- <el-table ref="reagent" :data="reagentData" :span-method="spanMethod" border>
|
|
|
+ <el-table ref="reagent" :data="reagentData" :span-method="spanMethod">
|
|
|
<el-table-column
|
|
|
label="检验项目"
|
|
|
prop="jyxm"
|
|
|
@@ -82,6 +84,10 @@ export default {
|
|
|
readonly: {
|
|
|
type: Boolean,
|
|
|
default: false
|
|
|
+ },
|
|
|
+ params: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {}
|
|
|
}
|
|
|
},
|
|
|
data () {
|
|
|
@@ -98,57 +104,94 @@ export default {
|
|
|
centerDialogVisible: false,
|
|
|
validateFlag: false,
|
|
|
disabled: false,
|
|
|
- ypData: [
|
|
|
- // { jianCeXiangMu: 'A', xianDingFanWei: '50%', fhl: '80%' },
|
|
|
- // { jianCeXiangMu: 'B', xianDingFanWei: '40%', fhl: '80%' },
|
|
|
- // { jianCeXiangMu: 'C', xianDingFanWei: '30%', fhl: '80%' }
|
|
|
- ],
|
|
|
- ypFlag: false
|
|
|
+ ypData: [],
|
|
|
+ ypFlag: false,
|
|
|
+ nodeId: '',
|
|
|
+ spanLength: 0,
|
|
|
+ show: true
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
},
|
|
|
watch: {
|
|
|
+ disabled: {
|
|
|
+ handler (val) {
|
|
|
+ this.$emit('change-data', 'zuJianShuJu', JSON.stringify([this.reagentData, this.copyDialogData.length, val]))
|
|
|
+ },
|
|
|
+ immediate: true
|
|
|
+ },
|
|
|
'formData.sjghyzjlbxmcszb': {
|
|
|
handler (val) {
|
|
|
this.ypData = []
|
|
|
this.ypFlag = false
|
|
|
val.forEach(item => {
|
|
|
// 判断“平行实验/留样再测”表是否全填
|
|
|
- if (!item.jianCeXiangMu || !item.canShuMingCheng || !item.xianDingFanWei) {
|
|
|
+ if (!item.jianCeXiangMu || !item.xiangMuFuHeLv || !item.xianDingFanWei) {
|
|
|
this.ypFlag = true
|
|
|
}
|
|
|
- this.ypData.push({ ...item, fhl: '80%' })
|
|
|
+ this.ypData.push({ ...item })
|
|
|
})
|
|
|
- console.log(val, 'watch')
|
|
|
// 处理表单”平行实验/留样再测“
|
|
|
- if (val.length && !this.ypFlag) {
|
|
|
- // 点完计算结果后再去编辑”平行实验/留样再测“表单,则给表格置空重新填写
|
|
|
- if (this.disabled && this.reagentData.length) {
|
|
|
- this.copyDialogData = []
|
|
|
- this.reagentData = []
|
|
|
- this.disabled = false
|
|
|
- return this.$message.error('请重新配置样品')
|
|
|
- }
|
|
|
- if (!this.disabled && this.reagentData.length) {
|
|
|
- this.initData()
|
|
|
+ // if (val.length && !this.ypFlag) {
|
|
|
+ // // 点完计算结果后再去编辑”平行实验/留样再测“表单,则给表格置空重新填写
|
|
|
+ // if (this.disabled && this.reagentData.length) {
|
|
|
+ // this.copyDialogData = []
|
|
|
+ // this.reagentData = []
|
|
|
+ // this.disabled = false
|
|
|
+ // return this.$message.error('请重新配置样品')
|
|
|
+ // }
|
|
|
+ // if (!this.disabled && this.reagentData.length) {
|
|
|
+ // this.initData()
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ immediate: true
|
|
|
+ },
|
|
|
+ 'formData.sjghyzjlbbbzb': {
|
|
|
+ handler (val) {
|
|
|
+ if (this.formData.zuJianShuJu) {
|
|
|
+ const data = JSON.parse(this.formData.zuJianShuJu)
|
|
|
+ this.spanLength = data[1]
|
|
|
+ if (val.length && this.reagentData.length <= 0) {
|
|
|
+ const arry = []
|
|
|
+ val.forEach(item => {
|
|
|
+ arry.push({ jyxm: item.jianCeXiangMu, ypbh: item.biaoBenHao, jsjcdjg: item.jiuJieGuo, xsjcdjg: item.xinJieGuo, pq: item.jieGuo, fhl: item.biaoZhun, sfxf: item.xiangFu, jl: item.jieLun, xdfw: item.zuiXiaoFanWei })
|
|
|
+ })
|
|
|
+ setTimeout(() => {
|
|
|
+ this.reagentData = arry
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.reagent && this.$refs.reagent.$forceUpdate()
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- deep: true,
|
|
|
+ deep: true
|
|
|
+ },
|
|
|
+ 'formData.fangAn': {
|
|
|
+ handler (val) {
|
|
|
+ this.showAndHide(val)
|
|
|
+ },
|
|
|
immediate: true
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|
|
|
- // console.log('mounted', this.formData)
|
|
|
+ this.nodeId = this.params ? this.params.nodeId : ''
|
|
|
+ this.spanLength = this.params ? this.params.spanLength : ''
|
|
|
+ this.disabled = this.readonly || this.nodeId === 'Activity_0xkc1ji'
|
|
|
+ this.showAndHide(this.formData.fangAn)
|
|
|
},
|
|
|
methods: {
|
|
|
+ showAndHide (data) {
|
|
|
+ if (data.includes('平行试验') || data.includes('留样再测') || data.includes('对比方案')) {
|
|
|
+ this.show = true
|
|
|
+ } else {
|
|
|
+ this.show = false
|
|
|
+ }
|
|
|
+ },
|
|
|
// 配置样品
|
|
|
openDialog () {
|
|
|
- // “平行实验/留样再测”表单校验是否是true
|
|
|
- if (this.ypData.length <= 0 || this.ypFlag) {
|
|
|
- return this.$message.error('请先配置好留样再测再配置')
|
|
|
- }
|
|
|
this.centerDialogVisible = true
|
|
|
if (this.copyDialogData.length > 0) {
|
|
|
this.dialogData = JSON.parse(JSON.stringify(this.copyDialogData))
|
|
|
@@ -164,7 +207,7 @@ export default {
|
|
|
},
|
|
|
// 生成数据
|
|
|
generateData () {
|
|
|
- if (this.copyDialogData.length > 0) {
|
|
|
+ if (this.copyDialogData.length > 0 && this.ypData.length > 0 && !this.ypFlag) {
|
|
|
if (this.reagentData.length > 0) {
|
|
|
this.$confirm('将重置表格数据,是否确认操作?', '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
@@ -193,7 +236,7 @@ export default {
|
|
|
})
|
|
|
if (!computedFlag && this.reagentData.length > 0) {
|
|
|
this.reagentData.forEach(item => {
|
|
|
- item.pq = this.deleteAccuracy((item.xsjcdjg - item.jsjcdjg) / item.jsjcdjg)
|
|
|
+ item.pq = this.deleteAccuracy(Math.abs(item.xsjcdjg - item.jsjcdjg) / item.jsjcdjg)
|
|
|
item.sfxf = Number(item.pq.replace('%', '')) < Number(item.xdfw.replace('%', '')) ? '是' : '否'
|
|
|
})
|
|
|
this.ypData.forEach(c => {
|
|
|
@@ -201,12 +244,11 @@ export default {
|
|
|
this.reagentData.forEach(item => {
|
|
|
if (item.jyxm === c.jianCeXiangMu) {
|
|
|
item.fhl = this.deleteAccuracy(count / this.copyDialogData.length)
|
|
|
- item.jl = Number(item.fhl.replace('%', '')) > Number(c.fhl.replace('%', '')) ? '合格' : '不合格'
|
|
|
+ item.jl = Number(item.fhl.replace('%', '')) >= Number(c.xiangMuFuHeLv.replace('%', '')) ? '合格' : '不合格'
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
this.disabled = true
|
|
|
- console.log(this.reagentData)
|
|
|
} else {
|
|
|
this.$message.error('试剂测得结果必须大于0且不能为空!')
|
|
|
}
|
|
|
@@ -216,13 +258,13 @@ export default {
|
|
|
this.reagentData = []
|
|
|
this.ypData.forEach(item => {
|
|
|
this.copyDialogData.forEach(el => {
|
|
|
- this.reagentData.push({ jyxm: item.jianCeXiangMu, ypbh: el.number, jsjcdjg: '', xsjcdjg: '', pq: '', xdfw: item.xianDingFanWei, sfxf: '', fhl: '', jl: '' })
|
|
|
+ this.reagentData.push({ jyxm: item.jianCeXiangMu, ypbh: el.number, jsjcdjg: '', xsjcdjg: '', pq: '', xdfw: item.xianDingFanWei + '%', sfxf: '', fhl: '', jl: '' })
|
|
|
})
|
|
|
})
|
|
|
this.$refs.reagent.doLayout()
|
|
|
},
|
|
|
spanMethod ({ row, column, rowIndex, columnIndex }) {
|
|
|
- const rowspan = this.copyDialogData.length
|
|
|
+ const rowspan = this.copyDialogData.length || this.spanLength
|
|
|
if (columnIndex === 0 || columnIndex === 5 || columnIndex === 7 || columnIndex === 8) {
|
|
|
if (rowIndex % rowspan === 0) {
|
|
|
return {
|
|
|
@@ -296,9 +338,17 @@ export default {
|
|
|
margin-bottom: 20px;
|
|
|
.button{
|
|
|
display: flex;
|
|
|
- flex-direction: row-reverse;
|
|
|
- .el-button{
|
|
|
- margin-left: 5px;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 0px 0px 0px 15px;
|
|
|
+ background: #f0ffff;
|
|
|
+ .title {
|
|
|
+ color: #999;
|
|
|
+ font-size: 12px;
|
|
|
+ font-weight: bold;
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
+ .el-button {
|
|
|
+ margin: 0;
|
|
|
}
|
|
|
}
|
|
|
}
|