/******************************************************************************* * Copyright(c) 2022 dongke All rights reserved. / Confidential * 类的信息: * 1.程序名称: * 2.员工资料列表 * 编辑履历: * 作者 日期 版本 修改内容 * admin 2024-2-12 1.00 *******************************************************************************/ const mixins = require('@/mixins/index.js') const Constants = require('@/utils/Constants.js') Page({ mixins: [mixins], /** * 页面的初始数据 */ data: { // 查询条件 searchContent: [], totallength: 0, //视图下方提醒数量 // 底部保存按钮 buttonFootList: [{ name: 'add', title: mixins.$t('add') }], contentnFootList: [ ], btnFormData: null, active: 0, tagList: [ { title: mixins.$t('all') }, { title: mixins.$t('resignation') }, { title: mixins.$t('leaveOffice') } ], // 列表区(内容) contentList: [ { name: 'staffCode', title: mixins.$t('staffCode') }, { name: 'staffPhone', title: mixins.$t('staffPhone') }, { name: 'orgName', title: mixins.$t('orgId') }, { name: 'roleNames', title: mixins.$t('roleName') }, ], // 弹出按钮 buttonList: [ { name: 'staffRight', title: mixins.$t('functionalPermissions') }, { name: 'staffPurview', title: mixins.$t('purviewPermissions') }, { name: 'leaveOffice', title: mixins.$t('leaveOffice') }, ], // 主键Id primaryKey: 'staffId', // 路由 routeObjName: 'staff', }, /** * @desc : 切换页面 * @date : 2024/2/1 15:49 * @author : 姜永辉 */ onChangeTabs(e) { let index = e.detail.detail.index this.setData({ active: index, }) // 默认查询 this.searchData(); }, /** * @desc : 设置额外参数 * @date : 2024/2/1 15:49 * @author : 姜永辉 */ setSearchParams(params) { // 在职离职状态 params.hrStatus = (this.data.active == 0 ? null : this.data.active) return params }, /** * @desc : 查询 * @date : 2024/2/1 15:49 * @author : 姜永辉 */ getData(params) { return this.excute(this.data.service, this.data.service.selectByCond, params); }, /** * @desc : 如果页面需要后续处理,再进行处理 * @date : 2024/2/1 15:49 * @author : 姜永辉 */ handleSearchData(data) { // 员工的数量 let tableData = this.data.tableData || [] let contentnFootList = this.data.contentnFootList tableData.forEach(it => { if (it.hrStatus == 0) { it.backgroundColor = 'red' } }) contentnFootList.forEach(it => { if (it.type == 'count') { it.bill = tableData.length } }) this.setData({ tableData, contentnFootList }) }, /** * @desc : 离职 * @date : 2024/2/1 15:49 * @author : 姜永辉 */ leaveOffice(e) { let item = e console.log("leaveOffice", e); let id = item.staffId let params={ staffId:item.staffId, hrStatus:2 // 离职2 在职1 } this.excute(this.data.service, this.data.service.leaveOffice , params).then(res => { if (res.data.code == Constants.SUCESS_CODE) { // 重新查询 this.searchData() } }) }, })