fix部门页面

This commit is contained in:
zhangzhiqiang
2022-12-02 09:49:21 +08:00
parent bb69a505d9
commit 2c76124f03
10 changed files with 54 additions and 39 deletions

View File

@@ -14,7 +14,7 @@
@keyup.enter.native="crud.toQuery"
/>
<el-select
v-model="query.enabled"
v-model="query.is_used"
clearable
size="mini"
placeholder="状态"
@@ -28,7 +28,6 @@
</div>
<crudOperation :permission="permission" />
</div>
<!--表单组件-->
<el-dialog
append-to-body
:close-on-click-modal="false"
@@ -46,7 +45,7 @@
</el-form-item>
<el-form-item label="部门排序" prop="deptSort">
<el-input-number
v-model.number="form.deptSort"
v-model.number="form.dept_sort"
:min="0"
:max="999"
controls-position="right"
@@ -76,7 +75,8 @@
:load-options="loadDepts"
:options="depts"
style="width: 370px;"
placeholder="选择上级类目"
:normalizer="normalizer"
placeholder="选择部门类目"
/>
</el-form-item>
</el-form>
@@ -101,23 +101,21 @@
<el-table-column :selectable="checkboxT" type="selection" width="55" />
<!-- <el-table-column label="编码" prop="code" />-->
<el-table-column label="名称" prop="name" />
<el-table-column label="排序" prop="deptSort" />
<el-table-column label="状态" align="center" prop="enabled">
<el-table-column label="排序" prop="dept_sort" />
<el-table-column label="状态" align="center" prop="is_used">
<template slot-scope="scope">
<el-switch
v-model="scope.row.enabled"
v-model="scope.row.is_used"
:disabled="scope.row.id === 1"
active-color="#409EFF"
inactive-color="#F56C6C"
active-value="1"
inactive-value="0"
@change="changeEnabled(scope.row, scope.row.enabled,)"
/>
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建日期">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column prop="create_time" label="创建日期" />
<el-table-column
v-permission="['admin','dept:edit','dept:del']"
label="操作"
@@ -146,16 +144,15 @@ import CRUD, { crud, form, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import { getDeptvo } from '../../../api/system/dept'
const defaultForm = {
id: null,
code: null,
name: null,
isTop: '1',
subCount: 0,
sub_count: 0,
pid: null,
deptSort: 999,
dept_sort: 999,
enabled: 'true',
extId: null,
versionId: null
@@ -189,8 +186,8 @@ export default {
del: ['admin', 'dept:del']
},
enabledTypeOptions: [
{ key: 'true', display_name: '正常' },
{ key: 'false', display_name: '禁用' }
{ key: '1', display_name: '正常' },
{ key: '0', display_name: '禁用' }
]
}
},
@@ -235,8 +232,7 @@ export default {
})
},
getDepts() {
crudDept.getDepts({ enabled: true }).then(res => {
debugger
crudDept.getDeptvo({ is_used: '1' }).then(res => {
this.depts = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
@@ -248,11 +244,9 @@ export default {
// 获取弹窗内部门数据
loadDepts({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
crudDept.getDepts({ enabled: true, pid: parentNode.id }).then(res => {
crudDept.getDeptvo({ is_used: '1', pid: parentNode.dept_id }).then(res => {
parentNode.children = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
obj.children = null
return obj
})
setTimeout(() => {
@@ -294,6 +288,13 @@ export default {
},
checkboxT(row, rowIndex) {
return row.id !== 1
},
normalizer(node) {
return {
id: node.dept_id,
label: node.name,
children: node.children
}
}
}
}