|
|
|
|
@ -26,40 +26,39 @@
|
|
|
|
|
</slot>
|
|
|
|
|
</lx-header>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- @cell-click="cellClicks" -->
|
|
|
|
|
<!-- :span-method="spanMethod" -->
|
|
|
|
|
<!-- :showIndex='false' -->
|
|
|
|
|
<xy-table :list="list"
|
|
|
|
|
:total="total"
|
|
|
|
|
:span-method="spanMethod"
|
|
|
|
|
:showIndex='false'
|
|
|
|
|
stripe
|
|
|
|
|
@cell-dblclick="cellClicks"
|
|
|
|
|
@selection-change='selectionChange'
|
|
|
|
|
@pageSizeChange="e => {select.page_size = e,getList()}"
|
|
|
|
|
@pageIndexChange="e => {select.page = e,getList()}"
|
|
|
|
|
:table-item="table"
|
|
|
|
|
:defaultExpandAll="false"
|
|
|
|
|
<xy-table :list="currentTableList"
|
|
|
|
|
:total="total"
|
|
|
|
|
:span-method="spanMethod"
|
|
|
|
|
row-key="rowindex"
|
|
|
|
|
:showIndex='false'
|
|
|
|
|
stripe
|
|
|
|
|
@cell-dblclick="cellClicks"
|
|
|
|
|
@selection-change='selectionChange'
|
|
|
|
|
@pageSizeChange="e => {select.page_size = e,getList()}"
|
|
|
|
|
@pageIndexChange="e => {select.page = e,getList()}"
|
|
|
|
|
:table-item="table"
|
|
|
|
|
:defaultExpandAll="false"
|
|
|
|
|
:isPage='false'>
|
|
|
|
|
<template v-slot:btns>
|
|
|
|
|
<el-table-column align='center' label="操作" width="100" header-align="center">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div>
|
|
|
|
|
<Button type="primary" style='margin-right:5px;margin-bottom:5px;' size="small"
|
|
|
|
|
@click="showPlan(scope.row.id)">发布任务</Button>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<Button type="primary" style='margin-right:5px;margin-bottom:5px;' size="small"
|
|
|
|
|
@click="editorPlan(scope.row.id,'editor')">编辑计划</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</template>
|
|
|
|
|
</xy-table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:isPage='false'>
|
|
|
|
|
<template v-slot:btns>
|
|
|
|
|
<el-table-column align='center' label="操作" width="100" header-align="center">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div>
|
|
|
|
|
<Button type="primary" style='margin-right:5px;margin-bottom:5px;' size="small"
|
|
|
|
|
@click="showPlan(scope.row.id)">查看/添加</Button>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<Button type="primary" style='margin-right:5px;margin-bottom:5px;' size="small"
|
|
|
|
|
@click="editorPlan(scope.row.id,'editor')">编辑</Button>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- <Button type="primary" style='margin-right:5px;margin-bottom:5px;' size="small"
|
|
|
|
|
@click="editorUnit('add',scope.row.id)">发起任务</Button> -->
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</template>
|
|
|
|
|
</xy-table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<addPlan ref='addPlan' @refresh='getList'></addPlan>
|
|
|
|
|
<showPlan ref='showPlan'></showPlan>
|
|
|
|
|
<addUnit ref='addUnit' @refresh='getList'></addUnit>
|
|
|
|
|
@ -91,7 +90,7 @@
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
textName: '',
|
|
|
|
|
stateObj:{},
|
|
|
|
|
stateObj:{},
|
|
|
|
|
select: {
|
|
|
|
|
keyword: '',
|
|
|
|
|
page: 1,
|
|
|
|
|
@ -146,7 +145,9 @@
|
|
|
|
|
id:5,
|
|
|
|
|
value:'审核不通过',
|
|
|
|
|
type:'warning'
|
|
|
|
|
}],
|
|
|
|
|
}],
|
|
|
|
|
currentTable:'',
|
|
|
|
|
currentTableList:[],
|
|
|
|
|
table: [
|
|
|
|
|
// {
|
|
|
|
|
// type:'selection',
|
|
|
|
|
@ -197,6 +198,11 @@
|
|
|
|
|
// prop: 'year',
|
|
|
|
|
// width: 80,
|
|
|
|
|
// },
|
|
|
|
|
{
|
|
|
|
|
label: "月份",
|
|
|
|
|
prop: 'monthName',
|
|
|
|
|
width: 120,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "工作项目",
|
|
|
|
|
prop: 'menu',
|
|
|
|
|
@ -339,10 +345,13 @@
|
|
|
|
|
computed: {
|
|
|
|
|
// 获取所有单元格合并数据
|
|
|
|
|
spanArr() {
|
|
|
|
|
if (!this.list.length) return []
|
|
|
|
|
const mergeCols = ['menu','level'] // 需要合并的列(字段)
|
|
|
|
|
const data = groupBy(this.list, 'menu')
|
|
|
|
|
return getMergeCells(data, this.table, mergeCols)
|
|
|
|
|
for(var k in this.currentTableList){
|
|
|
|
|
if (!this.currentTableList.length) return []
|
|
|
|
|
const mergeCols = ['monthName','menu','level'] // 需要合并的列(字段)
|
|
|
|
|
const data = groupBy(this.currentTableList, 'monthIndex')
|
|
|
|
|
// console.log("data",data)
|
|
|
|
|
return getMergeCells(data, this.table, mergeCols)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
@ -415,17 +424,86 @@
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.list = res.data
|
|
|
|
|
this.list = res.data
|
|
|
|
|
// this.currentTableList = this.groupByMonth(this.list)
|
|
|
|
|
let data = this.groupByMonth(this.list)
|
|
|
|
|
let data3 = []
|
|
|
|
|
let monthObj = this.sortByMonth()
|
|
|
|
|
Object.entries(data).forEach(([key, value]) => {
|
|
|
|
|
value.forEach((item,index) => {
|
|
|
|
|
let item1 = this.deepCloneObject(item)
|
|
|
|
|
item1.monthName = key;
|
|
|
|
|
data3.push({
|
|
|
|
|
rowindex:key+index,
|
|
|
|
|
monthIndex:monthObj[key],
|
|
|
|
|
...item1
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
this.currentTableList = data3
|
|
|
|
|
// this.currentTableList = Object.values(data1).reduce((acc, val) => acc.concat(val), []);
|
|
|
|
|
|
|
|
|
|
this.total = res.total
|
|
|
|
|
},
|
|
|
|
|
deepCloneObject(obj) {
|
|
|
|
|
let clone = {};
|
|
|
|
|
Object.keys(obj).forEach((key) => {
|
|
|
|
|
if (obj[key] instanceof Array) {
|
|
|
|
|
clone[key] = this.deepCloneArray(obj[key]);
|
|
|
|
|
} else if (typeof obj[key] === 'object' && obj[key] !== null) {
|
|
|
|
|
clone[key] = this.deepCloneObject(obj[key]);
|
|
|
|
|
} else {
|
|
|
|
|
clone[key] = obj[key];
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return clone;
|
|
|
|
|
},
|
|
|
|
|
deepCloneArray(arr) {
|
|
|
|
|
let clone = [];
|
|
|
|
|
arr.forEach((item, index) => {
|
|
|
|
|
if (Array.isArray(item)) {
|
|
|
|
|
clone[index] = this.deepCloneArray(item);
|
|
|
|
|
} else if (typeof item === 'object' && item !== null) {
|
|
|
|
|
clone[index] = this.deepCloneObject(item);
|
|
|
|
|
} else {
|
|
|
|
|
clone[index] = item;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return clone;
|
|
|
|
|
},
|
|
|
|
|
groupByMonth(originalArray) {
|
|
|
|
|
const groupedArrays = {};
|
|
|
|
|
originalArray.forEach(obj => {
|
|
|
|
|
obj.start_date.forEach(month => {
|
|
|
|
|
if (!groupedArrays[month]) {
|
|
|
|
|
groupedArrays[month] = [];
|
|
|
|
|
}
|
|
|
|
|
groupedArrays[month].push(obj);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
return groupedArrays;
|
|
|
|
|
},
|
|
|
|
|
sortByMonth(){
|
|
|
|
|
const now = new Date();
|
|
|
|
|
const currentMonth = now.getMonth(); // 获取当前月份(0-11,其中0代表一月)
|
|
|
|
|
const allMonths = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
|
|
|
|
|
const decemberAndPrevious = allMonths.slice(currentMonth);
|
|
|
|
|
const monthArr = [...decemberAndPrevious, ...allMonths.slice(0, currentMonth)]
|
|
|
|
|
const monthObj = {}
|
|
|
|
|
monthArr.map((item,index)=>{
|
|
|
|
|
monthObj[item] = index
|
|
|
|
|
})
|
|
|
|
|
return monthObj
|
|
|
|
|
},
|
|
|
|
|
spanMethod({
|
|
|
|
|
row,
|
|
|
|
|
colomn,
|
|
|
|
|
rowIndex,
|
|
|
|
|
columnIndex
|
|
|
|
|
}) {
|
|
|
|
|
|
|
|
|
|
return this.spanArr[rowIndex][columnIndex]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
changeYear(e) {
|
|
|
|
|
console.log(e)
|
|
|
|
|
@ -527,7 +605,10 @@
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
<style scoped>
|
|
|
|
|
/deep/ .monthName{
|
|
|
|
|
vertical-align: top!important;
|
|
|
|
|
}
|
|
|
|
|
/deep/ .el-icon-circle-close {
|
|
|
|
|
color: #fff
|
|
|
|
|
}
|
|
|
|
|
@ -548,6 +629,10 @@
|
|
|
|
|
::v-deep .el-table .cell.el-tooltip {
|
|
|
|
|
white-space: normal !important;
|
|
|
|
|
width: 100% !important;
|
|
|
|
|
}
|
|
|
|
|
::v-deep .el-collapse-item__header{
|
|
|
|
|
padding-left: 30px;
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
}
|
|
|
|
|
/* /deep/ .el-table__body tr.el-table__row--striped td {
|
|
|
|
|
background-color: #C0C4CC!important;
|
|
|
|
|
|