Commit 5cbe46aeeb696388e33373d8f674bb6bece61233

Authored by zhongnanhuang
1 parent 419f88a8

feat: update 金蝶客户新增、修改

src/pages/Order/components/KingdeeCustomerModal.tsx 0 → 100644
  1 +import {
  2 + postKingdeeRepCustomerDetail,
  3 + postKingdeeRepCustomerSave,
  4 +} from '@/services';
  5 +import { getTeacherCustomFieldNumber } from '@/utils/kingdee';
  6 +import { CloseCircleOutlined } from '@ant-design/icons';
  7 +import {
  8 + ModalForm,
  9 + ProFormGroup,
  10 + ProFormList,
  11 + ProFormText,
  12 +} from '@ant-design/pro-components';
  13 +import { Form, message } from 'antd';
  14 +
  15 +// import { cloneDeep } from 'lodash';
  16 +export default ({ setVisible, data, onClose }) => {
  17 + const [form] = Form.useForm();
  18 + console.log(data);
  19 +
  20 + /**
  21 + * 回显客户信息
  22 + * @param id
  23 + */
  24 + async function queryAndShowCustomer(id: any) {
  25 + //查询客户信息
  26 + let res = await postKingdeeRepCustomerDetail({
  27 + data: {
  28 + id: id,
  29 + },
  30 + });
  31 +
  32 + if (res) {
  33 + form.setFieldValue('name', res.name);
  34 + form.setFieldValue('id', res.id);
  35 + form.setFieldValue('contact_persons', res.bomentity);
  36 + let customFiledNumber = await getTeacherCustomFieldNumber();
  37 + form.setFieldValue('teacherName', res.custom_field[customFiledNumber]);
  38 + }
  39 + }
  40 +
  41 + if (data) {
  42 + //修改
  43 + if (data.id) {
  44 + queryAndShowCustomer(data.id);
  45 + } else {
  46 + //新增
  47 + form.setFieldValue('name', data.name);
  48 + form.setFieldValue('contact_persons', [{}]);
  49 + }
  50 + }
  51 + return (
  52 + <>
  53 + <ModalForm
  54 + width={900}
  55 + open
  56 + title="客户信息"
  57 + form={form}
  58 + autoFocusFirstInput
  59 + modalProps={{
  60 + okText: '保存',
  61 + cancelText: '取消',
  62 + destroyOnClose: true,
  63 + onCancel: () => {
  64 + setVisible(false);
  65 + },
  66 + }}
  67 + onFinish={async (values) => {
  68 + //查询客户自定义字段,课题组
  69 + let custom_field_umber = await getTeacherCustomFieldNumber();
  70 +
  71 + if (custom_field_umber) {
  72 + let customFieldObj = {};
  73 + customFieldObj[custom_field_umber] = values.teacherName;
  74 + values.custom_field = customFieldObj;
  75 + }
  76 + let customSaveRes = await postKingdeeRepCustomerSave({
  77 + data: values,
  78 + });
  79 + if (customSaveRes) {
  80 + let id_number_map = customSaveRes.id_number_map;
  81 + let ids = customSaveRes.ids;
  82 + if (id_number_map && ids) {
  83 + message.success('保存成功');
  84 + let id = ids[0];
  85 + onClose(id);
  86 + }
  87 + }
  88 + }}
  89 + onOpenChange={setVisible}
  90 + >
  91 + <ProFormText key="key" name="id" label="id" placeholder="id" hidden />
  92 + <ProFormGroup key="group">
  93 + <ProFormText
  94 + name="name"
  95 + width="md"
  96 + label="客户名称"
  97 + initialValue={data}
  98 + placeholder="请输入客户名称"
  99 + rules={[
  100 + {
  101 + required: true,
  102 + pattern: new RegExp('^.+-.+$'),
  103 + message:
  104 + '格式错误,请按照:“单位-名称” 命名,若无单位可写:“无-名称”',
  105 + },
  106 + { required: true, message: '客户名称必填' },
  107 + ]}
  108 + />
  109 + <ProFormText
  110 + name="teacherName"
  111 + width="md"
  112 + label="课题组老师"
  113 + placeholder="请输入课题组老师"
  114 + rules={[
  115 + { required: true, message: '课题组老师必填,若没有请填“无”' },
  116 + ]}
  117 + />
  118 + </ProFormGroup>
  119 +
  120 + <ProFormList
  121 + creatorButtonProps={{ disabled: false }}
  122 + name="contact_persons"
  123 + label="联系人信息"
  124 + actionGuard={{
  125 + beforeRemoveRow: async () => {
  126 + return new Promise((resolve) => {
  127 + let contactPersons = form.getFieldValue('contact_persons');
  128 + if (contactPersons.length === 1) {
  129 + message.error('至少要有一个联系人');
  130 + resolve(false);
  131 + return;
  132 + }
  133 + resolve(true);
  134 + });
  135 + },
  136 + }}
  137 + deleteIconProps={{
  138 + Icon: CloseCircleOutlined,
  139 + tooltipText: '不需要这行了',
  140 + }}
  141 + >
  142 + <ProFormGroup key="group">
  143 + {[
  144 + <ProFormText
  145 + key="key"
  146 + name="id"
  147 + label="id"
  148 + placeholder="id"
  149 + hidden
  150 + />,
  151 + <ProFormText
  152 + key="key"
  153 + name="contact_person"
  154 + label="收货人姓名"
  155 + placeholder="联系人姓名"
  156 + rules={[{ required: true, message: '收货人姓名必填' }]}
  157 + />,
  158 + <ProFormText
  159 + key="key"
  160 + name="mobile"
  161 + label="联系方式"
  162 + placeholder="联系方式"
  163 + rules={[{ required: true, message: '联系方式必填' }]}
  164 + />,
  165 + <ProFormText
  166 + key="key"
  167 + name="contact_address"
  168 + label="收货地址"
  169 + width="md"
  170 + placeholder="请输入收货地址"
  171 + rules={[{ required: true, message: '收货地址必填' }]}
  172 + />,
  173 + ]}
  174 + </ProFormGroup>
  175 + </ProFormList>
  176 + </ModalForm>
  177 + </>
  178 + );
  179 +};
