/* eslint-disable */
import React from 'react';
import { Flex, Button, ListView, Toast, TextareaItem, Steps, WhiteSpace, WingBlank } from 'antd-mobile-v2';
import { DownlandOutline, ArrowDownCircleOutline, CheckCircleFill, ClockCircleFill, HandPayCircleOutline, InformationCircleOutline, } from 'antd-mobile-icons'
import { Space, Dropdown, Menu } from 'antd';
import { createForm } from 'rc-form';
import 'antd-mobile-v2/dist/antd-mobile.css';
import CommobileBase from './CommobileBase';
import CommobileBillEvent from './CommobileBillEvent';
import CommobileViewMaster from './CommobileViewMaster';
import commonConfig from '../../utils/config';
import * as commonUtils from '../../utils/utils';
import ShowType from './CommobileComponent';
import CommobileToolBar from './CommobileToolBar';
import styles from '../mobile.less';
import add from '../../assets/mobile/add-select.svg';
import scan from '../../assets/mobile/scanning.svg';
import close from '../../assets/mobile/close.svg';
import * as commonFunc from '../../components/Common/commonFunc';
import BarCodeUtil from './BarCodeUtil';
import preView from '../components/preView';
import WaterWave from "../../components/Charts/WaterWave";
import * as commonServices from "../../services/services";

