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 } = quickSearch;
let datas = quickSearchDetailData;
let time = new Date().getTime();
let obj = {
key: "new_" + time,
customname: '',
orderid: 0,
minnum: '',
maxnum: '',
type: quickSearch.qcData.qcType,
fieldid: quickSearch.qcData.fieldid,
customid: quickSearch.customid
}
datas = toJS(datas);
datas.push(obj);
quickSearch.setQuickSearchDetailData(datas);
}
delRow = () => {
const { quickSearch } = this.props;
let { qcDetailRowKeys } = quickSearch;
if (qcDetailRowKeys.length <= 0) {
message.error(getLabel(22346, '请选择要删除的信息', 'label'));
return;
}
const that = this;
Modal.confirm({
title: getLabel(83601, '您确认要删除选中的记录吗?'),
onOk() {
let datas = quickSearch.quickSearchDetailData;
datas = toJS(datas);
datas = that.delFromArray(datas, qcDetailRowKeys);
quickSearch.qcDetailRowKeys = [];
quickSearch.setQuickSearchDetailData(datas);
},
onCancel() { },
});
}
delFromArray = (array, selectRowIds) => {
for (let i = 0; i < selectRowIds.length; i++) {
let key = selectRowIds[i];
for (let j = 0; j < array.length; j++) {
if (array[j]["key"] == key) {
array.splice(j, 1);
break;
}
}
}
return array;
}
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 (