| | |
| | | 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 = ""; |
| | |
| | | } |
| | | |
| | | if (!string) { |
| | | this.form.error = 2; |
| | | this.$set(this.form,'error',2) |
| | | } else { |
| | | this.form.error = 1; |
| | | this.$set(this.form,'error',1) |
| | | } |
| | | } |
| | | }, |
| | |
| | | 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, |
| | |
| | | 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) |
| | |
| | | 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({ |