|
@@ -103,14 +103,13 @@ export default {
|
|
|
if (method === 'add') {
|
|
|
this.title = `创建部门`
|
|
|
} else if (method === 'edit') {
|
|
|
- this.inputForm.id = id
|
|
|
- this.title = '修改附件'
|
|
|
+ this.inputForm.deptId = id
|
|
|
+ this.title = '修改部门'
|
|
|
}
|
|
|
- this.loading = false
|
|
|
this.visible = true
|
|
|
this.$nextTick(() => {
|
|
|
- this.$refs.inputForm.resetFields()
|
|
|
this.loading = true
|
|
|
+ this.$refs.inputForm.resetFields()
|
|
|
ddService.deptList().then(res => {
|
|
|
res.result.unshift({
|
|
|
deptId: 1,
|
|
@@ -118,12 +117,20 @@ export default {
|
|
|
isLeaf: true
|
|
|
})
|
|
|
this.deptList = res.result
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.deptId)) {
|
|
|
+ ddService.queryById({
|
|
|
+ deptId: this.inputForm.deptId
|
|
|
+ }).then(res => {
|
|
|
+ this.inputForm.name = res.result.name
|
|
|
+ this.inputForm.parentId = res.result.parentId
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.loading = false
|
|
|
|
|
|
+ }
|
|
|
})
|
|
|
- if (this.commonJS.isNotEmpty(this.inputForm.id)) {
|
|
|
|
|
|
- }
|
|
|
- this.loading = false
|
|
|
})
|
|
|
},
|
|
|
// 表单提交
|
|
@@ -132,8 +139,8 @@ export default {
|
|
|
this.$refs['inputForm'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.loading = true
|
|
|
- if (this.inputForm.id) {
|
|
|
- ddService.updateById(this.inputForm).then((data) => {
|
|
|
+ if (this.inputForm.deptId) {
|
|
|
+ ddService.updateDept(this.inputForm).then((data) => {
|
|
|
this.visible = false
|
|
|
this.$emit('refreshList')
|
|
|
}).catch(() => {
|
|
@@ -141,8 +148,6 @@ export default {
|
|
|
this.loading = false
|
|
|
})
|
|
|
} else {
|
|
|
- console.log(this.inputForm);
|
|
|
-
|
|
|
ddService.addDept(this.inputForm).then((data) => {
|
|
|
this.visible = false
|
|
|
this.$emit('refreshList')
|
|
@@ -162,13 +167,6 @@ export default {
|
|
|
}
|
|
|
this.visible = false
|
|
|
},
|
|
|
- async updateStatusById(type, callback) {
|
|
|
- this.loading = true
|
|
|
- workCollectAccessoryService.updateStatusById(param).then(() => {
|
|
|
- this.loading = false
|
|
|
- callback()
|
|
|
- })
|
|
|
- },
|
|
|
}
|
|
|
|
|
|
}
|