Browse Source

feat: 交付物插件

text-draggable
xuesinan 4 years ago
parent
commit
c7680a2237
  1. 17
      src/App.vue
  2. 4
      src/components/tall/Reviewer/Reviewer.vue
  3. 68
      src/components/tall/center/RegularTask.vue
  4. 17
      src/plugins/p-deliver/check-form-modal.vue
  5. 19
      src/plugins/p-deliver/p-deliver-check.vue
  6. 23
      src/plugins/p-deliver/p-deliver-upload.vue
  7. 18
      src/plugins/p-deliver/p-deliver.vue

17
src/App.vue

@ -24,12 +24,13 @@ if (sessionProject && !projectInfo.value.id) {
store.commit('task/setBusinessCode', info && info.businessCode ? info.businessCode : '');
}
if (projectInfo.value.id) {
getMemberList();
}
watch(projectInfo, () => {
if (projectInfo.value.id) {
const projectId = projectInfo.value.id;
const { url } = projectInfo.value;
const param = { projectId };
store.dispatch('role/getAllMembers', { param, url });
getMemberList();
}
});
@ -56,6 +57,14 @@ setInterval(() => {
getPlugins();
}, 60000);
//
function getMemberList() {
const projectId = projectInfo.value.id;
const { url } = projectInfo.value;
const param = { projectId };
store.dispatch('role/getAllMembers', { param, url });
}
/**
* 查询服务
*/

4
src/components/tall/Reviewer/Reviewer.vue

