Преглед изворни кода

性能验证实验、配置数据提交校验完善,修复已知bug

cfort пре 1 година
родитељ
комит
7731ca67ad

+ 3 - 5
src/views/business/performance/components/chart.vue

@@ -85,14 +85,12 @@ export default {
     .info-container {
         .chart {
             .chart-container {
-                // white-space: pre-wrap;
-                // color: #606266;
-                // font-size: 14px;
-                // line-height: 1.5;
                 .form-row {
                     display: flex;
-                    justify-content: center;
                     flex-wrap: wrap;
+                    > *:only-child {
+                        margin: 0 auto;
+                    }
                     .chart-item {
                         height: 300px;
                         width: 100%;

+ 10 - 1
src/views/business/performance/components/experimental-data.vue

@@ -79,7 +79,7 @@ export default {
         ImportTable: () => import('@/business/platform/form/formrender/dynamic-form/components/import-table')
     },
     props: {
-        expData: {
+        exp: {
             type: Object,
             default: () => {}
         },
@@ -94,6 +94,7 @@ export default {
     },
     data () {
         return {
+            expData: this.exp,
             showImportTable: false,
             toolbars: [
                 { key: 'export', icon: 'ibps-icon-cloud-download', label: '导出模板', type: 'info', hidden: this.readonly },
@@ -102,6 +103,14 @@ export default {
             ]
         }
     },
+    watch: {
+        exp: {
+            handler (val) {
+                this.expData = val
+            },
+            deep: true
+        }
+    },
     methods: {
         handleActionEvent (key) {
             switch (key) {

+ 11 - 6
src/views/business/performance/components/param-info.vue

@@ -14,6 +14,7 @@
                                 type="number"
                                 :min="getAttrs('specimensNum', 'min')"
                                 :max="getAttrs('specimensNum', 'max')"
+                                :step="getAttrs('specimensNum', 'step')"
                                 :precision="getAttrs('specimensNum', 'precision')"
                                 :disabled="readonly"
                                 placeholder="请输入"
@@ -28,6 +29,7 @@
                                 type="number"
                                 :min="getAttrs('repeatNum', 'min')"
                                 :max="getAttrs('repeatNum', 'max')"
+                                :step="getAttrs('repeatNum', 'step')"
                                 :precision="getAttrs('repeatNum', 'precision')"
                                 :disabled="readonly"
                                 placeholder="请输入"
@@ -43,6 +45,7 @@
                                 type="number"
                                 :min="getAttrs('days', 'min')"
                                 :max="getAttrs('days', 'max')"
+                                :step="getAttrs('days', 'step')"
                                 :precision="getAttrs('days', 'precision')"
                                 :disabled="readonly"
                                 placeholder="请输入"
@@ -64,6 +67,7 @@
                                 type="number"
                                 :min="getAttrs('methodNum', 'min')"
                                 :max="getAttrs('methodNum', 'max')"
+                                :step="getAttrs('methodNum', 'step')"
                                 :precision="getAttrs('methodNum', 'precision')"
                                 :disabled="readonly"
                                 placeholder="请输入"
@@ -98,7 +102,7 @@
                 </el-row>
                 <el-row v-if="isShow('targetValue')" :gutter="20" class="form-row">
                     <el-col :span="24">
-                        <el-form-item prop="targetValue" :show-message="false" class="inline-item">
+                        <el-form-item prop="shiYanCanShu.targetValue" :show-message="false" class="inline-item">
                             <template slot="label">
                                 <span>{{ getAttrs('targetValue', 'label', false) }}</span>
                                 <el-tooltip
@@ -125,7 +129,7 @@
                 </el-row>
                 <el-row v-if="isShow('claimValue')" :gutter="20" class="form-row">
                     <el-col :span="24">
-                        <el-form-item prop="claimValue" :show-message="false" class="inline-item">
+                        <el-form-item prop="shiYanCanShu.claimValue" :show-message="false" class="inline-item">
                             <template slot="label">
                                 <span>{{ getAttrs('claimValue', 'label', false) }}</span>
                                 <el-tooltip
@@ -161,7 +165,7 @@
                 </el-row>
                 <el-row :gutter="20" class="form-row">
                     <el-col v-if="isShow('rejectionRate')" :span="12">
-                        <el-form-item :label="getAttrs('rejectionRate', 'label', false)" prop="rejectionRate" :show-message="false">
+                        <el-form-item :label="getAttrs('rejectionRate', 'label', false)" prop="shiYanCanShu.rejectionRate" :show-message="false">
                             <el-select
                                 v-model="pageInfo.rejectionRate"
                                 clearable
@@ -198,11 +202,12 @@
                         </el-form-item>
                     </el-col>
                     <el-col v-if="pageInfo.standard === '基于允许总误差TEa' && isShow('tea')" :span="12">
-                        <el-form-item label="TEa数值" prop="tea" :show-message="false">
+                        <el-form-item label="TEa数值" prop="shiYanCanShu.tea" :show-message="false">
                             <el-input-number
                                 v-model="pageInfo.tea"
                                 type="number"
                                 :min="0"
+                                :step="getAttrs('standard', 'step')"
                                 :precision="2"
                                 :disabled="readonly"
                                 placeholder="请输入"
@@ -339,7 +344,7 @@
                                 type="number"
                                 :min="getAttrs('allowableR2', 'min')"
                                 :max="getAttrs('allowableR2', 'max')"
-                                :step="0.001"
+                                :step="getAttrs('allowableR2', 'step')"
                                 :precision="getAttrs('allowableR2', 'precision')"
                                 :disabled="readonly"
                                 placeholder="请输入"
@@ -364,7 +369,7 @@
                                 type="number"
                                 :min="getAttrs('rangeValue', 'min')"
                                 :max="getAttrs('rangeValue', 'max')"
-                                :step="0.01"
+                                :step="getAttrs('rangeValue', 'step')"
                                 :precision="getAttrs('rangeValue', 'precision')"
                                 :disabled="readonly"
                                 placeholder="请输入"

+ 1 - 0
src/views/business/performance/components/reagent-edit.vue

@@ -23,6 +23,7 @@
                 <el-select
                     v-model="reagentForm.leiBie"
                     filterable
+                    allow-create
                     clearable
                     :disabled="readonly"
                     placeholder="请选择"

+ 16 - 2
src/views/business/performance/components/reagent-info.vue

@@ -163,14 +163,28 @@ export default {
                 results.forEach(item => {
                     const obj = {}
                     Object.keys(item).forEach(key => {
-                        console.log(key)
                         if (keys[key]) {
                             obj[keys[key]] = item[key]
                         }
                     })
                     list.push(obj)
                 })
-                this.reagentData = Array.from(this.reagentData.concat(list))
+                const keysValue = Object.values(keys)
+                const isError = list.some(item => keysValue.some(key => !item[key]))
+                if (isError || !list.length) {
+                    return this.$message.warning('导出模板中的每一项都需填写,请检查您的数据!')
+                }
+                const dateRegex = /^(\d{4})[-/](\d{2})(?:[-/](\d{2}))?$/
+                const isDateError = list.some(item => {
+                    return !dateRegex.test(item.youXiaoQi)
+                })
+                if (isDateError) {
+                    return this.$message.warning('有效期格式支持【2024-01】、【2024/01】、【2024-01-01】、【2024/01/01】,请检查您的数据!')
+                }
+                list.forEach(item => {
+                    item.youXiaoQi = item.youXiaoQi.replace(/\//g, '-')
+                })
+                this.reagentData.push(...list)
                 this.showImportTable = false
             })
         },

+ 52 - 4
src/views/business/performance/config.vue

@@ -322,7 +322,7 @@
                                                     :disabled="readonly && method.isBasic === 'Y'"
                                                     :min="paramListMap[scope.row.key].min"
                                                     :max="paramListMap[scope.row.key].max"
-                                                    :precision="paramListMap[scope.row.key].precision"
+                                                    :precision="item.key === 'precision' ? 0 : paramListMap[scope.row.key].precision"
                                                 />
                                                 <div v-else>/</div>
                                             </template>
@@ -733,11 +733,51 @@ export default {
                     break
             }
         },
+        validate (data) {
+            const { methods = [] } = data
+            var msg = ''
+            for (const item of methods) {
+                const { methodName, step, criterion, params = [], formulas = [], template, chartOption = [], isDisabled } = item
+                if (!step || !criterion || !template) {
+                    msg = `【${methodName}】实验步骤、判定标准、结论模板、实验参数为必填信息,请补充完整`
+                    break
+                }
+                const pE1 = !(params && params.length) && isDisabled === 'N'
+                const pE2 = params.some(i => !i.key || !i.label)
+                const fE = formulas && formulas.length && formulas.some(i => !i.key || !i.label || !i.value)
+                const cE = chartOption && chartOption.length && chartOption.some(i => !i.key || !i.label || !i.value)
+                if (pE1) {
+                    msg = `【${methodName}】未配置实验参数,请配置实验参数或将方法禁用!`
+                    break
+                }
+                if (pE2) {
+                    msg = `【${methodName}】实验参数中的参数、名称为必填信息,请补充完整`
+                    break
+                }
+                if (fE) {
+                    msg = `【${methodName}】实验公式中的名称、编码及表达式为必填信息,请补充完整或删除空数据`
+                    break
+                }
+                if (cE) {
+                    msg = `【${methodName}】图表配置中的名称、编码及配置项为必填信息,请补充完整或删除空数据`
+                    break
+                }
+            }
+            if (msg) {
+                this.$message.warning(msg)
+                return false
+            }
+            return true
+        },
         handleSave () {
             this.$refs.configForm.validate((valid) => {
                 if (!valid) {
                     return this.$message.warning('请完善表单必填项信息!')
                 }
+                const isValidate = this.validate(this.formData)
+                if (!isValidate) {
+                    return
+                }
                 const submitData = JSON.parse(JSON.stringify(this.formData))
                 submitData.methods.forEach(item => {
                     const temp = this.getNumberStep(item.params)
@@ -818,9 +858,14 @@ export default {
         },
         // 获取数值类型参数步长
         getNumberStep (data) {
+            if (!data || !data.length) {
+                return []
+            }
             return data.map(item => {
-                if (item.type === 'number') {
-                    item.step = 10 ** -item.precision
+                if (this.$utils.isNotEmpty(item.precision)) {
+                    return { ...item, step: 10 ** -item.precision }
+                } else {
+                    return item
                 }
             })
         },
@@ -919,7 +964,7 @@ export default {
                     .el-tabs__nav-wrap.is-scrollable {
                         width: calc(100% - 100px);
                     }
-                    .outer-tabs {
+                                        .outer-tabs {
                         .el-tabs__content {
                             height: calc(100vh - 290px);
                             overflow: auto;
@@ -943,6 +988,9 @@ export default {
                                     width: auto !important;
                                 }
                             }
+                            .hidden-column {
+                                display: none;
+                            }
                         }
                     }
                 }

+ 46 - 19
src/views/business/performance/constants/index.js

@@ -85,11 +85,46 @@ export const formRules = {
         message: '请输入',
         trigger: 'change'
     }],
+    'shiYanCanShu.specimensName': [{
+        required: true,
+        message: '请输入',
+        trigger: 'change'
+    }],
     'shiYanCanShu.model': [{
         required: true,
         message: '请选择',
         trigger: 'change'
     }],
+    'shiYanCanShu.tea': [{
+        required: true,
+        message: '请输入',
+        trigger: 'change'
+    }],
+    'shiYanCanShu.targetValue': [{
+        required: true,
+        message: '请输入',
+        trigger: 'change'
+    }],
+    'shiYanCanShu.claimValue': [{
+        required: true,
+        message: '请输入',
+        trigger: 'change'
+    }],
+    'shiYanCanShu.rejectionRate': [{
+        required: true,
+        message: '请选择',
+        trigger: 'change'
+    }],
+    'shiYanCanShu.batchCVS': [{
+        required: true,
+        message: '请选择',
+        trigger: 'change'
+    }],
+    'shiYanCanShu.dailyCVS': [{
+        required: true,
+        message: '请选择',
+        trigger: 'change'
+    }],
     'shiYanCanShu.allowableR2': [{
         required: true,
         message: '请输入',
@@ -342,6 +377,11 @@ export const methodKeyOption = [
         type: 'linearRange',
         label: '线性稀释回收法',
         value: '线性区间:线性稀释回收法'
+    },
+    {
+        type: 'linearRange',
+        label: 'WST408线性评价',
+        value: '线性区间:WST408线性评价'
     }
 ]
 
@@ -413,7 +453,7 @@ export const paramList = [
         key: 'tea',
         type: 'number',
         min: 0,
-        precision: 0,
+        precision: 2,
         isVisible: true,
         isReadonly: false
     },
@@ -447,16 +487,6 @@ export const paramList = [
         isVisible: true,
         isReadonly: false
     },
-    {
-        label: '偏倚',
-        key: 'batchCVS',
-        type: 'select',
-        fieldOption: {
-            selectOptions: batchOption
-        },
-        isVisible: true,
-        isReadonly: false
-    },
     {
         label: '假失控率',
         key: 'rejectionRate',
@@ -471,20 +501,17 @@ export const paramList = [
         label: '靶值',
         key: 'targetValue',
         type: 'number',
-        isVisible: true,
-        isReadonly: false
-    },
-    {
-        label: '厂商声明差值(偏倚)',
-        key: 'claimValue',
-        type: 'string',
+        min: 0,
+        precision: 2,
         isVisible: true,
         isReadonly: false
     },
     {
         label: '不确定度',
         key: 'claimValue',
-        type: 'string',
+        type: 'number',
+        min: 0,
+        precision: 2,
         isVisible: true,
         isReadonly: false
     },

+ 13 - 7
src/views/business/performance/experimental.vue

@@ -43,7 +43,7 @@
                 </div>
                 <div class="right">
                     <experimental-data
-                        :exp-data="form.jiSuanJieGuo"
+                        :exp="form.jiSuanJieGuo"
                         :form-id="formId"
                         :readonly="readonly"
                         @export="handleExport"
@@ -254,7 +254,7 @@ export default {
             return data.length === data.filter(i => this.$utils.isNotEmpty(i)).length
         },
         submitForm (key, showMsg, callback) {
-            const { shiYanCanShu, shiYanShuJu, jiSuanJieGuo, ...rest } = this.form || {}
+            const { kaiShiShiJian, jieShuShiJian, shiYanCanShu, shiYanShuJu, jiSuanJieGuo, ...rest } = this.form || {}
             const { rangeValue } = shiYanCanShu || {}
             shiYanCanShu.range = rangeValue ? [100 - parseFloat(rangeValue) * 100, 100 + parseFloat(rangeValue) * 100] : []
             // 校验数组数据
@@ -267,6 +267,9 @@ export default {
                 const msg = t ? `${t.label}填写不完整,请补充后再提交` : '性能验证实验参数部分信息填写不完整,请补充后再提交'
                 return this.$message.warning(msg)
             }
+            if (new Date(kaiShiShiJian) > new Date(jieShuShiJian)) {
+                return this.$message.warning('实验开始时间不能大于实验结束时间!')
+            }
             // 组装提交数据
             const submitData = {
                 ...rest,
@@ -318,7 +321,7 @@ export default {
         handleExport () {
             this.handleSubmit('beforeExport', false, () => {
                 exportTemplate({ id: this.formId }).then(res => {
-                    ActionUtils.download(res.data, `${this.form.fangAnLeiXing}-${this.form.shiYanXiangMu}.xlsx`)
+                    ActionUtils.download(res.data, `${this.configData.methodName}-${this.form.shiYanXiangMu}.xlsx`)
                 })
             })
         },
@@ -341,6 +344,7 @@ export default {
                     importTemplate(data).then(res => {
                         this.$message.success('实验数据导入成功')
                         this.form.jiSuanJieGuo = res.data
+                        this.form.shiYanJieLun = res.data.reportResult
                     }).catch(({ state, cause }) => {
                         const errMsg = JSON.parse(cause)
                         let msgContent = ''
@@ -414,14 +418,16 @@ export default {
                         youXiaoQi: '2025-05-01'
                     }
                 ],
-                shiYanCanShu: {},
-                shiYanShuJu: [],
-                shiYanJieLun: '测试达标',
                 shenHeRen: '1166673437578493952',
                 baoGaoShiJian: '2024-05-06',
                 fuJian: '1239940596743798784'
             }
-            this.form = JSON.parse(JSON.stringify(o))
+            const t = JSON.parse(JSON.stringify(o))
+            this.form = {
+                ...this.form,
+                ...t,
+                shiYanCanShu: this.form.shiYanCanShu
+            }
         }
     }
 }

+ 6 - 1
src/views/business/performance/report/precision.vue

@@ -69,6 +69,7 @@
                                     </el-table-column>
                                 </el-table-column>
                             </el-table>
+                            <div class="note" v-html="table.note" />
                         </div>
                     </div>
                 </el-tab-pane>
@@ -142,7 +143,8 @@ export default {
                 title: k,
                 header: reportDataDTO[k].header || this.getTableHeader(reportDataDTO[k].list),
                 hideHeader: this.$utils.isEmpty(reportDataDTO[k].header),
-                list: reportDataDTO[k].list
+                list: reportDataDTO[k].list,
+                note: reportDataDTO[k].note
             })).sort((a, b) => a.title.localeCompare(b.title)) : []
             const chartData = chartDataDTO ? Object.keys(chartDataDTO).map(k => ({
                 title: k,
@@ -239,6 +241,9 @@ export default {
                         }
                     }
                 }
+                .note {
+                    margin-top: 10px;
+                }
             }
         }
     }