栏目权限页面的编写

This commit is contained in:
黎永顺 2022-11-08 17:43:26 +08:00
parent c4e93a30c7
commit 21002e1e7d
4 changed files with 58 additions and 117 deletions

View File

@ -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);
}

View File

@ -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 (
<WeaCheckbox
// value={}
// onChange={value => {
// console.log(value);
// }}
/>
);
};
} else if (c.dataIndex === "custom") {
c.render = function (text, record) {
return (
<WeaBrowser type={267} inputStyle={{ width: 200 }} />
);
};
}
});
};
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 (
<div>
<WeaTableEdit
columns={toJS(columns)}
datas={toJS(datas)}
showAdd={false}
showCopy={false}
showDelete={false}
showTitle={false}
<WeaTable
ecId={`${(this && this.props && this.props.ecId) || ""}_WeaTable@b43a4c`}
comsWeaTableStore={tableStore}
hasOrder={true}
needScroll={true}
// rowSelection={{
// getCheckboxProps: record => {
// console.log(record);
// return {
// disabled: true // 配置无法勾选的列
// };
// }
// }}
getColumns={c => this.renderRenderColumns(c)}
onOperatesClick={(record, index, operate) =>
this.onOperatesClick(record, index, operate)}
/>
</div>
);

View File

@ -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 (
<div style={{ height: "100%" }}>
<WeaRightMenu

View File

@ -1,15 +1,18 @@
import * as mobx from "mobx";
import { action, computed, extendObservable, observable } from "mobx";
import { WeaTableNew } from 'comsMobx';
import { message } from "antd";
import { WeaHelpfulTip } from "ecCom";
import { isEmpty } from "lodash";
import { i18n } from "../public/i18n";
import * as Api from "../apis/columnPermission";
const { TableStore } = WeaTableNew;
const toJS = mobx.toJS;
export class ColumnPermission {
@observable weaTopTitle = i18n.module.staffCardDisplay();
@observable tableStore = new TableStore();
@observable btnMenu = [];
@observable selectedKey = "0";
@observable authorized = false;
@ -111,32 +114,12 @@ export class ColumnPermission {
[
Api.getTable()
]
).then(res => {
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);
});