ソースを参照

fix: 修复分账配置companyId混乱问题,确保每个公司独立配置

xw 3 週間 前
コミット
03b6162591
2 ファイル変更49 行追加19 行削除
  1. 1 0
      src/api/his/company.js
  2. 48 19
      src/views/his/company/index.vue

+ 1 - 0
src/api/his/company.js

@@ -80,6 +80,7 @@ export function getDivConfig(companyId) {
   })
 }
 
+// 设置分账配置
 export function setDiv(data) {
   return request({
     url: '/his/company/setDiv',

+ 48 - 19
src/views/his/company/index.vue

@@ -118,9 +118,9 @@
       </el-table-column>
       <el-table-column label="管理员账号" align="center" prop="userName"/>
       <el-table-column label="限制用户数量" align="center" prop="limitUserCount"/>
-      <el-table-column label="限制pad数量" align="center" prop="maxPadNum" :formatter="padNumFormatter" v-if="this.$store.state.user.medicalMallConfig.resource"/>
-      <el-table-column label="占用pad数量" align="center" prop="usedNum" v-if="this.$store.state.user.medicalMallConfig.resource"/>
-      <el-table-column label="所属部门" align="center" prop="deptId" v-if="this.$store.state.user.medicalMallConfig.resource">
+      <el-table-column label="限制pad数量" align="center" prop="maxPadNum" :formatter="padNumFormatter" v-if="this.$store.state.user.medicalMallConfig && this.$store.state.user.medicalMallConfig.resource"/>
+      <el-table-column label="占用pad数量" align="center" prop="usedNum" v-if="this.$store.state.user.medicalMallConfig && this.$store.state.user.medicalMallConfig.resource"/>
+      <el-table-column label="所属部门" align="center" prop="deptId" v-if="this.$store.state.user.medicalMallConfig && this.$store.state.user.medicalMallConfig.resource">
         <template slot-scope="scope">
           <el-tag prop="deptId" v-for="(item, index) in deptOptions" :key="'deptId'+index"
                   v-if="scope.row.deptId===item.deptId"
@@ -218,7 +218,7 @@
           </el-select>
         </el-form-item>
         <!-- 所属部门 -->
-        <el-form-item label="所属部门" prop="deptId" v-if="this.$store.state.user.medicalMallConfig.resource">
+        <el-form-item label="所属部门" prop="deptId" v-if="this.$store.state.user.medicalMallConfig && this.$store.state.user.medicalMallConfig.resource">
           <el-select
             v-model="form.deptId"
             placeholder="请选择"
@@ -245,7 +245,7 @@
         <el-form-item label="员工数量" prop="limitUserCount">
           <el-input-number v-model="form.limitUserCount" :min="1" :max="10000"></el-input-number>
         </el-form-item>
-        <el-form-item label="pad数量" prop="maxPadNum" v-if="this.$store.state.user.medicalMallConfig.resource">
+        <el-form-item label="pad数量" prop="maxPadNum" v-if="this.$store.state.user.medicalMallConfig && this.$store.state.user.medicalMallConfig.resource">
           <el-input-number v-model="form.maxPadNum" :min="-1" :max="10000"></el-input-number>
           <span class="pad-tips">
             注:-1表示不做限制
@@ -608,7 +608,14 @@ export default {
           title: '分账配置'
       },
       revenueForm:{
-        acctInfos: [] 
+        companyId: null,
+        companyName: '',
+        divFlag: '0',
+        delayAcctFlag: 'N',
+        percentageFlag: 'N',
+        iscCleanSplit: 'N',
+        acctInfos: [],
+        isAdd: 1
       },
       // 表单参数
       deductForm: {
@@ -781,7 +788,6 @@ export default {
   methods: {
     // 添加分账账户
     addAcctInfo() {
-      console.log("-----------------",this.revenueForm)
       this.revenueForm.acctInfos.push({
         huifuId: '',
         acctId: '',
@@ -803,24 +809,45 @@ export default {
     },
     handleRevenue(row){
       const companyId = row.companyId
+      // 重置表单数据,避免保留上次的数据
+      this.revenueForm = {
+        companyId: companyId,
+        companyName: row.companyName,
+        divFlag: '0',
+        delayAcctFlag: 'N',
+        percentageFlag: 'N',
+        iscCleanSplit: 'N',
+        acctInfos: [],
+        isAdd: 1
+      }
+      
       //查询配置
-      this.revenueForm.isAdd = 1
       getDivConfig(companyId).then(response => {
         if(response.data){
-          this.revenueForm = response.data
+          this.revenueForm = {
+            ...response.data,
+            companyId: companyId,
+            companyName: row.companyName,
+            isAdd: 1
+          }
           if(response.data.acctInfos == null){
             this.revenueForm.acctInfos = []
           }
-          if(response.data.divFlag){
+          if(response.data.divFlag != null){
             this.revenueForm.divFlag = String(response.data.divFlag)
           }
+          if(!response.data.delayAcctFlag){
+            this.revenueForm.delayAcctFlag = 'N'
+          }
+          if(!response.data.percentageFlag){
+            this.revenueForm.percentageFlag = 'N'
+          }
+          if(!response.data.iscCleanSplit){
+            this.revenueForm.iscCleanSplit = 'N'
+          }
         }
       })
-      this.revenueForm.companyId = companyId
-      this.revenueForm.companyName = row.companyName
-      if(row.divFlag){
-        this.revenueForm.divFlag == "0"
-      }
+      
       this.revenue.open = true
     },
     handleRecharge(row) {
@@ -854,9 +881,10 @@ export default {
       })
     },
     submitRevenueForm(){
-      var param = this.revenueForm;
-      console.log("--------------",param)
-      if(param.companyId && param.divFlag){
+      // 使用深拷贝,避免影响其他数据
+      var param = JSON.parse(JSON.stringify(this.revenueForm));
+      console.log("--------------提交的分账配置参数",param)
+      if(param.companyId && param.divFlag != null){
         setDiv(param).then(response => {
             if (response.code === 200) {
               this.msgSuccess(response.msg)
@@ -864,7 +892,8 @@ export default {
               this.getList()
             }
           })
-        console.log("--------------",param)
+      } else {
+        this.$message.error('请填写完整的分账配置信息')
       }
     },
     /** 提交按钮 */