Browse Source

feat: 导入子项目、交付物增加角色id、时间轴

test2
xuesinan 4 years ago
parent
commit
586a3f0bea
  1. 3
      CHANGELOG.md
  2. 3
      apis/tall.js
  3. 2
      apis/wbs.js
  4. 107
      components/PrettyExchange/PrettyExchange.vue
  5. 14
      components/Projects/Projects.vue
  6. 2
      components/Upload/Upload.vue
  7. 5
      hooks/project/useGetTasks.js
  8. 2
      pages/business/business.vue
  9. 2
      pages/index/index.vue
  10. 43
      pages/project/project.vue
  11. 2
      plugins/p-deliver-check/check-form-modal.vue
  12. 2
      plugins/p-deliver-upload/p-deliver-upload.vue
  13. 23
      store/project/mutations.js

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 1.0.0 (2022-03-24) # 1.0.0 (2022-03-30)
### 🌟 新功能 ### 🌟 新功能
范围|描述|commitId 范围|描述|commitId
@ -152,6 +152,7 @@
- | 向上查向下查 | [1933e1b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1933e1b) - | 向上查向下查 | [1933e1b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1933e1b)
- | 项目列表排序 | [ad0ce75](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/ad0ce75) - | 项目列表排序 | [ad0ce75](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/ad0ce75)
- | 消息id | [f79918b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/f79918b) - | 消息id | [f79918b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/f79918b)
- | 小红点、上传项目刷新项目列表 | [02d933e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/02d933e)
- | 小红点监听 | [f0f158d](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/f0f158d) - | 小红点监听 | [f0f158d](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/f0f158d)
- | 小红点修复 | [ef33187](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/ef33187) - | 小红点修复 | [ef33187](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/ef33187)
- | 修复一些内容 | [3cdb1ce](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/3cdb1ce) - | 修复一些内容 | [3cdb1ce](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/3cdb1ce)

3
apis/tall.js

@ -37,7 +37,8 @@ export function setupTall(app) {
// 设置项目顺序 // 设置项目顺序
uni.$u.api.setProjectSort = params => uni.$u.post(`${tall}/project/setProjectSort`, params); uni.$u.api.setProjectSort = params => uni.$u.post(`${tall}/project/setProjectSort`, params);
// 设置项目父子结构 // 设置项目父子结构
uni.$u.api.setProjectRelation = params => uni.$u.post(`${tall}/project/setProjectRelation`, params); // uni.$u.api.setProjectRelation = params => uni.$u.post(`${tall}/project/setProjectRelation`, params);
uni.$u.api.setProjectRelation = params => uni.$u.post(`${tall}/project/drag`, params);
// 删除某个项目 // 删除某个项目
uni.$u.api.delProject = (projectId, url) => uni.$u.post(`${url}/tall/project/delete`, { projectId }); uni.$u.api.delProject = (projectId, url) => uni.$u.post(`${url}/tall/project/delete`, { projectId });
} }

2
apis/wbs.js

@ -7,7 +7,7 @@ const domain = computed(() => store.state.domain);
export function setupWbs(app) { export function setupWbs(app) {
uni.$u.api = { ...uni.$u.api } || {}; uni.$u.api = { ...uni.$u.api } || {};
// 导入wbs // 导入wbs
uni.$u.api.import = formData => uni.$upload.chooseAndUpload(`${domain.value}/tall/project/wbs`, formData); uni.$u.api.import = (parentId, formData) => uni.$upload.chooseAndUpload(`${domain.value}/tall/project/wbs?parentId=${parentId}`, formData);
// 导入时查找域内的业务列表 // 导入时查找域内的业务列表
uni.$u.api.getBusinessList = params => uni.$u.http.post(`${Config.apiUrl}/ptostall/business/import/query`, params); uni.$u.api.getBusinessList = params => uni.$u.http.post(`${Config.apiUrl}/ptostall/business/import/query`, params);
} }

107
components/PrettyExchange/PrettyExchange.vue

