import React from 'react'; import { observer } from 'mobx-react'; import { WeaDialog, WeaNewScroll, WeaLocaleProvider, WeaRightMenu } from 'ecCom'; import { WeaScope, WeaInput, WeaInputNumber, WeaSearchGroup, WeaTab, WeaError, WeaHelpfulTip } from 'ecCom'; const getLabel = WeaLocaleProvider.getLabel; import { Button, Table, Modal, message } from 'antd'; import { observable, toJS, } from "mobx"; import { WeaForm } from 'comsMobx'; import $ from 'jquery'; @observer export default class QuickSearchDetail extends React.Component { constructor(props) { super(props); } onSelectChange = (keys, rows) => { let keyarr = []; rows.map(row => { keyarr.push(row.key); }); const { quickSearch } = this.props; quickSearch.qcDetailRowKeys = keyarr; } save = () => { const { quickSearch } = this.props; quickSearch.saveQuickSearchDetailInfo(); } closeDialog = () => { const { quickSearch } = this.props; quickSearch.quickSearchDetailVisable = false; } getSearchButton = () => { const { quickSearch } = this.props; const buttons = new Array(); buttons.push(); buttons.push(); return buttons; } addRow = () => { // const { quickSearch } = this.props; // let { quickSearchDetailData } = CubeListStore; // let datas = quickSearchDetailData; // let time = new Date().getTime(); // let obj = { // key: "new_" + time, // customname: '', // orderid: 0, // minnum: '', // maxnum: '', // type: CubeListStore.qcData.qcType, // fieldid: CubeListStore.qcData.fieldid, // customid: CubeListStore.customid // } // datas = toJS(datas); // datas.push(obj); // CubeListStore.setQuickSearchDetailData(datas); } delRow = () => { // const { CubeListStore } = this.props; // let { qcDetailRowKeys } = CubeListStore; // if (qcDetailRowKeys.length <= 0) { // message.error(getLabel(22346, '请选择要删除的信息', 'label')); // return; // } // const that = this; // Modal.confirm({ // title: getLabel(83601, '您确认要删除选中的记录吗?'), // onOk() { // let datas = CubeListStore.quickSearchDetailData; // datas = toJS(datas); // datas = that.delFromArray(datas, qcDetailRowKeys); // CubeListStore.qcDetailRowKeys = []; // CubeListStore.setQuickSearchDetailData(datas); // }, // onCancel() { }, // }); } render() { const { quickSearch: store } = this.props, { qcDetailRowKeys } = store; const rowSelection = { qcDetailRowKeys, onChange: this.onSelectChange, } const Height = $(".wea-dialog-body")[0] && $(".wea-dialog-body")[0].style.height; const buttons = [ , ] return ( ) } } @observer class QuickSearchTableEdit extends React.Component{ getColumns = () => { let columnArray = [ { title: getLabel(195, "名称"), dataIndex: "customname", key: "customname", width: "40%", com: [{ label: '', type: 'INPUT', key: 'customname', viewAttr: 3, otherParams: { isBase64: true, inputType: "multilang" } }] }, { title:
{getLabel(387588, "内容自定义条件")} 
, dataIndex: "condition", key: "condition", width: "40%", com: [{ label: '', type: 'SCOP', key: 'condition', viewAttr: 3 }] }, { title: getLabel(88, "顺序"), dataIndex: "orderid", key: "orderid", width: "20%", com: [{ label: '', type: 'INPUTNUMBER', key: 'orderid', viewAttr: 2, otherParams: { max: 999, step: 1 } }] } ]; columnArray = columnArray.map((col) => { let _col = { ...col }; _col.render = (text, record, index) => { return this.getColRender(_col, text, record, index); } return _col }); return columnArray; } getColRender = (_col, text, record, index) => { const { datas } = this.props; const { quickSearch: { quickSearchRefObj } } = this.props.ListProps; const { com, } = _col; let _com = []; com.map((c) => { if (typeof c.props === 'object') { _com.push(); } else { const { key, viewAttr = 2, type = 'INPUT', width, otherParams = {} } = c; const _type = type.toUpperCase(); _com.push( { _type === 'INPUT' && quickSearchRefObj[`error_${key}_${index}`] = ref} > this.onEdit(record, index, key, value)} {...otherParams} /> } { _type === 'SCOP' && quickSearchRefObj[`error_${key}_${index}`] = ref} >
this.onEdit(record, index, key, value)} />
} { _type === 'INPUTNUMBER' && this.onEdit(record, index, key, value1)} {...otherParams} /> }
) } }); return (
{_com}
) } onEdit = (record, index, key, value) => { const { datas } = this.props; let _datas = [...datas]; _datas[index][key] = value; if (key == 'condition') { _datas[index].minnum = value[0] === undefined ? "" : value[0]; _datas[index].maxnum = value[1] === undefined ? "" : value[1]; } typeof this.props.onChange === 'function' && this.props.onChange(_datas); } render() { const { datas, rowSelection } = this.props; return (
) } }