This commit is contained in:
2021-07-02 15:43:49 +08:00
15 changed files with 157 additions and 69 deletions

View File

@@ -1,6 +1,6 @@
import React, { Component } from 'react'
import { Form, Button, Input, Descriptions, message as Message, Modal, Spin, Tabs } from 'antd'
import { merge, isEqual } from 'lodash'
import { merge, isEqual, pickBy } from 'lodash'
import { AntIcon, ComponentDynamic, Container } from 'components'
import { api } from 'common/api'
@@ -90,6 +90,10 @@ export default class index extends Component {
const { taskId } = this.props.param
if (taskId) {
api.houseInfoGetByTaskId({ taskId }).then(({ data }) => {
// 删除空节点
for (const key in data) {
data[key] = pickBy(data[key], p => p !== null && p !== undefined)
}
this.setState({
taskStatus: data.patrolInfo.status,
record: data,
@@ -168,7 +172,6 @@ export default class index extends Component {
this.formData.patrolInfo.id = this.props.param.taskId
}
console.log(this.formData)
this.setState({ saving: true })
if (action) {

View File

@@ -3,6 +3,9 @@ import { Form, message as Message, Spin } from 'antd'
import { AntIcon } from 'components'
import { cloneDeep } from 'lodash'
import MonacoEditor from 'react-monaco-editor'
import store from 'store'
const { getState } = store
const initialValues = {}
@@ -10,6 +13,7 @@ export default class form extends Component {
state = {
// 加载状态
loading: true,
...getState('layout'),
}
// 表单实例
@@ -83,6 +87,8 @@ export default class form extends Component {
//#endregion
render() {
const { theme } = this.state
return (
<Form initialValues={initialValues} ref={this.form} className="yo-form">
<Spin spinning={this.state.loading} indicator={<AntIcon type="loading" />}>
@@ -90,7 +96,7 @@ export default class form extends Component {
<MonacoEditor
height={300}
language="json"
theme="vs-dark"
theme={theme === 'dark' ? 'vs-dark' : 'default'}
options={{
fontSize: 12,
}}