Commit f07881b4 authored by 涂伟's avatar 涂伟

fix: '台账配置父台账功能添加'

parent 4789f572
......@@ -25,6 +25,7 @@ import {
Ledger_ReloadLedgerFields,
Ledger_QueryLedger,
Ledger_SaveLedger,
Ledger_ParentLedgers,
} from '@/services/standingBook/api';
import { Account, getFieldInfo } from 'panda-xform';
import ChangeAdd from './changeAdd';
......@@ -61,6 +62,7 @@ const BookConfigNew = props => {
const [submitObj, setSubmitObj] = useState({}); // 表单预览弹窗
const [modalLoading, setModalLoading] = useState(false); // 提交数据
const [viewModalLoading, setViewModalLoading] = useState(false); // 表单预览弹窗
const [parentData, setParentData] = useState([]); // 父级台账下拉框数据
const [form] = Form.useForm();
const tableRef = useRef(null);
const accountRef = useRef(null);
......@@ -89,6 +91,14 @@ const BookConfigNew = props => {
span: 19,
},
};
const itemLayout = {
labelCol: {
span: 10,
},
wrapperCol: {
span: 14,
},
};
const switchLayout = {
labelCol: {
span: 10,
......@@ -223,6 +233,7 @@ const BookConfigNew = props => {
form.setFieldsValue({ EnableBatchOperation: true });
form.setFieldsValue({ EnableImportExport: true });
}
getParentData({ ledgerId: type === 'edit' ? formObj.ID : '0' });
} else {
setFiled({});
form.resetFields();
......@@ -232,6 +243,18 @@ const BookConfigNew = props => {
}
}, [visible]);
// 获取父台账表
const getParentData = params => {
Ledger_ParentLedgers(params).then(res => {
if (res.code === 0) {
setParentData(res.data);
console.log(res, 'ressssssssssssssssss');
} else {
setParentData([]);
}
});
};
// 获取台账表
const getTableData = () => {
GetCM_Ledger_LoadLedgerTable().then(res => {
......@@ -529,6 +552,15 @@ const BookConfigNew = props => {
form.setFieldsValue({ Type: value });
}
};
// 表单值监听
const handleValuesChange = (changedValues, allValues) => {
if ('TableName' in changedValues) {
let AccountType = standingTable.filter(item => {
return item.value === changedValues.TableName;
})[0].text;
form.setFieldsValue({ AccountType });
}
};
return (
<Modal
......@@ -571,7 +603,7 @@ const BookConfigNew = props => {
okText="保存并查看"
>
<div className={styles.top}>
<Form form={form} {...layout}>
<Form form={form} {...layout} onValuesChange={handleValuesChange}>
<Row>
<Col span={8}>
<Item
......@@ -598,10 +630,32 @@ const BookConfigNew = props => {
</Item>
</Col>
<Col span={8}>
<Item
label="父级台账"
name="PreName"
// rules={[{ required: true, message: '请选择分组' }]}
>
<Select
showSearch
filterOption={false}
// onSearch={onSearch}
placeholder="请选择父级台账"
allowClear
>
{parentData.map((item, index) => (
<Option value={item.name} key={index}>
{item.name}
</Option>
))}
</Select>
</Item>
</Col>
<Col span={4}>
<Item
label="台账分组"
name="Type"
rules={[{ required: true, message: '请选择分组' }]}
{...itemLayout}
>
<Select
showSearch
......@@ -618,13 +672,14 @@ const BookConfigNew = props => {
</Select>
</Item>
</Col>
<Col span={8}>
<Col span={4}>
<Item
label="台账类型"
name="AccountType"
rules={[{ required: true, message: '请选择类型' }]}
{...itemLayout}
>
<Select placeholder="请选择台账类型">
<Select placeholder="请选择台账类型" disabled>
<Option value="台账">台账</Option>
<Option value="反馈">反馈</Option>
<Option value="设备">设备</Option>
......
......@@ -141,4 +141,8 @@ export const Ledger_ReloadLedgerFields = query =>
// 提交台账配置数据
export const Ledger_SaveLedger = data =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/Ledger_SaveLedger`, data);
\ No newline at end of file
post(`${PUBLISH_SERVICE}/WorkOrderCenter/Ledger_SaveLedger`, data);
// 获取副台账配置信息
export const Ledger_ParentLedgers = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/Ledger_ParentLedgers`, query);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment