提交 5822ea6d authored 作者: 钟是志's avatar 钟是志

28008 生源地统计页面显示调整

上级 1e1e429f
......@@ -63,7 +63,7 @@ export default class TableList extends React.Component {
}
render() {
const { isTree, json } = this.props;
const { isTree, json, uuid } = this.props;
const { showNo } = this.state;
if(showNo){
return null;
......@@ -84,6 +84,7 @@ export default class TableList extends React.Component {
rights={this.props.rights || []}
objCode={this.props.objCode}
isFormCom={true}
uuid={uuid}
sql={this.props.sql}
/>
) : (
......@@ -102,6 +103,7 @@ export default class TableList extends React.Component {
rights={this.props.rights || []}
objCode={this.props.objCode}
isFormCom={true}
uuid={uuid}
sql={this.props.sql}
/>
);
......
export default function countWidth({
json,
uuid,
}) {
let showDiv = 500;
if (json.twidth) {
// 列表宽度配置项 在 组件的 扩展的配置里面
showDiv = json.twidth;
console.log(showDiv);
return showDiv;
}
if (document.getElementsByClassName('ant-layout-content')?.length) {
// 这是大学工项目 容器元素的宽度
showDiv = document.getElementsByClassName('ant-layout-content')[0].clientWidth - 100;
// console.log(showDiv);
}
if (document.querySelector('#mobelDiv')) {
showDiv = document.querySelector('#mobelDiv')?.parentNode.clientWidth;
// 这个是一站式的元素的宽度
}
changeVisitor(json, uuid);
return showDiv;
}
/**
* json
* uuid
* 变动观察器
* 解决禅道 28008 生源地统计页面显示调整
*/
function changeVisitor(json, uuid) {
if (!uuid) {
return null;
}
let dom = document.querySelector(`td[data-cell-id="${uuid}"]`);
if (!dom) {
return null;
}
const targetNode = dom;
// 配置器的配置:需要监听的变动
const config = {
characterData: true, // 监视指定目标节点或子节点树中节点所包含的字符数据的变化 无默认值。
subtree: true, // 观察后代节点,默认为 false
childList: true, // 观察目标子节点的变化,是否有添加或者删除
};
// 变动时回调
const callback = function (mutations) {
if(!json.twidth){
let dxx = document.querySelector(`td[data-cell-id="${uuid}"] .mobelDivClassName`);
if(dxx && dxx.style.width === '500px'){
dxx.style.width = document.querySelector(`td[data-cell-id="${uuid}"] .mobelDivClassName`)?.parentNode.clientWidth + 'px';
}
}
};
// 创建一个MutationObserver实例
const observer = new MutationObserver(callback);
// 监听目标节点
observer.observe(targetNode, config);
// observer.disconnect()
}
......@@ -35,6 +35,7 @@ import { cloneDeep } from '../../copy/index';
import { getPopconfirm, getModal } from '@/webPublic/one_stop_public/utils/utils';
import { text, number, date } from '@/webPublic/one_stop_public/libs/formList/config';
import { FormListButtons } from '@/webPublic/one_stop_public/libs/formList/SplitIndex';
import countWidth from '@/webPublic/one_stop_public/libs/formList/countWidth';
const FormItem = Form.Item;
const Popconfirm = getPopconfirm();
......@@ -70,7 +71,8 @@ const CreateForm = Form.create()((props) => {
//处理日期何时入库问题
try {
fieldsValue[d] = fieldsValue[d].format('YYYY-MM-DD HH:mm:ss');
} catch (e) {}
} catch (e) {
}
break;
}
}
......@@ -117,7 +119,12 @@ const CreateForm = Form.create()((props) => {
);
});
@connect(({ formList, DataColumn, DataObj, loading }) => ({
@connect(({
formList,
DataColumn,
DataObj,
loading
}) => ({
formList,
DataColumn,
DataObj,
......@@ -147,7 +154,6 @@ class FormList extends React.Component {
columnRights: [],
isReady: false,
groups: {},
showDiv: '',
showMobileDiv: '',
isView: false,
checkedList: [], // 复选框默认选中
......@@ -280,11 +286,19 @@ class FormList extends React.Component {
//渲染值
componentDidMount() {
const { dispatch, isFormCom, isSelect, callback, valueName } = this.props;
const {
dispatch,
} = this.props;
window.addEventListener('resize', this.resize);
// console.log('componentDidMount');
if (this.props.objCode) {
const { dispatch, objCode, sql } = this.props;
const {
dispatch,
objCode,
sql
} = this.props;
if (Number(objCode) === 1) {
this.initColumn();
......@@ -375,7 +389,7 @@ class FormList extends React.Component {
if (nextProps.value.columns != null && nextProps.value.columns.length > 0) {
this.columns = nextProps.value.columns;
}
if(nextProps.value.selectedRows && Array.isArray(nextProps.value.selectedRows)){
if (nextProps.value.selectedRows && Array.isArray(nextProps.value.selectedRows)) {
// 27867 就业市场/线上招聘管理/职位信息审核,胡林那 hulinnaAdmin 马上审核通过的职位直接发布 发布不了
this.setState({
selectedRows: nextProps.value.selectedRows,
......@@ -396,8 +410,15 @@ class FormList extends React.Component {
}
initColumn = () => {
const { dispatch, value, objCode } = this.props;
const { rights, columnRights } = this.state;
const {
dispatch,
value,
objCode
} = this.props;
const {
rights,
columnRights
} = this.state;
if (value && value.columns) {
this.columns = value.columns;
let cacheList = [];
......@@ -516,9 +537,11 @@ class FormList extends React.Component {
return val;
}
if (datas[t].dataFormatStrWeb != null) {
return moment(val).format(datas[t].dataFormatStrWeb);
return moment(val)
.format(datas[t].dataFormatStrWeb);
} else {
return moment(val).format('YYYY-MM-DD HH:mm:ss');
return moment(val)
.format('YYYY-MM-DD HH:mm:ss');
}
};
} else if (datas[t].name.indexOf('process_status') > -1) {
......@@ -534,7 +557,7 @@ class FormList extends React.Component {
{files.map((f, index2) => {
return (
<li key={index2}>
<FilePreview path={queryApiActionPath() + f.path} pathName={f.name} />
<FilePreview path={queryApiActionPath() + f.path} pathName={f.name}/>
</li>
);
})}
......@@ -677,7 +700,8 @@ class FormList extends React.Component {
};
handleStandardTableChange = (pagination, filtersArg, sorter) => {
const filters = Object.keys(filtersArg).reduce((obj, key) => {
const filters = Object.keys(filtersArg)
.reduce((obj, key) => {
const newObj = { ...obj };
newObj[key] = getValue(filtersArg[key]);
return newObj;
......@@ -764,7 +788,8 @@ class FormList extends React.Component {
for (let i in columns) {
if (columns[i].isPrimaryKey) {
//key
Keys[columns[i].name] = selectedRows.map((row) => row[columns[i].name]).join(',');
Keys[columns[i].name] = selectedRows.map((row) => row[columns[i].name])
.join(',');
}
}
this.props.dispatch({
......@@ -789,7 +814,10 @@ class FormList extends React.Component {
handleSearch = (e) => {
e.preventDefault();
const { dispatch, form } = this.props;
const {
dispatch,
form
} = this.props;
const { formValues } = this.state;
......@@ -840,7 +868,10 @@ class FormList extends React.Component {
this.getPage(params);
};
handleFormReset = () => {
const { form, dispatch } = this.props;
const {
form,
dispatch
} = this.props;
form.resetFields();
this.setState(
{
......@@ -852,14 +883,17 @@ class FormList extends React.Component {
);
};
getItem = (isQuery, form, item, isAdd, formData, labelCol, wrapperCol) => {
const { groups, isView } = this.state;
const {
groups,
isView
} = this.state;
//如果隐藏的话 就用隐藏域放置
if (item.isHidden) {
return (
<FormItem className={styles.hidden} key={item.id}>
{form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name],
})(<Input type="hidden" placeholder="请输入" />)}
})(<Input type="hidden" placeholder="请输入"/>)}
</FormItem>
);
}
......@@ -873,7 +907,7 @@ class FormList extends React.Component {
{form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }],
})(<Input style={{ width: '70%' }} readOnly={!isAdd} placeholder="请输入" />)}
})(<Input style={{ width: '70%' }} readOnly={!isAdd} placeholder="请输入"/>)}
</FormItem>
);
}
......@@ -893,7 +927,8 @@ class FormList extends React.Component {
showSearch
filterOption={(input, option) =>
option
? option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
? option.props.children.toLowerCase()
.indexOf(input.toLowerCase()) >= 0
: false
}
placeholder="请选择"
......@@ -938,7 +973,7 @@ class FormList extends React.Component {
? JSON.parse(formData[item.name])
: null,
rules: [{ required: !item.isNull }],
})(<UploadCom disabled={isView} />)}
})(<UploadCom disabled={isView}/>)}
</FormItem>
);
} else if (isQuery && item.isGroupQuery != null && item.isGroupQuery) {
......@@ -959,7 +994,8 @@ class FormList extends React.Component {
showSearch
filterOption={(input, option) =>
option
? option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
? option.props.children.toLowerCase()
.indexOf(input.toLowerCase()) >= 0
: false
}
allowClear>
......@@ -978,7 +1014,7 @@ class FormList extends React.Component {
{form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }],
})(<Input disabled={isView} style={{ width: '70%' }} placeholder="请输入" />)}
})(<Input disabled={isView} style={{ width: '70%' }} placeholder="请输入"/>)}
</FormItem>
);
} else if (number.indexOf(item.type) > -1) {
......@@ -997,7 +1033,7 @@ class FormList extends React.Component {
callback(errors);
},
],
})(<Input disabled={isView} placeholder="请输入" />)}
})(<Input disabled={isView} placeholder="请输入"/>)}
</FormItem>
);
} else if (isQuery && date.indexOf(item.type) > -1) {
......@@ -1042,14 +1078,17 @@ class FormList extends React.Component {
{form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }],
})(<Input disabled={isView} style={{ width: '70%' }} placeholder="请输入" />)}
})(<Input disabled={isView} style={{ width: '70%' }} placeholder="请输入"/>)}
</FormItem>
);
}
};
renderForm() {
const { form, get } = this.props;
const {
form,
get
} = this.props;
const { querys } = this.state;
if (querys.length == 0) {
......@@ -1122,7 +1161,13 @@ class FormList extends React.Component {
};
render() {
const { modalVisible, selectedRows, rights, data, isReady } = this.state;
const {
modalVisible,
selectedRows,
rights,
data,
isReady,
} = this.state;
if (!isReady) {
return (
......@@ -1131,7 +1176,7 @@ class FormList extends React.Component {
width: 20,
margin: 'auto',
}}>
<Spin />
<Spin/>
</div>
);
}
......@@ -1146,31 +1191,20 @@ class FormList extends React.Component {
istableCom, // 是否有模板设计器调用
value: { btns },
loading,
uuid,
} = this.props;
const { showMobileDiv, isView } = this.state;
const {
showMobileDiv,
isView
} = this.state;
let scrollWidth = document.documentElement.clientWidth || document.body.clientWidth; //可使宽度
let isMobile = scrollWidth < 1000;
if (document.querySelector('#previewDiv')) {
isMobile = true;
}
// console.log(json);
let showDiv = 500;
if (document.getElementsByClassName('ant-layout-content')?.length) {
// 这是大学工项目 容器元素的宽度
showDiv = document.getElementsByClassName('ant-layout-content')[0].clientWidth - 100;
}
if (document.querySelector('#mobelDiv')) {
// 这个是一站式的元素的宽度
showDiv = document.querySelector('#mobelDiv')?.parentNode.clientWidth;
}
if (json.twidth) {
// 列表宽度配置项 在 组件的 扩展的配置里面
showDiv = json.twidth;
}
// console.log(showDiv);
const showDiv = countWidth({json, uuid});
const parentMethods = {
handleAdd: this.handleAdd,
handleModalVisible: this.handleModalVisible,
......@@ -1250,7 +1284,7 @@ class FormList extends React.Component {
Dom.map((x, index) => (
<Fragment key={Math.random()}>
{x}
{index > 0 && index !== Dom.length - 1 && <Divider type="vertical" />}
{index > 0 && index !== Dom.length - 1 && <Divider type="vertical"/>}
</Fragment>
))}
</div>
......@@ -1371,13 +1405,13 @@ class FormList extends React.Component {
{rights && !rights.includes('searchData') ? (
''
) : (
<SearchInfo hanldeHighSearch={this.hanldeHighSearch} objId={this.state.objId} />
<SearchInfo hanldeHighSearch={this.hanldeHighSearch} objId={this.state.objId}/>
)}
{rights && !rights.includes('importData') ? (
''
) : (
<ImportUtil objId={this.state.objId} callback={() => this.getPage()} />
<ImportUtil objId={this.state.objId} callback={() => this.getPage()}/>
)}
{rights && !rights.includes('exportCurrent') ? (
......@@ -1394,12 +1428,12 @@ class FormList extends React.Component {
{rights && !rights.includes('exportData') ? (
''
) : (
<ExportInfo objId={this.state.objId} />
<ExportInfo objId={this.state.objId}/>
)}
{rights && !rights.includes('statistics') ? (
''
) : (
<StatisticsInfo objId={this.state.objId} />
<StatisticsInfo objId={this.state.objId}/>
)}
{rights && !rights.includes('delete')
? ''
......@@ -1441,7 +1475,7 @@ class FormList extends React.Component {
</Popover>
)}
{btns && btns.after && btns.after.length > 0
? btns.after.map((r) => <Button {...r} loading={loading} />)
? btns.after.map((r) => <Button {...r} loading={loading}/>)
: ''}
{!!this.props.otherProps &&
......@@ -1511,7 +1545,7 @@ class FormList extends React.Component {
)}
</div>
</Card>
<CreateForm {...parentMethods} modalVisible={modalVisible} />
<CreateForm {...parentMethods} modalVisible={modalVisible}/>
</>
);
if (isFormCom) {
......
......@@ -2622,6 +2622,7 @@ ${obj[dataColumn.base52]}
cm = (
<TableList
get={get}
uuid={uuid}
isTree={json.isTree}
json={json}
loading={this.props.loading}
......@@ -3788,6 +3789,7 @@ ${obj[dataColumn.base52]}
})(
<TableList
json={json}
uuid={uuid}
isTree={json.isTree}
isHiddenPage={json.isHiddenPage}
showHeader={json.showHeader}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论