소스 검색

性能验证我的快速评价

zhonghuizhen 6 달 전
부모
커밋
2fee7d9083
2개의 변경된 파일387개의 추가작업 그리고 20개의 파일을 삭제
  1. 96 20
      src/views/business/performance/experimental.vue
  2. 291 0
      src/views/business/performance/myRecord.vue

+ 96 - 20
src/views/business/performance/experimental.vue

@@ -24,19 +24,19 @@
       <div v-if="loadCompleted" class="config-form-container">
         <div class="left">
           <experimental-desc
-            :step="configData.step"
-            :criterion="configData.criterion"
-            :formulas="configData.formulas"
-            :references="configData.references"
+            :step="configData.step || ''"
+            :criterion="configData.criterion || ''"
+            :formulas="configData.formulas || []"
+            :references="configData.references || []"
             :readonly="readonly"
           />
           <basic-info :info="form" :readonly="readonly" />
           <reagent-info :info="form.reagentPoList" :readonly="readonly" />
           <param-info
-            v-if="$utils.isNotEmpty(configData.params)"
+            v-if="$utils.isNotEmpty(configData && configData.params)"
             :form-id="formId"
             :info="form.shiYanCanShu"
-            :config-data="configData.params"
+            :config-data="configData.params || []"
             :readonly="readonly"
             @updateParams="handleUpdateParams"
           />
@@ -65,7 +65,7 @@
       </div>
     </el-form>
     <div slot="title" class="config-dialog-header">
-      <div class="title">{{ configData.methodName }}</div>
+      <div class="title">{{ configData.methodName || '' }}</div>
       <div class="operate">
         <template v-for="btn in toolbars">
           <el-button
@@ -76,7 +76,7 @@
             :size="btn.size || 'mini'"
             @click="handleActionEvent(btn.key)"
           >
-            {{ btn.label }}
+            {{ typeof btn.label === "function" ? btn.label() : btn.label }}
           </el-button>
         </template>
       </div>
@@ -96,22 +96,22 @@
             margin-bottom: 20px;
           "
         >
-          {{ configData.methodName }}
+          {{ configData.methodName || '' }}
         </div>
         <experimental-desc
-          :step="configData.step"
-          :criterion="configData.criterion"
-          :formulas="configData.formulas"
-          :references="configData.references"
+          :step="configData.step || ''"
+          :criterion="configData.criterion || ''"
+          :formulas="configData.formulas || []"
+          :references="configData.references || []"
           :readonly="true"
         />
         <basic-info :info="form" :readonly="true" />
         <reagent-info :info="form.reagentPoList" :readonly="true" :pdf="pdf" />
         <param-info
-          v-if="$utils.isNotEmpty(configData.params)"
+          v-if="$utils.isNotEmpty(configData && configData.params)"
           :form-id="formId"
           :info="form.shiYanCanShu"
-          :config-data="configData.params"
+          :config-data="configData.params || []"
           :readonly="true"
           @updateParams="handleUpdateParams"
         />
