|
|
@ -15,7 +15,7 @@ |
|
|
|
<el-table ref="roleTable" |
|
|
|
v-loading="loading1" |
|
|
|
:data="tableData" |
|
|
|
row-key="roleKey" |
|
|
|
row-key="id" |
|
|
|
border |
|
|
|
style="width: 100%;margin-top:20px"> |
|
|
|
<el-table-column type="index" |
|
|
@ -27,7 +27,7 @@ |
|
|
|
header-align="left" |
|
|
|
align="left" |
|
|
|
label="分类名称" |
|
|
|
width="150"></el-table-column> |
|
|
|
width="250"></el-table-column> |
|
|
|
|
|
|
|
<el-table-column prop="status" |
|
|
|
label="状态" |
|
|
@ -48,19 +48,19 @@ |
|
|
|
<el-button v-if="scope.row.status==='enable'" |
|
|
|
type="primary" |
|
|
|
size="mini" |
|
|
|
@click="handelChangeState(scope.row,'disable')">禁用</el-button> |
|
|
|
@click="confirmChangeState(scope.row,'disable')">禁用</el-button> |
|
|
|
<el-button v-if="scope.row.status==='disable'" |
|
|
|
type="primary" |
|
|
|
size="mini" |
|
|
|
@click="handelChangeState(scope.row,'enable')">启用</el-button> |
|
|
|
@click="confirmChangeState(scope.row,'enable')">启用</el-button> |
|
|
|
|
|
|
|
<el-button type="primary" |
|
|
|
size="mini" |
|
|
|
@click="handleEdit(scope.row.roleKey, scope.row.roleName)">修改</el-button> |
|
|
|
@click="handleEdit(scope.row)">修改</el-button> |
|
|
|
|
|
|
|
<el-button type="primary" |
|
|
|
size="mini" |
|
|
|
@click="handleDel(scope.row)">删除</el-button> |
|
|
|
@click="confirmDel(scope.row)">删除</el-button> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
@ -97,7 +97,7 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import Sortable from 'sortablejs' |
|
|
|
import { requestPost, requestGet } from "@/js/dai/request"; |
|
|
|
import { requestPost } from "@/js/dai/request"; |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'RoleList', |
|
|
@ -105,12 +105,15 @@ export default { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
loading1: false, |
|
|
|
roleList: [],//角色列表 |
|
|
|
customerId: '',//客户id |
|
|
|
|
|
|
|
selCategoryId: '', |
|
|
|
tableData: [], |
|
|
|
isManager: false, |
|
|
|
|
|
|
|
//弹出框相关 |
|
|
|
formType: 'A',//新增/编辑 A/U |
|
|
|
diaTitle: '新增分类', |
|
|
|
categoryName: '', |
|
|
|
diaShow: false, |
|
|
@ -119,17 +122,20 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
mounted () { |
|
|
|
this.loadList() |
|
|
|
this.dragRoleSort() |
|
|
|
|
|
|
|
const roleList = this.$store.state.user.roleList |
|
|
|
console.log(this.$store.state.user.roleList) |
|
|
|
if (roleList.indexOf('root_manager') > -1) { |
|
|
|
async mounted () { |
|
|
|
this.roleList = localStorage.getItem('roleList') |
|
|
|
this.customerId = localStorage.getItem('customerId') |
|
|
|
console.log(this.roleList) |
|
|
|
console.log(this.customerId) |
|
|
|
if (this.roleList.indexOf('root_manager') > -1) { |
|
|
|
this.isManager = true |
|
|
|
} else { |
|
|
|
this.isManager = false |
|
|
|
this.isManager = true |
|
|
|
} |
|
|
|
await this.loadList() |
|
|
|
await this.dragRoleSort() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
@ -137,12 +143,12 @@ export default { |
|
|
|
|
|
|
|
//获取分类列表 |
|
|
|
async loadList () { |
|
|
|
console.log(this.description) |
|
|
|
// const url = "/gov/voice/guideccategory/getcategory" |
|
|
|
const url = "/gov/voice/guidecategory/page" |
|
|
|
const params = { |
|
|
|
customerId: this.customerId, |
|
|
|
} |
|
|
|
const { data, code, msg } = await requestGet(url, params) |
|
|
|
const { data, code, msg } = await requestPost(url, params) |
|
|
|
if (code === 0) { |
|
|
|
this.tableData = data.list |
|
|
|
|
|
|
@ -157,6 +163,7 @@ export default { |
|
|
|
this.diaShow = true |
|
|
|
this.categoryName = '' |
|
|
|
this.selCategoryId = '' |
|
|
|
this.formType = 'A' |
|
|
|
}, |
|
|
|
//编辑 |
|
|
|
handleEdit (row) { |
|
|
@ -164,24 +171,28 @@ export default { |
|
|
|
this.diaShow = true |
|
|
|
this.selCategoryId = row.id |
|
|
|
this.categoryName = row.categoryName |
|
|
|
this.formType = 'U' |
|
|
|
}, |
|
|
|
|
|
|
|
//保存分类 |
|
|
|
async saveCategory () { |
|
|
|
const url = "/gov/voice/guideccategory/update" |
|
|
|
let params = {} |
|
|
|
if (this.selCategoryId) { |
|
|
|
params = { |
|
|
|
categoryId: this.selCategoryId, |
|
|
|
categoryName: this.categoryName |
|
|
|
} |
|
|
|
|
|
|
|
let url = '' |
|
|
|
let params = { |
|
|
|
categoryName: this.categoryName, |
|
|
|
customerId: this.customerId |
|
|
|
} |
|
|
|
if (this.formType === 'U') { |
|
|
|
url = "/gov/voice/guidecategory/update" |
|
|
|
params.id = this.selCategoryId |
|
|
|
} else { |
|
|
|
params = { |
|
|
|
categoryName: this.categoryName |
|
|
|
} |
|
|
|
url = "/gov/voice/guidecategory/save" |
|
|
|
} |
|
|
|
|
|
|
|
const { data, code, msg } = await requestPost(url, params) |
|
|
|
if (code === 0) { |
|
|
|
this.$message.success('操作成功') |
|
|
|
this.diaShow = false |
|
|
|
this.loadList() |
|
|
|
|
|
|
|
} else { |
|
|
@ -189,16 +200,27 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
confirmChangeState (row, state) { |
|
|
|
this.$confirm('确认修改分类状态', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning' |
|
|
|
}).then(async () => { |
|
|
|
this.handelChangeState(row, state) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
//修改状态 |
|
|
|
async handelChangeState (row, state) { |
|
|
|
|
|
|
|
const url = "/gov/voice/guideccategory/disable" |
|
|
|
const url = "/gov/voice/guidecategory/disable" |
|
|
|
const params = { |
|
|
|
status: state, |
|
|
|
categoryId: row.id |
|
|
|
id: row.id |
|
|
|
} |
|
|
|
const { data, code, msg } = await requestPost(url, params) |
|
|
|
if (code === 0) { |
|
|
|
this.$message.success('操作成功') |
|
|
|
this.loadList() |
|
|
|
|
|
|
|
} else { |
|
|
@ -206,14 +228,26 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
confirmDel (row) { |
|
|
|
this.$confirm('确认删除当前分类', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning' |
|
|
|
}).then(async () => { |
|
|
|
this.handelDel(row) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
//删除分类 |
|
|
|
async handelDel (row) { |
|
|
|
const url = "/gov/voice/guidecategory" |
|
|
|
const url = "/gov/voice/guidecategory/delete" |
|
|
|
const params = { |
|
|
|
categoryId: row.id |
|
|
|
id: row.id, |
|
|
|
customerId: this.customerId |
|
|
|
} |
|
|
|
const { data, code, msg } = await requestPost(url, params) |
|
|
|
if (code === 0) { |
|
|
|
this.$message.success('删除成功') |
|
|
|
this.loadList() |
|
|
|
|
|
|
|
} else { |
|
|
@ -241,36 +275,6 @@ export default { |
|
|
|
row.isEdit = true |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//保存角色名称、职责 |
|
|
|
async updateRole () { |
|
|
|
console.log(this.description) |
|
|
|
const url = "/epmetuser/govstaffrole/updatedefaultrole" |
|
|
|
const params = { |
|
|
|
roleId: this.selCategoryId, |
|
|
|
roleName: this.roleName, |
|
|
|
description: this.description |
|
|
|
} |
|
|
|
const { data, code, msg } = await requestPost(url, params) |
|
|
|
if (code === 0) { |
|
|
|
this.diaShow = false |
|
|
|
this.loadList() |
|
|
|
|
|
|
|
} else { |
|
|
|
this.$message.error(msg) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//点击功能权限按钮 |
|
|
|
toOperationConfig (roleKey, roleName) { |
|
|
|
this.roleName = roleName |
|
|
|
this.funcShow = true |
|
|
|
this.opeList = [] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
dragRoleSort () { |
|
|
|
const el = this.$refs.roleTable.$el.querySelectorAll('.el-table__body-wrapper > table > tbody')[0] |
|
|
|
this.sortTable = Sortable.create(el, { |
|
|
@ -291,29 +295,52 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
//保存顺序 |
|
|
|
handleSaveSort () { |
|
|
|
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 |
|
|
|
}) |
|
|
|
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 |
|
|
|
// }) |
|
|
|
// } |
|
|
|
// }) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|