Browse Source

合同下手动添加设备的编辑

chenj 1 week ago
parent
commit
d0c9170e95

+ 1 - 1
RuoYi-Vue-fast-master/src/main/resources/application-druid.yml

@@ -24,7 +24,7 @@ spring:
       # 主库数据源
       master:
         # 本地开发环境
-        url: jdbc:mysql://rm-uf62e36t771a0f9yoao.mysql.rds.aliyuncs.com:3306/koyo_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
+        url: jdbc:mysql://rm-uf62e36t771a0f9yoao.mysql.rds.aliyuncs.com:3306/koyo_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true&allowMultiQueries=true
         username: koyo_admin_user
         password: Gold@1234
 #        url: jdbc:mysql://223.113.228.198:3306/koyo_2rd?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8

+ 56 - 40
ruoyi-ui-vue2/src/views/contract/edit.vue

@@ -9,9 +9,9 @@
         <el-button  @click="cancel" icon="el-icon-remove-outline">
           {{ $t('common.cancel') }}
         </el-button>
-<!--        <el-button v-if="type == 'view'" icon="el-icon-arrow-left" plain size="mini" @click="cancel">-->
-<!--          {{ $t('common.back') }}-->
-<!--        </el-button>-->
+        <!--        <el-button v-if="type == 'view'" icon="el-icon-arrow-left" plain size="mini" @click="cancel">-->
+        <!--          {{ $t('common.back') }}-->
+        <!--        </el-button>-->
       </div>
     </div>
 
@@ -124,7 +124,6 @@
               <el-form-item prop="amount" :label="$t('contract.amount')"  :maxlength="100" >
                 <MoneyInput  v-model="form.amount" @change="item=>valueAmount(item)" :inputValue="form.amount" :zeroLength="2" :style="{width:disableFlag ? '16vw' : '80%'}" placeholder="请输入合同金额" :disabled="disableFlag" class="money-input-class"></MoneyInput>
               </el-form-item>
-
             </el-col>
             <el-col :span="8">
               <!-- 签单日期 -->
@@ -282,7 +281,7 @@
 
             <el-table-column v-if="type != 'view'" :label="$t('common.operate')" width="150px" fixed="right" align="center">
               <template slot-scope="scope">
-                <el-button size="mini" v-if="scope.row.origin == 1" type="text" icon="el-icon-edit" @click="equipmentEdit(scope.row)">{{ "编辑" }}</el-button>
+                <el-button size="mini" v-if="scope.row.origin == 1" type="text" icon="el-icon-edit" @click="equipmentEdit(scope.row,scope.$index)">{{ "编辑" }}</el-button>
                 <el-button size="mini" v-if="!disableFlag" type="text" icon="el-icon-delete" @click="equipmentDelete(scope.$index)">{{ "删除" }}</el-button>
               </template>
             </el-table-column>
@@ -334,7 +333,7 @@
           </div>
         </div>
       </div>
-    <FollowDialog ref="followDialog"></FollowDialog>
+      <FollowDialog ref="followDialog"></FollowDialog>
     </div>
     <!--选择报价单dialog-->
     <el-dialog :close-on-click-modal="false" :title="$t('lift.pleaseSelectQuotation')" :visible.sync="quotationOpen"
@@ -448,7 +447,7 @@
           <el-col :span="12">
             <!-- 单价-->
             <el-form-item prop="unitPrice" :label="$t('lift.unitPrice')" :disabled="readOnly"  width="100%" >
-                  <MoneyInput v-model="equipmentForm.amount" @change="item=>valueUnit(item)" :inputValue="equipmentForm.unitPrice" :zeroLength="2" :placeholder="'请输入单价'" class="money-input-class" ></MoneyInput>
+              <MoneyInput v-model="equipmentForm.amount" @change="item=>valueUnit(item)" :inputValue="equipmentForm.unitPrice" :zeroLength="2" :placeholder="'请输入单价'" class="money-input-class" ></MoneyInput>
             </el-form-item>
 
           </el-col>
@@ -547,13 +546,13 @@
             </template>
           </Column>
           <!--附加费用-->
