线下价格-任务
parent
7feeb519d8
commit
93d27bd1b9
|
|
@ -797,7 +797,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
||||||
path: 'project/ProjectFormEdit',
|
path: 'project/ProjectFormEdit',
|
||||||
name: 'ProProEdit',
|
name: 'ProProEdit',
|
||||||
meta: {
|
meta: {
|
||||||
title: '项目管理新增',
|
title: '项目管理编辑',
|
||||||
noCache: true,
|
noCache: true,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
activeMenu: '/project/project'
|
activeMenu: '/project/project'
|
||||||
|
|
@ -815,6 +815,28 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
||||||
},
|
},
|
||||||
component: () => import('@/views/task/project/ProjectDetail.vue')
|
component: () => import('@/views/task/project/ProjectDetail.vue')
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'components/TaskDetail',
|
||||||
|
name: 'ProComDetail',
|
||||||
|
meta: {
|
||||||
|
title: '任务详情',
|
||||||
|
noCache: true,
|
||||||
|
hidden: true,
|
||||||
|
activeMenu: '/project/project'
|
||||||
|
},
|
||||||
|
component: () => import('@/views/task/components/TaskDetail.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'components/ProjectTaskForm',
|
||||||
|
name: 'ProComAdd',
|
||||||
|
meta: {
|
||||||
|
title: '任务新增',
|
||||||
|
noCache: true,
|
||||||
|
hidden: true,
|
||||||
|
activeMenu: '/project/project'
|
||||||
|
},
|
||||||
|
component: () => import('@/views/task/components/ProjectTaskForm.vue')
|
||||||
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -237,6 +237,7 @@ export enum DICT_TYPE {
|
||||||
// ========== ERP - 企业资源计划模块 ==========
|
// ========== ERP - 企业资源计划模块 ==========
|
||||||
TTS_PROJECT_LEVEL="tts_project_level", //项目级别
|
TTS_PROJECT_LEVEL="tts_project_level", //项目级别
|
||||||
TTS_PROJECT_TYPE="tts_project_type", //项目类型
|
TTS_PROJECT_TYPE="tts_project_type", //项目类型
|
||||||
|
TTS_TASK_LEVEL = 'tts_task_level',
|
||||||
|
|
||||||
|
|
||||||
// ========== ERP - 企业资源计划模块 ==========
|
// ========== ERP - 企业资源计划模块 ==========
|
||||||
|
|
|
||||||
|
|
@ -851,7 +851,7 @@ onMounted(async () => {
|
||||||
// formData.value.ownerUserId = useUserStore().getUser.id
|
// formData.value.ownerUserId = useUserStore().getUser.id
|
||||||
// }
|
// }
|
||||||
// 获取联系人
|
// 获取联系人
|
||||||
contactList.value = await ContactApi.getSimpleContactList()
|
contactList.value = await CustomerApi.getSelfCustomerSimpleList()
|
||||||
const data = await ContractApi.getOrg({
|
const data = await ContractApi.getOrg({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 1000
|
pageSize: 1000
|
||||||
|
|
|
||||||
|
|
@ -564,7 +564,23 @@ const open = async (type: string) => {
|
||||||
if (type) {
|
if (type) {
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
|
let totalOnlinePrice = 0;
|
||||||
|
let totalOfflinePrice = 0;
|
||||||
|
|
||||||
formData.value = await QuotationApi.getQuotation(type)
|
formData.value = await QuotationApi.getQuotation(type)
|
||||||
|
|
||||||
|
for (const product of formData.value.products) {
|
||||||
|
if (typeof product.onlinePrice) {
|
||||||
|
totalOnlinePrice += Number(product.onlinePrice);
|
||||||
|
}
|
||||||
|
if (typeof product.offlinePrice) {
|
||||||
|
totalOfflinePrice += Number(product.offlinePrice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
formData.value.onlinePrice = totalOnlinePrice.toFixed(2)
|
||||||
|
formData.value.offlinePrice = (totalOfflinePrice + totalOnlinePrice).toFixed(2)
|
||||||
|
let all = totalOnlinePrice + totalOfflinePrice + totalOnlinePrice
|
||||||
|
formData.value.totalPrice = all.toFixed(2)
|
||||||
formData.value.creditLimit = ((formData.value.creditAmount || 0) + (formData.value.creditLimitNum || 0)).toFixed(2)
|
formData.value.creditLimit = ((formData.value.creditAmount || 0) + (formData.value.creditLimitNum || 0)).toFixed(2)
|
||||||
} finally {
|
} finally {
|
||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
|
|
|
||||||
|
|
@ -307,14 +307,15 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="授信计算周期" prop="creditCalcCycle">
|
<el-form-item label="授信计算周期" prop="creditCalcCycle">
|
||||||
<el-select v-model="formData.creditCalcCycle" placeholder="请选择授信计算周期">
|
<el-input v-model="formData.creditCalcCycle" disabled placeholder="" />
|
||||||
|
<!-- <el-select v-model="formData.creditCalcCycle" placeholder="请选择授信计算周期">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in getIntDictOptions('credit_calc_cycle')"
|
v-for="dict in getIntDictOptions('credit_calc_cycle')"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
:label="dict.label"
|
:label="dict.label"
|
||||||
:value="dict.value"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
|
|
@ -374,7 +375,7 @@
|
||||||
<!-- 子表的表单 -->
|
<!-- 子表的表单 -->
|
||||||
<el-tabs v-model="subTabsName">
|
<el-tabs v-model="subTabsName">
|
||||||
<el-tab-pane label="报价产品关联" name="quotationProduct">
|
<el-tab-pane label="报价产品关联" name="quotationProduct">
|
||||||
<QuotationProductForm ref="quotationProductFormRef" :handleType="handleType" :quotation-id="formData.id" :business-id="formData.businessId" :billTemplateId="formData.invoiceTemplateId" :products="formData.products" />
|
<QuotationProductForm ref="quotationProductFormRef" :handleType="handleType" :quotation-id="formData.id" :business-id="formData.businessId" :billTemplateId="formData.invoiceTemplateId" :products="formData.products" @success="setSuccess" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<div style="text-align: right">
|
<div style="text-align: right">
|
||||||
|
|
@ -493,6 +494,37 @@ const formRef = ref() // 表单 Ref
|
||||||
/** 子表的表单 */
|
/** 子表的表单 */
|
||||||
const subTabsName = ref('quotationProduct')
|
const subTabsName = ref('quotationProduct')
|
||||||
const quotationProductFormRef = ref()
|
const quotationProductFormRef = ref()
|
||||||
|
watch(
|
||||||
|
() => formData.value.products,
|
||||||
|
(newProducts) => {
|
||||||
|
if (!Array.isArray(newProducts)) {
|
||||||
|
console.warn('formData.value.products is not an array');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let totalOnlinePrice = 0;
|
||||||
|
let totalOfflinePrice = 0;
|
||||||
|
|
||||||
|
for (const product of newProducts) {
|
||||||
|
if (typeof product.onlinePrice) {
|
||||||
|
totalOnlinePrice += Number(product.onlinePrice);
|
||||||
|
}
|
||||||
|
if (typeof product.offlinePrice) {
|
||||||
|
totalOfflinePrice += Number(product.offlinePrice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
formData.value.onlinePrice = totalOnlinePrice.toFixed(2)
|
||||||
|
formData.value.offlinePrice = (totalOfflinePrice + totalOnlinePrice).toFixed(2)
|
||||||
|
let all = totalOnlinePrice + totalOfflinePrice + totalOnlinePrice
|
||||||
|
formData.value.totalPrice = all.toFixed(2)
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
);
|
||||||
|
|
||||||
|
const setSuccess = (val) => {
|
||||||
|
formData.value.products = val
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const onBusinessChange = async (businessId: string) => {
|
const onBusinessChange = async (businessId: string) => {
|
||||||
if (!businessId) return
|
if (!businessId) return
|
||||||
|
|
@ -512,7 +544,6 @@ const onBusinessChange = async (businessId: string) => {
|
||||||
formData.value.onlinePrice = res.onlinePrice;
|
formData.value.onlinePrice = res.onlinePrice;
|
||||||
formData.value.totalPrice = res.totalPrice;
|
formData.value.totalPrice = res.totalPrice;
|
||||||
formData.value.creditAmount = res.creditAmount;
|
formData.value.creditAmount = res.creditAmount;
|
||||||
console.log('%csrc/views/crm/quotation/QuotationForm.vue:516 (formData.value.creditAmount || 0) + (formData.value.creditLimitNum || 0)', 'color: #007acc;', (formData.value.creditAmount || 0) , (formData.value.creditLimitNum || 0));
|
|
||||||
|
|
||||||
// 🔁 自动加载客户详情
|
// 🔁 自动加载客户详情
|
||||||
await onCustomerChange(res.customerId);
|
await onCustomerChange(res.customerId);
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,11 @@
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{row.offlinePrice}}
|
{{row.offlinePrice}}
|
||||||
</template>
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="线下价格(元)" align="center" min-width="130">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{row.downlinePrice}}
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="总计价格" align="center" min-width="150">
|
<el-table-column label="总计价格" align="center" min-width="150">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
|
|
@ -111,8 +116,16 @@ watch(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
|
// 循环处理
|
||||||
|
val.forEach((item) => {
|
||||||
|
if (item.offlinePrice != null && item.onlinePrice != null) {
|
||||||
|
item.downlinePrice = Number((Number(item.offlinePrice) + Number(item.onlinePrice)).toFixed(2)) || 0;
|
||||||
|
item.totalPrice = Number((Number(item.downlinePrice) + Number(item.onlinePrice)).toFixed(2)) || 0;
|
||||||
|
} else {
|
||||||
|
item.totalPrice = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
formData.value = val
|
formData.value = val
|
||||||
console.log('%csrc/views/crm/quotation/components/QuotationProductDetail.vue:134 val', 'color: #007acc;', val);
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
|
|
|
||||||
|
|
@ -46,21 +46,29 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="线上价格(元)" min-width="120">
|
<el-table-column label="线上价格(元)" min-width="130">
|
||||||
<template #default="{ row, $index }">
|
<template #default="{ row, $index }">
|
||||||
<el-form-item :prop="`${$index}.onlinePrice`" :rules="formRules.onlinePrice" class="mb-0px!">
|
<el-form-item :prop="`${$index}.onlinePrice`" :rules="formRules.onlinePrice" class="mb-0px!">
|
||||||
<el-input v-model="row.onlinePrice" placeholder="请输入线上价格" />
|
<el-input v-model="row.onlinePrice" oninput="value=value.match(/^\d+(?:\.\d{0,2})?/)" placeholder="" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="线下手续费(元)" min-width="120">
|
|
||||||
|
<el-table-column label="线下手续费(元)" min-width="140">
|
||||||
<template #default="{ row, $index }">
|
<template #default="{ row, $index }">
|
||||||
<el-form-item :prop="`${$index}.offlinePrice`" :rules="formRules.offlinePrice" class="mb-0px!">
|
<el-form-item :prop="`${$index}.offlinePrice`" :rules="formRules.offlinePrice" class="mb-0px!">
|
||||||
<el-input v-model="row.offlinePrice" placeholder="请输入线下价格" />
|
<el-input v-model="row.offlinePrice" oninput="value=value.match(/^\d+(?:\.\d{0,2})?/)" placeholder="" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="总计价格(元)" min-width="120">
|
<el-table-column label="线下价格(元)" min-width="130">
|
||||||
|
<template #default="{ row, $index }">
|
||||||
|
<el-form-item :prop="`${$index}.downlinePrice`" :rules="formRules.onlinePrice" class="mb-0px!">
|
||||||
|
{{row.downlinePrice}}
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="总计价格(元)" min-width="130">
|
||||||
<template #default="{ row, $index }">
|
<template #default="{ row, $index }">
|
||||||
<el-form-item :prop="`${$index}.totalPrice`" :rules="formRules.totalPrice" class="mb-0px!">
|
<el-form-item :prop="`${$index}.totalPrice`" :rules="formRules.totalPrice" class="mb-0px!">
|
||||||
{{row.totalPrice}}
|
{{row.totalPrice}}
|
||||||
|
|
@ -166,7 +174,7 @@ const formRules = reactive({
|
||||||
})
|
})
|
||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
const emit = defineEmits(['update:handleType'])
|
const emit = defineEmits(['update:handleType', 'success'])
|
||||||
/** 监听主表的关联字段的变化,加载对应的子表数据 */
|
/** 监听主表的关联字段的变化,加载对应的子表数据 */
|
||||||
watch(
|
watch(
|
||||||
() => props.businessId,
|
() => props.businessId,
|
||||||
|
|
@ -256,11 +264,13 @@ watch(
|
||||||
// 循环处理
|
// 循环处理
|
||||||
val.forEach((item) => {
|
val.forEach((item) => {
|
||||||
if (item.offlinePrice != null && item.onlinePrice != null) {
|
if (item.offlinePrice != null && item.onlinePrice != null) {
|
||||||
item.totalPrice = Number((Number(item.offlinePrice) + Number(item.onlinePrice)).toFixed(2));
|
item.downlinePrice = Number((Number(item.offlinePrice) + Number(item.onlinePrice)).toFixed(2)) || 0;
|
||||||
|
item.totalPrice = Number((Number(item.downlinePrice) + Number(item.onlinePrice)).toFixed(2)) || 0;
|
||||||
} else {
|
} else {
|
||||||
item.totalPrice = 0;
|
item.totalPrice = 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
emit('success', formData.value)
|
||||||
},
|
},
|
||||||
{ deep: true }
|
{ deep: true }
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -146,11 +146,11 @@
|
||||||
<dict-tag :type="'credit_method'" :value="scope.row.creditMethod" />
|
<dict-tag :type="'credit_method'" :value="scope.row.creditMethod" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="授信计算周期" align="center" prop="creditCalcCycle" width="120">
|
<el-table-column label="授信计算周期" align="center" prop="creditCalcCycle" width="120" />
|
||||||
<template #default="scope">
|
<!-- <template #default="scope">
|
||||||
<dict-tag :type="DICT_TYPE.CREDIT_CALC_CYCLE" :value="scope.row.creditCalcCycle" />
|
<dict-tag :type="DICT_TYPE.CREDIT_CALC_CYCLE" :value="scope.row.creditCalcCycle" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
<el-table-column label="授信额度" align="center" prop="creditLimit" />
|
<el-table-column label="授信额度" align="center" prop="creditLimit" />
|
||||||
<el-table-column label="合作主体" align="center" prop="partnerCompanyName" />
|
<el-table-column label="合作主体" align="center" prop="partnerCompanyName" />
|
||||||
<el-table-column label="审批状态" align="center" prop="auditStatus" width="100">
|
<el-table-column label="审批状态" align="center" prop="auditStatus" width="100">
|
||||||
|
|
@ -170,7 +170,7 @@
|
||||||
:formatter="dateFormatter"
|
:formatter="dateFormatter"
|
||||||
width="180px"
|
width="180px"
|
||||||
/>
|
/>
|
||||||
<el-table-column label="操作" align="center" fixed="right" min-width="160px">
|
<el-table-column label="操作" align="center" fixed="right" min-width="180px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div style="display:flex">
|
<div style="display:flex">
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -185,10 +185,30 @@
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="openFormEdit(scope.row)"
|
@click="openFormEdit(scope.row)"
|
||||||
v-hasPermi="['crm:quotation:update']"
|
v-hasPermi="['crm:quotation:update']"
|
||||||
|
v-if="scope.row.auditStatus == 0"
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="handleProcessDetail(scope.row)"
|
||||||
|
v-hasPermi="['crm:customer-suggestion:query']"
|
||||||
|
v-if="scope.row.auditStatus != 0"
|
||||||
|
>
|
||||||
|
进度
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="handleEnter(scope.row)"
|
||||||
|
v-hasPermi="['crm:quotation:customerConfirm']"
|
||||||
|
v-if="scope.row.auditStatus == 2 && scope.row.confirmStatus == 0"
|
||||||
|
>
|
||||||
|
客户确认
|
||||||
|
</el-button>
|
||||||
<el-dropdown
|
<el-dropdown
|
||||||
|
v-if="scope.row.auditStatus == 0"
|
||||||
@command="(command) => handleCommand(command, scope.row)"
|
@command="(command) => handleCommand(command, scope.row)"
|
||||||
v-hasPermi="[
|
v-hasPermi="[
|
||||||
'crm:quotation:delete',
|
'crm:quotation:delete',
|
||||||
|
|
@ -213,13 +233,13 @@
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
command="handleProcessDetail"
|
command="handleProcessDetail"
|
||||||
v-if="checkPermi(['crm:customer-suggestion:query'])"
|
v-if="checkPermi(['crm:customer-suggestion:query']) && scope.row.auditStatus != 0"
|
||||||
>
|
>
|
||||||
进度
|
进度
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
command="handleDelete"
|
command="handleDelete"
|
||||||
v-if="checkPermi(['crm:quotation:delete'])"
|
v-if="checkPermi(['crm:quotation:delete']) && scope.row.auditStatus === 0"
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
|
@ -384,6 +404,7 @@ const handleProcessDetail = (row) => {
|
||||||
const handleEnter = async (row) => {
|
const handleEnter = async (row) => {
|
||||||
await QuotationApi.enterQuotation({id: row.id})
|
await QuotationApi.enterQuotation({id: row.id})
|
||||||
message.success('操作成功!')
|
message.success('操作成功!')
|
||||||
|
getList()
|
||||||
|
|
||||||
}
|
}
|
||||||
const getName = (opt, val) => {
|
const getName = (opt, val) => {
|
||||||
|
|
|
||||||
|
|
@ -37,12 +37,12 @@
|
||||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||||
</el-button> -->
|
</el-button> -->
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<Pagination
|
<!-- <Pagination
|
||||||
:total="total"
|
:total="total"
|
||||||
v-model:page="queryParams.pageNo"
|
v-model:page="queryParams.pageNo"
|
||||||
v-model:limit="queryParams.pageSize"
|
v-model:limit="queryParams.pageSize"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/> -->
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<!-- 表单弹窗:添加/修改 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
|
|
@ -63,14 +63,14 @@ const message = useMessage() // 消息弹窗
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
id: propTypes.number.def(undefined),
|
id: propTypes.number.def(undefined),
|
||||||
userOptions: [],
|
userOptions: propTypes.object.def([]),
|
||||||
})
|
})
|
||||||
const loading = ref(true) // 列表的加载中
|
const loading = ref(true) // 列表的加载中
|
||||||
const list = ref<ProjectBonusVO[]>([]) // 列表的数据
|
const list = ref<ProjectBonusVO[]>([]) // 列表的数据
|
||||||
const total = ref(0) // 列表的总页数
|
const total = ref(0) // 列表的总页数
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 999,
|
||||||
projectId: undefined,
|
projectId: undefined,
|
||||||
userId: undefined,
|
userId: undefined,
|
||||||
bonusPercentage: undefined,
|
bonusPercentage: undefined,
|
||||||
|
|
@ -87,6 +87,7 @@ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
|
queryParams.projectId = props.id
|
||||||
const data = await ProjectBonusApi.getProjectBonusPage(queryParams)
|
const data = await ProjectBonusApi.getProjectBonusPage(queryParams)
|
||||||
list.value = data.list
|
list.value = data.list
|
||||||
total.value = data.total
|
total.value = data.total
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,20 @@
|
||||||
>
|
>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="项目名称" prop="taskName">
|
<el-form-item label="项目名称" prop="projectName">
|
||||||
<el-input v-model="formData.taskName" placeholder="请输入任务名称" />
|
<el-input v-model="formData.projectName" disabled placeholder="请输入任务名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="项目负责人" prop="userId">
|
<el-form-item label="项目负责人" prop="projectUser">
|
||||||
<el-input v-model="formData.userId" placeholder="请输入任务负责人" />
|
<el-select v-model="formData.projectUser" disabled 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>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
|
|
@ -25,7 +32,14 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="任务负责人" prop="userId">
|
<el-form-item label="任务负责人" prop="userId">
|
||||||
<el-input v-model="formData.userId" placeholder="请输入任务负责人" />
|
<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>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
|
|
@ -34,7 +48,7 @@
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
v-model="formData.startDate"
|
v-model="formData.startDate"
|
||||||
type="date"
|
type="date"
|
||||||
value-format="x"
|
value-format="YYYY-MM-DD"
|
||||||
placeholder="选择开始日期"
|
placeholder="选择开始日期"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -45,19 +59,31 @@
|
||||||
v-model="formData.endDate"
|
v-model="formData.endDate"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
type="date"
|
type="date"
|
||||||
value-format="x"
|
value-format="YYYY-MM-DD"
|
||||||
placeholder="选择截止日期"
|
placeholder="选择截止日期"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="任务优先级" prop="taskLevel">
|
<el-form-item label="任务优先级" prop="taskLevel">
|
||||||
<el-input v-model="formData.taskLevel" placeholder="请输入任务优先级" />
|
<el-select v-model="formData.taskLevel" filterable clearable placeholder="请输入任务优先级" class="w-1/1">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.TTS_TASK_LEVEL)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12" v-if="formType === 'update'">
|
||||||
|
<el-form-item label="任务进度" prop="taskProgress">
|
||||||
|
<el-input v-model="formData.taskProgress" oninput = "value=value.replace(/[^\d]/g,'')" placeholder="请输入任务进度" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
<el-form-item label="任务附件" prop="attachment">
|
<el-form-item label="任务附件" prop="attachment">
|
||||||
<el-input v-model="formData.attachment" placeholder="请输入任务附件" />
|
<UploadFile v-model="formData.attachment" :limit="1" :fileType="['doc','docx']"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
|
|
@ -75,16 +101,30 @@
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ProjectTaskApi, ProjectTaskVO } from '@/api/task/task'
|
import { ProjectTaskApi, ProjectTaskVO } from '@/api/task/task'
|
||||||
|
import { getIntDictOptions, getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
|
import { propTypes } from '@/utils/propTypes'
|
||||||
|
|
||||||
/** 任务 表单 */
|
/** 任务 表单 */
|
||||||
defineOptions({ name: 'ProjectTaskForm' })
|
defineOptions({ name: 'ProjectTaskForm' })
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
|
const props = defineProps({
|
||||||
|
userOptions: propTypes.object.def([]),
|
||||||
|
})
|
||||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
const dialogTitle = ref('') // 弹窗的标题
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
|
const validateProgress = (_: any, __: any, callback: any) => {
|
||||||
|
const num = Number(formData.value.taskProgress)
|
||||||
|
|
||||||
|
if (num <= 0 || num >100) {
|
||||||
|
callback(new Error('请输入正确的任务进度'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
callback()
|
||||||
|
}
|
||||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
id: undefined,
|
id: undefined,
|
||||||
|
|
@ -99,7 +139,9 @@ const formData = ref({
|
||||||
projectId: undefined,
|
projectId: undefined,
|
||||||
taskState: undefined,
|
taskState: undefined,
|
||||||
processInstanceId: undefined,
|
processInstanceId: undefined,
|
||||||
auditStatus: undefined
|
auditStatus: undefined,
|
||||||
|
projectUser: undefined,
|
||||||
|
projectName: undefined,
|
||||||
})
|
})
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
taskName: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
|
taskName: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
|
||||||
|
|
@ -108,17 +150,21 @@ const formRules = reactive({
|
||||||
startDate: [{ required: true, message: '开始日期不能为空', trigger: 'blur' }],
|
startDate: [{ required: true, message: '开始日期不能为空', trigger: 'blur' }],
|
||||||
endDate: [{ required: true, message: '截止日期不能为空', trigger: 'blur' }],
|
endDate: [{ required: true, message: '截止日期不能为空', trigger: 'blur' }],
|
||||||
taskDescribe: [{ required: true, message: '任务描述不能为空', trigger: 'blur' }],
|
taskDescribe: [{ required: true, message: '任务描述不能为空', trigger: 'blur' }],
|
||||||
projectId: [{ required: true, message: '项目Id不能为空', trigger: 'blur' }]
|
projectId: [{ required: true, message: '项目Id不能为空', trigger: 'blur' }],
|
||||||
|
taskProgress: [{ validator: validateProgress, trigger: 'blur' }],
|
||||||
})
|
})
|
||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
const open = async (type: string, id?: number) => {
|
const open = async (data: Object) => {
|
||||||
|
console.log('%csrc/views/task/components/ProjectTaskForm.vue:143 data', 'color: #007acc;', data);
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
dialogTitle.value = t('action.' + type)
|
// formData.value.projectName = data.name
|
||||||
formType.value = type
|
// formData.value.projectUser = data.userId
|
||||||
|
formType.value = data.type
|
||||||
|
let id = data.taskId
|
||||||
resetForm()
|
resetForm()
|
||||||
// 修改时,设置数据
|
// // 修改时,设置数据
|
||||||
if (id) {
|
if (id) {
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
|
|
@ -127,6 +173,9 @@ const open = async (type: string, id?: number) => {
|
||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
formData.value.projectName = data.name
|
||||||
|
formData.value.projectUser = data.userId
|
||||||
|
formData.value.projectId = data.id
|
||||||
}
|
}
|
||||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||||
|
|
||||||
|
|
@ -139,10 +188,11 @@ const submitForm = async () => {
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
const data = formData.value as unknown as ProjectTaskVO
|
const data = formData.value as unknown as ProjectTaskVO
|
||||||
if (formType.value === 'create') {
|
if(formType.value === 'create') {
|
||||||
await ProjectTaskApi.createProjectTask(data)
|
await ProjectTaskApi.createProjectTask(data)
|
||||||
message.success(t('common.createSuccess'))
|
message.success(t('common.createSuccess'))
|
||||||
} else {
|
} else {
|
||||||
|
data.taskProgress = (Number(data.taskProgress) / 100).toFixed(2)
|
||||||
await ProjectTaskApi.updateProjectTask(data)
|
await ProjectTaskApi.updateProjectTask(data)
|
||||||
message.success(t('common.updateSuccess'))
|
message.success(t('common.updateSuccess'))
|
||||||
}
|
}
|
||||||
|
|
@ -169,7 +219,9 @@ const resetForm = () => {
|
||||||
projectId: undefined,
|
projectId: undefined,
|
||||||
taskState: undefined,
|
taskState: undefined,
|
||||||
processInstanceId: undefined,
|
processInstanceId: undefined,
|
||||||
auditStatus: undefined
|
auditStatus: undefined,
|
||||||
|
projectUser: undefined,
|
||||||
|
projectName: undefined,
|
||||||
}
|
}
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,18 @@
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
<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="id" />
|
||||||
<el-table-column label="任务标题" align="center" prop="taskName" />
|
<el-table-column label="任务标题" align="center" prop="taskName" />
|
||||||
<el-table-column label="任务编号" align="center" prop="taskName" />
|
<el-table-column label="任务编号" align="center" prop="taskNo" />
|
||||||
<el-table-column label="任务进度" align="center" prop="taskProgress" />
|
<el-table-column label="任务进度" align="center" prop="taskProgress">
|
||||||
<el-table-column label="任务状态" align="center" prop="taskState" />
|
<template #default="scope">
|
||||||
<el-table-column label="任务负责人" align="center" prop="userId" />
|
{{Math.floor(scope.row.taskProgress * 100)}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="任务状态" align="center" prop="taskStateName" />
|
||||||
|
<el-table-column label="任务负责人" align="center" prop="userId">
|
||||||
|
<template #default="scope">
|
||||||
|
{{getName(userOptions, scope.row.userId)}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<!-- <el-table-column label="任务优先级" align="center" prop="taskLevel">
|
<!-- <el-table-column label="任务优先级" align="center" prop="taskLevel">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :type="DICT_TYPE.TTS_TASK_LEVEL" :value="scope.row.taskLevel" />
|
<dict-tag :type="DICT_TYPE.TTS_TASK_LEVEL" :value="scope.row.taskLevel" />
|
||||||
|
|
@ -59,7 +67,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<el-row justify="center" class="mt-3" >
|
<el-row justify="center" class="mt-3" >
|
||||||
<el-button @click="openForm" round>+ 添加</el-button>
|
<el-button @click="openForm('create')" round>+ 添加</el-button>
|
||||||
</el-row>
|
</el-row>
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<!-- <Pagination
|
<!-- <Pagination
|
||||||
|
|
@ -71,7 +79,7 @@
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<!-- 表单弹窗:添加/修改 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
<ProjectTaskForm ref="formRef" @success="getList" />
|
<ProjectTaskForm ref="formRef" @success="getList" :userOptions="userOptions" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
@ -83,16 +91,22 @@ import ProjectTaskForm from './ProjectTaskForm.vue'
|
||||||
|
|
||||||
/** 任务 列表 */
|
/** 任务 列表 */
|
||||||
defineOptions({ name: 'ProjectTask' })
|
defineOptions({ name: 'ProjectTask' })
|
||||||
|
import { propTypes } from '@/utils/propTypes'
|
||||||
|
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
|
const props = defineProps({
|
||||||
|
id: propTypes.number.def(undefined),
|
||||||
|
userId: propTypes.number.def(undefined),
|
||||||
|
name: propTypes.number.def(undefined),
|
||||||
|
userOptions: propTypes.object.def([]),
|
||||||
|
})
|
||||||
const loading = ref(true) // 列表的加载中
|
const loading = ref(true) // 列表的加载中
|
||||||
const list = ref<ProjectTaskVO[]>([]) // 列表的数据
|
const list = ref<ProjectTaskVO[]>([]) // 列表的数据
|
||||||
const total = ref(0) // 列表的总页数
|
const total = ref(0) // 列表的总页数
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 999,
|
||||||
taskName: undefined,
|
taskName: undefined,
|
||||||
userId: undefined,
|
userId: undefined,
|
||||||
taskLevel: undefined,
|
taskLevel: undefined,
|
||||||
|
|
@ -117,6 +131,7 @@ const exportLoading = ref(false) // 导出的加载中
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
|
queryParams.projectId = props.id
|
||||||
const data = await ProjectTaskApi.getProjectTaskPage(queryParams)
|
const data = await ProjectTaskApi.getProjectTaskPage(queryParams)
|
||||||
list.value = data.list
|
list.value = data.list
|
||||||
total.value = data.total
|
total.value = data.total
|
||||||
|
|
@ -139,8 +154,16 @@ const resetQuery = () => {
|
||||||
|
|
||||||
/** 添加/修改操作 */
|
/** 添加/修改操作 */
|
||||||
const formRef = ref()
|
const formRef = ref()
|
||||||
const openForm = (type: string, id?: number) => {
|
const openForm = (type: string, taskId?: number) => {
|
||||||
formRef.value.open(type, id)
|
console.log('%csrc/views/task/components/Task.vue:149 object', 'color: #007acc;', props.name, props.id, props.userId);
|
||||||
|
let data = {
|
||||||
|
name: props.name,
|
||||||
|
id: props.id,
|
||||||
|
userId: props.userId,
|
||||||
|
type: type,
|
||||||
|
taskId: taskId || '',
|
||||||
|
}
|
||||||
|
formRef.value.open(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
|
|
@ -171,8 +194,13 @@ const handleExport = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getName = (opt, val) => {
|
||||||
|
const arr = opt.filter(v => v.id == val)
|
||||||
|
return arr.length ? arr[0]['nickname'] : ''
|
||||||
|
}
|
||||||
|
|
||||||
/** 初始化 **/
|
/** 初始化 **/
|
||||||
onMounted(() => {
|
onMounted(async() => {
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -0,0 +1,234 @@
|
||||||
|
<template>
|
||||||
|
<ContentWrap style="margin-right:10px">
|
||||||
|
|
||||||
|
<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="projectName">
|
||||||
|
<el-input v-model="formData.projectName" disabled placeholder="请输入任务名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="项目负责人" prop="projectUser">
|
||||||
|
<el-select v-model="formData.projectUser" disabled placeholder="">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in userOptions"
|
||||||
|
:key="dict.id"
|
||||||
|
:label="dict.nickname"
|
||||||
|
:value="dict.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="任务标题" prop="taskName">
|
||||||
|
<el-input v-model="formData.taskName" disabled placeholder="请输入任务名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="任务负责人" prop="userId">
|
||||||
|
<el-select v-model="formData.userId" disabled placeholder="请选择成员姓名">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in userOptions"
|
||||||
|
:key="dict.id"
|
||||||
|
:label="dict.nickname"
|
||||||
|
:value="dict.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="开始日期" prop="startDate">
|
||||||
|
<el-date-picker
|
||||||
|
disabled
|
||||||
|
style="width: 100%"
|
||||||
|
v-model="formData.startDate"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="选择开始日期"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<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="12">
|
||||||
|
<el-form-item label="任务优先级" prop="taskLevel">
|
||||||
|
<el-select v-model="formData.taskLevel" disabled filterable clearable placeholder="请输入任务优先级" class="w-1/1">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.TTS_TASK_LEVEL)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" v-if="formType === 'update'">
|
||||||
|
<el-form-item label="任务进度" prop="taskProgress">
|
||||||
|
<el-input v-model="formData.taskProgress" disabled 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="true" :limit="1" :fileType="['doc','docx']"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="任务描述" prop="taskDescribe">
|
||||||
|
<el-input v-model="formData.taskDescribe" disabled type="textarea" :rows="5" placeholder="请输入任务描述" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ProjectTaskApi, ProjectTaskVO } from '@/api/task/task'
|
||||||
|
import { getIntDictOptions, getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
|
import { propTypes } from '@/utils/propTypes'
|
||||||
|
import * as DeptApi from '@/api/system/dept'
|
||||||
|
import * as UserApi from '@/api/system/user'
|
||||||
|
|
||||||
|
/** 任务 表单 */
|
||||||
|
defineOptions({ name: 'ProjectTaskForm' })
|
||||||
|
const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
const props = defineProps({
|
||||||
|
id: propTypes.number.def(undefined),
|
||||||
|
})
|
||||||
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
|
const validateProgress = (_: any, __: any, callback: any) => {
|
||||||
|
const num = Number(formData.value.taskProgress)
|
||||||
|
|
||||||
|
if (num <= 0 || num >100) {
|
||||||
|
callback(new Error('请输入正确的任务进度'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
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,
|
||||||
|
projectUser: undefined,
|
||||||
|
projectName: 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' }],
|
||||||
|
taskProgress: [{ validator: validateProgress, trigger: 'blur' }],
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const open = async (id) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
// formData.value.projectName = data.name
|
||||||
|
// formData.value.projectUser = data.userId
|
||||||
|
// 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 {
|
||||||
|
data.taskProgress = (Number(data.taskProgress) / 100).toFixed(2)
|
||||||
|
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,
|
||||||
|
projectUser: undefined,
|
||||||
|
projectName: undefined,
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
formType.value = props.id
|
||||||
|
|
||||||
|
if (formType.value) await open(formType.value)
|
||||||
|
// 获得用户列表
|
||||||
|
userOptions.value = await UserApi.getSimpleUserList()
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
@ -113,7 +113,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8" v-if="formData.bonusEvaluation">
|
<el-col :span="8" v-if="formData.bonusEvaluation">
|
||||||
<el-form-item label="项目进度" prop="progress">
|
<el-form-item label="项目进度(%)" prop="progress">
|
||||||
<el-input v-model="formData.progress" oninput = "value=value.replace(/[^\d]/g,'')" placeholder="请输入奖金评估描述" />
|
<el-input v-model="formData.progress" oninput = "value=value.replace(/[^\d]/g,'')" placeholder="请输入奖金评估描述" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
@ -183,7 +183,7 @@
|
||||||
<ContentWrap style="border: none;font-weight: 700" v-if="formData.auditStatus == 2">
|
<ContentWrap style="border: none;font-weight: 700" v-if="formData.auditStatus == 2">
|
||||||
任务信息
|
任务信息
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
<Task ref="taskRef" v-if="formData.auditStatus == 2" />
|
<Task ref="taskRef" v-if="formData.auditStatus == 2" :userOptions="userOptions" :id="formData.id" :userId="formData.userId" :name="formData.name" />
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="text-align: right" v-if="!type">
|
<div style="text-align: right" v-if="!type">
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
:model="queryParams"
|
:model="queryParams"
|
||||||
ref="queryFormRef"
|
ref="queryFormRef"
|
||||||
:inline="true"
|
:inline="true"
|
||||||
label-width="68px"
|
label-width="90px"
|
||||||
>
|
>
|
||||||
|
|
||||||
<el-form-item label="项目名称" prop="name">
|
<el-form-item label="项目名称" prop="name">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue