Quellcode durchsuchen

物料基础档案界面财务信息页签中选择数据修改显示的不是选中的数据问题处理

shiy vor 2 Jahren
Ursprung
Commit
222190e1d7
1 geänderte Dateien mit 48 neuen und 42 gelöschten Zeilen
  1. 48 42
      src/views/material/basicFile/details.vue

+ 48 - 42
src/views/material/basicFile/details.vue

@@ -10,7 +10,7 @@
         <el-col :span="1.5">
           <el-button-group>
             <el-button size="small" @click="handleSave"
-              v-hasPermi="['system:material:add', `${maintainNewVersion ? '' : 'system:material:versions'}`]">
+                       v-hasPermi="['system:material:add', `${maintainNewVersion ? '' : 'system:material:versions'}`]">
               保存
             </el-button>
           </el-button-group>
@@ -71,7 +71,7 @@
     <el-row :gutter="10" class="mb10" v-show="activeMainTab != 'material'">
       <el-col :span="1.5">
         <el-button-group>
-          <el-button size="small" @click="handleOtherEdit">修改</el-button>
+          <el-button size="small" @click="handleOtherEdit('table')">修改</el-button>
           <el-button size="small" v-show="activeMainTab != 'material_finance'" @click="handleOtherDel">删除</el-button>
         </el-button-group>
         <el-button-group>
@@ -128,12 +128,12 @@
               <div class="md-main">
 
                 <!-- 基本信息展示表单 -->
-                <el-form 
-                  v-if="activeMainTab == 'material'" 
-                  :inline="true" 
+                <el-form
+                  v-if="activeMainTab == 'material'"
+                  :inline="true"
                   label-position="right"
-                  :hide-required-asterisk="true" 
-                  :model="basicData.value" 
+                  :hide-required-asterisk="true"
+                  :model="basicData.value"
                   ref="basicMessageRef"
                 >
 
@@ -144,14 +144,14 @@
 
                         <!-- 多选框 -->
                         <el-form-item v-if="f.attribute == 'checkbox'" style="text-align: left;" :prop="f.prop"
-                        :rules="[{ required: f.required, message: `请选择${f.name}`, trigger: 'change' }]" >
+                                      :rules="[{ required: f.required, message: `请选择${f.name}`, trigger: 'change' }]">
                           <!-- :rules="[{ required: f.required, message: `请选择${f.name}`, trigger: 'change' }]" -->
 
-                          <el-checkbox 
-                            :label="f.name" name="type" 
-                            v-model="basicData.value[f.prop]" 
+                          <el-checkbox
+                            :label="f.name" name="type"
+                            v-model="basicData.value[f.prop]"
                             true-label="0"
-                            false-label="2" 
+                            false-label="2"
                             :disabled="handleJudge(f)"
                             size="mini"
                           >
@@ -176,7 +176,8 @@
 
                           <!-- 参照 -->
                           <el-select v-if="f.apiUrl" v-model="basicData.value[`${f.prop}Name`]" placeholder="请选择"
-                              size="mini" :rules="[{ required: f.required, message: `请选择${f.name}`, trigger: 'change' }]"
+                                     size="mini"
+                                     :rules="[{ required: f.required, message: `请选择${f.name}`, trigger: 'change' }]"
                                      :key="basicData.value[f.prop]" :disabled="handleJudge(f)"
                                      @focus="f.apiUrl && handleQueryMore(f, '', { name: 'basicData', prop: f.prop })">
                             <div slot="empty"></div>
@@ -202,7 +203,8 @@
                         </el-form-item>
 
                         <!--attribute 文本 数字 文本域 为null -->
-                        <el-form-item v-else :prop="f.prop" :rules="[{ required: f.required, message: `请选择${f.name}`, trigger: 'change' }]">
+                        <el-form-item v-else :prop="f.prop"
+                                      :rules="[{ required: f.required, message: `请选择${f.name}`, trigger: 'change' }]">
                           <!-- :rules="[{ required: f.required, message: `请输入${f.name}`, trigger: 'blur' }]" -->
 
                           <template slot="label">