-<!--          <Column :label="$t('lift.additionalCost')" prop="additionalCost" align="right">-->
-<!--            <template slot-scope="{row}">-->
-<!--              <span >-->
-<!--                <span>{{ toDecimal2(numFormat(row.additionalCost)) }}</span>-->
-<!--              </span>-->
-<!--            </template>-->
-<!--          </Column>-->
+          <!--          <Column :label="$t('lift.additionalCost')" prop="additionalCost" align="right">-->
+          <!--            <template slot-scope="{row}">-->
+          <!--              <span >-->
+          <!--                <span>{{ toDecimal2(numFormat(row.additionalCost)) }}</span>-->
+          <!--              </span>-->
+          <!--            </template>-->
+          <!--          </Column>-->
 
           <Column label="总价" prop="liftAmount" align="right">
             <template slot-scope="{row}">
@@ -604,10 +603,11 @@ import {align} from "quill/ui/icons";
 import {getProjectName} from "@/api/business/crm/project";
 import {addContract, getContractById, updateContract} from "@/api/contract/contract";
 import {listLift} from "@/api/contract/lift";
-import {delcommafy} from "@/utils/money";
+import {comdify, delcommafy} from "@/utils/money";
 import {getContractHistory4Contract, listContractHistory} from "@/api/contract/contractHistory";
 import {getI18nDictName} from "../../utils/dict/DictFind";
 import {getAccountByAgent} from "@/api/business/crm/account";
