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 : ''); store.commit('task/setBusinessCode', info && info.businessCode ? info.businessCode : '');
} }
if (projectInfo.value.id) {
getMemberList();
}
watch(projectInfo, () => { watch(projectInfo, () => {
if (projectInfo.value.id) { if (projectInfo.value.id) {
const projectId = projectInfo.value.id; getMemberList();
const { url } = projectInfo.value;
const param = { projectId };
store.dispatch('role/getAllMembers', { param, url });
} }
}); });
@ -56,6 +57,14 @@ setInterval(() => {
getPlugins(); getPlugins();
}, 60000); }, 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> </template>
<script setup> <script setup>
import { ref, computed } from 'vue'; import { ref, computed, defineExpose } from 'vue';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
import { DownOutlined, UpOutlined } from '@ant-design/icons-vue'; import { DownOutlined, UpOutlined } from '@ant-design/icons-vue';
@ -43,6 +43,8 @@ const checkedCheckers = ref([]);
// 3... // 3...
const showCheckers = computed(() => (checkedCheckers.value.length > 3 ? checkedCheckers.value.slice(0, 3) : checkedCheckers.value)); const showCheckers = computed(() => (checkedCheckers.value.length > 3 ? checkedCheckers.value.slice(0, 3) : checkedCheckers.value));
defineExpose({ checkedCheckers, collapsed });
/** /**
* 点击成员 切换检查人的选中状态 * 点击成员 切换检查人的选中状态
* @param {object} member 成员对象 * @param {object} member 成员对象

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

@ -1,42 +1,44 @@
<template> <template>
<div id="tasks" class="task-list"> <div id="tasks" class="task-list">
<div class="task-box" v-for="(item, index) in tasks" :key="index"> <div class="-mt-3">
<div class="task-time flex items-center justify-between"> <div class="task-box" :class="{ 'pt-3': index === 0 }" v-for="(item, index) in tasks" :key="index">
<div class="flex items-center"> <div class="task-time flex items-center justify-between">
<PlayCircleOutlined style="font-size: 23px; color: #999999" /> <div class="flex items-center">
<span v-if="item.process === 4">{{ dayjs(+item.planStart).format('M月D日') }}</span> <PlayCircleOutlined style="font-size: 23px; color: #999999" />
<span v-else>{{ dayjs(+item.planStart).format('M月D日 HH:mm') }}</span> <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>
<div class="task-action"></div>
</div>
<div class="task-info"> <div class="task-info">
<div> <div>
<div class="task-card-null" v-if="item.process === 4"></div> <div class="task-card-null" v-if="item.process === 4"></div>
<div class="task-card" v-else> <div class="task-card" v-else>
<div class="task-name cursor-pointer"> <div class="task-name cursor-pointer">
<template v-if="item.plugins && item.plugins.length"> <template v-if="item.plugins && item.plugins.length">
<div v-for="(pluginArr, i) in item.plugins" :key="i"> <div v-for="(pluginArr, i) in item.plugins" :key="i">
<div :class="{ 'pt-3': i > 0 }" v-if="pluginArr.length"> <div :class="{ 'pt-3': i > 0 }" v-if="pluginArr.length">
<Plugin <Plugin
class="task-card-plugin" class="task-card-plugin"
v-for="plugin in pluginArr" v-for="plugin in pluginArr"
:key="plugin.pluginTaskId" :key="plugin.pluginTaskId"
:plugin-id="plugin.pluginId" :plugin-id="plugin.pluginId"
:plugin-task-id="plugin.pluginTaskId" :plugin-task-id="plugin.pluginTaskId"
:business-plugin-id="plugin.businessPluginId" :business-plugin-id="plugin.businessPluginId"
:plugin-info="plugin" :plugin-info="plugin"
:param="plugin.param" :param="plugin.param"
:style-type="plugin.styleType || 0" :style-type="plugin.styleType || 0"
:task="item" :task="item"
/> />
</div>
</div> </div>
</div> </template>
</template>
<div v-else class=""> <div v-else class="">
<Plugin class="task-card-plugin" plugin-id="1" :task="item" /> <Plugin class="task-card-plugin" plugin-id="1" :task="item" />
</div>
</div> </div>
</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 store = useStore();
const task = inject('task'); const task = inject('task');
const projectId = computed(() => store.getters['project/projectId']); const projectId = computed(() => store.getters['project/projectId']);
const sessionProjectId = sessionStorage.getItem('projectId');
const roleId = computed(() => store.state.role.roleId); const roleId = computed(() => store.state.role.roleId);
const words = computed(() => quickWords[props.data.mode]); // const words = computed(() => quickWords[props.data.mode]); //
@ -70,13 +71,15 @@ async function handleSubmit(mode) {
const { url } = store.state.projects.project; const { url } = store.state.projects.project;
const deliverRecordId = props.data.deliverRecordId(); const deliverRecordId = props.data.deliverRecordId();
const param = { const param = {
projectId: projectId.value, param: {
roleId: roleId.value, projectId: projectId.value || sessionProjectId,
deliverRecordId, roleId: roleId.value,
type: mode === 'RESOLVE' ? 1 : 2, deliverRecordId,
remark: commit.value, type: mode === 'RESOLVE' ? 1 : 2,
score: mode === 'RESOLVE' ? score.value : '', remark: commit.value,
msgId: task.msgId, score: mode === 'RESOLVE' ? score.value : '',
msgId: task.msgId,
},
}; };
await checkDeliver(param, url); 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-if="item.status === 1" class="text-green-600"> 已通过 </span>
<span v-else-if="item.status === 2" class="text-red-600"> 已驳回 </span> <span v-else-if="item.status === 2" class="text-red-600"> 已驳回 </span>
</div> </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> </div>
</div> </div>
@ -102,3 +112,10 @@ const checkModal = reactive({
// //
function openMoreRecords() {} function openMoreRecords() {}
</script> </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> --> <!-- <a-button type="primary" size="small" class="mr-3" @click="paste">粘贴</a-button> -->
<div class="inline-block"> <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-button type="primary" size="small" class="mr-3">文件</a-button>
</a-upload> </a-upload>
</div> </div>
@ -44,6 +44,7 @@ import Reviewer from '@/components/tall/Reviewer/Reviewer.vue';
const store = useStore(); const store = useStore();
const projectId = computed(() => store.getters['project/projectId']); const projectId = computed(() => store.getters['project/projectId']);
const sessionProjectId = sessionStorage.getItem('projectId');
const roleId = computed(() => store.state.role.roleId); const roleId = computed(() => store.state.role.roleId);
const deliver = inject('deliver'); // const deliver = inject('deliver'); //
@ -71,6 +72,7 @@ function handleChange(info) {
// //
async function submit() { async function submit() {
console.log(reviewerRef.value);
const { checkedCheckers } = reviewerRef.value; // const { checkedCheckers } = reviewerRef.value; //
// //
if (!validateDeliverForm(checkedCheckers)) return; if (!validateDeliverForm(checkedCheckers)) return;
@ -85,21 +87,24 @@ async function submit() {
const { url } = store.state.projects.project; const { url } = store.state.projects.project;
const param = { const params = {
projectId: projectId.value, param: {
roleId: roleId.value, projectId: projectId.value || sessionProjectId,
deliverId: deliver.value.deliverId, roleId: roleId.value,
fileList: [linkValue.value], deliverId: deliver.value.deliverId,
checkerList, fileList: [linkValue.value],
msgId: task.msgId, checkerList,
msgId: task.msgId,
},
}; };
const data = await submitDeliverInfo(param, url); const data = await submitDeliverInfo(params, url);
message.info('提交交付物信息成功'); message.info('提交交付物信息成功');
resetControlState(); // resetControlState(); //
emits('upload-success'); emits('upload-success');
} catch (error) { } catch (error) {
message.info('提交交付物信息失败'); message.info('提交交付物信息失败');
submitBtnLoading.value = false; // loading
throw new Error(error); throw new Error(error);
} }
} }

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

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

Loading…
Cancel
Save