You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

277 lines
8.8 KiB

<template>
<div style="padding: 0 20px">
<div ref="lxHeader">
<lx-header icon="md-apps" text="任务大纲" style="margin-bottom: 10px; border: 0px;">
<slot>
<div style="display: flex;justify-content: flex-start;flex-wrap: wrap;">
<DatePicker style='width:200px;margin-right: 10px;' placeholder="年份" placement="bottom" format='yyyy'
type="year" @on-change="changeYear"></DatePicker>
<Input v-model="select.keyword" clearable style="width: 200px;margin-right: 10px;" placeholder="关键字搜索" />
<!-- has_mission_plans -->
<Select clearable style='width:200px;margin-right: 10px;' v-model="select.has_mission_plans"
placeholder="是否已发布计划">
<Option v-for="item in hasMissionList" :value="item.id">{{item.value}}</Option>
</Select>
<Select clearable style='width:200px;margin-right: 10px;' v-model="select.has_missions"
placeholder="是否已发布任务">
<Option v-for="item in hasMissionList" :value="item.id">{{item.value}}</Option>
</Select>
<Button type="primary" @click="getList">查询</Button>
<Button type="primary" style="margin-left: 10px;" @click="editorOutline('','add')">添加</Button>
</div>
</slot>
</lx-header>
</div>
<!-- @cell-click="cellClicks" -->
<xy-table :list="mission_log" :table-item="missionLogTable" :showIndex='false' :isPage='false'
:span-method="spanMethod">
has_mission
<template v-slot:has_mission>
<el-table-column align='center' label="是否创建计划或专项任务" fixed="right" width="120" header-align="center">
<template slot-scope="scope">
<div v-if="scope.row.mission_plans.length>0">
已创建计划
</div>
<div v-if="scope.row.missions.length>0">
已创建专项任务
</div>
</template>
</el-table-column>
</template>
<template v-slot:btns>
<el-table-column align='center' label="操作" fixed="right" width="120" header-align="center">
<template slot-scope="scope">
<div>
<Button type="primary" style='margin-right:5px;margin-bottom:5px;' size="small"
@click="editPlan(scope.row,'add')">年度计划</Button>
</div>
<div>
<Button type="primary" style='margin-right:5px;margin-bottom:5px;' size="small"
@click="editUnit(scope.row,4)">专题任务</Button>
</div>
<div>
<Button type="primary" style='margin-right:5px;margin-bottom:5px;' size="small"
@click="editorOutline(scope.row.id,'editor')">编辑大纲</Button>
</div>
</template>
</el-table-column>
</template>
</xy-table>
<addOutline ref="addOutline" @refresh="getList"></addOutline>
<addPlan ref="addPlan" @refresh="getList"></addPlan>
<addUnit ref="addUnit" @toUnit="getList" @refresh="getList"></addUnit>
</div>
</template>
<script>
import {
index,
destroy
} from '@/api/task/newplan.js'
import {
getparameteritem
} from "@/api/system/dictionary.js";
import {
getMergeCells,
groupBy
} from '@/utils/contactTable.js'
import addOutline from '../list/components/addOutline.vue'
import addPlan from '../list/components/addPlan.vue'
import addUnit from '../list/components/addUnit.vue'
import state from '@/store/modules/user.js'
export default {
components: {
addOutline,
addPlan,
addUnit,
},
data() {
return {
select: {
keyword: '',
table_name: 'new_plans',
page: 1,
page_size: 99999,
year: new Date().getFullYear(),
sort_name: 'created_at',
sort_type: 'ASC',
has_mission_plans:'',
has_missions:''
},
hasMissionList:[{
id:0,
value:'否',
},{
id:1,
value:'是',
}],
menuList: [],
mission_log: [],
missionLogTable: [{
label: "工作项目",
prop: 'menu',
align: 'center',
fixed: 'left',
width: 120
}, {
label: "性质级别",
prop: 'level',
width: 120,
align: 'center',
fixed: 'left'
}, {
label: "工作内容",
prop: 'work_content',
align: 'left',
width: 240
},{
label: "要求",
prop: 'work_require',
align: 'left',
width: 240
},{
label: "主要工作",
prop: 'content',
align: 'left',
width: 240
}, {
label: "工作周期",
prop: 'period',
width: 120
}, {
label: "工作步骤",
prop: 'require',
width: 240
}, {
label: "完成时间",
prop: 'end_time',
width: 120,
align: 'center'
}, {
label: "责任科室",
prop: 'duty_dep_id',
width: 120
}, {
label: "参与科室",
prop: 'join_dep_id',
width: 120,
}, {
label: "具体流程概述",
prop: 'flow',
width: 240,
align: 'left'
}, {
label: "所需资源概述",
prop: 'resource',
width: 240,
align: 'left'
},{
label: "是否已创建计划或专项任务",
prop: 'has_mission',
width: 240,
align: 'left'
}],
}
},
computed: {
// 获取所有单元格合并数据
spanArr() {
if (!this.missionLogTable.length) return []
const mergeCols = ['menu', 'level'] // 需要合并的列(字段)
const data = groupBy(this.mission_log, 'sort')
return getMergeCells(data, this.missionLogTable, mergeCols)
}
},
created() {
// this.getMenuList()
this.stateObj = state.state
this.getList()
},
methods: {
async getMenuList() {
const res = await getparameteritem('main_level')
this.menuList = res.detail
},
async getList() {
const res = await index({
...this.select,
has_mission_plans:this.select.has_mission_plans?this.select.has_mission_plans:(this.select.has_mission_plans===0?0:''),
has_missions:this.select.has_missions?this.select.has_missions:(this.select.has_missions===0?0:''),
'with_relations[0]':"missionPlans",
'with_relations[1]':"missions",
filter: [{
key: 'year',
op: 'eq',
value: this.select.year
}, {
key: 'content',
op: 'like',
value: this.select.keyword
}],
})
this.mission_log = res.data
},
changeYear(e) {
if (e) {
this.select.year = e
}else{
this.select.year = new Date().getFullYear()
}
},
spanMethod({
row,
colomn,
rowIndex,
columnIndex
}) {
return this.spanArr[rowIndex][columnIndex]
},
editorOutline(id, type) {
if (id) {
this.$refs.addOutline.id = id
}
this.$refs.addOutline.setMissionId(this.id)
this.$refs.addOutline.setName(`${this.select.year}任务大纲`)
this.$refs.addOutline.type = type
// this.$refs.addOutline.menuList = this.menuList
this.$refs.addOutline.isShow = true
},
editUnit(row,type){
this.$refs.addUnit.type="add"
this.$refs.addUnit.setoutLineId(row.id)
this.$refs.addUnit.setType(type)
this.$refs.addUnit.setNameContent(row.content,row.flow)
this.$refs.addUnit.setMenuLevel(row.menu,row.level,row.menu_id,row.level_id)
this.$refs.addUnit.setMainId(this.stateObj.department_id,this.stateObj.login_id)
this.$refs.addUnit.isShow = true
},
editPlan(row,type){
this.$refs.addPlan.type="add"
this.$refs.addPlan.setMenuLevel(row)
this.$refs.addPlan.setMainId(this.stateObj.department_id,this.stateObj.login_id)
this.$refs.addPlan.isShow = true
},
toUrlPlan(){
this.$router.push('/task/list/plan_1')
},
toUrlUnit(e){
this.$router.push('/task/list/unit_4')
},
},
watch: {}
}
</script>
<style scoped>
::v-deep .el-table .cell.el-tooltip {
white-space: normal !important;
}
</style>