diff --git a/pc4mobx/organization/apis/columnPermission.js b/pc4mobx/organization/apis/columnPermission.js index ed88720..4c74908 100644 --- a/pc4mobx/organization/apis/columnPermission.js +++ b/pc4mobx/organization/apis/columnPermission.js @@ -7,8 +7,8 @@ export const userDefineCardItemSave = (params) => { return WeaTools.callApi('/api/hrm/carddisplay/saveCustomCard', 'POST', params); } export const hasRight = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/cardAccess/hasRight', 'POST', params); + return WeaTools.callApi('/api/bs/hrmorganization/cardAccess/hasRight', 'GET', params); } export const getTable = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/cardAccess/getTable', 'POST', params); + return WeaTools.callApi('/api/bs/hrmorganization/cardAccess/getTable', 'GET', params); } diff --git a/pc4mobx/organization/components/columnPermission/components/permissionItem.js b/pc4mobx/organization/components/columnPermission/components/permissionItem.js index 7bc51e4..19771db 100644 --- a/pc4mobx/organization/components/columnPermission/components/permissionItem.js +++ b/pc4mobx/organization/components/columnPermission/components/permissionItem.js @@ -1,7 +1,9 @@ import React, { Component } from "react"; -import { toJS } from 'mobx'; +import { WeaTableNew } from "comsMobx"; +import { WeaCheckbox, WeaBrowser } from "ecCom"; import { inject, observer } from "mobx-react"; -import { WeaTableEdit } from "ecCom"; + +const WeaTable = WeaTableNew.WeaTable; @inject("columnPermission") @observer @@ -14,94 +16,50 @@ class PermissionItem extends Component { const { columnPermission } = this.props; columnPermission.loadTabOneRelatedData(); }; + renderRenderColumns = columns => { + columns.forEach((c, index) => { + if (c.dataIndex === "status" || c.dataIndex === "all_people" || + c.dataIndex === "superior" || c.dataIndex === "all_superior") { + c.render = function (text, record) { + return ( + { + // console.log(value); + // }} + /> + ); + }; + } else if (c.dataIndex === "custom") { + c.render = function (text, record) { + return ( + + ); + }; + } + }); + }; render() { - const { columnPermission } = this.props, { tabOneRelatedData } = columnPermission; - const { datas, columns } = tabOneRelatedData; - // const columns = [ - // { - // title: "栏目", - // dataIndex: "column", - // key: "column", - // com: [ - // { label: "", type: "TEXT", viewAttr: 1, key: "column" } - // ] - // }, - // { - // title: "是否启用", - // dataIndex: "isused", - // key: "isused", - // com: [ - // { - // type: "CHECKBOX", - // key: "isused", - // viewAttr: 1 - // } - // ] - // }, - // { - // title: "所有人可见", - // dataIndex: "all", - // key: "all", - // com: [ - // { - // type: "CHECKBOX", - // key: "all" - // } - // ] - // }, - // { - // title: "上级可见", - // dataIndex: "highVisible", - // key: "highVisible", - // com: [ - // { - // type: "CHECKBOX", - // key: "highVisible" - // } - // ] - // }, - // { - // title: "所有上级可见", - // dataIndex: "allVisible", - // key: "allVisible", - // com: [ - // { - // type: "CHECKBOX", - // key: "allVisible" - // } - // ] - // }, - // { - // title: "查看自定义", - // dataIndex: "customRole", - // key: "customRole", - // com: [ - // { label: "", type: "TEXT", viewAttr: 1, key: "customRole" } - // ] - // } - // ]; - // const datas = [ - // { - // id: "1", - // column: "基本信息", - // isused: false, - // all: false, - // highVisible: true, - // allVisible: false, - // customRole: "角色1" - // } - // ]; + const { columnPermission } = this.props, { tableStore } = columnPermission; return (
- { + // console.log(record); + // return { + // disabled: true // 配置无法勾选的列 + // }; + // } + // }} + getColumns={c => this.renderRenderColumns(c)} + onOperatesClick={(record, index, operate) => + this.onOperatesClick(record, index, operate)} />
); diff --git a/pc4mobx/organization/components/columnPermission/index.js b/pc4mobx/organization/components/columnPermission/index.js index 62a20a2..6646008 100644 --- a/pc4mobx/organization/components/columnPermission/index.js +++ b/pc4mobx/organization/components/columnPermission/index.js @@ -51,9 +51,9 @@ class ColumnPermission extends Component { render() { const { columnPermission } = this.props; const { selectedKey, authorized } = columnPermission; - // if (!authorized) { - // return renderNoright(); - // } + if (!authorized) { + return renderNoright(); + } return (
{ - console.log('res', res); - extendObservable(this.tabOneRelatedData, { - datas: [], - columns: [], - loading: false - }); - // res.map((rs, index) => { - // if (index == 0) { - // let { - // api_status, - // data - // } = rs; - // - // if (api_status) { - // data !== undefined && extendObservable(this.tabOneRelatedData, { - // data: data - // }); - // extendObservable(this.tabOneRelatedData, { - // loading: false - // }); - // } else { - // message.error(rs.message); - // } - // } - // }); + ).then(([res]) => { + if (res.code === 200) { + res.data.datas && this.tableStore.getDatas(res.data.datas, 1); + } else { + message.warning(res.msg); + } }).catch(error => { message.error(error); });