Commit a1a1c163 authored by 孙浩's avatar 孙浩

判断部门、菜单状态修改

parent bb9a4b9a
......@@ -86,6 +86,20 @@ export function updateDept(data) {
})
}
// 修改状态部门
export function statusChange(data) {
const businessId = data.businessId
data = Qs.stringify(data)
return request({
url: '/system/dept/statusChange/' + businessId,
method: 'put',
data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
}
// 删除部门
export function delDept(deptId) {
return request({
......
......@@ -89,7 +89,21 @@ export function updateMenu(data) {
const businessId = data.businessId
data = Qs.stringify(data)
return request({
url: '/system/menu/update/'+ businessId,
url: '/system/menu/update/' + businessId,
method: 'put',
data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
}
// 修改状态菜单
export function statusChange(data) {
const businessId = data.businessId
data = Qs.stringify(data)
return request({
url: '/system/menu/statusChange/' + businessId,
method: 'put',
data,
headers: {
......
......@@ -203,7 +203,7 @@
</template>
<script>
import { addDept, delDept, getDept, listDept, listDeptExcludeChild, updateDept } from '@/api/system/dept'
import { addDept, delDept, getDept, listDept, listDeptExcludeChild, statusChange, updateDept} from '@/api/system/dept'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import Coolbutton from '@/components/coolbutton'
......@@ -247,7 +247,7 @@ export default {
title: '',
// 是否显示弹出层
open: false,
// 状态数据字典
// 状态
statusOptions: [
{
dictLabel: '启用',
......@@ -295,27 +295,13 @@ export default {
},
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
// this.$store.dispatch('searchSave/searchParamsSet', {
// path: this.$route.path,
// param: {
// ...this.queryParams
// }
// })
setDataCache(this.$route.path, this.queryParams)
next()
},
created() {
// const filterData = getDataCache(this.$route.path)
// if (filterData) {
// const param = JSON.parse(filterData)
// this.queryParams = { ...param }
// }
// 分页参数初始化为{"page":1,"rows":10},如需自定义分页参数,自行修改
this.queryParams = JSON.parse(getDataCache(this.$route.path))
this.getList()
// this.getDicts('sys_normal_disable'.toUpperCase()).then(response => {
// this.statusOptions = response.data
// })
},
methods: {
/** 查询部门列表 */
......@@ -385,12 +371,22 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return updateDept(row)
}).then(() => {
const dept = Object.assign({}, row, { children: [] })
dept.children = []
return statusChange(dept)
}).then((response) => {
if (response.code === 200) {
this.$message({
message: text + '成功',
type: 'success'
})
} else {
this.$message({
message: response.message,
type: 'error'
})
this.getList()
}
}).catch(function() {
row.flag = row.flag === '0' ? '1' : '0'
})
......
......@@ -206,13 +206,13 @@
</el-select>
</el-form-item>
<el-form-item v-show="form.parentId" prop="dataId">
<el-select v-model="form.dataId" style="width: 100%" clearable placeholder="请选择父字典数据" @visible-change="clearSelected">
<el-select v-model="form.DataLable" style="width: 100%" clearable placeholder="请选择父字典数据" @visible-change="clearSelected">
<el-option
v-for="item in optionsDict"
:key="item.dictValue"
:key="item.businessId"
:label="item.dictLabel"
:disabled="item.status == 1"
:value="item.dictValue"
:value="item.businessId"
>
<span style="float: left">{{ item.dictLabel }}</span>
<span v-if="item.status === '1'" style="float: right; color: #8492a6; font-size: 12px;padding-left: 10px">{{ '已停用' }}</span>
......
......@@ -259,7 +259,7 @@
</template>
<script>
import { addMenu, delMenu, getMenu, listMenu, updateMenu } from '@/api/system/menu'
import { addMenu, delMenu, getMenu, listMenu, statusChange, updateMenu} from '@/api/system/menu'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import IconSelect from '@/components/IconSelect'
......@@ -526,12 +526,20 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return updateMenu(row)
}).then(() => {
row.children = []
return statusChange(row)
}).then((response) => {
if (response.code === 200) {
this.$message({
message: text + '成功',
type: 'success'
})
} else {
this.$message({
message: response.message,
type: 'error'
})
}
}).catch(function() {
row.flag = row.flag === '0' ? '1' : '0'
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment