dept
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="外部标识" prop="extId">
|
||||
<el-input v-model="form.ext_id" style="width: 370px;" />
|
||||
<el-input v-model="form.extId" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="顶级部门">
|
||||
<el-radio-group v-model="form.isTop" style="width: 140px">
|
||||
@@ -61,13 +61,11 @@
|
||||
<el-radio label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="is_uesd">
|
||||
<el-form-item label="状态" prop="isUesd">
|
||||
<el-switch
|
||||
v-model="form.isUsed"
|
||||
active-color="#409EFF"
|
||||
inactive-color="#F56C6C"
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.isTop === '0'" style="margin-bottom: 0;" label="上级部门" prop="pid">
|
||||
@@ -110,8 +108,6 @@
|
||||
:disabled="scope.row.id === 1"
|
||||
active-color="#409EFF"
|
||||
inactive-color="#F56C6C"
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
@change="changeEnabled(scope.row, scope.row.isUsed,)"
|
||||
/>
|
||||
</template>
|
||||
@@ -153,8 +149,8 @@ const defaultForm = {
|
||||
sub_count: 0,
|
||||
pid: null,
|
||||
deptSort: 999,
|
||||
isUsed: '1',
|
||||
ext_id: null
|
||||
isUsed: true,
|
||||
extId: null
|
||||
}
|
||||
export default {
|
||||
name: 'Dept',
|
||||
@@ -182,8 +178,8 @@ export default {
|
||||
del: ['admin', 'dept:del']
|
||||
},
|
||||
enabledTypeOptions: [
|
||||
{ key: '1', display_name: '正常' },
|
||||
{ key: '0', display_name: '禁用' }
|
||||
{ key: true, display_name: '启用' },
|
||||
{ key: false, display_name: '禁用' }
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -228,7 +224,7 @@ export default {
|
||||
})
|
||||
},
|
||||
getDepts() {
|
||||
crudDept.getDeptvo({ isUsed: '1' }).then(res => {
|
||||
crudDept.getDeptvo({ isUsed: true }).then(res => {
|
||||
this.depts = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
@@ -240,7 +236,7 @@ export default {
|
||||
// 获取弹窗内部门数据
|
||||
loadDepts({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
crudDept.getDeptvo({ isUsed: '1', pid: parentNode.deptId }).then(res => {
|
||||
crudDept.getDeptvo({ isUsed: true, pid: parentNode.deptId }).then(res => {
|
||||
parentNode.children = res.content.map(function(obj) {
|
||||
obj.children = null
|
||||
return obj
|
||||
@@ -267,19 +263,18 @@ export default {
|
||||
},
|
||||
// 改变状态
|
||||
changeEnabled(data, val) {
|
||||
this.$confirm('此操作将 "' + this.dict.label.dept_status[val] + '" ' + data.name + '部门, 是否继续?', '提示', {
|
||||
const satus = this.enabledTypeOptions.find(item => { return item.key == data.isUsed })
|
||||
debugger
|
||||
this.$confirm('此操作将 "' + satus.display_name + '" ' + data.name + '部门, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
crudDept.edit(data).then(res => {
|
||||
this.crud.notify(this.dict.label.dept_status[val] + '成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(err => {
|
||||
data.enabled = !data.enabled
|
||||
console.log(err.response.data.message)
|
||||
this.crud.notify(satus.display_name + '成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
})
|
||||
}).catch(() => {
|
||||
data.enabled = !data.enabled
|
||||
data.isUsed = !data.isUsed
|
||||
})
|
||||
},
|
||||
checkboxT(row, rowIndex) {
|
||||
|
||||
Reference in New Issue
Block a user