Browse Source

fix: 时间轴小红点、导出

test2
xuesinan 4 years ago
parent
commit
5ed569182a
  1. 1
      CHANGELOG.md
  2. 828
      components/PrettyExchange/PrettyExchange.vue
  3. 40
      components/Projects/ProjectItem.vue
  4. 61
      components/Roles/Roles.vue
  5. 60
      pages/project/project.vue
  6. 3
      plugins/p-deliver-check/check-form-modal.vue

1
CHANGELOG.md

@ -118,6 +118,7 @@
交付物 | 重构交付物审核部分,修复审核bug | [5fd8889](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/5fd8889) 交付物 | 重构交付物审核部分,修复审核bug | [5fd8889](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/5fd8889)
- | 解决默认角色不是第一个时显示出错问题 | [8dba578](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8dba578) - | 解决默认角色不是第一个时显示出错问题 | [8dba578](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8dba578)
- | 解决warning | [dcb0079](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/dcb0079) - | 解决warning | [dcb0079](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/dcb0079)
- | 没有新消息双击按照上一个角色的任务id跳转的问题 | [eade2dd](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/eade2dd)
- | 拍照上传交付物 | [1cbb2ac](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1cbb2ac) - | 拍照上传交付物 | [1cbb2ac](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1cbb2ac)
- | 切换项目存储的任务id未清空 | [77fe17f](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/77fe17f) - | 切换项目存储的任务id未清空 | [77fe17f](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/77fe17f)
- | 切换项目任务清空 | [1dd3b4b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1dd3b4b) - | 切换项目任务清空 | [1dd3b4b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1dd3b4b)

828
components/PrettyExchange/PrettyExchange.vue

