项目-商机
parent
c76055af50
commit
bb812d011f
|
|
@ -112,6 +112,11 @@ export const getCustomer = async (id: number) => {
|
|||
return await request.get({ url: `/crm/customer/get?id=` + id })
|
||||
}
|
||||
|
||||
// 查询客户详情带报价单
|
||||
export const getCustomerDetail = async (id: number) => {
|
||||
return await request.get({ url: `/crm/customer/get-contract-customer-detail?id=` + id })
|
||||
}
|
||||
|
||||
// 新增客户
|
||||
export const createCustomer = async (data: CustomerVO) => {
|
||||
return await request.post({ url: `/crm/customer/create`, data })
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
import request from '@/config/axios'
|
||||
|
||||
// 项目奖金 VO
|
||||
export interface ProjectBonusVO {
|
||||
id: number // 唯一主键
|
||||
projectId: number // 项目ID
|
||||
userId: number // 员工ID
|
||||
bonusPercentage: number // 奖金百分比
|
||||
bonusAmount: number // 奖金金额
|
||||
bonusIssueDate: Date // 奖金发放日期
|
||||
bonusState: number // 奖金发放状态
|
||||
}
|
||||
|
||||
// 项目奖金 API
|
||||
export const ProjectBonusApi = {
|
||||
// 查询项目奖金分页
|
||||
getProjectBonusPage: async (params: any) => {
|
||||
return await request.get({ url: `/tts/project-bonus/page`, params })
|
||||
},
|
||||
|
||||
// 查询项目奖金详情
|
||||
getProjectBonus: async (id: number) => {
|
||||
return await request.get({ url: `/tts/project-bonus/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增项目奖金
|
||||
createProjectBonus: async (data: ProjectBonusVO) => {
|
||||
return await request.post({ url: `/tts/project-bonus/create`, data })
|
||||
},
|
||||
|
||||
// 修改项目奖金
|
||||
updateProjectBonus: async (data: ProjectBonusVO) => {
|
||||
return await request.put({ url: `/tts/project-bonus/update`, data })
|
||||
},
|
||||
|
||||
// 删除项目奖金
|
||||
deleteProjectBonus: async (id: number) => {
|
||||
return await request.delete({ url: `/tts/project-bonus/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出项目奖金 Excel
|
||||
exportProjectBonus: async (params) => {
|
||||
return await request.download({ url: `/tts/project-bonus/export-excel`, params })
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
import request from '@/config/axios'
|
||||
|
||||
// 项目管理 VO
|
||||
export interface ProjectVO {
|
||||
id: number // 唯一主键
|
||||
projectCode: string // 项目编号
|
||||
name: string // 项目名称
|
||||
projectLevel: number // 项目级别,字典值:简单、一般、中等、困难、比较困难
|
||||
projectType: number // 项目类型,字典值
|
||||
userId: number // 项目负责人ID
|
||||
startDate: Date // 项目开始日期
|
||||
endDate: Date // 项目结束日期
|
||||
attachment: string // 项目附件
|
||||
bonusEvaluation: boolean // 立项奖金评估,1: 是,2: 否
|
||||
bonusAmount: number // 立项奖金金额
|
||||
bonusIssueDate: Date // 奖金发放日期
|
||||
background: string // 项目背景
|
||||
introduction: string // 项目简介
|
||||
expectation: string // 项目预期成果
|
||||
progress: number // 项目进度
|
||||
processInstanceId: string // 工作流编号
|
||||
auditStatus: number // 审批状态
|
||||
}
|
||||
|
||||
// 项目管理 API
|
||||
export const ProjectApi = {
|
||||
// 查询项目管理分页
|
||||
getProjectPage: async (params: any) => {
|
||||
return await request.get({ url: `/tts/project/page`, params })
|
||||
},
|
||||
|
||||
// 查询项目管理详情
|
||||
getProject: async (id: number) => {
|
||||
return await request.get({ url: `/tts/project/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增项目管理
|
||||
createProject: async (data: ProjectVO) => {
|
||||
return await request.post({ url: `/tts/project/create`, data })
|
||||
},
|
||||
|
||||
// 修改项目管理
|
||||
updateProject: async (data: ProjectVO) => {
|
||||
return await request.put({ url: `/tts/project/update`, data })
|
||||
},
|
||||
|
||||
// 删除项目管理
|
||||
deleteProject: async (id: number) => {
|
||||
return await request.delete({ url: `/tts/project/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出项目管理 Excel
|
||||
exportProject: async (params) => {
|
||||
return await request.download({ url: `/tts/project/export-excel`, params })
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
import request from '@/config/axios'
|
||||
|
||||
// 任务 VO
|
||||
export interface ProjectTaskVO {
|
||||
id: number // 唯一主键
|
||||
taskName: string // 任务名称
|
||||
userId: number // 任务负责人
|
||||
taskLevel: number // 任务优先级
|
||||
startDate: Date // 开始日期
|
||||
endDate: Date // 截止日期
|
||||
attachment: string // 任务附件
|
||||
taskDescribe: string // 任务描述
|
||||
taskProgress: number // 任务进度
|
||||
projectId: number // 项目Id
|
||||
taskState: number // 任务状态
|
||||
processInstanceId: string // 工作流编号
|
||||
auditStatus: number // 审批状态
|
||||
}
|
||||
|
||||
// 任务 API
|
||||
export const ProjectTaskApi = {
|
||||
// 查询任务分页
|
||||
getProjectTaskPage: async (params: any) => {
|
||||
return await request.get({ url: `/tts/project-task/page`, params })
|
||||
},
|
||||
|
||||
// 查询任务详情
|
||||
getProjectTask: async (id: number) => {
|
||||
return await request.get({ url: `/tts/project-task/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增任务
|
||||
createProjectTask: async (data: ProjectTaskVO) => {
|
||||
return await request.post({ url: `/tts/project-task/create`, data })
|
||||
},
|
||||
|
||||
// 修改任务
|
||||
updateProjectTask: async (data: ProjectTaskVO) => {
|
||||
return await request.put({ url: `/tts/project-task/update`, data })
|
||||
},
|
||||
|
||||
// 删除任务
|
||||
deleteProjectTask: async (id: number) => {
|
||||
return await request.delete({ url: `/tts/project-task/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出任务 Excel
|
||||
exportProjectTask: async (params) => {
|
||||
return await request.download({ url: `/tts/project-task/export-excel`, params })
|
||||
}
|
||||
}
|
||||
|
|
@ -776,6 +776,47 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/project',
|
||||
component: Layout,
|
||||
name: 'ProCenter',
|
||||
meta: { hidden: true },
|
||||
children: [
|
||||
{
|
||||
path: 'project/ProjectForm',
|
||||
name: 'ProProAdd',
|
||||
meta: {
|
||||
title: '项目管理新增',
|
||||
noCache: true,
|
||||
hidden: true,
|
||||
activeMenu: '/project/project'
|
||||
},
|
||||
component: () => import('@/views/task/project/ProjectForm.vue')
|
||||
},
|
||||
{
|
||||
path: 'project/ProjectFormEdit',
|
||||
name: 'ProProEdit',
|
||||
meta: {
|
||||
title: '项目管理新增',
|
||||
noCache: true,
|
||||
hidden: true,
|
||||
activeMenu: '/project/project'
|
||||
},
|
||||
component: () => import('@/views/task/project/ProjectForm.vue')
|
||||
},
|
||||
{
|
||||
path: 'project/ProjectDetail',
|
||||
name: 'ProProDetail',
|
||||
meta: {
|
||||
title: '项目管理详情',
|
||||
noCache: true,
|
||||
hidden: true,
|
||||
activeMenu: '/project/project'
|
||||
},
|
||||
component: () => import('@/views/task/project/ProjectDetail.vue')
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/ai',
|
||||
component: Layout,
|
||||
|
|
|
|||
|
|
@ -234,6 +234,11 @@ export enum DICT_TYPE {
|
|||
CREDIT_CALC_CYCLE = "credit_calc_cycle",//授信计算周期
|
||||
|
||||
|
||||
// ========== ERP - 企业资源计划模块 ==========
|
||||
TTS_PROJECT_LEVEL="tts_project_level", //项目级别
|
||||
TTS_PROJECT_TYPE="tts_project_type", //项目类型
|
||||
|
||||
|
||||
// ========== ERP - 企业资源计划模块 ==========
|
||||
ERP_AUDIT_STATUS = 'erp_audit_status', // ERP 审批状态
|
||||
ERP_STOCK_RECORD_BIZ_TYPE = 'erp_stock_record_biz_type', // 库存明细的业务类型
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ watch(
|
|||
// 循环处理
|
||||
val.forEach((item) => {
|
||||
if (item.offlinePrice != null && item.onlinePrice != null) {
|
||||
item.totalPrice = item.offlinePrice + item.onlinePrice;
|
||||
item.totalPrice = Number(item.offlinePrice) + Number(item.onlinePrice);
|
||||
} else {
|
||||
item.totalPrice = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -771,7 +771,7 @@ const onCustomerChange = async (customerId: string) => {
|
|||
|
||||
try {
|
||||
formLoading.value = true;
|
||||
const customerRes = await CustomerApi.getCustomer(customerId);
|
||||
const customerRes = await CustomerApi.getCustomerDetail(customerId);
|
||||
formData.value.cooperationType = customerRes.cooperationType;
|
||||
formData.value.companyType = customerRes.companyType;
|
||||
formData.value.listingStatus = customerRes.listingStatus;
|
||||
|
|
@ -833,7 +833,6 @@ onMounted(async () => {
|
|||
customerList.value = await CustomerApi.getCustomerSimpleList()
|
||||
// 获得用户列表
|
||||
userOptions.value = await UserApi.getSimpleUserList()
|
||||
console.log('%csrc/views/crm/contract/ContractForm.vue:827 userOptions.value', 'color: #007acc;', userOptions.value);
|
||||
// 获得报价列表
|
||||
quotationList.value = await QuotationApi.getSelfSimpleQuotationList()
|
||||
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@
|
|||
</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
command="handleChange"
|
||||
v-if="checkPermi(['crm:contract:change']) && scope.row.auditStatus === 0"
|
||||
v-if="checkPermi(['crm:contract:change']) && scope.row.auditStatus === 2"
|
||||
>
|
||||
合同变更
|
||||
</el-dropdown-item>
|
||||
|
|
@ -395,7 +395,7 @@ const handleChange = (row) => {
|
|||
}
|
||||
|
||||
/** 操作分发 */
|
||||
const handleCommand = (command: string, row: UserApi.UserVO) => {
|
||||
const handleCommand = (command: string, row) => {
|
||||
switch (command) {
|
||||
case 'handleSubmit':
|
||||
handleSubmit(row)
|
||||
|
|
@ -486,7 +486,7 @@ const onPrintContract = async (row: ContractApi.ContractVO) => {
|
|||
// }
|
||||
// }
|
||||
// link.click()
|
||||
console.log('%csrc/views/crm/contract/index.vue:489 res.data', 'color: #007acc;', res);
|
||||
// console.log('%csrc/views/crm/contract/index.vue:489 res.data', 'color: #007acc;', res);
|
||||
window.open(res)
|
||||
|
||||
// message.success('提交审核成功!')
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|||
const changeProduct = (val) => {
|
||||
let arr = productList.value.filter(v => v.id === val)
|
||||
if (arr.length) {
|
||||
formData.value.projectCode = arr[0]['projectCode']
|
||||
formData.value.projectCode = arr[0]['no']
|
||||
formData.value.category = arr[0]['category']
|
||||
formData.value.detailType = arr[0]['detailType']
|
||||
formData.value.unit = arr[0]['unit']
|
||||
|
|
|
|||
|
|
@ -0,0 +1,149 @@
|
|||
<template>
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="唯一主键" align="center" prop="id" />
|
||||
<!-- <el-table-column label="项目ID" align="center" prop="projectId" /> -->
|
||||
<el-table-column label="姓名" align="center" prop="userId" />
|
||||
<el-table-column label="系统占比" align="center" prop="bonusPercentage">
|
||||
<template #default="scope">
|
||||
{{(scope.row.bonusPercentage * 100).toFixed(2) + '%'}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="团队奖金" align="center" prop="bonusAmount" />
|
||||
<el-table-column label="所得奖金" align="center" prop="bonusIssueDate" />
|
||||
<el-table-column label="操作" align="center" min-width="120px">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['task:project-bonus:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-row justify="center" class="mt-3" >
|
||||
<el-button @click="openForm" round>+ 添加</el-button>
|
||||
</el-row>
|
||||
<!-- <el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['task:project-bonus:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button> -->
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<ProjectBonusForm ref="formRef" @success="getList" :id="id" :userOptions="userOptions" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { ProjectBonusApi, ProjectBonusVO } from '@/api/task/bonus'
|
||||
import ProjectBonusForm from './ProjectBonusForm.vue'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
|
||||
/** 项目奖金 列表 */
|
||||
defineOptions({ name: 'ProjectBonus' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
const props = defineProps({
|
||||
id: propTypes.number.def(undefined),
|
||||
userOptions: [],
|
||||
})
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<ProjectBonusVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
projectId: undefined,
|
||||
userId: undefined,
|
||||
bonusPercentage: undefined,
|
||||
bonusAmount: undefined,
|
||||
bonusIssueDate: [],
|
||||
bonusState: undefined,
|
||||
createTime: []
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await ProjectBonusApi.getProjectBonusPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
emit('success', list.value)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await ProjectBonusApi.deleteProjectBonus(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await ProjectBonusApi.exportProjectBonus(queryParams)
|
||||
download.excel(data, '项目奖金.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
<template>
|
||||
<Dialog title="添加成员" v-model="dialogVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="110px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="成员姓名" prop="userId">
|
||||
<el-select v-model="formData.userId" placeholder="请选择成员姓名">
|
||||
<el-option
|
||||
v-for="dict in userOptions"
|
||||
:key="dict.id"
|
||||
:label="dict.nickname"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="奖金系数占比" prop="bonusPercentage">
|
||||
<el-input v-model="formData.bonusPercentage" oninput="value=value.match(/^\d+(?:\.\d{0,2})?/)" placeholder="请输入奖金系数占比" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ProjectBonusApi, ProjectBonusVO } from '@/api/task/bonus'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
|
||||
/** 项目奖金 表单 */
|
||||
defineOptions({ name: 'ProjectBonusForm' })
|
||||
// const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表
|
||||
|
||||
const props = defineProps({
|
||||
id: propTypes.number.def(undefined),
|
||||
userOptions: [],
|
||||
})
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const validateMin = (_: any, __: any, callback: any) => {
|
||||
const num = Number(formData.value.bonusPercentage)
|
||||
if (!num) {
|
||||
callback(new Error('请输入奖金系数占比'))
|
||||
return
|
||||
}
|
||||
if (num < 0 || num >100) {
|
||||
callback(new Error('请输入奖金系数占比'))
|
||||
return
|
||||
}
|
||||
|
||||
callback()
|
||||
}
|
||||
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
projectId: undefined,
|
||||
userId: undefined,
|
||||
bonusPercentage: undefined,
|
||||
bonusAmount: undefined,
|
||||
bonusIssueDate: undefined,
|
||||
bonusState: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }],
|
||||
userId: [{ required: true, message: '员工ID不能为空', trigger: 'blur' }],
|
||||
bonusPercentage: [{ required: true, validator: validateMin, trigger: 'blur' }],
|
||||
})
|
||||
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (id?: number) => {
|
||||
dialogVisible.value = true
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = JSON.parse(JSON.stringify(formData.value as unknown as ProjectBonusVO))
|
||||
data.projectId = props.id
|
||||
data.bonusPercentage = Number(data.bonusPercentage / 100).toFixed(4)
|
||||
await ProjectBonusApi.createProjectBonus(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
projectId: undefined,
|
||||
userId: undefined,
|
||||
bonusPercentage: undefined,
|
||||
bonusAmount: undefined,
|
||||
bonusIssueDate: undefined,
|
||||
bonusState: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,176 @@
|
|||
<template>
|
||||
<Dialog title="新增任务" v-model="dialogVisible" width="50%">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="项目名称" prop="taskName">
|
||||
<el-input v-model="formData.taskName" placeholder="请输入任务名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="项目负责人" prop="userId">
|
||||
<el-input v-model="formData.userId" placeholder="请输入任务负责人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="任务标题" prop="taskName">
|
||||
<el-input v-model="formData.taskName" placeholder="请输入任务名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="任务负责人" prop="userId">
|
||||
<el-input v-model="formData.userId" placeholder="请输入任务负责人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="开始日期" prop="startDate">
|
||||
<el-date-picker
|
||||
style="width: 100%"
|
||||
v-model="formData.startDate"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="选择开始日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="截止日期" prop="endDate">
|
||||
<el-date-picker
|
||||
v-model="formData.endDate"
|
||||
style="width: 100%"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="选择截止日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="任务优先级" prop="taskLevel">
|
||||
<el-input v-model="formData.taskLevel" placeholder="请输入任务优先级" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="任务附件" prop="attachment">
|
||||
<el-input v-model="formData.attachment" placeholder="请输入任务附件" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="任务描述" prop="taskDescribe">
|
||||
<el-input v-model="formData.taskDescribe" type="textarea" :rows="5" placeholder="请输入任务描述" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ProjectTaskApi, ProjectTaskVO } from '@/api/task/task'
|
||||
|
||||
/** 任务 表单 */
|
||||
defineOptions({ name: 'ProjectTaskForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
taskName: undefined,
|
||||
userId: undefined,
|
||||
taskLevel: undefined,
|
||||
startDate: undefined,
|
||||
endDate: undefined,
|
||||
attachment: undefined,
|
||||
taskDescribe: undefined,
|
||||
taskProgress: undefined,
|
||||
projectId: undefined,
|
||||
taskState: undefined,
|
||||
processInstanceId: undefined,
|
||||
auditStatus: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
taskName: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
|
||||
userId: [{ required: true, message: '任务负责人不能为空', trigger: 'blur' }],
|
||||
taskLevel: [{ required: true, message: '任务优先级不能为空', trigger: 'blur' }],
|
||||
startDate: [{ required: true, message: '开始日期不能为空', trigger: 'blur' }],
|
||||
endDate: [{ required: true, message: '截止日期不能为空', trigger: 'blur' }],
|
||||
taskDescribe: [{ required: true, message: '任务描述不能为空', trigger: 'blur' }],
|
||||
projectId: [{ required: true, message: '项目Id不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await ProjectTaskApi.getProjectTask(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as ProjectTaskVO
|
||||
if (formType.value === 'create') {
|
||||
await ProjectTaskApi.createProjectTask(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await ProjectTaskApi.updateProjectTask(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
taskName: undefined,
|
||||
userId: undefined,
|
||||
taskLevel: undefined,
|
||||
startDate: undefined,
|
||||
endDate: undefined,
|
||||
attachment: undefined,
|
||||
taskDescribe: undefined,
|
||||
taskProgress: undefined,
|
||||
projectId: undefined,
|
||||
taskState: undefined,
|
||||
processInstanceId: undefined,
|
||||
auditStatus: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,178 @@
|
|||
<template>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="序号" align="center" prop="id" />
|
||||
<el-table-column label="任务标题" align="center" prop="taskName" />
|
||||
<el-table-column label="任务编号" align="center" prop="taskName" />
|
||||
<el-table-column label="任务进度" align="center" prop="taskProgress" />
|
||||
<el-table-column label="任务状态" align="center" prop="taskState" />
|
||||
<el-table-column label="任务负责人" align="center" prop="userId" />
|
||||
<!-- <el-table-column label="任务优先级" align="center" prop="taskLevel">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.TTS_TASK_LEVEL" :value="scope.row.taskLevel" />
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="开始日期" align="center" prop="startDate" />
|
||||
<el-table-column label="截止日期" align="center" prop="endDate" />
|
||||
<!-- <el-table-column label="任务附件" align="center" prop="attachment" />
|
||||
<el-table-column label="任务描述" align="center" prop="taskDescribe" />
|
||||
<el-table-column label="项目Id" align="center" prop="projectId" />
|
||||
<el-table-column label="工作流编号" align="center" prop="processInstanceId" />
|
||||
<el-table-column label="审批状态" align="center" prop="auditStatus" />
|
||||
<el-table-column label="创建者" align="center" prop="creator" /> -->
|
||||
<!-- <el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="更新者" align="center" prop="updater" />
|
||||
<el-table-column
|
||||
label="更新时间"
|
||||
align="center"
|
||||
prop="updateTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/> -->
|
||||
<el-table-column label="操作" align="center" min-width="120px">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['task:project-task:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['task:project-task:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-row justify="center" class="mt-3" >
|
||||
<el-button @click="openForm" round>+ 添加</el-button>
|
||||
</el-row>
|
||||
<!-- 分页 -->
|
||||
<!-- <Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/> -->
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<ProjectTaskForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { ProjectTaskApi, ProjectTaskVO } from '@/api/task/task'
|
||||
import ProjectTaskForm from './ProjectTaskForm.vue'
|
||||
|
||||
/** 任务 列表 */
|
||||
defineOptions({ name: 'ProjectTask' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<ProjectTaskVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
taskName: undefined,
|
||||
userId: undefined,
|
||||
taskLevel: undefined,
|
||||
startDate: [],
|
||||
endDate: [],
|
||||
attachment: undefined,
|
||||
taskDescribe: undefined,
|
||||
taskProgress: undefined,
|
||||
projectId: undefined,
|
||||
taskState: undefined,
|
||||
processInstanceId: undefined,
|
||||
auditStatus: undefined,
|
||||
creator: undefined,
|
||||
createTime: [],
|
||||
updater: undefined,
|
||||
updateTime: []
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await ProjectTaskApi.getProjectTaskPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await ProjectTaskApi.deleteProjectTask(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await ProjectTaskApi.exportProjectTask(queryParams)
|
||||
download.excel(data, '任务.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
|
@ -0,0 +1,338 @@
|
|||
<template>
|
||||
<ContentWrap>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="120px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-row>
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="项目编号" prop="projectCode">
|
||||
<el-input v-model="formData.projectCode" placeholder="请输入项目编号" />
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="项目级别" prop="projectLevel">
|
||||
<el-select v-model="formData.projectLevel" disabled placeholder="请输入项目级别">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.TTS_PROJECT_LEVEL)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="项目类型" prop="projectType">
|
||||
<el-select v-model="formData.projectType" disabled placeholder="请选择项目类型">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.TTS_PROJECT_TYPE)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="项目名称" prop="name">
|
||||
<el-input v-model="formData.name" disabled placeholder="请输入项目名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="项目负责人" prop="userId">
|
||||
<el-select
|
||||
disabled
|
||||
v-model="formData.userId"
|
||||
placeholder="请选择项目负责人"
|
||||
filterable
|
||||
>
|
||||
<el-option
|
||||
v-for="item in userOptions"
|
||||
:key="item.id"
|
||||
:label="item.nickname"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="项目开始日期" prop="startDate">
|
||||
<el-date-picker
|
||||
disabled
|
||||
v-model="formData.startDate"
|
||||
style="width: 100%"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="选择项目开始日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="项目结束日期" prop="endDate">
|
||||
<el-date-picker
|
||||
disabled
|
||||
v-model="formData.endDate"
|
||||
style="width: 100%"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="选择项目结束日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="归属部门" prop="deptId">
|
||||
<el-tree-select
|
||||
disabled
|
||||
v-model="formData.deptId"
|
||||
:data="deptTree"
|
||||
:props="defaultProps"
|
||||
check-strictly
|
||||
node-key="id"
|
||||
placeholder="请选择归属部门"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="formType">
|
||||
<el-form-item label="立项奖金评估" prop="bonusEvaluation">
|
||||
<el-switch
|
||||
v-model="formData.bonusEvaluation"
|
||||
class="ml-2"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="formData.bonusEvaluation">
|
||||
<el-form-item label="立项奖金金额" prop="bonusAmount">
|
||||
<el-input v-model="formData.bonusAmount" disabled placeholder="请输入奖金评估描述" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="项目附件" prop="attachment">
|
||||
<UploadFile v-model="formData.attachment" :limit="1" :fileType="['doc','docx']"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<ContentWrap style="border: none;font-weight: 700" v-if="formData.auditStatus == 2">
|
||||
项目信息
|
||||
</ContentWrap>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="项目背景" prop="background">
|
||||
<el-input v-model="formData.background" disabled type="textarea" :rows="5" placeholder="请输入项目背景" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="项目简介" prop="introduction">
|
||||
<el-input v-model="formData.introduction" disabled type="textarea" :rows="5" placeholder="请输入项目简介" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="项目预期" prop="expectation">
|
||||
<el-input v-model="formData.expectation" disabled type="textarea" :rows="5" placeholder="请输入项目预期" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="项目进度" prop="progress">
|
||||
<el-input v-model="formData.progress" placeholder="请输入项目进度" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="工作流编号" prop="processInstanceId">
|
||||
<el-input v-model="formData.processInstanceId" placeholder="请输入工作流编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="审批状态" prop="auditStatus">
|
||||
<el-radio-group v-model="formData.auditStatus">
|
||||
<el-radio value="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
</el-row>
|
||||
<ContentWrap style="border: none;font-weight: 700" v-if="formData.auditStatus == 2">
|
||||
奖金信息
|
||||
</ContentWrap>
|
||||
<el-row v-if="formData.auditStatus == 2">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="系数总和" prop="expectation">
|
||||
<el-input v-model="formData.expectation" disabled placeholder="系数总和" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="团队奖金" prop="expectation">
|
||||
<el-input v-model="formData.expectation" disabled placeholder="团队奖金" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<ContentWrap style="border: none;font-weight: 700" v-if="formData.auditStatus == 2">
|
||||
团队成员
|
||||
</ContentWrap>
|
||||
<Bonus ref="formRef" v-if="formData.auditStatus == 2" />
|
||||
|
||||
<ContentWrap style="border: none;font-weight: 700" v-if="formData.auditStatus == 2">
|
||||
任务信息
|
||||
</ContentWrap>
|
||||
<Task ref="taskRef" v-if="formData.auditStatus == 2" />
|
||||
|
||||
</el-form>
|
||||
<div style="text-align: right" v-if="!type">
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="goBack">取 消</el-button>
|
||||
</div>
|
||||
</ContentWrap>
|
||||
|
||||
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ProjectApi, ProjectVO } from '@/api/task/project'
|
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import Bonus from '../components/Bouns.vue'
|
||||
import Task from '../components/Task.vue'
|
||||
import { defaultProps, handleTree } from '@/utils/tree'
|
||||
import * as DeptApi from '@/api/system/dept'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
const { proxy }: any = getCurrentInstance();
|
||||
|
||||
/** 项目管理 表单 */
|
||||
defineOptions({ name: 'ProjectForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const props = defineProps({
|
||||
id: propTypes.number.def(undefined),
|
||||
type: propTypes.number.def(undefined),
|
||||
})
|
||||
const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表
|
||||
const message = useMessage() // 消息弹窗
|
||||
const deptTree = ref() // 部门树形结构
|
||||
const routeId = ref('')
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
projectCode: undefined,
|
||||
name: undefined,
|
||||
projectLevel: undefined,
|
||||
projectType: undefined,
|
||||
userId: undefined,
|
||||
startDate: undefined,
|
||||
endDate: undefined,
|
||||
attachment: undefined,
|
||||
bonusEvaluation: undefined,
|
||||
bonusAmount: undefined,
|
||||
bonusIssueDate: undefined,
|
||||
background: undefined,
|
||||
introduction: undefined,
|
||||
expectation: undefined,
|
||||
progress: undefined,
|
||||
processInstanceId: undefined,
|
||||
auditStatus: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
name: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }],
|
||||
projectLevel: [{ required: true, message: '项目级别不能为空', trigger: 'change' }],
|
||||
projectType: [{ required: true, message: '项目类型不能为空', trigger: 'change' }],
|
||||
userId: [{ required: true, message: '项目负责人ID不能为空', trigger: 'blur' }],
|
||||
startDate: [{ required: true, message: '项目开始日期不能为空', trigger: 'blur' }],
|
||||
endDate: [{ required: true, message: '项目结束日期不能为空', trigger: 'blur' }],
|
||||
attachment: [{ required: true, message: '项目附件不能为空', trigger: 'blur' }],
|
||||
background: [{ required: true, message: '项目背景不能为空', trigger: 'blur' }],
|
||||
introduction: [{ required: true, message: '项目简介不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (id?: number) => {
|
||||
dialogVisible.value = true
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await ProjectApi.getProject(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as ProjectVO
|
||||
if (!formType.value) {
|
||||
await ProjectApi.createProject(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await ProjectApi.updateProject(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
goBack()
|
||||
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const goBack = ()=> {
|
||||
proxy.$router.go(-1)
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
projectCode: undefined,
|
||||
name: undefined,
|
||||
projectLevel: undefined,
|
||||
projectType: undefined,
|
||||
userId: undefined,
|
||||
startDate: undefined,
|
||||
endDate: undefined,
|
||||
attachment: undefined,
|
||||
bonusEvaluation: undefined,
|
||||
bonusAmount: undefined,
|
||||
bonusIssueDate: undefined,
|
||||
background: undefined,
|
||||
introduction: undefined,
|
||||
expectation: undefined,
|
||||
progress: undefined,
|
||||
processInstanceId: undefined,
|
||||
auditStatus: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
const route = useRoute();
|
||||
onMounted(async () => {
|
||||
formType.value = props.id || route.query.id
|
||||
|
||||
|
||||
if (formType.value) await open(formType.value)
|
||||
|
||||
deptTree.value = handleTree(await DeptApi.getSimpleDeptList())
|
||||
// 获得用户列表
|
||||
userOptions.value = await UserApi.getSimpleUserList()
|
||||
|
||||
if (!formType.value) {
|
||||
formData.value.userId = useUserStore().getUser.id
|
||||
}
|
||||
|
||||
})
|
||||
</script>
|
||||
|
|
@ -0,0 +1,369 @@
|
|||
<template>
|
||||
<ContentWrap>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="120px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-row>
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="项目编号" prop="projectCode">
|
||||
<el-input v-model="formData.projectCode" placeholder="请输入项目编号" />
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="项目级别" prop="projectLevel">
|
||||
<el-select v-model="formData.projectLevel" :disabled="formType" placeholder="请输入项目级别">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.TTS_PROJECT_LEVEL)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="项目类型" prop="projectType">
|
||||
<el-select v-model="formData.projectType" :disabled="formType" placeholder="请选择项目类型">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.TTS_PROJECT_TYPE)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="项目名称" prop="name">
|
||||
<el-input v-model="formData.name" :disabled="formType" placeholder="请输入项目名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="项目负责人" prop="userId">
|
||||
<el-select
|
||||
v-model="formData.userId"
|
||||
:disabled="formType"
|
||||
placeholder="请选择项目负责人"
|
||||
filterable
|
||||
>
|
||||
<el-option
|
||||
v-for="item in userOptions"
|
||||
:key="item.id"
|
||||
:label="item.nickname"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="项目开始日期" prop="startDate">
|
||||
<el-date-picker
|
||||
:disabled="formType"
|
||||
v-model="formData.startDate"
|
||||
style="width: 100%"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="选择项目开始日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="项目结束日期" prop="endDate">
|
||||
<el-date-picker
|
||||
:disabled="formType"
|
||||
v-model="formData.endDate"
|
||||
style="width: 100%"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="选择项目结束日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="归属部门" prop="deptId">
|
||||
<el-tree-select
|
||||
:disabled="formType"
|
||||
v-model="formData.deptId"
|
||||
:data="deptTree"
|
||||
:props="defaultProps"
|
||||
check-strictly
|
||||
node-key="id"
|
||||
placeholder="请选择归属部门"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="立项奖金评估" prop="bonusEvaluation">
|
||||
<el-radio-group v-model="formData.bonusEvaluation">
|
||||
<el-switch
|
||||
v-model="formData.bonusEvaluation"
|
||||
class="ml-2"
|
||||
/>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="formData.bonusEvaluation">
|
||||
<el-form-item label="立项奖金金额" prop="bonusAmount">
|
||||
<el-input v-model="formData.bonusAmount" oninput="value=value.match(/^\d+(?:\.\d{0,2})?/)" placeholder="请输入奖金评估描述" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="formData.bonusEvaluation">
|
||||
<el-form-item label="项目进度" prop="progress">
|
||||
<el-input v-model="formData.progress" oninput = "value=value.replace(/[^\d]/g,'')" placeholder="请输入奖金评估描述" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="项目附件" prop="attachment">
|
||||
<UploadFile v-model="formData.attachment" :disabled="!!formType" :limit="1" :fileType="['doc','docx']"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<ContentWrap style="border: none;font-weight: 700" v-if="formData.auditStatus == 2">
|
||||
项目信息
|
||||
</ContentWrap>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="项目背景" prop="background">
|
||||
<el-input v-model="formData.background" type="textarea" :disabled="formType" :rows="5" placeholder="请输入项目背景" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="项目简介" prop="introduction">
|
||||
<el-input v-model="formData.introduction" type="textarea" :disabled="formType" :rows="5" placeholder="请输入项目简介" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="项目预期" prop="expectation">
|
||||
<el-input v-model="formData.expectation" type="textarea" :disabled="formType" :rows="5" placeholder="请输入项目预期" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="项目进度" prop="progress">
|
||||
<el-input v-model="formData.progress" placeholder="请输入项目进度" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="工作流编号" prop="processInstanceId">
|
||||
<el-input v-model="formData.processInstanceId" placeholder="请输入工作流编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="审批状态" prop="auditStatus">
|
||||
<el-radio-group v-model="formData.auditStatus">
|
||||
<el-radio value="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
</el-row>
|
||||
<ContentWrap style="border: none;font-weight: 700" v-if="formData.auditStatus == 2">
|
||||
奖金信息
|
||||
</ContentWrap>
|
||||
<el-row v-if="formData.auditStatus == 2">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="系数总和" prop="">
|
||||
<el-input v-model="coefficient" disabled placeholder="系数总和" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="团队奖金" prop="">
|
||||
<el-input v-model="teamAmount" disabled placeholder="团队奖金" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<ContentWrap style="border: none;font-weight: 700" v-if="formData.auditStatus == 2">
|
||||
团队成员
|
||||
</ContentWrap>
|
||||
<Bonus ref="formRef" v-if="formData.auditStatus == 2" :userOptions="userOptions" :id="formData.id" @success="getData" />
|
||||
|
||||
<ContentWrap style="border: none;font-weight: 700" v-if="formData.auditStatus == 2">
|
||||
任务信息
|
||||
</ContentWrap>
|
||||
<Task ref="taskRef" v-if="formData.auditStatus == 2" />
|
||||
|
||||
</el-form>
|
||||
<div style="text-align: right" v-if="!type">
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="goBack">取 消</el-button>
|
||||
</div>
|
||||
</ContentWrap>
|
||||
|
||||
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ProjectApi, ProjectVO } from '@/api/task/project'
|
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import Bonus from '../components/Bouns.vue'
|
||||
import Task from '../components/Task.vue'
|
||||
import { defaultProps, handleTree } from '@/utils/tree'
|
||||
import * as DeptApi from '@/api/system/dept'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
const { proxy }: any = getCurrentInstance();
|
||||
|
||||
/** 项目管理 表单 */
|
||||
defineOptions({ name: 'ProjectForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const props = defineProps({
|
||||
id: propTypes.number.def(undefined),
|
||||
type: propTypes.number.def(undefined),
|
||||
})
|
||||
const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表
|
||||
const message = useMessage() // 消息弹窗
|
||||
const deptTree = ref() // 部门树形结构
|
||||
const routeId = ref('')
|
||||
const teamAmount = ref('')
|
||||
const coefficient = ref('')
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const validateProgress = (_: any, __: any, callback: any) => {
|
||||
const num = Number(formData.value.progress)
|
||||
|
||||
if (num <= 0 || num >100) {
|
||||
callback(new Error('请输入正确的项目进度'))
|
||||
return
|
||||
}
|
||||
|
||||
callback()
|
||||
}
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
projectCode: undefined,
|
||||
name: undefined,
|
||||
projectLevel: undefined,
|
||||
projectType: undefined,
|
||||
userId: undefined,
|
||||
startDate: undefined,
|
||||
endDate: undefined,
|
||||
attachment: undefined,
|
||||
bonusEvaluation: undefined,
|
||||
bonusAmount: undefined,
|
||||
bonusIssueDate: undefined,
|
||||
background: undefined,
|
||||
introduction: undefined,
|
||||
expectation: undefined,
|
||||
progress: undefined,
|
||||
processInstanceId: undefined,
|
||||
auditStatus: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
name: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }],
|
||||
projectLevel: [{ required: true, message: '项目级别不能为空', trigger: 'change' }],
|
||||
projectType: [{ required: true, message: '项目类型不能为空', trigger: 'change' }],
|
||||
userId: [{ required: true, message: '项目负责人ID不能为空', trigger: 'blur' }],
|
||||
startDate: [{ required: true, message: '项目开始日期不能为空', trigger: 'blur' }],
|
||||
endDate: [{ required: true, message: '项目结束日期不能为空', trigger: 'blur' }],
|
||||
attachment: [{ required: true, message: '项目附件不能为空', trigger: 'blur' }],
|
||||
background: [{ required: true, message: '项目背景不能为空', trigger: 'blur' }],
|
||||
introduction: [{ required: true, message: '项目简介不能为空', trigger: 'blur' }],
|
||||
progress: [{ validator: validateProgress, trigger: 'blur' }],
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (id?: number) => {
|
||||
dialogVisible.value = true
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await ProjectApi.getProject(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as ProjectVO
|
||||
if (!formType.value) {
|
||||
await ProjectApi.createProject(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await ProjectApi.updateProject(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
goBack()
|
||||
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const goBack = ()=> {
|
||||
proxy.$router.go(-1)
|
||||
}
|
||||
|
||||
const getData = (val) => {
|
||||
let amount = 0
|
||||
let coefficientNum = 0
|
||||
val.forEach( item => {
|
||||
amount = amount + item.bonusAmount
|
||||
coefficientNum = coefficientNum + item.bonusPercentage
|
||||
})
|
||||
coefficient.value = (coefficientNum * 100).toFixed(2) + '%'
|
||||
teamAmount.value = amount
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
projectCode: undefined,
|
||||
name: undefined,
|
||||
projectLevel: undefined,
|
||||
projectType: undefined,
|
||||
userId: undefined,
|
||||
startDate: undefined,
|
||||
endDate: undefined,
|
||||
attachment: undefined,
|
||||
bonusEvaluation: undefined,
|
||||
bonusAmount: undefined,
|
||||
bonusIssueDate: undefined,
|
||||
background: undefined,
|
||||
introduction: undefined,
|
||||
expectation: undefined,
|
||||
progress: undefined,
|
||||
processInstanceId: undefined,
|
||||
auditStatus: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
const route = useRoute();
|
||||
onMounted(async () => {
|
||||
formType.value = props.id || route.query.id
|
||||
|
||||
|
||||
if (formType.value) await open(formType.value)
|
||||
|
||||
deptTree.value = handleTree(await DeptApi.getSimpleDeptList())
|
||||
// 获得用户列表
|
||||
userOptions.value = await UserApi.getSimpleUserList()
|
||||
|
||||
if (!formType.value) {
|
||||
formData.value.userId = useUserStore().getUser.id
|
||||
}
|
||||
|
||||
})
|
||||
</script>
|
||||
|
|
@ -0,0 +1,413 @@
|
|||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
|
||||
<el-form-item label="项目名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入项目名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目类型" prop="projectType">
|
||||
<el-select v-model="queryParams.projectType" clearable class="!w-240px" placeholder="请选择项目类型">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.TTS_PROJECT_TYPE)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目级别" prop="projectLevel">
|
||||
<el-select v-model="queryParams.projectLevel" clearable class="!w-240px" placeholder="请输入项目级别">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.TTS_PROJECT_LEVEL)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="项目负责人" prop="userId">
|
||||
<el-select
|
||||
v-model="queryParams.userId"
|
||||
placeholder="请选择项目负责人"
|
||||
filterable
|
||||
class="!w-240px"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="item in userOptions"
|
||||
:key="item.id"
|
||||
:label="item.nickname"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目编号" prop="projectCode">
|
||||
<el-input
|
||||
v-model="queryParams.projectCode"
|
||||
placeholder="请输入项目编号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目日期" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
class="!w-240px"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm()"
|
||||
v-hasPermi="['task:project:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['task:project:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="唯一主键" align="center" prop="id" />
|
||||
<el-table-column label="项目编号" align="center" prop="projectCode" width="150" />
|
||||
<el-table-column label="项目名称" align="center" prop="name" />
|
||||
<el-table-column label="项目级别" align="center" prop="projectLevel">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.TTS_PROJECT_LEVEL" :value="scope.row.projectLevel" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="项目类型" align="center" prop="projectType">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.TTS_PROJECT_TYPE" :value="scope.row.projectType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="项目负责人" align="center" prop="userId" width="120">
|
||||
<template #default="scope">
|
||||
{{getName(userOptions, scope.row.userId)}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="项目开始日期" align="center" prop="startDate" width="170" />
|
||||
<el-table-column label="项目结束日期" align="center" prop="endDate" width="170" />
|
||||
<el-table-column label="项目附件" align="center" prop="attachment" />
|
||||
<el-table-column label="立项奖金评估" align="center" prop="bonusEvaluation" width="120">
|
||||
<template #default="scope">
|
||||
{{scope.row.bonusEvaluation ? '是' : '否'}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="立项奖金金额" align="center" prop="bonusAmount" width="120" />
|
||||
<el-table-column label="奖金发放日期" align="center" prop="bonusIssueDate" width="170" />
|
||||
<el-table-column label="项目背景" align="center" prop="background" />
|
||||
<el-table-column label="项目简介" align="center" prop="introduction" />
|
||||
<el-table-column label="项目预期成果" align="center" prop="expectation" width="120" />
|
||||
<el-table-column label="项目进度" align="center" prop="progress" />
|
||||
<el-table-column label="工作流编号" align="center" prop="processInstanceId" width="140" />
|
||||
<el-table-column label="审批状态" align="center" prop="auditStatus" width="110">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.auditStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建者" align="center" prop="creator" >
|
||||
<template #default="scope">
|
||||
{{getName(userOptions, scope.row.creator)}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="更新者" align="center" prop="updater">
|
||||
<template #default="scope">
|
||||
{{getName(userOptions, scope.row.updater)}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="更新时间"
|
||||
align="center"
|
||||
prop="updateTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="操作" align="center" fixed="right" width="190px">
|
||||
<template #default="scope">
|
||||
<div style="display:flex">
|
||||
<!-- <el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openFormEdit(scope.row)"
|
||||
v-if="scope.row.auditStatus === 2"
|
||||
v-hasPermi="['task:project:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button> -->
|
||||
<el-button
|
||||
v-if="scope.row.auditStatus !== 0"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleProcessDetail(scope.row)"
|
||||
>
|
||||
进度
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openFormDetail(scope.row)"
|
||||
|
||||
>
|
||||
详情
|
||||
</el-button>
|
||||
<!-- <el-button
|
||||
link
|
||||
v-if="scope.row.auditStatus === 0"
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['task:project:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button> -->
|
||||
<el-dropdown
|
||||
v-if="scope.row.auditStatus === 2"
|
||||
@command="(command) => handleCommand(command, scope.row)"
|
||||
v-hasPermi="[
|
||||
'task:project:create',
|
||||
'task:project:addUser',
|
||||
'task:project:update'
|
||||
]"
|
||||
>
|
||||
<el-button type="primary" link><Icon icon="ep:d-arrow-right" /> 更多</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item
|
||||
command="openFormEdit"
|
||||
v-if="checkPermi(['task:project:update']) && scope.row.auditStatus === 2"
|
||||
>
|
||||
编辑
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
command="handleAddTask"
|
||||
v-if="checkPermi(['task:project:create']) && scope.row.auditStatus === 2"
|
||||
>
|
||||
新增任务
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
command="handleAddUser"
|
||||
v-if="checkPermi(['task:project:addUser']) && scope.row.auditStatus === 2"
|
||||
>
|
||||
新增成员
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<ProjectTaskForm ref="taskRef" @success="getList" />
|
||||
<ProjectBonusForm ref="bonusRef" @success="getList" :userOptions="userOptions" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { ProjectApi, ProjectVO } from '@/api/task/project'
|
||||
import ProjectTaskForm from '../components/ProjectTaskForm.vue'
|
||||
import ProjectBonusForm from '../components/ProjectBonusForm.vue'
|
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import { checkPermi } from '@/utils/permission'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
|
||||
/** 项目管理 列表 */
|
||||
defineOptions({ name: 'Project' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<ProjectVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
projectCode: undefined,
|
||||
name: undefined,
|
||||
projectLevel: undefined,
|
||||
projectType: undefined,
|
||||
userId: undefined,
|
||||
attachment: undefined,
|
||||
bonusEvaluation: undefined,
|
||||
bonusAmount: undefined,
|
||||
bonusIssueDate: [],
|
||||
background: undefined,
|
||||
introduction: undefined,
|
||||
expectation: undefined,
|
||||
progress: undefined,
|
||||
processInstanceId: undefined,
|
||||
auditStatus: undefined,
|
||||
creator: undefined,
|
||||
createTime: [],
|
||||
updater: undefined,
|
||||
updateTime: []
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 操作分发 */
|
||||
const handleCommand = (command: string, row: UserApi.UserVO) => {
|
||||
switch (command) {
|
||||
case 'handleAddTask':
|
||||
handleAddTask(row)
|
||||
break
|
||||
case 'handleAddUser':
|
||||
openAddUserForm(row)
|
||||
break
|
||||
case 'openFormEdit':
|
||||
openFormEdit(row)
|
||||
break
|
||||
case 'handleDelete':
|
||||
handleDelete(row.id)
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await ProjectApi.getProjectPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const router = useRouter() // 路由
|
||||
const formRef = ref()
|
||||
const openForm = (row) => {
|
||||
// formRef.value.open(type, id)
|
||||
router.push({ name: 'ProProAdd' })
|
||||
}
|
||||
// 编辑
|
||||
const openFormEdit = (row: Object) => {
|
||||
router.push({ name: 'ProProEdit', query: { id: row.id} })
|
||||
}
|
||||
const openFormDetail = (row: Object) => {
|
||||
router.push({ name: 'ProProDetail', query: { id: row.id} })
|
||||
}
|
||||
|
||||
/** 查看审批 */
|
||||
const handleProcessDetail = (row) => {
|
||||
router.push({ name: 'BpmProcessInstanceDetail', query: { id: row.processInstanceId } })
|
||||
}
|
||||
const bonusRef = ref()
|
||||
const taskRef = ref()
|
||||
|
||||
const openAddUserForm = (row) => {
|
||||
bonusRef.value.open(row.id)
|
||||
}
|
||||
|
||||
const handleAddTask = (row) => {
|
||||
taskRef.value.open(row.id)
|
||||
}
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await ProjectApi.deleteProject(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await ProjectApi.exportProject(queryParams)
|
||||
download.excel(data, '项目管理.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const getName = (opt, val) => {
|
||||
const arr = opt.filter(v => v.id == val)
|
||||
return arr.length ? arr[0]['nickname'] : ''
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(async() => {
|
||||
// 获得用户列表
|
||||
userOptions.value = await UserApi.getSimpleUserList()
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
Loading…
Reference in New Issue