Compare commits
3 Commits
468349658d
...
a78304745c
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a78304745c | ||
![]() |
32286efe79 | ||
![]() |
a1123251ae |
@ -24,6 +24,21 @@ export interface ContractInfoVO {
|
||||
*/
|
||||
remark: string;
|
||||
|
||||
/**
|
||||
* 重要性
|
||||
*/
|
||||
manageContractLevel?: string;
|
||||
|
||||
/**
|
||||
* 合同负责人
|
||||
*/
|
||||
contractManagerId?: string;
|
||||
|
||||
/**
|
||||
* 合同负责人
|
||||
*/
|
||||
contractManager?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface ContractInfoForm extends BaseEntity {
|
||||
@ -52,6 +67,21 @@ export interface ContractInfoForm extends BaseEntity {
|
||||
*/
|
||||
remark?: string;
|
||||
|
||||
/**
|
||||
* 重要性
|
||||
*/
|
||||
manageContractLevel?: string;
|
||||
|
||||
/**
|
||||
* 合同负责人id
|
||||
*/
|
||||
contractManagerId?: string;
|
||||
|
||||
/**
|
||||
* 合同负责人
|
||||
*/
|
||||
contractManager?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface ContractInfoQuery extends PageQuery {
|
||||
|
@ -43,7 +43,7 @@
|
||||
<!-- <el-table-column label="" align="center" prop="id" v-if="true" />-->
|
||||
<el-table-column label="合同编码" align="center" prop="contractCode" fixed="left"/>
|
||||
<el-table-column label="合同名称" align="center" prop="contractName" width="300" fixed="left"/>
|
||||
<el-table-column label="合同负责人" align="center" prop="contractCode" />
|
||||
<el-table-column label="合同负责人" align="center" prop="contractManager" />
|
||||
<el-table-column label="重要性" align="center" prop="contractLevel" >
|
||||
<template #default="scope">
|
||||
<dict-tag :options="manage_contract_level" :value="scope.row.contractLevel" />
|
||||
@ -97,6 +97,18 @@
|
||||
<el-select v-model="form.manageContractLevel" placeholder="请选择">
|
||||
<el-option v-for="dict in manage_contract_level" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="合同重要性" prop="manageContractLevel">
|
||||
<el-select v-model="form.manageContractLevel" placeholder="请选择">
|
||||
<el-option v-for="dict in manage_contract_level" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="合同负责人" prop="contractManagerId">
|
||||
<el-button type="primary" icon="Plus" circle @click="openUserSelect" />
|
||||
<el-tag v-for="user in selectUserList" :key="user.userId" closable style="margin: 2px"
|
||||
@close="handleCloseTag(user)">
|
||||
{{ user.employeeName }}
|
||||
</el-tag>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
@ -108,6 +120,8 @@
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<UserSelect ref="userSelectRef" :multiple="false" :data="selectUserIds" @confirm-call-back="userSelectCallBack">
|
||||
</UserSelect>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
@ -115,7 +129,8 @@
|
||||
<script setup name="ContractInfo" lang="ts">
|
||||
import { listContractInfo, getContractInfo, delContractInfo, addContractInfo, updateContractInfo } from '@/api/manage/contract';
|
||||
import { ContractInfoVO, ContractInfoQuery, ContractInfoForm } from '@/api/manage/contract/types';
|
||||
|
||||
import UserSelect from '@/components/UserSelect/index.vue';
|
||||
import { UserVO } from '@/api/system/user/types';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const contractInfoList = ref<ContractInfoVO[]>([]);
|
||||
@ -129,7 +144,12 @@ const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const contractInfoFormRef = ref<ElFormInstance>();
|
||||
|
||||
const userFormRef = ref<ElFormInstance>();
|
||||
//user
|
||||
const selectUserList = ref<UserVO[]>([]);
|
||||
//userid
|
||||
const selectUserIds = ref<string>(undefined);
|
||||
const userSelectRef = ref<InstanceType<typeof UserSelect>>();
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
@ -162,7 +182,6 @@ const data = reactive<PageData<ContractInfoForm, ContractInfoQuery>>({
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
const { manage_contract_type,manage_contract_level } = toRefs<any>(proxy?.useDict('manage_contract_type','manage_contract_level'));
|
||||
|
||||
/** 查询合同信息列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
@ -218,6 +237,32 @@ const handleUpdate = async (row?: ContractInfoVO) => {
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = "修改合同信息";
|
||||
console.log(row)
|
||||
const newUser: UserVO = {
|
||||
userId: form.value.contractManagerId,
|
||||
employeeName: form.value.contractManager,
|
||||
tenantId: undefined,
|
||||
deptId: undefined,
|
||||
userName: undefined,
|
||||
nickName: undefined,
|
||||
userType: undefined,
|
||||
email: undefined,
|
||||
phonenumber: undefined,
|
||||
sex: undefined,
|
||||
avatar: undefined,
|
||||
status: undefined,
|
||||
delFlag: undefined,
|
||||
loginIp: undefined,
|
||||
loginDate: undefined,
|
||||
remark: undefined,
|
||||
deptName: undefined,
|
||||
roles: undefined,
|
||||
roleIds: undefined,
|
||||
postIds: undefined,
|
||||
roleId: undefined,
|
||||
admin: undefined
|
||||
};
|
||||
selectUserList.value[0] = newUser;
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
@ -253,6 +298,46 @@ const handleExport = () => {
|
||||
}, `contractInfo_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
//打开人员
|
||||
const openUserSelect = () => {
|
||||
if (userSelectRef.value) {
|
||||
userSelectRef.value.open();
|
||||
// 确保 UserSelect 的 data 是数组格式(即使单选也传数组)
|
||||
userSelectRef.value.$el.querySelector('input')?.focus(); // 可选:自动聚焦输入框
|
||||
console.log('selectUserList')
|
||||
console.log(selectUserList)
|
||||
if (selectUserList.value.length !== 0) {
|
||||
console.log('selectUserList不为空')
|
||||
selectUserIds.value = selectUserList.value.map((item) => item.userId).join(',');
|
||||
}else{
|
||||
selectUserIds.value = undefined;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
//确认人员
|
||||
const userSelectCallBack = (data: UserVO[]) => {
|
||||
if (data && data.length > 0) {
|
||||
selectUserList.value = data;
|
||||
selectUserIds.value = data[0].userId.toString();
|
||||
// 单选模式下直接取第一个用户的ID
|
||||
form.value.contractManagerId = selectUserIds.value; // 同步到表单(关键!)
|
||||
} else {
|
||||
selectUserList.value = [];
|
||||
selectUserIds.value = '';
|
||||
form.value.contractManagerId = ''; // 清空表单
|
||||
}
|
||||
};
|
||||
//删除人员
|
||||
const handleCloseTag = (user: UserVO) => {
|
||||
const userId = user.userId;
|
||||
// 使用split删除用户
|
||||
const index = selectUserList.value.findIndex((item) => item.userId === userId);
|
||||
selectUserList.value.splice(index, 1);
|
||||
selectUserIds.value = selectUserList.value.map((item) => item.userId).join(',');
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user