Просмотр исходного кода

性能验证增加不确定度参数,增加信息收缩功能,已知bug修复

cfort 1 год назад
Родитель
Сommit
2d68e3b181

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

@@ -63,7 +63,9 @@ export default {
         }
     },
     mounted () {
-        this.initChart()
+        this.$nextTick(() => {
+            this.initChart()
+        })
     },
     methods: {
         initChart () {
@@ -75,6 +77,13 @@ export default {
                 // eslint-disable-next-line no-eval
                 const option = eval('(' + item.option + ')')
                 option.title.text = item.title
+                option.grid = option.grid || {
+                    left: '8%',
+                    right: '4%',
+                    bottom: '6%',
+                    top: '12%',
+                    containLabel: true
+                }
                 chart.setOption(option)
             })
         }

+ 137 - 4
src/views/business/performance/components/experimental-desc.vue

@@ -4,23 +4,46 @@
             <div class="title">
                 <i class="ibps-icon-star" />
                 <span>实验步骤</span>
+                <el-tooltip effect="dark" :content="collapseStatus.step ? '收缩' : '展开'" placement="bottom">
+                    <el-button
+                        class="collapse-btn"
+                        size="mini"
+                        :icon="collapseStatus.step ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
+                        @click="toggleCollapse('step')"
+                    />
+                </el-tooltip>
             </div>
-            <!-- <div class="step">{{ step }}</div> -->
-            <div class="step" v-html="step" />
+            <div v-show="collapseStatus.step" class="step" v-html="step" />
         </div>
         <div class="design info-item">
             <div class="title">
                 <i class="ibps-icon-star" />
                 <span>判断标准</span>
+                <el-tooltip effect="dark" :content="collapseStatus.criterion ? '收缩' : '展开'" placement="bottom">
+                    <el-button
+                        class="collapse-btn"
+                        size="mini"
+                        :icon="collapseStatus.criterion ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
+                        @click="toggleCollapse('criterion')"
+                    />
+                </el-tooltip>
             </div>
-            <div class="step" v-html="criterion" />
+            <div v-show="collapseStatus.criterion" class="step" v-html="criterion" />
         </div>
         <div v-if="formulas.length" class="design info-item">
             <div class="title">
                 <i class="ibps-icon-star" />
                 <span>实验公式</span>
+                <el-tooltip effect="dark" :content="collapseStatus.formula ? '收缩' : '展开'" placement="bottom">
+                    <el-button
+                        class="collapse-btn"
+                        size="mini"
+                        :icon="collapseStatus.formula ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
+                        @click="toggleCollapse('formula')"
+                    />
+                </el-tooltip>
             </div>
-            <div class="formula-box">
+            <div v-show="collapseStatus.formula" class="formula-box">
                 <div v-for="item in formulas" :key="item.key" class="formula-item">
                     <div>{{ item.label }}</div>
                     <div>{{ item.value }}</div>
@@ -31,8 +54,17 @@
             <div class="title">
                 <i class="ibps-icon-star" />
                 <span>参考资料</span>
+                <el-tooltip effect="dark" :content="collapseStatus.references ? '收缩' : '展开'" placement="bottom">
+                    <el-button
+                        class="collapse-btn"
+                        size="mini"
+                        :icon="collapseStatus.references ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
+                        @click="toggleCollapse('references')"
+                    />
+                </el-tooltip>
             </div>
             <ibps-attachment
+                v-show="collapseStatus.references"
                 v-model="references"
                 allow-download
                 download
@@ -42,6 +74,44 @@
                 readonly
             />
         </div>