@@ -217,7 +219,7 @@
                           <el-input size="mini" v-model="basicData.value[f.prop]" :type="f.attribute || 'text'"
                                     :readonly="handleJudge(f)"
                                     :rules="[{ required: f.required, message: `请选择${f.name}`, trigger: 'change' }]"
-                                    >
+                          >
                           </el-input>
                         </el-form-item>
 
@@ -456,12 +458,12 @@
 
 
     <!-- 其他页签的操作 -->
-    <el-dialog 
-      :title="otherDeatils.title" 
-      :visible.sync="otherDeatils.show" 
+    <el-dialog
+      :title="otherDeatils.title"
+      :visible.sync="otherDeatils.show"
       show-close width="70%"
-      :before-close="handleCloseOtherDetails" 
-      :close-on-press-escape="false" 
+      :before-close="handleCloseOtherDetails"
+      :close-on-press-escape="false"
       :close-on-click-modal="false"
       class="otherDialog"
     >
@@ -470,7 +472,7 @@
         <el-row :gutter="10" class="mb10">
           <el-col :span="1.5" v-if="!otherDeatils.isEdit">
             <el-button-group>
-              <el-button size="small" @click="handleOtherEdit">修改</el-button>
+              <el-button size="small" @click="handleOtherEdit('form')">修改</el-button>
               <!-- <el-button size="small" @click="handleOtherDel">删除</el-button> -->
             </el-button-group>
             <el-button-group>
@@ -1346,22 +1348,26 @@
         });
       },
       // 除基本信息之后的修改
-      handleOtherEdit() {
-        console.log('除基本信息之后的修改');
-        if (this.mainMsg.checkedList.length == 1) {
-          this.otherDeatils.show = true;
-          this.otherDeatils.isEdit = true;
-          let activeTab = this.detailsTabs.filter(item => item.code == this.activeMainTab)[0];
-          this.otherDeatils.queryKey = this.mainMsg.checkedList[0].id;
-          this.otherDeatils.title = activeTab.label;
-          console.log(this.otherDeatils, 'this.otherDeatils');
+      handleOtherEdit(type) {
+        console.log('除基本信息之后的修改', type);
+        this.otherDeatils.show = true;
+        this.otherDeatils.isEdit = true;
+        let activeTab = this.detailsTabs.filter(item => item.code == this.activeMainTab)[0];
+        this.otherDeatils.title = activeTab.label;
+        if ('table' === type) {
+          if (this.mainMsg.checkedList.length == 1) {
+            this.otherDeatils.queryKey = this.mainMsg.checkedList[0].id;
+            console.log(this.otherDeatils, 'this.otherDeatils');
+          } else {
+            this.$message({
+              message: '修改请选择单个数据!',
+              type: 'warning'
+            });
+          }
+        }
+        if (this.otherDeatils.queryKey) {
           // 查询其他标签页列表详情
           this.getOtherListDetails(activeTab.code, this.otherDeatils.queryKey);
-        } else {
-          this.$message({
-            message: '修改请选择单个数据!',
-            type: 'warning'
-          });
         }
       },
       // 其他标签详情弹窗-刷新
@@ -1582,8 +1588,8 @@
       handleSave() {
         console.log('保存修改');
         this.$refs['basicMessageRef'].validate(async (valid) => {
-          
-          if(valid){
+
+          if (valid) {
             this.loading = true;
             // 普通保存修改
             this.updateButtonGroup && this.handleSaveMaterial(() => {
@@ -1596,13 +1602,13 @@
               this.maintainNewVersion = false;
               this.handleRefresh();
             })
-          }else {
+          } else {
             this.$message.error('存在必填项未填写');
             console.log('error submit!!');
             return false;
           }
         })
-        
+
       },
       // 物料类别列表选中
       handleSelectionType(list) {
@@ -2105,11 +2111,11 @@
       },
       "basicData.value.isMedicine": {
         handler(nVal, oVal) {
-          this.basicData.form = this.basicData.form.map(formItem =>{
+          this.basicData.form = this.basicData.form.map(formItem => {
 
-            if(formItem.prop === 'productionPermit'){
+            if (formItem.prop === 'productionPermit') {
 
-              formItem.required = nVal == '0' ? true :false;
+              formItem.required = nVal == '0' ? true : false;
 
             }
             return formItem;