@ -26,7 +26,7 @@
class="cu-item flex-col" class="cu-item flex-col"
v-for="(item, index) in data.itemList" v-for="(item, index) in data.itemList"
> >
<view class="border-100 bg-blue-500" v-if="item.showTopBorder"></view> <!-- <view class="border-100 bg-blue-500" v-if="item.showTopBorder"></view> -->
<!-- 内容区 --> <!-- 内容区 -->
<!-- 父项目 --> <!-- 父项目 -->
@ -48,7 +48,7 @@
</view> </view>
</view> </view>
<view class="workbench-btn" v-if="index === 0" @click="toWorkbench">工作台</view> <!-- <view class="workbench-btn" v-if="index === 0" @click="toWorkbench">工作台</view> -->
<!-- 箭头 --> <!-- 箭头 -->
<view v-if="item.sonProjectList && item.sonProjectList.length"> <view v-if="item.sonProjectList && item.sonProjectList.length">
@ -164,11 +164,11 @@ const data = reactive({
clickProject: {}, clickProject: {},
projectId: 0, projectId: 0,
// menuList: [{ text: '' }, { text: '' }, { text: '' }, { text: '' }, { text: '' }], // menuList: [{ text: '' }, { text: '' }, { text: '' }, { text: '' }, { text: '' }],
menuList: [{ text: '导出' }, { text: '删除' }], menuList: [{ text: '导入' }, { text: '导出' }, { text: '删除' }, { text: '排序' }],
// show: false, // show: false,
// border: 'border border-blue-500 shadow rounded-md', // border: 'border border-blue-500 shadow rounded-md',
showBorder: false, // // showBorder: false, //
showItemIndex: undefined, showItemIndex: undefined,
}); });
@ -179,9 +179,9 @@ watchEffect(() => {
if (projects.value) { if (projects.value) {
data.itemList = projects.value; data.itemList = projects.value;
data.itemList.forEach(item => { data.itemList.forEach(item => {
item.showBorder = false; // item.showBorder = false; //
item.showSubBorder = false; // item.showSubBorder = false; //
item.showTopBorder = false; // item.showTopBorder = false; //
item.remindNum = 0; item.remindNum = 0;
if (remindData.value) { if (remindData.value) {
@ -246,6 +246,7 @@ function chooseAction(e) {
index: e, index: e,
projectId: data.projectId, projectId: data.projectId,
url: data.clickProject.url, url: data.clickProject.url,
projectName: data.tips.text
}; };
// emit('chooseAction', data); // emit('chooseAction', data);
actionFun(obj); actionFun(obj);
@ -264,6 +265,12 @@ function actionFun(obj) {
delProject(obj.projectId, obj.url); delProject(obj.projectId, obj.url);
} }
if (action === '导入') {
data.changeEvent = false;
store.commit('setDomain', obj.url);
importProject(obj.projectId, obj.projectName);
}
if (action === '导出') { if (action === '导出') {
data.changeEvent = false; data.changeEvent = false;
exportProject(obj.projectId, obj.url); exportProject(obj.projectId, obj.url);
@ -391,10 +398,10 @@ function move(e, length) {
} }
function stops(e, index, length) { function stops(e, index, length) {
console.log('结束'); console.log('结束', e, index, length);
const touch = e.changedTouches[0]; const touch = e.changedTouches[0];
const lastIndex = findOverIndex(touch.pageY, length); const lastIndex = findOverIndex(touch.pageY, length);
console.log('11111111111', data.itemList)
// //
for (let i = 0; i < data.itemList.length; i++) { for (let i = 0; i < data.itemList.length; i++) {
// //
@ -408,9 +415,14 @@ function stops(e, index, length) {
const Value = data.itemList[arr[0] - 0].sonProjectList[arr[1] - 0]; const Value = data.itemList[arr[0] - 0].sonProjectList[arr[1] - 0];
data.itemList.unshift(Value); data.itemList.unshift(Value);
data.itemList[arr[0] - 0].sonProjectList.splice([arr[1] - 0], 1); data.itemList[arr[0] - 0].sonProjectList.splice([arr[1] - 0], 1);
// const options = {
// id: Value.id,
// parentId: 0,
// };
const options = { const options = {
id: Value.id, businessCode: Value.businessCode,
parentId: 0, moveProjectId: Value.id,
targetProjectId: '',
}; };
emit('change', options); emit('change', options);
} }
@ -434,9 +446,14 @@ function stops(e, index, length) {
const Value = data.itemList[arr[0] - 0].sonProjectList[arr[1] - 0]; const Value = data.itemList[arr[0] - 0].sonProjectList[arr[1] - 0];
data.itemList.splice(i + 1, 0, Value); data.itemList.splice(i + 1, 0, Value);
data.itemList[arr[0] - 0].sonProjectList.splice([arr[1] - 0], 1); data.itemList[arr[0] - 0].sonProjectList.splice([arr[1] - 0], 1);
// const options = {
// id: Value.id,
// parentId: 0,
// };
const options = { const options = {
id: Value.id, businessCode: Value.businessCode,
parentId: 0, moveProjectId: Value.id,
targetProjectId: '',
}; };
emit('change', options); emit('change', options);
} }
@ -457,9 +474,14 @@ function stops(e, index, length) {
data.itemList.splice(index, 1); data.itemList.splice(index, 1);
// //
clearSet(i); clearSet(i);
// const options = {
// id: Value.id,
// parentId: data.itemList[lastIndex - 1].id,
// };
const options = { const options = {
id: Value.id, businessCode: Value.businessCode,
parentId: data.itemList[lastIndex - 1].id, moveProjectId: Value.id,
targetProjectId: data.itemList[lastIndex - 1].id,
}; };
emit('change', options); emit('change', options);
} else { } else {
@ -473,15 +495,25 @@ function stops(e, index, length) {
data.itemList[arr[0] - 0].sonProjectList.splice([arr[1] - 0], 1); data.itemList[arr[0] - 0].sonProjectList.splice([arr[1] - 0], 1);
// //
clearSet(i); clearSet(i);
// const options = {
// id: Value.id,
// parentId: data.itemList[lastIndex].id,
// };
const options = { const options = {
id: Value.id, businessCode: Value.businessCode,
parentId: data.itemList[lastIndex].id, moveProjectId: Value.id,
targetProjectId: data.itemList[lastIndex].id,
}; };
emit('change', options); emit('change', options);
// const options1 = {
// id: Value.id,
// parentId: 0,
// };
const options1 = { const options1 = {
id: Value.id, businessCode: Value.businessCode,
parentId: 0, moveProjectId: Value.id,
targetProjectId: '',
}; };
emit('change', options1); emit('change', options1);
} }
@ -548,6 +580,37 @@ function delProject(id, url) {
}); });
} }
//
function importProject(id, name) {
uni.showModal({
content: '是否导入到' + name,
showCancel: true,
success: async ({ confirm }) => {
if (confirm) {
try {
const res = await uni.$u.api.import(id);
// WBS
//
emit('success');
// const { apiUrl } = Config;
// let defaultwbs = `${apiUrl}/defaultwbs`;
// res.url && (defaultwbs = res.url);
store.commit('project/setIsRefresh', 1);
setTimeout(() => {
uni.navigateTo({ url: `/pages/project/project?u=${user.value.id}&p=${res.id}&pname=${res.name}&url=${encodeURIComponent(res.url)}` });
}, 2000);
} catch (error) {
console.error('error: ', error);
emit('error', error);
}
}
},
});
}
//
function exportProject(id, url) { function exportProject(id, url) {
uni.showModal({ uni.showModal({
title: '', title: '',
@ -590,9 +653,9 @@ function exportProject(id, url) {
} }
// //
function toWorkbench() { // function toWorkbench() {
uni.navigateTo({ url: '/pages/workbench/workbench' }); // uni.navigateTo({ url: '/pages/workbench/workbench' });
} // }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

14
components/Projects/Projects.vue

@ -9,13 +9,13 @@
function change(options) { function change(options) {
if (options instanceof Array) { if (options instanceof Array) {
let projectIdList = []; // let projectIdList = [];
let arr = []; // let arr = [];
options.forEach(item => { // options.forEach(item => {
projectIdList.push(item.id); // projectIdList.push(item.id);
arr.push(item.name); // arr.push(item.name);
}); // });
setProjectSort(projectIdList); // setProjectSort(projectIdList);
} else { } else {
setProjectRelation(options); setProjectRelation(options);
} }

2
components/Upload/Upload.vue

@ -43,7 +43,7 @@
success: async ({ confirm }) => { success: async ({ confirm }) => {
if (confirm) { if (confirm) {
try { try {
const res = await uni.$u.api.import(); const res = await uni.$u.api.import('');
// WBS // WBS
// //
emit('success'); emit('success');

5
hooks/project/useGetTasks.js

@ -165,6 +165,11 @@ export default function useGetTasks() {
let downTargetTime = dayjs(+lastTime).add(params.pageSize - 1, timeGranularity.value); let downTargetTime = dayjs(+lastTime).add(params.pageSize - 1, timeGranularity.value);
const nextPage = params.queryType === 0 ? upNextPage.value : downNextPage.value; // 下一页的值 const nextPage = params.queryType === 0 ? upNextPage.value : downNextPage.value; // 下一页的值
// 双击小红点
if (currLocationTaskId.value) {
lastTime = centerData.length ? centerData[0].planStart : new Date().getTime();
}
if (centerData.length) { if (centerData.length) {
let arr = []; let arr = [];

2
pages/business/business.vue

@ -51,7 +51,7 @@ async function toUpload(url) {
store.commit('setDomain', url); store.commit('setDomain', url);
try { try {
const res = await uni.$u.api.import(); const res = await uni.$u.api.import('');
// WBS // WBS
// //
uni.$ui.showToast('导入成功,即将打开新项目', 3000); uni.$ui.showToast('导入成功,即将打开新项目', 3000);

2
pages/index/index.vue

@ -95,7 +95,7 @@
} else { } else {
let arr = []; let arr = [];
data.forEach(item => { data.forEach(item => {
item.show = false; item.show = true;
const index = arr.findIndex(v => v.businessCode === item.businessCode); const index = arr.findIndex(v => v.businessCode === item.businessCode);
if (index === -1) { if (index === -1) {

43
pages/project/project.vue

@ -177,6 +177,17 @@ watch(roleId, () => {
) return; ) return;
store.commit('task/setTimeNode', Date.now()); store.commit('task/setTimeNode', Date.now());
let currRoleRealTasks = [];
let currRoleShowTasks = [];
if (allTasks.value.length) {
const index = visibleRoles.value.findIndex(role => role.id === roleId.value);
currRoleRealTasks = allTasks.value[index].realTasks || [];
currRoleShowTasks = allTasks.value[index].task || [];
}
store.commit('socket/setCurrLocationTaskId', '');
store.commit('task/setCurrRoleRealTasks', currRoleRealTasks); //
store.commit('task/setCurrRoleShowTasks', currRoleShowTasks); //
} }
}); });
@ -188,28 +199,6 @@ watch(roleId, () => {
watch(timeNode, newValue => { watch(timeNode, newValue => {
if (newValue && roleId.value) { if (newValue && roleId.value) {
clearTasksData(); clearTasksData();
let currRoleRealTasks = [];
let currRoleShowTasks = [];
const index = visibleRoles.value.findIndex(role => role.id === roleId.value);
const arr = [...allTasks.value];
let upNextPage = 1;
let downNextPage = 1;
if (arr.length && index > -1) {
currRoleRealTasks = arr[index].realTasks || [];
currRoleShowTasks = arr[index].task || [];
upNextPage = arr[index].upNextPage || 1;
downNextPage = arr[index].downNextPage || 1;
}
store.commit('task/updateTasks', currRoleShowTasks); // store
store.commit('task/updateRealTasks', currRoleRealTasks); // store
store.commit('task/setCurrRoleRealTasks', currRoleRealTasks); //
store.commit('task/setCurrRoleShowTasks', currRoleShowTasks); //
store.commit('task/setUpNextPage', upNextPage); //
store.commit('task/setDownNextPage', downNextPage); //
store.commit('socket/setCurrLocationTaskId', targetTaskId.value || '');
// //
getGlobalData(); // getGlobalData(); //
getPermanent(); // getPermanent(); //
@ -332,6 +321,16 @@ function tabsChange(e) {
const { id } = visibleRoles.value[e.detail.current]; const { id } = visibleRoles.value[e.detail.current];
store.commit('role/setRoleIndex', e.detail.current); store.commit('role/setRoleIndex', e.detail.current);
store.commit('role/setRoleId', id); store.commit('role/setRoleId', id);
const index = visibleRoles.value.findIndex(role => role.id === id);
const arr = [...allTasks.value];
store.commit('task/updateTasks', arr[index].task || []); // store
store.commit('task/updateRealTasks', arr[index].realTasks || []); // store
store.commit('task/setCurrRoleRealTasks', arr[index].realTasks || []); //
store.commit('task/setCurrRoleShowTasks', arr[index].task || []); //
store.commit('task/setUpNextPage', arr[index].upNextPage || 1); //
store.commit('task/setDownNextPage', arr[index].downNextPage || 1); //
store.commit('socket/setCurrLocationTaskId', '');
} }
// //

2
plugins/p-deliver-check/check-form-modal.vue

@ -44,6 +44,7 @@ const emits = defineEmits(['hide', 'submit-end']);
const store = useStore(); const store = useStore();
const words = computed(() => quickWords[props.data.mode]); // const words = computed(() => quickWords[props.data.mode]); //
const projectId = computed(() => store.getters['project/projectId']); const projectId = computed(() => store.getters['project/projectId']);
const roleId = computed(() => store.state.role.roleId);
const task = inject('task'); const task = inject('task');
const commit = ref(''); // const commit = ref(''); //
const score = ref(100); // const score = ref(100); //
@ -59,6 +60,7 @@ async function handleSubmit(mode) {
const deliverRecordId = props.data.deliverRecordId(); const deliverRecordId = props.data.deliverRecordId();
const param = { const param = {
projectId: projectId.value, projectId: projectId.value,
roleId: roleId.value,
deliverRecordId, deliverRecordId,
type: mode === 'RESOLVE' ? 1 : 2, type: mode === 'RESOLVE' ? 1 : 2,
remark: commit.value, remark: commit.value,

2
plugins/p-deliver-upload/p-deliver-upload.vue

@ -99,6 +99,7 @@ const showBadge = ref(false); // u-badge的显示与隐藏
// //
const submitState = computed(() => !linkValue.value); const submitState = computed(() => !linkValue.value);
const projectId = computed(() => store.getters['project/projectId']); const projectId = computed(() => store.getters['project/projectId']);
const roleId = computed(() => store.state.role.roleId);
// //
function validateDeliverForm(checkedCheckers) { function validateDeliverForm(checkedCheckers) {
@ -132,6 +133,7 @@ async function submit() {
const param = { const param = {
projectId: projectId.value, projectId: projectId.value,
roleId: roleId.value,
deliverId: deliver.value.deliverId, deliverId: deliver.value.deliverId,
fileList: [linkValue.value], fileList: [linkValue.value],
checkerList, checkerList,

23
store/project/mutations.js

@ -18,17 +18,18 @@ const mutations = {
* @param { object } options options:{ index,show } * @param { object } options options:{ index,show }
*/ */
setProjectItemShow(state, options) { setProjectItemShow(state, options) {
if (options.show) { state.projects[options.index].show = options.show;
for (var i = 0; i < state.projects.length; i++) { // if (options.show) {
if (i === options.index) { // for (var i = 0; i < state.projects.length; i++) {
state.projects[i].show = true; // if (i === options.index) {
} else { // state.projects[i].show = true;
state.projects[i].show = false; // } else {
} // state.projects[i].show = false;
} // }
} else { // }
state.projects[options.index].show = false; // } else {
} // state.projects[options.index].show = false;
// }
}, },
/** /**

Loading…
Cancel
Save