提交 3a5654f8 authored 作者: 钟是志's avatar 钟是志

20187 国家助学金、奖学金、励志奖学金、贫困生认定--添加查询条件

上级 4d363d89
import pageSetting from './pageSetting';
import React, { Component, Fragment } from 'react';
import React, { Component } from 'react';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import List from '../ApplyPage/List';
import ListTab from './ListTab';
import { deepCopy } from '@/baseComponent/utils';
import { getApplyPage, getHandledPage, getWaitPage } from '../publicApiService';
import { getHandledPage, getWaitPage } from '../publicApiService';
import AuditModal from '@/webPublic/FormInsertDiy/AuditPage/BatchAudit/AuditModal';
import { ModalInfo } from '@/baseComponent/Modal';
import ButtonDiy from '@/baseComponent/ButtonDiy';
......@@ -60,10 +58,24 @@ export default class AuditPage extends Component {
handleSearchSet = () => {
const { columns, searchCondition } = this.props;
console.log(searchCondition);
const tab1 = {
search: {
field: {},
getPageService: getWaitPage,
beforeSearchData: (data) => {
let searcherKeyValue = {};
for(let item of searchCondition){
if(typeof data[item.key] !== 'undefined'){
searcherKeyValue[item.base52] = data[item.key];
}
}
if(searcherKeyValue && Object.keys(searcherKeyValue).length){
data.searcherKeyValue = JSON.stringify(searcherKeyValue);
}
console.log(data);
return data;
},
responseCallBack: response => {
return response;
},
......@@ -81,6 +93,19 @@ export default class AuditPage extends Component {
responseCallBack: response => {
return response;
},
beforeSearchData: (data) => {
let searcherKeyValue = {};
for(let item of searchCondition){
if(typeof data[item.key] !== 'undefined'){
searcherKeyValue[item.base52] = data[item.key];
}
}
if(searcherKeyValue && Object.keys(searcherKeyValue).length){
data.searcherKeyValue = JSON.stringify(searcherKeyValue);
}
console.log(data);
return data;
},
condition: searchCondition,
nameSpan: { big: 8, small: 9 },
fileSpan: { big: 4, small: 4 },
......@@ -95,7 +120,7 @@ export default class AuditPage extends Component {
};
render() {
const { workId, dataBaseId, addFields } = this.props;
const { workId, dataBaseId, addFields, searchCondition } = this.props;
return (
<PageHeaderWrapper title="">
......@@ -104,6 +129,7 @@ export default class AuditPage extends Component {
pageButton={this.handleButtonSet({})}
workId={workId}
dataBaseId={dataBaseId}
searchCondition={searchCondition}
addFields={addFields}
pageSearch={this.handleSearchSet({})}
/>
......
import React, { Component, Fragment } from 'react';
import SearchDom from '@/highOrderComponent/SearchDom';
import ButtonListDom from '../ButtonListDom';
import Shell from '@/baseComponent/Shell';
import StandardTable from '@/components/StandardTable';
import PropTypes from 'prop-types';
import { deepCopy } from '@/baseComponent/utils';
import { handleAudit } from '../publicApiService';
import { handleColumns } from '@/webPublic/FormInsertDiy/AffairPage/destruction';
import React, { Component, Fragment } from "react";
import SearchDom from "@/highOrderComponent/SearchDom";
import ButtonListDom from "../ButtonListDom";
import Shell from "@/baseComponent/Shell";
import StandardTable from "@/components/StandardTable";
import PropTypes from "prop-types";
import { deepCopy } from "@/baseComponent/utils";
import { handleAudit } from "../publicApiService";
import { handleColumns } from "@/webPublic/FormInsertDiy/AffairPage/destruction";
export default class List extends Component {
constructor(props) {
......@@ -21,24 +21,24 @@ export default class List extends Component {
current: 1,
total: 1,
pageSize: this.props.listConfig.pageSize || 10,
pageSizeOptions: ['10', '20', '50', '100', '500'],
pageSizeOptions: ["10", "20", "50", "100", "500"],
showQuickJumper: true,
onShowSizeChange: (current, size) => {
this.pageChange(current, size);
},
onChange: (current, size) => {
this.pageChange(current, size);
},
},
}
}
};
}
giveDefaultValue = (props) => {
// 如果设置了 giveFieldsToFormValues 则将默认值赋值给formValues
let formValues = {};
if(props.pageSearch && props.pageSearch.search && props.pageSearch.search.giveFieldsToFormValues){
for(let x in props.pageSearch.search.field){
if(props.pageSearch.search.field[x].required === true){
if (props.pageSearch && props.pageSearch.search && props.pageSearch.search.giveFieldsToFormValues) {
for (let x in props.pageSearch.search.field) {
if (props.pageSearch.search.field[x].required === true) {
formValues[x] = props.pageSearch.search.field[x].defaultValue;
}
}
......@@ -54,7 +54,7 @@ export default class List extends Component {
/** 如果配置了默认值 则 加进去 **/
for (let item in search.field) {
let one = search.field[item];
if (one.required && (typeof data[item] === 'undefined')) {
if (one.required && (typeof data[item] === "undefined")) {
/**
* 存在必填项 且当前必填项没有值时 则传入. 如果必填项有值则不需要修改
* */
......@@ -65,55 +65,59 @@ export default class List extends Component {
data.pageSize = pagination.pageSize;
data.pageNo = pagination.current;
}
if(search.beforeGetPage){
if (search.beforeGetPage) {
data = search.beforeGetPage(data);
}
return data;
};
getPage = () => {
const { listConfig, pageSearch, dataBaseId, workId, getpageService } = this.props;
const { listConfig, pageSearch, workId } = this.props;
const { pagination, sortGetPageFields } = this.state;
const { search } = pageSearch;
let data = this.giveGetPageFields();
if(!data){
if (!data) {
return false;
}
if(search.handleSort){
if (search.handleSort) {
data = {
...data,
...sortGetPageFields, // 增加排序的搜索条件
}
};
}
this.setState({
list: [],
loading: true,
});
if (search.beforeSearchData && typeof search.beforeSearchData === "function") {
data = search.beforeSearchData(data, {...this.props});
}
search.getPageService({ ...data, appId: workId }).then((response) => {
this.setState({
loading: false,
loading: false
});
if (!response || (search.paging && typeof response.total === 'undefined') || response.errMsg) {
if (!response || (search.paging && typeof response.total === "undefined") || response.errMsg) {
return false;
}
if (listConfig.paging) {
pagination.total = Number(response.total);
}
if (typeof search.responseCallBack !== 'undefined') {
if (typeof search.responseCallBack !== "undefined") {
response = search.responseCallBack(response);
}
this.setState({
list: response.rows || response,
selectRows: [],
pagination: pagination,
pagination: pagination
});
});
};
stateChange = (key, value) => {
this.setState({
[key]: value,
[key]: value
});
};
......@@ -122,8 +126,8 @@ export default class List extends Component {
pagination: {
...this.state.pagination,
current: current,
pageSize: size,
},
pageSize: size
}
}, () => {
this.getPage();
});
......@@ -137,19 +141,19 @@ export default class List extends Component {
/**
* 如果设置了beforeChange回调函数 则调用此回调函数改变另外的字段的值
* */
const index = condition.findIndex((item)=>{
const index = condition.findIndex((item) => {
return item.key === key;
});
if(index !== -1){
if (index !== -1) {
const thisConfig = condition[index];
if(thisConfig.beforeChange){
oldValue = thisConfig.beforeChange(oldValue,thisConfig);
if (thisConfig.beforeChange) {
oldValue = thisConfig.beforeChange(oldValue, thisConfig);
}
}
this.setState({
formValues: oldValue,
},()=>{
if(search.afterFormValuesChange){
formValues: oldValue
}, () => {
if (search.afterFormValuesChange) {
search.afterFormValuesChange(key, oldValue, this.getPage);
}
});
......@@ -157,13 +161,13 @@ export default class List extends Component {
handleSelectRows = rows => {
this.setState({
selectRows: rows,
selectRows: rows
});
};
componentDidMount() {
const { search } = this.props.pageSearch;
if(!search.noNeedInitData){
if (!search.noNeedInitData) {
this.getPage();
}
}
......@@ -171,20 +175,20 @@ export default class List extends Component {
componentWillMount() {
}
componentWillUnmount(){
componentWillUnmount() {
}
resetFormValues = () => {
const { beforeResetFormValues } = this.props.pageSearch.search;
let { formValues } = this.state;
if(beforeResetFormValues){
if (beforeResetFormValues) {
formValues = beforeResetFormValues(formValues);
}else{
formValues = {} ;
} else {
formValues = {};
}
this.setState({
formValues,
})
formValues
});
};
/**
......@@ -192,13 +196,13 @@ export default class List extends Component {
* */
handleOnChange = (pagination, filters, sorter) => {
const { pageSearch } = this.props;
if(sorter){
if (sorter) {
const sortGetPageFields = pageSearch.search.handleSort(sorter);
this.setState({
sortGetPageFields,
},()=>{
sortGetPageFields
}, () => {
this.getPage();
})
});
}
};
......@@ -207,92 +211,92 @@ export default class List extends Component {
const { list } = this.state;
let re = {};
let buttonConfig = [];
for(let item of list){
if(item.btns && Array.isArray(item.btns)){
for( let x of item.btns){
if(typeof re[x.name] === 'undefined'){
for (let item of list) {
if (item.btns && Array.isArray(item.btns)) {
for (let x of item.btns) {
if (typeof re[x.name] === "undefined") {
re[x.name] = x;
}
}
}
}
for(let z in re){
for (let z in re) {
let info = re[z];
buttonConfig.push(
{
type: z,
name: z,
component: 'ModalBatch',
className: z !== '通过' ? 'defaultRed' : 'defaultBlue',
component: "ModalBatch",
className: z !== "通过" ? "defaultRed" : "defaultBlue",
nameSpan: { big: 4, small: 5 },
fileSpan: { big: 1, small: 1 },
values: {
[info.key]: info.value,
[info.key]: info.value
},
fields: [
{
key: 'reason',
name: '审核意见',
type: 'textarea',
},
key: "reason",
name: "审核意见",
type: "textarea"
}
],
beforeSubmit: (props, formValues) => {
return {
taskForm : {},
examineMap: JSON.stringify(formValues),
taskForm: {},
examineMap: JSON.stringify(formValues)
};
},
sourceKey: 'taskId',
postKey: 'taskIds',
apiServiceApi: handleAudit,
sourceKey: "taskId",
postKey: "taskIds",
apiServiceApi: handleAudit
}
)
);
}
return buttonConfig;
};
render() {
const { formValues, selectRows, list, pagination, loading } = this.state;
const { listConfig, pageSearch, pageButton ,children, addFields} = this.props;
const { listConfig, pageSearch, pageButton, children, addFields } = this.props;
let { columns, search } = pageSearch;
columns = handleColumns(columns);
let data = list;
for(let item of addFields){
if(item.type === 'tableSelect' && item.c1){
for(let i = 0; i < data.length; i++ ){
for (let item of addFields) {
if (item.type === "tableSelect" && item.c1) {
for (let i = 0; i < data.length; i++) {
let nameKey = item.componentProps.labelName;
if(data[i][item.c1] && data[i][item.c1].selects){
if (data[i][item.c1] && data[i][item.c1].selects) {
let res = [];
for(let x in data[i][item.c1].selects){
for (let x in data[i][item.c1].selects) {
res.push(data[i][item.c1].selects[x][nameKey]);
}
data[i][item.c1] = res.join(',');
data[i][item.c1] = res.join(",");
}
}
}
}
const tableProps = {
rowKey: pageSearch.tableRowKey || 'id',
rowKey: pageSearch.tableRowKey || "id",
selectedRows: selectRows,
data: {list: data, pagination},
data: { list: data, pagination },
columns,
bordered: pageSearch.bordered || false,
loading,
noSelectRow: !listConfig.selectRows,
onSelectRow: this.handleSelectRows,
scroll: {x: true},
scroll: { x: true }
};
if(!listConfig.paging){
tableProps.data = {list: data, pagination:false};
if (!listConfig.paging) {
tableProps.data = { list: data, pagination: false };
}
if(search && search.handleSort){
if (search && search.handleSort) {
tableProps.onChange = this.handleOnChange;
}
return (
<Fragment>
{listConfig.searchArea ?
{listConfig.searchArea && this.props.searchCondition?.length ?
<SearchDom formStateChange={this.formStateChange}
formValues={formValues}
getPage={this.getPage}
......@@ -313,7 +317,7 @@ export default class List extends Component {
children={children}
/> : null}
<StandardTable {...tableProps}/>
<StandardTable {...tableProps} />
</Shell>
</Fragment>
);
......@@ -323,7 +327,7 @@ export default class List extends Component {
List.propTypes = {
listConfig: PropTypes.object.isRequired,
// pageButton: PropTypes.array,
pageSearch: PropTypes.object.isRequired,
pageSearch: PropTypes.object.isRequired
};
List.defaultProps = {
......@@ -331,37 +335,37 @@ List.defaultProps = {
selectRows: true, // 是否可以行选择,
paging: true, // 是否可以分页,
searchArea: true, // 是否拥有 搜索区dom,
buttonArea: true, // 是否拥有 按钮区,
buttonArea: true // 是否拥有 按钮区,
},
pageSearch: {
search: {
url: '',
url: "",
field: {},
responseCallBack: (response) => {
return response;
},
condition: [
{
key: 'studentNo',
name: '学号',
type: 'input',
},
key: "studentNo",
name: "学号",
type: "input"
}
],
tableRowKey: 'id',
tableRowKey: "id",
columns: [
{
title: '姓名',
dataIndex: '',
title: "姓名",
dataIndex: ""
},
{
title: '操作',
dataIndex: 'operation',
renderType: 'update', // 修改
},
title: "操作",
dataIndex: "operation",
renderType: "update" // 修改
}
],
nameSpan: { big: 8, small: 9 },
fileSpan: { big: 4, small: 4 },
},
},
fileSpan: { big: 4, small: 4 }
}
}
};
......@@ -32,17 +32,17 @@ export default class ListTab extends Component {
};
render() {
const { tabList, pageSearch, pageButton, workId, dataBaseId, addFields } = this.props;
const { tabList, pageSearch, pageButton, workId, dataBaseId, addFields, searchCondition } = this.props;
const { activeKey, tabKeys } = this.state;
return (
<Fragment>
<Shell>
<Shell styleShell={{marginTop: 0}}>
{/*<SearchDom />*/}
<Tabs activeKey={activeKey}
className={styles.ListTab}
onChange={this.handleChangeTab}>
{tabKeys.map((item) => {
return <TabPane tab={tabList[item].name} key={item}>
</TabPane>
})}
</Tabs>
......@@ -53,6 +53,7 @@ export default class ListTab extends Component {
key={item}
workId={workId}
addFields={addFields}
searchCondition={searchCondition}
dataBaseId={dataBaseId}
pageSearch={pageSearch[item]}
pageButton={pageButton[item]}
......
......@@ -44,10 +44,11 @@ export default class Index extends React.Component {
return false;
}
destructionFunc.destructionGetDetail(response).then((x) => {
const { addFields, tableInfo, allConfigSetInfo } = x;
const { addFields, tableInfo, allConfigSetInfo, searchCondition } = x;
this.setState({
addFields,
tableInfo,
searchCondition,
allConfigSetInfo,
},() => {
this.giveDetailColumns();
......
......@@ -6,7 +6,7 @@ const pageSetting = {
listConfig:{
selectRows: true, // 是否可以行选择,
paging: true, // 是否可以分页,
searchArea: false, // 是否拥有 搜索区dom,
searchArea: true, // 是否拥有 搜索区dom,
buttonArea: true, // 是否拥有 按钮区,
}
},
......@@ -15,9 +15,9 @@ const pageSetting = {
listConfig:{
selectRows: true, // 是否可以行选择,
paging: true, // 是否可以分页,
searchArea: false, // 是否拥有 搜索区dom,
searchArea: true, // 是否拥有 搜索区dom,
buttonArea: true, // 是否拥有 按钮区,
}
},
},
},
};
......
import { text, number, date, format, taskNode } from '../config/index';
import { isJSON } from '@/baseComponent/utils';
import { translateAddFields } from '../config/index';
import { translateAddFields, getSearchCondition } from '../config/index';
import config from '@/config/config';
import { Tooltip } from 'antd';
import moment from 'moment';
......@@ -190,6 +190,7 @@ export async function destructionGetDetail(response) {
addFields: [],
tableInfo: {},
allConfigSetInfo: response,
searchCondition: [],
};
}
const basicPatternModel = response.unifiedServicePatternModel;
......@@ -286,6 +287,7 @@ export async function destructionGetDetail(response) {
addFields: await translateAddFields(fileds, tableInfo),
tableInfo,
allConfigSetInfo: response,
searchCondition: await getSearchCondition(basicPatternModel?.dataObjModels[0]?.id),
};
}
......
......@@ -12,9 +12,9 @@ import { getOneStopConfig, isJSON } from '@/baseComponent/utils';
import config from '@/config/config';
const giveValue = (x) => {
if(x && x.rows){
if (x && x.rows) {
let res = [];
for(let item of x.rows){
for (let item of x.rows) {
res.push({
...item.hisTaskListData,
...item,
......@@ -22,7 +22,7 @@ const giveValue = (x) => {
}
x.rows = res;
return x;
}else{
} else {
return {
rows: [],
total: 1,
......@@ -30,8 +30,8 @@ const giveValue = (x) => {
}
};
const getId = async (pathname) => { // 获取流程引擎 事务workId 和表dataBaseId
const getId = async (pathname) => {
// 获取流程引擎 事务workId 和表dataBaseId
let idObj = await getOneStopConfig(pathname);
console.log(idObj);
if (typeof idObj === 'undefined' || !idObj) {
......@@ -45,8 +45,8 @@ const getId = async (pathname) => { // 获取流程引擎 事务workId 和表dat
}
};
const getPages = (info) => { // 获取代办事项 分页数据 workId
const getPages = (info) => {
// 获取代办事项 分页数据 workId
// workId, pageSize, pageNo,
if (typeof info.pageNo === 'undefined') {
info.pageNo = 1;
......@@ -55,48 +55,66 @@ const getPages = (info) => { // 获取代办事项 分页数据 workId
return apiRequest('/UnifiedAppFormApi/getWaitPage', info);
};
const getColumns = (workId) => { // 获取表头 workId
const getColumns = (workId) => {
// 获取表头 workId
return apiRequest('/UnifiedAppFormApi/getFormTitle', { id: workId });
};
const getHead = (dataObjId) => {
// 获取表头 workId
return apiRequest('/DataColumnApi/getHeaderList', { dataObjId });
};
/**
* 获取下拉枚举值
* */
const getOptions = async (id, filterSql = undefined, key, name) => {
return await apiRequest('/DataColumnApi/getOptions', {id, filterSql}).then((x)=>{
if(x){
return x.map((y)=>{
return await apiRequest('/DataColumnApi/getOptions', { id, filterSql }).then((x) => {
if (x) {
return x.map((y) => {
return {
key: y[key],
name: y[name],
};
});
} else {
return [];
}
})
}else{
});
};
/**
* 批量获取下拉枚举值
* */
const getBatchOptions = async (ids) => {
return await apiRequest('/DataColumnApi/getBatchOptions', {ids}).then((x) => {
if (x) {
return x.map((y) => {
return {
key: y[key],
name: y[name],
};
});
} else {
return [];
}
});
};
/**
* 获取下拉枚举值 通过sql语句
* */
const getSqlOptions = async (id, sqlKey = undefined, key, name ) => {
return await apiRequest('/DataColumnApi/getSqlOptions', {id, sqlKey}).then((x)=>{
if(x){
return x.map((y)=>{
const getSqlOptions = async (id, sqlKey = undefined, key, name) => {
return await apiRequest('/DataColumnApi/getSqlOptions', { id, sqlKey }).then((x) => {
if (x) {
return x.map((y) => {
return {
key: y[key],
name: y[name],
}
})
}else{
};
});
} else {
return [];
}
});
......@@ -106,24 +124,23 @@ const getSqlOptions = async (id, sqlKey = undefined, key, name ) => {
* 获取发起流程填写的字段表单详情
* */
const getFormDetail = (id) => {
return apiRequest('/UnifiedAppApi/getDetail', {id}).then((x)=>{
if(x){
return apiRequest('/UnifiedAppApi/getDetail', { id }).then((x) => {
if (x) {
return x;
}else{
} else {
return {};
}
});
};
/**
* 发起流程
* */
const startProcess = (info) => {
return apiRequest('/UnifiedAppFormApi/startProcess', info).then((x)=>{
if(x){
return apiRequest('/UnifiedAppFormApi/startProcess', info).then((x) => {
if (x) {
return x;
}else{
} else {
return null;
}
});
......@@ -135,9 +152,8 @@ const startProcess = (info) => {
* */
const getApplyPage = (info) => {
return apiRequest('/UnifiedAppFormApi/getApplyPage', info).then((x)=>{
return apiRequest('/UnifiedAppFormApi/getApplyPage', info).then((x) => {
return giveValue(x);
});
};
/**
......@@ -146,14 +162,14 @@ const getApplyPage = (info) => {
* */
const getDetailInfo = (id) => {
return apiRequest('/UnifiedAppFormApi/getFormDetail', {id}).then((x)=>{
if(x){
return apiRequest('/UnifiedAppFormApi/getFormDetail', { id }).then((x) => {
if (x) {
return x;
}else{
} else {
return null;
}
});
};
};
/**
* 待办业务
* pageSize: 10
......@@ -163,7 +179,7 @@ const getDetailInfo = (id) => {
const getWaitPage = (info) => {
return apiRequest('/UnifiedAppFormApi/getWaitPage', info).then((x) => {
return giveValue(x);
})
});
};
/**
* 已办业务
......@@ -173,9 +189,8 @@ const getWaitPage = (info) => {
* */
const getHandledPage = (info) => {
return apiRequest('/UnifiedAppFormApi/getHandledPage', info).then((x) => {
return giveValue(x);
})
});
};
/**
......@@ -186,40 +201,47 @@ const getHandledPage = (info) => {
* */
const handleAudit = (info) => {
return apiRequest('/UnifiedAppFormApi/examineProcess', info).then((x) => {
if(x){
if (x) {
return x;
}
})
});
};
const handleSqlData = (info) => {
return apiRequest('/DataColumnApi/getSqlData', info).then((x) => {
if(x){
if (x) {
return x;
}else{
} else {
return [];
}
})
});
};
const handleSqlfind = async(sqlKey = '') => {
return await apiRequest('/SqlManageEntityApi/find', {sqlKey}).then((x) => {
if(x){
const handleSqlfind = async (sqlKey = '') => {
return await apiRequest('/SqlManageEntityApi/find', { sqlKey }).then((x) => {
if (x) {
return x;
}else{
} else {
return null;
}
})
});
};
export {
getId, getColumns, getPages,
getId,
getColumns,
getPages,
getFormDetail,
getOptions, startProcess, getApplyPage,
getDetailInfo, getWaitPage, getHandledPage, handleAudit,
handleSqlData,handleSqlfind, getSqlOptions,
getOptions,
getBatchOptions,
startProcess,
getApplyPage,
getDetailInfo,
getWaitPage,
getHandledPage,
handleAudit,
handleSqlData,
handleSqlfind,
getSqlOptions,
getHead,
};
......@@ -59,7 +59,7 @@ const transLateTimeTOUnix = (value, dataType) => {
}
};
const getFormArrayConfig = header => {
const getFormArrayConfig = (header) => {
let config = [];
for (let item of header) {
if (item.isPrimaryKey || item.isHidden || item.dataIndex === 'operationEdit') {
......@@ -81,6 +81,7 @@ const getFormArrayConfig = header => {
type: 'input',
placeHolder: `请输入${item.name}`,
required: !item.isNull,
base52: item.base52,
});
} else if (number.indexOf(item.type) > -1) {
config.push({
......@@ -90,6 +91,7 @@ const getFormArrayConfig = header => {
placeHolder: `请输入${item.name}`,
required: !item.isNull,
min: 0,
base52: item.base52,
});
} else if (date.indexOf(item.type) > -1) {
config.push({
......@@ -99,6 +101,7 @@ const getFormArrayConfig = header => {
placeHolder: `请输入${item.name}`,
required: !item.isNull,
format: format[item.type],
base52: item.base52,
});
} else {
config.push({
......@@ -107,6 +110,7 @@ const getFormArrayConfig = header => {
type: 'input',
placeHolder: `请输入${item.name}`,
required: !item.isNull,
base52: item.base52,
});
}
}
......@@ -135,14 +139,14 @@ const transLate = {
Table: 'table', // 表格 未开发
};
const getOpts = async item => {
const getOpts = async (item) => {
let options = [];
if (item.optionType === 'reference') {
options = await service.getOptions(
item.dataId,
item.filterSql,
item.referenceCodeName,
item.referenceNameName
item.referenceNameName,
);
} else if (item.optionType === 'sql') {
options = await service.getSqlOptions(item.dataId, item.sqlKey, item.valueName, item.labelName);
......@@ -152,6 +156,28 @@ const getOpts = async item => {
return options;
};
const getSearchCondition = async (id) => {
const searchHeaders = await service.getHead(id).then((res) => {
if (res && res.length) {
return res.filter((x) => {
return x.isShowQuery !== false && x.isHidden === false;
});
}
});
const refIds = [];
searchHeaders.forEach((x) => {
if (!!x.referenceObjId) {
refIds.push(x.referenceObjId);
}
});
const condition = getFormArrayConfig(searchHeaders);
if (refIds && refIds.length) { // TODO 暂时不处理下拉的搜索条件 要考虑 getOpts 里面提及的各种问题
const options = await service.getBatchOptions(refIds);
console.log(options);
}
return condition;
};
const translateAddFields = async (data, tableInfo) => {
let key = [];
let res = [];
......@@ -188,7 +214,7 @@ const translateAddFields = async (data, tableInfo) => {
case 'ChildForm':
item.componentProps.thisFields = await translateAddFields(
item.componentProps.thisFields,
tableInfo
tableInfo,
);
break;
case 'Radio':
......@@ -199,7 +225,7 @@ const translateAddFields = async (data, tableInfo) => {
break;
case 'Checkbox':
item.options = await getOpts(item);
item.options = item.options.map(x => {
item.options = item.options.map((x) => {
return {
label: x.name,
value: x.key,
......@@ -248,4 +274,5 @@ export {
format,
mustHaveValue,
taskNode,
getSearchCondition,
};
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论