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

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

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