jihua renwu

master
lion 2 years ago
parent 789812132e
commit d8e9014934

@ -7,9 +7,9 @@
<Select filterable clearable style='width:150px;margin-right: 10px;' v-model="select.status" placeholder="检查状态">
<Option v-for="item in statusList" :value="item.id">{{item.value}}</Option>
</Select>
<Select filterable clearable style='width:150px;margin-right: 10px;' v-model="select.mission_id" placeholder="任务名称">
<!-- <Select filterable clearable style='width:150px;margin-right: 10px;' v-model="select.mission_id" placeholder="任务名称">
<Option v-for="item in missionList" :value="item.id">{{item.name}}</Option>
</Select>
</Select> -->
<Select filterable clearable style='width:150px;margin-right: 10px;' v-model="select.ask_id" placeholder="问题类型">
<Option v-for="item in askList" :value="item.id">{{item.value}}</Option>
</Select>
@ -34,45 +34,60 @@
</lx-header>
</div>
<!-- @cell-click="cellClicks" -->
<xy-table
:list="list"
:total="total"
stripe
:span-method="spanMethod"
:showIndex='false'
:isPage="false"
@cell-dblclick='cellClicks'
@selection-change='selectionChange'
@pageSizeChange="e => {select.page_size = e,getList()}"
@pageIndexChange="e => {select.page = e,getList()}"
:table-item="table">
<template v-slot:btns>
<el-table-column align='center' label="操作" width="80" header-align="center">
<template slot-scope="scope">
<div v-if="(is_guiji||is_chuzhang||scope.row.is_myself)&&!(scope.row.status==5||scope.row.status==6)">
<Button type="primary" style='margin-right:5px;margin-bottom:5px;' size="small" @click="showPatrol(scope.row.id,'show')"></Button>
</div>
<div v-else>
<Button size="small" style='margin-right:5px;margin-bottom:5px;' @click="showPatrol(scope.row.id,'show')"></Button>
<div class="tablewrap">
<div class="tablemonth">
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange"></el-checkbox>
<div style="margin: 15px 0;"></div>
<el-checkbox-group v-model="selectMission" @change="changeMonth">
<el-checkbox v-for="item in missionList" :label="item.name">{{item.name}}</el-checkbox>
</el-checkbox-group>
</div>
<div class="tablecontent">
<xy-table
:list="currentTableList"
:total="total"
stripe
:showIndex='false'
:isPage="false"
@cell-dblclick='cellClicks'
@selection-change='selectionChange'
@pageSizeChange="e => {select.page_size = e,getList()}"
@pageIndexChange="e => {select.page = e,getList()}"
:table-item="table">
<template v-slot:btns>
<el-table-column align='center' label="操作" width="80" header-align="center">
<template slot-scope="scope">
<div v-if="(is_guiji||is_chuzhang||scope.row.is_myself)&&!(scope.row.status==5||scope.row.status==6)">
<Button type="primary" style='margin-right:5px;margin-bottom:5px;' size="small" @click="showPatrol(scope.row.id,'show')"></Button>
</div>
<div v-else>
<Button size="small" style='margin-right:5px;margin-bottom:5px;' @click="showPatrol(scope.row.id,'show')"></Button>
</div>
<!-- <Button type="primary" style='margin-right:5px;margin-bottom:5px;' size="small" @click="showPatrol(scope.row.id,'show')"></Button> -->
<!-- <Button v-if="scope.row.status==1&&((scope.row.check_leader==1&&is_leader&&scope.row.leader_status===null)||(scope.row.check_main==1&&is_main_leader&&scope.row.main_status===null))" type="primary" style='margin-right:5px;margin-bottom:5px;' size="small" @click="showPatrol(scope.row.id,'leader')"></Button> -->
<!-- <Button v-if="scope.row.status==9&&((scope.row.re_check_leader==1&&is_leader&&scope.row.re_leader_status===null)||(scope.row.re_check_main==1&&is_main_leader&&scope.row.re_main_status===null))" type="primary" style='margin-right:5px;margin-bottom:5px;' size="small" @click="showPatrol(scope.row.id,'leaderconfirm')"></Button> -->
<div v-if='is_guiji||is_chuzhang||login_id==scope.row.admin_id'>
<Button type="primary" style='margin-right:5px;margin-bottom:5px;' size='small' @click="editorPatrol(scope.row.id,'editor')"></Button>
</div>
<div v-if='is_guiji||is_chuzhang'>
<Poptip transfer confirm title="确认要删除吗?" @on-ok="deleteList(scope.row.id)">
<Button type="primary" style='margin-right:5px;margin-bottom:5px;' size='small' ghost>删除</Button>
</Poptip>
</div>
</div>
<!-- <Button type="primary" style='margin-right:5px;margin-bottom:5px;' size="small" @click="showPatrol(scope.row.id,'show')"></Button> -->
<!-- <Button v-if="scope.row.status==1&&((scope.row.check_leader==1&&is_leader&&scope.row.leader_status===null)||(scope.row.check_main==1&&is_main_leader&&scope.row.main_status===null))" type="primary" style='margin-right:5px;margin-bottom:5px;' size="small" @click="showPatrol(scope.row.id,'leader')"></Button> -->
<!-- <Button v-if="scope.row.status==9&&((scope.row.re_check_leader==1&&is_leader&&scope.row.re_leader_status===null)||(scope.row.re_check_main==1&&is_main_leader&&scope.row.re_main_status===null))" type="primary" style='margin-right:5px;margin-bottom:5px;' size="small" @click="showPatrol(scope.row.id,'leaderconfirm')"></Button> -->
<div v-if='is_guiji||is_chuzhang||login_id==scope.row.admin_id'>
<Button type="primary" style='margin-right:5px;margin-bottom:5px;' size='small' @click="editorPatrol(scope.row.id,'editor')"></Button>
</div>
<div v-if='is_guiji||is_chuzhang'>
<Poptip transfer confirm title="确认要删除吗?" @on-ok="deleteList(scope.row.id)">
<Button type="primary" style='margin-right:5px;margin-bottom:5px;' size='small' ghost>删除</Button>
</Poptip>
</div>
</template>
</el-table-column>
</template>
</el-table-column>
</template>
</xy-table>
</xy-table>
</div>
</div>
<addPatrol ref='addPatrol' @refresh='getList'></addPatrol>
<showPatrol ref='showPatrol' @refresh='getList'></showPatrol>
</div>
@ -194,6 +209,10 @@
value:'退回'
}
],
currentTableList:[],
isIndeterminate:true,
checkAll:false,
selectMission:[],
table:[{
label:"任务名称",
prop:'missionName',
@ -398,18 +417,18 @@
}],
}
},
computed: {
//
spanArr() {
for(var k in this.list){
if (!this.list.length) return []
const mergeCols = ['missionName'] //
// const data = groupBy(this.list, 'monthIndex')
// console.log("data",data)
return getMergeCells(this.list, this.table, mergeCols)
}
}
},
// computed: {
// //
// spanArr() {
// for(var k in this.list){
// if (!this.list.length) return []
// const mergeCols = ['missionName'] //
// // const data = groupBy(this.list, 'monthIndex')
// // console.log("data",data)
// return getMergeCells(this.list, this.table, mergeCols)
// }
// }
// },
created(){
// this.getUserId()
@ -515,8 +534,40 @@
}
}
this.list = res.data
this.currentTableList = this.filterBySelectedMonths(this.list,this.selectMission)
console.log("currentTableList",this.currentTableList)
this.total = res.total
},
handleCheckAllChange(val) {
this.selectMission = val ? this.missionList : [];
this.isIndeterminate = false;
let _arr = []
_arr = this.filterBySelectedMonths(this.list,this.selectMission)
this.currentTableList = _arr
},
changeMonth(e){
let checkedCount = e.length;
this.checkAll = checkedCount === this.missionList.length;
this.isIndeterminate = checkedCount > 0 && checkedCount < this.missionList.length;
let _arr = []
_arr = this.filterBySelectedMonths(this.list,this.selectMission)
this.currentTableList = _arr
},
filterBySelectedMonths(arr, selectMission) {
if (!selectMission || selectMission.length === 0) {
return arr;
}
// Ensure selectMission is an array even if it's a single value
if (!Array.isArray(selectMission)) {
selectMission = [selectMission];
}
return arr.filter(obj => {
// Check if there's at least one common month between obj.month and selectMission
return selectMission.some(selected => obj.missionName.includes(selected));
});
},
async getMissonList(){
console.log("this.unitTypeList",this.unitTypeList)
const res = await getparameteritem('unitTypeList')
@ -728,6 +779,18 @@
</script>
<style scoped>
.tablewrap{
display:flex;
}
.tablemonth{
width:10%;
background: #fff;
padding: 20px;
margin-right:1%;
}
.tablecontent{
width:89%
}
/deep/ .v-table .el-table__body .missionName{
vertical-align: top!important;
}

@ -26,7 +26,17 @@
</slot>
</lx-header>
</div>
<xy-table :list="currentTableList"
<div class="tablewrap">
<div class="tablemonth">
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange"></el-checkbox>
<div style="margin: 15px 0;"></div>
<el-checkbox-group v-model="selectMonth" @change="changeMonth">
<el-checkbox v-for="item in allMonths" :label="item"></el-checkbox>
</el-checkbox-group>
</div>
<div class="tablecontent">
<xy-table :list="currentTableList"
:total="total"
:span-method="spanMethod"
row-key="rowindex"
@ -54,6 +64,9 @@
</el-table-column>
</template>
</xy-table>
</div>
</div>
@ -147,62 +160,13 @@
type:'warning'
}],
currentTable:'',
currentTableList:[],
currentTableList:[],
isIndeterminate:true,
checkAll:false,
selectMonth:[],
allMonths : ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
table: [
// {
// type:'selection',
// width:50,
// selectable:(row,index)=>{
// if(this.stateObj.login_id==row.admin_id||this.stateObj.is_guiji||this.stateObj.is_chuzhang||this.stateObj.is_admin){
// return true
// }else{
// return false
// }
// }
// },
// {
// type:'expand',
// width:50,
// expandFn:(row)=>{
// return(<div style={{"border-bottom": "1px solid #EBEEF5"}}>
// {
// row.row.mission.length>0?
// row.row.mission.map((item,index)=>{
// return(<div class='expandrow'>
// <p>{index+1}<span>:</span><span>{item.name}</span></p>
// <p><span>:</span><span>{
// this.auditStatusList.map(status=>{
// if(item.audit_status===status.id){
// return status.value
// }
// })
// }</span></p>
// <p><span>:</span><span>{item.start_date}</span></p>
// <p><span>:</span><span>{item.end_date}</span></p>
// <p><span>:</span><span>{item.unit_type_detail?item.unit_type_detail.value:''}</span></p>
// <p><span>:</span><span>{item.admin?item.admin.name:''}</span></p>
// <p><span>:</span><span>{item.department?item.department.name:''}</span></p>
// <p><span>:</span><span>{item.created_at.substring(0,11)}</span></p>
// </div>)
// })
// :<div class='expandrow'></div>
// }</div>)
// }
// },
// {
// label: "",
// prop: 'year',
// width: 80,
// },
{
label: "月份",
prop: 'monthName',
width: 120,
},
{
label: "工作项目",
prop: 'menu',
@ -347,8 +311,8 @@
spanArr() {
for(var k in this.currentTableList){
if (!this.currentTableList.length) return []
const mergeCols = ['monthName','menu','level'] //
const data = groupBy(this.currentTableList, 'monthIndex')
const mergeCols = ['menu','level'] //
const data = groupBy(this.currentTableList, 'id')
// console.log("data",data)
return getMergeCells(data, this.table, mergeCols)
}
@ -359,10 +323,21 @@
// this.getLeads()
this.stateObj = state.state
this.select.year = (new Date()).getFullYear() + ''
let currentMonth = this.allMonths[(new Date()).getMonth()]
this.selectMonth.push(currentMonth)
this.getList()
},
methods: {
spanMethod({
row,
colomn,
rowIndex,
columnIndex
}) {
return this.spanArr[rowIndex][columnIndex]
},
async getList() {
const res = await listplan({
...this.select
@ -426,25 +401,59 @@
}
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), []);
// 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 = this.filterBySelectedMonths(this.list,this.selectMonth)
console.log("this.currentTableList",this.currentTableList)
this.total = res.total
},
handleCheckAllChange(val) {
this.selectMonth = val ? this.allMonths : [];
this.isIndeterminate = false;
let _arr = []
_arr = this.filterBySelectedMonths(this.list,this.selectMonth)
this.currentTableList = _arr
},
changeMonth(e){
let checkedCount = e.length;
this.checkAll = checkedCount === this.allMonths.length;
this.isIndeterminate = checkedCount > 0 && checkedCount < this.allMonths.length;
let _arr = []
_arr = this.filterBySelectedMonths(this.list,this.selectMonth)
this.currentTableList = _arr
},
filterBySelectedMonths(arr, selectMonth) {
if (!selectMonth || selectMonth.length === 0) {
return arr;
}
// Ensure selectMonth is an array even if it's a single value
if (!Array.isArray(selectMonth)) {
selectMonth = [selectMonth];
}
return arr.filter(obj => {
// Check if there's at least one common month between obj.month and selectMonth
return obj.start_date.some(month => selectMonth.includes(month));
});
},
deepCloneObject(obj) {
let clone = {};
Object.keys(obj).forEach((key) => {
@ -495,16 +504,7 @@
})
return monthObj
},
spanMethod({
row,
colomn,
rowIndex,
columnIndex
}) {
return this.spanArr[rowIndex][columnIndex]
},
changeYear(e) {
console.log(e)
this.select.year = e
@ -606,6 +606,18 @@
</script>
<style scoped>
.tablewrap{
display:flex;
}
.tablemonth{
width:10%;
background: #fff;
padding: 20px;
margin-right:1%;
}
.tablecontent{
width:89%
}
/deep/ .v-table .el-table__body .monthName{
vertical-align: top!important;
}

@ -32,55 +32,68 @@
</lx-header>
</div>
<div class="tablewrap">
<div class="tablemonth">
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange"></el-checkbox>
<div style="margin: 15px 0;"></div>
<el-checkbox-group v-model="selectMonth" @change="changeMonth">
<el-checkbox v-for="item in allMonths" :label="item"></el-checkbox>
</el-checkbox-group>
</div>
<xy-table
:list="list"
:total="total"
stripe
:span-method="spanMethod"
:showIndex='false'
:isPage="false"
@cell-dblclick='cellClicks'
@selection-change='selectionChange'
@pageSizeChange="e => {select.page_size = e,getList()}"
@pageIndexChange="e => {select.page = e,getList()}"
:table-item="table">
<template v-slot:btns>
<el-table-column align='center' label="操作" width="100" header-align="center">
<template slot-scope="scope">
<template v-if="path_type!=5">
<div>
<Button type="primary" style='margin-right:5px;margin-bottom:5px;' size="small" @click="checkUnits(scope.row.id,'show')"></Button>
</div>
<div>
<Button style="margin-right:5px;margin-bottom:5px;" type="primary" size="small" @click="editorUnit(scope.row.id,'editor')"></Button>
</div>
<div>
<Button v-if="scope.row.audit_admin_id==stateObj.login_id&&scope.row.audit_status==0" style="margin-right:5px;margin-bottom:5px;" type="primary" size="small" @click="checkUnits(scope.row.id,'check')"></Button>
</div>
</template>
<template v-else>
<div v-for="item in unitTypeList">
<Button v-if="scope.row.unit_type==item.id&&scope.row.audit_status==1" type="primary" size="small" style="margin-right:5px;margin-bottom:5px;" @click="openMyMission(item.value,scope.row)">{{item.remark}}</Button>
<!-- <Button v-if="scope.row.unit_type==item.id" type="primary" size="small" style="margin-right:5px;margin-bottom:5px;" @click="openAsks(scope.row)"></Button>
<Button type="primary" size="small" style="margin-right:5px;margin-bottom:5px;" @click="$refs['addPatrol'].mission_id=scope.row.id,$refs['addPatrol'].isShow=true,$refs['addPatrol'].type='add'"></Button>
-->
</div>
<div>
<Button style="margin-right:5px;margin-bottom:5px;" type="primary" size="small" @click="editorUnit(scope.row.id,'editor')"></Button>
</div>
<div class="tablecontent">
<xy-table
:list="currentTableList"
:total="total"
stripe
:span-method="spanMethod"
:showIndex='false'
:isPage="false"
@cell-dblclick='cellClicks'
@selection-change='selectionChange'
@pageSizeChange="e => {select.page_size = e,getList()}"
@pageIndexChange="e => {select.page = e,getList()}"
:table-item="table">
<template v-slot:btns>
<el-table-column align='center' fixed="right" label="操作" width="100" header-align="center">
<template slot-scope="scope">
<template v-if="path_type!=5">
<div>
<Button type="primary" style='margin-right:5px;margin-bottom:5px;' size="small" @click="checkUnits(scope.row.id,'show')"></Button>
</div>
<div>
<Button style="margin-right:5px;margin-bottom:5px;" type="primary" size="small" @click="editorUnit(scope.row.id,'editor')"></Button>
</div>
<div>
<Button v-if="scope.row.audit_admin_id==stateObj.login_id&&scope.row.audit_status==0" style="margin-right:5px;margin-bottom:5px;" type="primary" size="small" @click="checkUnits(scope.row.id,'check')"></Button>
</div>
</template>
<template v-else>
<div v-for="item in unitTypeList">
<Button v-if="scope.row.unit_type==item.id&&scope.row.audit_status==1" type="primary" size="small" style="margin-right:5px;margin-bottom:5px;" @click="openMyMission(item.value,scope.row)">{{item.remark}}</Button>
<!-- <Button v-if="scope.row.unit_type==item.id" type="primary" size="small" style="margin-right:5px;margin-bottom:5px;" @click="openAsks(scope.row)"></Button>
<Button type="primary" size="small" style="margin-right:5px;margin-bottom:5px;" @click="$refs['addPatrol'].mission_id=scope.row.id,$refs['addPatrol'].isShow=true,$refs['addPatrol'].type='add'"></Button>
-->
</div>
<div>
<!-- <Button style="margin-right:5px;margin-bottom:5px;" type="primary" size="small" @click="editorUnit(scope.row.id,'editor')"></Button> -->
</div>
<div>
<Button style='margin-right:5px;margin-bottom:5px;' type="primary" size="small" @click="checkUnits(scope.row.id,'show')"></Button>
</div>
</template>
<div>
<Button style='margin-right:5px;margin-bottom:5px;' type="primary" size="small" @click="checkUnits(scope.row.id,'show')"></Button>
<Button style='margin-right:5px;margin-bottom:5px;' size="small" @click="backPlan(scope.row)"></Button>
</div>
</template>
<div>
<Button style='margin-right:5px;margin-bottom:5px;' size="small" @click="backPlan(scope.row)"></Button>
</div>
</template>
</el-table-column>
</template>
</el-table-column>
</template>
</xy-table>
</xy-table>
</div>
</div>
<el-dialog
title="提示"
@ -227,16 +240,21 @@
unitTypeList: [],
askList:[],
list: [],
sectionList:[],
table: [{
label: "月份",
prop: 'monthName',
// fixed:'left',
},{
sectionList:[],
currentTableList:[],
isIndeterminate:true,
checkAll:false,
selectMonth:[],
allMonths : ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
table: [{
label: "任务名称",
prop: 'name',
// fixed:'left',
align:'left',
align:'left',
width:300,
fixed:'left'
}, {
label: "状态",
prop: 'audit_status',
@ -338,10 +356,10 @@
computed: {
//
spanArr() {
for(var k in this.list){
if (!this.list.length) return []
for(var k in this.currentTableList){
if (!this.currentTableList.length) return []
const mergeCols = ['monthName'] //
const data = this.groupBy(this.list, 'monthIndex')
const data = this.groupBy(this.currentTableList, 'monthIndex')
console.log("data",data)
return getMergeCells(data, this.table, mergeCols)
}
@ -350,7 +368,8 @@
created() {
this.getLeads()
this.stateObj = state.state
console.log("state111",this.stateObj)
let currentMonth = this.allMonths[(new Date()).getMonth()]
// this.selectMonth.push(currentMonth)
if (this.$route.path) {
let path = this.$route.path.split("_")
this.select.type = path[1]
@ -360,11 +379,13 @@
this.select.myself = 1
this.type_name = '我的任务'
this.path_type = path[1]
this.selectMonth.push(currentMonth)
}
if(path[1]==4){
this.select.type = 4
this.type_name = '专项专题任务'
this.path_type = path[1]
this.selectMonth = this.allMonths
// this.table.unshift({
// type:'selection',
// selectable:(row,index)=>{
@ -387,8 +408,7 @@
// })
}
}
this.getUnitTypeList()
this.getUnitTypeList()
this.getList()
},
@ -530,12 +550,13 @@
}
return 0;
});
},
},
async getList() {
let res = await listunit({
...this.select
})
const allMonths = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
const allMonths = this.allMonths
let monthObj = this.sortByMonth()
//
@ -631,10 +652,43 @@
}
}
this.list = res.data
this.list = res.data
this.currentTableList = this.filterBySelectedMonths(this.list,this.selectMonth)
console.log("this.currentTableList",this.currentTableList)
this.total = res.total
},
handleCheckAllChange(val) {
this.selectMonth = val ? this.allMonths : [];
this.isIndeterminate = false;
let _arr = []
_arr = this.filterBySelectedMonths(this.list,this.selectMonth)
this.currentTableList = _arr
},
changeMonth(e){
let checkedCount = e.length;
this.checkAll = checkedCount === this.allMonths.length;
this.isIndeterminate = checkedCount > 0 && checkedCount < this.allMonths.length;
let _arr = []
_arr = this.filterBySelectedMonths(this.list,this.selectMonth)
this.currentTableList = _arr
},
filterBySelectedMonths(arr, selectMonth) {
if (!selectMonth || selectMonth.length === 0) {
return arr;
}
// Ensure selectMonth is an array even if it's a single value
if (!Array.isArray(selectMonth)) {
selectMonth = [selectMonth];
}
return arr.filter(obj => {
// Check if there's at least one common month between obj.month and selectMonth
// return obj.start_date.some(month => selectMonth.includes(month));
return selectMonth.some(selected => obj.monthName.includes(selected));
});
},
sortByMonth(){
const now = new Date();
@ -654,6 +708,18 @@
</script>
<style scoped>
.tablewrap{
display:flex;
}
.tablemonth{
width:10%;
background: #fff;
padding: 20px;
margin-right:1%
}
.tablecontent{
width:89%
}
::v-deep .el-table .cell.el-tooltip {
white-space: normal !important;
width: 100% !important;

Loading…
Cancel
Save