@ -13,7 +13,7 @@
/> />
</view> </view>
</view> </view>
<!-- 点击排序之后的效果 --> <!-- 点击排序之后的效果 -->
<view v-else> <view v-else>
<view <view
@ -26,7 +26,6 @@
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>
<!-- 内容区 --> <!-- 内容区 -->
@ -47,14 +46,26 @@
<view class="pl-2">{{ dayjs(+item.endTime).format('MM-DD HH:mm') }}</view> <view class="pl-2">{{ dayjs(+item.endTime).format('MM-DD HH:mm') }}</view>
</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">
<u-icon @click="openSubProject(item.sonProjectList.length, index)" class="text-gray-400" name="arrow-up" size="14px" v-if="item.show"></u-icon> <u-icon
<u-icon @click="openSubProject(item.sonProjectList.length, index)" class="text-gray-400" name="arrow-down" size="14px" v-else></u-icon> @click="openSubProject(item.sonProjectList.length, index)"
class="text-gray-400"
name="arrow-up"
size="14px"
v-if="item.show"
></u-icon>
<u-icon
@click="openSubProject(item.sonProjectList.length, index)"
class="text-gray-400"
name="arrow-down"
size="14px"
v-else
></u-icon>
</view> </view>
<u-icon class="text-gray-400" name="arrow-right" size="14px" v-else></u-icon> <u-icon class="text-gray-400" name="arrow-right" size="14px" v-else></u-icon>
</view> </view>
@ -67,10 +78,10 @@
:key="subIndex" :key="subIndex"
@touchend.stop.prevent="stops($event, index + '-' + subIndex, item.sonProjectList.length)" @touchend.stop.prevent="stops($event, index + '-' + subIndex, item.sonProjectList.length)"
@touchmove.stop.prevent="move($event, item.sonProjectList.length)" @touchmove.stop.prevent="move($event, item.sonProjectList.length)"
@touchstart.stop.prevent="start($event, index + '-' + subIndex)" class="cu-item flex-col" @touchstart.stop.prevent="start($event, index + '-' + subIndex)"
class="cu-item flex-col"
v-for="(subItem, subIndex) in item.sonProjectList" v-for="(subItem, subIndex) in item.sonProjectList"
> >
<view class="flex items-center justify-between p-3 w-full"> <view class="flex items-center justify-between p-3 w-full">
<u-icon class="mover" name="https://www.tall.wiki/staticrec/drag.svg" size="48"></u-icon> <u-icon class="mover" name="https://www.tall.wiki/staticrec/drag.svg" size="48"></u-icon>
@ -80,15 +91,16 @@
<!-- 状态 --> <!-- 状态 -->
<view <view
:class=" :class="
subItem.status === 0 subItem.status === 0
? 'text-blue-400 bg-blue-100' ? 'text-blue-400 bg-blue-100'
: subItem.status === 1 : subItem.status === 1
? 'text-green-400 bg-green-100' ? 'text-green-400 bg-green-100'
: subItem.status === 2 : subItem.status === 2
? 'text-red-400 bg-red-100' ? 'text-red-400 bg-red-100'
: 'text-gray-400 bg-gray-100' : 'text-gray-400 bg-gray-100'
" "
class="px-2 text-xs text-gray-400 bg-gray-100 rounded-full flex-shrink-0"> class="px-2 text-xs text-gray-400 bg-gray-100 rounded-full flex-shrink-0"
>
{{ subItem.status === 0 ? '未开始' : subItem.status === 1 ? '进行中' : subItem.status === 2 ? '暂停' : '已完成' }} {{ subItem.status === 0 ? '未开始' : subItem.status === 1 ? '进行中' : subItem.status === 2 ? '暂停' : '已完成' }}
</view> </view>
</view> </view>
@ -122,423 +134,471 @@
</template> </template>
<script setup> <script setup>
import { reactive, onMounted, watch, computed } from 'vue'; import { reactive, onMounted, watch, computed } from 'vue';
import ProjectItem from '@/components/Projects/ProjectItem.vue'; import { useStore } from 'vuex';
import { useStore } from 'vuex'; import dayjs from 'dayjs';
import dayjs from 'dayjs'; import ProjectItem from '@/components/Projects/ProjectItem.vue';
const store = useStore(); const store = useStore();
const projects = computed(() => store.state.project.projects); const projects = computed(() => store.state.project.projects);
const remindData = computed(() => store.state.socket.remindData); const remindData = computed(() => store.state.socket.remindData);
const data = reactive({ const data = reactive({
// itemTop: 0, // itemTop: 0,
// itemLeft: 0, // itemLeft: 0,
itemHeight: 0, // itemHeight: 0, //
itemWidth: 0, // itemWidth: 0, //
subItemHeight: 0, // subItemHeight: 0, //
showMoveImage: false, showMoveImage: false,
moveItem: '', // moveItem: '', //
moveLeft: 0, // moveLeft: 0, //
moveTop: 0, // moveTop: 0, //
deltaLeft: 0, deltaLeft: 0,
deltaTop: 0, deltaTop: 0,
beginleft: 0, // beginleft: 0, //
begintop: 0, // begintop: 0, //
itemList: [], // itemList: [], //
setSubItem: false, // setSubItem: false, //
changeEvent: false, // changeEvent: false, //
showMenu: false, showMenu: false,
tips: { text: '', color: '#909399', fontSize: 28, }, tips: { text: '', color: '#909399', fontSize: 28 },
projectId: 0, clickProject: {},
menuList: [{ text: '复制' }, { text: '编辑' }, { text: '删除' }, { text: '置顶' }, { text: '排序' }], projectId: 0,
// show: false, // menuList: [{ text: '' }, { text: '' }, { text: '' }, { text: '' }, { text: '' }],
// border: 'border border-blue-500 shadow rounded-md', menuList: [{ text: '导出' }, { text: '删除' }],
showBorder: false, //
showItemIndex: undefined, // show: false,
}); // border: 'border border-blue-500 shadow rounded-md',
showBorder: false, //
const emit = defineEmits(['changeHeight', 'change']); showItemIndex: undefined,
});
//
watch([projects, remindData], () => { const emit = defineEmits(['changeHeight', 'change']);
if (projects.value) {
data.itemList = projects.value; //
data.itemList.forEach(item => { watch([projects, remindData], () => {
item.showBorder = false; // if (projects.value) {
item.showSubBorder = false; //
item.showTopBorder = false; //
item.remindNum = 0;
if (remindData.value) {
remindData.value.forEach(remind => {
const remind_data = JSON.parse(remind.data);
if (remind_data.data.projectId === item.id) {
item.remindNum++;
}
})
}
});
}
})
onMounted(() => {
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;
if (remindData.value) {
remindData.value.forEach(remind => {
const remind_data = JSON.parse(remind.data);
if (remind_data.data.projectId === item.id) {
item.remindNum++;
}
});
}
}); });
}
});
onMounted(() => {
data.itemList = projects.value;
data.itemList.forEach(item => {
item.showBorder = false; //
item.showSubBorder = false; //
item.showTopBorder = false; //
}); });
});
// //
function openSubProject(length, index) { function openSubProject(length, index) {
store.commit('project/setProjectItemShow', { index, show: data.itemList[index].show ? false : true }); store.commit('project/setProjectItemShow', { index, show: !data.itemList[index].show });
if (length && index) { if (length && index) {
emit('changeHeight', length, index); emit('changeHeight', length, index);
} }
data.showItemIndex = index; data.showItemIndex = index;
}
//
function getDate() {
const query = uni
.createSelectorQuery()
.select('#cu-0')
.fields(
{
id: true,
dataset: true,
rect: true,
size: true,
},
res => {
data.begintop = res.top;
data.beginleft = res.left;
},
)
.exec();
}
function setData(flag, project, tips) {
data.showMenu = flag;
data.projectId = project.id;
data.tips = tips;
data.clickProject = project;
}
function chooseAction(e) {
const obj = {
index: e,
projectId: data.projectId,
url: data.clickProject.url,
};
// emit('chooseAction', data);
actionFun(obj);
}
//
function actionFun(obj) {
const action = data.menuList[obj.index].text;
if (action === '排序') {
data.changeEvent = true;
uni.$ui.showToast('请移动进行排序');
} }
// if (action === '删除') {
function getDate() { data.changeEvent = false;
const query = uni.createSelectorQuery().select(`#cu-0`).fields({ delProject(obj.projectId);
id: true,
dataset: true,
rect: true,
size: true
}, res => {
data.begintop = res.top;
data.beginleft = res.left;
}).exec();
} }
function setData(flag, projectId, tips) { if (action === '导出') {
data.showMenu = flag; data.changeEvent = false;
data.projectId = projectId; exportProject(obj.projectId, obj.url);
data.tips = tips;
} }
function chooseAction(e) { if (data.showItemIndex !== undefined) {
let obj = { store.commit('project/setProjectItemShow', {
index: e, index: data.showItemIndex,
projectId: data.projectId show: true,
}; });
// emit('chooseAction', data);
actionFun(obj);
} }
}
// function isNumber(val) {
function actionFun(obj) { return val === +val;
let action = data.menuList[obj.index].text; }
if (action === '排序') {
data.changeEvent = true;
uni.$ui.showToast('请移动进行排序');
}
if (action === '删除') { function start(e, index) {
data.changeEvent = false; console.log('开始');
delProject(obj.projectId); setTimeout(() => {
} getDate();
}, 300);
if (data.showItemIndex !== undefined) { if (isNumber(index)) {
store.commit('project/setProjectItemShow', { //
index: data.showItemIndex, data.setSubItem = false;
show: true const query = uni
}); .createSelectorQuery()
} .select(`#cu-${index}`)
.fields(
{
id: true,
dataset: true,
rect: true,
size: true,
},
res => {
data.moveTop = res.top;
data.moveLeft = res.left;
data.moveItem = data.itemList[index];
data.itemWidth = res.width;
data.itemHeight = res.height;
},
)
.exec();
} else {
//
const arr = index.split('-');
data.setSubItem = true;
const query = uni.createSelectorQuery();
query
.select(`#cu-${arr[0] - 0}`)
.fields(
{
id: true,
dataset: true,
rect: true,
size: true,
},
res => {
data.itemHeight = res.height;
},
)
.exec();
query
.select(`#cu-${index}`)
.fields(
{
id: true,
dataset: true,
rect: true,
size: true,
},
res => {
data.moveTop = res.top;
data.moveLeft = res.left;
data.moveItem = data.itemList[arr[0] - 0].sonProjectList[arr[1] - 0];
data.itemWidth = res.width;
data.subItemHeight = res.height;
},
)
.exec();
} }
}
function isNumber(val) {
return val === +val; function move(e, length) {
console.log('移动');
data.showMoveImage = true; //
const touch = e.touches[0];
if (data.deltaLeft == 0) {
//
data.deltaLeft = touch.pageX - data.moveLeft;
data.deltaTop = touch.pageY - data.moveTop;
} }
data.moveLeft = touch.pageX - data.deltaLeft;
function start(e, index) { data.moveTop = touch.pageY - data.deltaTop;
console.log('开始');
setTimeout(() => { const lastIndex = findOverIndex(touch.pageY, length);
getDate(); // 线
}, 300); for (let i = 0; i < data.itemList.length; i++) {
if (data.moveLeft > 35) {
if (isNumber(index)) { // data.itemList[i].showBorder = false;
data.setSubItem = false; data.itemList[i].showTopBorder = false;
const query = uni.createSelectorQuery().select(`#cu-${index}`).fields({ if (i === lastIndex) {
id: true, data.itemList[i].showSubBorder = true;
dataset: true, } else {
rect: true, data.itemList[i].showSubBorder = false;
size: true }
}, res => { } else if (lastIndex === -1) {
data.moveTop = res.top; data.itemList[0].showTopBorder = true;
data.moveLeft = res.left; data.itemList[i].showSubBorder = false;
data.moveItem = data.itemList[index]; data.itemList[i].showBorder = false;
data.itemWidth = res.width; } else {
data.itemHeight = res.height; data.itemList[i].showSubBorder = false;
}).exec(); data.itemList[i].showTopBorder = false;
} else { // if (i === lastIndex) {
let arr = index.split('-'); data.itemList[i].showBorder = true;
data.setSubItem = true; } else {
data.itemList[i].showBorder = false;
const query = uni.createSelectorQuery(); }
query.select(`#cu-${arr[0] - 0}`).fields({
id: true,
dataset: true,
rect: true,
size: true
}, res => {
data.itemHeight = res.height;
}).exec();
query.select(`#cu-${index}`).fields({
id: true,
dataset: true,
rect: true,
size: true
}, res => {
data.moveTop = res.top;
data.moveLeft = res.left;
data.moveItem = data.itemList[arr[0] - 0].sonProjectList[arr[1] - 0];
data.itemWidth = res.width;
data.subItemHeight = res.height;
}).exec();
} }
} }
}
function move(e, length) {
console.log('移动'); function stops(e, index, length) {
data.showMoveImage = true; // console.log('结束');
const touch = e.touches[0]; const touch = e.changedTouches[0];
if (data.deltaLeft == 0) { const lastIndex = findOverIndex(touch.pageY, length);
//
data.deltaLeft = touch.pageX - data.moveLeft; //
data.deltaTop = touch.pageY - data.moveTop; for (let i = 0; i < data.itemList.length; i++) {
//
if (data.itemList[i].showTopBorder) {
if (isNumber(index)) {
const Value = data.itemList[index];
data.itemList.unshift(Value);
data.itemList.splice(index + 1, 1);
} else {
const arr = index.split('-');
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,
};
emit('change', options);
}
//
clearSet(i);
emit('change', data.itemList);
return;
} }
data.moveLeft = touch.pageX - data.deltaLeft; //
data.moveTop = touch.pageY - data.deltaTop; if (data.itemList[i].showBorder) {
if (isNumber(index)) {
let lastIndex = findOverIndex(touch.pageY, length); const Value = data.itemList[index];
// 线 data.itemList.splice(i + 1, 0, Value);
for (let i = 0; i < data.itemList.length; i++) { if (i < index) {
if (data.moveLeft > 35) { data.itemList.splice(index + 1, 1);
data.itemList[i].showBorder = false;
data.itemList[i].showTopBorder = false;
if (i === lastIndex) {
data.itemList[i].showSubBorder = true;
} else { } else {
data.itemList[i].showSubBorder = false; data.itemList.splice(index, 1);
} }
} else { } else {
if (lastIndex === -1) { const arr = index.split('-');
data.itemList[0].showTopBorder = true; const Value = data.itemList[arr[0] - 0].sonProjectList[arr[1] - 0];
data.itemList[i].showSubBorder = false; data.itemList.splice(i + 1, 0, Value);
data.itemList[i].showBorder = false; data.itemList[arr[0] - 0].sonProjectList.splice([arr[1] - 0], 1);
} else { const options = {
data.itemList[i].showSubBorder = false; id: Value.id,
data.itemList[i].showTopBorder = false; parentId: 0,
if (i === lastIndex) { };
data.itemList[i].showBorder = true; emit('change', options);
} else {
data.itemList[i].showBorder = false;
}
}
} }
//
clearSet(i);
emit('change', data.itemList);
return;
} }
} //
if (data.itemList[i].showSubBorder) {
function stops(e, index, length) { if (isNumber(index)) {
console.log('结束'); const Value = data.itemList[index];
const touch = e.changedTouches[0]; if (data.itemList[lastIndex - 1].sonProjectList && data.itemList[lastIndex - 1].sonProjectList.length) {
let lastIndex = findOverIndex(touch.pageY, length); data.itemList[lastIndex - 1].sonProjectList.push(Value);
//
for (let i = 0; i < data.itemList.length; i++) {
//
if (data.itemList[i].showTopBorder) {
if (isNumber(index)) {
let Value = data.itemList[index];
data.itemList.unshift(Value);
data.itemList.splice(index + 1, 1);
} else { } else {
let arr = index.split('-'); data.itemList[lastIndex].sonProjectList = [Value];
let 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,
};
emit('change', options);
} }
data.itemList.splice(index, 1);
// //
clearSet(i); clearSet(i);
emit('change', data.itemList); const options = {
return; id: Value.id,
} parentId: data.itemList[lastIndex - 1].id,
// };
if (data.itemList[i].showBorder) { emit('change', options);
if (isNumber(index)) { } else {
let Value = data.itemList[index]; const arr = index.split('-');
data.itemList.splice(i + 1, 0, Value); const Value = data.itemList[arr[0] - 0].sonProjectList[arr[1] - 0];
if (i < index) { if (data.itemList[lastIndex].sonProjectList && data.itemList[lastIndex].sonProjectList.length) {
data.itemList.splice(index + 1, 1); data.itemList[lastIndex].sonProjectList.push(Value);
} else {
data.itemList.splice(index, 1);
}
} else { } else {
let arr = index.split('-'); data.itemList[lastIndex].sonProjectList = [Value];
let 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,
};
emit('change', options);
} }
data.itemList[arr[0] - 0].sonProjectList.splice([arr[1] - 0], 1);
// //
clearSet(i); clearSet(i);
emit('change', data.itemList); const options = {
return; id: Value.id,
} parentId: data.itemList[lastIndex].id,
// };
if (data.itemList[i].showSubBorder) { emit('change', options);
if (isNumber(index)) {
let Value = data.itemList[index]; const options1 = {
if (data.itemList[lastIndex - 1].sonProjectList && data.itemList[lastIndex - 1].sonProjectList.length) { id: Value.id,
data.itemList[lastIndex - 1].sonProjectList.push(Value); parentId: 0,
} else { };
data.itemList[lastIndex].sonProjectList = [Value]; emit('change', options1);
}
data.itemList.splice(index, 1);
//
clearSet(i);
const options = {
id: Value.id,
parentId: data.itemList[lastIndex - 1].id,
};
emit('change', options);
} else {
let arr = index.split('-');
let Value = data.itemList[arr[0] - 0].sonProjectList[arr[1] - 0];
if (data.itemList[lastIndex].sonProjectList && data.itemList[lastIndex].sonProjectList.length) {
data.itemList[lastIndex].sonProjectList.push(Value);
} else {
data.itemList[lastIndex].sonProjectList = [Value];
}
data.itemList[arr[0] - 0].sonProjectList.splice([arr[1] - 0], 1);
//
clearSet(i);
const options = {
id: Value.id,
parentId: data.itemList[lastIndex].id,
};
emit('change', options);
const options1 = {
id: Value.id,
parentId: 0,
};
emit('change', options1);
}
return;
} }
return;
} }
} }
}
//
function clearSet(i) { //
data.itemList[i].showBorder = false; function clearSet(i) {
data.itemList[i].showSubBorder = false; data.itemList[i].showBorder = false;
data.itemList[i].showTopBorder = false; data.itemList[i].showSubBorder = false;
data.deltaLeft == 0; data.itemList[i].showTopBorder = false;
data.showMoveImage = false; data.deltaLeft == 0;
data.setSubItem = false; data.showMoveImage = false;
data.changeEvent = false; data.setSubItem = false;
data.showItemIndex = undefined; data.changeEvent = false;
data.showItemIndex = undefined;
}
//
function findOverIndex(posY) {
//
const leng = data.itemList.length * data.itemHeight; //
if (posY < data.begintop) {
return -1;
} }
for (let i = 0; i < data.itemList.length; i++) {
// const begin = data.itemHeight * i + data.begintop;
function findOverIndex(posY) { const end = data.itemHeight * i + data.begintop + data.itemHeight;
// if (begin <= posY && end >= posY) {
let leng = data.itemList.length * data.itemHeight; // return i;
if (posY < data.begintop) {
return -1;
}
for (var i = 0; i < data.itemList.length; i++) {
let begin = data.itemHeight * i + data.begintop;
let end = data.itemHeight * i + data.begintop + data.itemHeight;
if (begin <= posY && end >= posY) {
return i;
}
}
if (posY > leng) {
//
return data.itemList.length - 1;
} else if (posY < data.begintop) {
return 0;
} }
} }
if (posY > leng) {
// //
function delProject(id) { return data.itemList.length - 1;
uni.showModal({
title: '',
content: '是否删除项目?',
showCancel: true,
success: async ({
confirm
}) => {
if (confirm) {
await uni.$u.api.delProject(id);
let flag_index = 0;
data.itemList.forEach((item, index) => {
if (item.id == id) {
flag_index = index;
}
});
data.itemList.splice(flag_index, 1);
store.commit('project/setProjects', data.itemList);
}
},
});
}
//
function toWorkbench() {
uni.navigateTo({
url: '/pages/workbench/workbench'
})
} }
</script> if (posY < data.begintop) {
return 0;
<style lang="scss" scoped>
.cu-item {
width: 100%;
display: flex;
align-items: center;
font-size: 14px;
} }
}
//
function delProject(id) {
uni.showModal({
title: '',
content: '是否删除项目?',
showCancel: true,
success: async ({ confirm }) => {
if (confirm) {
await uni.$u.api.delProject(id);
let flag_index = 0;
data.itemList.forEach((item, index) => {
if (item.id == id) {
flag_index = index;
}
});
.border-100 { data.itemList.splice(flag_index, 1);
width: 92%; store.commit('project/setProjects', data.itemList);
height: 4rpx; }
} },
});
}
function exportProject(id, url) {
uni.showModal({
title: '',
content: '是否导出项目?',
showCancel: true,
success: async ({ confirm }) => {
if (confirm) {
const data = await uni.$u.post(`${url}/tall/project/exportWbs`, { projectId: id });
// console.log('data', data);
window.location.href = data.url;
}
},
});
}
.border-80 { //
width: 84%; function toWorkbench() {
height: 2px; uni.navigateTo({ url: '/pages/workbench/workbench' });
margin-left: 30px; }
} </script>
.workbench-btn { <style lang="scss" scoped>
margin-right: 10px; .cu-item {
width: 80px; width: 100%;
height: 36px; display: flex;
line-height: 36px; align-items: center;
border-radius: 18px; font-size: 14px;
overflow: hidden; }
border: 1px solid #2B85E4;
background-color: #1890FF; .border-100 {
font-size: 12px; width: 92%;
color: #FFFFFF; height: 4rpx;
text-align: center; }
}
.border-80 {
width: 84%;
height: 2px;
margin-left: 30px;
}
.workbench-btn {
margin-right: 10px;
width: 80px;
height: 36px;
line-height: 36px;
border-radius: 18px;
overflow: hidden;
border: 1px solid #2b85e4;
background-color: #1890ff;
font-size: 12px;
color: #ffffff;
text-align: center;
}
</style> </style>

