瀏覽代碼

需求池208 解决冲突

hbchen 2 年之前
父節點
當前提交
34d575551b

+ 2 - 1
src/directives/index.js

@@ -1,2 +1,3 @@
 export * from './modules/buttonPermisson'
-export * from './modules/select-scroll'
+export * from './modules/select-scroll'
+export * from './modules/overflow-tooltip'

+ 39 - 0
src/directives/modules/overflow-tooltip.js

@@ -0,0 +1,39 @@
+// 长度溢出显示ToolTip 请绑定的标签元素包裹住 element-plus的el-tooltip。
+/**
+ * binding.value 为长度溢出的元素的css选择器,没有请设置
+ */
+import { ElMessage } from 'element-plus'
+
+let mainElement 
+let tooltipNode
+export const overflowTooltip={
+  created(el,binding,vnode) {
+    try {
+      let {value} = binding
+      tooltipNode = vnode.children.find((childrenCmpt) => childrenCmpt.component?.type.name == 'ElTooltip')
+      setTimeout(()=>{
+        mainElement = el.querySelector(value)
+        if(!mainElement){
+          throw new Error('找不到指定css选择器的元素')
+        }
+      },0)
+      if(!value){
+        throw new Error('请设置长度溢出的元素的css选择器')
+      }
+      if(!tooltipNode){
+        throw new Error('找不到el-tooltip组件')
+      }
+    } catch (error) {
+      ElMessage.error(error.message)
+      // console.log(error.message);
+    }
+  },
+  updated() {
+    if(mainElement?.scrollWidth > mainElement?.clientWidth){
+      // 超出
+      tooltipNode.component.props.disabled=false
+    }else{
+      tooltipNode.component.props.disabled=true
+    }
+  },
+}

+ 23 - 4
src/views/financialManagement/contractProgress.vue

@@ -61,6 +61,7 @@
       contract_amount:'',
       contract_type:'',
       has_payment:'',
+      actual_pay_companies:'',
       relate_contract_code:'',
       actual_company_name:'',
       sign_date:'',
@@ -543,6 +544,7 @@
       contract_amount:'',
       contract_type:'',
       has_payment:'',
+      actual_pay_companies:'',
       relate_contract_code:'',
       actual_company_name:'',
       sign_date:'',
@@ -594,8 +596,8 @@
       }
       contractInfo.form.relate_contract_code=''
     }else{
-      // 代付
       contractInfo.form.has_payment=''
+      // contractInfo.form.payment_companys=''
     }
   }
 
@@ -721,6 +723,8 @@
     contractInfo.contractValidityDate=[selectItem.start_date,selectItem.end_date]
     contractInfo.form.contract_amount=selectItem.price
     contractInfo.form.seller_id=selectItem.seller_id
+    contractInfo.form.has_payment=selectItem.actual_pay_companies?1:0
+    contractInfo.form.actual_pay_companies=selectItem.actual_pay_companies
     contractInfo.form.seller_ids=selectItem.seller_id+''
     contractInfo.form.contract_type=selectItem.contract_type_key
     contractInfo.form.relate_contract_code=contractInfo.form.contract_type==3 || contractInfo.form.contract_type==4?selectItem.relate_contract_code:''
@@ -744,6 +748,7 @@
     contractInfo.showServiceQy = selectItem.product_id == 2
 
   }
+
   // 销售选中
   const selectSeller=(value)=>{
     contractInfo.form.seller_ids=value+''
@@ -1096,8 +1101,11 @@
         }
         // contractInfo.form.service_amount = [{product_id:1,service_amount:contractInfo.form.services_amount},
         // {product_id:2,service_amount:contractInfo.form.services_Qy_amount}]
-        if(!contractInfo.form.has_payment) contractInfo.form.has_payment=0
-        // console.log(contractInfo.form);
+        if(!contractInfo.form.has_payment){
+          contractInfo.form.has_payment=0
+          contractInfo.form.actual_pay_companies=''
+        }
+        console.log(contractInfo.form);
         // 检验合同名称或者合同有效期是否重复
         if(contractInfo.form.contract_register_id){
           // 编辑
@@ -1323,6 +1331,7 @@
         contract_amount:res.data.contract_amount,
         contract_type:res.data.contract_type,
         has_payment:res.data.has_payment,
+        actual_pay_companies:res.data.actual_pay_companies,
         relate_contract_code:res.data.relate_contract_code,
         actual_company_name:res.data.actual_company_name,
         sign_date:res.data.sign_date,
@@ -1603,12 +1612,22 @@
                         </el-select>
                       </el-form-item>
                       <el-form-item label="是否代付" prop="has_payment" v-if="[1,2,4].includes(contractInfo.form.contract_type)">
-                        <el-radio-group v-model="contractInfo.form.has_payment" 
+                        <el-radio-group v-model="contractInfo.form.has_payment"
                         style="min-width:286px;width: 15vw;">
                           <el-radio :label="1">是</el-radio>
                           <el-radio :label="0">否</el-radio>
                         </el-radio-group>
                       </el-form-item>
+                      <el-form-item label="代付方" prop="actual_pay_companies" v-if="contractInfo.form.has_payment==1"
+                      :rules="contractInfo.form.contract_source==0?{required:true,message:'代付方信息不能为空',trigger:'blur'}:{}">
+                        <div v-overflowTooltip="'#overflow-input'">
+                          <el-tooltip placement="top" :content="contractInfo.form.actual_pay_companies" 
+                          :trigger-keys="['Enter']" :disabled="false">
+                            <el-input v-model="contractInfo.form.actual_pay_companies" :disabled="contractInfo.form.contract_source==0?false:true"
+                            placeholder="请输入代付方信息" id="overflow-input" />
+                          </el-tooltip>
+                        </div>
+                      </el-form-item>
                       <el-form-item label="实际使用方" prop="actual_company_name" v-if="contractInfo.form.contract_type==3">
                         <el-input v-model="contractInfo.form.actual_company_name" 
                         placeholder="请输入实际使用方" />

+ 1 - 1
src/views/financialStatistics/commodityPayment.vue

@@ -498,7 +498,7 @@ const moment = inject('$moment')
       margin-left: -30px;
       display: flex;
       align-items: center;
-      flex-wrap: wrap; 
+      flex-wrap: wrap;
       .search-item{
         width: 200px;
         margin: 0 0 8px 30px;