<style> .AS_UL li { list-style-type: none; display: inline-block; width: 117px; height: 52px; line-height: 52px; text-align: center; font-size: 14px; color: #333; margin-top: 20px; position: relative; float: left; cursor: pointer; background-color: #e9e9e9; } .AS_UL li i { position: absolute; display: inline-block; width: 26px; height: 3px; top: 40px; display: none; left: 45px; background-color: #e95252; } .AS_cked { background-color: #fff !important; } .AS_cked i { display: block !important; } .AS_content { width: 100%; min-height: 400px; background-color: #fff; } .AS_table { width: 99%; height: 100%; border-collapse: collapse; padding: 0 20px; font-size: 12px; text-align: center; margin: auto; border: 1px solid #d1d1d1; } .AS_table tbody tr { height: 60px; border-bottom: 1px solid #d1d1d1; } .AS_table tr th { height: 30px; line-height: 30px; background: #dcdcdc; /* text-align: left; */ padding-left: 10px; font-size: 12px; font-weight: 400; color: #333; } .AS_more { display: inline-block; width: 60px; height: 22px; border-radius: 4px; background-color: #e95252; color: #fff; text-align: center; line-height: 22px; } .AS_comGren { color: #059c5c; font-weight: bold; } .AS_header { position: relative; } .AS_header span { position: absolute; top: 7px; margin-left: 10px; } .AS_header img { width: 30px; height: 30px; border-radius: 50%; margin-left: -40px; } .AS_table .el-button.is-circle { padding: 5px; } .AS_Score { width: 120px; text-align: left; margin: auto; } .AS_zhidu { width: 98%; height: 410px; background-color: #fff; border-top: 1px solid #d1d1d1; position: absolute; bottom: 0; z-index: 999; } .AS_title { border-left: 3px solid #e95252; text-indent: 15px; height: 14px; display: inline-block; margin: 20px 0 0 20px; font-size: 14px; margin-bottom: 20px; line-height: 14px; color: #000; } .AS_zhidu .el-form-item__label { font-size: 12px; } .AS_zhiduTop { width: 100%; border-bottom: 1px dashed #dadada; padding-left: 30px; } .AS_addbtn { width: 30px; height: 30px; background-color: #dadada; border-radius: 50%; text-align: center; line-height: 30px; color: #fff; cursor: pointer; position: absolute; top: 5px; left: 170px; } .AS_addbtn:hover { background-color: #e95252; color: #fff; } .AS_rolesList { height: 202px; overflow: auto; border-bottom: 1px dashed #dadada; } .AS_rolesList::-webkit-scrollbar{ /*滚动条整体样式*/ width: 4px; /*高宽分别对应横竖滚动条的尺寸*/ height: 8px; } .AS_rolesList::-webkit-scrollbar-thumb { /*滚动条里面小方块*/ border-radius: 4px; -webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2); background: #c9c9c9; } .AS_rolesList::-webkit-scrollbar-track { /*滚动条里面轨道*/ -webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2); border-radius: 4px; background: #EDEDED; } .AS_Rlist { width: 260px; height: 160px; background-color: #e0f4ff; border-radius: 4px; margin: 20px 0 0 20px; font-size: 12px; float: left; } .AS_top { background-color: #cbe9fa; color: #175c82; font-size: 14px; height: 27px; line-height: 27px; padding: 0 10px; } .AS_delbtn { width: 37px; height: 17px; background-color: #5294b8; color: #b7ddf2; border-radius: 9px; font-size: 12px; float: right; margin-top: 5px; cursor: pointer; border: none; outline: none; } .AS_ruleInut { margin-left:10px; } .AS_ruleInut .el-input .el-input__inner, .AS_ruleInut .el-select .el-input { border-radius: 16px; height: 25px; } .AS_SaveBtn { margin: 20px; } .AS_content .query-box { border: 0; } ._ASDetails table tr._color_666 th { padding: 9px 15px; font-size:12px; } ._ASDetails table th{ background-color: #ededed; font-size:12px; } ._ASDetails table td{ background-color: #ffffff; padding: 9px 15px; font-size:12px; color: #333333; border: 1px solid #d2d2d2; } .AS_comList{text-decoration: underline;cursor: pointer;} .AS_ruleInut .el-form-item__label{width:47px!important;} .AS_ruleInut .el-form-item__content{margin-left:47px!important;} .AS_ruleInut .el-form-item{margin-bottom:0;} .AS_ROne .el-form-item{display:inline-block;} .AS_ROne .el-form-item:last-child .el-form-item__content{margin-left:0!important;} </style> <template> <div> <div> <ul class="AS_UL clearfix"> <li v-for="item in ConfigTypeList" :key="item.subCode" :class="{'AS_cked':systemList==item.Id}" @click="getSwitch(item.Id)">{{item.Name}}<i></i></li> </ul> <div class="AS_content"> <div class="query-box"> <ul> <li> <span> <em>{{$t('objFill.v101.administrative.zhiduxianmu')}}</em> <el-select class='w210' v-model="queryMsg.ItemId" filterable :placeholder="$t('pub.pleaseSel')"> <el-option :label="$t('pub.unlimitedSel')" :value='comSelect'></el-option> <el-option v-for='item in projectList' :key="item.ItemId" :label="item.ItemName" :value="item.ItemId"> </el-option> </el-select> </span> </li> <li> <span> <em>{{$t('fnc.sygongsi')}}</em> <el-select class='w210' v-model="queryMsg.QBranchId" filterable :placeholder="$t('pub.pleaseSel')"> <el-option :value="comPanySelect" :label="$t('pub.unlimitedSel')"></el-option> <el-option v-for='item in CompanyList' :key="item.Id" :label="item.BName" :value="item.Id"> </el-option> </el-select> </span> </li> <li> <span> <em>{{$t('fnc.sybumen')}}</em> <el-select class='w210' filterable v-model="queryMsg.QDepartmendId" :placeholder="$t('pub.pleaseSel')"> <el-option :label="$t('pub.unlimitedSel')" :value='comSelect'></el-option> <el-option v-for='item in DepartmentList' :label='item.DepartmentName' :value='item.DepartmentID' :key='item.DepartmentID'> </el-option> </el-select> </span> </li> <li> <button class="hollowFixedBtn" @click="addASrules">{{$t('pub.addBtn')}}</button> <button class="normalBtn">{{$t('pub.searchBtn')}}</button> </li> </ul> </div> <table class="AS_table"> <tr> <th>{{$t('objFill.v101.administrative.zhiduxianmu')}}</th> <th>{{$t('objFill.v101.administrative.guizhe')}}</th> <th width='120px;'>{{$t('objFill.v101.administrative.jianlifangshi')}}</th> <th>{{$t('fnc.sygongsi')}}</th> <th>{{$t('fnc.sybumen')}}</th> <th>{{$t('fnc.sygangwei')}}</th> <th>{{$t('objFill.v101.header.chuanjian')}}/{{$t('objFill.v101.administrative.tiaozhengsj')}}</th> <th>{{$t('objFill.v101.header.chuanjian')}}/{{$t('objFill.v101.administrative.xiugairen')}}</th> <th>{{$t('system.table_operation')}}</th> </tr> <tbody> <tr v-for="item in dataList" :key="item.subCode"> <td>{{item.ItemName}}</td> <td> <el-popover popper-class="_ASDetails" width="400" trigger="click"> <table width="100%" border="0" cellspacing="0" cellpadding="0" collapse="0"> <tr class="_color_666"> <th>{{$t('objFill.v101.administrative.guizhe')}}</th> <th>{{$t('objFill.v101.activity.jifen')}}</th> <th>{{$t('fnc.xianjin')}}</th> </tr> <tr v-for="subItem in item.RulesList" :key="subItem.subCode"> <td>{{subItem.RuleStyleStr}}{{subItem.RuleStyle}}</td> <td>{{subItem.RuleType}}</td> <td>{{subItem.Cash}}</td> </tr> </table> <span class="AS_more" slot="reference" v-if="item.RulesList.length>0"> {{item.RulesList[0].RuleStyleStr}}{{item.RulesList[0].RuleStyle}} </span> </el-popover> </td> <td> <div class="AS_Score">{{$t('objFill.v101.activity.jifen')}}:<span class="AS_comGren" v-if="item.RulesList.length>0">+{{item.RulesList[0].RuleType}}</span></div> <div class="AS_Score">{{$t('fnc.xianjin')}}:<span class="AS_comGren" v-if="item.RulesList.length>0">+{{item.RulesList[0].Cash}}</span></div> </td> <td> <el-popover popper-class="_ASDetails" width="200" trigger="click"> <table width="100%" border="0" cellspacing="0" cellpadding="0" collapse="0"> <tr class="_color_666"> <th>{{$t('sm.company')}}</th> </tr> <tr v-for="subItem in item.BranchList" :key="subItem.subCode"> <td>{{subItem.BName}}</td> </tr> </table> <span v-if="item.BranchList.length>0" class="AS_comList" slot="reference"> {{item.BranchList[0].BName}} </span> </el-popover> </td> <td> <el-popover popper-class="_ASDetails" width="200" trigger="click"> <table width="100%" border="0" cellspacing="0" cellpadding="0" collapse="0"> <tr class="_color_666"> <th>{{$t('admin.admin_Department')}}</th> </tr> <tr v-for="subItem in item.DepartmentList" :key="subItem.subCode"> <td>{{subItem.DepartmentName}}</td> </tr> </table> <span v-if="item.DepartmentList.length>0" class="AS_comList" slot="reference"> {{item.DepartmentList[0].DepartmentName}} </span> </el-popover> </td> <td> <el-popover popper-class="_ASDetails" width="200" trigger="click"> <table width="100%" border="0" cellspacing="0" cellpadding="0" collapse="0"> <tr class="_color_666"> <th>{{$t('admin.admin_Post')}}</th> </tr> <tr v-for="subItem in item.PostList" :key="subItem.subCode"> <td>{{subItem.PostName}}</td> </tr> </table> <span v-if="item.PostList.length>0" class="AS_comList" slot="reference"> {{item.PostList[0].PostName}} </span> </el-popover> </td> <td>{{item.UpdateTime}}</td> <td> <div class="AS_header"> <img v-if="item.EmployeePhoto" :src="item.EmployeePhoto"/> <img v-else src="../../assets/img/bg_c3@3x.png"/> <span>{{item.EmployeeName}}</span> </div> </td> <td> <el-tooltip class="item" effect="dark" :content="$t('system.table_edit')" placement="top-start"> <el-button type="primary" icon="el-icon-edit" @click="getInfoList(item.ConfigId)" circle></el-button> </el-tooltip> <el-tooltip class="item" effect="dark" :content="$t('system.table_delete')" placement="top-start"> <el-button type="danger" icon="el-icon-delete" @click="delPeiZhi(item.ConfigId)" circle ></el-button> </el-tooltip> </td> </tr> </tbody> </table> </div> </div> <div class="AS_zhidu" v-if="isShow"> <span class="AS_title">{{$t('objFill.v101.administrative.xinzenjianlzd')}}</span> <el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="100px"> <div class="AS_zhiduTop clearfix"> <el-col :span="6"> <el-form-item :label="$t('objFill.v101.administrative.zhiduxianmu')" prop="ItemId"> <el-select :placeholder="$t('pub.pleaseSel')" v-model="addMsg.ItemId" class="w160"> <el-option :value="comSelect" :label="$t('pub.unlimitedSel')"></el-option> <el-option v-for='item in projectList' :key="item.ItemId" :label="item.ItemName" :value="item.ItemId"> </el-option> </el-select> <div class="AS_addbtn" @click="addRules"> <i class="iconfont icon-img_haha"></i> </div> </el-form-item> </el-col> <el-col :span="5"> <el-form-item :label="$t('fnc.sygongsi')" prop="BranchIds"> <el-select :placeholder="$t('pub.pleaseSel')" multiple v-model="addMsg.BranchIds" class="w160 multiple_input" @change="getDepartment"> <el-option :value="comPanySelect" :label="$t('pub.unlimitedSel')"></el-option> <el-option v-for='item in CompanyList' :key="item.Id" :label="item.BName" :value="item.Id"> </el-option> </el-select> </el-form-item> </el-col> <el-col :span="5"> <el-form-item :label="$t('fnc.sybumen')" prop="DepartmentIds"> <el-select :placeholder="$t('pub.pleaseSel')" multiple v-model="addMsg.DepartmentIds" class="w160 multiple_input" @change="getPostIds"> <el-option :label="$t('pub.unlimitedSel')" :value='comSelect'></el-option> <el-option v-for='item in DepartmentList' :label='item.DepartmentName' :value='item.DepartmentID' :key='item.DepartmentID'> </el-option> </el-select> </el-form-item> </el-col> <el-col :span="5"> <el-form-item :label="$t('fnc.sygangwei')" prop="PostIds"> <el-select :placeholder="$t('pub.pleaseSel')" multiple v-model="addMsg.PostIds" class="w160 multiple_input"> <el-option :label="$t('pub.unlimitedSel')" :value='comSelect'></el-option> <el-option v-for='item in PostIdsList' :label='item.PostName' :value='item.PostId' :key='item.PostId'> </el-option> </el-select> </el-form-item> </el-col> </div> <div class="AS_rolesList clearfix"> <div class="AS_Rlist" v-for="(item,index) in addMsg.RulesList" :key="item.subCode"> <div class="AS_top"> <span>{{$t('objFill.v101.administrative.guizhe')}}{{index+1}}</span> <input type="button" :value="$t('system.table_delete')" class="AS_delbtn" @click="delList(index,item.RuleId)"/> </div> <div class="AS_ruleInut AS_ROne"> <el-form-item :label="$t('objFill.v101.administrative.guizhe')" :prop="'addMsg.RulesList.'+index+'.RuleStyle'" :rules="AsRules.RuleStyle"> <el-select class='w95' filterable v-model="item.RuleStyle" :placeholder="$t('pub.pleaseSel')"> <el-option v-for="item in RuleStyleList" :label='item.Name' :value='item.Id' :key='item.Id'> </el-option> </el-select> </el-form-item> <el-form-item prop="RuleValue"> <el-input class='w95' v-model="item.RuleValue"></el-input> </el-form-item> </div> <div class="AS_ruleInut"> <el-form-item :label="$t('objFill.v101.activity.jifen')" prop="RuleType"> <el-select class='w95' v-model="item.RuleType" filterable :placeholder="$t('pub.pleaseSel')"> <el-option v-for="item in RuleTypeList" :label='item.Name' :value='item.Id' :key='item.Id'> </el-option> </el-select> </el-form-item> </div> <div class="AS_ruleInut" v-if="item.RuleType==1||item.RuleType==3"> <el-form-item :label="$t('objFill.v101.activity.jifen')" prop="Integral"> <el-input class='w95' v-model="item.Integral"></el-input> </el-form-item> </div> <div class="AS_ruleInut" v-if="item.RuleType==2||item.RuleType==3"> <el-form-item :label="$t('fnc.xianjin')" prop="Cash"> <el-input class='w95' v-model="item.Cash"></el-input> </el-form-item> </div> </div> </div> <input type="button" class="normalBtn AS_SaveBtn" @click="submitForm('addMsg')" :value="$t('pub.saveBtn')"/> <input type="button" class="normalBtn" @click="isShow=false;clearinputInfo()" :value="$t('pub.cancelBtn')"/> </el-form> </div> <el-pagination background @current-change="handleCurrentChange" :current-page.sync="queryMsg.currentPage" :page-size="queryMsg.pageSize" layout="total,prev, pager, next, jumper" :total="queryMsg.total"> </el-pagination> </div> </template> <script> export default { data() { return { queryMsg: { ConfigType:0, ItemId: 0, QBranchId: -1, QDepartmendId: 0, pageIndex: 1, pageSize: 10, total: 0, currentPage: 1 }, //制度项目 projectList: [], //数据源 dataList: [], //是否显示底层 isShow: false, //奖惩制度 systemList: 1, //公用默认下拉 comSelect: 0, comPanySelect: -1, //适用公司 CompanyList: [], //部门 DepartmentList: [], // 公司 getCompanyMsg: { RB_Group_Id: "0", Status: "0" }, //适用岗位 PostIdsList: [], //奖惩制度 ConfigTypeList: [], //规则方式 RuleStyleList: [], //积分 RuleTypeList: [], //中间存放 comConfigId:'', addMsg: { ConfigId: 0, ConfigType: 0, //奖励惩罚 ItemId: 0, BranchIds: [], DepartmentIds: [], PostIds: [], RulesList: [] }, rules:{ ItemId:[ { required: true, message: this.$t('objFill.v101.administrative.qingxuanzzdxm'), trigger: "change" } ], BranchIds:[ { required: true, message: this.$t('objFill.v101.administrative.qingxuanzsygs'), trigger: "change" } ], DepartmentIds:[ { required: true, message: this.$t('objFill.v101.administrative.qingxuanzsybm'), trigger: "change" } ], PostIds:[ { required: true, message: this.$t('objFill.v101.administrative.qingxuanzsyganw'), trigger: "change" } ], }, AsRules:{ RuleStyle:[ { required: true, message: this.$t('objFill.v101.administrative.qingxuanzgz'), trigger: "change" } ] } }; }, methods: { //初始化制度项目 getSystemProject() { this.apipost( "user_Assessment_GetItemList", {}, res => { if (res.data.resultCode == 1) { this.projectList = res.data.data; } }, err => {} ); }, //获取列表数据 getList() { this.apipost( "user_Assessment_GetPageList", this.queryMsg, res => { if (res.data.resultCode == 1) { this.queryMsg.total = res.data.data.count; this.dataList = res.data.data.pageData; } }, err => {} ); }, //点击切换奖惩制度 getSwitch(Id) { this.systemList = Id; this.queryMsg.ConfigType=Id; this.isShow=false; this.GetRuleObj(); this.getList(); }, //新增 addASrules(){ this.isShow=true; this.addMsg.ConfigId=0; this.clearinputInfo(); }, //获取公司列表 getCompanyList() { this.apipost( "admin_get_BranchGetList", this.getCompanyMsg, res => { if (res.data.resultCode == 1) { this.CompanyList = res.data.data; } else { } }, err => {} ); }, //根据多公司获取部门 getDepartment() { this.addMsg.DepartmentIds = []; let msg = { QBranchIds: this.addMsg.BranchIds.join(",") }; this.apipost( "department_get_GetListByBranchIds", msg, res => { if (res.data.resultCode == 1) { this.DepartmentList = res.data.data; } }, err => {} ); }, //根据多部门获取岗位 getPostIds() { this.addMsg.PostIds = []; this.PostIdsList = []; let msg = { QDepartmentIds: this.addMsg.DepartmentIds.join(",") }; this.apipost( "admin_post_GetPostListByDepartmentIds", msg, res => { if (res.data.resultCode == 1) { this.PostIdsList = res.data.data; } }, err => {} ); }, handleCurrentChange(val) { this.queryMsg.pageIndex = val; this.getList(); }, //添加制度项目 addRules() { this.addMsg.RulesList.push(this.GetRuleObj()); }, //获取规则项目 GetRuleObj() { return { RuleId: 0, ConfigId: 0, RuleStyle: "", RuleValue: "", RuleType: 1, Integral: "", Cash: "" }; }, //初始化各种枚举信息 getEnumeration() { this.apipost( "user_Assessment_GetEnum", {}, res => { if (res.data.resultCode == 1) { var tempData = res.data.data; this.ConfigTypeList = tempData.ConfigTypeList; this.RuleStyleList = tempData.RuleStyleList; this.RuleTypeList = tempData.RuleTypeList; } }, err => {} ); }, //删除规则 delList(index,RuleId) { if(RuleId>0){ var that = this; this.Confirm(that.$t('tips.shifoushanchu'), function() { var msg = { RuleId: RuleId }; that.apipost("user_Assessment_RemoveRuleId",msg, res => { if (res.data.resultCode == 1) { that.Success(this.$t('tips.shanchuchenggong')); that.getInfoList(that.comConfigId); }else{ that.Error(res.data.data); } },null); }); }else{ this.addMsg.RulesList.splice(index, 1); } }, submitForm(addMsg) { //提交创建、修改表单 let that = this; that.$refs[addMsg].validate(valid => { if (valid) { that.SaveData(); } else { return false; } }); }, //保存数据 SaveData() { this.addMsg.ConfigType = this.systemList; this.addMsg.BranchIds = this.addMsg.BranchIds.join(","); this.addMsg.DepartmentIds = this.addMsg.DepartmentIds.join(","); this.addMsg.PostIds = this.addMsg.PostIds.join(","); this.apipost( "user_Assessment_Set", this.addMsg, res => { if (res.data.resultCode == 1) { this.Success(this.$t('tips.saveYes')); this.getList(); this.clearinputInfo(); this.isShow=false; } }, err => {} ); }, clearinputInfo() { this.addMsg = { ConfigId: 0, //ConfigType: 0, //奖励惩罚 ItemId: 0, BranchIds: [], DepartmentIds: [], PostIds: [], RulesList: [] } }, //修改获取数据 getInfoList(ConfigId){ this.comConfigId = ConfigId; let msg = { ConfigId:ConfigId } this.apipost( "user_Assessment_Get", msg, res => { if (res.data.resultCode == 1) { this.isShow=true; var tempData = res.data.data; this.addMsg.BranchIds=[]; this.addMsg.DepartmentIds=[]; this.addMsg.PostIds=[]; this.addMsg.ConfigId = tempData.ConfigId; this.addMsg.ConfigType = this.systemList; this.addMsg.ItemId = tempData.ItemId; this.addMsg.RulesList = tempData.RulesList; var BranchIds = tempData.BranchIds.split(','); this.getDepartment(); this.getPostIds(); BranchIds.forEach(x => { this.addMsg.BranchIds.push(Number(x)); }); var DepartmentIds = tempData.DepartmentIds.split(','); DepartmentIds.forEach(x => { this.addMsg.DepartmentIds.push(Number(x)); }); var PostIds = tempData.PostIds.split(','); PostIds.forEach(x => { this.addMsg.PostIds.push(Number(x)); }); } }, err => {} ); }, //删除配置 delPeiZhi(ConfigId){ var that = this; this.Confirm(that.$t('tips.shifoushanchu'), function() { var msg = { ConfigId: ConfigId }; that.apipost( "user_Assessment_RemoveConfigById", msg, res => { if (res.data.resultCode == 1) { that.Success(this.$t('tips.shanchuchenggong')); that.getList(); }else{ that.Error(res.data.data); } }, null ); }); } }, mounted() { let userInfo = this.getLocalStorage(); this.getCompanyMsg.RB_Group_Id = userInfo.RB_Group_id; //集团ID this.getEnumeration(); this.getCompanyList(); this.getList(); this.getSystemProject(); } }; </script>