Browse Source

fix: 流水账修改

text-draggable
xuesinan 3 years ago
parent
commit
c0e48fd52c
  1. 17
      src/App.vue
  2. 4
      src/components/tall/center/Global.vue
  3. 4
      src/components/tall/center/RegularTask.vue
  4. 11
      src/components/tall/center/Roles.vue
  5. 1
      src/components/tall/top/TopNavbar.vue
  6. 107
      src/plugins/p-daily-account/p-daily-account-detail.vue

17
src/App.vue

@ -6,7 +6,7 @@
<script setup>
import { useStore } from 'vuex';
import { computed } from 'vue';
import { computed, watch } from 'vue';
import { v4 as uuidv4 } from 'uuid';
const store = useStore();
@ -24,13 +24,14 @@ if (sessionProject && !projectInfo.value.id) {
store.commit('task/setBusinessCode', info && info.businessCode ? info.businessCode : '');
}
if (projectInfo.value.id || sessionProject) {
const info = JSON.parse(sessionProject);
const projectId = projectInfo.value.id || info.id;
const url = projectInfo.value.url || info.url;
const param = { projectId };
store.dispatch('role/getAllMembers', { param, url });
}
watch(projectInfo, () => {
if (projectInfo.value.id) {
const projectId = projectInfo.value.id;
const { url } = projectInfo.value;
const param = { projectId };
store.dispatch('role/getAllMembers', { param, url });
}
});
//
store.commit('layout/setDeviceId', uuidv4().split('-')[0]);

4
src/components/tall/center/Global.vue

