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. 121
      components/PrettyExchange/PrettyExchange.vue
  5. 16
      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
@ -152,6 +152,7 @@
- | 向上查向下查 | [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)
- | 消息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)
- | 小红点修复 | [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)

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.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 });
}

2
apis/wbs.js

@ -7,7 +7,7 @@ const domain = computed(() => store.state.domain);
export function setupWbs(app) {
uni.$u.api = { ...uni.$u.api } || {};
// 导入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);
}

121
components/PrettyExchange/PrettyExchange.vue

@ -26,7 +26,7 @@
class="cu-item flex-col"
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 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">
@ -164,11 +164,11 @@ const data = reactive({
clickProject: {},
projectId: 0,
// menuList: [{ text: '' }, { text: '' }, { text: '' }, { text: '' }, { text: '' }],
menuList: [{ text: '导出' }, { text: '删除' }],
menuList: [{ text: '导入' }, { text: '导出' }, { text: '删除' }, { text: '排序' }],
// show: false,
// border: 'border border-blue-500 shadow rounded-md',
showBorder: false, //
// showBorder: false, //
showItemIndex: undefined,
});
@ -179,9 +179,9 @@ watchEffect(() => {
if (projects.value) {
data.itemList = projects.value;
data.itemList.forEach(item => {
item.showBorder = false; //
item.showSubBorder = false; //
item.showTopBorder = false; //
item.showBorder = false; //
item.showSubBorder = false; //
item.showTopBorder = false; //
item.remindNum = 0;
if (remindData.value) {
@ -245,7 +245,8 @@ function chooseAction(e) {
const obj = {
index: e,
projectId: data.projectId,
url: data.clickProject.url,
url: data.clickProject.url,
projectName: data.tips.text
};
// emit('chooseAction', data);
actionFun(obj);
@ -262,6 +263,12 @@ function actionFun(obj) {
if (action === '删除') {
data.changeEvent = false;
delProject(obj.projectId, obj.url);
}
if (action === '导入') {
data.changeEvent = false;
store.commit('setDomain', obj.url);
importProject(obj.projectId, obj.projectName);
}
if (action === '导出') {
@ -391,10 +398,10 @@ function move(e, length) {
}
function stops(e, index, length) {
console.log('结束');
console.log('结束', e, index, length);
const touch = e.changedTouches[0];
const lastIndex = findOverIndex(touch.pageY, length);
console.log('11111111111', data.itemList)
//
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];
data.itemList.unshift(Value);
data.itemList[arr[0] - 0].sonProjectList.splice([arr[1] - 0], 1);
const options = {
id: Value.id,
parentId: 0,
// const options = {
// id: Value.id,
// parentId: 0,
// };
const options = {
businessCode: Value.businessCode,
moveProjectId: Value.id,
targetProjectId: '',
};
emit('change', options);
}
@ -434,9 +446,14 @@ function stops(e, index, length) {
const Value = data.itemList[arr[0] - 0].sonProjectList[arr[1] - 0];
data.itemList.splice(i + 1, 0, Value);
data.itemList[arr[0] - 0].sonProjectList.splice([arr[1] - 0], 1);
const options = {
id: Value.id,
parentId: 0,
// const options = {
// id: Value.id,
// parentId: 0,
// };
const options = {
businessCode: Value.businessCode,
moveProjectId: Value.id,
targetProjectId: '',
};
emit('change', options);
}
@ -457,9 +474,14 @@ function stops(e, index, length) {
data.itemList.splice(index, 1);
//
clearSet(i);
const options = {
id: Value.id,
parentId: data.itemList[lastIndex - 1].id,
// const options = {
// id: Value.id,
// parentId: data.itemList[lastIndex - 1].id,
// };
const options = {
businessCode: Value.businessCode,
moveProjectId: Value.id,
targetProjectId: data.itemList[lastIndex - 1].id,
};
emit('change', options);
} else {
@ -473,15 +495,25 @@ function stops(e, index, length) {
data.itemList[arr[0] - 0].sonProjectList.splice([arr[1] - 0], 1);
//
clearSet(i);
const options = {
id: Value.id,
parentId: data.itemList[lastIndex].id,
// const options = {
// id: Value.id,
// parentId: data.itemList[lastIndex].id,
// };
const options = {
businessCode: Value.businessCode,
moveProjectId: Value.id,
targetProjectId: data.itemList[lastIndex].id,
};
emit('change', options);
const options1 = {
id: Value.id,
parentId: 0,
// const options1 = {
// id: Value.id,
// parentId: 0,
// };
const options1 = {
businessCode: Value.businessCode,
moveProjectId: Value.id,
targetProjectId: '',
};
emit('change', options1);
}
@ -546,8 +578,39 @@ 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) {
uni.showModal({
title: '',
@ -590,9 +653,9 @@ function exportProject(id, url) {
}
//
function toWorkbench() {
uni.navigateTo({ url: '/pages/workbench/workbench' });
}
// function toWorkbench() {
// uni.navigateTo({ url: '/pages/workbench/workbench' });
// }
</script>
<style lang="scss" scoped>

16
components/Projects/Projects.vue

@ -6,16 +6,16 @@
<script setup>
const emit = defineEmits(['getProjects']);
function change(options) {
if (options instanceof Array) {
let projectIdList = [];
let arr = [];
options.forEach(item => {
projectIdList.push(item.id);
arr.push(item.name);
});
setProjectSort(projectIdList);
// let projectIdList = [];
// let arr = [];
// options.forEach(item => {
// projectIdList.push(item.id);
// arr.push(item.name);
// });
// setProjectSort(projectIdList);
} else {
setProjectRelation(options);
}

2
components/Upload/Upload.vue

@ -43,7 +43,7 @@
success: async ({ confirm }) => {
if (confirm) {
try {
const res = await uni.$u.api.import();
const res = await uni.$u.api.import('');
// WBS
//
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);
const nextPage = params.queryType === 0 ? upNextPage.value : downNextPage.value; // 下一页的值
// 双击小红点
if (currLocationTaskId.value) {
lastTime = centerData.length ? centerData[0].planStart : new Date().getTime();
}
if (centerData.length) {
let arr = [];

2
pages/business/business.vue

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

2
pages/index/index.vue

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

43
pages/project/project.vue

@ -177,6 +177,17 @@ watch(roleId, () => {
) return;
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 => {
if (newValue && roleId.value) {
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(); //
getPermanent(); //
@ -332,6 +321,16 @@ function tabsChange(e) {
const { id } = visibleRoles.value[e.detail.current];
store.commit('role/setRoleIndex', e.detail.current);
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 words = computed(() => quickWords[props.data.mode]); //
const projectId = computed(() => store.getters['project/projectId']);
const roleId = computed(() => store.state.role.roleId);
const task = inject('task');
const commit = ref(''); //
const score = ref(100); //
@ -59,6 +60,7 @@ async function handleSubmit(mode) {
const deliverRecordId = props.data.deliverRecordId();
const param = {
projectId: projectId.value,
roleId: roleId.value,
deliverRecordId,
type: mode === 'RESOLVE' ? 1 : 2,
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 projectId = computed(() => store.getters['project/projectId']);
const roleId = computed(() => store.state.role.roleId);
//
function validateDeliverForm(checkedCheckers) {
@ -132,6 +133,7 @@ async function submit() {
const param = {
projectId: projectId.value,
roleId: roleId.value,
deliverId: deliver.value.deliverId,
fileList: [linkValue.value],
checkerList,

23
store/project/mutations.js

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

Loading…
Cancel
Save