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

时间戳时区bug

上级 03b5fe22
......@@ -14,7 +14,7 @@ import TableCom from '../tableCompon';
import IsNewTable from './isNewMobileTable';
import maintain from '../assets/maintain.png';
import { isJSON } from '@/webPublic/one_stop_public/copy';
// import moment2 from 'moment-timezone'
export default class ZdyTable extends Component {
constructor(props) {
super(props);
......@@ -634,7 +634,7 @@ export default class ZdyTable extends Component {
this.setState({ objRealTime: obj });
};
getT = (trees, key) => {
for (var i in trees) {
if (trees[i].key == key) {
return trees[i].title;
......@@ -645,8 +645,8 @@ export default class ZdyTable extends Component {
}
}
return null;
};
render() {
......@@ -688,10 +688,10 @@ export default class ZdyTable extends Component {
isWebPrint, // 打印界面
isWebPrintEnd,
isPreview,
} = this.props;
const trees = this.configs&&this.configs.trees?this.configs.trees:this.props.trees;
let get;
if (viewMode != null && viewMode != '') {
get = viewMode;
......
......@@ -50,7 +50,7 @@ import { queryApiActionPath } from '../utils/queryConfig';
import { extend } from 'umi-request';
import Highlighter from 'react-highlight-words';
import Signature from '../Signature';
import { changeToDraftState } from '../utils/myutils';
import { changeToDraftState, deepCopy, preHandle } from '../utils/myutils';
import { Base16Encode } from '../Base16/index';
import { getToken } from '../utils/token';
import { formulaList } from '../excelInitFuc/functionList';
......@@ -354,14 +354,16 @@ export default class tableCom extends Component {
dataFilter = ['Select', 'Radio', 'Checkbox', 'Cascader'];
getData = (json, dataColumn, obj, init) => {
const allValues = JSON.stringify(obj);
if (json.comName == 'TableSelect') {
let allValues = deepCopy(obj);
preHandle(allValues);
allValues = JSON.stringify(allValues);
if (json.comName === 'TableSelect') {
const { dispatch } = this.props;
const { sqlKey, optionType } = json;
if (optionType == 'sql') {
if (optionType === 'sql') {
dispatch({
type: 'SqlManageEntity/find',
payload: { sqlKey: sqlKey },
payload: { sqlKey },
callback: sqlModel => {
this.setState({ sqlModel });
if (sqlModel.dataObjId) {
......@@ -426,7 +428,7 @@ export default class tableCom extends Component {
}
this.setState({ columns });
}
// console.log(JSON.stringify(allValues));
dispatch({
type: 'DataColumn/getSqlData',
payload: { sqlKey, allValues },
......@@ -1179,7 +1181,7 @@ export default class tableCom extends Component {
if (vl == options[i][valueName] && !isExist) {
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
isExist = true;
}
......@@ -2365,7 +2367,8 @@ export default class tableCom extends Component {
/>,
);
cm = <div>{cm}</div>;
if (((json.isMobileLabel != null && json.isMobileLabel) ||
if (
((json.isMobileLabel != null && json.isMobileLabel) ||
(json.isMobileLabel == null && json.isLabel)) &&
title
) {
......@@ -2662,11 +2665,7 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [{ required: required, message: '请选择' + dataColumn.title }],
})(<MobileCascader options={options}
label={title}
disabled={disabled}
json={json}
/>);
})(<MobileCascader options={options} label={title} disabled={disabled} json={json} />);
}
if (
......@@ -2806,7 +2805,7 @@ export default class tableCom extends Component {
}
break;
}
// console.table('rangePicker', this.props?.form?.getFieldsValue()[begin.base52 + '$' + end.base52]);
cm = getFieldDecorator(begin.base52 + '$' + end.base52, {
initialValue: ivs,
rules:
......
......@@ -3,6 +3,7 @@ import { message } from 'antd';
import { stateToHTML } from 'draft-js-export-html';
import moment from 'moment';
import { isJSON } from '@/webPublic/one_stop_public/copy';
import React from "react";
function findLinkEntities(contentBlock, callback, contentState) {
contentBlock.findEntityRanges(
......@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论