From 0d3d6c79f0e76be540957a50453ae1d3da3a077b Mon Sep 17 00:00:00 2001
From: Chengliang <1546584672@qq.com>
Date: Tue, 20 Sep 2022 14:15:13 +0800
Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E5=8D=A1=E7=89=87?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/postionrank/RankScheme.js | 4 +-
.../components/resource/ResourceCard.js | 76 ++++++
pc4mobx/organization/index.js | 3 +-
pc4mobx/organization/stores/index.js | 4 +-
pc4mobx/organization/stores/resourceCard.js | 224 +-----------------
pc4mobx/organization/style/common.less | 3 +
6 files changed, 87 insertions(+), 227 deletions(-)
diff --git a/pc4mobx/organization/components/postionrank/RankScheme.js b/pc4mobx/organization/components/postionrank/RankScheme.js
index a569b53..efe0e7c 100644
--- a/pc4mobx/organization/components/postionrank/RankScheme.js
+++ b/pc4mobx/organization/components/postionrank/RankScheme.js
@@ -55,9 +55,7 @@ export default class RankScheme extends React.Component {
}
componentWillUnmount() {
- debugger
- alert('组件销毁?')
- }
+ }
componentWillReceiveProps(nextProps) {
diff --git a/pc4mobx/organization/components/resource/ResourceCard.js b/pc4mobx/organization/components/resource/ResourceCard.js
index e69de29..752dd06 100644
--- a/pc4mobx/organization/components/resource/ResourceCard.js
+++ b/pc4mobx/organization/components/resource/ResourceCard.js
@@ -0,0 +1,76 @@
+import React from 'react'
+import * as mobx from 'mobx'
+import {
+ inject,
+ observer
+} from 'mobx-react'
+import {
+ WeaTop,
+ WeaTab,
+ WeaFormItem,
+ WeaRightMenu,
+ WeaAlertPage
+} from 'ecCom'
+import {
+ Row,
+ Col,
+ Spin,
+ Modal,
+ Button,
+ message,
+ Switch
+} from 'antd'
+import {
+ WeaSwitch,
+ WeaTableNew
+} from 'comsMobx'
+import {
+ i18n
+} from '../../public/i18n';
+
+import '../../style/common.less';
+
+import { renderNoright } from '../../util'; // 从util文件引入公共的方法
+
+
+
+const toJS = mobx.toJS;
+const confirm = Modal.confirm;
+
+@inject('resourceCard')
+@observer
+export default class ResourceCard extends React.Component {
+ constructor(props) {
+ super(props);
+ }
+
+ componentWillMount() {
+ }
+
+ componentDidMount() {
+ this.init();
+ }
+
+ componentWillUnmount() {
+ }
+
+
+ componentWillReceiveProps(nextProps) {
+ if (this.props.location.key !== nextProps.location.key) {
+ this.init();
+ }
+ }
+
+ init() {
+ const {
+ resourceCard
+ } = this.props;
+ }
+
+ render(){
+ return(
+
111
+ )
+ }
+
+}
\ No newline at end of file
diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js
index b77ee0c..45f21a9 100644
--- a/pc4mobx/organization/index.js
+++ b/pc4mobx/organization/index.js
@@ -31,6 +31,7 @@ import HrmInfoExtend from "./components/resource/HrmInfoExtend";
import NewImport from "./components/newImport"
import StaffWorkflowSet from "./components/staff/StaffWorkflowSet"
import ResourceBasicInfo from "./components/resource/ResourceBasicInfo";
+import ResourceCard from "./components/resource/ResourceCard";
import stores from "./stores";
import "./style/index";
@@ -94,7 +95,7 @@ const Routes = (
-
+
);
diff --git a/pc4mobx/organization/stores/index.js b/pc4mobx/organization/stores/index.js
index 5c00af0..83502fe 100644
--- a/pc4mobx/organization/stores/index.js
+++ b/pc4mobx/organization/stores/index.js
@@ -25,6 +25,7 @@ import {HrmBasicDataImport} from "./import";
import {NewImportStore} from "./newImport";
import {ResourceBasicInfoStore} from "./reserouseBasicInfo";
import {ImportDialogStore} from "./importDialog";
+import {ResourceCardStore} from "./resourceCard";
module.exports = {
@@ -54,5 +55,6 @@ module.exports = {
hrmBasicDataImport:new HrmBasicDataImport(),
newImport: new NewImportStore(),
resourceBasicInfo: new ResourceBasicInfoStore(),
- importDialog: new ImportDialogStore()
+ importDialog: new ImportDialogStore(),
+ resourceCard:new ResourceCardStore()
};
diff --git a/pc4mobx/organization/stores/resourceCard.js b/pc4mobx/organization/stores/resourceCard.js
index de4b4a6..baa4ecd 100644
--- a/pc4mobx/organization/stores/resourceCard.js
+++ b/pc4mobx/organization/stores/resourceCard.js
@@ -6,226 +6,6 @@ import forEach from 'lodash/forEach'
import * as Api from '../apis/resourceCard'; // 引入API接口文件
-export class ResourceExtendStore {
- @observable form = new WeaForm();
- @observable tableInfo = []
- @observable conditions = [];
- @observable isEditor = false;
- @observable isNew = true;
- @observable loading = true;
- @observable tabInfo = [];
- @observable selectedKey = '0';
- @observable detailSelectedKey = '0';
- @observable topTab = [];
- @observable buttons = {};
- @observable id = ''; //人员id
- @observable date = '';
- @observable personalEditTables;
- @observable tabkey = '0'
-
-
- @observable selectedRowKeys = [];
- @observable selectedRows = [];
-
- @action onRowSelect = (keys) => {
- this.setSelectedRowKeys(keys);
- }
-
- @action setSelectedRowKeys = (keys) => {
- this.selectedRowKeys = keys;
- }
-
-
- @action
- edit = () => {
- this.isEditor = true;
- this.getData();
- this.getTabInfo();
- this.detailSelectedKey = '0'
- }
-
- init = () => {
- this.detailSelectedKey = '0'
- this.isEditor = false;
- }
-
- save = () => {
- if (this.loading)
- return;
- this.form.validateForm().then(f => {
- if (f.isValid) {
- this.loading = true;
- if (this.personalEditTables) {
- const targetDatas = this.tableInfo[this.detailSelectedKey].tabinfo.datas,
- isPass = (targetDatas.length > 0) ? this.personalEditTables.refs.edit.doRequiredCheck().pass : true
- if (isPass) {
- this.editResource()
- } else {
- this.loading = false;
- }
- } else {
- this.editResource();
- }
- } else {
- f.showErrors();
- this.setDate(new Date());
- this.loading = false;
- }
- })
- }
-
- editResource = () => {
- let pDatas = this.form.getFormParams();
- Api.editResource({ ...{
- id: this.id
- },
- ...pDatas,
- ...this.getTableEditParams()
- }).then(data => {
- if (data.code == 200) {
- message.success(i18n.message.saveSuccess());
- this.init();
- this.getData();
- this.selectedRowKeys = [];
- } else {
- message.warning(data.message);
- }
- this.loading = false;
- }, error => {
- message.warning(error.message);
- this.loading = false;
- })
- }
-
- getTableEditParams = () => {
- const params = {};
- this.tableInfo && this.tableInfo.forEach(t => {
- t.tabinfo.datas = t.tabinfo.datas || [];
- params[t.tabinfo.rownum] = t.tabinfo.datas.length;
- t.tabinfo && t.tabinfo.datas && t.tabinfo.datas.forEach((item, index) => {
- !isEmpty(item) && forEach(item, (value, key) => {
- Object.assign(params, {
- [`${key}_${index}`]: value
- });
- })
- })
- })
- return params
- }
-
-
-
- getData = () => {
- this.setLoading(true);
- let params = {
- viewAttr: this.isEditor ? 2 : 1,
- id: this.id,
- viewCondition:this.selectedKey
- }
- Api.getResourceExtendForm(params).then((res) => {
- if (res.code === 200) {
- res.data.result.conditions && this.form.initFormFields(res.data.result.conditions);
- res.data.result.conditions && this.setConditions(res.data.result.conditions);
- this.tableInfo = this.handleTable(res.data.result.tables);
- this.getTabInfo();
- res.data.result.buttons && this.setButtons(res.data.result.buttons);
- res.data.result.tabInfo && this.setTopTab(res.data.result.tabInfo);
- this.isEditor && this.getSelectedRows();
- this.setLoading(false);
-
- } else {
- message.warning(res.msg);
- }
- }, error => {
- message.warning(error.msg);
- })
- }
-
- handleTable = (datas) => {
- return datas && datas.map(data => {
- const { tabinfo: { columns } } = data;
- const length = columns.length;
- columns.map(c => {
- c.width = `${95 / length}%`
- })
- return data
- })
- }
-
- getTabInfo = () => {
- this.tabInfo = [];
- this.tableInfo && this.tableInfo.forEach((c, idx) => {
- if (!c.hide) {
- this.tabInfo.push({
- key: `${idx}`,
- title: c.tabname,
- })
- }
- })
- //if (!isEmpty(this.tabInfo)) this.tabkey = this.tabInfo[0].key;
- if (!isEmpty(this.tabInfo)) this.detailSelectedKey = this.tabInfo[0].key;
- }
-
- setLoading(val) {
- this.loading = val;
- }
-
-
- updateTabKey = (key) => {
- this.tabKey = key;
- }
-
- updateDetailSelectedKey =(key) => {
- this.detailSelectedKey = key;
- }
-
- updateTableInfo = (data) => {
- this.tableInfo = data
- }
-
- setSelectedKey = (key) => {
- this.selectedKey = key;
- }
-
- getSelectedRows = () => {
- const selectedRows = [];
- this.tableInfo.forEach(t => {
- const singleTableRows = [];
- t.tabinfo.datas.forEach((data, i) => {
- if (data.viewAttr === 1) {
- singleTableRows.push(i);
- }
- });
- selectedRows.push(singleTableRows);
- })
- this.selectedRows = selectedRows;
- }
-
-
- setTopTab(topTab) {
- this.topTab = topTab;
- }
-
- changeData(key) {
- this.setSelectedKey(key);
- this.getData();
- }
-
- setId(id) {
- this.id = id;
- }
-
- setPersonalEditTables = (ref) => {
- this.personalEditTables = ref;
- }
-
- setConditions(conditions) {
- this.conditions = conditions;
- }
-
- setButtons(buttons) {
- this.buttons = buttons;
- }
-
-
+export class ResourceCardStore {
+
}
diff --git a/pc4mobx/organization/style/common.less b/pc4mobx/organization/style/common.less
index 33a6c32..024cb19 100644
--- a/pc4mobx/organization/style/common.less
+++ b/pc4mobx/organization/style/common.less
@@ -87,3 +87,6 @@
width: 100%;
}
}
+
+//我的卡片样式
+