1.取消顺序号
2.人员为弹框多选 3.预计时间取生产计划自动带出 5.人员为4 5岗位人员
This commit is contained in:
parent
6c69e4fbc6
commit
d003a4a9aa
@ -10,6 +10,7 @@ import com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum;
|
||||
import com.chanko.yunxi.mes.framework.operatelog.core.service.OperateLogFrameworkService;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.taskdispatch.vo.*;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.fpuser.FpUserDO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.fpuserdetail.FpUserDetailDO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDetailDO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskreport.TaskReportDO;
|
||||
@ -210,6 +211,15 @@ public class TaskDispatchController {
|
||||
List<HashMap<String, String>> owner = taskDispatchService.getOwner(id, type);
|
||||
return success(owner);
|
||||
}
|
||||
|
||||
@GetMapping("/assmebleDispatchPage")
|
||||
@Operation(summary = "获取装配报工责任人名单")
|
||||
@PreAuthorize("@ss.hasPermission('heli:task-dispatch:query')")
|
||||
public CommonResult< List<FpUserDetailDO>> assmebleDispatchPage() {
|
||||
List<FpUserDetailDO> assembleOwner = taskDispatchService.getAssembleOwner();
|
||||
return success(assembleOwner);
|
||||
}
|
||||
|
||||
@GetMapping("/getListJg")
|
||||
@Operation(summary = "获得加工工时成本")
|
||||
@PreAuthorize("@ss.hasPermission('heli:deliver-order:query')")
|
||||
|
@ -119,6 +119,15 @@ public class TaskDispatchRespVO {
|
||||
@Schema(description = "要求开始日期")
|
||||
private LocalDateTime requiredStartDate;
|
||||
|
||||
@Schema(description = "装配报工预计开始时间")
|
||||
private LocalDateTime assembleBeginDate;
|
||||
|
||||
@Schema(description = "装配报工预计结束时间")
|
||||
private LocalDateTime assembleEndDate;
|
||||
|
||||
@Schema(description = "工艺流程+6")
|
||||
private String craftContent;
|
||||
|
||||
@Schema(description = "要求完成日期")
|
||||
private LocalDateTime requiredEndDate;
|
||||
|
||||
|
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum;
|
||||
import com.chanko.yunxi.mes.module.heli.enums.TaskDispatchStatusEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -72,6 +73,7 @@ public class TaskDispatchDO extends BaseDO {
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 状态,1表示正常,2表示禁用
|
||||
*/
|
||||
@ -152,6 +154,10 @@ public class TaskDispatchDO extends BaseDO {
|
||||
private String craftContent;
|
||||
@TableField(exist = false)
|
||||
private Integer projectSubAmount;
|
||||
@TableField(exist = false)
|
||||
private LocalDateTime assembleBeginDate;
|
||||
@TableField(exist = false)
|
||||
private LocalDateTime assembleEndDate;
|
||||
public boolean canSave(){
|
||||
return TaskDispatchStatusEnum.SAVE.getCode() == this.dispatchStatus.intValue();
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@ -107,7 +108,26 @@ public interface FpUserDetailMapper extends BaseMapperX<FpUserDetailDO> {
|
||||
return selectList(query);
|
||||
|
||||
}
|
||||
default List<FpUserDetailDO> selectOwnerList(){
|
||||
MPJLambdaWrapper<FpUserDetailDO> queery1 = new MPJLambdaWrapper();
|
||||
List<Integer> list = new ArrayList();
|
||||
list.add(4);
|
||||
list.add(5);
|
||||
queery1.selectAll(FpUserDetailDO.class)
|
||||
.select("c.nickname as nick_Name ")
|
||||
// .leftJoin(PostDO.class,"b", PostDO::getId,FpUserDetailDO::getPostId)
|
||||
.leftJoin(AdminUserDO.class,"c",AdminUserDO::getId,FpUserDetailDO::getBusyId)
|
||||
.leftJoin(FpUserDO.class,"a",FpUserDO::getId, FpUserDetailDO::getFpId)
|
||||
.eq(FpUserDO::getType,"1")
|
||||
.eq(FpUserDetailDO::getIsRes,"Y")
|
||||
.in(FpUserDetailDO::getPostId,list);
|
||||
|
||||
|
||||
return selectList(queery1);
|
||||
|
||||
|
||||
|
||||
}
|
||||
// void deleteFpId(@Param("fpId") Long fpId);
|
||||
//
|
||||
// void deleteByFuId(@Param("id")Long id);
|
||||
|
@ -131,6 +131,7 @@ public interface TaskDispatchMapper extends BaseMapperX<TaskDispatchDO> {
|
||||
default TaskDispatchDO selectById(Long id) {
|
||||
MPJLambdaWrapper<TaskDispatchDO> query = new MPJLambdaWrapper<>();
|
||||
query.selectAll(TaskDispatchDO.class)
|
||||
|
||||
.select("a.plan_no as planCode", "e.name as customerName", "a.craft_content as craftContent")
|
||||
.select("d.code as projectCode", "d.project_name as projectName", "d.project_end_time as projectEndTime")
|
||||
.select("c.name as projectSubName", "b.project_sub_code as projectSubCode")
|
||||
|
@ -3,6 +3,7 @@ package com.chanko.yunxi.mes.module.heli.service.taskdispatch;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.taskdispatch.vo.*;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.ygjx.vo.YgjxPageReqVO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.fpuserdetail.FpUserDetailDO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDetailDO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskreport.TaskReportDO;
|
||||
@ -90,6 +91,7 @@ public interface TaskDispatchService {
|
||||
void convertAssembleProcedure(TaskDispatchDO taskDispatchDO);
|
||||
|
||||
List<HashMap<String,String>> getOwner(Long id,Long type);
|
||||
public List<FpUserDetailDO> getAssembleOwner();
|
||||
boolean judgeHasOver(Long id);
|
||||
|
||||
List<TaskDispatchDO> getListJg(Long id, Long projectSubId);
|
||||
|
@ -654,6 +654,15 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
|
||||
return fpUserMapList;
|
||||
}
|
||||
@Override
|
||||
public List<FpUserDetailDO> getAssembleOwner(){
|
||||
List<FpUserDetailDO> fpUserDetailDOS = fpUserDetailMapper.selectOwnerList();
|
||||
// List<HashMap<String,String>> fpUserMapList = new ArrayList<>();
|
||||
if (CollUtil.isEmpty(fpUserDetailDOS)){
|
||||
throw exception(OWNER_NOT_EXISTS);
|
||||
}
|
||||
return fpUserDetailDOS;
|
||||
}
|
||||
@Override
|
||||
public PageResult<TaskDispatchDetailTotalVO> getTaskDispatchPageDetailTotal(TaskDispatchDetailTotalVO pageTotalVO) {
|
||||
if(pageTotalVO.getDeviceModel()!=null){
|
||||
EquipManufactureDO equipManufactureDO = equipManufactureMapper.selectById(pageTotalVO.getDeviceModel());
|
||||
|
@ -72,7 +72,9 @@ export const getTaskDispatchDetailListByWorkTime = async (params) => {
|
||||
export const getOwnerList = async(id:number,type:number)=>{
|
||||
return await request.get({url:`/heli/task-dispatch/task-dispatch-detail/getOwner?id=`+id+`&type=`+type})
|
||||
}
|
||||
|
||||
export const getAssmebleDispatchPage = async() => {
|
||||
return await request.get({ url: '/heli/task-dispatch/assmebleDispatchPage' })
|
||||
}
|
||||
|
||||
export const judgeHasOver = async(id:number)=>{
|
||||
return await request.get({url:`/heli/task-dispatch/task-dispatch-detail/judgeHasOver?id=`+id})
|
||||
|
@ -278,9 +278,9 @@ ref="subFormRef" :model="formData.taskDispatchDetails" :rules="subFormRules"
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="顺序号" align="center" prop="sort" width="160">
|
||||
<template #header> <span class="hl-table_header">*</span>顺序号</template>
|
||||
<template #header> 顺序号</template>
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.sort`" :rules="subFormRules.sort" class="mb-0px!">
|
||||
<el-form-item :prop="`${$index}.sort`" class="mb-0px!">
|
||||
<el-input-number
|
||||
min="0" :precision="0" class="!w-240px"
|
||||
:disabled="detailDisabled || (row.beginProduce != 0 && row.procedureStatus != 0)" v-model="row.sort"
|
||||
@ -288,20 +288,42 @@ min="0" :precision="0" class="!w-240px"
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="负责人" align="center" prop="owner" width="180">
|
||||
<!-- <el-table-column label="负责人" align="center" prop="owner" width="180">
|
||||
<template #header> <span class="hl-table_header">*</span>负责人</template>
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.owner`" :rules="subFormRules.owner" class="mb-0px!">
|
||||
<el-form-item :prop="`${$index}.owner`" :rules="subFormRules.owner" class="mb-0px!">-->
|
||||
<!-- <UserSelect-->
|
||||
<!--v-model="row.owner" :disabled="detailDisabled || row.procedureStatus != 0"-->
|
||||
<!-- @update:new-value="handleSelectedUser($index, $event)" />-->
|
||||
<el-select v-model="row.owner" filterable :disabled="detailDisabled || (row.beginProduce != 0 && row.procedureStatus != 0)" @update:new-value="handleSelectedUser($index, $event)">
|
||||
<!-- <el-select v-model="row.owner" filterable :disabled="detailDisabled || (row.beginProduce != 0 && row.procedureStatus != 0)" @update:new-value="handleSelectedUser($index, $event)">
|
||||
<el-option
|
||||
v-for="dict in userInit" :key="dict.id"
|
||||
:label="dict.username+' '+dict.nickname" :value="dict.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>-->
|
||||
<el-table-column label="负责人" align="center" prop="owner" width="180">
|
||||
<template #header> <span class="hl-table_header">*</span>负责人</template>
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.ownerNames`" :rules="subFormRules.owner" class="mb-0px!">
|
||||
<el-input
|
||||
class="!w-265px"
|
||||
placeholder="负责人"
|
||||
v-model="row.ownerNames"
|
||||
readonly
|
||||
:disabled="detailDisabled "
|
||||
@click.prevent="handleClick(row.owners,$index)"
|
||||
>
|
||||
<template #append
|
||||
><el-button
|
||||
:icon="Search"
|
||||
:disabled="detailDisabled"
|
||||
@click="openuserDialog(row.owners,$index)"
|
||||
/></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="预计开始时间" min-width="180">
|
||||
<template #header> <span class="hl-table_header">*</span>预计开始时间</template>
|
||||
@ -473,6 +495,8 @@ v-if="formData.dispatchStatus == 2" @click="printHandle(formData.id)" :disabled=
|
||||
|
||||
<!-- 【打印发货单】 - 弹框-->
|
||||
<ProductProcessPrint ref="ProductProcessPrintRef" :info="dialogInfo" />
|
||||
<!--派工人员选择弹框-->
|
||||
<UserDialog ref="userDialogref" @success="handleuserClick" />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
@ -485,6 +509,8 @@ import {
|
||||
dateFormatter,
|
||||
formatDate
|
||||
} from "@/utils/formatTime";
|
||||
import UserDialog from './userselect.vue'
|
||||
import { Search } from '@element-plus/icons-vue'
|
||||
import {
|
||||
ref,
|
||||
watch
|
||||
@ -521,7 +547,7 @@ import * as ProcedureApi from "@/api/heli/procedure";
|
||||
defineOptions({
|
||||
name: 'TaskDispatchDetail'
|
||||
})
|
||||
|
||||
const userDialogref = ref()
|
||||
const reload = inject('reload')
|
||||
const {
|
||||
t
|
||||
@ -548,7 +574,20 @@ const formatDateT = (timestamp) => {
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
return `${year}-${month}-${day}`; // 返回 YYYY-MM-DD 格式
|
||||
}
|
||||
const handleClick = (owners,index) => {
|
||||
openuserDialog(owners,index)
|
||||
}
|
||||
const openuserDialog = (owners,index) => {
|
||||
userDialogref.value.open(owners,index)
|
||||
}
|
||||
const handleuserClick = (val, index) => {
|
||||
// 确保逻辑正确无误,例如避免直接修改reactive引用的原始数组
|
||||
formData.value.taskDispatchDetails[index].owners = val.map((item) => item.id)
|
||||
formData.value.taskDispatchDetails[index].ownerNames = val.map((item) => item.nickname)
|
||||
|
||||
// console.log(formData.value.taskDispatchDetails[index].owners);
|
||||
// console.log(formData.value.taskDispatchDetails[index].ownerNames);
|
||||
}
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
code: undefined,
|
||||
@ -566,7 +605,9 @@ const formData = ref({
|
||||
taskDispatchDetails: [],
|
||||
operateLogs: [],
|
||||
active: undefined,
|
||||
activeOpinion: ''
|
||||
activeOpinion: '',
|
||||
craftInfos:[],
|
||||
craftContent:''
|
||||
})
|
||||
|
||||
const formRef = ref() // 表单 Ref
|
||||
@ -824,7 +865,9 @@ const resetForm = () => {
|
||||
taskDispatchDetails: [],
|
||||
operateLogs: [],
|
||||
active: undefined,
|
||||
activeOpinion: ''
|
||||
activeOpinion: '',
|
||||
craftInfos:[],
|
||||
craftContent:''
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
@ -866,7 +909,22 @@ const subFormRules = reactive({
|
||||
trigger: 'blur'
|
||||
}],
|
||||
})
|
||||
const arrayEmpty = (list : any[]) => {
|
||||
if(list != null && list.length > 0){
|
||||
return false;
|
||||
}else{
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
const strEmpty = (str : string) => {
|
||||
if(str != null && str !== ''){
|
||||
return false;
|
||||
}else{
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
const queryData = async (id?: number) => {
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
@ -874,6 +932,11 @@ const queryData = async (id?: number) => {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await TaskDispatchApi.getTaskDispatch(id)
|
||||
if(formData.value.craftContent != null && formData.value.craftContent != ''){
|
||||
formData.value.craftInfos = JSON.parse(formData.value.craftContent)
|
||||
console.log(formData.value.craftInfos)
|
||||
}
|
||||
|
||||
formData.value.taskDispatchDetails = await TaskDispatchApi.getTaskDispatchDetailListByDispatchId(id)
|
||||
formData.value.bomCode = 'BOM-' + formData.value.projectSubCode
|
||||
if (formData.value.dispatchStatus == 2) {
|
||||
@ -1002,6 +1065,14 @@ const onAddItem = () => {
|
||||
beginProduce: 0,
|
||||
dispatchId: undefined,
|
||||
}
|
||||
if(!arrayEmpty(formData.value.craftInfos)){
|
||||
formData.value.craftInfos.forEach(item => {
|
||||
if(item.name == '装配'){
|
||||
row.startTime = item.startDate;
|
||||
row.endTime = item.endDate
|
||||
}
|
||||
})
|
||||
}
|
||||
row.amount = formData.value.projectSubAmount
|
||||
row.dispatchId = formData.value.id
|
||||
formData.value.taskDispatchDetails.push(row)
|
||||
|
@ -0,0 +1,320 @@
|
||||
<template>
|
||||
<Dialog title="职工信息" width="80%" v-model="dialogVisible" center>
|
||||
<ContentWrap class="borderxx">
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="108px">
|
||||
<el-form-item label="姓名/工号" label-width="130px" prop="nickname">
|
||||
<el-input v-model="queryParams.userNickName" placeholder="请输入姓名/工号" clearable @keyup.enter="handleQuery" class="!w-240px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属部门" prop="deptId">
|
||||
<el-tree-select v-model="queryParams.deptId" :data="deptList" :props="defaultProps" check-strictly node-key="id" clearable placeholder="请选择所属部门" />
|
||||
</el-form-item>
|
||||
<el-form-item label="岗位" prop="postId">
|
||||
<el-select v-model="queryParams.postIdNew" clearable placeholder="请选择岗位">
|
||||
<el-option v-for="dict in postList" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery" type="primary">
|
||||
<Icon icon="ep:search" class="mr-5px" /> 搜索
|
||||
</el-button>
|
||||
<el-button @click="resetQuery">
|
||||
<Icon icon="ep:refresh" class="mr-5px" /> 重置
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
<el-card class="hl-card">
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table ref="multipleTable" v-loading="loading" :data="list" :stripe="true" height="100%" :show-overflow-tooltip="true" :reserve-selection="true" class="hl-table" @selection-change="handleSelectionChange" :row-key="getRowKeys" @row-click="clickRow" selection :style="{height: list && list.length > 9 ? '475px' : ''}">
|
||||
<el-table-column type="selection" width="55" :reserve-selection="true" />
|
||||
<el-table-column type="index" min-width="70" label="序号" align="center" />
|
||||
|
||||
<el-table-column label="工号" align="center" prop="username" :show-overflow-tooltip="true" min-width="120" />
|
||||
<el-table-column label="姓名" align="center" prop="nickname" :show-overflow-tooltip="true" min-width="120" />
|
||||
<el-table-column label="部门" align="center" key="deptName" prop="deptName" :show-overflow-tooltip="true" min-width="120" />
|
||||
<el-table-column label="岗位" align="center" prop="postIdNew" min-width="120" />
|
||||
<el-table-column label="手机号码" align="center" prop="mobile" min-width="120" />
|
||||
<!-- <el-table-column label="性别" align="center" prop="sex" min-width="120"> -->
|
||||
<!-- <template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="scope.row.sex" />
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<!-- <Pagination :total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize" @pagination="getList" /> -->
|
||||
</ContentWrap>
|
||||
</el-card>
|
||||
<template #footer>
|
||||
<el-button @click="dialogVisible = false" size="large">取 消</el-button>
|
||||
<el-button @click="submitForm" type="success" size="large">保 存</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import { CommonStatusEnum } from '@/utils/constants'
|
||||
import { defaultProps, handleTree } from '@/utils/tree'
|
||||
import * as PostApi from '@/api/system/post'
|
||||
import * as DeptApi from '@/api/system/dept'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
import * as DispatchApi from '@/api/heli/taskdispatch'
|
||||
import { FormRules } from 'element-plus'
|
||||
import { ElTable } from 'element-plus'
|
||||
import { any, string } from 'vue-types'
|
||||
import { toRefs } from 'vue'
|
||||
const beforeOwnerList = ref([])
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
const router = useRouter()
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
|
||||
const deptList = ref<Tree[]>([]) // 树形结构
|
||||
const postList = ref([]) // 岗位列表
|
||||
|
||||
//接收父组件传递过来的值
|
||||
const props = defineProps({
|
||||
dialogType: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
const dialogTypeValue = toRefs(props).dialogType // 获取 props 中的 dialogType
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 999,
|
||||
userNickName: undefined,
|
||||
nickname: undefined,
|
||||
deptId: undefined,
|
||||
postIdNew:'',
|
||||
postId: undefined,
|
||||
status: 0
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const finalToggleList : any = ref([])
|
||||
const thisPageList : any = ref([])
|
||||
/** 查询列表 */
|
||||
const arrayEmpty = (list : any[]) => {
|
||||
if(list != null && list.length > 0){
|
||||
return false;
|
||||
}else{
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
const strEmpty = (str : string) => {
|
||||
if(str != null && str !== ''){
|
||||
return false;
|
||||
}else{
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
// 清除选中状态
|
||||
try {
|
||||
postList.value = [];
|
||||
list.value = []
|
||||
var hasSet = new Set;
|
||||
const data = await UserApi.getUserPage(queryParams)
|
||||
var ownerList = await DispatchApi.getAssmebleDispatchPage();
|
||||
if(!arrayEmpty(ownerList)){
|
||||
ownerList.forEach(item => {
|
||||
data.list.forEach( item1 =>{
|
||||
if(item.busyId == item1.id){
|
||||
if(!strEmpty(queryParams.postIdNew)){
|
||||
if(item.postId == queryParams.postIdNew){
|
||||
let newItem = { postIdNew: item.postId, ...item1 };
|
||||
list.value.push(newItem)
|
||||
hasSet.add(item.postId)
|
||||
}
|
||||
}else{
|
||||
let newItem = { postIdNew: item.postId, ...item1 };
|
||||
list.value.push(newItem)
|
||||
hasSet.add(item.postId)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
if(!arrayEmpty(list.value)){
|
||||
if(!arrayEmpty(beforeOwnerList.value )){
|
||||
//反选
|
||||
beforeOwnerList.value.forEach(item =>{
|
||||
list.value.forEach(item1 =>{
|
||||
if(item == item1.id){
|
||||
multipleSelection.value.push(item1);
|
||||
multipleTable.value.toggleRowSelection(item1, true)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
total.value = list.value.length;
|
||||
}else{
|
||||
total.value = 0
|
||||
}
|
||||
|
||||
hasSet.forEach(item =>{
|
||||
postList.value.push({
|
||||
label:item,
|
||||
value:item
|
||||
})
|
||||
})
|
||||
}else{
|
||||
list.value = []
|
||||
total.value = 0
|
||||
}
|
||||
// console.log(ownerList)
|
||||
// list.value = data.list
|
||||
// total.value = data.total
|
||||
// if((finalToggleList.value == null || finalToggleList.value.length == 0 )&& (multipleSelection.value == null || multipleSelection.value.length == 0)){
|
||||
// console.log('1')
|
||||
// }else if ((finalToggleList.value == null || finalToggleList.value.length == 0 )&& multipleSelection.value != null && multipleSelection.value.length >0){
|
||||
// multipleSelection.value.forEach(item =>{
|
||||
// finalToggleList.value.push(item);
|
||||
// })
|
||||
// multipleTable.value.clearSelection();
|
||||
// }else if (finalToggleList.value != null && finalToggleList.value.length >0 && multipleSelection.value != null && multipleSelection.value.length >0){
|
||||
|
||||
// if(thisPageList.value != null && thisPageList.value.length > 0){
|
||||
// console.log('3')
|
||||
// // 在 multipleSelection 中但不在 thisPageList 中的数据 添加
|
||||
// const inMultipleNotInThisPage = multipleSelection.value.filter(msItem =>
|
||||
// !thisPageList.value.some(tpItem => tpItem.id === msItem.id)
|
||||
// );
|
||||
|
||||
// // 在 thisPageList 中却不在 multipleSelection 中的数据 删除
|
||||
// const inThisPageNotInMultiple = thisPageList.value.filter(tpItem =>
|
||||
// !multipleSelection.value.some(msItem => msItem.id === tpItem.id)
|
||||
// );
|
||||
|
||||
// // 创建一个以 id 为键的对象,用于快速查找 finalToggleList 中的元素
|
||||
// const finalToggleListObj = finalToggleList.value.reduce((acc, item) => {
|
||||
// acc[item.id] = item;
|
||||
// return acc;
|
||||
// }, {});
|
||||
|
||||
// // 添加 inMultipleNotInThisPage 中的数据到 finalToggleListObj
|
||||
// inMultipleNotInThisPage.forEach(item => {
|
||||
// finalToggleListObj[item.id] = item;
|
||||
// });
|
||||
|
||||
// // 删除 inThisPageNotInMultiple 中的数据从 finalToggleListObj
|
||||
// inThisPageNotInMultiple.forEach(item => {
|
||||
// delete finalToggleListObj[item.id];
|
||||
// });
|
||||
|
||||
// // 将 finalToggleListObj 转换回数组
|
||||
// const updatedFinalToggleList = Object.values(finalToggleListObj);
|
||||
|
||||
// // 如果 finalToggleList 是响应式的,例如在 Vue.js 中,你可能需要更新原始的响应式变量
|
||||
// finalToggleList.value = updatedFinalToggleList;
|
||||
// thisPageList.value = []
|
||||
// multipleTable.value.clearSelection();
|
||||
// }else{
|
||||
// console.log('4')
|
||||
// multipleSelection.value.forEach(item => {
|
||||
// finalToggleList.value.push(item)
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
// }else if (finalToggleList.value != null && finalToggleList.value.length >0 && ( multipleSelection.value == null || multipleSelection.value.length == 0) ){
|
||||
// console.log('5')
|
||||
// finalToggleList.value.forEach(item => {
|
||||
// const row = list.value.find(r => r.matId === item.matId);
|
||||
// console.log(row)
|
||||
// if (row) {
|
||||
// multipleTable.value.toggleRowSelection(row, true);
|
||||
// thisPageList.value.push(row);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// console.log(multipleSelection.value)
|
||||
// console.log(finalToggleList.value)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
const multipleTable: any = ref<InstanceType<typeof ElTable>>()
|
||||
const multipleSelection: any = ref([])
|
||||
|
||||
const handleSelectionChange = (val: []) => {
|
||||
multipleSelection.value = val
|
||||
}
|
||||
|
||||
//指定key值,数据更新之后保留之前选中的数据
|
||||
const getRowKeys = (row) => {
|
||||
return row.id
|
||||
}
|
||||
const clickRow = (row: any) => {
|
||||
if (row) {
|
||||
multipleTable.value!.toggleRowSelection(row, undefined)
|
||||
} else {
|
||||
multipleTable.value!.clearSelection()
|
||||
}
|
||||
}
|
||||
|
||||
/** 提交表单 */
|
||||
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = () => {
|
||||
if (!multipleSelection.value || multipleSelection.value.length <= 0) {
|
||||
message.warning(t('common.selectText'))
|
||||
return
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
// console.log(dialogTypeValue.value)
|
||||
console.log(multipleSelection.value);
|
||||
|
||||
emit('success', multipleSelection.value, faindex.value)
|
||||
//重置父组件传递过来的值
|
||||
}
|
||||
|
||||
const userInit = ref()
|
||||
const faindex =ref()
|
||||
/** 打开弹窗 */
|
||||
const open = async (owners,index) => {
|
||||
multipleSelection.value=[]
|
||||
console.log(owners)
|
||||
beforeOwnerList.value = owners;
|
||||
faindex.value=index
|
||||
dialogVisible.value = true
|
||||
queryParams.userNickName = undefined
|
||||
queryParams.deptId = undefined
|
||||
queryParams.postId = undefined
|
||||
// 加载部门树
|
||||
deptList.value = handleTree(await DeptApi.getSimpleDeptList())
|
||||
// 加载岗位列表
|
||||
// postList.value = await PostApi.getSimplePostList()
|
||||
|
||||
//用户列表数据
|
||||
userInit.value = await UserApi.getSimpleUserList()
|
||||
handleQuery()
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user