Browse Source

feat: 流水账样式

text-draggable
xuesinan 3 years ago
parent
commit
021b53c8c2
  1. 1
      .eslintrc.js
  2. 4
      src/components/tall/plugin/Plugin.vue
  3. 31
      src/plugins/p-daily-account/p-daily-account-detail.vue
  4. 173
      src/plugins/p-deliver-second/p-deliver-second-detail.vue
  5. 26
      src/plugins/p-deliver-second/p-deliver-second.vue
  6. 30
      src/plugins/p-deliver-second/p-deliver-upload-second.vue
  7. 12
      src/store/tall/task/index.js
  8. 6
      src/views/detail/Test.vue

1
.eslintrc.js

@ -11,6 +11,7 @@ module.exports = {
parser: "vue-eslint-parser", // 添加这一句
plugins: ['vue'],
rules: {
"prefer-destructuring": ["error", {"object": true, "array": false}],
'no-nested-ternary': 'off',
'no-unused-vars': 'off',
'no-loop-func': 'off',

4
src/components/tall/plugin/Plugin.vue

@ -2,9 +2,9 @@
<p-task-title :task="task" v-if="pluginId === '1'" class="p-2" />
<!-- 交付物插件 -->
<p-deliver v-else-if="pluginId === '15'" />
<!-- <p-deliver v-else-if="pluginId === '15'" /> -->
<!-- 交付物插件2 -->
<!-- <p-deliver-second v-else-if="pluginId === '15'" /> -->
<p-deliver-second v-else-if="pluginId === '15'" />
<!-- 资源管理 -->
<!-- <p-source-manage v-else-if="pluginId === '16'" class="p-2" /> -->

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

@ -51,10 +51,19 @@
</a-form>
<!-- 表格 -->
<a-table sticky class="mt-6" :columns="columns" :data-source="columnDatas" bordered :pagination="false" :scroll="{ x: 1400 }">
<a-table
sticky
class="mt-6"
:columns="columns"
:data-source="columnDatas"
bordered
:pagination="false"
:rowClassName="rowClassName"
:scroll="{ x: 1000, y: 580 }"
>
<template #bodyCell="{ column, text, record }">
<div
style="height: 100px"
style="height: 50px"
:class="{ 'text-left': column.dataIndex === 'program' }"
class="overflow-y-auto task-today"
@dblclick="showModal(record, column.proId)"
@ -315,7 +324,7 @@ async function getQueryTasks() {
columns.value = [
{
title: '时间',
width: 100,
width: 70,
dataIndex: 'time',
key: 'time',
fixed: 'left',
@ -323,7 +332,7 @@ async function getQueryTasks() {
},
{
title: '员工',
width: 100,
width: 90,
dataIndex: 'staff',
key: 'staff',
fixed: 'left',
@ -340,18 +349,20 @@ async function getQueryTasks() {
dataIndex: 'program',
key: `${index}`,
proId,
width: 300,
width: 200,
align: 'center',
});
});
memberList.value.forEach((member, key) => {
console.log('11111111', key);
const obj = {
empId: member.id,
key,
time: dayjs(+params.param.startTime).format('MM-DD'),
staff: `${member.empName}`,
program: [],
bgColor: key % 2 === 1 ? 1 : 0,
};
const currMember = data.recs.filter(item => member.id === item.empId);
@ -425,6 +436,12 @@ async function handleExport() {
}
}
//
function rowClassName(record, index) {
const bgColor = record.bgColor ? 'bg-style-color' : '';
return bgColor;
}
//
function handlePage(e) {
const start = dayjs(+formState.timeRange[0].startOf('day')).add(e - 1, 'day');
@ -661,4 +678,8 @@ async function punch(clockType) {
flex-wrap: nowrap;
overflow: hidden;
}
:deep(.bg-style-color) td {
background-color: #fafafa;
}
</style>

173
src/plugins/p-deliver-second/p-deliver-second-detail.vue

@ -0,0 +1,173 @@
<template>
<div class="relative">
<div class="text-base text-center font-semibold" style="height: 44px; line-height: 44px; background: rgb(248, 248, 248)">
交付物上传记录
</div>
<div class="tab-box absolute w-full flex justify-between items-center bg-white">
<div
class="tab-item text-center cursor-pointer"
v-for="(item, index) in clickList"
:key="index"
:class="{ 'tab-curr': item.index === current }"
@click="changeTabs(item.index)"
>
<div class="tab-title px-1 inline-block">{{ item.name }}</div>
</div>
</div>
<!-- 占位 -->
<div style="height: 44px"></div>
<div id="deliverCon" class="scroll-box">
<!-- 提交 -->
<div class="p-3 text-base scroll-0">当前提交</div>
<div class="px-3">
<p-deliver-upload-second
class="p-3 bg-white rounded-md"
v-if="deliverData"
:deliverData="deliverData"
:task="task"
@upload-success="getDeliverData"
></p-deliver-upload-second>
</div>
<!-- 审核 -->
<div class="p-3 text-base scroll-1">审核状态</div>
<div class="px-3">
<p-deliver-check-second
v-if="deliverData"
:deliverData="deliverData"
:task="task"
@submit-end="getDeliverData"
></p-deliver-check-second>
</div>
</div>
</div>
</template>
<script setup>
import { useStore } from 'vuex';
import { ref, onMounted, computed, watch, provide } from 'vue';
import { getDeliverByTaskId } from 'apis';
import { message } from 'ant-design-vue';
import pDeliverUploadSecond from '@/plugins/p-deliver-second/p-deliver-upload-second.vue';
import pDeliverCheckSecond from '@/plugins/p-deliver-second/p-deliver-check-second.vue';
const store = useStore();
const detailParams = computed(() => store.state.task.detailParams); //
const sessionDetailParams = sessionStorage.getItem('detailParams'); //
const clickList = ref([
{
index: 0,
name: '提交',
},
{
index: 1,
name: '审核',
},
{
index: 2,
name: '历史记录',
},
]);
const current = ref(0); //
const deliverData = ref(null); //
const task = ref(null); //
//
if (sessionDetailParams && !detailParams.value) {
const params = JSON.parse(sessionDetailParams);
store.commit('task/setTaskDetailParams', params);
provide('deliver', params.deliver);
provide('task', params.task);
}
if (detailParams.value) {
deliverData.value = detailParams.value.deliver;
task.value = detailParams.value.task;
provide('deliver', deliverData);
provide('task', task.value);
}
//
watch(detailParams, () => {
deliverData.value = detailParams.value.deliver;
task.value = detailParams.value.task;
});
onMounted(() => {
document.getElementById('deliverCon').addEventListener('scroll', handleScroll, true);
});
//
function changeTabs(index) {
current.value = index;
}
//
function handleScroll(e) {
// scrollTop
const { scrollTop } = e.target;
// windowHeight
const windowHeight = e.target.clientHeight;
// scrollHeight
const { scrollHeight } = e.target;
console.log('scrollTop', scrollTop);
}
// id
async function getDeliverData() {
try {
const { url } = store.state.projects.project;
const { id: taskId } = task.value;
if (!taskId) return;
const param = { param: { taskId } };
const data = await getDeliverByTaskId(param, url);
deliverData.value = data;
} catch (error) {
message.info(error);
}
}
</script>
<style scoped>
.tab-box {
height: 44px;
z-index: 999;
}
.tab-box .tab-item {
width: calc(100% / 3);
height: 44px;
line-height: 40px;
}
.tab-box .tab-curr .tab-title {
color: #2979ff;
border-bottom: 3px solid #2979ff;
}
.time-box {
width: 120px;
}
.time-box view {
height: 15px;
border-radius: 2px;
margin: 2px 0;
}
.time-box .duration-value {
height: 15px;
line-height: 15px;
font-size: 12px;
top: 0;
left: 0;
color: #333;
}
</style>

26
src/plugins/p-deliver-second/p-deliver-second.vue

@ -3,11 +3,19 @@
<div>
<p-deliver-upload-second v-if="deliver" @upload-success="getDeliverData"></p-deliver-upload-second>
<p-deliver-check-second
<!-- <p-deliver-check-second
class="mt-3"
v-if="deliver && deliver.details && deliver.details.length"
@check-success="getDeliverData"
></p-deliver-check-second>
></p-deliver-check-second> -->
<div class="mt-3" v-if="deliver && deliver.details && deliver.details.length" @check-success="getDeliverData">
<!-- 审核标题 -->
<div class="flex justify-between items-center" @click="openDeliverHistory">
<div>{{ deliver ? deliver.deliverName : '' }}审核状态</div>
<right-outlined />
</div>
</div>
</div>
</template>
@ -16,8 +24,9 @@ import { useStore } from 'vuex';
import { ref, inject, provide } from 'vue';
import { getDeliverByTaskId } from 'apis';
import { message } from 'ant-design-vue';
import { RightOutlined } from '@ant-design/icons-vue';
import pDeliverUploadSecond from '@/plugins/p-deliver-second/p-deliver-upload-second.vue';
import pDeliverCheckSecond from '@/plugins/p-deliver-second/p-deliver-check-second.vue';
// import pDeliverCheckSecond from '@/plugins/p-deliver-second/p-deliver-check-second.vue';
const store = useStore();
const task = inject('task');
@ -27,6 +36,17 @@ const deliver = ref(null); // 服务端返回的交付物信息
deliver.value = pluginInfo && pluginInfo.data ? JSON.parse(pluginInfo.data) : null;
provide('deliver', deliver);
//
function openDeliverHistory() {
const detailParams = {
deliver: deliver.value,
task,
};
store.commit('task/setTaskDetailParams', detailParams); //
store.commit('task/setTaskDetailUrl', ''); //
store.commit('task/setTaskDetailShow', 'deliverSecDetail'); //
}
// id
async function getDeliverData() {
try {

30
src/plugins/p-deliver-second/p-deliver-upload-second.vue

@ -79,18 +79,25 @@
<script setup>
import { useStore } from 'vuex';
import { ref, inject, computed, defineEmits } from 'vue';
import { ref, inject, computed, watch, defineEmits, defineProps } from 'vue';
import { message } from 'ant-design-vue';
import { submitDeliverInfo, uploadImg } from 'apis';
import ReviewerSecond from '@/components/tall/Reviewer/ReviewerSecond.vue';
const props = defineProps({
deliverData: { type: Object, default: () => {} },
task: { type: Object, default: () => {} },
});
const store = useStore();
const projectId = computed(() => store.getters['project/projectId']);
const sessionProjectId = sessionStorage.getItem('projectId');
const roleId = computed(() => store.state.role.roleId);
const deliver = inject('deliver'); //
const task = inject('task'); //
const deliverInject = inject('deliver'); //
const taskInject = inject('task'); //
const deliver = computed(() => (Object.keys(props.deliverData).length ? props.deliverData : deliverInject.value));
const task = computed(() => (Object.keys(props.task).length ? props.task : taskInject));
const linkValue = ref(''); //
const duration = ref(2); //
@ -111,6 +118,21 @@ const showMask = ref(false); // 编辑和删除页面是否显示
const emits = defineEmits(['upload-success']);
if (Object.keys(deliver.value).length) {
linkValue.value = deliver.value.details[0]; //
//
duration.value = deliver.value.duration ? Number(deliver.value.duration) / 3600000 : Number(deliver.value.initialDuration) / 3600000;
checkedIndex.value = duration.value === 0.5 ? 0 : duration.value === 1 ? 1 : duration.value === 2 ? 2 : -1;
}
watch(deliver, () => {
console.log('deliver', deliver);
linkValue.value = deliver.value.details[0]; //
//
duration.value = deliver.value.duration ? Number(deliver.value.duration) / 3600000 : Number(deliver.value.initialDuration) / 3600000;
checkedIndex.value = duration.value === 0.5 ? 0 : duration.value === 1 ? 1 : duration.value === 2 ? 2 : -1;
});
function handleChange(info) {
console.log('info', info);
}
@ -145,6 +167,7 @@ async function submit() {
deliverId: deliver.value.deliverId,
fileList: [linkValue.value],
checkerList,
duration: Number(duration.value) * 60 * 60 * 1000,
msgId: task.msgId,
},
};
@ -185,7 +208,6 @@ function validateDeliverForm(checkedCheckers) {
//
function resetControlState() {
submitBtnLoading.value = false; // loading
linkValue.value = ''; //
reviewerRef.value.collapsed = true; //
}
</script>

12
src/store/tall/task/index.js

@ -39,6 +39,8 @@ export default {
deliverId: '', // 当前交付物id
deliverRecordId: '', // 当前交付物记录id
detailParams: '', // 设置详情页参数
},
getters: {
@ -437,6 +439,16 @@ export default {
state.deliverRecordId = data;
sessionStorage.setItem('deliverRecordId', data);
},
/**
* 设置详情页参数
* @param {Object} state
* @param {Object} data
*/
setTaskDetailParams(state, data) {
state.detailParams = data;
sessionStorage.setItem('detailParams', JSON.stringify(data));
},
},
actions: {},

6
src/views/detail/Test.vue

@ -8,8 +8,11 @@
<!-- 交付物历史记录 -->
<p-deliver-history v-if="taskDetailShow === 'deliverHistory'"></p-deliver-history>
<!-- 审核记录 -->
<!-- 交付物审核记录 -->
<p-audit-records v-if="taskDetailShow === 'auditRecords'"></p-audit-records>
<!-- 交付物2详情页 -->
<p-deliver-second-detail v-if="taskDetailShow === 'deliverSecDetail'"></p-deliver-second-detail>
</div>
</template>
@ -20,6 +23,7 @@ import DetailWebview from '@/components/tall/Right/DetailWebview.vue';
import pDailyAccountDetail from '@/plugins/p-daily-account/p-daily-account-detail.vue';
import pDeliverHistory from '@/plugins/p-deliver/p-deliver-history.vue';
import pAuditRecords from '@/plugins/p-deliver/p-audit-records.vue';
import pDeliverSecondDetail from '@/plugins/p-deliver-second/p-deliver-second-detail.vue';
const store = useStore();

Loading…
Cancel
Save