@ -52,13 +52,13 @@ const roleInfo = computed(() => store.state.role.roleInfo); // 当前角色信
const roleId = computed(() => store.state.role.roleId); // id
const globals = computed(() => store.getters['task/globals']); //
if (project.value && roleId.value) {
if (project.value.id && roleId.value) {
getPermanentData(roleId.value); //
getGlobalData(roleId.value);
}
watch([project, roleId], () => {
if (project.value && roleId.value) {
if (project.value.id && roleId.value) {
getPermanentData(roleId.value); //
getGlobalData(roleId.value);
}

4
src/components/tall/center/RegularTask.vue

@ -75,12 +75,12 @@ onMounted(() => {
document.getElementById('tasks').addEventListener('scroll', handleScroll, true);
});
if (project.value && roleId.value) {
if (project.value.id && roleId.value) {
getTasks({ roleId: roleId.value }); //
}
watch([project, roleId], async () => {
if (project.value && roleId.value) {
if (project.value.id && roleId.value) {
await getTasks({ roleId: roleId.value }); //
}
});

11
src/components/tall/center/Roles.vue

@ -2,7 +2,7 @@
<div class="role-list relative" ref="roleBox">
<div class="role-abs absolute flex items-center" ref="roleAbs">
<div class="role-box relative cursor-pointer" ref="roleItem" v-for="(item, index) in roleList" :key="index" @click="changeRole(item)">
<div class="role-name" :class="{ mine: roleId === item.id }">{{ item.name }}</div>
<div class="role-name" :class="{ mine: item.mine === 1, selected: roleId === item.id }">{{ item.name }}</div>
<div class="line-box absolute flex justify-center" v-if="roleId === item.id"><div class="line"></div></div>
</div>
</div>
@ -117,6 +117,11 @@ function changeRole(item) {
}
.role-name.mine {
font-weight: 600;
color: #f59e0b !important;
}
.role-name.selected {
font-weight: 600;
color: #1890ff;
}
@ -131,4 +136,8 @@ function changeRole(item) {
height: 2px;
background-color: #1890ff;
}
.role-name.mine + .line-box .line {
background-color: #f59e0b;
}
</style>

1
src/components/tall/top/TopNavbar.vue

@ -45,6 +45,7 @@ function signOut() {
store.commit('user/setUser', null);
store.commit('projects/setProject', null);
store.commit('user/setToken', '');
store.commit('role/setRoleId', '');
// store.commit('task/setTaskDetail', null);
// router.push({ path: '/experiment/user/signin' });
}

107
src/plugins/p-daily-account/p-daily-account-detail.vue

@ -57,8 +57,8 @@
<template v-for="item in text">
<template v-if="column.proId === item.proId">
<div class="mb-3" v-for="(task, key) in item.tasks" :key="key">
<PushpinOutlined v-if="task.cooperation === 1" title="协作任务" />
<span class="ml-2">
<PushpinOutlined class="mr-2" v-if="task.cooperation === 1" title="协作任务" />
<span>
我今日计划结果{{ key + 1 }}{{ task.taskName }}交付物是{{ task.deliverName }}截止时间{{
dayjs(+task.deadline).format('MM-DD')
}}时长{{ task.duration / 3600000 }}检查人{{ task.checker }}
@ -93,6 +93,8 @@
style="padding: 0; max-height: 800px; overflow-y: auto"
>
<div style="padding: 0 96px">
<div class="mb-4">当前操作项目{{ currProName }}当前操作成员{{ currEmpName }}</div>
<a-form :model="modalFormState">
<div v-for="(item, index) in modalFormState" :key="index">
<div class="flex justify-between items-center text-gray-400">
@ -216,12 +218,15 @@ const projectId = computed(() => store.getters['project/projectId']);
const sessionProjectId = sessionStorage.getItem('projectId');
const roleId = computed(() => store.state.role.roleId);
const members = computed(() => store.state.role.members);
const userId = computed(() => store.getters['user/userId']); // id
const isFullScreen = computed(() => store.state.layout.isFullScreen); //
const visible = ref(false); //
const isDisabled = ref(false); //
const morningStatus = ref(false); //
const nightStatus = ref(false); //
const checkerId = ref(null); // id
const recordId = ref(null); // id
const memberId = ref(null); // id
//
const formState = reactive({
@ -229,6 +234,8 @@ const formState = reactive({
staffRange: [], //
programName: [], //
});
const startTime = dayjs(+new Date().getTime());
const endTime = dayjs(+new Date().getTime()).add(1, 'day');
//
const memberList = ref([]); //
@ -246,28 +253,19 @@ const dataTotal = ref(0); // 数据总量
const columnDatas = ref([]);
//
const modalFormState = ref([
{
taskName: '',
deliverName: '',
showDeadLine: dayjs(+new Date().getTime()),
deadline: '',
showDuration: '2',
duration: '',
checker: '',
cooperation: 0,
deliverLink: '',
sequence: 0,
},
]);
const modalFormState = ref([]);
//
const workDurations = [...Array(8)].map((_, i) => ({ value: `${i + 1}` }));
const isSubmitDeliver = ref(false); //
const currEmpId = ref(null); // id
const currEmpName = ref(null); //
const currProId = ref(null); // id
const currProName = ref(null); //
onMounted(async () => {
getClockQuery();
await getInfo();
await getQueryTasks({});
await getQueryTasks();
});
//
@ -284,18 +282,19 @@ async function getInfo() {
pageSize.value = data.emps.length;
proList.value = data.pros;
} catch (error) {
message.info(error);
throw new Error(error);
}
}
//
async function getQueryTasks(query) {
async function getQueryTasks() {
try {
const { url } = store.state.projects.project;
const params = {
param: {
startTime: query.startTime || formState.timeRange[0].startOf('day').valueOf(),
endTime: query.endTime || formState.timeRange[1].startOf('day').valueOf(),
startTime: startTime.value || formState.timeRange[0].startOf('day').valueOf(),
endTime: endTime.value || formState.timeRange[1].startOf('day').valueOf(),
emps: emps.value || [],
pros: proDatas.value || [],
},
@ -359,6 +358,7 @@ async function getQueryTasks(query) {
columnDatas.value.push(obj);
});
} catch (error) {
message.info(error);
throw new Error(error);
}
}
@ -377,8 +377,9 @@ function handleSubmit() {
if (index > -1) proDatas.value.push(item.id);
});
const endTime = dayjs(+formState.timeRange[0].startOf('day')).add(1, 'day');
getQueryTasks({ endTime: dayjs(+endTime).valueOf() });
const end = dayjs(+formState.timeRange[0].startOf('day')).add(1, 'day');
endTime.value = dayjs(+end).valueOf();
getQueryTasks();
}
//
@ -392,16 +393,39 @@ function resetData() {
//
function handlePage(e) {
const startTime = dayjs(+formState.timeRange[0].startOf('day')).add(e - 1, 'day');
const endTime = dayjs(+startTime).add(1, 'day');
getQueryTasks({ startTime: dayjs(+startTime).valueOf(), endTime: dayjs(+endTime).valueOf() });
const start = dayjs(+formState.timeRange[0].startOf('day')).add(e - 1, 'day');
const end = dayjs(+start).add(1, 'day');
startTime.value = dayjs(+start).valueOf();
endTime.value = dayjs(+end).valueOf();
getQueryTasks();
}
//
function showModal(data, proId) {
currEmpId.value = data.empId;
currProId.value = proId;
const currEmpInfo = memberList.value.find(item => item.id === data.empId);
currEmpName.value = currEmpInfo.empName;
const currProInfo = proList.value.find(item => item.id === proId);
currProName.value = currProInfo.projectName;
isDisabled.value = dayjs(+new Date().getTime()).format('MM-DD') !== data.time;
visible.value = true;
modalFormState.value = [
{
taskName: '',
deliverName: '',
showDeadLine: dayjs(+new Date().getTime()),
deadline: '',
showDuration: '2',
duration: '',
checker: '',
cooperation: 0,
deliverLink: '',
sequence: 0,
},
];
data.program.forEach(item => {
if (proId === item.proId) {
modalFormState.value = [...item.tasks];
@ -417,7 +441,7 @@ function showModal(data, proId) {
//
function filterOption(input, option) {
return option.emp_name.indexOf(input) >= 0;
return option.empName.indexOf(input) >= 0;
}
//
@ -500,8 +524,8 @@ async function submitForm() {
const params = {
param: {
time: new Date().getTime(),
empId: 1,
proId: 1,
empId: currEmpId.value,
proId: currProId.value,
tasks: modalFormState.value,
},
};
@ -513,18 +537,27 @@ async function submitForm() {
punch();
getQueryTasks();
} catch (error) {
message.info(error);
throw new Error(error);
}
}
//
async function getClockQuery() {
const startTime = dayjs(+new Date().getTime()).valueOf();
const endTime = dayjs(+new Date().getTime())
const start = dayjs(+new Date().getTime()).valueOf();
const end = dayjs(+new Date().getTime())
.add(1, 'day')
.valueOf();
const params = { param: { projectId: projectId.value || sessionProjectId, roleId: roleId.value, memberIdList: [], startTime, endTime } };
const params = {
param: {
projectId: projectId.value || sessionProjectId,
roleId: roleId.value,
memberIdList: [],
startTime: start,
endTime: end,
},
};
try {
const { url } = store.state.projects.project;
@ -539,9 +572,17 @@ async function getClockQuery() {
checkerId.value = members.value[0].memberId;
}
// id
if (data[0].recordList[0].isMine === 1) {
memberId.value = data[0].recordList[0].memberId;
}
recordId.value = data[0].recordList[0].id;
morningStatus.value = data[0].recordList[0].morningStatus > 0; //
nightStatus.value = data[0].recordList[0].nightStatus > 0; //
} catch (error) {
message.info(error);
throw new Error(error);
}
}
@ -549,7 +590,8 @@ async function getClockQuery() {
async function punch() {
const clockType = isSubmitDeliver.value ? 1 : 0; // 1 0
const dateTime = dayjs(+new Date().getTime()).valueOf(); //
const params = { param: { clockType, dateTime } };
const params = { param: { checkerId: checkerId.value, memberId: memberId.value, id: recordId.value, clockType, dateTime } };
try {
const { url } = store.state.projects.project;
const data = await clockPunch(params, url);
@ -557,6 +599,7 @@ async function punch() {
morningStatus.value = data[0].recordList[0].morningStatus > 0; //
nightStatus.value = data[0].recordList[0].nightStatus > 0; //
} catch (error) {
message.info(`打卡失败,${error}`);
throw new Error(error);
}
}

Loading…
Cancel
Save