From b2c2a77b5632b7e5f29a6cdce816bd977bc8604d Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期四, 25 四月 2024 16:33:53 +0800 Subject: [PATCH] 车间管理 修改完成之后,再次打开 爆红的问题修改+新建薪资方案的前端开发+ --- src/views/systemSetting/silkStandardSetting/components/silkTableList.vue | 1 src/assets/style/index.scss | 14 + src/api/data.js | 7 src/views/employeeSalary/salaryPlan/components/SilkSetDialog.vue | 106 +++++++++++++ src/views/systemSetting/workshopManage/components/addDialog.vue | 9 + src/views/employeeSalary/salaryPlan/components/bomDialog.vue | 4 src/views/employeeSalary/salaryPlan/components/ConstantSetDialog.vue | 149 ++++++++++++++++++ src/views/employeeSalary/salaryPlan/components/addDialog.vue | 132 ++++++++++++++- 8 files changed, 405 insertions(+), 17 deletions(-) diff --git a/src/api/data.js b/src/api/data.js index 815656d..def6c5e 100644 --- a/src/api/data.js +++ b/src/api/data.js @@ -12,10 +12,17 @@ { id: 3, value: "浼戝亣" }, { id: 4, value: "寮傚父" }, ] +const silkSet=[ + { id: 1, value: "閲庣氦" }, + { id: 2, value: "澶ч噹" }, + { id: 3, value: "鐗归噹" }, +] export const getDataByType = (type) => { if (type == "projectOptions") { return projectOptions }else if(type=='attendanceStatus'){ return attendanceStatus + }else if(type=='silkSet'){ + return silkSet; } } diff --git a/src/assets/style/index.scss b/src/assets/style/index.scss index e9288e6..f79a476 100644 --- a/src/assets/style/index.scss +++ b/src/assets/style/index.scss @@ -123,6 +123,9 @@ .font_size_40 { font-size: 40px !important; } +.color_fff { + color: #fff; +} .color_333 { color: #333; } @@ -144,6 +147,17 @@ .background_blue{ background: #2a78fb; } +.background_e3e3e3{ + background: #e3e3e3; +} +.background_red{ + background: red; +} +.formula-input-item{ + padding:3px 8px; + font-size:12px; + margin-right:3px; +} .cursor_pointer { cursor: pointer; } diff --git a/src/views/employeeSalary/salaryPlan/components/ConstantSetDialog.vue b/src/views/employeeSalary/salaryPlan/components/ConstantSetDialog.vue new file mode 100644 index 0000000..9e5dba2 --- /dev/null +++ b/src/views/employeeSalary/salaryPlan/components/ConstantSetDialog.vue @@ -0,0 +1,149 @@ +<template> + <el-dialog :close-on-click-modal="false" :visible.sync="islook" width="35rem" class="add-rule-set-dialog" + @close="shutdown"> + <div slot="title" class="tac drawerHeader">{{ title }}</div> + <div class="dialog-content-box"> + <el-form ref="form" class="form-box" :rules="rules" + :model="form" + label-width="150px" + label-position="right"> + <el-form-item v-if="constType==2" label="缂哄嫟瓒呰繃" label-width="100px" prop="cycle"> + + <el-input + style="width:calc(100% - 150px)" + class="margin_left_5px margin_right_5px" + v-model="form.cycle" + placeholder="璇疯緭鍏�"></el-input> + 澶╁垯婊″嫟濂栧叏棰濇墸闄� + </el-form-item> + <el-form-item v-if="constType==3" label="璇疯緭鍏ュ父閲忔暟鍊�" label-width="150px" prop="number"> + <el-input + v-model="form.number" + class="margin_left_5px" + placeholder="璇疯緭鍏�"></el-input> + </el-form-item> + </el-form> + </div> + <div slot="footer" class="dialog-footer tac"> + <el-button @click="shutdown">鍙栨秷</el-button> + <el-button type="primary" @click="onSubmit(form)">纭畾</el-button> + </div> + </el-dialog> +</template> + +<script> +export default { + props: { + constType:{ + type:[Number,String], + default:'' + }, + title:{ + type:[String,Number], + default:'' + }, + editRow:{ + type:[Object], + } + }, + data() { + return { + islook: false, + form: { + cycle:1, + number:'', + }, + rules: { + cycle: [ + { + required: true, + message: "璇疯緭鍏�", + trigger: "blur", + }, + { + validator: this.validatorNum, + trigger: "blur", + }, + ], + number: [ + { + required: true, + message: "璇疯緭鍏�", + trigger: "blur", + }, + { + validator: this.validatorNum, + trigger: "blur", + }, + ], + }, + procedureIdsList: [], + }; + }, + mounted() { + }, + watch: { + islook(newVal) { + if (newVal) { + this.$nextTick(() => { + this.$refs["form"].resetFields(); + }); + this.form.cycle=this.editRow.cycle + this.form.number=null + } + }, + }, + methods: { + validatorNum(rule, value, callback) { + if (value) { + if (value == undefined || value == null) { + callback(new Error("璇疯緭鍏ユ湁鏁堟暟瀛�")); + } else { + let reg2 = + /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/; + if (!reg2.test(value)) { + callback(new Error("璇峰~鍐�2浣嶅皬鏁扮殑鏁板瓧")); + } else { + callback(); + } + } + } else { + callback(); + } + }, + onSubmit() { + this.$refs.form.validate((valid) => { + if (valid) { + this.$emit('confirmValueSave',this.form,this.constType) + this.shutdown() + } + }); + }, + shutdown() { + this.islook = false; + }, + }, +}; +</script> + +<style lang="scss" scoped> +.add-rule-set-dialog { + .form-box { + width:94%; + .el-form-item { + width: 100%; + .el-radio{ + height:40px; + line-height:40px; + } + } + } +} + + +::v-deep .el-input__inner { + font-size: 13px !important; + color: rgba(0, 0, 0, 0.9); + text-align: left; +} +</style> diff --git a/src/views/employeeSalary/salaryPlan/components/SilkSetDialog.vue b/src/views/employeeSalary/salaryPlan/components/SilkSetDialog.vue new file mode 100644 index 0000000..5ec9a12 --- /dev/null +++ b/src/views/employeeSalary/salaryPlan/components/SilkSetDialog.vue @@ -0,0 +1,106 @@ +<template> + <el-dialog :close-on-click-modal="false" :visible.sync="islook" width="35rem" class="add-rule-set-dialog" + @close="shutdown"> + <div slot="title" class="tac drawerHeader">{{ title }}</div> + <div class="dialog-content-box"> + <el-form ref="form" class="form-box" :rules="rules" + :model="form" + label-width="300px" + label-position="top"> + <el-form-item label="璇烽�夋嫨閲庣氦鍖呭惈閭e嚑涓敓涓濇爣鍑嗭細" prop="purchaseTypeList"> + <el-checkbox-group v-model="form.purchaseTypeList"> + <el-checkbox + v-for="item in silkSetList" + :label="item.id" + :key=item.id + >{{ item.value }}</el-checkbox + > + </el-checkbox-group> + </el-form-item> + </el-form> + </div> + <div slot="footer" class="dialog-footer tac"> + <el-button @click="shutdown">鍙栨秷</el-button> + <el-button type="primary" @click="onSubmit(form)">纭畾</el-button> + </div> + </el-dialog> +</template> + +<script> +import { getDataByType } from "@/api/data" +export default { + props: { + title:{ + type:[String,Number], + default:'' + }, + editRow:{ + type:[Object], + } + }, + data() { + return { + islook: false, + silkSetList:getDataByType('silkSet'), + form: { + purchaseTypeList:[1], + }, + rules: { + // 閲囪喘绫诲瀷 + purchaseTypeList: [ + { required: true, message: "璇烽�夋嫨", trigger: ["blur",'change'] }, + ], + }, + procedureIdsList: [], + }; + }, + mounted() { + }, + watch: { + islook(newVal) { + if (newVal) { + this.$nextTick(() => { + this.$refs["form"].resetFields(); + }); + this.form=this.editRow + } + }, + }, + methods: { + onSubmit() { + this.$refs.form.validate((valid) => { + if (valid) { + this.$emit('confirmValueSave',this.form,1) + this.shutdown() + } + }); + }, + shutdown() { + this.islook = false; + }, + }, +}; +</script> + +<style lang="scss" scoped> +.add-rule-set-dialog { + .form-box { + width:93%; + margin: 0 auto; + .el-form-item { + width: 100%; + .el-radio{ + height:40px; + line-height:40px; + } + } + } +} + + +::v-deep .el-input__inner { + font-size: 13px !important; + color: rgba(0, 0, 0, 0.9); + text-align: left; +} +</style> diff --git a/src/views/employeeSalary/salaryPlan/components/addDialog.vue b/src/views/employeeSalary/salaryPlan/components/addDialog.vue index aa2a3bc..cd33fac 100644 --- a/src/views/employeeSalary/salaryPlan/components/addDialog.vue +++ b/src/views/employeeSalary/salaryPlan/components/addDialog.vue @@ -56,15 +56,21 @@ ></i> </el-form-item> <el-form-item prop="salaryFormula" label="璁¤垂鍏紡瀹氫箟"> - <el-input + <!-- <el-input type="textarea" :autosize="{ minRows: 4, maxRows: 6}" disabled placeholder="璇疯緭鍏ュ唴瀹�" v-model="form.salaryFormula" > - </el-input> + </el-input> --> + <div class="formula-input" v-html="form.salaryFormula"></div> + <el-button class='formula-btn' type="text" @click="checkFormula()">妫�鏌ュ叕寮�</el-button> </el-form-item> + <div class="formula-error" > + <span v-if="form.error==1"> 鏃犻敊璇紝鍙斁蹇冧娇鐢� ! </span> + <span v-if="form.error==2"> 鍏紡鏈夐敊璇紝璇锋鏌� ! </span> + </div> <div class="formula-box"> <div class="table-bottom-tabs"> <div @@ -93,12 +99,24 @@ <div class="formula-p">鍙�夋暟鎹�</div> <div class="formula-bottom" v-if="activeName==1"> <div :class="item.width==2?'formula-item-100':'formula-item'" v-for='item in formulaName' :key="item.name"> - <span @click="formulaClick(item)"> {{ item.name }}</span> + <span @click="formulaClick(item)"> {{ item.name }}</span> + <i + v-if="item.type==1" + class="el-icon-setting margin_left_5px cursor_pointer" + style="font-size: 18px; color: gray" + @click="handleSlikSetShow" + ></i> </div> </div> <div class="formula-bottom" v-if="activeName==2"> <div :class="item.width==2?'formula-item-100':'formula-item'" v-for='item in formulaNameTwo' :key="item.name"> <span @click="formulaClick(item)"> {{ item.name }}</span> + <i + v-if="item.type==2" + class="el-icon-setting margin_left_5px cursor_pointer" + style="font-size: 18px; color: gray" + @click="handleConstSetShow(2)" + ></i> </div> </div> </div> @@ -106,7 +124,8 @@ <div class="formula-p">甯哥敤绗﹀彿/浜ч噺</div> <div class="formula-bottom"> <div :class="item.width==2?'formula-item-100':'formula-item'" v-for='item in formulaSymbol' :key="item.name"> - <span @click="formulaClick(item)"> {{ item.name }}</span> + <span v-if="item.type==3" @click="handleConstSetShow(3)"> {{ item.name }}</span> + <span v-else @click="formulaClick(item)"> {{ item.name }}</span> </div> </div> </div> @@ -124,6 +143,19 @@ :workList="unitList" title="璁¢噺鍗曚綅" ></BomDialog> + <SilkSetDialog + ref="silkSetDialog" + @confirmValueSave="confirmValueSave" + :editRow="form" + title="閰嶇疆" + ></SilkSetDialog> + <ConstantSetDialog + ref="constantSetDialog" + @confirmValueSave="confirmValueSave" + :constType="constType" + :editRow="form" + :title="constType==2?'閰嶇疆':'杈撳叆'" + ></ConstantSetDialog> </div> </template> @@ -135,8 +167,14 @@ } from "@/api/employeeSalary/salaryPlan.js"; import { getWorkTypeList } from "@/api/employeeManage/employeeInfo.js"; import BomDialog from "@/views/employeeSalary/salaryPlan/components/bomDialog.vue"; +import SilkSetDialog from "@/views/employeeSalary/salaryPlan/components/SilkSetDialog.vue"; +import ConstantSetDialog from "@/views/employeeSalary/salaryPlan/components/ConstantSetDialog.vue"; export default { - components: { BomDialog }, + components: { + BomDialog, + SilkSetDialog, + ConstantSetDialog + }, props: { editRow: { type: Object, @@ -144,12 +182,15 @@ }, data() { return { - islook: true, + islook: false, form: { name: "", workTypes: [], salaryType: "", salaryFormula: "", + error:'', + purchaseTypeList:[1], + cycle:1, }, activeName: 1, formulaName:[ @@ -187,7 +228,7 @@ }, { name:'婊″嫟濂�', - type:1, + type:2, }, { name:'浼戞伅鏃ュ姞鐝椂闀�', @@ -208,15 +249,19 @@ formulaSymbol:[ { name:'+', + background:'background_red', }, { name:'-', + background:'background_red', }, { name:'/', + background:'background_red', }, { name:'*', + background:'background_red', }, { name:'(', @@ -226,7 +271,7 @@ }, { name:'甯搁噺鏁板瓧', - type:1, + type:3, width:2 }, ], @@ -250,6 +295,7 @@ ], }, unitList: [], + constType:'', }; }, computed: {}, @@ -271,6 +317,43 @@ methods: { tabClickBottom(activeName) { this.activeName = activeName; + }, + // 鐐瑰嚮鐢熶骇鏁版嵁鍜岃�冨嫟鍙婅ˉ璐存暟鎹� 璧嬪�艰璐瑰叕寮忓畾涔� + formulaClick(item,value){ + let string='' + let name=(item.type==3&&item.name=='甯搁噺鏁板瓧')?value:item.name + if(item.background){ + string="<span class='formula-input-item background_red color_fff'>"+ name +"</span>" + }else{ + string="<span class='formula-input-item background_e3e3e3'>"+ name +"</span>" + } + this.form.salaryFormula= this.form.salaryFormula+string; + this.$forceUpdate() + }, + checkFormula(){ + + }, + confirmValueSave(form,type){ + if(type==1){ + this.form.purchaseTypeList=form.purchaseTypeList; + }else if(type==2){ + this.form.cycle=form.cycle + }else if(type==3){ + this.formulaClick({ + name:'甯搁噺鏁板瓧', + type:3, + width:2 + },form.number) + } + }, + // 閲庣氦鏁伴噺 + handleSlikSetShow(){ + this.$refs.silkSetDialog.islook = true; + }, + // 婊″嫟濂� + handleConstSetShow(val){ + this.constType=val; + this.$refs.constantSetDialog.islook = true; }, // 鍗曚綅 handleUnitShow() { @@ -304,15 +387,14 @@ workTypes: [], salaryType: "", salaryFormula: "", + error:'', + purchaseTypeList:[1], + cycle:1, }; this.$nextTick(() => { this.$refs["form"].resetFields(); if (this.editRow.id) { this.form = JSON.parse(JSON.stringify(this.editRow)); - this.form.groupNumber = this.form.groupNumber - ? this.form.groupNumber - : null; - this.getGroupNumber(true); } }); } @@ -339,6 +421,10 @@ this.$refs[formName].validate((valid) => { if (valid) { let form = JSON.parse(JSON.stringify(this.form)); + if(form.purchaseTypeList.length==0){ + this.$message.error('璇风偣鍑婚噹绾ゆ暟閲忛厤缃敓涓濇爣鍑嗭紒') + return true; + } saveSalaryPlan(form).then((res) => { if (res.code == 200) { this.$message({ @@ -372,6 +458,7 @@ width:100%; height:auto; overflow:hidden; + margin-bottom:30px; .formula-p{ line-height:40px; } @@ -412,8 +499,27 @@ overflow:hidden; } } - } + .formula-input{ + width:calc(100% - 100px); + height:100px; + padding:10px 10px; + overflow-y:auto; + background:#F5F7FA; + border:1px solid #E4E7ED; + cursor:not-allowed; + float:left; + margin-right:20px; + } + .formula-btn{ + float:left; + margin-top:80px; + } + .formula-error{ + width:100%; + line-height:28px; + font-size:12px; + } } ::v-deep { diff --git a/src/views/employeeSalary/salaryPlan/components/bomDialog.vue b/src/views/employeeSalary/salaryPlan/components/bomDialog.vue index c2fbb38..dc2cbb9 100644 --- a/src/views/employeeSalary/salaryPlan/components/bomDialog.vue +++ b/src/views/employeeSalary/salaryPlan/components/bomDialog.vue @@ -38,7 +38,7 @@ <i class="el-icon-delete cursor_pointer" id="iconStyle" - @click="handleDelete(scope.row.id, scope)" + @click="handleDelete(scope)" ></i> </template> </el-table-column> @@ -102,7 +102,7 @@ }, 500); }); }, - handleDelete(id, scope) { + handleDelete(scope) { if (this.BomTableData.length === 1) { this.$message.warning("鑷冲皯淇濈暀涓�鏉℃暟鎹�"); return; diff --git a/src/views/systemSetting/silkStandardSetting/components/silkTableList.vue b/src/views/systemSetting/silkStandardSetting/components/silkTableList.vue index bc3226f..5881827 100644 --- a/src/views/systemSetting/silkStandardSetting/components/silkTableList.vue +++ b/src/views/systemSetting/silkStandardSetting/components/silkTableList.vue @@ -47,7 +47,6 @@ } " ></el-input> - {{item.prop}} <div class="common-select-btn" @click="clearupColumn(item.prop,i)"> <i class="el-icon-remove" title="鍒犻櫎"></i> </div> diff --git a/src/views/systemSetting/workshopManage/components/addDialog.vue b/src/views/systemSetting/workshopManage/components/addDialog.vue index 6135db5..06b7048 100644 --- a/src/views/systemSetting/workshopManage/components/addDialog.vue +++ b/src/views/systemSetting/workshopManage/components/addDialog.vue @@ -138,7 +138,14 @@ }, watch: { - + 'editConfig.visible'(newVal) { + if (newVal) { + this.$nextTick(()=>{ + this.$refs["ruleForm"].resetFields(); + this.editConfig=this.editDiaConfig + }) + } + }, }, methods: { handleClose(done) { -- Gitblit v1.8.0