const dataSource = new ListView.DataSource({
  rowHasChanged: (row1, row2) => row2,
});
const { Step } = Steps
class CommobileExamine extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
    };
  }

  // eslint-disable-next-line react/sort-comp
  handleClick = async (name, type, sId) => {
    const { masterData, app } = this.props;
    const userinfo = app.userinfo;
    if (name === 'BtnRefuse' || name === 'BtnAgree') {
      if(name ==='BtnRefuse') {
        masterData.approved = false;
        if(commonUtils.isEmpty(this.state.textareaValue)) {
          Toast.fail('需要输入驳回内容!');
          return;
        }
      } else if(name ==='BtnAgree') {
        masterData.approved = true;
      }
      if(this.state.textareaValue) {
        masterData.sCommentMemo = this.state.textareaValue;
      }
      const url = `${commonConfig.server_host}currencyFlow/completeerp/${userinfo.sBrandsId}/${userinfo.sSubsidiaryId}/${userinfo.sUserName}`;
      const value ={
        flow: masterData,
      }
      const returnData = (await commonServices.postValueService(app.token, value, url)).data;
      if(commonUtils.isNotEmptyObject(returnData)) {
        if (returnData.code === 0) {
          window.history.back(-1);
        } else {
          Toast.fail(returnData.msg);
        }
      } else {
        Toast.info ('操作失败！');
      }
    } else if(name === 'BtnEntrust') { /* 委托 */
      if(commonUtils.isNotEmptyObject(type)) {
        const url = `${commonConfig.server_host}currencyFlow/completeerp/${userinfo.sUserName}/${userinfo.sBrandsId}/${userinfo.sSubsidiaryId}`;
        // const url = commonConfig.flow_host + 'process/delegatePhone/' + userinfo.sUserName + '/' + userinfo.sBrandsId + '/'+ userinfo.sSubsidiaryId + '/' ;
        const value ={
          taskId: masterData.sTaskId,
          delegateToUser: type.sUserName
        }
        const returnData = (await commonServices.postValueService(app.token, value, url)).data;
        if(commonUtils.isNotEmptyObject(returnData)) {
          if (returnData.code === 0) {
            window.history.back(-1);
          } else {
            Toast.fail(returnData.msg);
          }
        } else {
          Toast.info ('操作失败！');
        }
      }
    } else if (name === 'BtnSave') {
      this.props.onSubmit();
    } else if (name === 'BtnUpd') {
      this.props.onEdit(name);
    } else if (type === 'add') {
      this.props.onDataRowAdd(name);
    } else if (type === 'del') {
      const { app, [`${name}Data`]: tableData } = this.props;
      let { [`${name}DelData`]: tableDelData } = this.props;
      tableDelData = commonUtils.isEmptyArr(tableDelData) ? [] : tableDelData;
      if (sId !== '') {
        const tableDataIndex = tableData.findIndex(item => item.sId === sId);
        if (tableDataIndex > -1) {
          const slaveDataFilter = tableData[tableDataIndex];
          tableData.splice(tableDataIndex, 1);
          slaveDataFilter.handleType = 'del';
          tableDelData.push(slaveDataFilter);
        }
        this.props.onSaveState({
          [`${name}Data`]: tableData,
          [`${name}DelData`]: tableDelData,
          [`${name}SelectedRowKeys`]: [],
        });
      } else {
        Toast.fail(commonFunc.showMessage(app.commonConst, 'pleaseChooseDelData')); // 请选择删除数据
      }
    } else if (type === 'scan') {
      BarCodeUtil.startScan(async (type, code) => {
        const {
          slaveConfig, sModelsId, masterData, slaveData, sModelsType,
        } = this.props;
        // const slaveData = [];
        let slaveDataObj = {};
        let masterdataObj = {};
        let slaveDataObjAdd = {};
        let masterDataObjAdd = {};
        const codeArr = code.split('|');
        if (sModelsType === 'materialsStock/productionmaterials') {
          const dataStr = codeArr[10].replace(/-/g, '/');
          const date = new Date(dataStr);
          slaveDataObjAdd = {
            sMaterialsStyle: codeArr[1],
            sDefineNo: codeArr[4],
            sDefineNo2: codeArr[5],
            dAuxiliaryQty: codeArr[7],
            tInStoreDate: date,
          };
          const slaveDataConfig = commonUtils.isNotEmptyObject(slaveConfig) ? slaveConfig.gdsconfigformslave : '';
          const materialsNameConfig = slaveDataConfig.filter(item => item.sName === 'sMaterialsId');
          const sWareHouseNameConfig = slaveDataConfig.filter(item => item.sName === 'sWareHouseId');
          const sLocationNameConfig = slaveDataConfig.filter(item => item.sName === 'sLocationId');
          const onDataRowAdd = this.props.onDataRowAdd(name, true);
          const materialseAssignField = commonUtils.isNotEmptyArr(materialsNameConfig) ? materialsNameConfig[0].sAssignField : '';
          const sWareHouseNameAssignField = commonUtils.isNotEmptyArr(sWareHouseNameConfig) ? sWareHouseNameConfig[0].sAssignField : '';
          const sLocationNameAssignField = commonUtils.isNotEmptyArr(sLocationNameConfig) ? sLocationNameConfig[0].sAssignField : '';

          let materialsNameDropDownData = [];
          let sWareHouseNamedropDownData = [];
          let sLocationNamedropDownData = [];
          if (commonUtils.isNotEmptyObject(materialsNameConfig[0]) && materialsNameConfig[0].sDropDownType === 'sql') {
            materialsNameDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', materialsNameConfig[0], slaveData);
          }
          if (commonUtils.isNotEmptyObject(sWareHouseNameConfig[0]) && sWareHouseNameConfig[0].sDropDownType === 'sql') {
            sWareHouseNamedropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', sWareHouseNameConfig[0], slaveData);
          }
          if (commonUtils.isNotEmptyObject(sLocationNameConfig[0]) && sLocationNameConfig[0].sDropDownType === 'sql') {
            sLocationNamedropDownData = await this.props.getSqlDropDownData(sModelsId, 'master', sLocationNameConfig[0], masterData);
          }
          // }
          let materialsNameDataOne;
          let sWareHouseNameDataOne;
          let sLocationNameDataOne;
          if (!commonUtils.isEmpty(materialsNameDropDownData)) {
            materialsNameDataOne = materialsNameDropDownData.filter(item => item.sMaterialsName === codeArr[6]);
          }
          if (!commonUtils.isEmpty(sWareHouseNamedropDownData)) {
            sWareHouseNameDataOne = sWareHouseNamedropDownData.filter(item => item.sName === codeArr[2]);
          }
          if (!commonUtils.isEmpty(sLocationNamedropDownData)) {
            sLocationNameDataOne = sLocationNamedropDownData.filter(item => item.sName === codeArr[3]);
          }
          const newCopyTo = {};
          newCopyTo.master = masterData;
          newCopyTo.slave = commonUtils.isEmpty(slaveData) ? [] : slaveData[0];
          let materialsDataDetiale = {};
          let sWareHouseNameDataDetiale = {};
          let sLocationNameDataDetiale = {};
          materialsDataDetiale = { ...commonFunc.getAssignFieldValue(materialseAssignField, materialsNameDataOne[0], newCopyTo) };
          sWareHouseNameDataDetiale = { ...commonFunc.getAssignFieldValue(sWareHouseNameAssignField, sWareHouseNameDataOne[0], newCopyTo) };
          sLocationNameDataDetiale = { ...commonFunc.getAssignFieldValue(sLocationNameAssignField, sLocationNameDataOne[0], newCopyTo) };
          slaveDataObj = {
            ...onDataRowAdd,
            ...materialsDataDetiale,
            ...sWareHouseNameDataDetiale,
            ...slaveDataObjAdd,
            ...sLocationNameDataDetiale,
          };
          masterdataObj = { ...masterData, ...sLocationNameDataDetiale, ...sWareHouseNameDataDetiale };
        } else if (sModelsType === 'sales/salesSgoods') { // 扫码待发货
          const dataStr = codeArr[12].replace(/-/g, '/');
          const date = new Date(dataStr);
          slaveDataObjAdd = {
            sOrderNo: codeArr[9],
            sWorkOrderNo: codeArr[8],
            sCustomerOrderNo: codeArr[10],
            sCustomerProductNo: codeArr[11],
            sDefineNo: codeArr[3],
            sDefineNo2: codeArr[4],
            dProductQty: codeArr[6],
            tInStoreDate: date,
          };
          masterDataObjAdd = {
            sCustomerShort: codeArr[7],
          };
          const slaveDataConfig = commonUtils.isNotEmptyObject(slaveConfig) ? slaveConfig.gdsconfigformslave : '';
          const sWareHouseNameConfig = slaveDataConfig.filter(item => item.sName === 'sWareHouseId'); // 仓库名称
          const sLocationNameConfig = slaveDataConfig.filter(item => item.sName === 'sLocationId');// 库区库位
          const sProductNameConfig = slaveDataConfig.filter(item => item.sName === 'sProductId');// 产品名称


          const onDataRowAdd = this.props.onDataRowAdd(name, true);
          const sWareHouseNameAssignField = commonUtils.isNotEmptyArr(sWareHouseNameConfig) ? sWareHouseNameConfig[0].sAssignField : '';
          const sLocationNameAssignField = commonUtils.isNotEmptyArr(sLocationNameConfig) ? sLocationNameConfig[0].sAssignField : '';
          const sProductNameAssignField = commonUtils.isNotEmptyArr(sProductNameConfig) ? sProductNameConfig[0].sAssignField : '';


          let sWareHouseNamedropDownData = [];
          let sLocationNamedropDownData = [];
          let sProductNamedropDownData = [];
          if (commonUtils.isNotEmptyObject(sWareHouseNameConfig[0]) && sWareHouseNameConfig[0].sDropDownType === 'sql') {
            sWareHouseNamedropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', sWareHouseNameConfig[0], slaveData);
          }
          if (commonUtils.isNotEmptyObject(sLocationNameConfig[0]) && sLocationNameConfig[0].sDropDownType === 'sql') {
            sLocationNamedropDownData = await this.props.getSqlDropDownData(sModelsId, 'master', sLocationNameConfig[0], masterData);
          }
          if (commonUtils.isNotEmptyObject(sProductNameConfig[0]) && sProductNameConfig[0].sDropDownType === 'sql') {
            sProductNamedropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', sProductNameConfig[0], slaveData);
          }
          let sWareHouseNameDataOne;
          let sLocationNameDataOne;
          let sProductNameDataOne;
          if (!commonUtils.isEmpty(sWareHouseNamedropDownData)) {
            sWareHouseNameDataOne = sWareHouseNamedropDownData.filter(item => item.sName === codeArr[1]);
          }
          if (!commonUtils.isEmpty(sLocationNamedropDownData)) {
            sLocationNameDataOne = sLocationNamedropDownData.filter(item => item.sName === codeArr[2]);
          }
          if (!commonUtils.isEmpty(sProductNamedropDownData)) {
            sProductNameDataOne = sProductNamedropDownData.filter(item => item.sProductName === codeArr[5]);
          }
          const newCopyTo = {};
          newCopyTo.master = masterData;
          newCopyTo.slave = commonUtils.isEmpty(slaveData) ? [] : slaveData[0];
          let sWareHouseNameDataDetiale = {};
          let sLocationNameDataDetiale = {};
          let sProductNameDataDetiale = {};
          sWareHouseNameDataDetiale = { ...commonFunc.getAssignFieldValue(sWareHouseNameAssignField, sWareHouseNameDataOne[0], newCopyTo) };
          sLocationNameDataDetiale = { ...commonFunc.getAssignFieldValue(sLocationNameAssignField, sLocationNameDataOne[0], newCopyTo) };
          sProductNameDataDetiale = { ...commonFunc.getAssignFieldValue(sProductNameAssignField, sProductNameDataOne[0], newCopyTo) };
          slaveDataObj = {
            ...onDataRowAdd,
            ...sWareHouseNameDataDetiale,
            ...slaveDataObjAdd,
            ...sProductNameDataDetiale,
            ...sLocationNameDataDetiale,
          };
          masterdataObj = {
            ...masterData,
            ...sLocationNameDataDetiale,
            ...masterDataObjAdd,
            ...sWareHouseNameDataDetiale,
          };
        } else if (sModelsType === 'purchase/purchaseInstore' || sModelsType === 'scan/productionmaterials') { /* 扫码入库、扫码领料(唯一码) */
          const { masterConfig } = this.props;
          /* 取第一条码 */
          const sDefineNo = codeArr[0];
          /* 如果条码已存在，提示 */
          const iIndex = slaveData.findIndex(item => commonUtils.isNotEmptyObject(item.sDefineNo) && item.sDefineNo === sDefineNo);
          if (iIndex > -1) {
            Toast.fail('条码已存在!!!', 1);
            return;
          }
          masterdataObj = {
            ...masterData,
          };
          /* 读取扫码配置 */
          const btnScanConfigs = masterConfig.gdsconfigformslave.filter(item => item.sName === '' && item.bVisible && item.sControlName.indexOf('BtnScan') > -1);
          const AssignField = commonUtils.isNotEmptyArr(btnScanConfigs) ? btnScanConfigs[0].sAssignField : '';
          slaveDataObj = { ...slaveDataObj, ...commonFunc.getAssignFieldValue(AssignField, masterData) }; // 取赋值字段
          slaveDataObj.sDefineNo = sDefineNo;
          slaveDataObj.sId = commonUtils.createSid();
          if (commonUtils.isNotEmptyArr(slaveData)) {
            const len = slaveData.length;
            const sDefineNoNew = slaveData[len - 1].sDefineNo;
            const { handleType } = slaveData[len - 1];
            /* 若slaveData 最后一条数据没有条形码，则赋值条形码；否则新增一条数据 */
            if (commonUtils.isEmptyArr(sDefineNoNew)) {
              slaveDataObj.handleType = commonUtils.isEmpty(handleType) ? 'update' : handleType;
              slaveData[len - 1] = slaveDataObj;
            } else {
              slaveDataObj.handleType = 'add';
              slaveData.push(slaveDataObj);
            }
          } else {
            slaveDataObj.handleType = 'add';
            slaveData.push(slaveDataObj);
          }
          this.handleClick('slave', 'scan'); /* 连续扫码 */
        } else {
          Toast.fail('二维码不存在!!!', 1);
        }
        if (sModelsType !== 'purchase/purchaseInstore' && sModelsType !== 'scan/productionmaterials') {
          slaveData.push(slaveDataObj);
        }
        this.props.onSaveState({ slaveData, masterData: masterdataObj });
      });
    } else if (name === 'BtnCamera') { /* 手机调动摄像头拍照 */
      this.handleCamera();
    } else if (name === 'BtnPhoto') { /* 手机相册选择图片 */
      this.handleGetPhoto();
    } else if (name === 'BtnCancel') {
      window.history.back(-1);
    } else if (name === 'BtnExamine') {
      this.props.onAudit(1);
    } else if (name === 'BtnCancelExamine') {
      /* 销审 */
      this.props.onAudit(0);
    }
  }

  /* 设置textareaValue */
  handleTextareaChange = (val) => {
    this.setState({
      textareaValue: val,
    });
  }
  handleCamera = () => {
    BarCodeUtil.getImage();
  }
  handleGetPhoto = () => {
    BarCodeUtil.getPhoto();
  }
  getViewValue = (showConfig, record) => {
    let sValue = record === undefined ? undefined : record[showConfig.sName];
    if (showConfig.sDropDownType === 'const') {
      let showDropDown = [];
      if (typeof showConfig.showDropDown === 'object') {
        // eslint-disable-next-line prefer-destructuring
        showDropDown = showConfig.showDropDown;
      } else {
        showDropDown = commonUtils.objectToArr(commonUtils.convertStrToObj(showConfig.showDropDown));
      }
      let iIndex = commonUtils.isEmpty(record[showConfig.sName]) ? -1 : showDropDown.findIndex(item => item.sId === record[showConfig.sName].toString());
      if (iIndex === -1 && record[showConfig.sName] === '') {
        iIndex = showDropDown.findIndex(item => item.sId === '');
      }
      sValue = iIndex > -1 ? showDropDown[iIndex].value : record[showConfig.sName];
    }
    return sValue;
  };

  render() {
    const {
      slaveConfig, slaveData: slaveDataOld, sModelsId, enabled, app, sUseInfo, onReturnForm, masterData, masterConfig, userEntrustData,
    } = this.props;
    onReturnForm(this.props.form);
    const slaveDataOld2 = slaveDataOld === undefined ? [] : slaveDataOld;
    const slaveData = dataSource.cloneWithRows(slaveDataOld2);
    const f1 = commonUtils.isEmptyObject(masterConfig) ? {} : masterConfig.gdsconfigformslave.filter(item => item.bVisible && item.sName !== '' && item.iTag === 1)[0];
    const f2 = commonUtils.isEmptyObject(masterConfig) ? {} : masterConfig.gdsconfigformslave.filter(item => item.bVisible && item.sName !== '' && item.iTag === 1)[1];
    const f3 = commonUtils.isEmptyObject(masterConfig) ? {} : masterConfig.gdsconfigformslave.filter(item => item.bVisible && item.sName !== '' && item.iTag === 1)[2];
    const f4 = commonUtils.isEmptyObject(masterConfig) ? {} : masterConfig.gdsconfigformslave.filter(item => item.bVisible && item.sName !== '' && item.iTag === 1)[3];
    const f5 = commonUtils.isEmptyObject(masterConfig) ? {} : masterConfig.gdsconfigformslave.filter(item => item.bVisible && item.sName !== '' && item.iTag === 1)[4];
    const f6 = commonUtils.isEmptyObject(masterConfig) ? {} : masterConfig.gdsconfigformslave.filter(item => item.bVisible && item.sName !== '' && item.iTag === 1)[5];
    const f7 = commonUtils.isEmptyObject(masterConfig) ? {} : masterConfig.gdsconfigformslave.filter(item => item.bVisible && item.sName !== '' && item.iTag === 1)[6];
    const f8 = commonUtils.isEmptyObject(masterConfig) ? {} : masterConfig.gdsconfigformslave.filter(item => item.bVisible && item.sName !== '' && item.iTag === 1)[7];
    const f9 = commonUtils.isEmptyObject(masterConfig) ? {} : masterConfig.gdsconfigformslave.filter(item => item.bVisible && item.sName !== '' && item.iTag === 1)[8];
    const f10 = commonUtils.isEmptyObject(masterConfig) ? {} : masterConfig.gdsconfigformslave.filter(item => item.bVisible && item.sName !== '' && item.iTag === 1)[9];
    const sFilePathConfig = commonUtils.isNotEmptyObject(masterConfig) ? masterConfig.gdsconfigformslave.filter(item => item.sName === 'sFilePath') : [];
    const memoConfig = commonUtils.isNotEmptyObject(masterConfig) ? masterConfig.gdsconfigformslave.filter(item => item.sName === 'sCommentMemo') : [];
    const dWidth = document.documentElement.clientWidth || document.body.clientWidth; /* 获取手机视窗宽度 */
    const dHeight = document.documentElement.clientHeight || document.body.clientHeight; /* 获取手机视窗宽度 */
    const formItemLayout = { labelCol: { span: 2 }, wrapperCol: { span: 18 } };
    const sFileNameText = commonUtils.isNotEmptyObject(masterData) ?  masterData.sFileName : '';
    const sFilePath = commonUtils.isNotEmptyObject(masterData) ?  masterData.sFilePath : '';
    const sFilePathText = commonUtils.isNotEmptyObject(sFilePath) ?  sFilePath.replace('{ipAddress}', location.host) : '';
    // const sFilePathText = commonUtils.isNotEmptyObject(sFilePath) ?  sFilePath.replace('{ipAddress}', '113.90.147.40:7070') : '';
    const menu = (
      <Menu>
        { commonUtils.isNotEmptyArr(userEntrustData) && userEntrustData.map((item) => {
          return (
            <Menu.Item>
              <a rel="noopener noreferrer" style={{
                color: 'rgb(0,0,0)', fontSize: '0.8rem', height: '20px', lineHeight: '20px',
              }}   onClick={() => this.handleClick('BtnEntrust', item)} >
                {item.sUserName}
              </a>
            </Menu.Item>
          );
        })
        }
      </Menu>
    );
    const style = {
      display: 'flex',
      justifyContent: 'center',
      alignItems: 'center',
    };
    const btnStyle = {
      fontSize: '15px',
      backgroundColor: '#f0f0f0',
      display: 'flex',
      justifyContent: 'center',
      alignItems: 'center',
    };
    const BtnStyle = {
      type: 'default',
      color: 'red',
      border: 'none',
      backgroundColor: '#f0f0f0',
      fontSize: '15px',
    };
    const divStyle = {
      display: 'flex',
      justifyContent: 'space-between',
      background: ' #f0f0f0',
    };
    const row = (rowData, sectionID, rowID) => {
      return (
        <div style={{ backgroundColor: '#f0f0f0' }} key={rowID}>
          <Flex className={styles.ProcessReportMobile}>
            {/* eslint-disable-next-line react/jsx-no-duplicate-props */}
            {
              slaveConfig.gdsconfigformslave.filter(item => item.sControlName === 'BtnChildrenAdd' && item.bVisible).length ?
                <Flex.Item style={style}>
                  <Button type="button" inline disabled={!enabled} onClick={this.handleClick.bind(this, 'slave', 'add')} style={btnStyle}>
                    增加
                    <img src={add} className={styles.iconStyle} style={!enabled ? { opacity: 0.3 } : { opacity: 1 }} alt="add" />
                  </Button>
                </Flex.Item> : ''
            }
            {
              slaveConfig && slaveConfig.gdsconfigformslave.filter(item => item.sControlName === 'BtnChildrenScan' && item.bVisible).length ?
                <Flex.Item style={style}>
                  <Button type="button" inline disabled={!enabled} onClick={this.handleClick.bind(this, 'slave', 'scan')} style={btnStyle}>
                    扫码
                    <img src={scan} className={styles.iconStyle} style={!enabled ? { opacity: 0.3 } : { opacity: 1 }} alt="scan" />
                  </Button>
                </Flex.Item> : ''
            }
            {
              slaveConfig && slaveConfig.gdsconfigformslave.filter(item => item.sControlName === 'BtnChildrenDel' && item.bVisible).length ?
                <Flex.Item style={style}>
                  <Button type="button" inline disabled={!enabled} onClick={this.handleClick.bind(this, 'slave', 'del', rowData.sId)} style={btnStyle}>
                    删除
                    <img src={close} className={styles.iconStyle} style={!enabled ? { opacity: 0.3 } : { opacity: 1 }} alt="close" />
                  </Button>
                </Flex.Item> : ''
            }
          </Flex>
          {commonUtils.isEmptyObject(slaveConfig) ? '' : slaveConfig.gdsconfigformslave.filter(item => item.bVisible && item.sName !== '').map((child) => {
            const sMemo = child.sName.toLowerCase().endsWith('memo');
            // sUseInfo是指被其他单据调用，或者被审核
            let enabledNew = (enabled && !child.bReadonly && !child.specialControl && commonUtils.isEmpty(sUseInfo));
            if (child.iTag === 1) {
              enabledNew = false;
            } else if (child.iTag === 3) {
              enabledNew = true;
            }
            const showTypeProps = {
              app,
              masterData,
              record: rowData,
              sId: rowData.sId, /*   修改当前编号(数据格式:字符串)   */
              name: 'slave',
              form: this.props.form,
              formId: sModelsId,
              getSqlDropDownData: this.props.getSqlDropDownData,
              getSqlCondition: this.props.getSqlCondition,
              handleSqlDropDownNewRecord: this.props.handleSqlDropDownNewRecord,
              getFloatNum: this.props.getFloatNum,
              getDateFormat: this.props.getDateFormat,
              onChange: this.props.onDataChange,
              showConfig: child,
              formItemLayout: sMemo ? formItemLayout : {},
              textArea: sMemo,
              enabled: enabledNew,
              dataValue: rowData[child.sName],
              bTable: true,
              onFilterDropDownData: this.props.onFilterDropDownData,
              onSaveState: this.props.onSaveState,
            };
            return (
              <ShowType {...showTypeProps} />
            );
          })}
          {slaveConfig.gdsconfigformslave.filter(item => item.bVisible && item.sName.includes('spicture')).map((item) => {
            if (item.sName.includes('spicture') && commonUtils.isNotEmptyObject(rowData.spicture)) {
              const { token } = app;
              let imgBox = '';
              const picAddr = commonUtils.isNotEmptyObject(rowData.spicture) ? rowData.spicture.split(',') : '';
              const previewImageArr = [];
              if (commonUtils.isNotEmptyArr(picAddr)) {
                picAddr.forEach((item) => {
                  const dataPreviewUrl = `${commonConfig.server_host}file/download?savePathStr=${item}&width=${dWidth}&&height=${dHeight}&sModelsId=100&token=${token}`; /* 预览 */
                  previewImageArr.push(dataPreviewUrl);
                });
                const dataUrl = `${commonConfig.server_host}file/download?savePathStr=${picAddr[0]}&width=60&&height=60&sModelsId=100&token=${token}`; /* 缩略图 */
                // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
                imgBox = <div className="spictureStyle" key={rowID}> <img src={dataUrl} alt="img" onFocus={() => 0} onClick={e => preView(previewImageArr, e)} /></div>;
              }
              return imgBox;
            } else {
              return '';
            }
          })}
        </div>
      );
    };
    return (
      <div className="commobileBillContainer">
        <form style={{ paddingBottom: '47px' }}>
          <div className="flex-container" style={{ color: 'white' }}>
            <CommobileViewMaster {...this.props} />
          </div>
          {
            commonUtils.isNotEmptyArr(sFilePathConfig)?
              <div style={{
                position: 'relative',
                width: '20%',
                left: '80%',
                top: '-27px'
              }}><a  href={sFilePathText}><DownlandOutline fontSize={20}  /></a></div> :''
          }
          {
            commonUtils.isNotEmptyArr(memoConfig)?
              <TextareaItem
                autoSize={{ minRows: 3, maxRows: 5 }}
                rows ={5}
                placeholder='输入备注'
                onChange={val => this.handleTextareaChange(val)}
            />  : ''
          }
          {commonUtils.isEmptyArr(slaveDataOld2) ? '':
            <div className={styles.listViewStyle} style={{ backgroundColor : '#ffffff', minHeight :' 150px'}}>
              <Steps direction='vertical' style={{ marginTop : '10px'}}>
                {
                  slaveDataOld2.map((child) => {
                    const des = (<div>
                      <p> {commonUtils.isNotEmptyObject(child.sHandleName) ? '办理人：' + child.sHandleName :''}</p>
                      <p> {commonUtils.isNotEmptyObject(child.sContent) ?  child.sContent :''}</p>
                      <p> {commonUtils.isNotEmptyObject(child.tStartDate) ? '接收时间：' + child.tStartDate :''}</p>
                      <p> {commonUtils.isNotEmptyObject(child.tEndDate) ? '完结时间：' + child.tEndDate :''}</p> </div>);
                    return (
                      <Step
                        title={child.sNodeName}
                        status={child.sState}
                        description={des}
                        icon={child.sState === 'finish' ? <CheckCircleFill /> : child.sState === 'wait' ? <ClockCircleFill /> : <InformationCircleOutline />}
                      />
                    );
                  })
                }
              </Steps>
              {/*<ListView*/}
              {/*  dataSource={slaveData}*/}
              {/*  renderRow={row}*/}
              {/*  pageSize={commonConfig.pageSize}*/}
              {/*  initialListSize={0}*/}
              {/*  onScroll={() => {}}*/}
              {/*  scrollRenderAheadDistance={500}*/}
              {/*  onEndReachedThreshold={10}*/}
              {/*  className={styles.listView}*/}
              {/*/>*/}
            </div>
          }
          {
            sModelsId === '192116812112116672690047620' ?
              <div className={styles.examineBtnStyle}>
                <Button className={styles.examineBtn} type="primary"   style={{ background:'red' }}   onClick={this.handleClick.bind(this, 'BtnRefuse')} >驳回</Button>
                <Button className={styles.examineBtn} type="primary"    onClick={this.handleClick.bind(this, 'BtnAgree')}>同意</Button>
                <Dropdown  placement="topCenter" trigger={['click']} overlay={menu}>
                  <Button className={styles.examineBtn} type="primary" >委托</Button>
                </Dropdown>
              </div>
              : ''
          }
        </form>
      </div>
    );
  }
}

const CommobileExamineComponent = createForm()(CommobileExamine);

export default CommobileBase(CommobileBillEvent(CommobileExamineComponent));
