|
@@ -1,16 +1,58 @@
|
|
|
<template>
|
|
|
- <div class="w-full h-full flex-col">
|
|
|
+ <div class="w-full h-full flex flex-col">
|
|
|
<div class="bg-white info flex-1 overflow-y-auto">
|
|
|
- <van-cell title="任务名称" :value="''" />
|
|
|
- <van-cell title="优先级" :value="''" />
|
|
|
+ <van-cell title="任务名称" :value="infoData.taskName" />
|
|
|
+ <van-cell title="优先级">
|
|
|
+ <template #default>
|
|
|
+ {{ fixedFieldPriority.find(subItem => subItem.value == infoData.priority)?.label || '' }}
|
|
|
+ </template>
|
|
|
+ </van-cell>
|
|
|
+ <van-cell title="状态" :value="''">
|
|
|
+ <template #default>
|
|
|
+ <div :style="`color: ${fixedFieldTaskStatus.find(subItem => subItem.value == infoData.status)?.color}`">
|
|
|
+ {{ fixedFieldTaskStatus.find(subItem => subItem.value == infoData.status)?.label || '' }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </van-cell>
|
|
|
+ <van-cell title="执行人">
|
|
|
+ <template #default>
|
|
|
+ <TranslationComponent :openId="infoData.taskExecutors" />
|
|
|
+ </template>
|
|
|
+ </van-cell>
|
|
|
+ <van-cell title="开始时间" :value="infoData.startDate" />
|
|
|
+ <van-cell title="截至时间" :value="infoData.endDate" />
|
|
|
+ <van-cell title="客户名称" :value="infoData.customName" v-if="infoData.customName" />
|
|
|
+ <van-cell title="商机名称" :value="infoData.businessName" v-if="infoData.businessName" />
|
|
|
+ <van-cell title="销售订单" :value="infoData.orderName" v-if="infoData.orderName" />
|
|
|
+ <van-cell title="线索名称" :value="infoData.clueName" v-if="infoData.clueName" />
|
|
|
+ <van-cell title="联系人名称" :value="infoData.contactsName" v-if="!infoData.clueId" />
|
|
|
+ <van-cell title="联系人号码" :value="infoData.contactsPhone" v-if="!infoData.clueId" />
|
|
|
+ </div>
|
|
|
+ <div class="bottomButton">
|
|
|
+ <van-button type="success" class="w-full block" @click="completeTheTask(2)" v-if="infoData.status != 2">完成任务</van-button>
|
|
|
+ <van-button type="primary" class="w-full block" @click="completeTheTask(0)" v-if="infoData.status == 2">重启任务</van-button>
|
|
|
+ <van-button type="danger" class="w-full block" @click="deleteTask">删除任务</van-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref } from 'vue';
|
|
|
+import { ref, watch } from 'vue';
|
|
|
+import { showConfirmDialog } from 'vant';
|
|
|
import { useLifecycle } from '@hooks/useCommon.js';
|
|
|
+import { GET_TASK_DETAILS, TASK_OPERATION } from "@hooks/useApi"
|
|
|
+import requests from "@common/requests";
|
|
|
+import { fixedFieldPaymentStatus, fixedFieldPriority, fixedFieldTaskStatus, fixedFieldStatusArray } from "@utility/defaultData"
|
|
|
+import useShowToast from '@hooks/useToast'
|
|
|
+import { routingInfos } from "@utility/generalVariables"
|
|
|
+import useInfoStore from '@store/useInfoStore'
|
|
|
+import useFixedData from "@store/useFixedData.js"
|
|
|
+import useRouterStore from "@store/useRouterStore.js";
|
|
|
|
|
|
+const router = useRouterStore()
|
|
|
+const fixedData = useFixedData()
|
|
|
+const userInfo = useInfoStore()
|
|
|
+const { toastSuccess, toastFail, toastText } = useShowToast()
|
|
|
const props = defineProps({
|
|
|
info: {
|
|
|
type: Object,
|
|
@@ -18,25 +60,81 @@ const props = defineProps({
|
|
|
default: () => ({})
|
|
|
}
|
|
|
})
|
|
|
+const routingInformation = routingInfos['tasks']
|
|
|
+const infoData = ref(props.info);
|
|
|
+const timeout = ref(null);
|
|
|
+
|
|
|
+watch(() => props.info, (newValue) => {
|
|
|
+ initializeData(newValue.id)
|
|
|
+})
|
|
|
+
|
|
|
+function completeTheTask(status) {
|
|
|
+ const id = infoData.value.id
|
|
|
+ requests.post(TASK_OPERATION, { id, status }).then(({ data }) => {
|
|
|
+ toastSuccess('操作成功')
|
|
|
+ getTaskDetails(id)
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
-function getTaskDetails() {
|
|
|
-
|
|
|
+function deleteTask() {
|
|
|
+ const { name = '', searchFiled = {}, deteleFiled = '' } = routingInformation
|
|
|
+ const row = infoData.value
|
|
|
+ const foemVal = { [routingInformation.key == 'tasks' ? 'taskIds' : 'ids']: row.id }
|
|
|
+ showConfirmDialog({
|
|
|
+ title: `删除${name}`,
|
|
|
+ message: `确定删除【${row[searchFiled?.search]}】${name}吗?`,
|
|
|
+ }).then(() => {
|
|
|
+ requests.post(deteleFiled, { ...foemVal }).then((res) => {
|
|
|
+ toastSuccess('删除成功')
|
|
|
+ router.navigateBack({
|
|
|
+ success: () => {
|
|
|
+ router.emit('moduleListDetailParameter', {
|
|
|
+ row: JSON.stringify(routingInformation)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch((err) => {
|
|
|
+ toastFail(err.msg ? err.msg : '删除失败')
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
-function initializeData() {
|
|
|
+function getTaskDetails(id) {
|
|
|
+ requests.post(GET_TASK_DETAILS, { id }).then(({ data }) => {
|
|
|
+ infoData.value = data
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
+function initializeData(id) {
|
|
|
+ clearTimeout(timeout.value);
|
|
|
+ timeout.value = setTimeout(() => {
|
|
|
+ getTaskDetails(id)
|
|
|
+ }, 100);
|
|
|
}
|
|
|
|
|
|
useLifecycle({
|
|
|
load: () => {
|
|
|
- initializeData()
|
|
|
+ initializeData(props.info.id)
|
|
|
},
|
|
|
init: () => {
|
|
|
- initializeData()
|
|
|
+ initializeData(props.info.id)
|
|
|
+ },
|
|
|
+ unLoad: () => {
|
|
|
+ clearTimeout(timeout.value);
|
|
|
}
|
|
|
});
|
|
|
</script>
|
|
|
|
|
|
<style lang='scss' scoped>
|
|
|
+.bottomButton {
|
|
|
+ margin: 0 14px;
|
|
|
+ padding-bottom: 30px;
|
|
|
|
|
|
+ :deep(.van-button) {
|
|
|
+ margin-bottom: 20px;
|
|
|
+ }
|
|
|
+}
|
|
|
+.info {
|
|
|
+ margin: 8px 14px 30px 14px;
|
|
|
+}
|
|
|
</style>
|