提交 9e0a3df6 authored 作者: 钟是志's avatar 钟是志

时间戳时区bug

上级 03b5fe22
...@@ -14,7 +14,7 @@ import TableCom from '../tableCompon'; ...@@ -14,7 +14,7 @@ import TableCom from '../tableCompon';
import IsNewTable from './isNewMobileTable'; import IsNewTable from './isNewMobileTable';
import maintain from '../assets/maintain.png'; import maintain from '../assets/maintain.png';
import { isJSON } from '@/webPublic/one_stop_public/copy'; import { isJSON } from '@/webPublic/one_stop_public/copy';
// import moment2 from 'moment-timezone'
export default class ZdyTable extends Component { export default class ZdyTable extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
...@@ -634,7 +634,7 @@ export default class ZdyTable extends Component { ...@@ -634,7 +634,7 @@ export default class ZdyTable extends Component {
this.setState({ objRealTime: obj }); this.setState({ objRealTime: obj });
}; };
getT = (trees, key) => { getT = (trees, key) => {
for (var i in trees) { for (var i in trees) {
if (trees[i].key == key) { if (trees[i].key == key) {
return trees[i].title; return trees[i].title;
...@@ -645,8 +645,8 @@ export default class ZdyTable extends Component { ...@@ -645,8 +645,8 @@ export default class ZdyTable extends Component {
} }
} }
return null; return null;
}; };
render() { render() {
...@@ -688,10 +688,10 @@ export default class ZdyTable extends Component { ...@@ -688,10 +688,10 @@ export default class ZdyTable extends Component {
isWebPrint, // 打印界面 isWebPrint, // 打印界面
isWebPrintEnd, isWebPrintEnd,
isPreview, isPreview,
} = this.props; } = this.props;
const trees = this.configs&&this.configs.trees?this.configs.trees:this.props.trees; const trees = this.configs&&this.configs.trees?this.configs.trees:this.props.trees;
let get; let get;
if (viewMode != null && viewMode != '') { if (viewMode != null && viewMode != '') {
get = viewMode; get = viewMode;
......
...@@ -50,7 +50,7 @@ import { queryApiActionPath } from '../utils/queryConfig'; ...@@ -50,7 +50,7 @@ import { queryApiActionPath } from '../utils/queryConfig';
import { extend } from 'umi-request'; import { extend } from 'umi-request';
import Highlighter from 'react-highlight-words'; import Highlighter from 'react-highlight-words';
import Signature from '../Signature'; import Signature from '../Signature';
import { changeToDraftState } from '../utils/myutils'; import { changeToDraftState, deepCopy, preHandle } from '../utils/myutils';
import { Base16Encode } from '../Base16/index'; import { Base16Encode } from '../Base16/index';
import { getToken } from '../utils/token'; import { getToken } from '../utils/token';
import { formulaList } from '../excelInitFuc/functionList'; import { formulaList } from '../excelInitFuc/functionList';
...@@ -354,14 +354,16 @@ export default class tableCom extends Component { ...@@ -354,14 +354,16 @@ export default class tableCom extends Component {
dataFilter = ['Select', 'Radio', 'Checkbox', 'Cascader']; dataFilter = ['Select', 'Radio', 'Checkbox', 'Cascader'];
getData = (json, dataColumn, obj, init) => { getData = (json, dataColumn, obj, init) => {
const allValues = JSON.stringify(obj); let allValues = deepCopy(obj);
if (json.comName == 'TableSelect') { preHandle(allValues);
allValues = JSON.stringify(allValues);
if (json.comName === 'TableSelect') {
const { dispatch } = this.props; const { dispatch } = this.props;
const { sqlKey, optionType } = json; const { sqlKey, optionType } = json;
if (optionType == 'sql') { if (optionType === 'sql') {
dispatch({ dispatch({
type: 'SqlManageEntity/find', type: 'SqlManageEntity/find',
payload: { sqlKey: sqlKey }, payload: { sqlKey },
callback: sqlModel => { callback: sqlModel => {
this.setState({ sqlModel }); this.setState({ sqlModel });
if (sqlModel.dataObjId) { if (sqlModel.dataObjId) {
...@@ -426,7 +428,7 @@ export default class tableCom extends Component { ...@@ -426,7 +428,7 @@ export default class tableCom extends Component {
} }
this.setState({ columns }); this.setState({ columns });
} }
// console.log(JSON.stringify(allValues));
dispatch({ dispatch({
type: 'DataColumn/getSqlData', type: 'DataColumn/getSqlData',
payload: { sqlKey, allValues }, payload: { sqlKey, allValues },
...@@ -1179,7 +1181,7 @@ export default class tableCom extends Component { ...@@ -1179,7 +1181,7 @@ export default class tableCom extends Component {
if (vl == options[i][valueName] && !isExist) { if (vl == options[i][valueName] && !isExist) {
isExist = true; isExist = true;
} }
if(Array.isArray(vl) && vl.length && vl.includes(options[i][valueName]) && !isExist){ if (Array.isArray(vl) && vl.length && vl.includes(options[i][valueName]) && !isExist) {
// 钟是志 2021年9月28日 16:19:46 解决 checkbox 多选负值不上的bug // 钟是志 2021年9月28日 16:19:46 解决 checkbox 多选负值不上的bug
isExist = true; isExist = true;
} }
...@@ -2365,7 +2367,8 @@ export default class tableCom extends Component { ...@@ -2365,7 +2367,8 @@ export default class tableCom extends Component {
/>, />,
); );
cm = <div>{cm}</div>; cm = <div>{cm}</div>;
if (((json.isMobileLabel != null && json.isMobileLabel) || if (
((json.isMobileLabel != null && json.isMobileLabel) ||
(json.isMobileLabel == null && json.isLabel)) && (json.isMobileLabel == null && json.isLabel)) &&
title title
) { ) {
...@@ -2662,11 +2665,7 @@ export default class tableCom extends Component { ...@@ -2662,11 +2665,7 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择' + dataColumn.title }], : [{ required: required, message: '请选择' + dataColumn.title }],
})(<MobileCascader options={options} })(<MobileCascader options={options} label={title} disabled={disabled} json={json} />);
label={title}
disabled={disabled}
json={json}
/>);
} }
if ( if (
...@@ -2806,7 +2805,7 @@ export default class tableCom extends Component { ...@@ -2806,7 +2805,7 @@ export default class tableCom extends Component {
} }
break; break;
} }
// console.table('rangePicker', this.props?.form?.getFieldsValue()[begin.base52 + '$' + end.base52]);
cm = getFieldDecorator(begin.base52 + '$' + end.base52, { cm = getFieldDecorator(begin.base52 + '$' + end.base52, {
initialValue: ivs, initialValue: ivs,
rules: rules:
......
...@@ -3,6 +3,7 @@ import { message } from 'antd'; ...@@ -3,6 +3,7 @@ import { message } from 'antd';
import { stateToHTML } from 'draft-js-export-html'; import { stateToHTML } from 'draft-js-export-html';
import moment from 'moment'; import moment from 'moment';
import { isJSON } from '@/webPublic/one_stop_public/copy'; import { isJSON } from '@/webPublic/one_stop_public/copy';
import React from "react";
function findLinkEntities(contentBlock, callback, contentState) { function findLinkEntities(contentBlock, callback, contentState) {
contentBlock.findEntityRanges( contentBlock.findEntityRanges(
...@@ -130,3 +131,52 @@ export function preHandle(values) { ...@@ -130,3 +131,52 @@ export function preHandle(values) {
} }
} }
} }
/**
* 深拷贝函数 一站式使用
* */
export function deepCopy(obj, parent = null) {
if (React.isValidElement(obj)) {
return React.cloneElement(obj);
}
if (['boolean', 'string', 'number'].indexOf(typeof obj) > -1 || !obj) {
return obj;
}
let result;
if (obj.constructor === Array) {
result = [];
} else {
result = {};
}
let keys = Object.keys(obj),
key = null,
temp = null,
_parent = parent;
// 该字段有父级则需要追溯该字段的父级
while (_parent) {
// 如果该字段引用了它的父级则为循环引用
if (_parent.originalParent === obj) {
// 循环引用直接返回同级的新对象
return _parent.currentParent;
}
_parent = _parent.parent;
}
for (let i = 0; i < keys.length; i++) {
key = keys[i];
temp = obj[key];
if(temp && moment.isMoment(temp)){
result[key] = temp.clone();
}else if (temp && typeof temp === 'object') { // 如果字段的值也是一个对象
// 递归执行深拷贝 将同级的待拷贝对象与新对象传递给 parent 方便追溯循环引用
result[key] = deepCopy(temp, {
originalParent: obj,
currentParent: result,
parent: parent,
});
} else {
result[key] = temp;
}
}
return result;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论