jihua renwu

master
lion 2 years ago
parent 4ecfbd8e9c
commit e917a47191

@ -709,7 +709,7 @@ export default {
show-overflow-tooltip={item.showOverflowTooltip ?? true}
align={item.align ?? "center"}
header-align={item.headerAlign ?? "center"}
class-name={`xy-table__row-fade ${item.className}`}
class-name={`xy-table__row-fade ${item.className} ${item.prop}`}
label-class-name={`xy-table__title-fade ${item.labelClassName}`}
selectable={item.selectable}
reserve-selection={item.reserveSelection}

@ -51,10 +51,10 @@ export const getMergeCells = (tableData = [], tableColumn = [], mergeCols = [])
export const groupBy = (arr, prop) => {
return arr.sort((a, b) => {
if (a[prop] < b[prop]) {
return 1;
return -1;
}
if (a[prop] > b[prop]) {
return -1;
return 1;
}
return 0;
});

@ -223,13 +223,13 @@
<div>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>参与对象
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>责任科室
</div>
<div class="xy-table-item-content" style="width:400px">
<el-radio-group v-model="form.name7" @change='changeName7'>
<el-radio :label="2">部门</el-radio>
<el-radio :label="1">人员</el-radio>
<el-radio :label="3">组别</el-radio>
<!-- <el-radio :label="1">人员</el-radio>
<el-radio :label="3">组别</el-radio> -->
</el-radio-group>
</div>
</div>

@ -51,7 +51,7 @@
</div>
</template>
<template v-slot:mission_level>
<div class="xy-table-item">
<!-- <div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>任务等级
</div>
@ -61,8 +61,8 @@
</el-option>
</el-select>
</div>
</div>
<div class="xy-table-item">
</div> -->
<!-- <div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>任务状态
</div>
@ -72,7 +72,7 @@
</el-option>
</el-select>
</div>
</div>
</div> -->
</template>
<template v-slot:mission_plan_id v-if="hasPlanId">
<div class="xy-table-item">
@ -591,13 +591,13 @@ import elSelectTree from '@/components/selectTree'
},
changeName7(e) {
if (e) {
this.form.accept_department_ids = []
this.form.accept_admin_ids = []
this.form.mission_groups = []
this.mission_groups_list = []
this.valueArr = []
this.valueMultiple = []
this.$forceUpdate()
// this.form.accept_department_ids = []
// this.form.accept_admin_ids = []
// this.form.mission_groups = []
// this.mission_groups_list = []
// this.valueArr = []
// this.valueMultiple = []
// this.$forceUpdate()
}
},
changeAudit(e) {
@ -736,7 +736,7 @@ import elSelectTree from '@/components/selectTree'
start_date: res?.start_date,
name: res?.name,
end_date: res?.end_date,
mission_level:res?.mission_level,
mission_level:0,
mission_plan_id:res?.mission_plan_id,
@ -981,14 +981,14 @@ import elSelectTree from '@/components/selectTree'
}
}
},
department_id(val){
if(val){
console.log('this.department_id',this.department_id)
this.form.mission_level = this.department_id
}else{
this.form.mission_level = 0
}
},
// department_id(val){
// if(val){
// console.log('this.department_id',this.department_id)
// this.form.mission_level = this.department_id
// }else{
// this.form.mission_level = 0
// }
// },
isShow(newVal) {
if (newVal) {

@ -72,7 +72,7 @@
</el-descriptions-item> -->
<el-descriptions-item span='4'>
<template slot="label">
参与对象
责任科室
</template>
<div v-if="showform.accept_admin&&showform.accept_admin.length>0">
<el-tag style='margin-right:10px' v-for='item in showform.accept_admin'>
@ -125,7 +125,7 @@
<template v-slot:missionlist>
<el-divider>任务情况</el-divider>
<Button :disabled="hasLocked" type="primary" style='margin-right:5px;margin-bottom:5px;'
@click="editorUnit('add')">添加子任务</Button>
@click="editorUnit('add')">发布任务</Button>
<xy-table
:list="mission_log"
stripe
@ -318,7 +318,7 @@
width: 80,
align:'center',
}, {
label: "参与对象",
label: "责任科室",
prop: '_names',
// width: 240,
align: 'left',

@ -26,9 +26,9 @@
<Button type="primary" style="margin-left: 10px;" @click="importTable(new Date().getTime().toString())">导出</Button>
<Poptip v-if='is_guiji||is_chuzhang' transfer confirm title="确认要删除吗?" @on-ok="deleteList">
<!-- <Poptip v-if='is_guiji||is_chuzhang' transfer confirm title="确认要删除吗?" @on-ok="deleteList">
<Button type="primary" style="margin-left:10px;" ghost>删除</Button>
</Poptip>
</Poptip> -->
</div>
</slot>
</lx-header>
@ -38,6 +38,9 @@
: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()}"
@ -53,9 +56,15 @@
<!-- <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> -->
<!-- <Poptip v-if='is_guiji||is_chuzhang' transfer confirm title="确认要删除吗?" @on-ok="deleteList(scope.row.id)">
<Button type="primary" size='small' style="margin-left:5px;margin-bottom:5px;" ghost>删除</Button>
</Poptip> -->
<div v-if='is_guiji||is_chuzhang||login_id==scope.row.admin_id'>
<Button type="primary" style='margin-left:10px;' @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" size='small' style="margin-left:5px;margin-bottom:5px;" ghost>删除</Button>
</Poptip>
</div>
</template>
</el-table-column>
</template>
@ -88,6 +97,10 @@
saveAs
} from "file-saver";
import state from '@/store/modules/user.js'
import {
getMergeCells,
groupBy
} from '@/utils/contactTable.js'
export default{
components:{
addPatrol,
@ -104,7 +117,7 @@
select:{
keyword:'',
page:1,
page_size:10,
page_size:9999,
status:'',
myself:0,
mission_id:'',
@ -179,21 +192,8 @@
}
],
table:[{
type:'selection',
// selectable:(row,index)=>{
// if((this.is_guiji||this.is_chuzhang||this.login_id==row.up_admin_id)&&row.status==0){
// return true
// }else{
// return false
// }
// }
},{
label:"任务名称",
prop:'mission',
align:'left',
formatter:(cell,data,value,index)=>{
return value?value.name:'日常巡查'
}
prop:'missionName',
// width:180
},{
label:"状态",
@ -395,6 +395,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)
}
}
},
created(){
// this.getUserId()
@ -468,9 +480,19 @@
// }
},
spanMethod({
row,
colomn,
rowIndex,
columnIndex
}) {
return this.spanArr[rowIndex][columnIndex]
},
async getList(){
const res = await listpatrol({...this.select})
for(var k of res.data){
k.missionName = k.mission?k.mission.name:'日常巡查'
console.log("k.missionName",k.missionName)
k.is_myself = false
if(k.status==2||k.status==3||k.status==4||k.status==7){
if(k.accept_admin_ids&&k.accept_admin_ids.length>0){
@ -703,6 +725,9 @@
</script>
<style scoped>
/deep/ .missionName{
vertical-align: top!important;
}
/deep/ .el-icon-circle-close{
color:#fff
}

@ -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-110
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;

@ -25,7 +25,7 @@
<Button type="primary" @click="getList" style="margin-right: 10px;">查询</Button>
<Button v-if="path_type!=5" type="primary" style="margin-right: 10px;"
@click="editorUnit('','add')">添加</Button>
<Button type="primary" v-if="path_type!=5" style='margin-right:10px' @click="chooseEditorUnit()"></Button>
<!-- <Button type="primary" v-if="path_type!=5" style='margin-right:10px' @click="chooseEditorUnit()"></Button> -->
</div>
</slot>
@ -37,6 +37,9 @@
: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()}"
@ -49,6 +52,9 @@
<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>
@ -60,6 +66,9 @@
<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>
@ -110,6 +119,10 @@
} from "@/api/system/dictionary.js";
import state from '@/store/modules/user.js'
import {contactGroup} from './js/index.js'
import {
getMergeCells,
groupBy
} from '@/utils/contactTable.js'
export default {
components: {
addUnit,
@ -137,7 +150,7 @@
select: {
keyword: '',
page: 1,
page_size: 10,
page_size: 9999,
myself: 0,
myself_department: 0,
type: '',
@ -215,7 +228,11 @@
askList:[],
list: [],
sectionList:[],
table: [{
table: [{
label: "月份",
prop: 'monthName',
// fixed:'left',
},{
label: "任务名称",
prop: 'name',
// fixed:'left',
@ -317,6 +334,18 @@
}
}],
}
},
computed: {
//
spanArr() {
for(var k in this.list){
if (!this.list.length) return []
const mergeCols = ['monthName'] //
const data = this.groupBy(this.list, 'monthIndex')
console.log("data",data)
return getMergeCells(data, this.table, mergeCols)
}
}
},
created() {
this.getLeads()
@ -336,16 +365,16 @@
this.select.type = 4
this.type_name = '专项专题任务'
this.path_type = path[1]
this.table.unshift({
type:'selection',
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
}
}
})
// this.table.unshift({
// type:'selection',
// 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
// }
// }
// })
// this.auditStatusList.push({
// id:5,
// value:'',
@ -482,14 +511,45 @@
this.select.start_date = "";
this.select.end_date = "";
}
},
spanMethod({
row,
colomn,
rowIndex,
columnIndex
}) {
return this.spanArr[rowIndex][columnIndex]
},
groupBy(arr, prop) {
return arr.sort((a, b) => {
if (a[prop] < b[prop]) {
return 1;
}
if (a[prop] > b[prop]) {
return -1;
}
return 0;
});
},
async getList() {
let res = await listunit({
...this.select
})
const allMonths = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
let monthObj = this.sortByMonth()
//
//
for(var r of res.data){
if(r.start_date){
let dateArr = r.start_date.split("-")
r.monthName = allMonths[parseInt(dateArr[1])-1]
let _index = monthObj[r.monthName]<10?"0"+monthObj[r.monthName]:monthObj[r.monthName]
r.monthIndex = parseInt(dateArr[0])+""+_index
console.log(r.monthName,r.monthIndex)
}
var _names = []
//
if(r.accept_admin_ids&&r.accept_admin_ids.length>0){
@ -572,8 +632,22 @@
}
this.list = res.data
this.total = res.total
}
this.total = res.total
},
sortByMonth(){
const now = new Date();
const currentMonth = now.getMonth(); // 0-110
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
},
},
}

Loading…
Cancel
Save