Commit a1a1c163 authored by 孙浩's avatar 孙浩

判断部门、菜单状态修改

parent bb9a4b9a
...@@ -86,6 +86,20 @@ export function updateDept(data) { ...@@ -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) { export function delDept(deptId) {
return request({ return request({
......
...@@ -89,7 +89,21 @@ export function updateMenu(data) { ...@@ -89,7 +89,21 @@ export function updateMenu(data) {
const businessId = data.businessId const businessId = data.businessId
data = Qs.stringify(data) data = Qs.stringify(data)
return request({ 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', method: 'put',
data, data,
headers: { headers: {
......
...@@ -203,7 +203,7 @@ ...@@ -203,7 +203,7 @@
</template> </template>
<script> <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 Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import Coolbutton from '@/components/coolbutton' import Coolbutton from '@/components/coolbutton'
...@@ -247,7 +247,7 @@ export default { ...@@ -247,7 +247,7 @@ export default {
title: '', title: '',
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
// 状态数据字典 // 状态
statusOptions: [ statusOptions: [
{ {
dictLabel: '启用', dictLabel: '启用',
...@@ -295,27 +295,13 @@ export default { ...@@ -295,27 +295,13 @@ export default {
}, },
/** 路由离开前存储筛选条件*/ /** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
// this.$store.dispatch('searchSave/searchParamsSet', {
// path: this.$route.path,
// param: {
// ...this.queryParams
// }
// })
setDataCache(this.$route.path, this.queryParams) setDataCache(this.$route.path, this.queryParams)
next() next()
}, },
created() { created() {
// const filterData = getDataCache(this.$route.path)
// if (filterData) {
// const param = JSON.parse(filterData)
// this.queryParams = { ...param }
// }
// 分页参数初始化为{"page":1,"rows":10},如需自定义分页参数,自行修改 // 分页参数初始化为{"page":1,"rows":10},如需自定义分页参数,自行修改
this.queryParams = JSON.parse(getDataCache(this.$route.path)) this.queryParams = JSON.parse(getDataCache(this.$route.path))
this.getList() this.getList()
// this.getDicts('sys_normal_disable'.toUpperCase()).then(response => {
// this.statusOptions = response.data
// })
}, },
methods: { methods: {
/** 查询部门列表 */ /** 查询部门列表 */
...@@ -385,12 +371,22 @@ export default { ...@@ -385,12 +371,22 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(function() { }).then(function() {
return updateDept(row) const dept = Object.assign({}, row, { children: [] })
}).then(() => { dept.children = []
this.$message({ return statusChange(dept)
message: text + '成功', }).then((response) => {
type: 'success' if (response.code === 200) {
}) this.$message({
message: text + '成功',
type: 'success'
})
} else {
this.$message({
message: response.message,
type: 'error'
})
this.getList()
}
}).catch(function() { }).catch(function() {
row.flag = row.flag === '0' ? '1' : '0' row.flag = row.flag === '0' ? '1' : '0'
}) })
......
...@@ -206,13 +206,13 @@ ...@@ -206,13 +206,13 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item v-show="form.parentId" prop="dataId"> <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 <el-option
v-for="item in optionsDict" v-for="item in optionsDict"
:key="item.dictValue" :key="item.businessId"
:label="item.dictLabel" :label="item.dictLabel"
:disabled="item.status == 1" :disabled="item.status == 1"
:value="item.dictValue" :value="item.businessId"
> >
<span style="float: left">{{ item.dictLabel }}</span> <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> <span v-if="item.status === '1'" style="float: right; color: #8492a6; font-size: 12px;padding-left: 10px">{{ '已停用' }}</span>
......
...@@ -259,7 +259,7 @@ ...@@ -259,7 +259,7 @@
</template> </template>
<script> <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 Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import IconSelect from '@/components/IconSelect' import IconSelect from '@/components/IconSelect'
...@@ -526,12 +526,20 @@ export default { ...@@ -526,12 +526,20 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(function() { }).then(function() {
return updateMenu(row) row.children = []
}).then(() => { return statusChange(row)
this.$message({ }).then((response) => {
message: text + '成功', if (response.code === 200) {
type: 'success' this.$message({
}) message: text + '成功',
type: 'success'
})
} else {
this.$message({
message: response.message,
type: 'error'
})
}
}).catch(function() { }).catch(function() {
row.flag = row.flag === '0' ? '1' : '0' 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