+        <!-- <template v-for="(item, index) in infoList">
+            <div v-if="item.dependOn" :key="index" class="design info-item">
+                <div class="title">
+                    <i class="ibps-icon-star" />
+                    <span>{{ item.title }}</span>
+                    <el-tooltip effect="dark" :content="item.collapse ? '收缩' : '展开'" placement="bottom">
+                        <el-button
+                            class="collapse-btn"
+                            size="mini"
+                            :icon="item.collapse ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
+                            @click="toggleCollapse(item.key)"
+                        />
+                    </el-tooltip>
+                </div>
+                <template v-if="item.key === 'formula'">
+                    <div v-show="collapseStatus.formula" class="formula-box">
+                        <div v-for="f in formulas" :key="f.key" class="formula-item">
+                            <div>{{ f.label }}</div>
+                            <div>{{ f.value }}</div>
+                        </div>
+                    </div>
+                </template>
+                <template v-else-if="item.key === 'references'">
+                    <ibps-attachment
+                        v-model="references"
+                        allow-download
+                        download
+                        multiple
+                        accept="*"
+                        store="id"
+                        readonly
+                    />
+                </template>
+                <template v-else>
+                    <div v-show="item.collapse" class="step" v-html="item.value" />
+                </template>
+            </div>
+        </template> -->
     </div>
 </template>
 <script>
@@ -68,6 +138,46 @@ export default {
             default: ''
         }
     },
+    data () {
+        return {
+            collapseStatus: {
+                step: true,
+                criterion: true,
+                formula: false,
+                references: true
+            },
+            infoList: [
+                {
+                    key: 'step',
+                    title: '实验步骤',
+                    collapse: true,
+                    value: this.step,
+                    dependOn: true
+                },
+                {
+                    key: 'criterion',
+                    title: '判定标准',
+                    collapse: true,
+                    value: this.criterion,
+                    dependOn: true
+                },
+                {
+                    key: 'formula',
+                    title: '实验公式',
+                    collapse: true,
+                    value: this.formulas,
+                    dependOn: this.formulas && this.formulas.length
+                },
+                {
+                    key: 'references',
+                    title: '参考资料',
+                    collapse: true,
+                    value: this.references,
+                    dependOn: this.references
+                }
+            ]
+        }
+    },
     mounted () {
         this.$nextTick(() => {
             this.formatMath()
@@ -81,6 +191,15 @@ export default {
                 }
                 MathJax.MathQueue('.formula-box')
             }, 500)
+        },
+        toggleCollapse (key) {
+            // this.infoList.forEach(item => {
+            //     if (item.key === key) {
+            //         item.collapse = !item.collapse
+            //     }
+            // })
+            // console.log(this.infoList)
+            this.$set(this.collapseStatus, key, !this.collapseStatus[key])
         }
     }
 }