+import Vue from "vue";
 
 export default {
   name: "contractEdit",
@@ -623,7 +623,8 @@ export default {
       type: '',
       form: {
         file: "",
-        leadIds: []
+        leadIds: [],
+        amount:0
       },
       rules: {
         amount: [
@@ -714,16 +715,17 @@ export default {
       additionalCostForm:{},
       additionalCostList:[],
       tableLoading:false,
-      contractHistory:{}
+      contractHistory:{},
+      currentEquipmentRow:{},
     };
   },
 
   watch:{
     form(newValue,oldValue){
       if(newValue)
-      if(newValue.agentId !== oldValue.agentId){
-        this.changeAgentId()
-      }
+        if(newValue.agentId !== oldValue.agentId){
+          this.changeAgentId()
+        }
     },
 
   },
@@ -940,7 +942,7 @@ export default {
     selectQuotation() {
       if(this.quotationList.length ===  0){
         //该代理商未找到对应的报价单
-          this.$message.error(this.$t('lift.agentNotExistQuotation'))
+        this.$message.error(this.$t('lift.agentNotExistQuotation'))
       }else {
         //选择报价单
         this.resetUserQueryParams()
@@ -950,6 +952,7 @@ export default {
     },
     /**手动添加 */
     manuallyAdd(){
+      this.equipmentForm = {}
       this.resetEquipmentSubmitForm()
       if(!this.form.agentId && this.form.agentId != 0 ){
         //请选择代理商
@@ -971,6 +974,7 @@ export default {
       if (this.contractId !== null) {
         await getContractHistory4Contract(this.contractId).then(response => {
           this.form = response.data;
+          this.form.amount = comdify(delcommafy(this.form.amount), 2);
           this.equipmentList = response.data.tqContractLiftHistoryList
         });
       }
@@ -980,6 +984,7 @@ export default {
       if (this.contractId !== null) {
         await getContractById(this.contractId).then(response => {
           this.form = response.data;
+          this.form.amount = comdify(delcommafy(this.form.amount), 2);
           if(this.form.contractNo && this.type != 'history'){
             //获取履历信息
             listContractHistory({contractNo:this.form.contractNo}).then(resHis=>{
@@ -997,8 +1002,6 @@ export default {
             }
           })
         });
-
-
       }
     },
     /** 合同提交按钮 */
@@ -1019,8 +1022,8 @@ export default {
         this.$message.error("设备不能为空!")
         return;
       }
-
-
+      //将金额中的千分位符号恢复
+      this.form.amount = delcommafy(this.form.amount)
       this.$refs["form"].validate(async valid => {
         if (valid) {
           this.submitLoading = true;
@@ -1077,13 +1080,16 @@ export default {
     },
 
     /**设备一览修改*/
-    equipmentEdit(row){
+    equipmentEdit(row,index){
       //编辑设备
       this.equipmentTitle = "编辑设备"
       // this.resetEquipmentSubmitForm()
       console.log("row===============================>",row)
       this.equipmentOpen = true
-      this.equipmentForm = row
+      //记录当前行
+      row.index = index
+      //将当前行内容赋值给编辑表
+      this.equipmentForm = {...row}
     },
 
     /**设备一览删除*/
@@ -1143,7 +1149,7 @@ export default {
     equipmentSubmitForm(){
       this.$refs["equipmentForm"].validate(async valid => {
         if(valid){
-          if(this.equipmentList.includes(this.equipmentForm)){
+          if(this.equipmentForm.origin  == 1){
             console.log("编辑")
             this.equipmentForm.liftAmount = this.equipmentForm.unitPrice+ this.equipmentForm.additionalCost
             if(this.equipmentForm.count > 1){
@@ -1153,21 +1159,29 @@ export default {
               }
               this.$set(this.equipmentForm,"count",1)
             }
+            this.$nextTick(() => {
+              Vue.set(this.equipmentList, this.equipmentForm.index, this.equipmentForm)
+              // this.equipmentList[this.equipmentForm.index] = { ...this.equipmentForm }
+            })
+            console.log("this.equipmentList=========>",this.equipmentList)
+            console.log("this.equipmentList[this.equipmentForm.index]=========>",this.equipmentList[this.equipmentForm.index])
+            console.log("this.equipmentForm.index======>",this.equipmentForm.index)
+            console.log("this.equipmentForm======>",this.equipmentForm)
             //编辑成功
             this.$message.success(this.$t('common.editSuccess'))
           }else{
             console.log("新增")
             this.$set(this.equipmentForm,"origin",1)
             for (let i = 0; i < this.equipmentForm.count; i++) {
-                this.equipmentList.push({...this.equipmentForm, count: 1,additionalCost:0.00,
-                  liftAmount:this.equipmentForm.unitPrice,
-                  otherFees :0.00,
-                  reviewCommission:0.00,
-                  reviewShippingCosts :0.00,
-                  planOceanFreight :0.00,
-                  planInlandFreightCost:0.00
-                });
-                console.log("this.equipmentList=================>",this.equipmentList)
+              this.equipmentList.push({...this.equipmentForm, count: 1,additionalCost:0.00,
+                liftAmount:this.equipmentForm.unitPrice,
+                otherFees :0.00,
+                reviewCommission:0.00,
+                reviewShippingCosts :0.00,
+                planOceanFreight :0.00,
+                planInlandFreightCost:0.00
+              });
+              console.log("this.equipmentList=================>",this.equipmentList)
             }
             //添加成功
             this.$message.success(this.$t('common.addSuccess'))
@@ -1178,7 +1192,7 @@ export default {
 
     },
     equipmentCancel(){
-     this.equipmentOpen = false
+      this.equipmentOpen = false
     },
     //重置设备一览的form表
     resetEquipmentSubmitForm() {
@@ -1326,7 +1340,7 @@ export default {
         } else {
           this.userSelectionListNowSet.forEach(item => {
             if (!this.equipmentList.find(target => {
-                return target.elevatorCode+target.quotationNoVersion === target.elevatorCode+item.quotationNoVersion
+              return target.elevatorCode+target.quotationNoVersion === target.elevatorCode+item.quotationNoVersion
             })) {
               this.equipmentList.unshift(item);
             }
@@ -1369,7 +1383,7 @@ export default {
             sums[7] = this.toDecimal2(this.numFormat(Number(delcommafy(sums[7])))) || 0.00
           }
           if(index === 12){
-            sums[12] = this.toDecimal2(this.numFormat(sums[12])) || 0.00
+            sums[12] = this.toDecimal2(this.numFormat(Number(sums[12]))) || 0.00
           }
         }
 
@@ -1377,7 +1391,9 @@ export default {
       return sums;
     },
     valueAmount(value){
+      // this.$nextTick(() => {
       this.$set(this.form,'amount',value)
+      // })
     },
     valueUnit(value){
       this.$set(this.equipmentForm,'unitPrice',value)