6 changed files with 386 additions and 25 deletions
@ -0,0 +1,292 @@ |
|||||
|
<template > |
||||
|
<div class="g-main"> |
||||
|
<div class="m-table"> |
||||
|
<div class="u-table-btn2"> |
||||
|
|
||||
|
<div class="u-table-btn2-left"> |
||||
|
<el-button style="" |
||||
|
size="small" |
||||
|
class="diy-button--blue" |
||||
|
icon="el-icon-plus" |
||||
|
@click="handlereturn()">返回</el-button> |
||||
|
<el-button style="" |
||||
|
size="small" |
||||
|
class="diy-button--blue" |
||||
|
icon="el-icon-plus" |
||||
|
@click="handleAdd({},'add')">新增分类</el-button> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="m-table-item"> |
||||
|
<el-table :data="tableList" style="width: 100%;margin-bottom: 20px;" row-key="id" border |
||||
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"> |
||||
|
<el-table-column prop="categoryName" label="事件类型"> |
||||
|
</el-table-column> |
||||
|
<el-table-column label="操作" |
||||
|
fixed="right" |
||||
|
header-align="center" |
||||
|
align="center" |
||||
|
class="operate"> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-button |
||||
|
v-if="scope.row.pid==0" |
||||
|
type="text" |
||||
|
class="div-table-button--blue" |
||||
|
size="small" |
||||
|
@click="handleAdd(scope.row,'add0')">添加二级分类</el-button> |
||||
|
<el-button |
||||
|
type="text" |
||||
|
class="div-table-button--blue" |
||||
|
size="small" |
||||
|
@click="handleAdd(scope.row,'edit')">修改</el-button> |
||||
|
|
||||
|
<el-button |
||||
|
type="text" |
||||
|
class="div-table-button--blue" |
||||
|
size="small" |
||||
|
@click="handleDelete(scope.row)">删除</el-button> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
<div> |
||||
|
<el-pagination @size-change="handleSizeChange" |
||||
|
@current-change="handleCurrentChange" |
||||
|
:current-page.sync="pageNo" |
||||
|
:page-sizes="[20, 50, 100, 200]" |
||||
|
:page-size="pageSize" |
||||
|
layout="sizes, prev, pager, next, total" |
||||
|
:total="total"> |
||||
|
</el-pagination> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<el-dialog :visible.sync="formShow" |
||||
|
:close-on-click-modal="false" |
||||
|
:close-on-press-escape="false" |
||||
|
:title="formTitle" |
||||
|
width="670px" |
||||
|
top="5vh" |
||||
|
class="dialog-h" |
||||
|
@closed="diaClose"> |
||||
|
|
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { requestPost,requestGet } from "@/js/dai/request"; |
||||
|
import { mapGetters } from 'vuex' |
||||
|
import { Loading } from 'element-ui' // 引入Loading服务 |
||||
|
import axios from 'axios' |
||||
|
let loading // 加载动画 |
||||
|
export default { |
||||
|
data () { |
||||
|
return { |
||||
|
searchHeight: 0,//搜索栏高度, |
||||
|
pageNo:0, |
||||
|
pageSize:20, |
||||
|
total:0, |
||||
|
formTitle:"", |
||||
|
formShow:false, |
||||
|
tableData: [], |
||||
|
tableList:[] |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
activated () { |
||||
|
|
||||
|
}, |
||||
|
async mounted () { |
||||
|
console.log("dsfjsdklf"); |
||||
|
this.getCategoryTree() |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
//事件类型统计 |
||||
|
async getCategoryTree() { |
||||
|
const url = "/governance/icEvent/getCategoryTree"; |
||||
|
let param = { |
||||
|
endDate : "2025-12-31 23:59:59", |
||||
|
startDate : "2025-01-01 00:00:00", |
||||
|
usableFlag: true |
||||
|
} |
||||
|
const { data, code, msg } = await requestPost(url, param); |
||||
|
if (code === 0) { |
||||
|
this.tableList = data |
||||
|
// this.tableList=this.flattenTree(data); |
||||
|
console.log(this.tableList); |
||||
|
console.log(this.tableList, "lksdjfklj s"); |
||||
|
} else { |
||||
|
this.$message.error(msg); |
||||
|
} |
||||
|
}, |
||||
|
handlereturn(){ |
||||
|
this.$emit('close') |
||||
|
}, |
||||
|
async loadTable () { |
||||
|
const url = "/governance/commonServiceType/treeList" |
||||
|
let {data,msg,code } = await requestGet(url) |
||||
|
if(code == 0){ |
||||
|
this.tableData = data |
||||
|
}else{ |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
diaClose () { |
||||
|
this.$refs.ref_form.resetData() |
||||
|
this.formShow = false |
||||
|
}, |
||||
|
addFormOk () { |
||||
|
this.formShow = false |
||||
|
this.loadTable() |
||||
|
}, |
||||
|
addFormCancle () { |
||||
|
this.formShow = false |
||||
|
}, |
||||
|
async handleDetail (row) { |
||||
|
this.detailShow = true |
||||
|
const _data = await this.detail(row) |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.ref_form_detail.initForm(_data) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
handleAdd (row,type) { |
||||
|
if(type=="add"){ |
||||
|
console.log(row.id); |
||||
|
this.formTitle = '新增分类' |
||||
|
this.formShow = true |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.ref_form.initForm(type, row) |
||||
|
}) |
||||
|
} else if(type=="add0"){ |
||||
|
this.formTitle = '新增分类' |
||||
|
this.formShow = true |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.ref_form.initForm(type, row) |
||||
|
}) |
||||
|
} else if (type == 'edit') { |
||||
|
this.formTitle = '修改分类' |
||||
|
this.formShow = true |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.ref_form.initForm(type, row) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
selectAll (selection) { |
||||
|
|
||||
|
this.selection = selection |
||||
|
|
||||
|
|
||||
|
}, |
||||
|
selectionChange (selection) { |
||||
|
this.selection = selection |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
async handleDelete (row) { |
||||
|
|
||||
|
this.$confirm("确认删除?", "提示", { |
||||
|
confirmButtonText: "确定", |
||||
|
cancelButtonText: "取消", |
||||
|
type: "warning" |
||||
|
}) |
||||
|
.then(() => { |
||||
|
this.deleteDemand(row) |
||||
|
}) |
||||
|
.catch(err => { |
||||
|
if (err == "cancel") { |
||||
|
this.$message({ |
||||
|
type: "info", |
||||
|
message: "已取消删除" |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
}, |
||||
|
async deleteDemand (row) { |
||||
|
const url = `/governance/commonServiceType/delete/${row.id}` |
||||
|
const { data, code, msg } = await requestPost(url) |
||||
|
if (code === 0) { |
||||
|
this.$message({ |
||||
|
type: "success", |
||||
|
message: "删除成功" |
||||
|
}); |
||||
|
this.loadTable() |
||||
|
} else if (code > 8000) { |
||||
|
this.$message({ |
||||
|
message: msg, |
||||
|
duration: 0 |
||||
|
}) |
||||
|
this.loadTable() |
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
handleDiyClose () { |
||||
|
this.diyDialog = false; |
||||
|
}, |
||||
|
handleClose (done) { |
||||
|
this.diyDialog = false |
||||
|
}, |
||||
|
|
||||
|
handleSizeChange (val) { |
||||
|
this.pageSize = val |
||||
|
this.pageNo = 1 |
||||
|
this.loadTable() |
||||
|
}, |
||||
|
handleCurrentChange (val) { |
||||
|
this.pageNo = val |
||||
|
this.loadTable() |
||||
|
}, |
||||
|
|
||||
|
// 开启加载动画 |
||||
|
startLoading () { |
||||
|
loading = Loading.service({ |
||||
|
lock: true, // 是否锁定 |
||||
|
text: '正在加载……', // 加载中需要显示的文字 |
||||
|
background: 'rgba(0,0,0,.7)' // 背景颜色 |
||||
|
}) |
||||
|
}, |
||||
|
// 结束加载动画 |
||||
|
endLoading () { |
||||
|
// clearTimeout(timer); |
||||
|
if (loading) { |
||||
|
loading.close() |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
computed: { |
||||
|
tableHeight () { |
||||
|
console.log(this.searchHeight) |
||||
|
let height = this.searchHeight + 270 |
||||
|
return this.$store.state.inIframe ? this.clientHeight - height + this.iframeHeight : this.clientHeight - height |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
...mapGetters(['clientHeight', 'iframeHeight']) |
||||
|
}, |
||||
|
watch: { |
||||
|
}, |
||||
|
props: { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
<style lang="scss" scoped > |
||||
|
@import "@/assets/scss/modules/management/list-main.scss"; |
||||
|
</style> |
||||
|
|
||||
|
<style > |
||||
|
.el-message.is-closable .el-message__content { |
||||
|
line-height: 20px; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
|
Loading…
Reference in new issue