40
components/Projects/ProjectItem.vue

@ -2,7 +2,7 @@
<view class="w-full"> <view class="w-full">
<!-- 有子项目 父项目 --> <!-- 有子项目 父项目 -->
<view class="flex items-center justify-between p-3"> <view class="flex items-center justify-between p-3">
<u-icon @click="openMenu(item)" class="mover" name="https://www.tall.wiki/staticrec/drag.svg" size="48"></u-icon> <u-icon @click="openMenu(item, index)" class="mover" name="https://www.tall.wiki/staticrec/drag.svg" size="48"></u-icon>
<view @click="openProject(item)" class="flex-1 px-3"> <view @click="openProject(item)" class="flex-1 px-3">
<view class="flex items-center mb-1"> <view class="flex items-center mb-1">
@ -24,15 +24,32 @@
<!-- 箭头 --> <!-- 箭头 -->
<view v-if="item.sonProjectList && item.sonProjectList.length"> <view v-if="item.sonProjectList && item.sonProjectList.length">
<u-icon @click="emit('openSubProject', item.sonProjectList.length, index)" class="text-gray-400" name="arrow-up" size="14px" v-if="item.show"></u-icon> <u-icon
<u-icon @click="emit('openSubProject', item.sonProjectList.length, index)" class="text-gray-400" name="arrow-down" size="14px" v-else></u-icon> @click="emit('openSubProject', item.sonProjectList.length, index)"
class="text-gray-400"
name="arrow-up"
size="14px"
v-if="item.show"
></u-icon>
<u-icon
@click="emit('openSubProject', item.sonProjectList.length, index)"
class="text-gray-400"
name="arrow-down"
size="14px"
v-else
></u-icon>
</view> </view>
<u-icon @click="openProject(item)" class="text-gray-400" name="arrow-right" size="14px" v-else></u-icon> <u-icon @click="openProject(item)" class="text-gray-400" name="arrow-right" size="14px" v-else></u-icon>
</view> </view>
<!-- 子项目 --> <!-- 子项目 -->
<view class="ml-8" v-if="item.show"> <view class="ml-8" v-if="item.show">
<view :id="'cu-' + index + '-' + subIndex" :key="subIndex" class="cu-item flex-col" v-for="(subItem, subIndex) in item.sonProjectList"> <view
:id="'cu-' + index + '-' + subIndex"
:key="subIndex"
class="cu-item flex-col"
v-for="(subItem, subIndex) in item.sonProjectList"
>
<!-- <view :key="subItem.id" v-for="subItem in item.sonProjectList"> --> <!-- <view :key="subItem.id" v-for="subItem in item.sonProjectList"> -->
<view class="flex items-center justify-between p-3"> <view class="flex items-center justify-between p-3">
<u-icon @click="openMenu(subItem)" class="mover" name="https://www.tall.wiki/staticrec/drag.svg" size="48"></u-icon> <u-icon @click="openMenu(subItem)" class="mover" name="https://www.tall.wiki/staticrec/drag.svg" size="48"></u-icon>
@ -106,9 +123,7 @@ const data = reactive({
// //
function toWorkbench() { function toWorkbench() {
uni.navigateTo({ uni.navigateTo({ url: '/pages/workbench/workbench' });
url: '/pages/workbench/workbench'
});
} }
// //
@ -127,12 +142,13 @@ function openProject(project) {
/** /**
* 弹出项目操作面板 * 弹出项目操作面板
*/ */
function openMenu(project) { function openMenu(project, index) {
if (index === 0) return;
data.showMenu = true; data.showMenu = true;
data.projectId = project.id; data.projectId = project.id;
data.tips.text = project.name; data.tips.text = project.name;
emit('setData', data.showMenu, data.projectId, data.tips); emit('setData', data.showMenu, project, data.tips);
} }
</script> </script>
@ -154,10 +170,10 @@ function openMenu(project) {
line-height: 36px; line-height: 36px;
border-radius: 18px; border-radius: 18px;
overflow: hidden; overflow: hidden;
border: 1px solid #2B85E4; border: 1px solid #2b85e4;
background-color: #1890FF; background-color: #1890ff;
font-size: 12px; font-size: 12px;
color: #FFFFFF; color: #ffffff;
text-align: center; text-align: center;
} }

61
components/Roles/Roles.vue

@ -58,7 +58,8 @@ const store = useStore();
const getTasksHook = useGetTasks(); const getTasksHook = useGetTasks();
const visibleRoles = computed(() => store.state.role.visibleRoles); const visibleRoles = computed(() => store.state.role.visibleRoles);
const roleId = computed(() => store.state.role.roleId); const roleId = computed(() => store.state.role.roleId);
const tasks = computed(() => store.state.task.tasks); // const tasks = computed(() => store.state.task.tasks);
const allTasks = computed(() => store.state.task.allTasks); //
const remindData = computed(() => store.state.socket.remindData); // const remindData = computed(() => store.state.socket.remindData); //
const currLocationTaskId = computed(() => store.state.socket.currLocationTaskId); // id const currLocationTaskId = computed(() => store.state.socket.currLocationTaskId); // id
@ -79,6 +80,64 @@ watchEffect(() => {
data.roles = visibleRoles.value; data.roles = visibleRoles.value;
data.loading = false; data.loading = false;
} }
if (allTasks.value.length > 0) {
allTasks.value.forEach(item => {
if (item.global) {
item.global.forEach(global => {
global.remindNum = 0;
global.plugins.forEach(pluginArr => {
pluginArr.forEach(plugin => {
plugin.remindNum = 0;
remindData.value.forEach(remind => {
const remind_data = JSON.parse(remind.data);
if (item.role.id === remind_data.data.roleId) {
if (remind_data.data.taskId === global.id) {
global.remindNum++;
}
if (remind_data.data.taskId === global.id && remind_data.data.pluginId === plugin.pluginTaskId) {
plugin.remindNum++;
}
}
});
});
});
});
}
if (item.task) {
item.task.forEach(task => {
task.remindNum = 0;
if (task.plugins) {
task.plugins.forEach(pluginArr => {
pluginArr.forEach(plugin => {
plugin.remindNum = 0;
remindData.value.forEach(remind => {
const remind_data = JSON.parse(remind.data);
if (item.role.id === remind_data.data.roleId) {
if (remind_data.data.taskId === task.id) {
task.remindNum++;
}
if (remind_data.data.taskId === task.id && remind_data.data.pluginId === plugin.pluginTaskId) {
plugin.remindNum++;
}
}
});
});
});
}
});
}
});
}
store.commit('task/setAllTasks', allTasks.value);
}); });
onMounted(() => { onMounted(() => {

60
pages/project/project.vue

@ -74,66 +74,6 @@ if (!userInfo.value) {
} }
} }
watch([allTasks, remindData], () => {
if (allTasks.value.length > 0) {
allTasks.value.forEach(item => {
if (item.global) {
item.global.forEach(global => {
global.remindNum = 0;
global.plugins.forEach(pluginArr => {
pluginArr.forEach(plugin => {
plugin.remindNum = 0;
remindData.value.forEach(remind => {
const remind_data = JSON.parse(remind.data);
if (item.role.id === remind_data.data.roleId) {
if (remind_data.data.taskId === global.id) {
global.remindNum++;
}
if (remind_data.data.taskId === global.id && remind_data.data.pluginId === plugin.pluginTaskId) {
plugin.remindNum++;
}
}
});
});
});
});
}
if (item.task) {
item.task.forEach(task => {
task.remindNum = 0;
if (task.plugins) {
task.plugins.forEach(pluginArr => {
pluginArr.forEach(plugin => {
plugin.remindNum = 0;
remindData.value.forEach(remind => {
const remind_data = JSON.parse(remind.data);
if (item.role.id === remind_data.data.roleId) {
if (remind_data.data.taskId === task.id) {
task.remindNum++;
}
if (remind_data.data.taskId === task.id && remind_data.data.pluginId === plugin.pluginTaskId) {
plugin.remindNum++;
}
}
});
});
});
}
});
}
});
}
store.commit('task/setAllTasks', allTasks.value);
});
/** /**
* 当角色发生变化时 * 当角色发生变化时
* 重新查询永久日常任务和普通日常任务 * 重新查询永久日常任务和普通日常任务

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

@ -57,7 +57,6 @@ watch(remindData, () => {
if (remind_data.data.taskId === task.id) { if (remind_data.data.taskId === task.id) {
msgId.value = remind.id; msgId.value = remind.id;
console.log('交付物检查弹框', msgId.value)
} }
}) })
}) })
@ -79,7 +78,7 @@ async function handleSubmit(mode) {
score: mode === 'RESOLVE' ? score.value : '', score: mode === 'RESOLVE' ? score.value : '',
msgId: msgId.value msgId: msgId.value
}; };
console.log('交付物审核', param, msgId.value)
await uni.$u.api.checkDeliver(param); await uni.$u.api.checkDeliver(param);
handleHide(); // + handleHide(); // +
uni.$ui.showToast('审核信息提交成功'); uni.$ui.showToast('审核信息提交成功');

Loading…
Cancel
Save