175 lines
5.2 KiB
JavaScript
175 lines
5.2 KiB
JavaScript
|
|
import {
|
||
|
|
observable,
|
||
|
|
action
|
||
|
|
} from 'mobx';
|
||
|
|
import * as mobx from 'mobx';
|
||
|
|
import * as API from '../apis/quickSearch';
|
||
|
|
import {
|
||
|
|
WeaForm
|
||
|
|
} from 'comsMobx';
|
||
|
|
import {
|
||
|
|
Modal,
|
||
|
|
message,
|
||
|
|
} from 'antd'
|
||
|
|
import {
|
||
|
|
i18n
|
||
|
|
} from '../public/i18n';
|
||
|
|
import { WeaLocaleProvider } from 'ecCom';
|
||
|
|
|
||
|
|
const toJS = mobx.toJS;
|
||
|
|
const getLabel = WeaLocaleProvider.getLabel;
|
||
|
|
|
||
|
|
|
||
|
|
export class QuickSearchStore {
|
||
|
|
|
||
|
|
@observable quickSearchForm = new WeaForm();
|
||
|
|
@observable qcSelectedRowKeys = [];
|
||
|
|
@observable quickSearchData = {
|
||
|
|
datas: [],//表格记录record
|
||
|
|
setting: {},
|
||
|
|
options: [],
|
||
|
|
};
|
||
|
|
@observable quickSearchDetailVisable = false;
|
||
|
|
@observable qcData = { qcType: '', cid: '', fieldid: '' };//快速查询明细type
|
||
|
|
@observable quickSearchDetailData = [];
|
||
|
|
@observable precision = 0;
|
||
|
|
|
||
|
|
/**** ==============quickSearchForm ===============*/
|
||
|
|
@observable quickSearchFields = [
|
||
|
|
{
|
||
|
|
domkey: ['isquicksearch'],
|
||
|
|
conditionType: 'SWITCH',
|
||
|
|
label: getLabel('387493', "快捷搜索条件"),
|
||
|
|
labelcol: 5,
|
||
|
|
fieldcol: 19,
|
||
|
|
viewAttr: 3,
|
||
|
|
}
|
||
|
|
]
|
||
|
|
|
||
|
|
|
||
|
|
@action("初始化页面") initList = () => {
|
||
|
|
this.quickSearchForm.initFormFields([{ items: this.quickSearchFields.slice() }]);
|
||
|
|
this.getQuickSearchInfo();
|
||
|
|
}
|
||
|
|
|
||
|
|
@action clearQuciSearchData = () => {
|
||
|
|
this.quickSearchData.setting = {};
|
||
|
|
this.quickSearchData.datas = [];
|
||
|
|
this.quickSearchData.options = [];
|
||
|
|
}
|
||
|
|
|
||
|
|
@action("数据获取") getQuickSearchInfo = () => {
|
||
|
|
this.clearQuciSearchData();
|
||
|
|
API.getQuickSearchInfo({ customid: 382 }).then(action(({ status, errorCode, error, setting, datas, options, groupidOptions }) => {
|
||
|
|
if (status == '1') {
|
||
|
|
this.quickSearchData.setting = setting;
|
||
|
|
this.quickSearchData.datas = datas.map(d => {
|
||
|
|
return { ...d, visible: false }
|
||
|
|
});
|
||
|
|
this.quickSearchData.groupidOptions = groupidOptions;
|
||
|
|
this.quickSearchData.options = options;
|
||
|
|
this.quickSearchForm.updateFields({
|
||
|
|
isquicksearch: setting.isquicksearch,
|
||
|
|
});
|
||
|
|
} else {
|
||
|
|
message.error(`[${getLabel(127353, "错误") + errorCode}]:${error}`);
|
||
|
|
}
|
||
|
|
}));
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
@action("保存页面") saveQuickSearchInfo = (params) => {
|
||
|
|
// let datas = this.quickSearchData.datas;
|
||
|
|
// datas.map((data, index) => {
|
||
|
|
// data.orderid = index
|
||
|
|
// });
|
||
|
|
|
||
|
|
// let formparm = this.quickSearchForm.getFormParams();
|
||
|
|
// if (!this.checkQuickSearchData()) {
|
||
|
|
// message.error(getLabel('387954', "条件字段不能重复"));
|
||
|
|
// return;
|
||
|
|
// }
|
||
|
|
// let id = this.quickSearchData.setting.id;
|
||
|
|
// if (id == null) {
|
||
|
|
// return;
|
||
|
|
// }
|
||
|
|
// if (params) {
|
||
|
|
// formparm = params;
|
||
|
|
// }
|
||
|
|
// API.saveQuickSearchInfo({
|
||
|
|
// id: id,
|
||
|
|
// customid: this.customid,
|
||
|
|
// data: JSON.stringify(datas), ...formparm
|
||
|
|
// }).then(({ status, errorCode, error, setting, datas, options }: any) => {
|
||
|
|
// if (status == '1') {
|
||
|
|
// message.success(getLabel(83551, '保存成功!'));
|
||
|
|
// this.qcSelectedRowKeys = [];
|
||
|
|
// this.getQuickSearchInfo();
|
||
|
|
// } else {
|
||
|
|
// message.error(`[${getLabel(127353, "错误") + errorCode}]:${error}`);
|
||
|
|
// }
|
||
|
|
// });
|
||
|
|
// this.quickSearchData.setting.id = null;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
@action setQuickSearchData = (datas) => {
|
||
|
|
this.quickSearchData.datas = datas;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**============================quickdetail===================== */
|
||
|
|
@action("设置") openQuickSearchDetail = (record) => {
|
||
|
|
this.quickSearchDetailVisable = true;
|
||
|
|
this.qcData.qcType = record.type;
|
||
|
|
this.qcData.cid = record.cid;
|
||
|
|
this.qcData.fieldid = record.fieldid;
|
||
|
|
this.getQuickSearchDetailInfo(record.cid);
|
||
|
|
}
|
||
|
|
|
||
|
|
@action getQuickSearchDetailInfo = (cid) => {
|
||
|
|
API.getQuickSearchDetailInfo({ cid: cid }).then(({ status, errorCode, error, setting, datas, precision }) => {
|
||
|
|
if (status == '1') {
|
||
|
|
this.quickSearchDetailData = datas;
|
||
|
|
this.precision = precision;
|
||
|
|
} else {
|
||
|
|
message.error(`[${getLabel(127353, "错误") + errorCode}]:${error}`);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/**===========================buttons=========================== */
|
||
|
|
rightMenu = [
|
||
|
|
{
|
||
|
|
"isBatch": "0",
|
||
|
|
"isTop": "1",
|
||
|
|
"menuFun": "save",
|
||
|
|
"menuIcon": "icon-coms-Preservation",
|
||
|
|
"menuName": "保存",
|
||
|
|
"type": "BTN_save"
|
||
|
|
},
|
||
|
|
// {
|
||
|
|
// "isBatch": "0",
|
||
|
|
// "isTop": "0",
|
||
|
|
// "menuFun": "log",
|
||
|
|
// "menuIcon": "icon-coms-Print-log",
|
||
|
|
// "menuName": "日志",
|
||
|
|
// "type": "BTN_log"
|
||
|
|
// }
|
||
|
|
];
|
||
|
|
topMenu = [
|
||
|
|
{
|
||
|
|
"isBatch": "1",
|
||
|
|
"isTop": "1",
|
||
|
|
"menuFun": "save",
|
||
|
|
"menuIcon": "icon-coms-Preservation",
|
||
|
|
"menuName": "保存",
|
||
|
|
"type": "BTN_save"
|
||
|
|
}
|
||
|
|
]
|
||
|
|
|
||
|
|
}
|