... ...
src/pages/Order/components/OrderDrawer.tsx
... ... @@ -3,7 +3,6 @@ import {
3 3 postKingdeeRepCustomer,
4 4 postKingdeeRepCustomerDetail,
5 5 postKingdeeRepMaterial,
6   - postKingdeeRepSystemCustomField,
7 6 postServiceOrderAddOrder,
8 7 postServiceOrderQuerySalesCode,
9 8 postServiceOrderUpdateOrder,
... ... @@ -13,6 +12,7 @@ import {
13 12 getAliYunOSSFileNameFromUrl,
14 13 getUserInfo,
15 14 } from '@/utils';
  15 +import { getTeacherCustomFieldNumber } from '@/utils/kingdee';
16 16 import {
17 17 DrawerForm,
18 18 FormListActionType,
... ... @@ -35,10 +35,14 @@ import {
35 35 PAYMENT_METHOD_OPTIONS,
36 36 PRODUCT_BELONG_DEPARTMENT_OPTIONS,
37 37 } from '../constant';
  38 +import KingdeeCustomerModal from './KingdeeCustomerModal';
38 39  
39 40 export default ({ onClose, data, subOrders, orderOptType }) => {
40 41 const [invoicingStatus, setInvoicingStatus] = useState('');
41 42 const [salesCodeOptions, setSalesCodeOptions] = useState([]);
  43 + const [customer, setCustomer] = useState({});
  44 + const [kingdeeCstomerModalVisible, setKingdeeCstomerModalVisible] =
  45 + useState(false);
42 46 // const [productInvStockOptionsList, setProductInvStockOptionsList] = useState(
43 47 // [],
44 48 // ); //商品的仓库选项
... ... @@ -119,7 +123,6 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
119 123 includeFlag = true;
120 124 }
121 125 }
122   - console.log(includeFlag);
123 126 if (!includeFlag) {
124 127 form.resetFields(['salesCode']);
125 128 message.warning('检测到销售代码为旧的,已清空,请重新选择');
... ... @@ -127,48 +130,6 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
127 130 }
128 131 };
129 132  
130   - useEffect(() => {
131   - getSalesCodeOptions();
132   - }, []);
133   -
134   - useEffect(() => {
135   - // 在组件挂载或数据变化时,更新组件状态
136   - if (data) {
137   - setInvoicingStatus(data.invoicingStatus);
138   - }
139   - }, [data]);
140   -
141   - // let mainInfoDisbled = optType('edit');
142   - if (optType('edit') || optType('copy')) {
143   - //如果是复制,需要开票,不回显是否需要开票字段
144   - if (optType('copy')) {
145   - if (data.invoicingStatus === 'INVOICED') {
146   - data.invoicingStatus = undefined;
147   - }
148   - }
149   - //订单修改和新增的子订单列表命名是list
150   - data.list = data.subOrderInformationLists;
151   - //主订单事业部默认显示子订单第一条的事业部
152   - data.productBelongBusiness = data.list[0].productBelongBusiness;
153   - data.paymentMethod = data.list[0].paymentMethod;
154   - data.paymentChannel = data.list[0].paymentChannel;
155   - data.invoicingStatus = data.list[0].invoicingStatus;
156   -
157   - data.list = data.list?.map((item) => {
158   - item.filePaths = item.listAnnex?.map((path) => {
159   - let i = 0;
160   - return {
161   - uid: i++,
162   - name: getAliYunOSSFileNameFromUrl(path),
163   - status: 'uploaded',
164   - url: path,
165   - response: { data: [path] },
166   - };
167   - });
168   - return item;
169   - });
170   - }
171   -
172 133 //复制的时候,如果是不需要开票,要把开票信息清空
173 134 if (optType('copy') && data.invoicingStatus === 'UN_INVOICE') {
174 135 data.invoiceIdentificationNumber = undefined;
... ... @@ -193,6 +154,92 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
193 154 }, [data]);
194 155  
195 156 /**
  157 + * 选择客户后自动为收货人Select添加选项,填充课题组和单位信息
  158 + * @param option 客户选项
  159 + */
  160 + async function autoFillCustomerContactSelectOptions(customerId: any) {
  161 + //查询单位详细信息
  162 + let res = await postKingdeeRepCustomerDetail({
  163 + data: {
  164 + id: customerId,
  165 + },
  166 + });
  167 +
  168 + //erp客户名称
  169 + form.setFieldValue('erpCustomerName', res?.name);
  170 +
  171 + //重新设置当前option
  172 + form.setFieldValue('erpCustomerId', {
  173 + label: res?.name,
  174 + value: res?.id,
  175 + id: res?.id,
  176 + });
  177 +
  178 + //查询客户自定义字段,课题组
  179 + let entity_number = await getTeacherCustomFieldNumber();
  180 +
  181 + //在单位详细信息中拿到自定义字段的值
  182 + let customField = res?.custom_field;
  183 + if (customField) {
  184 + let teacherName = customField[entity_number];
  185 + //填充到课题组老师表单字段中
  186 + form.setFieldValue('institutionContactName', teacherName);
  187 + }
  188 +
  189 + //单位名称,从客户名称中获取,客户名称规则<单位名称>-<联系人名称和电话>
  190 + let namePortions = res?.name?.split('-');
  191 + if (namePortions && namePortions.length >= 2) {
  192 + form.setFieldValue('institution', namePortions[0]);
  193 + }
  194 +
  195 + //如果原来的收货信息没有包含在这次查询出来的收货人选项中,那么清除原来的收货人信息
  196 + let existFlag = false;
  197 +
  198 + //填充收货人选项
  199 + let newProductCustomerContactOptions = res?.bomentity?.map((item) => {
  200 + let address =
  201 + item.contact_person + ',' + item.mobile + ',' + item.contact_address;
  202 + if (address === data.contactAddress) {
  203 + existFlag = true;
  204 + }
  205 + return { ...item, label: address, value: address };
  206 + });
  207 +
  208 + setProductCustomerContactOptions(newProductCustomerContactOptions);
  209 +
  210 + if (!existFlag) {
  211 + //清空原来的收货人信息
  212 + form.setFieldValue('customerShippingAddress', undefined);
  213 + form.setFieldValue('customerContactNumber', undefined);
  214 + form.setFieldValue('customerName', undefined);
  215 + form.setFieldValue('erpCustomerAddress', undefined);
  216 + }
  217 + }
  218 +
  219 + /**
  220 + * 回显金蝶信息
  221 + */
  222 + async function showKindeeInfo() {
  223 + //客户信息
  224 + if (data.customerId) {
  225 + //客户回显
  226 + autoFillCustomerContactSelectOptions(data.customerId);
  227 + }
  228 +
  229 + //商品单位回显
  230 + let list = data?.subOrderInformationLists;
  231 + if (list) {
  232 + let newProductUnitOptionsList = [...productUnitOptionsList];
  233 + for (let i = 0; i < list.length; i++) {
  234 + newProductUnitOptionsList[i] = [
  235 + { label: list[i].unit, value: list[i].unitId },
  236 + ];
  237 + }
  238 + setProductUnitOptionsList(newProductUnitOptionsList);
  239 + }
  240 + }
  241 +
  242 + /**
196 243 *
197 244 * @param option 商品名称所对应的商品数据
198 245 * @param currentRowData list中当前行的数据
... ... @@ -213,7 +260,7 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
213 260  
214 261 //单位
215 262 currentData.unit = option.base_unit_name;
216   - currentData.erpUnitId = option.base_unit_id;
  263 + currentData.unitId = option.base_unit_id;
217 264  
218 265 form.setFieldValue('list', copyList);
219 266  
... ... @@ -247,7 +294,7 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
247 294 form.setFieldValue('customerName', option.contact_person);
248 295  
249 296 //erp收货地址:需要与客户联系人中的地址一样:姓名,手机号,地址
250   - form.setFieldValue('erpCustomerAddress', option.value);
  297 + form.setFieldValue('contactAddress', option.value);
251 298 }
252 299  
253 300 /**
... ... @@ -255,58 +302,9 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
255 302 * @param option
256 303 */
257 304 function autoFillSalesInfo(option: any) {
  305 + console.log(option);
258 306 //销售代表对应职员编码填充
259   - form.setFieldValue('number', option.number);
260   - }
261   -
262   - /**
263   - * 选择客户后自动为收货人Select添加选项,填充课题组和单位信息
264   - * @param option 客户选项
265   - */
266   - async function autoFillCustomerContactSelectOptions(option: any) {
267   - //查询单位详细信息
268   - let res = await postKingdeeRepCustomerDetail({
269   - data: {
270   - id: option.id,
271   - },
272   - });
273   -
274   - //erp客户名称
275   - form.setFieldValue('erpCustomerName', option.name);
276   -
277   - //查询客户自定义字段,课题组
278   - let customFiledRes = await postKingdeeRepSystemCustomField({
279   - data: {
280   - entity_number: 'bd_customer',
281   - },
282   - });
283   -
284   - //遍历自定义字段的head,找到名称为"课题组老师"的entity_number
285   - let entity_number = '';
286   - customFiledRes?.head?.forEach((item) => {
287   - if (item.display_name === '课题组老师') {
288   - entity_number = item.number;
289   - }
290   - });
291   - //在单位详细信息中拿到自定义字段的值
292   - let teacherName = res?.custom_field[entity_number];
293   - //填充到课题组老师表单字段中
294   - form.setFieldValue('institutionContactName', teacherName);
295   -
296   - //单位名称,从客户名称中获取,客户名称规则<单位名称>-<联系人名称和电话>
297   - let namePortions = res?.name.split('-');
298   - if (namePortions.length >= 2) {
299   - form.setFieldValue('institution', namePortions[0]);
300   - }
301   -
302   - //填充收货人选项
303   - let newProductCustomerContactOptions = res?.bomentity?.map((item) => {
304   - let address =
305   - item.contact_person + ',' + item.mobile + ',' + item.contact_address;
306   - return { ...item, label: address, value: address };
307   - });
308   - console.log(newProductCustomerContactOptions);
309   - setProductCustomerContactOptions(newProductCustomerContactOptions);
  307 + form.setFieldValue('empNumber', option.number);
310 308 }
311 309  
312 310 /**
... ... @@ -343,725 +341,822 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
343 341 form.setFieldValue('totalPayment', totalPayment);
344 342 }
345 343  
346   - return (
347   - <DrawerForm<{
348   - deleteSubOrderLists: any;
349   - name: string;
350   - company: string;
351   - }>
352   - open
353   - width="35%"
354   - title={optType('add') || optType('copy') ? '新建订单' : '修改订单'}
355   - resize={{
356   - onResize() {
357   - console.log('resize!');
358   - },
359   - maxWidth: window.innerWidth * 0.8,
360   - minWidth: 400,
361   - }}
362   - // layout="horizontal"
363   - // labelCol={{ span: 8 }}
364   - form={form}
365   - autoFocusFirstInput
366   - drawerProps={{
367   - destroyOnClose: true,
368   - maskClosable: false,
369   - }}
370   - submitTimeout={2000}
371   - onFinish={async (values) => {
372   - let res = {};
373   - //附件处理
374   - let list = values.list;
375   - // console.log(list);
376   - list = list.map((item) => {
377   - item.filePaths = item.filePaths?.map((file) => {
378   - console.log(file);
379   - return { url: file.response.data[0] };
380   - });
381   - return item;
382   - });
  344 + useEffect(() => {
  345 + getSalesCodeOptions();
  346 + showKindeeInfo();
  347 + }, []);
383 348  
384   - values.list = list;
385   - values.institution = values.institution?.trim();
386   - values.institutionContactName = values.institutionContactName?.trim();
  349 + useEffect(() => {
  350 + // 在组件挂载或数据变化时,更新组件状态
  351 + if (data) {
  352 + setInvoicingStatus(data.invoicingStatus);
  353 + }
  354 + }, [data]);
387 355  
388   - if (optType('add') || optType('copy')) {
389   - res = await postServiceOrderAddOrder({ data: values });
390   - } else {
391   - //计算已删除的子订单id
392   - const originIds = originSubOrders.map((item) => {
393   - return item.id;
394   - });
395   - const curIds = form.getFieldValue('list')?.map((item) => {
396   - return item.id;
  356 + // let mainInfoDisbled = optType('edit');
  357 + if (optType('edit') || optType('copy')) {
  358 + //如果是复制,需要开票,不回显是否需要开票字段
  359 + if (optType('copy')) {
  360 + if (data.invoicingStatus === 'INVOICED') {
  361 + data.invoicingStatus = undefined;
  362 + }
  363 + }
  364 + //订单修改和新增的子订单列表命名是list
  365 + data.list = data.subOrderInformationLists;
  366 + //主订单事业部默认显示子订单第一条的事业部
  367 + data.productBelongBusiness = data.list[0].productBelongBusiness;
  368 + data.paymentMethod = data.list[0].paymentMethod;
  369 + data.paymentChannel = data.list[0].paymentChannel;
  370 + data.invoicingStatus = data.list[0].invoicingStatus;
  371 +
  372 + data.list = data.list?.map((item) => {
  373 + item.filePaths = item.listAnnex?.map((path) => {
  374 + let i = 0;
  375 + return {
  376 + uid: i++,
  377 + name: getAliYunOSSFileNameFromUrl(path),
  378 + status: 'uploaded',
  379 + url: path,
  380 + response: { data: [path] },
  381 + };
  382 + });
  383 + return item;
  384 + });
  385 + }
  386 +
  387 + return (
  388 + <>
  389 + <DrawerForm<{
  390 + deleteSubOrderLists: any;
  391 + name: string;
  392 + company: string;
  393 + }>
  394 + open
  395 + width="35%"
  396 + title={optType('add') || optType('copy') ? '新建订单' : '修改订单'}
  397 + resize={{
  398 + onResize() {
  399 + console.log('resize!');
  400 + },
  401 + maxWidth: window.innerWidth * 0.8,
  402 + minWidth: 400,
  403 + }}
  404 + // layout="horizontal"
  405 + // labelCol={{ span: 8 }}
  406 + form={form}
  407 + autoFocusFirstInput
  408 + drawerProps={{
  409 + destroyOnClose: true,
  410 + maskClosable: false,
  411 + }}
  412 + submitTimeout={2000}
  413 + onFinish={async (values) => {
  414 + let res = {};
  415 + //附件处理
  416 + let list = values.list;
  417 + // console.log(list);
  418 + list = list.map((item) => {
  419 + item.filePaths = item.filePaths?.map((file) => {
  420 + console.log(file);
  421 + return { url: file.response.data[0] };
  422 + });
  423 + return item;
397 424 });
398   - let diff = originIds.filter((item) => !curIds.includes(item));
399   - values.deleteSubOrderLists = diff;
400   - res = await postServiceOrderUpdateOrder({ data: values });
401   - }
402 425  
403   - if (res.result === RESPONSE_CODE.SUCCESS) {
404   - message.success(res.message);
405   - // 不返回不会关闭弹框
406   - onClose(true);
407   - return true;
408   - }
409   - }}
410   - onOpenChange={(val) => {
411   - return !val && onClose();
412   - }}
413   - >
414   - <h2>订单基本信息</h2>
415   - <ProFormText
416   - key="id"
417   - name="id"
418   - width="lg"
419   - disabled
420   - label="id"
421   - placeholder="id"
422   - hidden
423   - />
  426 + values.list = list;
  427 + values.institution = values.institution?.trim();
  428 + values.institutionContactName = values.institutionContactName?.trim();
  429 +
  430 + if (typeof values.erpCustomerId !== 'string') {
  431 + values.erpCustomerId = values.erpCustomerId?.id;
  432 + }
424 433  
425   - <ProFormText
426   - key="number"
427   - name="number"
428   - width="lg"
429   - disabled
430   - label="销售职员编码"
431   - placeholder="销售职员编码"
432   - hidden
433   - />
  434 + if (optType('add') || optType('copy')) {
  435 + res = await postServiceOrderAddOrder({ data: values });
  436 + } else {
  437 + //计算已删除的子订单id
  438 + const originIds = originSubOrders.map((item) => {
  439 + return item.id;
  440 + });
  441 + const curIds = form.getFieldValue('list')?.map((item) => {
  442 + return item.id;
  443 + });
  444 + let diff = originIds.filter((item) => !curIds.includes(item));
  445 + values.deleteSubOrderLists = diff;
  446 + res = await postServiceOrderUpdateOrder({ data: values });
  447 + }
434 448  
435   - <ProFormSelect
436   - name="salesCode"
437   - key="salesCode"
438   - width="lg"
439   - showSearch
440   - label="销售代表"
441   - placeholder="请输入销售代表"
442   - rules={[{ required: true, message: '销售代表必填' }]}
443   - options={salesCodeOptions}
444   - onChange={(_, option) => {
445   - autoFillSalesInfo(option);
  449 + if (res.result === RESPONSE_CODE.SUCCESS) {
  450 + message.success(res.message);
  451 + // 不返回不会关闭弹框
  452 + onClose(true);
  453 + return true;
  454 + }
  455 + }}
  456 + onOpenChange={(val) => {
  457 + return !val && onClose();
446 458 }}
447   - // disabled={mainInfoDisbled}
448   - />
449   - <ProFormText
450   - key="erpCustomerName"
451   - name="erpCustomerName"
452   - hidden
453   - ></ProFormText>
  459 + >
  460 + <h2>订单基本信息</h2>
  461 + <ProFormText
  462 + key="id"
  463 + name="id"
  464 + width="lg"
  465 + disabled
  466 + label="id"
  467 + placeholder="id"
  468 + hidden
  469 + />
454 470  
455   - <ProFormText
456   - key="erpCustomerAddress"
457   - name="erpCustomerAddress"
458   - hidden
459   - ></ProFormText>
  471 + <ProFormText
  472 + key="empNumber"
  473 + name="empNumber"
  474 + width="lg"
  475 + label="销售职员编码"
  476 + placeholder="销售职员编码"
  477 + hidden
  478 + />
460 479  
461   - <ProFormSelect
462   - name="erpCustomerId"
463   - key="customerId"
464   - width="lg"
465   - showSearch
466   - label="客户"
467   - placeholder="请选择客户"
468   - rules={[{ required: true, message: '客户必填' }]}
469   - onChange={(_, option) => {
470   - autoFillCustomerContactSelectOptions(option);
471   - }}
472   - fieldProps={{
473   - optionItemRender(item) {
474   - if (item.type === 'add') {
  480 + <ProFormSelect
  481 + name="salesCode"
  482 + key="salesCode"
  483 + width="lg"
  484 + showSearch
  485 + label="销售代表"
  486 + placeholder="请输入销售代表"
  487 + rules={[{ required: true, message: '销售代表必填' }]}
  488 + options={salesCodeOptions}
  489 + onChange={(_, option) => {
  490 + autoFillSalesInfo(option);
  491 + }}
  492 + // disabled={mainInfoDisbled}
  493 + />
  494 + <ProFormText
  495 + key="erpCustomerName"
  496 + name="erpCustomerName"
  497 + hidden
  498 + ></ProFormText>
  499 +
  500 + <ProFormText
  501 + key="contactAddress"
  502 + name="contactAddress"
  503 + hidden
  504 + ></ProFormText>
  505 +
  506 + <ProFormSelect
  507 + name="erpCustomerId"
  508 + key="erpCustomerId"
  509 + width="lg"
  510 + showSearch
  511 + label={
  512 + <>
  513 + <span>客户</span>
  514 + <span
  515 + className="pl-2 text-xs text-[#1677ff] cursor-pointer"
  516 + onClick={() => {
  517 + let customerId = form.getFieldValue('erpCustomerId');
  518 + if (typeof customerId === 'string') {
  519 + setCustomer({ ...customer, id: customerId });
  520 + } else {
  521 + setCustomer({ ...customer, id: customerId.id });
  522 + }
  523 + setKingdeeCstomerModalVisible(true);
  524 + }}
  525 + >
  526 + 编辑客户信息
  527 + </span>
  528 + </>
  529 + }
  530 + placeholder="请选择客户"
  531 + rules={[{ required: true, message: '客户必填' }]}
  532 + onChange={(_, option) => {
  533 + //新增客户
  534 + if (option.type === 'add') {
  535 + setCustomer({ name: option.name });
  536 + setKingdeeCstomerModalVisible(true);
  537 + return;
  538 + }
  539 + autoFillCustomerContactSelectOptions(option.id);
  540 + }}
  541 + initialValue={{
  542 + label: data?.erpCustomerName,
  543 + value: data?.customerId,
  544 + id: data?.customerId,
  545 + }}
  546 + fieldProps={{
  547 + optionItemRender(item) {
  548 + if (item.type === 'add') {
  549 + return (
  550 + <div title={item.name + '(新增客户)'}>
  551 + <span style={{ color: '#333333' }}>{item.name}</span>
  552 + {' | '}
  553 + <span style={{ color: 'orange' }}>自定义</span>
  554 + </div>
  555 + );
  556 + }
475 557 return (
476   - <div title={item.name + '(新增客户)'}>
  558 + <div
  559 + title={
  560 + item.name +
  561 + ' | ' +
  562 + item.customerContactNumber +
  563 + ' | ' +
  564 + (item.customerShippingAddress === undefined
  565 + ? '无地址'
  566 + : item.customerShippingAddress) +
  567 + ' | ' +
  568 + item.institutionContactName +
  569 + ' | ' +
  570 + item.institution
  571 + }
  572 + >
477 573 <span style={{ color: '#333333' }}>{item.name}</span>
478   - {' | '}
479   - <span style={{ color: 'orange' }}>自定义</span>
480 574 </div>
481 575 );
  576 + },
  577 + }}
  578 + debounceTime={1000}
  579 + request={async (value, {}) => {
  580 + const keywords = value.keyWords;
  581 + const res = await postKingdeeRepCustomer({
  582 + data: { search: keywords },
  583 + });
  584 + let options = res?.rows?.map((c: any) => {
  585 + return {
  586 + ...c,
  587 + label: c.name,
  588 + value: c.id,
  589 + key: c.id,
  590 + };
  591 + });
  592 +
  593 + //第一个商品默认为要新增客户
  594 + if (keywords.trim() !== '') {
  595 + options.unshift({
  596 + name: keywords,
  597 + type: 'add',
  598 + label: keywords,
  599 + value: 3.1415926,
  600 + key: keywords,
  601 + });
482 602 }
483   - return (
484   - <div
485   - title={
486   - item.name +
487   - ' | ' +
488   - item.customerContactNumber +
489   - ' | ' +
490   - (item.customerShippingAddress === undefined
491   - ? '无地址'
492   - : item.customerShippingAddress) +
493   - ' | ' +
494   - item.institutionContactName +
495   - ' | ' +
496   - item.institution
497   - }
498   - >
499   - <span style={{ color: '#333333' }}>{item.name}</span>
500   - </div>
501   - );
502   - },
503   - }}
504   - debounceTime={1000}
505   - request={async (value, { params }) => {
506   - const keywords = value.keyWords;
507   - const res = await postKingdeeRepCustomer({
508   - data: { search: keywords },
509   - params: params,
510   - });
511   - console.log(res);
512   - let options = res?.rows?.map((c: any) => {
513   - return {
514   - ...c,
515   - label: c.name,
516   - value: c.id,
517   - key: c.id,
518   - };
519   - });
  603 + return options;
  604 + }}
  605 + />
  606 + <ProFormSelect
  607 + key="customerName"
  608 + label="收货人"
  609 + width="lg"
  610 + showSearch
  611 + name="customerName"
  612 + placeholder="请选择收货人"
  613 + rules={[{ required: true, message: '收货人必填' }]}
  614 + onChange={(_, option) => {
  615 + autoFillCustomerInfo(option);
  616 + }}
  617 + initialValue={data.contactAddress}
  618 + options={productCustomerContactOptions}
  619 + // fieldProps={{
  620 + // optionItemRender(item) {
  621 + // if (item.type === 'add') {
  622 + // return (
  623 + // <div title={item.name + '(新增收货人)'}>
  624 + // <span style={{ color: '#333333' }}>{item.name}</span>
  625 + // {' | '}
  626 + // <span style={{ color: 'orange' }}>自定义</span>
  627 + // </div>
  628 + // );
  629 + // }
  630 + // return (
  631 + // <div
  632 + // title={
  633 + // item.name +
  634 + // ' | ' +
  635 + // item.customerContactNumber +
  636 + // ' | ' +
  637 + // (item.customerShippingAddress === undefined
  638 + // ? '无地址'
  639 + // : item.customerShippingAddress) +
  640 + // ' | ' +
  641 + // item.institutionContactName +
  642 + // ' | ' +
  643 + // item.institution
  644 + // }
  645 + // >
  646 + // <span style={{ color: '#333333' }}>{item.name}</span>
  647 + // {' | '}
  648 + // <span style={{ color: '#339999' }}>
  649 + // {item.customerContactNumber === undefined
  650 + // ? '无电话号码'
  651 + // : item.customerContactNumber}
  652 + // </span>
  653 + // {' | '}
  654 + // <span style={{ color: '#666666' }}>
  655 + // {item.customerShippingAddress === undefined
  656 + // ? '无地址'
  657 + // : item.customerShippingAddress}
  658 + // </span>
  659 + // {' | '}
  660 + // <span style={{ color: '#666666' }}>
  661 + // {item.institutionContactName === undefined
  662 + // ? '无课题组'
  663 + // : item.institutionContactName}
  664 + // </span>
  665 + // {' | '}
  666 + // <span style={{ color: '#666666' }}>
  667 + // {item.institution === undefined ? '无单位' : item.institution}
  668 + // </span>
  669 + // </div>
  670 + // );
  671 + // },
  672 + // }}
  673 + // debounceTime={1000}
  674 + // request={async (value, { params }) => {
  675 + // const keywords = value.keyWords;
  676 + // const res = await postKingdeeRepCustomer({
  677 + // data: { search: keywords },
  678 + // params: params,
  679 + // });
  680 + // console.log(res)
  681 + // let options = res?.rows?.map((c: any) => {
  682 + // return {
  683 + // ...c,
  684 + // label: c.name,
  685 + // value: c.id,
  686 + // key: c.id,
  687 + // };
  688 + // });
520 689  
521   - //第一个商品默认为要新增客户
522   - if (keywords.trim() !== '') {
523   - options.unshift({
524   - name: keywords,
525   - type: 'add',
526   - label: keywords,
527   - value: 3.1415926,
528   - key: keywords,
529   - });
530   - }
531   - return options;
532   - }}
533   - />
534   - <ProFormSelect
535   - key="customerName"
536   - label="收货人"
537   - width="lg"
538   - showSearch
539   - name="customerName"
540   - // options={options}
541   - placeholder="请输入收货人"
542   - rules={[{ required: true, message: '收货人必填' }]}
543   - onChange={(_, option) => {
544   - autoFillCustomerInfo(option);
545   - }}
546   - options={productCustomerContactOptions}
547   - // fieldProps={{
548   - // optionItemRender(item) {
549   - // if (item.type === 'add') {
550   - // return (
551   - // <div title={item.name + '(新增收货人)'}>
552   - // <span style={{ color: '#333333' }}>{item.name}</span>
553   - // {' | '}
554   - // <span style={{ color: 'orange' }}>自定义</span>
555   - // </div>
556   - // );
557   - // }
558   - // return (
559   - // <div
560   - // title={
561   - // item.name +
562   - // ' | ' +
563   - // item.customerContactNumber +
564   - // ' | ' +
565   - // (item.customerShippingAddress === undefined
566   - // ? '无地址'
567   - // : item.customerShippingAddress) +
568   - // ' | ' +
569   - // item.institutionContactName +
570   - // ' | ' +
571   - // item.institution
572   - // }
573   - // >
574   - // <span style={{ color: '#333333' }}>{item.name}</span>
575   - // {' | '}
576   - // <span style={{ color: '#339999' }}>
577   - // {item.customerContactNumber === undefined
578   - // ? '无电话号码'
579   - // : item.customerContactNumber}
580   - // </span>
581   - // {' | '}
582   - // <span style={{ color: '#666666' }}>
583   - // {item.customerShippingAddress === undefined
584   - // ? '无地址'
585   - // : item.customerShippingAddress}
586   - // </span>
587   - // {' | '}
588   - // <span style={{ color: '#666666' }}>
589   - // {item.institutionContactName === undefined
590   - // ? '无课题组'
591   - // : item.institutionContactName}
592   - // </span>
593   - // {' | '}
594   - // <span style={{ color: '#666666' }}>
595   - // {item.institution === undefined ? '无单位' : item.institution}
596   - // </span>
597   - // </div>
598   - // );
599   - // },
600   - // }}
601   - // debounceTime={1000}
602   - // request={async (value, { params }) => {
603   - // const keywords = value.keyWords;
604   - // const res = await postKingdeeRepCustomer({
605   - // data: { search: keywords },
606   - // params: params,
607   - // });
608   - // console.log(res)
609   - // let options = res?.rows?.map((c: any) => {
610   - // return {
611   - // ...c,
612   - // label: c.name,
613   - // value: c.id,
614   - // key: c.id,
615   - // };
616   - // });
  690 + // //第一个商品默认为要新增的商品
  691 + // if (keywords.trim() !== '') {
  692 + // options.unshift({
  693 + // name: keywords,
  694 + // type: 'add',
  695 + // label: keywords,
  696 + // value: 3.1415926,
  697 + // key: keywords,
  698 + // });
  699 + // }
  700 + // return options;
  701 + // }}
  702 + />
  703 + <ProFormText
  704 + width="lg"
  705 + key="customerContactNumber"
  706 + name="customerContactNumber"
  707 + label="联系方式"
  708 + placeholder="请输入联系方式"
  709 + rules={[{ required: true, message: '联系方式必填' }]}
  710 + disabled
  711 + />
  712 + <ProFormText
  713 + width="lg"
  714 + key="institution"
  715 + name="institution"
  716 + label="单位"
  717 + placeholder="请输入单位"
  718 + rules={[{ required: true, message: '单位必填' }]}
  719 + disabled
  720 + />
  721 + <ProFormText
  722 + width="lg"
  723 + key="institutionContactName"
  724 + name="institutionContactName"
  725 + label="课题组"
  726 + placeholder="请输入课题组"
  727 + rules={[{ required: true, message: '课题组必填' }]}
  728 + disabled
  729 + />
  730 + <ProFormTextArea
  731 + width="lg"
  732 + key="customerShippingAddress"
  733 + name="customerShippingAddress"
  734 + label="收货地址"
  735 + placeholder="请输入收货地址"
  736 + rules={[{ required: true, message: '收货地址必填' }]}
  737 + disabled
  738 + />
  739 + <div id="total-payment">
  740 + <ProFormDigit
  741 + name="totalPayment"
  742 + width="lg"
  743 + key="totalPayment"
  744 + label="支付总额(¥)"
  745 + rules={[{ required: true, message: '支付总额必填' }]}
  746 + tooltip="点击计算,合计所有子订单金额"
  747 + fieldProps={{
  748 + addonAfter: (
  749 + <Button
  750 + className="rounded-l-none"
  751 + type="primary"
  752 + onClick={computeTotalPayment}
  753 + >
  754 + 计算
  755 + </Button>
  756 + ),
  757 + }}
  758 + // disabled={mainInfoDisbled}
  759 + />
  760 + </div>
617 761  
618   - // //第一个商品默认为要新增的商品
619   - // if (keywords.trim() !== '') {
620   - // options.unshift({
621   - // name: keywords,
622   - // type: 'add',
623   - // label: keywords,
624   - // value: 3.1415926,
625   - // key: keywords,
626   - // });
627   - // }
628   - // return options;
629   - // }}
630   - />
631   - <ProFormText
632   - width="lg"
633   - key="customerContactNumber"
634   - name="customerContactNumber"
635   - label="联系方式"
636   - placeholder="请输入联系方式"
637   - rules={[{ required: true, message: '联系方式必填' }]}
638   - disabled
639   - />
640   - <ProFormText
641   - width="lg"
642   - key="institution"
643   - name="institution"
644   - label="单位"
645   - placeholder="请输入单位"
646   - rules={[{ required: true, message: '单位必填' }]}
647   - disabled
648   - />
649   - <ProFormText
650   - width="lg"
651   - key="institutionContactName"
652   - name="institutionContactName"
653   - label="课题组"
654   - placeholder="请输入课题组"
655   - rules={[{ required: true, message: '课题组必填' }]}
656   - disabled
657   - />
658   - <ProFormTextArea
659   - width="lg"
660   - key="customerShippingAddress"
661   - name="customerShippingAddress"
662   - label="收货地址"
663   - placeholder="请输入收货地址"
664   - rules={[{ required: true, message: '收货地址必填' }]}
665   - disabled
666   - />
667   - <div id="total-payment">
668   - <ProFormDigit
669   - name="totalPayment"
  762 + <ProFormSelect
  763 + placeholder="请输入支付渠道"
  764 + name="paymentChannel"
670 765 width="lg"
671   - key="totalPayment"
672   - label="支付总额(¥)"
673   - rules={[{ required: true, message: '支付总额必填' }]}
674   - tooltip="点击计算,合计所有子订单金额"
675   - fieldProps={{
676   - addonAfter: (
677   - <Button
678   - className="rounded-l-none"
679   - type="primary"
680   - onClick={computeTotalPayment}
681   - >
682   - 计算
683   - </Button>
684   - ),
  766 + key="paymentChannel"
  767 + label="支付渠道"
  768 + options={enumToSelect(PAYMENT_CHANNEL_OPTIONS)}
  769 + rules={[{ required: true, message: '支付渠道必填' }]}
  770 + // disabled={mainInfoDisbled}
  771 + />
  772 + <ProFormSelect
  773 + placeholder="请输入支付方式"
  774 + name="paymentMethod"
  775 + width="lg"
  776 + key="paymentMethod"
  777 + label="支付方式"
  778 + options={enumToSelect(PAYMENT_METHOD_OPTIONS)}
  779 + rules={[{ required: true, message: '支付方式必填' }]}
  780 + // disabled={mainInfoDisbled}
  781 + />
  782 + <ProFormSelect
  783 + placeholder="选择是否需要开票"
  784 + name="invoicingStatus"
  785 + width="lg"
  786 + key="invoicingStatus"
  787 + label="是否需要开票"
  788 + options={getInvoicingSelect()}
  789 + // disabled={mainInfoDisbled}
  790 + onChange={(_, option) => {
  791 + setInvoicingStatus(option.value);
  792 + if (option.value === 'UN_INVOICE') {
  793 + form.setFieldValue('invoiceIdentificationNumber', undefined);
  794 + form.setFieldValue('bank', undefined);
  795 + form.setFieldValue('bankAccountNumber', undefined);
  796 + }
685 797 }}
  798 + rules={[{ required: true, message: '是否需要开票必填' }]}
  799 + />
  800 + <ProFormText
  801 + width="lg"
  802 + name="invoiceIdentificationNumber"
  803 + label="开票信息"
  804 + key="invoiceIdentificationNumber"
686 805 // disabled={mainInfoDisbled}
  806 + hidden={invoicingStatus === 'UN_INVOICE'}
  807 + placeholder="请输入开票信息"
  808 + rules={[
  809 + {
  810 + required: invoicingStatus === 'UN_INVOICE' ? false : true,
  811 + message: '开票信息必填',
  812 + },
  813 + ]}
687 814 />
688   - </div>
689 815  
690   - <ProFormSelect
691   - placeholder="请输入支付渠道"
692   - name="paymentChannel"
693   - width="lg"
694   - key="paymentChannel"
695   - label="支付渠道"
696   - options={enumToSelect(PAYMENT_CHANNEL_OPTIONS)}
697   - rules={[{ required: true, message: '支付渠道必填' }]}
698   - // disabled={mainInfoDisbled}
699   - />
700   - <ProFormSelect
701   - placeholder="请输入支付方式"
702   - name="paymentMethod"
703   - width="lg"
704   - key="paymentMethod"
705   - label="支付方式"
706   - options={enumToSelect(PAYMENT_METHOD_OPTIONS)}
707   - rules={[{ required: true, message: '支付方式必填' }]}
708   - // disabled={mainInfoDisbled}
709   - />
710   - <ProFormSelect
711   - placeholder="选择是否需要开票"
712   - name="invoicingStatus"
713   - width="lg"
714   - key="invoicingStatus"
715   - label="是否需要开票"
716   - options={getInvoicingSelect()}
717   - // disabled={mainInfoDisbled}
718   - onChange={(_, option) => {
719   - setInvoicingStatus(option.value);
720   - if (option.value === 'UN_INVOICE') {
721   - form.setFieldValue('invoiceIdentificationNumber', undefined);
722   - form.setFieldValue('bank', undefined);
723   - form.setFieldValue('bankAccountNumber', undefined);
724   - }
725   - }}
726   - rules={[{ required: true, message: '是否需要开票必填' }]}
727   - />
728   - <ProFormText
729   - width="lg"
730   - name="invoiceIdentificationNumber"
731   - label="开票信息"
732   - key="invoiceIdentificationNumber"
733   - // disabled={mainInfoDisbled}
734   - hidden={invoicingStatus === 'UN_INVOICE'}
735   - placeholder="请输入开票信息"
736   - rules={[
737   - {
738   - required: invoicingStatus === 'UN_INVOICE' ? false : true,
739   - message: '开票信息必填',
740   - },
741   - ]}
742   - />
743   -
744   - {getUserInfo().roleSmallVO?.code === 'admin' ? (
745   - <ProFormDateTimePicker
  816 + {getUserInfo().roleSmallVO?.code === 'admin' ? (
  817 + <ProFormDateTimePicker
  818 + width="lg"
  819 + key="invoicingTime"
  820 + name="invoicingTime"
  821 + // disabled={mainInfoDisbled}
  822 + hidden={invoicingStatus === 'UN_INVOICE'}
  823 + label="开票时间"
  824 + placeholder="请输入开票时间"
  825 + />
  826 + ) : (
  827 + ''
  828 + )}
  829 + <ProFormText
746 830 width="lg"
747   - key="invoicingTime"
748   - name="invoicingTime"
  831 + name="bank"
  832 + key="bank"
  833 + label="开户银行"
749 834 // disabled={mainInfoDisbled}
750 835 hidden={invoicingStatus === 'UN_INVOICE'}
751   - label="开票时间"
752   - placeholder="请输入开票时间"
  836 + placeholder="请输入开户银行"
  837 + />
  838 + <ProFormText
  839 + width="lg"
  840 + key="bankAccountNumber"
  841 + name="bankAccountNumber"
  842 + hidden={invoicingStatus === 'UN_INVOICE'}
  843 + label="银行账号"
  844 + // disabled={mainInfoDisbled}
  845 + placeholder="请输入银行账号"
  846 + />
  847 + <ProFormTextArea
  848 + width="lg"
  849 + name="notes"
  850 + label="备注"
  851 + key="notes"
  852 + // disabled={mainInfoDisbled}
  853 + placeholder="请输入备注"
  854 + rules={[
  855 + {
  856 + max: 120, // 最大长度为120个字符
  857 + message: '备注不能超过120个字符',
  858 + },
  859 + ]}
753 860 />
754   - ) : (
755   - ''
756   - )}
757   - <ProFormText
758   - width="lg"
759   - name="bank"
760   - key="bank"
761   - label="开户银行"
762   - // disabled={mainInfoDisbled}
763   - hidden={invoicingStatus === 'UN_INVOICE'}
764   - placeholder="请输入开户银行"
765   - />
766   - <ProFormText
767   - width="lg"
768   - key="bankAccountNumber"
769   - name="bankAccountNumber"
770   - hidden={invoicingStatus === 'UN_INVOICE'}
771   - label="银行账号"
772   - // disabled={mainInfoDisbled}
773   - placeholder="请输入银行账号"
774   - />
775   - <ProFormTextArea
776   - width="lg"
777   - name="notes"
778   - label="备注"
779   - key="notes"
780   - // disabled={mainInfoDisbled}
781   - placeholder="请输入备注"
782   - rules={[
783   - {
784   - max: 120, // 最大长度为120个字符
785   - message: '备注不能超过120个字符',
786   - },
787   - ]}
788   - />
789 861  
790   - <h2>商品信息</h2>
791   - <ProFormList
792   - creatorButtonProps={{ disabled: false }}
793   - name="list"
794   - label=""
795   - copyIconProps={false} //复制按钮不显示
796   - initialValue={[
797   - {
798   - productCode: '',
799   - productName: '',
800   - quantity: '',
801   - productPrice: '',
802   - parameters: '',
803   - subOrderPayment: '',
804   - },
805   - ]}
806   - actionGuard={{
807   - beforeRemoveRow: async (index) => {
808   - return new Promise((resolve) => {
809   - if (index === 0) {
810   - message.error('第一行数据不能删除');
811   - resolve(false);
812   - return;
813   - }
814   - resolve(true);
815   - });
816   - },
817   - }}
818   - itemRender={(doms, listMeta) => {
819   - if (optType('edit')) {
820   - let i = 0;
821   - let defaultFileList = listMeta.record?.listAnnex?.map((annex) => {
822   - return {
823   - uid: i++,
824   - name: annex,
825   - status: 'uploaded',
826   - url: annex,
827   - response: { data: [annex] },
828   - };
829   - });
830   - fileList[listMeta.index] = defaultFileList;
831   - }
832   - let itemFileList = fileList[listMeta.index];
833   - return (
834   - <ProCard
835   - bordered
836   - extra={doms.action}
837   - title={'商品' + (listMeta.index + 1)}
838   - style={{
839   - marginBlockEnd: 8,
840   - }}
841   - >
842   - {[
843   - <ProFormText
844   - key={'material' + listMeta.index}
845   - name="materialId"
846   - hidden
847   - ></ProFormText>,
848   - <ProFormSelect
849   - key="key"
850   - label="商品名称"
851   - width="lg"
852   - showSearch
853   - name="productName"
854   - // options={options}
855   - placeholder="请搜索商品"
856   - rules={[{ required: true, message: '商品名称必填' }]}
857   - onChange={(_, option) => {
858   - autoFillProductInfo(option, listMeta, listMeta.index);
859   - }}
860   - fieldProps={{
861   - optionItemRender(item) {
862   - if (item.type === 'add') {
  862 + <h2>商品信息</h2>
  863 + <ProFormList
  864 + creatorButtonProps={{ disabled: false }}
  865 + name="list"
  866 + label=""
  867 + copyIconProps={false} //复制按钮不显示
  868 + initialValue={[
  869 + {
  870 + productCode: '',
  871 + productName: '',
  872 + quantity: '',
  873 + productPrice: '',
  874 + parameters: '',
  875 + subOrderPayment: '',
  876 + },
  877 + ]}
  878 + actionGuard={{
  879 + beforeRemoveRow: async (index) => {
  880 + return new Promise((resolve) => {
  881 + if (index === 0) {
  882 + message.error('第一行数据不能删除');
  883 + resolve(false);
  884 + return;
  885 + }
  886 + resolve(true);
  887 + });
  888 + },
  889 + }}
  890 + itemRender={(doms, listMeta) => {
  891 + if (optType('edit')) {
  892 + let i = 0;
  893 + let defaultFileList = listMeta.record?.listAnnex?.map((annex) => {
  894 + return {
  895 + uid: i++,
  896 + name: annex,
  897 + status: 'uploaded',
  898 + url: annex,
  899 + response: { data: [annex] },
  900 + };
  901 + });
  902 + fileList[listMeta.index] = defaultFileList;
  903 + }
  904 + let itemFileList = fileList[listMeta.index];
  905 + return (
  906 + <ProCard
  907 + bordered
  908 + extra={doms.action}
  909 + title={'商品' + (listMeta.index + 1)}
  910 + style={{
  911 + marginBlockEnd: 8,
  912 + }}
  913 + >
  914 + {[
  915 + <ProFormText
  916 + key={'material' + listMeta.index}
  917 + name="materialId"
  918 + hidden
  919 + ></ProFormText>,
  920 + <ProFormSelect
  921 + key="key"
  922 + label="商品名称"
  923 + width="lg"
  924 + showSearch
  925 + name="productName"
  926 + // options={options}
  927 + placeholder="请搜索商品"
  928 + rules={[{ required: true, message: '商品名称必填' }]}
  929 + onChange={(_, option) => {
  930 + autoFillProductInfo(option, listMeta, listMeta.index);
  931 + }}
  932 + initialValue={{
  933 + label: listMeta?.record?.productName,
  934 + value: listMeta?.record?.materialId,
  935 + }}
  936 + fieldProps={{
  937 + optionItemRender(item) {
  938 + if (item.type === 'add') {
  939 + return (
  940 + <div title={item.name + '(新增商品信息)'}>
  941 + <span style={{ color: '#333333' }}>
  942 + {item.name}
  943 + </span>
  944 + {' | '}
  945 + <span style={{ color: 'orange' }}>新增商品</span>
  946 + </div>
  947 + );
  948 + }
863 949 return (
864   - <div title={item.name + '(新增商品信息)'}>
  950 + <div
  951 + title={
  952 + item.label +
  953 + ' | ' +
  954 + (item.model === undefined
  955 + ? '无参数'
  956 + : item.model) +
  957 + ' | ' +
  958 + item.base_unit_name
  959 + }
  960 + >
865 961 <span style={{ color: '#333333' }}>
866   - {item.name}
  962 + {item.label}
  963 + </span>
  964 + {' | '}
  965 + <span style={{ color: '#339999' }}>
  966 + {item.model === undefined ? '无参数' : item.model}
867 967 </span>
868 968 {' | '}
869   - <span style={{ color: 'orange' }}>新增商品</span>
  969 + <span style={{ color: '#666666' }}>
  970 + {item.base_unit_name === undefined
  971 + ? '无单位'
  972 + : item.base_unit_name}
  973 + </span>
870 974 </div>
871 975 );
872   - }
873   - return (
874   - <div
875   - title={
876   - item.label +
877   - ' | ' +
878   - (item.model === undefined ? '无参数' : item.model) +
879   - ' | ' +
880   - item.base_unit_name
881   - }
882   - >
883   - <span style={{ color: '#333333' }}>{item.label}</span>
884   - {' | '}
885   - <span style={{ color: '#339999' }}>
886   - {item.model === undefined ? '无参数' : item.model}
887   - </span>
888   - {' | '}
889   - <span style={{ color: '#666666' }}>
890   - {item.base_unit_name === undefined
891   - ? '无单位'
892   - : item.base_unit_name}
893   - </span>
894   - </div>
895   - );
896   - },
897   - }}
898   - debounceTime={1000}
899   - request={async (value) => {
900   - const keywords = value.keyWords;
901   - const res = await postKingdeeRepMaterial({
902   - data: { search: keywords },
903   - });
904   - let options = res?.rows?.map((p: any) => {
905   - return {
906   - ...p,
907   - label: p.name,
908   - value: p.id + '|' + p.name,
909   - key: p.id,
910   - };
911   - });
912   -
913   - //第一个商品默认为要新增的商品
914   - if (keywords.trim() !== '') {
915   - options.unshift({
916   - productName: keywords,
917   - type: 'add',
918   - label: keywords,
919   - value: 13 + '|' + keywords,
920   - key: keywords,
  976 + },
  977 + }}
  978 + debounceTime={1000}
  979 + request={async (value) => {
  980 + const keywords = value.keyWords;
  981 + const res = await postKingdeeRepMaterial({
  982 + data: { search: keywords },
  983 + });
  984 + let options = res?.rows?.map((p: any) => {
  985 + return {
  986 + ...p,
  987 + label: p.name,
  988 + value: p.id + '|' + p.name,
  989 + key: p.id,
  990 + };
921 991 });
922   - }
923   - return options;
924   - }}
925   - />,
926   - <ProFormText
927   - key={'productCode' + listMeta.index}
928   - width="lg"
929   - name="productCode"
930   - disabled
931   - label={
932   - <>
933   - <span>商品编码</span>
934   - <span className="pl-2 text-xs text-gray-400">
935   - 新增商品时,商品编码由系统自动生成
936   - </span>
937   - </>
938   - }
939   - placeholder="未输入商品名称"
940   - />,
941   - // <ProFormSelect
942   - // key="inv_stock"
943   - // placeholder="请选择仓库"
944   - // name="invStockId"
945   - // width="lg"
946   - // label="仓库"
947   - // options={productInvStockOptionsList[listMeta.index]}
948   - // />,
949   - <ProFormText
950   - key={'parameters' + listMeta.index}
951   - width="lg"
952   - name="parameters"
953   - label="商品参数"
954   - placeholder="请输入商品参数"
955   - rules={[{ required: true, message: '商品参数必填' }]}
956   - disabled
957   - />,
958   - <ProFormDigit
959   - key={'quantity' + listMeta.index}
960   - width="lg"
961   - name="quantity"
962   - label="商品数量"
963   - fieldProps={{
964   - onChange: (value) => {
965   - listMeta.record.quantity = value;
966   - computeSubOrderPayment(listMeta);
967   - },
968   - }}
969   - placeholder="请输入商品数量"
970   - rules={[{ required: true, message: '商品数量必填' }]}
971   - />,
972   -
973   - <ProFormDigit
974   - key={'productPrice' + listMeta.index}
975   - width="lg"
976   - name="productPrice"
977   - label="商品单价"
978   - fieldProps={{
979   - onChange: (value) => {
980   - listMeta.record.productPrice = value;
981   - computeSubOrderPayment(listMeta);
982   - },
983   - }}
984   - placeholder="请输入商品单价"
985   - rules={[{ required: true, message: '商品单价必填' }]}
986   - />,
987 992  
988   - <ProFormSelect
989   - key="erpUnitId"
990   - placeholder="请选择单位"
991   - name="erpUnitId"
992   - width="lg"
993   - label="单位"
994   - options={productUnitOptionsList[listMeta.index]}
995   - rules={[{ required: true, message: '商品单位必填' }]}
996   - />,
997   - <ProFormText
998   - key={'unit' + listMeta.index}
999   - width="lg"
1000   - name="unit"
1001   - label="商品单位"
1002   - placeholder="请输入商品单位"
1003   - rules={[{ required: true, message: '商品单位必填' }]}
1004   - hidden
1005   - />,
  993 + //第一个商品默认为要新增的商品
  994 + if (keywords.trim() !== '') {
  995 + options.unshift({
  996 + productName: keywords,
  997 + type: 'add',
  998 + label: keywords,
  999 + value: 13 + '|' + keywords,
  1000 + key: keywords,
  1001 + });
  1002 + }
  1003 + return options;
  1004 + }}
  1005 + />,
  1006 + <ProFormText
  1007 + key={'productCode' + listMeta.index}
  1008 + width="lg"
  1009 + name="productCode"
  1010 + disabled
  1011 + label={
  1012 + <>
  1013 + <span>商品编码</span>
  1014 + <span className="pl-2 text-xs text-gray-400">
  1015 + 新增商品时,商品编码由系统自动生成
  1016 + </span>
  1017 + </>
  1018 + }
  1019 + placeholder="未输入商品名称"
  1020 + />,
  1021 + // <ProFormSelect
  1022 + // key="inv_stock"
  1023 + // placeholder="请选择仓库"
  1024 + // name="invStockId"
  1025 + // width="lg"
  1026 + // label="仓库"
  1027 + // options={productInvStockOptionsList[listMeta.index]}
  1028 + // />,
  1029 + <ProFormText
  1030 + key={'parameters' + listMeta.index}
  1031 + width="lg"
  1032 + name="parameters"
  1033 + label="商品参数"
  1034 + placeholder="请输入商品参数"
  1035 + rules={[{ required: true, message: '商品参数必填' }]}
  1036 + disabled
  1037 + />,
  1038 + <ProFormDigit
  1039 + key={'quantity' + listMeta.index}
  1040 + width="lg"
  1041 + name="quantity"
  1042 + label="商品数量"
  1043 + fieldProps={{
  1044 + onChange: (value) => {
  1045 + listMeta.record.quantity = value;
  1046 + computeSubOrderPayment(listMeta);
  1047 + },
  1048 + }}
  1049 + placeholder="请输入商品数量"
  1050 + rules={[{ required: true, message: '商品数量必填' }]}
  1051 + />,
1006 1052  
1007   - <ProFormDigit
1008   - width="lg"
1009   - key={'subOrderPayment' + listMeta.index}
1010   - name="subOrderPayment"
1011   - label="子订单金额"
1012   - placeholder="请输入子订单金额"
1013   - tooltip="商品数量和单价变化后会自动计算子订单金额"
1014   - rules={[{ required: true, message: '子订单金额必填' }]}
1015   - />,
1016   - <ProFormSelect
1017   - key={'productBelongBusiness' + listMeta.index}
1018   - placeholder="请输入所属事业部"
1019   - name="productBelongBusiness"
1020   - width="lg"
1021   - label="所属事业部"
1022   - options={enumToSelect(PRODUCT_BELONG_DEPARTMENT_OPTIONS)}
1023   - initialValue={'EXPERIMENTAL_CONSUMABLES'}
1024   - rules={[{ required: true, message: '所属事业部必填' }]}
1025   - // disabled={mainInfoDisbled}
1026   - />,
1027   - <ProFormTextArea
1028   - key={'notes' + listMeta.index}
1029   - width="lg"
1030   - name="notes"
1031   - label={
1032   - <div>
1033   - <span>备注</span>
1034   - <span className="pl-2 text-xs text-gray-400">
1035   - 备注将体现在出货单上,请将需要仓管看见的信息写在备注上,例如需要开收据等信息。
1036   - </span>
1037   - </div>
1038   - }
1039   - placeholder="请输入备注"
1040   - rules={[
1041   - {
1042   - max: 120, // 最大长度为120个字符
1043   - message: '备注不能超过120个字符',
1044   - },
1045   - ]}
1046   - />,
1047   - <>
1048   - <ProFormUploadDragger
1049   - key={'filePaths' + listMeta.index}
1050   - label="附件"
1051   - name="filePaths"
1052   - action="/api/service/order/fileProcess"
  1053 + <ProFormDigit
  1054 + key={'productPrice' + listMeta.index}
  1055 + width="lg"
  1056 + name="productPrice"
  1057 + label="商品单价"
1053 1058 fieldProps={{
1054   - headers: { Authorization: localStorage.getItem('token') },
1055   - itemFileList,
  1059 + onChange: (value) => {
  1060 + listMeta.record.productPrice = value;
  1061 + computeSubOrderPayment(listMeta);
  1062 + },
1056 1063 }}
1057   - />
1058   - </>,
1059   - ]}
1060   - </ProCard>
1061   - );
1062   - }}
1063   - actionRef={actionRef}
1064   - ></ProFormList>
1065   - </DrawerForm>
  1064 + placeholder="请输入商品单价"
  1065 + rules={[{ required: true, message: '商品单价必填' }]}
  1066 + />,
  1067 +
  1068 + <ProFormSelect
  1069 + key="unitId"
  1070 + placeholder="请选择单位"
  1071 + name="unitId"
  1072 + width="lg"
  1073 + label="单位"
  1074 + options={productUnitOptionsList[listMeta.index]}
  1075 + rules={[{ required: true, message: '商品单位必填' }]}
  1076 + />,
  1077 + <ProFormText
  1078 + key={'unit' + listMeta.index}
  1079 + width="lg"
  1080 + name="unit"
  1081 + label="商品单位"
  1082 + placeholder="请输入商品单位"
  1083 + rules={[{ required: true, message: '商品单位必填' }]}
  1084 + hidden
  1085 + />,
  1086 +
  1087 + <ProFormDigit
  1088 + width="lg"
  1089 + key={'subOrderPayment' + listMeta.index}
  1090 + name="subOrderPayment"
  1091 + label="子订单金额"
  1092 + placeholder="请输入子订单金额"
  1093 + tooltip="商品数量和单价变化后会自动计算子订单金额"
  1094 + rules={[{ required: true, message: '子订单金额必填' }]}
  1095 + />,
  1096 + <ProFormSelect
  1097 + key={'productBelongBusiness' + listMeta.index}
  1098 + placeholder="请输入所属事业部"
  1099 + name="productBelongBusiness"
  1100 + width="lg"
  1101 + label="所属事业部"
  1102 + options={enumToSelect(PRODUCT_BELONG_DEPARTMENT_OPTIONS)}
  1103 + initialValue={'EXPERIMENTAL_CONSUMABLES'}
  1104 + rules={[{ required: true, message: '所属事业部必填' }]}
  1105 + // disabled={mainInfoDisbled}
  1106 + />,
  1107 + <ProFormTextArea
  1108 + key={'notes' + listMeta.index}
  1109 + width="lg"
  1110 + name="notes"
  1111 + label={
  1112 + <div>
  1113 + <span>备注</span>
  1114 + <span className="pl-2 text-xs text-gray-400">
  1115 + 备注将体现在出货单上,请将需要仓管看见的信息写在备注上,例如需要开收据等信息。
  1116 + </span>
  1117 + </div>
  1118 + }
  1119 + placeholder="请输入备注"
  1120 + rules={[
  1121 + {
  1122 + max: 120, // 最大长度为120个字符
  1123 + message: '备注不能超过120个字符',
  1124 + },
  1125 + ]}
  1126 + />,
  1127 + <>
  1128 + <ProFormUploadDragger
  1129 + key={'filePaths' + listMeta.index}
  1130 + label="附件"
  1131 + name="filePaths"
  1132 + action="/api/service/order/fileProcess"
  1133 + fieldProps={{
  1134 + headers: {
  1135 + Authorization: localStorage.getItem('token'),
  1136 + },
  1137 + itemFileList,
  1138 + }}
  1139 + />
  1140 + </>,
  1141 + ]}
  1142 + </ProCard>
  1143 + );
  1144 + }}
  1145 + actionRef={actionRef}
  1146 + ></ProFormList>
  1147 + </DrawerForm>
  1148 +
  1149 + {kingdeeCstomerModalVisible && (
  1150 + <KingdeeCustomerModal
  1151 + setVisible={setKingdeeCstomerModalVisible}
  1152 + data={customer}
  1153 + onClose={(customerId: any) => {
  1154 + setKingdeeCstomerModalVisible(false);
  1155 + //回显已经新建好的客户
  1156 + autoFillCustomerContactSelectOptions(customerId);
  1157 + }}
  1158 + />
  1159 + )}
  1160 + </>
1066 1161 );
1067 1162 };
... ...
src/services/definition.ts
... ... @@ -380,6 +380,25 @@ export interface CaptchaMessageVO {
380 380 type?: string;
381 381 }
382 382  
  383 +export interface Contactperson {
  384 + birthday?: string;
  385 + contactAddress?: string;
  386 + contactCityId?: string;
  387 + contactCountryId?: string;
  388 + contactDistrictId?: string;
  389 + contactPerson?: string;
  390 + contactProvinceId?: string;
  391 + email?: string;
  392 + /** @format int32 */
  393 + gender?: number;
  394 + id?: string;
  395 + isDefaultLinkman?: boolean;
  396 + mobile?: string;
  397 + phone?: string;
  398 + qq?: string;
  399 + wechat?: string;
  400 +}
  401 +
