| | |
| | | </template> |
| | | </el-dialog> |
| | | <!-- 新增编辑弹窗 --> |
| | | <addDialog :params="addParams" @refreshTable="this.onLoad"/> |
| | | <addDialog :params="addParams" @refreshTable="this.onLoad" /> |
| | | </basic-container> |
| | | </template> |
| | | |
| | |
| | | import NProgress from 'nprogress'; |
| | | import 'nprogress/nprogress.css'; |
| | | import addDialog from "./components/addDialog.vue"; |
| | | import { getDeptTree } from '@/api/system/dept'; |
| | | |
| | | export default { |
| | | components: { |
| | |
| | | isAddDialogVisible: false, |
| | | addParams: {}, |
| | | viewParams: {}, |
| | | depts: [] |
| | | }; |
| | | }, |
| | | computed: { |
| | |
| | | beforeOpen(done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getDetail(this.form.id).then(res => { |
| | | if (type === 'view') { |
| | | this.deptData().then(deptRes => { |
| | | const candidates = [] |
| | | res.data.data.candidateNum.forEach(item => { |
| | | const value = deptRes.find(dept => dept.id === item.deptId) |
| | | candidates.push(`${value.title}: ${item.val}人`) |
| | | }) |
| | | this.form.candidateNum = candidates.join('、') |
| | | }) |
| | | } |
| | | this.form = res.data.data; |
| | | }); |
| | | } |
| | |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | deptData() { |
| | | return getDeptTree(this.website.tenantId).then(deptResult => { |
| | | const result = deptResult.data.data |
| | | let deptList = [] |
| | | result.forEach(dept => { |
| | | if (dept.children) { |
| | | deptList = result.concat(dept.children) |
| | | delete dept.children |
| | | } else { |
| | | deptList.push(dept) |
| | | } |
| | | }) |
| | | return deptList |
| | | }); |
| | | } |
| | | } |
| | | }; |