Commit b52cf1a6 authored by 王鑫's avatar 王鑫

fix: 任务进度优化

parent 77e3ad9d
......@@ -13,6 +13,19 @@
<!-- <div class="q-mt-md" />-->
<!-- <q-btn @click="addTask" icon="mdi-plus" label="Add tas k" />-->
<!-- </q-page>-->
<div style="margin-top: 20px">
<a-pagination
@change="pageChange"
:defaultPageSize="defaultPageSize"
@showSizeChange="sizeChange"
class="cust-pagination"
size="small"
:total="total"
showSizeChanger
showQuickJumper
:showTotal="$showTotal"/>
</div>
</a-card>
</template>
<script>
......@@ -148,7 +161,9 @@ export default {
tasks,
options,
dynamicStyle: {},
lastId: 16
lastId: 16,
defaultPageSize: 10,
total: 20
}
},
methods: {
......@@ -166,43 +181,43 @@ export default {
if (response && response.code == SYS_CONST.REQUEST.SUCCEED) {
let respData = response.data;
let taskList = [];
console.log(respData)
// for (const respDataKey in respData) {
// let day = this.GetNumberOfDays(new Date(),respDataKey.begin);
// let duration = this.GetNumberOfDays(respDataKey.begin,respDataKey.end);
// // 父元素
// if(respDataKey.parentId == null){
// taskList.push({
// id: respDataKey.id,
// name: respDataKey.name,
// user: '',
// start: getDate(24 * day),
// duration: duration * 24 * 60 * 60 * 1000,
// percent: 85,
// type: "project"
// })
// // 子元素
// }else {
// taskList.push({
// id: respDataKey.id,
// name: "",
// user:'<span style=\'color:#1eb0bc\'>'+respDataKey.name+'</span>',
// parentId: respDataKey.parentId,
// start: getDate(24 * day),
// duration: duration * 24 * 60 * 60 * 1000,
// percent: 50,
// type: "milestone",
// collapsed: true,
// style: {
// base: {
// fill: "#1EBC61",
// stroke: "#0EAC51"
// }
// }
// })
// }
//
// }
for (const respDataKey in respData) {
let day = this.GetNumberOfDays(new Date(),respData[respDataKey].begin);
let duration = this.GetNumberOfDays(respData[respDataKey].begin,respData[respDataKey].end);
// 父元素
if(respData[respDataKey].parentId === null){
taskList.push({
id: respData[respDataKey].id,
name: respData[respDataKey].name,
user: '',
start: getDate(24 * day),
duration: duration * 24 * 60 * 60 * 1000,
percent: 85,
type: "project"
})
// 子元素
}else {
taskList.push({
id: respData[respDataKey].id,
name: "",
user:'<span style=\'color:#1eb0bc\'>'+respData[respDataKey].name+'</span>',
parentId: respData[respDataKey].parentId,
start: getDate(24 * day),
duration: duration * 24 * 60 * 60 * 1000,
percent: 50,
type: "milestone",
collapsed: true,
style: {
base: {
fill: "#1EBC61",
stroke: "#0EAC51"
}
}
})
}
}
this.tasks = taskList
}
});
},
......@@ -212,6 +227,12 @@ export default {
let a2 = Date.parse(new Date(date2));
let day = parseInt((a2-a1)/ (1000 * 60 * 60 * 24));//核心:时间戳相减,然后除以天数
return day
},
pageChange(){
},
sizeChange(){
}
},
mounted() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment