<style> .user_time_picker .el-date-editor--date > .el-input__inner { padding: 0 10px; font-size: 13px; } .user_time_picker .el-date-editor--date > span.el-input__prefix { display: none; } .user_time_picker .el-date-editor--date > span.el-input__suffix { top: -4px; right: 2px; } .zidingyiFz i { font-size: 14px !important; } ._couponReceiveCount{ text-decoration: underline; cursor: pointer; } /* .page_CouponList .el-button.is-circle{ border-radius: 4px } */ .text_al_left{ text-align: left; padding: 0 10px; } </style> <template> <div class="flexOne page_CouponList"> <div class="query-box"> <ul class="user_time_picker"> <li> <span> <em>员工</em> <el-select filterable v-model="msg.Employee_id" > <el-option :label="$t('system.ph_buxian')" :value="0"></el-option> <el-option v-for='item in userList' :label='item.name' :value='item.empId' :key='item.empId'></el-option> </el-select> </span> </li> <li> <span> <em>线路</em> <el-select filterable v-model="msg.Line_id"> <el-option :label="$t('system.ph_buxian')" :value="0"></el-option> <el-option v-for="item in newLineList" :label="item.LineName" :value="item.LineID" :key="item.LineID"></el-option> </el-select> </span> </li> <li> <input type="button" class="hollowFixedBtn" :value="$t('pub.searchBtn')" @click="resetPageIndex(),getList()" > <input type="button" @click="outerVisible = true,isleaveBtn=false,getCompany(),dialogTitle='新增线控管理',companyshow=false,Ltshow=false" class="normalBtn" :value="$t('pub.addBtn')" > </li> </ul> </div> <div class="clearfix"></div> <table class="singeRowTable" border="0" cellspacing="0" cellpadding="0" v-loading="loading"> <tr> <th>编号</th> <th>员工名称</th> <th>公司名称</th> <th width="300">线路名称</th> <th width="300">系列名称</th> <th>操作人</th> <th>操作时间</th> <th>{{$t('system.table_operation')}}</th> </tr> <tr v-for="(item,index) in DataList"> <td>{{item.ID}}</td> <td>{{item.EmpName}}</td> <td>{{item.BranchName}}</td> <td>{{item.LineName}}</td> <td>{{item.LtName}}</td> <td>{{item.UpdateName}}</td> <td>{{item.UpdateDate}}</td> <td class="text_al_left"> <!-- <el-button-group> --> <el-tooltip class="item" effect="dark" content="编辑" placement="top"> <el-button type="primary" icon="el-icon-edit" circle @click="Edit(item)" ></el-button> </el-tooltip> <el-tooltip class="item" effect="dark" content="删除" placement="top"> <el-button type="danger" icon="el-icon-delete" circle @click="Delete(item)" ></el-button> </el-tooltip> </td> </tr> </table> <div class="noDataNotice" v-if="DataList.length<1"> <i class="iconfont icon-kong"></i> <p>{{$t('active.ld_noData')}}</p> </div> <el-pagination background @current-change="handleCurrentChange" v-if="DataList.length>0" :current-page.sync="currentPage" layout="total,prev, pager, next, jumper" :page-size="msg.pageSize" :total="total" ></el-pagination> <el-dialog custom-class="w800" :title="dialogTitle" :visible.sync="outerVisible" center :before-close="closeChangeMachie" > <el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="100px"> <table class="layerTable layerNoIcon"> <tr> <td> <el-form-item :label="$t('advmanager.v_line')" prop="Line_id"> <el-select style="width:100%;" filterable v-model="addMsg.Line_id" @change="getLineTeamList(addMsg.Line_id)"> <el-option v-for="item in newLineList" :label="item.LineName" :value="item.LineID" :key="item.LineID"></el-option> </el-select> </el-form-item> </td> <td> <el-form-item label="员工" prop="Employee_id"> <el-select filterable style="width:100%;" v-model="addMsg.Employee_id" :placeholder="$t('system.ph_choice')" > <el-option v-for='item in userList' :label='item.name' :value='item.empId' :key='item.empId'></el-option> </el-select> </el-form-item> </td> </tr> <td> <el-form-item :label="$t('system.table_company')"> <el-select style="width:100%;" @change="CompanyChange" filterable multiple collapse-tags v-model="addMsg.BranchIdList" :placeholder="$t('system.ph_choice')" > <el-option :label="$t('system.ph_buxian')" :value="-1" :key="-1"></el-option> <el-option :disabled="companyshow" v-for="item in layerCompanyList" :label="item.BName" :value="item.Id" :key="item.Id" ></el-option> </el-select> </el-form-item> </td> <td> <el-form-item :label="$t('advmanager.v_xilie')" prop="lineteamId"> <el-select @change="LtIdListChange" style="width:100%;" filterable v-model="addMsg.LtIdList" multiple collapse-tags> <el-option :label="$t('system.ph_buxian')" :value="-1" :key="-1"></el-option> <el-option :disabled="Ltshow" v-for="item in LineTeamList" :label="item.LtName" :value="item.LtID" :key="item.LtID"></el-option> </el-select> </el-form-item> </td> </tr> </table> </el-form> <div slot="footer" class="dialog-footer"> <button class="hollowFixedBtn" @click="outerVisible = false,resetForm('addMsg')">{{$t('pub.cancelBtn')}}</button> <button class="normalBtn" @click="submitForm('addMsg')">{{$t('pub.saveBtn')}}</button> </div> </el-dialog> </div> </template> <script> export default { data() { return { companyshow:false, Ltshow:false, leaveBtn: "", leaveId: "", loading: true, isleaveBtn: false, total: 0, pageSize: "", currentPage: 1, outerVisible: false, innerVisible: false, isRight: true, dialogTitle: "", insideDialogTxt: "", LineList: [], //请求 msg: { pageIndex: 1, pageSize: 15, Line_id:0, Employee_id:0, }, rules: { Line_id: [{ required: true, message:"请选择线路", trigger: "change" }], Employee_id: [{ required: true, message:"请选择员工", trigger: "change" }], }, addMsg: { Line_id:"", Employee_id:"", BranchIdList:[], LtIdList:[], }, pwdMsg: { Id: "", Pwd: "", pwd1: "" }, getCompanyMsg: { RB_Group_Id: "0", Status: "0" }, //返回值的接收变量 DataList: [], groupList: [], layerCompanyList: [], companyList: [], layerDepartMentList: [], departMentList: [], PostList: [], groupId: '', LineTeamList: [], QLineTeamList: [], newLineList:[], getUserMsg:{ RB_Branch_id:'-1', RB_BranchId:'-1', }, userList:[], }; }, mounted() { let userInfo = this.getLocalStorage(); this.groupId = this.msg.groupId = this.getCompanyMsg.RB_Group_Id = this.addMsg.groupId = userInfo.RB_Group_id; //集团 this.msg.branchId = userInfo.RB_Branch_id; //公司 this.getList(); this.getCompany(); this.getLineList(); this.getUser(); }, filters: { }, methods: { LtIdListChange(val){ this.Ltshow=false; val.forEach(item => { if(item==-1){ this.Ltshow=true; this.addMsg.LtIdList=[-1]; } }); }, CompanyChange(val){ this.companyshow=false; val.forEach(item => { if(item==-1){ this.companyshow=true; this.addMsg.BranchIdList=[-1]; } }); }, Edit(item){ this.companyshow=false; this.Ltshow=false; this.dialogTitle='编辑线控管理'; this.getLineTeamList(item.Line_id) this.outerVisible=true; this.addMsg.ID=item.ID; this.addMsg.Line_id=item.Line_id; this.addMsg.Employee_id=item.Employee_id; this.addMsg.BranchIdList=item.BranchIdList; this.addMsg.LtIdList=item.LtIdList; this.addMsg.BranchIdList.forEach(item => { if(item==-1){ this.companyshow=true; this.addMsg.LtIdList=[-1]; } }); this.addMsg.LtIdList.forEach(item => { if(item==-1){ this.Ltshow=true; this.addMsg.LtIdList=[-1]; } }); }, getUser(){ this.getUserMsg.RB_Branch_id=this.msg.RB_BranchId; this.apipost('app_get_company_employee',this.getUserMsg,res=>{ if(res.data.resultCode==1){ this.userList=res.data.data; }else{} },err=>{}) }, Delete(item){ this.$confirm('是否删除?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { this.apipost("line_post_RemoveEmployee",{ID:item.ID}, res => { if (res.data.resultCode == 1) { this.Success(res.data.message) this.getList(); }else{ this.Error(res.data.message) } }); }).catch(() => { }); }, getLineList() { this.apipost("line_post_GetAllList", {}, res => { if (res.data.resultCode == 1) { this.newLineList = res.data.data; } }); }, getCompany() { this.apipost( "admin_get_BranchGetList", this.getCompanyMsg, res => { if (res.data.resultCode == 1) { this.layerCompanyList = res.data.data; } else { } }, err => {} ); }, getList() { //获取数据 this.loading = true; this.apipost("line_post_GetLineEmployeeList",this.msg, res => { if (res.data.resultCode == 1) { this.loading = false; this.DataList = res.data.data.pageData; this.total=res.data.data.count; }else{ this.Error(res.data.message) } }); }, // 跳转优惠券发放详情 goDetail: function (path, item) { this.$router.push({ name: path, query: { couponId: item.id, useState: item.couponStatus, blank: "y", } }); }, maxValue: function (val) { if (this.addMsg.couponsType === 2 && val >= 9.99) { this.addMsg.denomination = 9.99 this.$message.error(this.$t('rule.zkqzdzkwzhe')) } }, addData() { this.isleaveBtn = false; if(this.addMsg.BranchIdList.length==0){ this.addMsg.BranchIdList=[-1]; } if(this.addMsg.LtIdList.length==0){ this.addMsg.LtIdList=[-1]; } this.apipost('line_post_SetLineEmployee', this.addMsg, res => { this.outerVisible=false; if (res.data.resultCode == 1) { this.Success(res.data.message) this.getList(); this.addMsg={ Line_id:"", Employee_id:"", BranchIdList:[], LtIdList:[], } }else{ this.Error(res.data.message) } }) }, //获取系列列表 getLineTeamList (LineID, type) { this.addMsg.LtIdList=[]; let msg = { lineID: LineID, isTOOP: 1 } this.apipost('team_post_GetList', msg, res => { if (res.data.resultCode == 1) { if (type) { this.QLineTeamList = res.data.data } else { this.LineTeamList = res.data.data } } }) }, // 修改 updateData(item) { this.getLineTeamList(item.lineId) this.addMsg.couponsName= item.couponsName this.addMsg.effectDate= item.effectDate this.addMsg.expirationDate= item.expirationDate this.addMsg.couponsType= item.couponsType this.addMsg.groupId= item.groupId this.addMsg.branchId= item.branchId this.addMsg.lineId= item.lineId this.addMsg.denomination= item.denomination this.addMsg.overlapUse= item.overlapUse this.addMsg.useCondition= item.useCondition this.addMsg.id= item.id this.addMsg.couponCount = item.couponCount this.addMsg.lineteamId = item.lineteamId this.addMsg.couponsUseScope = item.couponsUseScope this.addMsg.couponStatus = item.couponStatus this.isleaveBtn = true; }, // 删除 deleteItem: function (item, type) { let text = this.$t('tips.qrsc'); let status = 3; if (type == 2) { text = this.$t('tips.qrjinyong'); status = 2 } else if (type == 3) { text = this.$t('tips.qrhuifu'); status = 1 } this.$confirm(text+'“'+ item.couponsName +'”'+this.$t('active.ad_yhq'), this.$t('tips.tips'), { confirmButtonText: this.$t('pub.sureBtn'), cancelButtonText: this.$t('pub.cancelBtn'), type: 'warning' }).then(() => { this.apiJavaPost("/api/sell/coupon/updateCouponStatus", {couponId: item.id, status: status,}, res => { if (res.data.resultCode === 1) { this.Success(res.data.message); this.getList(); } else { this.Error(res.data.message) } }, null); }).catch(() => { this.$message({ type: 'info', message: this.$t('hotel.hotel_HasBeenCancelled') }); }); }, handleCurrentChange(val) { this.msg.pageIndex = val; this.getList(); }, resetPageIndex() { this.msg.pageIndex = 1; this.currentPage = 1; }, submitForm(addMsg) { //提交创建、修改表单 this.$refs[addMsg].validate(valid => { if (valid) { this.addData(); } else { return false; } }); }, goUrl(name, id) { this.$router.push({ name: name, query: { id: id, type: 9, blank: "y", tab: "绑定账户信息" } }); }, closeChangeMachie(done) { //弹出框关闭初始化弹框内表单 done(); this.resetForm("addMsg"); }, resetForm(formName) { //弹出框取消 初始化谈框内表单 this.$refs[formName].resetFields(); this.addMsg={ Line_id:"", Employee_id:"", BranchIdList:[], LtIdList:[], } } } }; </script>