forked from xxhjsb/hbt-prevention-ui
185 lines
4.8 KiB
Vue
185 lines
4.8 KiB
Vue
|
|
<script lang="ts">
|
|
import { Component } from 'vue-property-decorator';
|
|
import template from "./duty.component.html"
|
|
import BaseRecordComponent from "hbt-common/components/common/baseRecord.component.vue"
|
|
import FormComponent from "hbt-common/components/common/form.component.vue"
|
|
import TableComponent from "hbt-common/components/common/table.component.vue"
|
|
import DutyService from "@/service/duty.service"
|
|
import FormOption from "hbt-common/models/formOptions"
|
|
import BtnOption from "hbt-common/models/btnOptions"
|
|
import DrawComponent from '@/components/draw.component.vue';
|
|
@Component({
|
|
template,
|
|
components:{
|
|
FormComponent,
|
|
TableComponent,
|
|
DrawComponent,
|
|
},
|
|
})
|
|
export default class DutyManagerComponent extends BaseRecordComponent<any> {
|
|
public tableService = new DutyService();
|
|
|
|
public params = {} as any;
|
|
|
|
public treeData = [{
|
|
label: '一级 1',
|
|
children: [{
|
|
label: '二级 1-1',
|
|
children: [{
|
|
label: '三级 1-1-1'
|
|
}]
|
|
}]
|
|
}, {
|
|
label: '一级 2',
|
|
children: [{
|
|
label: '二级 2-1',
|
|
children: [{
|
|
label: '三级 2-1-1'
|
|
}]
|
|
}, {
|
|
label: '二级 2-2',
|
|
children: [{
|
|
label: '三级 2-2-1'
|
|
}]
|
|
}]
|
|
}, {
|
|
label: '一级 3',
|
|
children: [{
|
|
label: '二级 3-1',
|
|
children: [{
|
|
label: '三级 3-1-1'
|
|
}]
|
|
}, {
|
|
label: '二级 3-2',
|
|
children: [{
|
|
label: '三级 3-2-1'
|
|
}]
|
|
}]
|
|
}]
|
|
|
|
public formActions = [{
|
|
name:"查询",
|
|
value:"search",
|
|
icon:"el-icon-search",
|
|
type:"primary"
|
|
},{
|
|
name:"清空",
|
|
icon:"el-icon-tickets",
|
|
value:"reset"
|
|
}];
|
|
public tableActions = [{
|
|
name:"批量删除",
|
|
value:"delete",
|
|
plain:true,
|
|
icon:"el-icon-delete",
|
|
type:"danger"
|
|
}];
|
|
public footerActions = [{
|
|
name:"选择全部",
|
|
value:"selectAll",
|
|
type:"primary"
|
|
},{
|
|
name:"反向选择",
|
|
value:"reverse"
|
|
}];
|
|
public formOptions:FormOption<BtnOption>[] = [{
|
|
name:"区域名称",
|
|
key:"areaId",
|
|
type:"text",
|
|
},{
|
|
name:"单元名称",
|
|
key:"unitId",
|
|
type:"text",
|
|
}];
|
|
|
|
public showUpdate = false;
|
|
public updateParams = {} as any;
|
|
public selectData = [];
|
|
|
|
created(){
|
|
|
|
}
|
|
// 树点击
|
|
public handleNodeClick(data){
|
|
console.log(data)
|
|
}
|
|
|
|
public buildTable(){
|
|
this.tableColumn.push({name:'序号',key:"index"});
|
|
this.tableColumn.push({name:'管控对象',key:"deptName"});
|
|
this.tableColumn.push({name:'分析对象',key:"deptName"});
|
|
this.tableColumn.push({name:'管控措施',key:"deptName"});
|
|
this.tableColumn.push({name:'隐患排查任务',key:"person"});
|
|
this.tableColumn.push({name:'结束时间',key:"person"});
|
|
this.tableColumn.push({name:'责任人',key:"person"});
|
|
this.tableColumn.push({name:'生成时间',key:"person"});
|
|
this.tableColumn.push({name:'任务状态', width:"110px",key:"status",render:(data)=>{
|
|
if(data.status==0){
|
|
return "<span class='noDraw'>未绘制</span>"
|
|
}else{
|
|
return "<span>已绘制</span>"
|
|
}
|
|
}});
|
|
}
|
|
|
|
public callback(data){
|
|
// 查询
|
|
if(data.value==="search"){
|
|
this.getTableData()
|
|
// 重置
|
|
}else if(data.value === "reset"){
|
|
this.reset()
|
|
// 反选
|
|
}else if(data.value === "reverse"){
|
|
this.toggleAll()
|
|
// 全选
|
|
}else if(data.value === "selectAll"){
|
|
this.selectAll()
|
|
}else if(data.value === "delete"){
|
|
this.deleteData(this.selectData.map((item:any)=>item.id))
|
|
}
|
|
}
|
|
// 重置数据
|
|
public reset(){
|
|
this.params = {
|
|
pageNum:1,
|
|
pageSize:20,
|
|
} as any;
|
|
}
|
|
// 删除数据
|
|
|
|
|
|
|
|
public showUpdateModel(id){
|
|
this.showUpdate = true
|
|
}
|
|
|
|
public handleClose(){
|
|
this.showUpdate = false;
|
|
}
|
|
|
|
|
|
public toggleAll() {
|
|
(this.$refs.multipleTable as any).toggleAllSelection();
|
|
}
|
|
public selectAll(){
|
|
if(!this.selectData.length){
|
|
this.toggleAll()
|
|
}else{
|
|
this.tableData.datas.forEach((item,index)=>{
|
|
const find = this.selectData.find((data:any)=>data.userId === item.userId);
|
|
if(!find){
|
|
(this.$refs.multipleTable as any).toggleRowSelection(item);
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
public handleSelectionChange(data){
|
|
this.selectData = data;
|
|
}
|
|
}
|
|
</script>
|
|
<style lang="scss" scoped src="../../common.component.scss"></style>
|