@ -27,7 +27,7 @@
</template>
<script setup>
import { ref, computed } from 'vue';
import { ref, computed, defineExpose } from 'vue';
import { useStore } from 'vuex';
import { DownOutlined, UpOutlined } from '@ant-design/icons-vue';
@ -43,6 +43,8 @@ const checkedCheckers = ref([]);
// 3...
const showCheckers = computed(() => (checkedCheckers.value.length > 3 ? checkedCheckers.value.slice(0, 3) : checkedCheckers.value));
defineExpose({ checkedCheckers, collapsed });
/**
* 点击成员 切换检查人的选中状态
* @param {object} member 成员对象

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

@ -1,42 +1,44 @@
<template>
<div id="tasks" class="task-list">
<div class="task-box" v-for="(item, index) in tasks" :key="index">
<div class="task-time flex items-center justify-between">
<div class="flex items-center">
<PlayCircleOutlined style="font-size: 23px; color: #999999" />
<span v-if="item.process === 4">{{ dayjs(+item.planStart).format('M月D日') }}</span>
<span v-else>{{ dayjs(+item.planStart).format('M月D日 HH:mm') }}</span>
<div class="-mt-3">
<div class="task-box" :class="{ 'pt-3': index === 0 }" v-for="(item, index) in tasks" :key="index">
<div class="task-time flex items-center justify-between">
<div class="flex items-center">
<PlayCircleOutlined style="font-size: 23px; color: #999999" />
<span v-if="item.process === 4">{{ dayjs(+item.planStart).format('M月D日') }}</span>
<span v-else>{{ dayjs(+item.planStart).format('M月D日 HH:mm') }}</span>
</div>
<div class="task-action"></div>
</div>
<div class="task-action"></div>
</div>
<div class="task-info">
<div>
<div class="task-card-null" v-if="item.process === 4"></div>
<div class="task-card" v-else>
<div class="task-name cursor-pointer">
<template v-if="item.plugins && item.plugins.length">
<div v-for="(pluginArr, i) in item.plugins" :key="i">
<div :class="{ 'pt-3': i > 0 }" v-if="pluginArr.length">
<Plugin
class="task-card-plugin"
v-for="plugin in pluginArr"
:key="plugin.pluginTaskId"
:plugin-id="plugin.pluginId"
:plugin-task-id="plugin.pluginTaskId"
:business-plugin-id="plugin.businessPluginId"
:plugin-info="plugin"
:param="plugin.param"
:style-type="plugin.styleType || 0"
:task="item"
/>
<div class="task-info">
<div>
<div class="task-card-null" v-if="item.process === 4"></div>
<div class="task-card" v-else>
<div class="task-name cursor-pointer">
<template v-if="item.plugins && item.plugins.length">
<div v-for="(pluginArr, i) in item.plugins" :key="i">
<div :class="{ 'pt-3': i > 0 }" v-if="pluginArr.length">
<Plugin
class="task-card-plugin"
v-for="plugin in pluginArr"
:key="plugin.pluginTaskId"
:plugin-id="plugin.pluginId"
:plugin-task-id="plugin.pluginTaskId"
:business-plugin-id="plugin.businessPluginId"
:plugin-info="plugin"
:param="plugin.param"
:style-type="plugin.styleType || 0"
:task="item"
/>
</div>
</div>
</div>
</template>
</template>
<div v-else class="">
<Plugin class="task-card-plugin" plugin-id="1" :task="item" />
<div v-else class="">
<Plugin class="task-card-plugin" plugin-id="1" :task="item" />
</div>
</div>
</div>
</div>

17
src/plugins/p-deliver/check-form-modal.vue

@ -47,6 +47,7 @@ const emits = defineEmits(['hide', 'submit-end']);
const store = useStore();
const task = inject('task');
const projectId = computed(() => store.getters['project/projectId']);
const sessionProjectId = sessionStorage.getItem('projectId');
const roleId = computed(() => store.state.role.roleId);
const words = computed(() => quickWords[props.data.mode]); //
@ -70,13 +71,15 @@ async function handleSubmit(mode) {
const { url } = store.state.projects.project;
const deliverRecordId = props.data.deliverRecordId();
const param = {
projectId: projectId.value,
roleId: roleId.value,
deliverRecordId,
type: mode === 'RESOLVE' ? 1 : 2,
remark: commit.value,
score: mode === 'RESOLVE' ? score.value : '',
msgId: task.msgId,
param: {
projectId: projectId.value || sessionProjectId,
roleId: roleId.value,
deliverRecordId,
type: mode === 'RESOLVE' ? 1 : 2,
remark: commit.value,
score: mode === 'RESOLVE' ? score.value : '',
msgId: task.msgId,
},
};
await checkDeliver(param, url);

19
src/plugins/p-deliver/p-deliver-check.vue

@ -61,7 +61,17 @@
<span v-if="item.status === 1" class="text-green-600"> 已通过 </span>
<span v-else-if="item.status === 2" class="text-red-600"> 已驳回 </span>
</div>
<span class="text-yellow-500 font-medium">{{ item.score }}</span>
<a-progress v-if="item.score" type="circle" :percent="item.score" strokeColor="#FA8C16" :width="40" :strokeWidth="10">
<template #format="percent">
<span
class="inline-block text-center text-white text-sm rounded-full"
style="background: #fa8c16; width: 22px; height: 22px; line-height: 22px"
>
{{ percent }}
</span>
</template>
</a-progress>
</div>
</div>
</div>
@ -102,3 +112,10 @@ const checkModal = reactive({
//
function openMoreRecords() {}
</script>
<style scoped>
.ant-progress .ant-progress-inner {
width: 40px !important;
height: 40px !important;
}
</style>

23
src/plugins/p-deliver/p-deliver-upload.vue

@ -21,7 +21,7 @@
<!-- <a-button type="primary" size="small" class="mr-3" @click="paste">粘贴</a-button> -->
<div class="inline-block">
<a-upload name="file" :action="action" :headers="headers" :max-count="1" @change="handleChange">
<a-upload name="param" :action="action" :headers="headers" :showUploadList="false" :max-count="1" @change="handleChange">
<a-button type="primary" size="small" class="mr-3">文件</a-button>
</a-upload>
</div>
@ -44,6 +44,7 @@ import Reviewer from '@/components/tall/Reviewer/Reviewer.vue';
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'); //
@ -71,6 +72,7 @@ function handleChange(info) {
//
async function submit() {
console.log(reviewerRef.value);
const { checkedCheckers } = reviewerRef.value; //
//
if (!validateDeliverForm(checkedCheckers)) return;
@ -85,21 +87,24 @@ async function submit() {
const { url } = store.state.projects.project;
const param = {
projectId: projectId.value,
roleId: roleId.value,
deliverId: deliver.value.deliverId,
fileList: [linkValue.value],
checkerList,
msgId: task.msgId,
const params = {
param: {
projectId: projectId.value || sessionProjectId,
roleId: roleId.value,
deliverId: deliver.value.deliverId,
fileList: [linkValue.value],
checkerList,
msgId: task.msgId,
},
};
const data = await submitDeliverInfo(param, url);
const data = await submitDeliverInfo(params, url);
message.info('提交交付物信息成功');
resetControlState(); //
emits('upload-success');
} catch (error) {
message.info('提交交付物信息失败');
submitBtnLoading.value = false; // loading
throw new Error(error);
}
}

18
src/plugins/p-deliver/p-deliver.vue

@ -3,18 +3,23 @@
<div>
<p-deliver-upload v-if="deliver" @upload-success="getDeliverData"></p-deliver-upload>
<p-deliver-check class="mt-3" v-if="deliver && deliver.details && deliver.details.length"></p-deliver-check>
<p-deliver-check
class="mt-3"
v-if="deliver && deliver.details && deliver.details.length"
@check-success="getDeliverData"
></p-deliver-check>
</div>
</template>
<script setup>
// import { useStore } from 'vuex';
import { useStore } from 'vuex';
import { ref, inject, provide } from 'vue';
import { getDeliverByTaskId } from 'apis';
import { message } from 'ant-design-vue';
import pDeliverUpload from '@/plugins/p-deliver/p-deliver-upload.vue';
import pDeliverCheck from '@/plugins/p-deliver/p-deliver-check.vue';
// const store = useStore();
const store = useStore();
const task = inject('task');
const pluginInfo = inject('pluginInfo');
const deliver = ref(null); //
@ -25,13 +30,14 @@ provide('deliver', deliver);
// id
async function getDeliverData() {
try {
const { url } = store.state.projects.project;
const { id: taskId } = task;
if (!taskId) return;
const param = { taskId };
const data = await getDeliverByTaskId(param);
const param = { param: { taskId } };
const data = await getDeliverByTaskId(param, url);
deliver.value = data;
} catch (error) {
console.log('error: ', error);
message.info(error);
}
}
</script>

Loading…
Cancel
Save