@@ -204,7 +204,7 @@ export default {
       dialogFormVisible: false,
       pdf: 'pdf',
       formLabelWidth: '110px',
-      configData: {},
+      configData: { methodName: '' },
       formId: this.params.recordId,
       form: {
         xingNengZhiBia: '',
@@ -227,25 +227,48 @@ export default {
         shiYanShuJu: [],
         jiSuanJieGuo: {},
         shiYanJieLun: '',
+        shiFouGuoShen: '已暂存',
         fuJian: ''
       },
       rules: formRules,
       loading: false,
       loadCompleted: false,
       toolbars: [
+      {
+          key: 'flowChart',
+          icon: 'ibps-icon-picture',
+          label: '流程图',
+          type: 'primary',
+          hidden: this.showToolBarsBtn('flowChart')
+        },
         {
           key: 'pdf',
           icon: 'ibps-icon-cube',
           label: '导出为PDF',
-          type: 'primary'
+          type: 'primary',
+          hidden: this.showToolBarsBtn('pdf')
         },
         // { key: 'test', icon: 'ibps-icon-gg', label: '测试', type: 'warning', hidden: this.readonly },
         {
           key: 'save',
           icon: 'ibps-icon-save',
           label: '保存',
-          type: 'success',
-          hidden: this.readonly
+          type: 'primary',
+          hidden: this.showToolBarsBtn('save')
+        },
+        {
+          key: 'submit',
+          icon: 'el-icon-s-promotion',
+          label: this.getSubmitLabel,
+          type: 'primary',
+          hidden: this.showToolBarsBtn('submit')
+        },
+        {
+          key: 'sendBack',
+          icon: 'ibps-icon-check-square-o',
+          label: '退回',
+          type: 'primary',
+          hidden: this.showToolBarsBtn('sendBack')
         },
         // { key: 'submit', icon: 'ibps-icon-send', label: '提交', type: 'primary', hidden: this.readonly },
         // { key: 'generate', icon: 'ibps-icon-cube', label: '生成报告', type: 'success', hidden: this.readonly },
@@ -253,7 +276,8 @@ export default {
           key: 'cancel',
           icon: 'el-icon-close',
           label: '关闭',
-          type: 'danger'
+          type: 'danger',
+          hidden: this.showToolBarsBtn('cancel')
         }
       ],
       validateList: [
@@ -274,6 +298,14 @@ export default {
     }
   },
   created() {
+    // 如果从myRecord传来了shiFouGuoShen,则使用它
+    if (this.params && this.params.shiFouGuoShen) {
+      // 确保form对象存在
+      if (!this.form) {
+        this.form = {}
+      }
+      this.form.shiFouGuoShen = this.params.shiFouGuoShen
+    }
     this.getConfigData(this.params)
     if (!this.params.recordId) {
       this.loadCompleted = true
@@ -641,6 +673,50 @@ export default {
         ...t,
         shiYanCanShu: this.form.shiYanCanShu
       }
+    },
+    // 控制工具栏按钮显示
+    showToolBarsBtn(key) {
+      // 在查阅状态时,只显示流程图、导出PDF和关闭按钮
+      if (this.readonly) {
+        // 允许显示的按钮:flowChart(流程图)、pdf(导出PDF)、cancel(关闭)
+        return !['flowChart', 'pdf', 'cancel'].includes(key)
+      }
+      
+      // 非查阅状态,根据shiFouGuoShen状态字段控制按钮显示
+      const status = (this.form && this.form.shiFouGuoShen) || '已暂存'
+      
+      // 已暂存状态显示流程图,导出pdf,关闭,保存,提交按钮
+      if (status === '已暂存' || status === '已退回') {
+        return !['flowChart', 'pdf', 'cancel', 'save', 'submit'].includes(key)
+      }
+      
+      // 已编制状态显示流程图,导出pdf,关闭,保存,退回,提交按钮
+      if (status === '已编制') {
+        return !['flowChart', 'pdf', 'cancel', 'save', 'sendBack', 'submit'].includes(key)
+      }
+      
+      // 已审核状态显示流程图,导出pdf,关闭,保存,退回,提交按钮
+      if (status === '已审核') {
+        return !['flowChart', 'pdf', 'cancel', 'save', 'sendBack', 'submit'].includes(key)
+      }
+      
+      // 已完成,已终止状态和查阅时显示一致
+      if (status === '已完成' || status === '已终止') {
+        return !['flowChart', 'pdf', 'cancel'].includes(key)
+      }
+      
+      // 默认显示流程图,导出pdf,关闭,保存,提交按钮
+      return !['flowChart', 'pdf', 'cancel', 'save', 'submit'].includes(key)
+    },
+    // 获取提交按钮的标签
+    getSubmitLabel() {
+      const status = (this.form && this.form.shiFouGuoShen) || '已暂存'
+      // 已编制和已审核状态下,提交按钮显示为"同意"
+      if (status === '已编制' || status === '已审核') {
+        return '同意'
+      }
+      // 其他状态下显示为"提交"
+      return '提交'
     }
   }
 }

+ 291 - 0
src/views/business/performance/myRecord.vue

@@ -0,0 +1,291 @@
+<template>
+    <div class="main-container">
+      <ibps-crud
+        ref="crud"
+        :display-field="title"
+        :height="height"
+        :data="listData"
+        :toolbars="listConfig.toolbars"
+        :search-form="listConfig.searchForm"
+        :pk-key="pkKey"
+        :columns="listConfig.columns"
+        :row-handle="listConfig.rowHandle"
+        :pagination="pagination"
+        :loading="loading"
+        @action-event="handleAction"
+        @sort-change="handleSortChange"
+        @pagination-change="handlePaginationChange"
+        @row-dblclick="handleRowDblclick"
+      >
+        <template slot="time" slot-scope="scope">
+          <div>起:{{ scope.row.kaiShiShiJian }}</div>
+          <div>止:{{ scope.row.jieShuShiJian }}</div>
+        </template>
+        <template slot="xingNengZhiBiaSearch">
+          <ibps-link-data
+            v-model="searchFormData['Q^xing_neng_zhi_bia^SL']"
+            template-key="xnyzxnzbzly"
+            placeholder="请选择"
+            style="width: 100%"
+          />
+        </template>
+      </ibps-crud>
+      <Experimental
+        v-if="showConfig"
+        :visible.sync="showConfig"
+        :params="params"
+        :readonly="readonly"
+        @refresh="loadData"
+        @close="() => (showConfig = false)"
+      />
+    </div>
+  </template>
+  
+  <script>
+  import { queryExperimental, removeExperimental } from '@/api/business/pv'
+  import ActionUtils from '@/utils/action'
+  import FixHeight from '@/mixins/height'
+  import IbpsLinkData from '@/business/platform/data/templaterender/link-data'
+  
+  export default {
+    components: {
+      Experimental: () => import('./experimental'),
+      'ibps-link-data': IbpsLinkData
+    },
+    mixins: [FixHeight],
+    data() {
+      const { userList = [] } = this.$store.getters || {}
+      const userOption = userList.map((item) => ({
+        label: item.userName,
+        value: item.userId
+      }))
+      return {
+        userOption,
+        title: '性能验证记录',
+        pkKey: 'id', // 主键  如果主键不是pk需要传主键
+        loading: true,
+        height: document.clientHeight,
+        listData: [],
+        pagination: {},
+        sorts: {},
+        searchFormData: {}, // 新增:为搜索表单创建独立的数据模型
+        showConfig: false,
+        readonly: false,
+        params: {},
+        targetOption: [],
+        methodOption: [],
+        listConfig: {
+          toolbars: [{ key: 'search' }, { key: 'remove' }],
+          searchForm: {
+            model: this.searchFormData, // 新增:绑定数据模型
+            forms: [
+              { prop: 'Q^shi_yan_xiang_mu_^SL', label: '实验项目' },
+              { prop: 'Q^xing_neng_zhi_bia^SL', label: '性能指标', fieldType: 'slot', slotName: 'xingNengZhiBiaSearch' },
+              { prop: 'Q^fang_an_lei_xing_^SL', label: '方案类型' },
+              { prop: 'Q^shi_yan_fang_fa_^SL', label: '实验方法' },
+              { prop: 'Q^yang_ben_lei_xing^SL', label: '样本类型' },
+              {
+                prop: 'Q^shi_fou_guo_shen_^SL',
+                label: '状态',
+                fieldType: 'select',
+                options: [
+                  { label: '已暂存', value: '已暂存' },
+                  { label: '已编制', value: '已编制' },
+                  { label: '已审核', value: '已审核' },
+                  { label: '已完成', value: '已完成' },
+                  { label: '已退回', value: '已退回' },
+                  { label: '已终止', value: '已终止' }
+                ]
+              },
+              {
+                prop: ['Q^create_time_^DL', 'Q^create_time_^DG'],
+                label: '创建时间',
+                fieldType: 'daterange'
+              }
+            ]
+          },
+          // 表格字段配置
+          columns: [
+            { prop: 'xingNengZhiBia', label: '性能指标', tags: [], width: 120 },
+            {
+              prop: 'fangAnLeiXing',
+              label: '方案类型',
+              tags: [],
+              minWidth: 125
+            },
+            
+            { prop: 'shiYanXiangMu', label: '实验项目', width: 120 },
+            { prop: 'shiYanFangFa', label: '实验方法', width: 120 },
+            { prop: 'yangBenLeiXing', label: '样本类型', width: 100 },
+            { prop: 'shiYanYiQi', label: '实验仪器', width: 120 },
+            {
+              prop: 'timeRange',
+              label: '实验时间',
+              slotName: 'time',
+              width: 140
+            },
+            { prop: 'shiFouGuoShen', label: '状态', width: 80 },
+            {
+              prop: 'bianZhiRen',
+              label: '实验人',
+              tags: userOption,
+              width: 90
+            },
+            { prop: 'createBy', label: '评价人', tags: userOption, width: 90 },
+            {
+              prop: 'createTime',
+              label: '创建时间',
+              dateFormat: 'yyyy-MM-dd HH:mm',
+              sortable: 'custom',
+              width: 130
+            }
+          ],
+          rowHandle: {
+            effect: 'display',
+            width: 90,
+            actions: [
+              {
+                key: 'edit',
+                label: '编辑',
+                type: 'primary',
+                icon: 'ibps-icon-edit',
+                //hidden: (row) => row.shiFouGuoShen !== '已暂存'
+              },
+              {
+                key: 'detail',
+                label: '查阅',
+                type: 'primary',
+                icon: 'ibps-icon-eye',
+                //hidden: (row) => row.shiFouGuoShen === '已暂存'
+              }
+            ]
+          }
+        }
+      }
+    },
+    created() {
+      this.loadData()
+    },
+    methods: {
+      // 加载数据
+      loadData() {
+        this.loading = true
+        queryExperimental(this.getSearchFormData())
+          .then((res) => {
+            ActionUtils.handleListData(this, res.data)
+            this.loading = false
+          })
+          .catch(() => {
+            this.loading = false
+          })
+      },
+      /**
+       * 获取格式化参数
+       */
+      getSearchFormData() {
+        const searchParam = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
+        const { userId } = this.$store.getters || {}
+        searchParam['Q^create_by_^S'] = userId
+        return ActionUtils.formatParams(searchParam, this.pagination, this.sorts)
+      },
+      /**
+       * 处理分页事件
+       */
+      handlePaginationChange(page) {
+        ActionUtils.setPagination(this.pagination, page)
+        this.loadData()
+      },
+      /**
+       * 处理排序
+       */
+      handleSortChange(sort) {
+        ActionUtils.setSorts(this.sorts, sort)
+        this.loadData()
+      },
+      /**
+       * 查询
+       */
+      search() {
+        this.loadData()
+      },
+      /**
+       * 处理按钮事件
+       */
+      handleAction(command, position, selection, data) {
+        switch (command) {
+          case 'search':
+            ActionUtils.setFirstPagination(this.pagination)
+            this.search()
+            break
+          case 'edit':
+          case 'detail': // 新增查阅只读
+            this.handleEdit(data, command)
+            break
+          case 'report':
+            this.handleReport(data)
+            break
+          case 'remove':
+            ActionUtils.removeRecord(selection)
+              .then((ids) => {
+                this.handleRemove(ids)
+              })
+              .catch(() => {})
+            break
+          default:
+            break
+        }
+      },
+      /**
+       * 处理编辑
+       */
+      async handleEdit(data, key) {
+        const { id, zhiBiaoId, fangFaId, fangFaKey, shiFouGuoShen } = data || {}
+        this.params = {
+          targetId: zhiBiaoId,
+          methodId: fangFaId,
+          methodKey: fangFaKey,
+          recordId: id,
+          shiFouGuoShen: shiFouGuoShen
+        }
+        this.readonly = key === 'detail'
+        this.showConfig = true
+      },
+      handleReport(data) {
+        console.log('wwww')
+      },
+      /**
+       * 处理删除
+       */
+      handleRemove(ids) {
+        // return this.$message.warning('避免误删测试数据,联系开发删除')
+        removeExperimental({ ids })
+          .then(() => {
+            ActionUtils.removeSuccessMessage()
+            this.search()
+          })
+          .catch(() => {})
+      },
+      handleRowDblclick(row) {
+        this.handleEdit(row, 'detail')
+      }
+    }
+  }
+  </script>
+  <style lang="scss">
+  .attachment-uploader-dialog {
+    .el-dialog__body {
+      height: calc(57vh - 100px) !important;
+    }
+  }
+  </style>
+<style lang="scss" scoped>
+.main-container ::v-deep .el-table__body-wrapper {
+  .el-table__row {
+    td:last-child {
+      .cell {
+        text-align: center;
+      }
+    }
+  }
+}
+</style>