2 changed files with 814 additions and 0 deletions
@ -0,0 +1,407 @@ |
|||||
|
<template> |
||||
|
<div class="role-container resi-container"> |
||||
|
<el-card class="flex1 resi-card-table"> |
||||
|
|
||||
|
<div class="resi-row-btn"> |
||||
|
<!-- <div v-if="isManager" class="resi-row-btn"> --> |
||||
|
<!-- 上下拖动可改变角色顺序 |
||||
|
<el-button style="margin-left:10px" |
||||
|
type="primary" |
||||
|
size="small" |
||||
|
@click="handleSaveSort" class="diy-button--white">保存顺序</el-button> --> |
||||
|
<el-button type="primary" size="small" @click="handleAdd" class="diy-button-add">新增</el-button> |
||||
|
</div> |
||||
|
<el-table ref="roleTable" v-loading="loading1" :data="tableData" border :height="tableHeight" |
||||
|
class="resi-table" style="width: 100%;margin-top:20px"> |
||||
|
<el-table-column label="序号" type="index" header-align="left" align="left" width="50"></el-table-column> |
||||
|
|
||||
|
<el-table-column prop="categoryName" header-align="left" align="left" label="分类名称" |
||||
|
width="250"></el-table-column> |
||||
|
|
||||
|
<el-table-column prop="status" label="状态" header-align="left" align="left"> |
||||
|
<template slot-scope="scope"> |
||||
|
<p style="color:red" v-if="scope.row.revision===0">{{'可用'}}</p> |
||||
|
<p v-else>{{'禁用'}}</p> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="categoryTypeName" label="类型" header-align="left" align="left"> |
||||
|
</el-table-column> |
||||
|
<el-table-column v-if="isManager" width="450" label="操作"> |
||||
|
<template slot-scope="scope"> |
||||
|
|
||||
|
<el-button v-if="scope.row.revision===0" type="text" size="small" |
||||
|
class="div-table-button--detail" @click="confirmChangeState(scope.row,'1')">禁用</el-button> |
||||
|
<el-button v-if="scope.row.revision===1" type="text" size="small" |
||||
|
class="div-table-button--detail" @click="confirmChangeState(scope.row,'0')">启用</el-button> |
||||
|
|
||||
|
<el-button type="text" size="small" class="div-table-button--edit" |
||||
|
@click="handleEdit(scope.row)">修改</el-button> |
||||
|
|
||||
|
<el-button type="text" size="small" class="div-table-button--delete" |
||||
|
@click="confirmDel(scope.row)">删除</el-button> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
|
||||
|
</el-card> |
||||
|
|
||||
|
<!-- 修改弹出框 --> |
||||
|
<el-dialog :visible.sync="diaShow" :close-on-click-modal="false" :close-on-press-escape="false" |
||||
|
:title="diaTitle" width="750px" top="5vh" class="dialog-h" @closed="diaClose"> |
||||
|
<div class="div_duty dialog-h-content scroll-h" v-if="diaShow"> |
||||
|
<el-form label-width="100px"> |
||||
|
<!-- <el-form-item label="分类归属类别"> |
||||
|
<el-select v-model="formData.categoryType" placeholder="请选择"> |
||||
|
<el-option v-for="item in categoryTypeList" :key="item.value" :label="item.label" |
||||
|
:value="item.value"> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> --> |
||||
|
<el-form-item label="分类名称"> |
||||
|
<el-input v-model.trim="formData.categoryName" type="textarea" maxlength="100" :rows="2" |
||||
|
style="width: 300px"></el-input> |
||||
|
</el-form-item> |
||||
|
|
||||
|
</el-form> |
||||
|
|
||||
|
</div> |
||||
|
<div class="resi-btns"> |
||||
|
<el-button size="small" @click="diaShow=false">取消</el-button> |
||||
|
<el-button type="primary" size="small" @click="saveCategory">提交</el-button> |
||||
|
</div> |
||||
|
</el-dialog> |
||||
|
|
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import Sortable from 'sortablejs' |
||||
|
import { requestPost } from "@/js/dai/request"; |
||||
|
import { mapGetters } from 'vuex' |
||||
|
|
||||
|
export default { |
||||
|
name: 'RoleList', |
||||
|
props: {}, |
||||
|
data () { |
||||
|
return { |
||||
|
categoryTypeList:[ |
||||
|
{ |
||||
|
label:"日常意见征集标题", |
||||
|
value:"ideaTitleType" |
||||
|
}, |
||||
|
{ |
||||
|
label:"意见征集身份", |
||||
|
value:"ideaIdentityType" |
||||
|
} |
||||
|
], |
||||
|
loading1: false, |
||||
|
roleList: [],//角色列表 |
||||
|
customerId: '',//客户id |
||||
|
formData:{ |
||||
|
categoryName:"", |
||||
|
revision:"", |
||||
|
categoryType:"ideaIdentityType" |
||||
|
|
||||
|
}, |
||||
|
selCategoryId: '', |
||||
|
tableData: [], |
||||
|
isManager: false, |
||||
|
|
||||
|
//弹出框相关 |
||||
|
formType: 'A',//新增/编辑 A/U |
||||
|
diaTitle: '新增分类', |
||||
|
categoryName: '', |
||||
|
diaShow: false, |
||||
|
|
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
async mounted () { |
||||
|
this.roleList = localStorage.getItem('roleList') |
||||
|
this.customerId = this.$store.state.user.customerId |
||||
|
console.log(this.roleList) |
||||
|
console.log(this.customerId) |
||||
|
if (this.roleList.indexOf('root_manager') > -1) { |
||||
|
this.isManager = true |
||||
|
} else { |
||||
|
this.isManager = true |
||||
|
} |
||||
|
await this.loadList() |
||||
|
await this.dragRoleSort() |
||||
|
|
||||
|
|
||||
|
|
||||
|
}, |
||||
|
computed: { |
||||
|
tableHeight () { |
||||
|
const h = this.clientHeight - 220 + this.iframeHeigh |
||||
|
const _h = this.clientHeight - 220 |
||||
|
return this.$store.state.inIframe ? h : _h |
||||
|
}, |
||||
|
|
||||
|
...mapGetters(['clientHeight', 'iframeHeight']) |
||||
|
}, |
||||
|
methods: { |
||||
|
|
||||
|
//获取分类列表 |
||||
|
async loadList () { |
||||
|
// const url = "/gov/voice/guideccategory/getcategory" |
||||
|
const url = "/governance/icEventIdeaCategory/page" |
||||
|
const params = { |
||||
|
pageSize:this.pageSize, |
||||
|
...this.formData, |
||||
|
customerId: this.customerId, |
||||
|
} |
||||
|
const { data, code, msg } = await requestPost(url, params) |
||||
|
if (code === 0) { |
||||
|
this.tableData = data.list |
||||
|
|
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
//新增 |
||||
|
handleAdd () { |
||||
|
this.diaTitle = '新增分类' |
||||
|
this.diaShow = true |
||||
|
this.formData.categoryName = '' |
||||
|
this.selCategoryId = '' |
||||
|
this.formType = 'Add' |
||||
|
}, |
||||
|
//编辑 |
||||
|
handleEdit (row) { |
||||
|
this.diaTitle = '编辑分类' |
||||
|
this.diaShow = true |
||||
|
this.selCategoryId = row.id |
||||
|
this.formData.categoryName = row.categoryName |
||||
|
this.formType = 'Update' |
||||
|
}, |
||||
|
|
||||
|
//保存分类 |
||||
|
async saveCategory () { |
||||
|
let url = '' |
||||
|
let params = { |
||||
|
categoryType: "ideaIdentityType" |
||||
|
} |
||||
|
if (this.formType === 'Update') { |
||||
|
url = "/governance/icEventIdeaCategory/update" |
||||
|
params.id = this.selCategoryId |
||||
|
params.categoryName= this.formData.categoryName |
||||
|
} else { |
||||
|
params.categoryName= this.formData.categoryName, |
||||
|
url = "/governance/icEventIdeaCategory/save" |
||||
|
} |
||||
|
|
||||
|
const { data, code, msg } = await requestPost(url, params) |
||||
|
if (code === 0) { |
||||
|
this.$message.success('操作成功') |
||||
|
this.formData.categoryName="" |
||||
|
this.diaShow = false |
||||
|
this.loadList() |
||||
|
|
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
confirmChangeState (row, state) { |
||||
|
this.$confirm('确认修改分类状态', '提示', { |
||||
|
confirmButtonText: '确定', |
||||
|
cancelButtonText: '取消', |
||||
|
type: 'warning' |
||||
|
}).then(async () => { |
||||
|
this.handelChangeState(row, state) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
//修改状态 |
||||
|
async handelChangeState(row, state) { |
||||
|
const url = "/governance/icEventIdeaCategory/update" |
||||
|
const params = { |
||||
|
revision: state, |
||||
|
id: row.id |
||||
|
} |
||||
|
const { data, code, msg } = await requestPost(url, params) |
||||
|
if (code === 0) { |
||||
|
this.$message.success('操作成功') |
||||
|
this.loadList() |
||||
|
|
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
confirmDel (row) { |
||||
|
this.$confirm('确认删除当前分类', '提示', { |
||||
|
confirmButtonText: '确定', |
||||
|
cancelButtonText: '取消', |
||||
|
type: 'warning' |
||||
|
}).then(async () => { |
||||
|
this.handelDel(row) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
//删除分类 |
||||
|
async handelDel (row) { |
||||
|
const url = "/governance/icEventIdeaCategory/delete" |
||||
|
// const params = { |
||||
|
// ids: row.id, |
||||
|
// // customerId: this.customerId |
||||
|
// } |
||||
|
const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 |
||||
|
formData.append('ids', [row.id]); //添加文件对象 |
||||
|
const { data, code, msg } = await requestPost(url, formData) |
||||
|
if (code === 0) { |
||||
|
this.$message.success('删除成功') |
||||
|
this.loadList() |
||||
|
|
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
//关闭角色职责弹出框 |
||||
|
diaClose () { |
||||
|
this.selCategoryId = '' |
||||
|
this.diaTitle = '' |
||||
|
this.categoryName = '' |
||||
|
this.diaShow = false |
||||
|
}, |
||||
|
|
||||
|
//显示角色职责弹出框 |
||||
|
handelChangeDuty (row) { |
||||
|
this.selCategoryId = row.id |
||||
|
this.description = row.description |
||||
|
this.roleName = row.roleName |
||||
|
this.diaShow = true |
||||
|
}, |
||||
|
handleChangeName (row) { |
||||
|
row.isEdit = true |
||||
|
}, |
||||
|
|
||||
|
dragRoleSort () { |
||||
|
const el = this.$refs.roleTable.$el.querySelectorAll('.el-table__body-wrapper > table > tbody')[0] |
||||
|
this.sortTable = Sortable.create(el, { |
||||
|
group: 'dragTable', |
||||
|
ghostClass: 'sortable-ghost', // Class name for the drop placeholder, |
||||
|
// setData: function(dataTransfer, dragEl) { |
||||
|
// dataTransfer.setData("Text", dragEl.textContent); |
||||
|
// }, |
||||
|
delay: 0, |
||||
|
onChange: evt => { |
||||
|
// console.log(evt) |
||||
|
}, |
||||
|
onEnd: evt => { |
||||
|
const targetRow = this.tableData.splice(evt.oldIndex, 1)[0] |
||||
|
this.tableData.splice(evt.newIndex, 0, targetRow) |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
//保存顺序 |
||||
|
async handleSaveSort () { |
||||
|
|
||||
|
const url = "/gov/voice/guidecategory/saveorder" |
||||
|
let params = { |
||||
|
orderList: this.tableData.map((item, index) => { |
||||
|
let obj = { |
||||
|
id: item.id, |
||||
|
orderIndex: index, |
||||
|
} |
||||
|
|
||||
|
return obj |
||||
|
}) |
||||
|
} |
||||
|
const { data, code, msg } = await requestPost(url, params) |
||||
|
if (code === 0) { |
||||
|
this.$message.success('操作成功') |
||||
|
this.loadList() |
||||
|
|
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
// let data = { |
||||
|
// roleIdList: this.tableData.map(item => { |
||||
|
// return item.id |
||||
|
// }) |
||||
|
// } |
||||
|
// this.$http |
||||
|
// .post('/epmetuser/govstaffrole/savedefaultsort', data) |
||||
|
// .then(({ data: res }) => { |
||||
|
// console.log('ressss', res) |
||||
|
// if (res.code === 0 && res.msg === 'success') { |
||||
|
// this.$message({ |
||||
|
// type: 'success', |
||||
|
// message: '保存成功' |
||||
|
// }) |
||||
|
// this.loadList() |
||||
|
// } else { |
||||
|
// this.$message({ |
||||
|
// type: 'error', |
||||
|
// message: res.msg |
||||
|
// }) |
||||
|
// } |
||||
|
// }) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
// .resi-container .resi-card-table { |
||||
|
// ::v-deep .el-table th { |
||||
|
|
||||
|
|
||||
|
|
||||
|
// } |
||||
|
// } |
||||
|
// .resi-table { |
||||
|
// ::v-deep .el-button--text { |
||||
|
|
||||
|
// } |
||||
|
// ::v-deep .btn-color-del { |
||||
|
|
||||
|
|
||||
|
// } |
||||
|
// ::v-deep .btn-color-edit { |
||||
|
|
||||
|
// } |
||||
|
// } |
||||
|
.role-container, |
||||
|
.role-flex { |
||||
|
display: flex; |
||||
|
} |
||||
|
.flex1 { |
||||
|
flex: 1; |
||||
|
} |
||||
|
.now-name { |
||||
|
/* display: flex; |
||||
|
justify-content: space-between; */ |
||||
|
margin-bottom: 10px; |
||||
|
margin-left: 10px; |
||||
|
} |
||||
|
.aui-wrapper .el-card + .el-card { |
||||
|
margin-top: 0; |
||||
|
} |
||||
|
.role-container .el-dialog__body { |
||||
|
padding: 0 20px 20px; |
||||
|
} |
||||
|
.div_duty { |
||||
|
margin-top: 30px; |
||||
|
/* height: 300px; |
||||
|
position: relative; */ |
||||
|
} |
||||
|
|
||||
|
.div_btn { |
||||
|
position: absolute; |
||||
|
bottom: 30px; |
||||
|
right: 15px; |
||||
|
} |
||||
|
</style> |
||||
|
|
@ -0,0 +1,407 @@ |
|||||
|
<template> |
||||
|
<div class="role-container resi-container"> |
||||
|
<el-card class="flex1 resi-card-table"> |
||||
|
|
||||
|
<div class="resi-row-btn"> |
||||
|
<!-- <div v-if="isManager" class="resi-row-btn"> --> |
||||
|
<!-- 上下拖动可改变角色顺序 |
||||
|
<el-button style="margin-left:10px" |
||||
|
type="primary" |
||||
|
size="small" |
||||
|
@click="handleSaveSort" class="diy-button--white">保存顺序</el-button> --> |
||||
|
<el-button type="primary" size="small" @click="handleAdd" class="diy-button-add">新增</el-button> |
||||
|
</div> |
||||
|
<el-table ref="roleTable" v-loading="loading1" :data="tableData" border :height="tableHeight" |
||||
|
class="resi-table" style="width: 100%;margin-top:20px"> |
||||
|
<el-table-column label="序号" type="index" header-align="left" align="left" width="50"></el-table-column> |
||||
|
|
||||
|
<el-table-column prop="categoryName" header-align="left" align="left" label="分类名称" |
||||
|
width="250"></el-table-column> |
||||
|
|
||||
|
<el-table-column prop="status" label="状态" header-align="left" align="left"> |
||||
|
<template slot-scope="scope"> |
||||
|
<p style="color:red" v-if="scope.row.revision===0">{{'可用'}}</p> |
||||
|
<p v-else>{{'禁用'}}</p> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="categoryTypeName" label="类型" header-align="left" align="left"> |
||||
|
</el-table-column> |
||||
|
<el-table-column v-if="isManager" width="450" label="操作"> |
||||
|
<template slot-scope="scope"> |
||||
|
|
||||
|
<el-button v-if="scope.row.revision===0" type="text" size="small" |
||||
|
class="div-table-button--detail" @click="confirmChangeState(scope.row,'1')">禁用</el-button> |
||||
|
<el-button v-if="scope.row.revision===1" type="text" size="small" |
||||
|
class="div-table-button--detail" @click="confirmChangeState(scope.row,'0')">启用</el-button> |
||||
|
|
||||
|
<el-button type="text" size="small" class="div-table-button--edit" |
||||
|
@click="handleEdit(scope.row)">修改</el-button> |
||||
|
|
||||
|
<el-button type="text" size="small" class="div-table-button--delete" |
||||
|
@click="confirmDel(scope.row)">删除</el-button> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
|
||||
|
</el-card> |
||||
|
|
||||
|
<!-- 修改弹出框 --> |
||||
|
<el-dialog :visible.sync="diaShow" :close-on-click-modal="false" :close-on-press-escape="false" |
||||
|
:title="diaTitle" width="750px" top="5vh" class="dialog-h" @closed="diaClose"> |
||||
|
<div class="div_duty dialog-h-content scroll-h" v-if="diaShow"> |
||||
|
<el-form label-width="100px"> |
||||
|
<!-- <el-form-item label="分类归属类别"> |
||||
|
<el-select v-model="formData.categoryType" placeholder="请选择"> |
||||
|
<el-option v-for="item in categoryTypeList" :key="item.value" :label="item.label" |
||||
|
:value="item.value"> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> --> |
||||
|
<el-form-item label="分类名称"> |
||||
|
<el-input v-model.trim="formData.categoryName" type="textarea" maxlength="100" :rows="2" |
||||
|
style="width: 300px"></el-input> |
||||
|
</el-form-item> |
||||
|
|
||||
|
</el-form> |
||||
|
|
||||
|
</div> |
||||
|
<div class="resi-btns"> |
||||
|
<el-button size="small" @click="diaShow=false">取消</el-button> |
||||
|
<el-button type="primary" size="small" @click="saveCategory">提交</el-button> |
||||
|
</div> |
||||
|
</el-dialog> |
||||
|
|
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import Sortable from 'sortablejs' |
||||
|
import { requestPost } from "@/js/dai/request"; |
||||
|
import { mapGetters } from 'vuex' |
||||
|
|
||||
|
export default { |
||||
|
name: 'RoleList', |
||||
|
props: {}, |
||||
|
data () { |
||||
|
return { |
||||
|
categoryTypeList:[ |
||||
|
{ |
||||
|
label:"日常意见征集标题", |
||||
|
value:"ideaTitleType" |
||||
|
}, |
||||
|
{ |
||||
|
label:"意见征集身份", |
||||
|
value:"ideaTitleType" |
||||
|
} |
||||
|
], |
||||
|
loading1: false, |
||||
|
roleList: [],//角色列表 |
||||
|
customerId: '',//客户id |
||||
|
formData:{ |
||||
|
categoryName:"", |
||||
|
revision:"", |
||||
|
categoryType:"ideaTitleType" |
||||
|
|
||||
|
}, |
||||
|
selCategoryId: '', |
||||
|
tableData: [], |
||||
|
isManager: false, |
||||
|
|
||||
|
//弹出框相关 |
||||
|
formType: 'A',//新增/编辑 A/U |
||||
|
diaTitle: '新增分类', |
||||
|
categoryName: '', |
||||
|
diaShow: false, |
||||
|
|
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
async mounted () { |
||||
|
this.roleList = localStorage.getItem('roleList') |
||||
|
this.customerId = this.$store.state.user.customerId |
||||
|
console.log(this.roleList) |
||||
|
console.log(this.customerId) |
||||
|
if (this.roleList.indexOf('root_manager') > -1) { |
||||
|
this.isManager = true |
||||
|
} else { |
||||
|
this.isManager = true |
||||
|
} |
||||
|
await this.loadList() |
||||
|
await this.dragRoleSort() |
||||
|
|
||||
|
|
||||
|
|
||||
|
}, |
||||
|
computed: { |
||||
|
tableHeight () { |
||||
|
const h = this.clientHeight - 220 + this.iframeHeigh |
||||
|
const _h = this.clientHeight - 220 |
||||
|
return this.$store.state.inIframe ? h : _h |
||||
|
}, |
||||
|
|
||||
|
...mapGetters(['clientHeight', 'iframeHeight']) |
||||
|
}, |
||||
|
methods: { |
||||
|
|
||||
|
//获取分类列表 |
||||
|
async loadList () { |
||||
|
// const url = "/gov/voice/guideccategory/getcategory" |
||||
|
const url = "/governance/icEventIdeaCategory/page" |
||||
|
const params = { |
||||
|
pageSize:this.pageSize, |
||||
|
...this.formData, |
||||
|
customerId: this.customerId, |
||||
|
} |
||||
|
const { data, code, msg } = await requestPost(url, params) |
||||
|
if (code === 0) { |
||||
|
this.tableData = data.list |
||||
|
|
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
//新增 |
||||
|
handleAdd () { |
||||
|
this.diaTitle = '新增分类' |
||||
|
this.diaShow = true |
||||
|
this.formData.categoryName = '' |
||||
|
this.selCategoryId = '' |
||||
|
this.formType = 'Add' |
||||
|
}, |
||||
|
//编辑 |
||||
|
handleEdit (row) { |
||||
|
this.diaTitle = '编辑分类' |
||||
|
this.diaShow = true |
||||
|
this.selCategoryId = row.id |
||||
|
this.formData.categoryName = row.categoryName |
||||
|
this.formType = 'Update' |
||||
|
}, |
||||
|
|
||||
|
//保存分类 |
||||
|
async saveCategory () { |
||||
|
let url = '' |
||||
|
let params = { |
||||
|
categoryType: "ideaTitleType" |
||||
|
} |
||||
|
if (this.formType === 'Update') { |
||||
|
url = "/governance/icEventIdeaCategory/update" |
||||
|
params.id = this.selCategoryId |
||||
|
params.categoryName= this.formData.categoryName |
||||
|
} else { |
||||
|
params.categoryName= this.formData.categoryName, |
||||
|
url = "/governance/icEventIdeaCategory/save" |
||||
|
} |
||||
|
|
||||
|
const { data, code, msg } = await requestPost(url, params) |
||||
|
if (code === 0) { |
||||
|
this.$message.success('操作成功') |
||||
|
this.formData.categoryName="" |
||||
|
this.diaShow = false |
||||
|
this.loadList() |
||||
|
|
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
confirmChangeState (row, state) { |
||||
|
this.$confirm('确认修改分类状态', '提示', { |
||||
|
confirmButtonText: '确定', |
||||
|
cancelButtonText: '取消', |
||||
|
type: 'warning' |
||||
|
}).then(async () => { |
||||
|
this.handelChangeState(row, state) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
//修改状态 |
||||
|
async handelChangeState(row, state) { |
||||
|
const url = "/governance/icEventIdeaCategory/update" |
||||
|
const params = { |
||||
|
revision: state, |
||||
|
id: row.id |
||||
|
} |
||||
|
const { data, code, msg } = await requestPost(url, params) |
||||
|
if (code === 0) { |
||||
|
this.$message.success('操作成功') |
||||
|
this.loadList() |
||||
|
|
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
confirmDel (row) { |
||||
|
this.$confirm('确认删除当前分类', '提示', { |
||||
|
confirmButtonText: '确定', |
||||
|
cancelButtonText: '取消', |
||||
|
type: 'warning' |
||||
|
}).then(async () => { |
||||
|
this.handelDel(row) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
//删除分类 |
||||
|
async handelDel (row) { |
||||
|
const url = "/governance/icEventIdeaCategory/delete" |
||||
|
// const params = { |
||||
|
// ids: row.id, |
||||
|
// // customerId: this.customerId |
||||
|
// } |
||||
|
const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 |
||||
|
formData.append('ids', [row.id]); //添加文件对象 |
||||
|
const { data, code, msg } = await requestPost(url, formData) |
||||
|
if (code === 0) { |
||||
|
this.$message.success('删除成功') |
||||
|
this.loadList() |
||||
|
|
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
//关闭角色职责弹出框 |
||||
|
diaClose () { |
||||
|
this.selCategoryId = '' |
||||
|
this.diaTitle = '' |
||||
|
this.categoryName = '' |
||||
|
this.diaShow = false |
||||
|
}, |
||||
|
|
||||
|
//显示角色职责弹出框 |
||||
|
handelChangeDuty (row) { |
||||
|
this.selCategoryId = row.id |
||||
|
this.description = row.description |
||||
|
this.roleName = row.roleName |
||||
|
this.diaShow = true |
||||
|
}, |
||||
|
handleChangeName (row) { |
||||
|
row.isEdit = true |
||||
|
}, |
||||
|
|
||||
|
dragRoleSort () { |
||||
|
const el = this.$refs.roleTable.$el.querySelectorAll('.el-table__body-wrapper > table > tbody')[0] |
||||
|
this.sortTable = Sortable.create(el, { |
||||
|
group: 'dragTable', |
||||
|
ghostClass: 'sortable-ghost', // Class name for the drop placeholder, |
||||
|
// setData: function(dataTransfer, dragEl) { |
||||
|
// dataTransfer.setData("Text", dragEl.textContent); |
||||
|
// }, |
||||
|
delay: 0, |
||||
|
onChange: evt => { |
||||
|
// console.log(evt) |
||||
|
}, |
||||
|
onEnd: evt => { |
||||
|
const targetRow = this.tableData.splice(evt.oldIndex, 1)[0] |
||||
|
this.tableData.splice(evt.newIndex, 0, targetRow) |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
//保存顺序 |
||||
|
async handleSaveSort () { |
||||
|
|
||||
|
const url = "/gov/voice/guidecategory/saveorder" |
||||
|
let params = { |
||||
|
orderList: this.tableData.map((item, index) => { |
||||
|
let obj = { |
||||
|
id: item.id, |
||||
|
orderIndex: index, |
||||
|
} |
||||
|
|
||||
|
return obj |
||||
|
}) |
||||
|
} |
||||
|
const { data, code, msg } = await requestPost(url, params) |
||||
|
if (code === 0) { |
||||
|
this.$message.success('操作成功') |
||||
|
this.loadList() |
||||
|
|
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
// let data = { |
||||
|
// roleIdList: this.tableData.map(item => { |
||||
|
// return item.id |
||||
|
// }) |
||||
|
// } |
||||
|
// this.$http |
||||
|
// .post('/epmetuser/govstaffrole/savedefaultsort', data) |
||||
|
// .then(({ data: res }) => { |
||||
|
// console.log('ressss', res) |
||||
|
// if (res.code === 0 && res.msg === 'success') { |
||||
|
// this.$message({ |
||||
|
// type: 'success', |
||||
|
// message: '保存成功' |
||||
|
// }) |
||||
|
// this.loadList() |
||||
|
// } else { |
||||
|
// this.$message({ |
||||
|
// type: 'error', |
||||
|
// message: res.msg |
||||
|
// }) |
||||
|
// } |
||||
|
// }) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
// .resi-container .resi-card-table { |
||||
|
// ::v-deep .el-table th { |
||||
|
|
||||
|
|
||||
|
|
||||
|
// } |
||||
|
// } |
||||
|
// .resi-table { |
||||
|
// ::v-deep .el-button--text { |
||||
|
|
||||
|
// } |
||||
|
// ::v-deep .btn-color-del { |
||||
|
|
||||
|
|
||||
|
// } |
||||
|
// ::v-deep .btn-color-edit { |
||||
|
|
||||
|
// } |
||||
|
// } |
||||
|
.role-container, |
||||
|
.role-flex { |
||||
|
display: flex; |
||||
|
} |
||||
|
.flex1 { |
||||
|
flex: 1; |
||||
|
} |
||||
|
.now-name { |
||||
|
/* display: flex; |
||||
|
justify-content: space-between; */ |
||||
|
margin-bottom: 10px; |
||||
|
margin-left: 10px; |
||||
|
} |
||||
|
.aui-wrapper .el-card + .el-card { |
||||
|
margin-top: 0; |
||||
|
} |
||||
|
.role-container .el-dialog__body { |
||||
|
padding: 0 20px 20px; |
||||
|
} |
||||
|
.div_duty { |
||||
|
margin-top: 30px; |
||||
|
/* height: 300px; |
||||
|
position: relative; */ |
||||
|
} |
||||
|
|
||||
|
.div_btn { |
||||
|
position: absolute; |
||||
|
bottom: 30px; |
||||
|
right: 15px; |
||||
|
} |
||||
|
</style> |
||||
|
|
Loading…
Reference in new issue