14 changed files with 237 additions and 14 deletions
|
After Width: | Height: | Size: 52 KiB |
@ -0,0 +1,41 @@ |
|||||
|
<template> |
||||
|
<div class="flex justify-around task-card-plugin"> |
||||
|
<a-button type="primary" style="width: 125px" @click="openAudit">财务审批</a-button> |
||||
|
<a-button type="primary" style="width: 125px" @click="openStatistical">财务统计</a-button> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script setup> |
||||
|
import { useStore } from 'vuex'; |
||||
|
import { computed, inject } from 'vue'; |
||||
|
|
||||
|
const store = useStore(); |
||||
|
const task = inject('task'); |
||||
|
const token = computed(() => store.state.user.token); |
||||
|
const project = computed(() => store.state.projects.project); |
||||
|
const sessionProject = sessionStorage.getItem('project'); |
||||
|
|
||||
|
if (sessionProject && !project.value.id) { |
||||
|
store.commit('projects/setProject', JSON.parse(sessionProject)); |
||||
|
} |
||||
|
|
||||
|
// 打开财务审批详情页 |
||||
|
function openAudit() { |
||||
|
const param = `name=财务审批&token=${token.value}&projectId=${project.value.id}&id=${task.detailId}&pn=${project.value.name}&tn=${task.name}`; |
||||
|
const url = `http://121.36.3.207/finance/financial-approval?${param}`; |
||||
|
|
||||
|
store.commit('task/setTaskDetailParams', ''); // 设置详情页参数 |
||||
|
store.commit('task/setTaskDetailUrl', url); // 设置详情页链接 |
||||
|
store.commit('task/setTaskDetailShow', ''); // 设置内置组件关键字(根据关键字判断显示的详情页) |
||||
|
} |
||||
|
|
||||
|
// 打开财务统计详情页 |
||||
|
function openStatistical() { |
||||
|
const param = `name=财务统计&token=${token.value}&projectId=${project.value.id}&id=${task.detailId}&pn=${project.value.name}&tn=${task.name}`; |
||||
|
const url = `http://121.36.3.207/finance/financial-approval?${param}`; |
||||
|
|
||||
|
store.commit('task/setTaskDetailParams', ''); // 设置详情页参数 |
||||
|
store.commit('task/setTaskDetailUrl', url); // 设置详情页链接 |
||||
|
store.commit('task/setTaskDetailShow', ''); // 设置内置组件关键字(根据关键字判断显示的详情页) |
||||
|
} |
||||
|
</script> |
||||
@ -0,0 +1,95 @@ |
|||||
|
<!-- 财务条内置组件 --> |
||||
|
<template> |
||||
|
<div class="finance-wrap task-card-plugin" v-if="data" @click="openFinance"> |
||||
|
<!-- 预算和奖金 --> |
||||
|
<div class="finance-row"> |
||||
|
<div |
||||
|
class="finance-item" |
||||
|
:style="{ width: `${(+data.budget * 100) / (+data.budget + +data.bonus)}%`, 'background-color': '#93C5FD' }" |
||||
|
> |
||||
|
预算{{ (data.budget ? data.budget : 0) / 100 }} |
||||
|
</div> |
||||
|
<div class="finance-item" :style="{ width: `${(+data.bonus * 100) / (+data.budget + +data.bonus)}%`, 'background-color': '#12c77e' }"> |
||||
|
奖金{{ (data.bonus ? data.bonus : 0) / 100 }} |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- 项目采购日常采购 --> |
||||
|
<div class="finance-row"> |
||||
|
<div |
||||
|
class="finance-item" |
||||
|
:style="{ width: `${(+data.projectExpend * 100) / (+data.projectExpend + +data.dailyExpend)}%`, 'background-color': '#FBBF24' }" |
||||
|
> |
||||
|
项目采购{{ (data.dailyExpend ? data.dailyExpend : 0) / 100 }} |
||||
|
</div> |
||||
|
<div |
||||
|
class="finance-item" |
||||
|
:style="{ width: `${(+data.dailyExpend * 100) / (+data.projectExpend + +data.dailyExpend)}%`, 'background-color': '#a1fd93' }" |
||||
|
> |
||||
|
日常采购{{ +(data.dailyExpend ? data.dailyExpend : 0) / 100 }} |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script setup> |
||||
|
import { useStore } from 'vuex'; |
||||
|
import { ref, computed, inject } from 'vue'; |
||||
|
import { getFinanceByTask } from 'apis'; |
||||
|
|
||||
|
const store = useStore(); |
||||
|
const task = inject('task'); |
||||
|
const data = ref(null); |
||||
|
const pluginInfo = inject('pluginInfo'); |
||||
|
|
||||
|
const token = computed(() => store.state.user.token); |
||||
|
const project = computed(() => store.state.projects.project); |
||||
|
const sessionProject = sessionStorage.getItem('project'); |
||||
|
|
||||
|
if (sessionProject && !project.value.id) { |
||||
|
store.commit('projects/setProject', JSON.parse(sessionProject)); |
||||
|
} |
||||
|
|
||||
|
data.value = pluginInfo && pluginInfo.data ? JSON.parse(pluginInfo.data) : null; |
||||
|
|
||||
|
// 查询任务上的财务条数据 |
||||
|
async function getFinanceByTaskData() { |
||||
|
try { |
||||
|
const { detailId } = task; |
||||
|
const { url } = project.value; |
||||
|
const params = { param: { detailId } }; |
||||
|
data.value = await getFinanceByTask(params, url); |
||||
|
} catch (error) { |
||||
|
console.log('getFinanceByTaskData error: ', error); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// getFinanceByTaskData(); |
||||
|
|
||||
|
// 打开详情页 |
||||
|
function openFinance() { |
||||
|
// DEBUG: 假数据 换成财务条详情页的地址 |
||||
|
const param = `name=财务&token=${token.value}&projectId=${project.value.id}&id=${task.detailId}&pn=${project.value.name}&tn=${task.name}`; |
||||
|
const url = `http://121.36.3.207/finance/applicant?${param}`; |
||||
|
|
||||
|
store.commit('task/setTaskDetailParams', ''); // 设置详情页参数 |
||||
|
store.commit('task/setTaskDetailUrl', url); // 设置详情页链接 |
||||
|
store.commit('task/setTaskDetailShow', ''); // 设置内置组件关键字(根据关键字判断显示的详情页) |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
.finance-wrap .finance-row { |
||||
|
display: flex; |
||||
|
} |
||||
|
|
||||
|
.finance-wrap .finance-row .finance-item { |
||||
|
margin: 2px 4px; |
||||
|
font-size: 12px; |
||||
|
text-align: center; |
||||
|
border-radius: 4px; |
||||
|
white-space: nowrap; |
||||
|
text-overflow: ellipsis; |
||||
|
overflow-x: visible; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,36 @@ |
|||||
|
<template> |
||||
|
<!-- 任务名 跳转详情页 --> |
||||
|
<div class="u-font-14 flex justify-between items-center task-card-plugin"> |
||||
|
{{ task.name }} |
||||
|
<right-outlined class="ml-3" @click="toDetail(task)" /> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script setup> |
||||
|
import { useStore } from 'vuex'; |
||||
|
import { computed, defineProps } from 'vue'; |
||||
|
import { RightOutlined } from '@ant-design/icons-vue'; |
||||
|
|
||||
|
const store = useStore(); |
||||
|
const projects = computed(() => store.state.projects.projects); |
||||
|
|
||||
|
defineProps({ task: { type: Object, default: () => {} } }); |
||||
|
|
||||
|
function toDetail(task) { |
||||
|
const { id, projectId, executorRoleId, businessUrl, businessCode } = task; |
||||
|
const project = projects.value.find(item => item.projectId); |
||||
|
|
||||
|
if (project) { |
||||
|
store.commit('projects/setProject', project); |
||||
|
store.commit('task/clearTasks'); // 清空定期任务 |
||||
|
store.commit('task/clearRealTasks'); // 清空真实任务数据 |
||||
|
store.commit('socket/setCurrLocationTaskId', id); |
||||
|
store.commit('task/setUpNextPage', 1); |
||||
|
store.commit('task/setDownNextPage', 1); |
||||
|
store.commit('task/setTimeLineType', 1); |
||||
|
store.commit('role/setRoleId', executorRoleId); |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style></style> |
||||
@ -0,0 +1,7 @@ |
|||||
|
<template> |
||||
|
<div class="text-center"> |
||||
|
<a-image src="/src/assets/work.jpg" /> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script setup></script> |
||||
Loading…
Reference in new issue