20 changed files with 453 additions and 608 deletions
@ -1,401 +0,0 @@ |
|||
export default [ |
|||
{ |
|||
path: '/tasks', |
|||
handler: (req, res) => { |
|||
return res.json({ |
|||
code: 200, |
|||
msg: 'ok', |
|||
success: true, |
|||
data: { |
|||
plugins: [ |
|||
`<button onclick="location.href='https://www.tall.wiki/wl/1'">js打开物流页面</button>`, |
|||
`<a href="https://www.tall.wiki/wl/5">a链接打开现海园区</a>`, |
|||
`<div class="p-3 my-4 text-2xl bg-yellow-400 text-white" onclick="alert(123)">样式继承及简单脚本</div>`, |
|||
`<div class="p-3 my-4 text-2xl bg-red-400 text-white" onclick="openModal()">先是modal, 函数执行</div>
|
|||
<div style="display: none" id="modal">modal</div> |
|||
|
|||
<script> |
|||
function openModal() { |
|||
const modal = document.getElementById('modal'); |
|||
if (modal.style.display === 'block') { |
|||
modal.style.display = 'none'; |
|||
} else { |
|||
modal.style.display = 'block'; |
|||
} |
|||
console.log('modal显示了'); |
|||
} |
|||
</script>`, |
|||
], |
|||
}, |
|||
}); |
|||
}, |
|||
}, |
|||
//根据id获取token
|
|||
{ |
|||
path: '/tall/v1.0/users/userId', |
|||
handler: (req, res) => { |
|||
return res.json({ |
|||
code: 200, |
|||
msg: 'ok', |
|||
success: true, |
|||
data: { |
|||
account: 'wally', |
|||
id: 123, |
|||
phone: '18603454788', |
|||
refresh_token: 'string', |
|||
token: 'string', |
|||
wxInfo: { |
|||
city: 'string', |
|||
country: 'string', |
|||
headImgUrl: 'string', |
|||
language: 'string', |
|||
nickname: 'string', |
|||
province: 'string', |
|||
sex: 0, |
|||
}, |
|||
}, |
|||
}); |
|||
}, |
|||
}, |
|||
//根据id获取项目信息
|
|||
{ |
|||
path: '/defaultwbs/project/findProjectById', |
|||
method: 'post', |
|||
handler: (req, res) => { |
|||
return res.json({ |
|||
code: 200, |
|||
msg: 'ok', |
|||
success: true, |
|||
data: { |
|||
name: '默认项目', |
|||
projectId: 1235555, |
|||
}, |
|||
}); |
|||
}, |
|||
}, |
|||
//查询角色栏展示的角色
|
|||
{ |
|||
path: '/defaultwbs/role/show', |
|||
method: 'post', |
|||
handler: (req, res) => { |
|||
return res.json({ |
|||
code: 200, |
|||
msg: 'ok', |
|||
success: true, |
|||
data: { |
|||
//不展示的角色
|
|||
invisibleList: [ |
|||
{ |
|||
id: 123456789, |
|||
mine: 1, |
|||
name: 'string', |
|||
pm: 0, |
|||
sequence: 33, |
|||
}, |
|||
], //展示的角色
|
|||
visibleList: [ |
|||
{ |
|||
id: 1, |
|||
name: '项目经理', |
|||
mine: 0, |
|||
pm: 1, |
|||
sequence: 1, |
|||
}, |
|||
{ |
|||
id: 2, |
|||
name: '运维', |
|||
mine: 0, |
|||
pm: 0, |
|||
sequence: 2, |
|||
}, |
|||
{ |
|||
id: 3, |
|||
name: '导师一', |
|||
mine: 1, |
|||
pm: 0, |
|||
sequence: 3, |
|||
}, |
|||
{ |
|||
id: 4, |
|||
name: '导师二', |
|||
mine: 1, |
|||
pm: 0, |
|||
sequence: 4, |
|||
}, |
|||
{ |
|||
id: 5, |
|||
name: '导师三', |
|||
mine: 1, |
|||
pm: 0, |
|||
sequence: 5, |
|||
}, |
|||
], |
|||
}, |
|||
}); |
|||
}, |
|||
}, |
|||
//配置角色栏展示的角色
|
|||
{ |
|||
path: '/defaultwbs/role/updateShow', |
|||
method: 'post', |
|||
handler: (req, res) => { |
|||
return res.json({ |
|||
code: 200, |
|||
msg: 'ok', |
|||
success: true, |
|||
data: { description: 'data数据' }, |
|||
}); |
|||
}, |
|||
}, |
|||
//根据角色查找永久的日常任务
|
|||
{ |
|||
path: '/defaultwbs/task/permanent', |
|||
method: 'post', |
|||
handler: (req, res) => { |
|||
return res.json({ |
|||
code: 200, |
|||
msg: 'ok', |
|||
success: true, |
|||
data: [ |
|||
{ |
|||
description: 'string', |
|||
detailId: 147258, |
|||
id: 258147, |
|||
name: 'string', |
|||
panel: { |
|||
backgroundColor: 'string', |
|||
border: 'string', |
|||
borderRadius: 'string', |
|||
col: 132, |
|||
height: 'string', |
|||
row: 147, |
|||
shadow: 'string', |
|||
width: 'string', |
|||
}, |
|||
planDuration: 123, |
|||
planStart: 123456789, |
|||
plugins: [ |
|||
[ |
|||
{ |
|||
col: 1, |
|||
colspan: 123, |
|||
param: 123, |
|||
pluginId: 13, |
|||
row: 2, |
|||
rowspan: 123, |
|||
}, |
|||
], |
|||
], |
|||
process: 0, |
|||
realDuration: 123456789, |
|||
realStart: 123456789, |
|||
skip: -1, |
|||
skipTaskId: 123456789, |
|||
}, |
|||
], |
|||
}); |
|||
}, |
|||
}, |
|||
//根据时间和角色查找日常任务
|
|||
{ |
|||
path: '/defaultwbs/task/global', |
|||
method: 'post', |
|||
handler: (req, res) => { |
|||
return res.json({ |
|||
code: 200, |
|||
msg: 'ok', |
|||
success: true, |
|||
data: [ |
|||
{ |
|||
description: 'string', |
|||
detailId: 147258, |
|||
id: 258147, |
|||
name: 'string', |
|||
panel: { |
|||
backgroundColor: 'string', |
|||
border: 'string', |
|||
borderRadius: 'string', |
|||
col: 132, |
|||
height: 'string', |
|||
row: 147, |
|||
shadow: 'string', |
|||
width: 'string', |
|||
}, |
|||
planDuration: 123, |
|||
planStart: 123456789, |
|||
plugins: [ |
|||
[ |
|||
{ |
|||
col: 1, |
|||
colspan: 123, |
|||
param: 123, |
|||
pluginId: 13, |
|||
row: 1, |
|||
rowspan: 123, |
|||
}, |
|||
], |
|||
], |
|||
process: 0, |
|||
realDuration: 123456789, |
|||
realStart: 123456789, |
|||
skip: -1, |
|||
skipTaskId: 123456789, |
|||
}, |
|||
], |
|||
}); |
|||
}, |
|||
}, |
|||
//根据时间基准点和角色查找定期任务
|
|||
{ |
|||
path: '/defaultwbs/task/regular', |
|||
method: 'post', |
|||
handler: (req, res) => { |
|||
return res.json({ |
|||
code: 200, |
|||
msg: 'ok', |
|||
success: true, |
|||
data: [ |
|||
{ |
|||
description: 'string', |
|||
detailId: 147258, |
|||
id: 258147, |
|||
name: 'string', |
|||
panel: { |
|||
backgroundColor: 'string', |
|||
border: 'string', |
|||
borderRadius: 'string', |
|||
col: 132, |
|||
height: '100', |
|||
row: 147, |
|||
shadow: 'string', |
|||
width: 'string', |
|||
}, |
|||
planDuration: 123, |
|||
planStart: 123456789, |
|||
plugins: [ |
|||
[ |
|||
{ |
|||
col: 123, |
|||
colspan: 123, |
|||
param: 123, |
|||
pluginId: 1, |
|||
row: 123, |
|||
rowspan: 123, |
|||
}, |
|||
], |
|||
], |
|||
process: 0, |
|||
realDuration: 123456789, |
|||
realStart: 123456789, |
|||
skip: -1, |
|||
skipTaskId: 123456789, |
|||
}, |
|||
{ |
|||
description: 'string', |
|||
detailId: 147258, |
|||
id: 254565, |
|||
name: 'string', |
|||
panel: { |
|||
backgroundColor: 'string', |
|||
border: 'string', |
|||
borderRadius: 'string', |
|||
col: 132, |
|||
height: '100', |
|||
row: 147, |
|||
shadow: 'string', |
|||
width: 'string', |
|||
}, |
|||
planDuration: 123, |
|||
planStart: 123456789, |
|||
plugins: [ |
|||
[ |
|||
{ |
|||
col: 123, |
|||
colspan: 123, |
|||
param: 123, |
|||
pluginId: 2, |
|||
row: 123, |
|||
rowspan: 123, |
|||
}, |
|||
], |
|||
], |
|||
process: 0, |
|||
realDuration: 123456789, |
|||
realStart: 123456789, |
|||
skip: -1, |
|||
skipTaskId: 123456789, |
|||
}, |
|||
{ |
|||
description: 'string', |
|||
detailId: 147258, |
|||
id: 111125, |
|||
name: 'string', |
|||
panel: { |
|||
backgroundColor: 'string', |
|||
border: 'string', |
|||
borderRadius: 'string', |
|||
col: 132, |
|||
height: '100', |
|||
row: 147, |
|||
shadow: 'string', |
|||
width: 'string', |
|||
}, |
|||
planDuration: 123, |
|||
planStart: 123456789, |
|||
plugins: [ |
|||
[ |
|||
{ |
|||
col: 123, |
|||
colspan: 123, |
|||
param: 123, |
|||
pluginId: 3, |
|||
row: 123, |
|||
rowspan: 123, |
|||
}, |
|||
], |
|||
], |
|||
process: 0, |
|||
realDuration: 123456789, |
|||
realStart: 123456789, |
|||
skip: -1, |
|||
skipTaskId: 123456789, |
|||
}, |
|||
], |
|||
}); |
|||
}, |
|||
}, |
|||
//修改任务状态
|
|||
{ |
|||
path: '/defaultwbs/task/type', |
|||
method: 'post', |
|||
handler: (req, res) => { |
|||
return res.json({ |
|||
code: 200, |
|||
msg: 'ok', |
|||
success: true, |
|||
data: { description: 'data数据' }, |
|||
}); |
|||
}, |
|||
}, |
|||
//根据id查询插件信息
|
|||
{ |
|||
path: '/defaultwbs/plugin', |
|||
method: 'post', |
|||
handler: (req, res) => { |
|||
return res.json({ |
|||
code: 200, |
|||
msg: 'ok', |
|||
success: true, |
|||
data: { |
|||
html: '<div style="background:#0f0;height:100%"></div>', |
|||
id: 13, |
|||
intro: 'string', |
|||
js: 'string', |
|||
name: 'string', |
|||
styleType: -1, |
|||
version: 'string', |
|||
}, |
|||
}); |
|||
}, |
|||
}, |
|||
]; |
@ -1,3 +1,86 @@ |
|||
<template> |
|||
<view>导入wbs</view> |
|||
<view> |
|||
<view @tap="handleUpload" v-if="task.name === '导入WBS新建项目'">{{ task.name }}</view> |
|||
<view @tap="handleUpdate" v-if="task.name === '导入WBS更新项目'">{{ task.name }}</view> |
|||
<!-- 全局提示框 --> |
|||
<u-top-tips ref="uTips"></u-top-tips> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { mapGetters, mapMutations } from 'vuex'; |
|||
|
|||
export default { |
|||
name: 'p-wbs-import', |
|||
props: { |
|||
task: { |
|||
type: Object, |
|||
default: () => {}, |
|||
}, |
|||
}, |
|||
data() { |
|||
return {}; |
|||
}, |
|||
|
|||
computed: { |
|||
...mapGetters('user', ['userId']), |
|||
...mapGetters('project', ['projectId']), |
|||
}, |
|||
|
|||
methods: { |
|||
...mapMutations('project', ['setShowAlert']), |
|||
|
|||
// 导入wbs |
|||
async handleUpload() { |
|||
try { |
|||
const data = await this.$u.api.import(); |
|||
// 导入WBS成功后 |
|||
// 直接打开导入的项目 |
|||
this.onUploadSuccess(); |
|||
setTimeout(() => { |
|||
this.$u.route('/pages/project/project', { |
|||
u: this.userId, |
|||
p: data.id, |
|||
pname: data.pname, |
|||
url: data.url, |
|||
}); |
|||
}, 2000); |
|||
} catch (error) { |
|||
this.onUploadError(error); |
|||
} |
|||
}, |
|||
|
|||
// 更新项目 |
|||
// TODO: 更新接口没写完 |
|||
async handleUpdate() { |
|||
try { |
|||
const data = await this.$u.api.import({ projectId: this.projectId }); |
|||
console.log('data: ', data); |
|||
// 导入WBS成功后 |
|||
// 直接打开导入的项目 |
|||
this.onUploadSuccess(); |
|||
} catch (error) { |
|||
this.onUploadError(error); |
|||
} |
|||
}, |
|||
|
|||
// 导入成功 |
|||
onUploadSuccess() { |
|||
this.$refs.uTips.show({ |
|||
title: '导入成功,即将打开新项目', |
|||
type: 'success', |
|||
duration: '3000', |
|||
}); |
|||
}, |
|||
|
|||
// 导入失败 |
|||
onUploadError(error) { |
|||
this.$refs.uTips.show({ |
|||
title: error || '导入失败', |
|||
type: 'error', |
|||
duration: '6000', |
|||
}); |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
|
Loading…
Reference in new issue