383 402 export interface CustomField {
384 403 baseEntityNumber?: string;
385 404 comboItems?: Array<Item>;
... ... @@ -509,6 +528,39 @@ export interface CustomerListResRow {
509 528 remark?: string;
510 529 }
511 530  
  531 +export interface CustomerSaveReq {
  532 + accountOpenAddr?: string;
  533 + addr?: string;
  534 + bank?: string;
  535 + bankAccount?: string;
  536 + cityId?: string;
  537 + clevelId?: string;
  538 + contactPersons?: Array<Contactperson>;
  539 + countryId?: string;
  540 + customField?: {
  541 + [propertyName: string]: string;
  542 + };
  543 + districtId?: string;
  544 + groupId?: string;
  545 + groupNumber?: string;
  546 + id?: string;
  547 + ignoreWarn?: boolean;
  548 + invoiceName?: string;
  549 + /** @format int32 */
  550 + invoiceType?: number;
  551 + mulLabel?: Array<Mullabel>;
  552 + name?: string;
  553 + number?: string;
  554 + provinceId?: string;
  555 + rate?: string;
  556 + remark?: string;
  557 + saleDeptId?: string;
  558 + saleDeptNumber?: string;
  559 + salerId?: string;
  560 + salerNumber?: string;
  561 + taxpayerNo?: string;
  562 +}
  563 +
512 564 export interface DictionaryQueryVO {
513 565 /** @format int32 */
514 566 current?: number;
... ... @@ -1165,6 +1217,13 @@ export interface ResetPwdVO {
1165 1217 userId?: number;
1166 1218 }
1167 1219  
  1220 +export interface SaveReply {
  1221 + idNumberMap?: {
  1222 + [propertyName: string]: string;
  1223 + };
  1224 + ids?: Array<string>;
  1225 +}
  1226 +
1168 1227 export interface ServerResult {
1169 1228 data?: any;
1170 1229 message?: string;
... ...
src/services/request.ts
... ... @@ -28,6 +28,7 @@ import type {
28 28 CustomerDetailDto,
29 29 CustomerDetailRes,
30 30 CustomerListRes,
  31 + CustomerSaveReq,
31 32 DictionaryQueryVO,
32 33 DictionaryVO,
33 34 Dto,
... ... @@ -35,6 +36,7 @@ import type {
35 36 MaterialListReply,
36 37 MaterialMaterialListReq,
37 38 MaterialStockRes,
  39 + ModelAndView,
38 40 OrderAddVO,
39 41 OrderAuditLogQueryVO,
40 42 OrderBaseInfoQueryVO,
... ... @@ -56,6 +58,7 @@ import type {
56 58 QueryMainOrderDto,
57 59 QueryReportFormsDto,
58 60 ResetPwdVO,
  61 + SaveReply,
59 62 ServerResult,
60 63 SysLogQueryVO,
61 64 SystemCustomFieldReq,
... ... @@ -239,9 +242,7 @@ export interface GetErrorResponse {
239 242 * @description
240 243 * OK
241 244 */
242   - 200: {
243   - [propertyName: string]: any;
244   - };
  245 + 200: ModelAndView;
245 246 /**
246 247 * @description
247 248 * Unauthorized
... ... @@ -262,9 +263,9 @@ export interface GetErrorResponse {
262 263 export type GetErrorResponseSuccess = GetErrorResponse[200];
263 264 /**
264 265 * @description
265   - * error
  266 + * errorHtml
266 267 * @tags basic-error-controller
267   - * @produces *
  268 + * @produces text/html
268 269 */
269 270 export const getError = /* #__PURE__ */ (() => {
270 271 const method = 'get';
... ... @@ -288,9 +289,7 @@ export interface PutErrorResponse {
288 289 * @description
289 290 * OK
290 291 */
291   - 200: {
292   - [propertyName: string]: any;
293   - };
  292 + 200: ModelAndView;
294 293 /**
295 294 * @description
296 295 * Created
... ... @@ -316,9 +315,9 @@ export interface PutErrorResponse {
316 315 export type PutErrorResponseSuccess = PutErrorResponse[200];
317 316 /**
318 317 * @description
319   - * error
  318 + * errorHtml
320 319 * @tags basic-error-controller
321   - * @produces *
  320 + * @produces text/html
322 321 * @consumes application/json
323 322 */
324 323 export const putError = /* #__PURE__ */ (() => {
... ... @@ -343,9 +342,7 @@ export interface PostErrorResponse {
343 342 * @description
344 343 * OK
345 344 */
346   - 200: {
347   - [propertyName: string]: any;
348   - };
  345 + 200: ModelAndView;
349 346 /**
350 347 * @description
351 348 * Created
... ... @@ -371,9 +368,9 @@ export interface PostErrorResponse {
371 368 export type PostErrorResponseSuccess = PostErrorResponse[200];
372 369 /**
373 370 * @description
374   - * error
  371 + * errorHtml
375 372 * @tags basic-error-controller
376   - * @produces *
  373 + * @produces text/html
377 374 * @consumes application/json
378 375 */
379 376 export const postError = /* #__PURE__ */ (() => {
... ... @@ -398,9 +395,7 @@ export interface DeleteErrorResponse {
398 395 * @description
399 396 * OK
400 397 */
401   - 200: {
402   - [propertyName: string]: any;
403   - };
  398 + 200: ModelAndView;
404 399 /**
405 400 * @description
406 401 * No Content
... ... @@ -421,9 +416,9 @@ export interface DeleteErrorResponse {
421 416 export type DeleteErrorResponseSuccess = DeleteErrorResponse[200];
422 417 /**
423 418 * @description
424   - * error
  419 + * errorHtml
425 420 * @tags basic-error-controller
426   - * @produces *
  421 + * @produces text/html
427 422 */
428 423 export const deleteError = /* #__PURE__ */ (() => {
429 424 const method = 'delete';
... ... @@ -447,9 +442,7 @@ export interface OptionsErrorResponse {
447 442 * @description
448 443 * OK
449 444 */
450   - 200: {
451   - [propertyName: string]: any;
452   - };
  445 + 200: ModelAndView;
453 446 /**
454 447 * @description
455 448 * No Content
... ... @@ -470,9 +463,9 @@ export interface OptionsErrorResponse {
470 463 export type OptionsErrorResponseSuccess = OptionsErrorResponse[200];
471 464 /**
472 465 * @description
473   - * error
  466 + * errorHtml
474 467 * @tags basic-error-controller
475   - * @produces *
  468 + * @produces text/html
476 469 * @consumes application/json
477 470 */
478 471 export const optionsError = /* #__PURE__ */ (() => {
... ... @@ -497,9 +490,7 @@ export interface HeadErrorResponse {
497 490 * @description
498 491 * OK
499 492 */
500   - 200: {
501   - [propertyName: string]: any;
502   - };
  493 + 200: ModelAndView;
503 494 /**
504 495 * @description
505 496 * No Content
... ... @@ -520,9 +511,9 @@ export interface HeadErrorResponse {
520 511 export type HeadErrorResponseSuccess = HeadErrorResponse[200];
521 512 /**
522 513 * @description
523   - * error
  514 + * errorHtml
524 515 * @tags basic-error-controller
525   - * @produces *
  516 + * @produces text/html
526 517 * @consumes application/json
527 518 */
528 519 export const headError = /* #__PURE__ */ (() => {
... ... @@ -547,9 +538,7 @@ export interface PatchErrorResponse {
547 538 * @description
548 539 * OK
549 540 */
550   - 200: {
551   - [propertyName: string]: any;
552   - };
  541 + 200: ModelAndView;
553 542 /**
554 543 * @description
555 544 * No Content
... ... @@ -570,9 +559,9 @@ export interface PatchErrorResponse {
570 559 export type PatchErrorResponseSuccess = PatchErrorResponse[200];
571 560 /**
572 561 * @description
573   - * error
  562 + * errorHtml
574 563 * @tags basic-error-controller
575   - * @produces *
  564 + * @produces text/html
576 565 * @consumes application/json
577 566 */
578 567 export const patchError = /* #__PURE__ */ (() => {
... ... @@ -733,6 +722,77 @@ export const postKingdeeRepCustomerDetail = /* #__PURE__ */ (() =&gt; {
733 722 return request;
734 723 })();
735 724  
  725 +/** @description request parameter type for postKingdeeRepCustomerSave */
  726 +export interface PostKingdeeRepCustomerSaveOption {
  727 + /**
  728 + * @description
  729 + * req
  730 + */
  731 + body: {
  732 + /**
  733 + @description
  734 + req */
  735 + req: CustomerSaveReq;
  736 + };
  737 +}
  738 +
  739 +/** @description response type for postKingdeeRepCustomerSave */
  740 +export interface PostKingdeeRepCustomerSaveResponse {
  741 + /**
  742 + * @description
  743 + * OK
  744 + */
  745 + 200: SaveReply;
  746 + /**
  747 + * @description
  748 + * Created
  749 + */
  750 + 201: any;
  751 + /**
  752 + * @description
  753 + * Unauthorized
  754 + */
  755 + 401: any;
  756 + /**
  757 + * @description
  758 + * Forbidden
  759 + */
  760 + 403: any;
  761 + /**
  762 + * @description
  763 + * Not Found
  764 + */
  765 + 404: any;
  766 +}
  767 +
  768 +export type PostKingdeeRepCustomerSaveResponseSuccess =
  769 + PostKingdeeRepCustomerSaveResponse[200];
  770 +/**
  771 + * @description
  772 + * getCustomerDetail
  773 + * @tags kingdee-erp-controller
  774 + * @produces *
  775 + * @consumes application/json
  776 + */
  777 +export const postKingdeeRepCustomerSave = /* #__PURE__ */ (() => {
  778 + const method = 'post';
  779 + const url = '/kingdee/rep/customerSave';
  780 + function request(
  781 + option: PostKingdeeRepCustomerSaveOption,
  782 + ): Promise<PostKingdeeRepCustomerSaveResponseSuccess> {
  783 + return requester(request.url, {
  784 + method: request.method,
  785 + ...option,
  786 + }) as unknown as Promise<PostKingdeeRepCustomerSaveResponseSuccess>;
  787 + }
  788 +
  789 + /** http method */
  790 + request.method = method;
  791 + /** request url */
  792 + request.url = url;
  793 + return request;
  794 +})();
  795 +
736 796 /** @description response type for getKingdeeRepGetToken */
737 797 export interface GetKingdeeRepGetTokenResponse {
738 798 /**
... ...
src/utils/kingdee.ts 0 → 100644
  1 +import { postKingdeeRepSystemCustomField } from '@/services';
  2 +
  3 +/**
  4 + * 获取课题组老师的自定义字段id
  5 + * @returns
  6 + */
  7 +export async function getTeacherCustomFieldNumber() {
  8 + let customFiledRes = await postKingdeeRepSystemCustomField({
  9 + data: {
  10 + entity_number: 'bd_customer',
  11 + },
  12 + });
  13 +
  14 + //遍历自定义字段的head,找到名称为"课题组老师"的entity_number
  15 + let entity_number = '';
  16 + customFiledRes?.head?.forEach((item) => {
  17 + if (item.display_name === '课题组老师') {
  18 + entity_number = item.number;
  19 + }
  20 + });
  21 + return entity_number;
  22 +}
... ...