@@ -92,6 +211,20 @@ export default {
             &:last-child {
                 margin-bottom: 0;
             }
+            .collapse-btn {
+                float: right;
+                position: relative;
+                line-height: 1;
+                cursor: pointer;
+                background: #fff;
+                // border: 1px solid #dcdfe6;
+                border: none;
+                color: #606266;
+                text-align: center;
+                font-weight: blod;
+                font-size: 18px;
+                padding: 1px 6px !important;
+            }
             .step {
                 white-space: pre-wrap;
                 color: #606266;

+ 13 - 0
src/views/business/performance/components/param-info.vue

@@ -164,6 +164,19 @@
                     </el-col>
                 </el-row>
                 <el-row :gutter="20" class="form-row">
+                    <el-col v-if="isShow('uncertainty')" :span="12">
+                        <el-form-item :label="getAttrs('uncertainty', 'label', false)" prop="shiYanCanShu.uncertainty" :show-message="false">
+                            <el-input-number
+                                v-model="pageInfo.uncertainty"
+                                type="number"
+                                :min="0"
+                                :step="getAttrs('uncertainty', 'step')"
+                                :precision="getAttrs('uncertainty', 'precision')"
+                                :disabled="readonly"
+                                placeholder="请输入"
+                            />
+                        </el-form-item>
+                    </el-col>
                     <el-col v-if="isShow('rejectionRate')" :span="12">
                         <el-form-item :label="getAttrs('rejectionRate', 'label', false)" prop="shiYanCanShu.rejectionRate" :show-message="false">
                             <el-select

+ 11 - 5
src/views/business/performance/config.vue

@@ -58,7 +58,7 @@
                                 />
                             </el-form-item>
                         </el-col>
-                        <el-col :span="4">
+                        <el-col :span="6">
                             <el-form-item label="指标类型" prop="targetKey" :show-message="false">
                                 <el-input
                                     v-model="formData.targetKey"
@@ -71,7 +71,7 @@
                                 />
                             </el-form-item>
                         </el-col>
-                        <el-col :span="4">
+                        <el-col :span="6">
                             <el-form-item label="排序" prop="sn" :show-message="false">
                                 <el-input-number
                                     v-model="formData.sn"
@@ -83,7 +83,7 @@
                                 />
                             </el-form-item>
                         </el-col>
-                        <el-col :span="4">
+                        <!-- <el-col :span="4">
                             <el-form-item label="图标" prop="icon">
                                 <el-input
                                     v-model="formData.icon"
@@ -94,7 +94,7 @@
                                     placeholder="请输入"
                                 />
                             </el-form-item>
-                        </el-col>
+                        </el-col> -->
                     </el-row>
                 </div>
             </div>
@@ -687,7 +687,7 @@ export default {
         copyMethod (index) {
             const copyData = JSON.parse(JSON.stringify(this.formData.methods[index]))
             copyData.sn = this.methodTabs.length + 1
-            copyData.id = ''
+            copyData.id = this.$utils.guid()
             copyData.methodName += ' (复制)'
             copyData.isBasic = 'N'
             copyData.isDisabled = 'N'
@@ -709,6 +709,12 @@ export default {
             const data = JSON.parse(JSON.stringify(this.initMethod))
             data.sn = this.methodTabs.length + 1
             data.methodName += data.sn
+            data.id = this.$utils.guid()
+            data.isBasic = 'N'
+            data.isDisabled = 'N'
+            data.params = []
+            data.formulas = []
+            data.chartOption = []
             this.formData.methods.push(data)
             this.activeTab = data.methodName
         },

+ 15 - 1
src/views/business/performance/constants/index.js

@@ -135,6 +135,11 @@ export const formRules = {
         message: '请输入',
         trigger: 'change'
     }],
+    'shiYanCanShu.uncertainty': [{
+        required: true,
+        message: '请输入',
+        trigger: 'change'
+    }],
     'shiYanCanShu.standard': [{
         required: true,
         message: '请选择',
@@ -457,6 +462,15 @@ export const paramList = [
         isVisible: true,
         isReadonly: false
     },
+    {
+        label: '不确定度',
+        key: 'uncertainty',
+        type: 'number',
+        min: 0,
+        precision: 2,
+        isVisible: true,
+        isReadonly: false
+    },
     {
         label: '性能标准',
         key: 'standard',
@@ -507,7 +521,7 @@ export const paramList = [
         isReadonly: false
     },
     {
-        label: '不确定度',
+        label: '厂商声明差值(偏移)',
         key: 'claimValue',
         type: 'number',
         min: 0,

+ 3 - 1
src/views/business/performance/experimental.vue

@@ -146,7 +146,7 @@ export default {
             loading: false,
             loadCompleted: false,
             toolbars: [
-                { key: 'test', icon: 'ibps-icon-gg', label: '测试', type: 'warning', hidden: this.readonly },
+                // { key: 'test', icon: 'ibps-icon-gg', label: '测试', type: 'warning', hidden: this.readonly },
                 { key: 'save', icon: 'ibps-icon-save', label: '保存', type: 'success', hidden: this.readonly },
                 // { key: 'submit', icon: 'ibps-icon-send', label: '提交', type: 'primary', hidden: this.readonly },
                 // { key: 'generate', icon: 'ibps-icon-cube', label: '生成报告', type: 'success', hidden: this.readonly },
@@ -273,6 +273,8 @@ export default {
             // 组装提交数据
             const submitData = {
                 ...rest,
+                kaiShiShiJian,
+                jieShuShiJian,
                 shiYanCanShu: this.$utils.isNotEmpty(shiYanCanShu) ? JSON.stringify(shiYanCanShu) : null,
                 shiYanShuJu: this.$utils.isNotEmpty(shiYanShuJu) ? JSON.stringify(shiYanShuJu) : null,
                 jiSuanJieGuo: this.$utils.isNotEmpty(jiSuanJieGuo) ? JSON.stringify(jiSuanJieGuo) : null,