浏览代码

resolve conflict form remote

ZhaoJun 1 年之前
父节点
当前提交
07d30f3602

+ 24 - 0
src/components/AuditForm/ItemAttribute.js

@@ -42,6 +42,9 @@ function ItemAttribute(props) {
       case 'NumberField':
         FormContent = <NumberField {...formProps} />;
         break;
+      case 'TextNote':
+        FormContent = <TextNote {...formProps} />;
+        break;
       case 'DDDateField':
         FormContent = <DDDateField {...formProps} />;
         break;
@@ -428,6 +431,27 @@ function NumberField(props) {
   );
 }
 
+function TextNote(props) {
+  const { item, btns, onFinish } = props;
+  const [form] = Form.useForm();
+
+  return (
+    <Form
+      form={form}
+      labelCol={{ span: 6 }}
+      wrapperCol={{ span: 18 }}
+      onFinish={onFinish}
+      autoComplete="off"
+      initialValues={item.props}
+    >
+      <Form.Item label="说明文字" name="placeholder">
+        <Input />
+      </Form.Item>
+      {btns}
+    </Form>
+  );
+}
+
 function ProjectField(props) {
   const { item, btns, onFinish } = props;
   const [form] = Form.useForm();

+ 22 - 0
src/components/AuditForm/constant.js

@@ -1,3 +1,4 @@
+import React from 'react';
 import {
   UserOutlined,
   TeamOutlined,
@@ -12,6 +13,7 @@ import {
   ProjectOutlined,
   SolutionOutlined,
   NumberOutlined,
+  FontColorsOutlined,
 } from '@ant-design/icons';
 
 export const COMPONENT_LIST = [
@@ -55,6 +57,26 @@ export const COMPONENT_LIST = [
       // choice: '0',
     },
   },
+  {
+    componentName: 'TextNote',
+    icon: <FontColorsOutlined />,
+    props: {
+      label: '文本说明控件',
+      bizAlias: '',
+      placeholder: '请输入文本',
+      required: false,
+    },
+  },
+  {
+    componentName: 'TextNote',
+    icon: <FontColorsOutlined />,
+    props: {
+      label: '文本说明控件',
+      bizAlias: '',
+      placeholder: '请输入文本',
+      required: false,
+    },
+  },
   {
     componentName: 'TextField',
     icon: <ItalicOutlined />,

+ 14 - 1
src/components/DDComponents/CodeFiled/index.js

@@ -1,6 +1,6 @@
 import React, { useEffect, useState } from 'react';
 import { Input } from 'antd';
-import { useRequest, useModel } from 'umi';
+import { useRequest } from 'umi';
 import { queryContractCode } from '@/services/contract';
 import { queryDepsV2 } from '@/services/department';
 import { connect } from 'dva';
@@ -50,6 +50,19 @@ function CodeField(props) {
     };
     return fun(depUserTree);
   };
+
+  useEffect(() => {
+    if (!depId || !depList.length) return;
+    const dep_code = getDepItemById(depId)?.Code;
+    const compony = depList.find(item => item.Flag === 1);
+    let params = {
+      company_id: compony?.ID,
+      company_code: compony?.Code,
+      dep_code,
+    };
+    runCode(params);
+  }, [depId, depList]);
+
   return <Input value={value} placeholder="选择部门后自动生成" disabled />;
 }
 

+ 6 - 5
src/components/DDComponents/DepartmentField/index.js

@@ -1,7 +1,8 @@
 import { TreeSelect } from 'antd';
 import React, { useState, useEffect } from 'react';
-import { queryDDdepList } from '@/services/boom';
 import { connect } from 'dva';
+// import { queryDDdepList } from '@/services/boom';
+// import { queryDDdepList } from '@/services/boom';
 
 function DepartmentField(props) {
   const { value = [], onChange, depUserTree } = props;
@@ -17,9 +18,9 @@ function DepartmentField(props) {
   //   };
   // };
 
-  // const onLoadData = async () => {
-  //   let depList = await queryDDdepList();
-  //
+  // const onLoadData = async ({ id }) => {
+  //   let depList = await queryDDdepList({ dept_id: id });
+
   //   console.log(depList);
   //   if (depList.length > 0) {
   //     let nodes = depList.map(genTreeNode);
@@ -34,7 +35,7 @@ function DepartmentField(props) {
   return (
     <TreeSelect
       showSearch
-      // multiple
+      // // multiple
       allowClear
       defaultValue={value}
       dropdownStyle={{

+ 1 - 2
src/components/DDComponents/index.js

@@ -4,6 +4,7 @@ import TableField from './TableField';
 import PhoneField from './PhoneField';
 import InnerContactField from './InnerContactField';
 import DepartmentField from './DepartmentField';
+import CodeField from './CodeFiled';
 import DDMultiSelectField from './DDMultiSelectField';
 import NumberField from './NumberField';
 import DDPhotoField from './DDPhotoField';
@@ -104,9 +105,7 @@ export default function DDComponents(props) {
       component = <DDDateRangeField format={format} disabled={disabled} onChange={onChange} />;
       break;
     case 'TextNote': // 文本说明控件
-      console.info('文本说明控件!');
       component = <TextNode value={placeholder} />;
-      console.log(item);
       break;
     case 'PhoneField': // 电话控件
       component = <PhoneField onChange={onChange} />;

+ 1 - 0
src/pages/Detail/AuditDetailed.js

@@ -35,6 +35,7 @@ const AuditDetailed = props => {
 
   const GetComponent = item => {
     const { id, label, bizAlias, required, notUpper } = item.props;
+    console.log(label);
     // 判断是否关联项
     if (data.linkedList.findIndex(curId => curId == id) !== -1) {
       let control = null; // 当前空间是否显示的条件 当id为control.id的组件选择的选项值为control.value 时显示