| | |
| | | <div class="main-card"> |
| | | <el-row class="cardTop"> |
| | | <el-col :span="12" class="mainCardBtn"> |
| | | <el-button type="primary" :icon="Plus" size="default" @click="dialogAddRecord = true">新建</el-button> |
| | | <el-button type="primary" :icon="Plus" size="default" @click="dialogAddRecord = true">新增</el-button> |
| | | <!-- <el-button type="warning" :icon="Edit" size="default" plain>修改</el-button>--> |
| | | <el-button type="danger" :icon="Delete" size="default" plain @click="deleteBatchBtn">删除</el-button> |
| | | <!-- <el-button type="danger" :icon="Delete" size="default" plain @click="deleteBatchBtn">删除</el-button>--> |
| | | </el-col> |
| | | <el-button type="primary" :icon="Refresh" size="default" @click="reLoadData()" /> |
| | | </el-row> |
| | | <el-table ref="multipleTableRef" :data="tableData" style="width: 100%" height="calc(100% - 100px)" :header-cell-style="{ background: '#fafafa' }" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="100" /> |
| | | <el-table-column property="groupName" label="班组名称" /> |
| | | <el-table-column property="groupMembers" label="班组人员" width="180" :show-overflow-tooltip="true" /> |
| | | <el-table-column property="department" label="所属部门" /> |
| | | <el-table-column property="groupMembers" label="班组人员" :show-overflow-tooltip="true" /> |
| | | <el-table-column property="groupInfo" label="描述" /> |
| | | <el-table-column fixed="right" label="操作" align="center" width="250"> |
| | | <template #default="scope"> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <el-dialog v-model="dialogDetails" title="时间策略"> |
| | | <el-dialog v-model="dialogDetails" title="班组管理"> |
| | | <el-form :model="details" label-width="120px"> |
| | | <el-form-item label="班组名称"> |
| | | <el-input v-model="details.groupName" readonly /> |
| | |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-dialog> |
| | | <el-dialog v-model="dialogAddRecord" title="时间策略编辑" @close="closeAdd" @open="openAdd"> |
| | | <el-dialog v-model="dialogAddRecord" title="班组管理编辑" @close="closeAdd" @open="openAdd"> |
| | | <el-form :model="addRecord" label-width="120px" ref="addRef" :rules="addRules"> |
| | | <el-form-item label="班组名称" prop="groupName"> |
| | | <el-input v-model="addRecord.groupName"> </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="选择部门" prop="department"> |
| | | <el-cascader v-model="addRecord.department" :options="departmentList" :props="casProps" :show-all-levels="false" @change="handleChange" /> |
| | | <el-form-item label="选择部门" prop="depId"> |
| | | <el-cascader v-model="addRecord.depId" :options="departmentList" :props="casProps" :show-all-levels="false" @change="handleChange" /> |
| | | </el-form-item> |
| | | <el-form-item label="选择人员" prop="groupMembers" v-if="addRecord.department !== ''"> |
| | | <el-select v-model="addRecord.groupMembers" multiple> |
| | | <el-form-item label="选择人员" prop="groupMemberIds" v-if="addRecord.depId"> |
| | | <el-select v-model="addRecord.groupMemberIds" multiple> |
| | | <el-option v-for="(item, index) in workerList" :label="item.username" :key="index" :value="item.uid">{{ item.username }}</el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | totalSize: number; |
| | | addRecord: { |
| | | groupName: string; |
| | | department: number | null; |
| | | depId: number | null; |
| | | groupMembers: Array<any>; |
| | | groupId: number | null; |
| | | groupMemberIds: Array<any>; |
| | | groupInfo: string; |
| | | }; |
| | | details: { |
| | |
| | | department: number | null; |
| | | groupMembers: Array<any>; |
| | | groupInfo: string; |
| | | depId: number | null; |
| | | }; |
| | | } |
| | | |
| | |
| | | searchWord: '', |
| | | tableData: [], |
| | | departmentList: [], |
| | | department: '', |
| | | workerList: [], |
| | | casProps: { |
| | | expandTrigger: 'hover', |
| | | emitPath: false, |
| | | value: 'depId', |
| | | label: 'depName' |
| | |
| | | deleteDialog: false, |
| | | deleteSetDialog: false, |
| | | addRecord: { |
| | | groupName: '', |
| | | department: null, |
| | | groupMembers: [], |
| | | depId: null, |
| | | groupInfo: '' |
| | | groupId: null, |
| | | groupInfo: '', |
| | | groupName: '', |
| | | groupMemberIds: [], |
| | | }, |
| | | details: { |
| | | groupName: '', |
| | |
| | | |
| | | const handleChange = async (value) => { |
| | | state.addRecord.depId = value; |
| | | console.log(state.addRecord.department, 'de'); |
| | | let res = await teamManageApi().getAllMember(value); |
| | | if (res.data.code === '200') { |
| | | state.workerList = res.data.data; |
| | |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: res.data.msg |
| | | message: '添加成功!' |
| | | }); |
| | | getListByPage(); |
| | | } else { |
| | |
| | | |
| | | // 修改工作时段方法 |
| | | const editRecordBtn = async (index, row) => { |
| | | state.addRecord = JSON.parse(JSON.stringify(row)); |
| | | state.addRecord.department = ''; |
| | | state.addRecord.groupMembers = []; |
| | | state.dialogAddRecord = true; |
| | | state.chosenIndex = index; |
| | | }; |
| | | |
| | | const obj = JSON.parse(JSON.stringify(row)); |
| | | for(let i in state.addRecord){ |
| | | if(isKey(i,obj)){ |
| | | state.addRecord[i] = obj[i] |
| | | } |
| | | } |
| | | handleChange(obj.depId).then((res)=>{ |
| | | state.addRecord.groupMemberIds = obj.groupMembers.map((item)=> { |
| | | return state.workerList.find(i => i.username == item)?.uid |
| | | }) |
| | | state.dialogAddRecord = true; |
| | | state.chosenIndex = index; |
| | | }) |
| | | } |
| | | const isKey = (key,obj)=>{ |
| | | return key in obj |
| | | } |
| | | const editRecord = async (data: any) => { |
| | | let res = await teamManageApi().updateRecord(data); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: res.data.msg |
| | | message: '修改成功!' |
| | | }); |
| | | getListByPage(); |
| | | } else { |
| | |
| | | if (!formEl) return; |
| | | await formEl.validate(async (valid, fields) => { |
| | | if (valid) { |
| | | const data = { |
| | | groupName: state.addRecord.groupName, |
| | | groupInfo: state.addRecord.groupInfo, |
| | | depId: state.addRecord.depId, |
| | | groupMemberIds: state.addRecord.groupMembers |
| | | }; |
| | | if (state.chosenIndex == null) { |
| | | const {groupId,...data} = state.addRecord |
| | | await addRecord(data); |
| | | } else { |
| | | data.groupId = JSON.stringify(state.addRecord.groupId); |
| | | await editRecord(data); |
| | | await editRecord(state.addRecord); |
| | | } |
| | | state.dialogAddRecord = false; |
| | | } else { |
| | |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: res.data.msg |
| | | message: '删除成功!' |
| | | }); |
| | | getListByPage(); |
| | | } else { |
| | |
| | | }; |
| | | |
| | | // 批量删除 |
| | | const deleteBatchBtn = async () => { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '抱歉,本页面暂不支持批量删除' |
| | | }); |
| | | // const deleteBatchBtn = async () => { |
| | | // ElMessage({ |
| | | // type: 'warning', |
| | | // message: '抱歉,本页面暂不支持批量删除' |
| | | // }); |
| | | // if (state.deleteArr.length > 0) { |
| | | // state.deleteSetDialog = true |
| | | // } else { |
| | |
| | | // message: '请先选择要删除的记录' |
| | | // }); |
| | | // } |
| | | }; |
| | | // }; |
| | | |
| | | // const conFirmDeleteBatch = async () => { |
| | | // let res = await teamManageApi().deletBatchRecord({ids: state.deleteArr}); |
| | |
| | | }; |
| | | |
| | | const closeAdd = () => { |
| | | state.addRecord = {}; |
| | | state.addRecord = { |
| | | depId: null, |
| | | groupId: null, |
| | | groupInfo: '', |
| | | groupName: '', |
| | | groupMemberIds: [], |
| | | }; |
| | | state.chosenIndex = null; |
| | | }; |
| | | const openAdd = () => { |
| | |
| | | getListByPage, |
| | | reLoadData, |
| | | deleteRecord, |
| | | deleteBatchBtn, |
| | | handleSizeChange, |
| | | handleCurrentChange, |
| | | confirmAddRecord, |
| | |
| | | <style scoped lang="scss"> |
| | | $homeNavLengh: 8; |
| | | .home-container { |
| | | height: calc(100vh - 114px); |
| | | height: calc(100vh - 144px); |
| | | box-sizing: border-box; |
| | | overflow: hidden; |
| | | .homeCard { |