diff --git a/pc4mobx/organization/apis/department.js b/pc4mobx/organization/apis/department.js index 47ddcd6..799ff3d 100644 --- a/pc4mobx/organization/apis/department.js +++ b/pc4mobx/organization/apis/department.js @@ -29,12 +29,20 @@ export const getAdvanceSearchCondition = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/dept/getSearchCondition', 'GET', params); } -export const getHrmListByJobId = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/job/getHrmListByJobId', 'GET', params); +export const getPostionTable = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/dept/getJobListByPid', 'GET', params); } export const getCopyForm = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/job/getCopyForm', 'GET', params); + return WeaTools.callApi('/api/bs/hrmorganization/dept/getCopyForm', 'GET', params); +} + +export const getMergeForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/dept/getMergeForm', 'GET', params); +} + +export const getTransferForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/dept/getMoveForm', 'GET', params); } export const add = (params) => { @@ -49,7 +57,29 @@ export const add = (params) => { } export const copy = (params) => { - return fetch('/api/bs/hrmorganization/job/copyJobItem', { + return fetch('/api/bs/hrmorganization/dept/copyDepartment', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const merge = (params) => { + return fetch('/api/bs/hrmorganization/dept/mergeDepartment', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const transfer = (params) => { + return fetch('/api/bs/hrmorganization/dept/moveDepartment', { method: 'POST', mode: 'cors', headers: { diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index fcc0034..e32d334 100644 --- a/pc4mobx/organization/components/company/company.js +++ b/pc4mobx/organization/components/company/company.js @@ -1,7 +1,7 @@ /** * @Author: 程亮 * @Date: 2022-05-18 16:23:32 - * @LastEditTime: 2022-06-01 17:15:50 + * @LastEditTime: 2022-06-06 14:21:43 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js */ @@ -271,12 +271,10 @@ export default class Company extends React.Component { c.render = function (text, record) { const menu = ( - { - record.isUsed === 0 ? - { _this.doDel(record.id) }}>删除 - : '' - } - + + { _this.doDel(record.id) }}>删除 + + { _this.select(record.id) }}>联查部门 @@ -402,6 +400,7 @@ export default class Company extends React.Component { } = company; const rowSelection = { + type: "checkbox", onChange(selectedRowKeys, selectedRows) { company.setSelectedRowKeys(selectedRowKeys); }, diff --git a/pc4mobx/organization/components/department/NewPopconfirm.js b/pc4mobx/organization/components/department/NewPopconfirm.js index e68370e..db925d6 100644 --- a/pc4mobx/organization/components/department/NewPopconfirm.js +++ b/pc4mobx/organization/components/department/NewPopconfirm.js @@ -23,7 +23,7 @@ export default class NewPopconfirm extends React.Component { constructor(props) { super(props); this.state = { - width: 700, + padding: "20px" } } @@ -38,19 +38,25 @@ export default class NewPopconfirm extends React.Component { let arr = []; isFormInit && condition.map(c => { c.items.map((field, index) => { - arr.push( - {} + {} ) }) }) return
{arr}
} + onChange = data => { + debugger + + }; + render() { const { title, @@ -59,8 +65,9 @@ export default class NewPopconfirm extends React.Component { onCancel, loading, height, + width } = this.props, { - width, + padding } = this.state; const buttons = [ @@ -84,7 +91,7 @@ export default class NewPopconfirm extends React.Component { loading ?
- : this.getForm() + : this.getForm() } ) diff --git a/pc4mobx/organization/components/department/department.js b/pc4mobx/organization/components/department/department.js index dccdfe1..cea9224 100644 --- a/pc4mobx/organization/components/department/department.js +++ b/pc4mobx/organization/components/department/department.js @@ -1,7 +1,7 @@ /** * @Author: 程亮 * @Date: 2022-06-02 09:19:37 - * @LastEditTime: 2022-06-02 16:41:55 + * @LastEditTime: 2022-06-06 16:40:18 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/department/department.js */ @@ -42,8 +42,8 @@ import '../../style/common.less'; import NewAndEditDialog from '../NewAndEditDialog'; - import NewWeaTableDialog from '../NewWeaTableDialog'; -import NewPopconfirm from './NewPopconfirm' + import NewTableDialog from '../NewTableDialog'; + import NewPopconfirm from './NewPopconfirm' const toJS = mobx.toJS; const confirm = Modal.confirm; @@ -132,13 +132,14 @@ import NewPopconfirm from './NewPopconfirm' //联查岗位 select(id) { - // const { - // department - // } = this.props; + const { + department + } = this.props; - // department.setNeDialogTitle("联查人员"); - // department.setVisible(true); - // department.getHrmTable(id); + department.setNeDialogTitle("联查岗位"); + department.setVisible(true); + department.setDialogLoadingStatus(true); + department.getPostionTable(id); } @@ -149,8 +150,10 @@ import NewPopconfirm from './NewPopconfirm' } = this.props; department.setNeDialogTitle(i18n.label.mergeDept()); - department.confirmVisible(true); - department.getMergeForm(); + department.setConfirmVisible(true); + department.setIds(id); + department.setIsMerge(true); + department.getMergeForm(id); } //转移 @@ -159,9 +162,11 @@ import NewPopconfirm from './NewPopconfirm' department } = this.props; - department.setNeDialogTitle(i18n.label.mergeDept()); - department.confirmVisible(true); - department.getTransferForm(); + department.setNeDialogTitle(i18n.label.transferDept()); + department.setConfirmVisible(true); + department.setIds(id); + department.setIsMerge(false); + department.getTransferForm(id); } @@ -331,18 +336,16 @@ import NewPopconfirm from './NewPopconfirm' c.render = function (text, record) { const menu = ( - { - record.isUsed === 0 ? - { _this.doDel(record.id) }}>删除 - : '' - } - + + { _this.doDel(record.id) }}>删除 + + { _this.merge(record.id) }}>合并 - + { _this.transfer(record.id) }}>转移 - + { _this.select(record.id) }}>联查岗位 @@ -372,6 +375,15 @@ import NewPopconfirm from './NewPopconfirm' } = this.props; department.save(); } + + PopconfirmSave() { + const { + department + } = this.props; + const {isMerge} = department; + isMerge && department.merge(); + !isMerge && department.transfer(); + } getTabBtn() { const { @@ -514,10 +526,11 @@ import NewPopconfirm from './NewPopconfirm' isPanelShow, departmentName, conditionNum, visible, condition, form, tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading, form1, isEdit, newVisible, jobDataSource, jobColumns, selectedRowKeys, total, current, pageSize, init, - defaultShowLeft,confirmVisible,confirmLoading + defaultShowLeft,confirmVisible,confirmLoading,postionDataSource,postionColumns,isMerge } = department; const rowSelection = { + type:"checkbox", onChange(selectedRowKeys, selectedRows) { department.setSelectedRowKeys(selectedRowKeys); }, @@ -597,13 +610,15 @@ import NewPopconfirm from './NewPopconfirm' - department.setVisible(false)} - /> + department.setVisible(false)} + /> this.handleSave()} - onCancel={() => department.setNewVisible(false)} + height={isMerge ? 100 : 140} + width={400} + isMerge={isMerge} + save={() => this.PopconfirmSave()} + onCancel={() => department.setConfirmVisible(false)} /> ) diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js index a97b765..4ed6499 100644 --- a/pc4mobx/organization/index.js +++ b/pc4mobx/organization/index.js @@ -13,7 +13,6 @@ import OfficeManage from "./components/office/officeManage"; import CompanyExtend from "./components/company/CompanyExtend"; import BranchNumSetting from "./components/branchNumSetting"; import Company from "./components/company/company"; -import DepartmentManage from "./components/deptment"; import StaffScheme from "./components/staff/StaffScheme"; import Staff from "./components/staff/Staff"; import Job from "./components/job/Job"; diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js index b322bdf..1542efc 100644 --- a/pc4mobx/organization/public/i18n.js +++ b/pc4mobx/organization/public/i18n.js @@ -142,6 +142,7 @@ export const i18n = { deptManage: () => getLabel(385936, '部门管理'), newDept: () => getLabel(386246, '新建部门'), mergeDept:()=> getLabel(386246, '合并部门'), + transferDept:()=> getLabel(386246, '转移部门'), diff --git a/pc4mobx/organization/stores/department.js b/pc4mobx/organization/stores/department.js index fa19819..c9d38ea 100644 --- a/pc4mobx/organization/stores/department.js +++ b/pc4mobx/organization/stores/department.js @@ -1,457 +1,523 @@ import { - observable, - action - } from 'mobx'; - import * as mobx from 'mobx'; - import * as Api from '../apis/department'; // 引入API接口文件 - import { - WeaForm - } from 'comsMobx'; - import { - WeaTableNew - } from 'comsMobx'; - import { - Modal, - message, - } from 'antd' - import { - i18n - } from '../public/i18n'; - - const toJS = mobx.toJS; - const { - TableStore - } = WeaTableNew; - - - export class DepartmentStore { - @observable tableStore = new TableStore(); - @observable topMenu = [] - @observable rightMenu = []; - @observable dataSource = []; - @observable columns = []; - @observable jobDataSource = []; - @observable jobColumns = []; - @observable loading = true; - @observable dialogLoading = true; - @observable isEdit = true; - @observable nEdialogTitle = ''; - @observable searchCondition = []; - @observable condition = []; - @observable copyCondition = []; - @observable isPanelShow = false; //高级搜索面板 - @observable form = new WeaForm(); - @observable form1 = new WeaForm(); //新增主表表单 - @observable form2 = new WeaForm(); //复制表单 - @observable departmentName = ''; - @observable conditionNum = 8; - @observable ids = ''; //选择行id - @observable id = ''; //页面跳转参数id - @observable searchConditionLoading = true; - @observable visible = false; - @observable newVisible = false; //新增弹窗 - @observable departmentId = ''; - @observable selectedRowKeys = ''; - @observable date = ''; - @observable init = true; //是否首次加载 - @observable total = ''; - @observable current = 1; - @observable pageSize = 10; - - @observable defaultShowLeft = true; - @observable companysId = 1 //集团id - - @observable confirmVisible = false; - @observable confirmLoading = true; - - - @action - getTableInfo(params) { - this.setLoading(true); + observable, + action +} from 'mobx'; +import * as mobx from 'mobx'; +import * as Api from '../apis/department'; // 引入API接口文件 +import { + WeaForm +} from 'comsMobx'; +import { + WeaTableNew +} from 'comsMobx'; +import { + Modal, + message, +} from 'antd' +import { + i18n +} from '../public/i18n'; + +const toJS = mobx.toJS; +const { + TableStore +} = WeaTableNew; + + +export class DepartmentStore { + @observable tableStore = new TableStore(); + @observable topMenu = [] + @observable rightMenu = []; + @observable dataSource = []; + @observable columns = []; + @observable loading = true; + @observable dialogLoading = true; + @observable isEdit = true; + @observable nEdialogTitle = ''; + @observable searchCondition = []; + @observable condition = []; + @observable copyCondition = []; + @observable isPanelShow = false; //高级搜索面板 + @observable form = new WeaForm(); + @observable form1 = new WeaForm(); //新增主表表单 + @observable form2 = new WeaForm(); //复制表单 + @observable departmentName = ''; + @observable conditionNum = 8; + @observable ids = ''; //选择行id + @observable id = ''; //页面跳转参数id + @observable searchConditionLoading = true; + @observable visible = false; + @observable newVisible = false; //新增弹窗 + @observable departmentId = ''; + @observable selectedRowKeys = ''; + @observable date = ''; + @observable init = true; //是否首次加载 + @observable total = ''; + @observable current = 1; + @observable pageSize = 10; + @observable defaultShowLeft = true; + @observable companysId = 1 //集团id + @observable postionDataSource = []; + @observable postionColumns = []; + + @observable confirmVisible = false; + @observable confirmLoading = true; + @observable isMerge = true; + + + @action + getTableInfo(params) { + this.setLoading(true); + params = { + ...params, + current: this.current, + pageSize: this.pageSize + } + if (this.isEmptyObject(this.form.getFormParams())) { params = { ...params, - current: this.current, - pageSize: this.pageSize - } - if (this.isEmptyObject(this.form.getFormParams())) { - params = { - ...params, - ...this.form.getFormParams(), - departmentName: this.departmentName - }; + ...this.form.getFormParams(), + departmentName: this.departmentName + }; + } else { + params = { + ...params, + ...this.form.getFormParams(), + }; + } + Api.getSearchList(params).then(response => { + return response.json() + }).then(res => { + if (res.code === 200) { + res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns); + this.setTotal(res.data.pageInfo.total); + res.data.pageInfo.list && this.setDataSource(res.data.pageInfo.list); + this.setLoading(false); + this.setInit(false); } else { - params = { - ...params, - ...this.form.getFormParams(), - }; + message.warning(res.msg); } - Api.getSearchList(params).then(response => { - return response.json() - }).then(res => { - if (res.code === 200) { - res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns); - this.setTotal(res.data.pageInfo.total); - res.data.pageInfo.list && this.setDataSource(res.data.pageInfo.list); - this.setLoading(false); - this.setInit(false); - } else { - message.warning(res.msg); - } - }).catch(error => { - message.warning(error.msg); - }) - } - - @action("nodetree事件") - doSearch(params) { - this.setInit(true); - this.getTableInfo(params); - } - - @action("联查人员") - getHrmTable(id) { - // let params = { - // departmentId: id - // } - // this.tableStore = new TableStore(); - // Api.getHrmListBydepartmentId(params).then(res => { - // if (res.code === 200) { - // res.data.datas && this.tableStore.getDatas(res.data.datas, 1); - // } else { - // message.warning(res.msg); - // } - // }, error => { - // message.warning(error.msg); - // }) - } - - //删除 - delete() { - let params = { - ids: this.ids - }; - Api.deleteTableData(params).then(response => { - return response.json() - }).then(data => { - if (data.code === 200) { - message.success(i18n.message.deleteSuccess()); - this.setSelectedRowKeys(''); - this.getTableInfo(); - } else { - message.warning(data.msg); - } - }).catch(error => { - message.warning(error.msg); - }) - } - - updateForbiddenTag(checked, id) { - let params = { - forbiddenTag: checked, - id: id - } - Api.updateForbiddenTag(params).then(response => { - return response.json() - }).then(data => { - if (data.code === 200) { - message.success(data.msg, 1); - } else { - message.warning(data.msg); - } - }).catch(error => { - message.warning(error.msg); - }) - } - - getSearchCondition() { - this.setScLoadingStatus(true); - Api.getAdvanceSearchCondition().then(res => { - if (res.code === 200) { - this.setScLoadingStatus(false); - res.data.conditions && this.setSearchCondition(res.data.conditions); - res.data.conditions && this.form.initFormFields(res.data.conditions); - } else { - message.warning(res.msg); - } - }, error => { - message.warning(error.msg); - }) - } - - - getDeptForm() { - let params = {}; - this.setDialogLoadingStatus(true); - Api.getDeptForm(params).then(res => { - if (res.code === 200) { - this.setDialogLoadingStatus(false); - res.data.condition && this.setCondition(res.data.condition); - res.data.condition && this.form1.initFormFields(res.data.condition); - } else { - message.warning(res.msg); - } - }, error => { - message.warning(error.msg); - }) - } + }).catch(error => { + message.warning(error.msg); + }) + } - @action("合并部门") - getMergeForm() { - // let params = {}; - // this.setConfirmLoading(true); - // Api.getDeptForm(params).then(res => { - // if (res.code === 200) { - // this.setConfirmLoading(false); - // res.data.condition && this.setCondition(res.data.condition); - // res.data.condition && this.form1.initFormFields(res.data.condition); - // } else { - // message.warning(res.msg); - // } - // }, error => { - // message.warning(error.msg); - // }) - } + @action("nodetree事件") + doSearch(params) { + this.setInit(true); + this.getTableInfo(params); + } - @action("转移部门") - getTransferForm() { - // let params = {}; - // this.setConfirmLoading(true); - // Api.getDeptForm(params).then(res => { - // if (res.code === 200) { - // this.setConfirmLoading(false); - // res.data.condition && this.setCondition(res.data.condition); - // res.data.condition && this.form1.initFormFields(res.data.condition); - // } else { - // message.warning(res.msg); - // } - // }, error => { - // message.warning(error.msg); - // }) + @action("联查岗位") + getPostionTable(id) { + let params = { + parentDept: id } - - @action("复制表单") - getCopyForm() { - let params = {}; - Api.getCopyForm(params).then(res => { - if (res.code === 200) { - res.data && this.setCopyCondition(res.data); - res.data && this.form2.initFormFields(res.data); - } else { - message.warning(res.msg); - } - }, error => { - message.warning(error.msg); - }) - } - - - save() { - let params = { - ...this.form1.getFormParams() - }; - this.form1.validateForm().then(f => { - if (f.isValid) { - Api.add(params).then(response => { - return response.json() - }).then(data => { - if (data.code === 200) { - message.success(data.msg); - this.getTableInfo(); - this.setNewVisible(false); - } else { - message.warning(data.msg); - } - }).catch(error => { - message.warning(error.msg); - }) - } else { - f.showErrors(); - this.setDate(new Date()); - } - }); - } - - copy() { - let params = { - ids: this.ids, - ...this.form2.getFormParams() - }; - Api.copy(params).then(response => { - return response.json() - }).then(data => { - if (data.code === 200) { - message.success(data.msg); - this.getTableInfo(); - this.form2 = new WeaForm(); - this.setSelectedRowKeys(''); - } else { - message.error(data.msg); - } - }).catch(error => { - message.warning(error.msg); - }) - - } - - - @action - getHasRight() { - Api.getHasRight().then(res => { - if (res.code === 200) { - res.data.rightMenu && this.setRightMenu(res.data.rightMenu); - res.data.topMenu && this.setTopMenu(res.data.topMenu); - } else { - message.warning(res.msg); - } - }, error => { - message.warning(error.msg); - }) - } - - updateFields(val) { - this.form.updateFields({ - compName: { - value: val - } - }); - } - - setSearchCondition(condition) { - this.searchCondition = condition; - } - - setScLoadingStatus(bool) { - this.searchConditionLoading = bool; - } - - setPanelStatus(bool) { - this.isPanelShow = bool; - bool && this.getSearchCondition(); - if (!bool) { - this.scLoadingReset(); + Api.getPostionTable(params).then(response => { + return response.json() + }).then(res => { + if (res.code === 200) { + res.data.list && this.setPostionDataSource(res.data.list); + res.data.columns && this.setPostionColumns(res.data.columns); + this.setDialogLoadingStatus(false); + } else { + message.warning(res.msg); } - } - - setDepartmentName(val) { - this.departmentName = val; - } - - isEmptyObject(obj) { - for (let key in obj) { - return false; - } - return true; - } - - setIds(ids) { - this.ids = ids; - } - - setId(id) { - this.id = id; - } - - scLoadingReset() { - this.searchConditionLoading = true; - } - - - formReset() { - this.form1 = new WeaForm(); - } - - - setVisible(bool) { - this.visible = bool; - } - - setDialogLoadingStatus(bool) { - this.dialogLoading = bool; - } - - - setSearchCondition(searchCondition) { - this.searchCondition = searchCondition; - } - - setDepartmentId(departmentId) { - this.departmentId = departmentId; - } - - setDate(date) { - this.date = date; - } - - setTopMenu(topMenu) { - this.topMenu = topMenu; - } - - setRightMenu(rightMenu) { - this.rightMenu = rightMenu; - } - - setDataSource(dataSource) { - this.dataSource = dataSource; - } - - setJobDataSource(jobDataSource) { - this.jobDataSource = jobDataSource; - } - - setColumns(columns) { - this.columns = columns - } - - setJobColumns(jobColumns) { - this.jobColumns = jobColumns - } - - setSelectedRowKeys(selectedRowKeys) { - this.selectedRowKeys = selectedRowKeys; - } - - setLoading(bool) { - this.loading = bool; - } - - setNeDialogTitle(title) { - this.nEdialogTitle = title - } - - setCondition(condition) { - this.condition = condition; - } - - setCopyCondition(copyCondition) { - this.copyCondition = copyCondition; - } - - setNewVisible(bool) { - this.formReset(); - this.newVisible = bool; - } - - setTotal(total) { - this.total = total; - } - - setCurrent(current) { - this.current = current; - } - - setPageSize(pageSize) { - this.pageSize = pageSize; - } - - setInit(bool) { - this.init = bool; - } - - setConfirmVisible(confirmVisible) { - this.confirmVisible = confirmVisible; - } + }).catch(error => { + message.warning(error.msg); + }) + } - setConfirmLoading(confirmLoading) { - this.confirmLoading = confirmLoading; + //删除 + delete() { + let params = { + ids: this.ids + }; + Api.deleteTableData(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(i18n.message.deleteSuccess()); + this.setSelectedRowKeys(''); + this.getTableInfo(); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) + } + + updateForbiddenTag(checked, id) { + let params = { + forbiddenTag: checked, + id: id } - } \ No newline at end of file + Api.updateForbiddenTag(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg, 1); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) + } + + getSearchCondition() { + this.setScLoadingStatus(true); + Api.getAdvanceSearchCondition().then(res => { + if (res.code === 200) { + this.setScLoadingStatus(false); + res.data.conditions && this.setSearchCondition(res.data.conditions); + res.data.conditions && this.form.initFormFields(res.data.conditions); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) + } + + + getDeptForm() { + let params = {}; + this.setDialogLoadingStatus(true); + Api.getDeptForm(params).then(res => { + if (res.code === 200) { + this.setDialogLoadingStatus(false); + res.data.condition && this.setCondition(res.data.condition); + res.data.condition && this.form1.initFormFields(res.data.condition); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) + } + + @action("合并部门") + getMergeForm(id) { + let params = { + id:id + }; + this.setConfirmLoading(true); + Api.getMergeForm(params).then(res => { + if (res.code === 200) { + this.setConfirmLoading(false); + res.data && this.setCondition(res.data); + res.data && this.form1.initFormFields(res.data); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) + } + + @action("转移部门") + getTransferForm(id) { + let params = { + id:id + }; + this.setConfirmLoading(true); + Api.getTransferForm(params).then(res => { + if (res.code === 200) { + this.setConfirmLoading(false); + res.data && this.setCondition(res.data); + res.data && this.form1.initFormFields(res.data); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) + } + + @action("复制表单") + getCopyForm() { + let params = {}; + Api.getCopyForm(params).then(res => { + if (res.code === 200) { + res.data && this.setCopyCondition(res.data); + res.data && this.form2.initFormFields(res.data); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) + } + + + save() { + let params = { + ...this.form1.getFormParams() + }; + this.form1.validateForm().then(f => { + if (f.isValid) { + Api.add(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg); + this.getTableInfo(); + this.setNewVisible(false); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) + } else { + f.showErrors(); + this.setDate(new Date()); + } + }); + } + + merge() { + let params = { + id:this.ids, + ...this.form1.getFormParams() + }; + this.form1.validateForm().then(f => { + if (f.isValid) { + Api.merge(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg); + this.getTableInfo(); + this.setConfirmVisible(false); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) + } else { + f.showErrors(); + this.setDate(new Date()); + } + }); + } + + transfer() { + let params = { + id:this.ids, + ...this.form1.getFormParams() + }; + this.form1.validateForm().then(f => { + if (f.isValid) { + Api.transfer(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg); + this.getTableInfo(); + this.setConfirmVisible(false); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) + } else { + f.showErrors(); + this.setDate(new Date()); + } + }); + } + + copy() { + let params = { + ids: this.ids, + ...this.form2.getFormParams() + }; + Api.copy(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg); + this.getTableInfo(); + this.form2 = new WeaForm(); + this.setSelectedRowKeys(''); + } else { + message.error(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) + + } + + + @action + getHasRight() { + Api.getHasRight().then(res => { + if (res.code === 200) { + res.data.rightMenu && this.setRightMenu(res.data.rightMenu); + res.data.topMenu && this.setTopMenu(res.data.topMenu); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) + } + + updateFields(val) { + this.form.updateFields({ + compName: { + value: val + } + }); + } + + setSearchCondition(condition) { + this.searchCondition = condition; + } + + setScLoadingStatus(bool) { + this.searchConditionLoading = bool; + } + + setPanelStatus(bool) { + this.isPanelShow = bool; + bool && this.getSearchCondition(); + if (!bool) { + this.scLoadingReset(); + } + } + + setDepartmentName(val) { + this.departmentName = val; + } + + isEmptyObject(obj) { + for (let key in obj) { + return false; + } + return true; + } + + setIds(ids) { + this.ids = ids; + } + + setId(id) { + this.id = id; + } + + scLoadingReset() { + this.searchConditionLoading = true; + } + + + formReset() { + this.form1 = new WeaForm(); + } + + + setVisible(bool) { + this.visible = bool; + } + + setDialogLoadingStatus(bool) { + this.dialogLoading = bool; + } + + + setSearchCondition(searchCondition) { + this.searchCondition = searchCondition; + } + + setDepartmentId(departmentId) { + this.departmentId = departmentId; + } + + setDate(date) { + this.date = date; + } + + setTopMenu(topMenu) { + this.topMenu = topMenu; + } + + setRightMenu(rightMenu) { + this.rightMenu = rightMenu; + } + + setDataSource(dataSource) { + this.dataSource = dataSource; + } + + setColumns(columns) { + this.columns = columns + } + + setSelectedRowKeys(selectedRowKeys) { + this.selectedRowKeys = selectedRowKeys; + } + + setLoading(bool) { + this.loading = bool; + } + + setNeDialogTitle(title) { + this.nEdialogTitle = title + } + + setCondition(condition) { + this.condition = condition; + } + + setCopyCondition(copyCondition) { + this.copyCondition = copyCondition; + } + + setNewVisible(bool) { + this.formReset(); + this.newVisible = bool; + } + + setTotal(total) { + this.total = total; + } + + setCurrent(current) { + this.current = current; + } + + setPageSize(pageSize) { + this.pageSize = pageSize; + } + + setInit(bool) { + this.init = bool; + } + + setConfirmVisible(confirmVisible) { + this.formReset(); + this.confirmVisible = confirmVisible; + } + + setConfirmLoading(confirmLoading) { + this.confirmLoading = confirmLoading; + } + + setPostionDataSource(postionDataSource) { + this.postionDataSource = postionDataSource; + } + + setPostionColumns(postionColumns) { + this.postionColumns = postionColumns; + } + + setIsMerge(bool) { + this.isMerge = bool; + } +} \ No newline at end of file