From 1ded895492d34003c7c12611615fce3a466ea5d2 Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期五, 26 四月 2024 14:32:40 +0800 Subject: [PATCH] 薪资方案列表联调字段调试+处计费公式定义数据形式用列表显示+删薪资方案接口联调+保存薪资方案接口联调 --- src/views/employeeSalary/salaryPlan/components/addDialog.vue | 79 ++++++++++++++++++++++++++++----------- 1 files changed, 57 insertions(+), 22 deletions(-) diff --git a/src/views/employeeSalary/salaryPlan/components/addDialog.vue b/src/views/employeeSalary/salaryPlan/components/addDialog.vue index 17dd835..fcf5242 100644 --- a/src/views/employeeSalary/salaryPlan/components/addDialog.vue +++ b/src/views/employeeSalary/salaryPlan/components/addDialog.vue @@ -341,6 +341,46 @@ tabClickBottom(activeName) { this.activeName = activeName; }, + formInfo() { + if (this.islook) { + this.form = { + name: "", + workTypes: [], + salaryType: "", + salaryFormula: "", + salaryFormulaHtml: "", + error: "", + purchaseTypeList: [1], + cycle: '1', + }; + this.$nextTick(() => { + this.$refs["form"].resetFields(); + if (this.editRow.id) { + this.form = JSON.parse(JSON.stringify(this.editRow)); + let salaryFormula=this.form.salaryFormula?this.form.salaryFormula:'' + this.form.salaryFormulaHtml='' + this.form.salaryFormula='' + this.form.purchaseTypeList =[1] + let arr=salaryFormula?salaryFormula.split('锛�'):[] + let formulaNameArr=this.formulaName.concat(this.formulaNameTwo).concat(this.formulaSymbol) + if(arr.length>0){ + for(let i in arr){ + for(let j in formulaNameArr){ + let reg2 = + /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/; + if (reg2.test(arr[i])) { + this.formulaClick({ name: "甯搁噺鏁板瓧", type: 3, width: 2, },arr[i]); + }else if(formulaNameArr[j].name==arr[i]){ + this.formulaClick(formulaNameArr[j]) + } + } + } + } + + } + }); + } + }, // 鐐瑰嚮鐢熶骇鏁版嵁鍜岃�冨嫟鍙婅ˉ璐存暟鎹� 璧嬪�艰璐瑰叕寮忓畾涔� formulaClick(item, value) { let string = ""; @@ -414,9 +454,9 @@ } if (!string) { - this.form.error = 2; + this.$set(this.form,'error',2) } else { - this.form.error = 1; + this.$set(this.form,'error',1) } } }, @@ -470,26 +510,6 @@ this.unitList = res.data; }); }, - formInfo() { - if (this.islook) { - this.form = { - name: "", - workTypes: [], - salaryType: "", - salaryFormula: "", - salaryFormulaHtml: "", - error: "", - purchaseTypeList: [1], - cycle: '1', - }; - this.$nextTick(() => { - this.$refs["form"].resetFields(); - if (this.editRow.id) { - this.form = JSON.parse(JSON.stringify(this.editRow)); - } - }); - } - }, getSelectDataList() { getWorkTypeList({ page: 0, @@ -511,6 +531,11 @@ submitForm(formName) { this.$refs[formName].validate((valid) => { if (valid) { + this.checkFormula() + if(this.form.error==2){ + this.$message.error("璇锋鏌ヨ璐瑰叕寮忓畾涔夛紒"); + return true; + } let form = JSON.parse(JSON.stringify(this.form)); let arr = form.salaryFormula.split("锛�"); arr=arr.splice(0,arr.length-1) @@ -519,6 +544,16 @@ this.$message.error("璇风偣鍑婚噹绾ゆ暟閲忛厤缃敓涓濇爣鍑嗭紒"); return true; } + let workTypes=[] + if(form.workTypes&&form.workTypes.length>0){ + for(let i in form.workTypes){ + workTypes.push({ + workName:form.workTypes[i].label, + id:form.workTypes[i].value + }) + } + } + form.workTypes=workTypes saveSalaryPlan(form).then((res) => { if (res.code == 200) { this.$message({ -- Gitblit v1.8.0