项目列表和分包单位以及迁移人员
This commit is contained in:
@ -115,6 +115,9 @@
|
||||
<el-button link type="danger" icon="Avatar" @click="handleJoinBlacklist(scope.row)" v-hasPermi="['project:constructionBlacklist:add']">
|
||||
黑名单
|
||||
</el-button>
|
||||
<el-button link type="primary" icon="Switch" @click="handleChange(scope.row)" v-hasPermi="['project:constructionBlacklist:add']">
|
||||
人员迁移
|
||||
</el-button>
|
||||
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['project:constructionUser:remove']">
|
||||
删除
|
||||
</el-button>
|
||||
@ -265,6 +268,24 @@
|
||||
<el-dialog title="施工人员详情" v-model="showDetailDrawer">
|
||||
<construction-user-detail :user-id="currentUserId" />
|
||||
</el-dialog>
|
||||
<el-dialog :title="skipName + '-人员迁移'" v-model="skip" width="500px">
|
||||
<el-form-item label="所属项目" label-width="130px">
|
||||
<el-select v-model="skipObject.projectId" @change="selectProject" placeholder="请选择所属项目" style="width: 240px">
|
||||
<el-option v-for="item in skipOptions" :key="item.id" :label="item.projectName" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="分包单位" label-width="130px">
|
||||
<el-select v-model="skipObject.contractorId" :disabled="!skipObject.projectId" placeholder="请选择分包单位" style="width: 240px">
|
||||
<el-option v-for="item in contractorList" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="setUnits">确认</el-button>
|
||||
<el-button @click="skip = false"> 取消 </el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -274,9 +295,18 @@ import {
|
||||
delConstructionUser,
|
||||
getConstructionUser,
|
||||
listConstructionUser,
|
||||
updateConstructionUser
|
||||
updateConstructionUser,
|
||||
getProjectContractorList,
|
||||
transferConstructionUser
|
||||
} from '@/api/project/constructionUser';
|
||||
import { ConstructionUserForm, ConstructionUserQuery, ConstructionUserVO } from '@/api/project/constructionUser/types';
|
||||
import {
|
||||
ConstructionUserForm,
|
||||
ConstructionUserQuery,
|
||||
ConstructionUserVO,
|
||||
skipType,
|
||||
skipOptionType,
|
||||
skipTeamType
|
||||
} from '@/api/project/constructionUser/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
import { listContractor } from '@/api/project/contractor';
|
||||
import { listProjectTeam } from '@/api/project/projectTeam';
|
||||
@ -300,15 +330,25 @@ const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
|
||||
const skip = ref(false);
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const constructionUserFormRef = ref<ElFormInstance>();
|
||||
|
||||
const skipName = ref('');
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
//人员迁移条件
|
||||
const skipObject: skipType = reactive({
|
||||
id: '',
|
||||
projectId: '',
|
||||
contractorId: ''
|
||||
});
|
||||
const contractorList = ref<Array<skipTeamType>>([]);
|
||||
//项目列表
|
||||
const skipOptions = ref<Array<skipOptionType>>([]);
|
||||
|
||||
const initFormData: ConstructionUserForm = {
|
||||
id: undefined,
|
||||
openid: undefined,
|
||||
@ -392,6 +432,21 @@ const getList = async () => {
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
const selectProject = (e: any) => {
|
||||
//选中项目筛选出项目下的分包单位
|
||||
contractorList.value = skipOptions.value.filter((item) => item.id == e)[0].contractorList;
|
||||
};
|
||||
|
||||
const setUnits = async () => {
|
||||
//人员迁移
|
||||
console.log('🚀 ~ setUnits ~ skipObject:', skipObject);
|
||||
let res = await transferConstructionUser(skipObject);
|
||||
if (res.code == 200) {
|
||||
ElMessage.success(res.msg);
|
||||
skip.value = false;
|
||||
getList();
|
||||
}
|
||||
};
|
||||
const contractorOpt = ref();
|
||||
|
||||
/** 查询当前项目下的分包公司列表 */
|
||||
@ -489,6 +544,16 @@ const handleShowDrawer = (row?: ConstructionUserVO) => {
|
||||
showDetailDrawer.value = true;
|
||||
};
|
||||
|
||||
/** 人员迁移 */
|
||||
const handleChange = async (row: ConstructionUserVO) => {
|
||||
const _id = row?.id || ids.value[0];
|
||||
skipName.value = row?.userName;
|
||||
skipObject.id = _id;
|
||||
const res = await getProjectContractorList();
|
||||
skipOptions.value = res.data;
|
||||
skip.value = true;
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
constructionUserFormRef.value?.validate(async (valid: boolean) => {
|
||||
|
Reference in New Issue
Block a user