data.config.ts 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820
  1. import { BasicColumn, FormSchema } from '/@/components/Table';
  2. import { requestMagicApi } from '/@/api/magicApi';
  3. import { getDataOption } from '/@/api/system/dic';
  4. import { getSubjectGroupInfo } from '/@/services/apis/SubjectGroupController';
  5. import { getTextbookInfoByissn } from '/@/services/apis/TextbookController';
  6. import { getMajorSetOption } from '/@/api/userMagic';
  7. export const type = {
  8. 0: '菜单',
  9. 1: '目录',
  10. };
  11. export const TableColumns: BasicColumn[] = [
  12. {
  13. title: '书号(ISSN)',
  14. dataIndex: 'issn',
  15. customRender: ({ text }) => {
  16. return text ? text : '/';
  17. },
  18. },
  19. {
  20. title: '书名',
  21. dataIndex: 'bookName',
  22. customRender: ({ text }) => {
  23. return text ? text : '/';
  24. },
  25. },
  26. {
  27. title: '出版社',
  28. dataIndex: 'publishingHouse',
  29. customRender: ({ text }) => {
  30. return text ? text : '/';
  31. },
  32. },
  33. {
  34. title: '作者(主编)',
  35. dataIndex: 'editorInChief',
  36. customRender: ({ text }) => {
  37. return text ? text : '/';
  38. },
  39. },
  40. {
  41. title: '学科组',
  42. dataIndex: 'groupName',
  43. customRender: ({ text }) => {
  44. return text ? text : '/';
  45. },
  46. },
  47. // {
  48. // title: '使用学期',
  49. // dataIndex: 'semesterName',
  50. // customRender: ({ text }) => {
  51. // return text ? text : '/';
  52. // },
  53. // },
  54. // {
  55. // title: '使用班级',
  56. // dataIndex: 'useClass',
  57. // customRender: ({ text }) => {
  58. // return text ? text : '/';
  59. // },
  60. // },
  61. {
  62. title: '对应课程',
  63. dataIndex: 'courseName',
  64. customRender: ({ text }) => {
  65. return text ? text : '/';
  66. },
  67. },
  68. {
  69. title: '规划教材',
  70. dataIndex: 'isTextbookPlanCn',
  71. customRender: ({ text }) => {
  72. return text ? text : '/';
  73. },
  74. },
  75. {
  76. title: '类型',
  77. dataIndex: 'textbookTypeCn',
  78. customRender: ({ text }) => {
  79. return text ? text : '/';
  80. },
  81. },
  82. {
  83. title: '规格型号',
  84. dataIndex: 'specificationsModels',
  85. customRender: ({ text }) => {
  86. return text ? text : '/';
  87. },
  88. },
  89. {
  90. title: '估价(元)',
  91. dataIndex: 'appraisalPrice',
  92. customRender: ({ text }) => {
  93. return text ? text : '/';
  94. },
  95. },
  96. {
  97. title: '定价(元)',
  98. dataIndex: 'price',
  99. customRender: ({ text }) => {
  100. return text ? text : '/';
  101. },
  102. },
  103. {
  104. title: '折扣(折)',
  105. dataIndex: 'discount',
  106. customRender: ({ text }) => {
  107. return text ? text : '/';
  108. },
  109. },
  110. {
  111. title: '小计(元)',
  112. dataIndex: 'subtotal',
  113. customRender: ({ text }) => {
  114. return text ? text : '/';
  115. },
  116. },
  117. {
  118. title: '库存(本、册)',
  119. dataIndex: 'stock',
  120. customRender: ({ text }) => {
  121. return text ? text : '/';
  122. },
  123. },
  124. {
  125. title: '操作',
  126. dataIndex: 'action',
  127. width: 220,
  128. fixed: 'right',
  129. slots: { customRender: 'action' },
  130. },
  131. ];
  132. export const formSchema: FormSchema[] = [
  133. {
  134. field: 'id',
  135. component: 'Input',
  136. label: 'id',
  137. show: false,
  138. },
  139. {
  140. label: '书号',
  141. field: 'issn',
  142. component: 'Input',
  143. componentProps: ({ formModel, formActionType }) => {
  144. return {
  145. onBlur: async (_) => {
  146. if (!formModel.issn) {
  147. return false;
  148. }
  149. const data = await getTextbookInfoByissn({ issn: formModel.issn });
  150. data && formActionType.setFieldsValue(Object.keys(data).length ? data : {});
  151. await formActionType.setFieldsValue({
  152. classId: data.textbookClassRelationList.map((item) => item.classId),
  153. });
  154. },
  155. };
  156. },
  157. required: true,
  158. colProps: { span: 12 },
  159. },
  160. {
  161. label: '书名',
  162. field: 'bookName',
  163. component: 'Input',
  164. required: true,
  165. colProps: { span: 12 },
  166. },
  167. {
  168. label: '类型',
  169. field: 'textbookType',
  170. component: 'ApiSelect',
  171. componentProps: {
  172. api: getDataOption,
  173. params: { code: 'textbook_type' },
  174. },
  175. required: true,
  176. colProps: { span: 12 },
  177. },
  178. {
  179. label: '出版社名称',
  180. field: 'publishingHouse',
  181. component: 'Input',
  182. required: true,
  183. colProps: { span: 12 },
  184. },
  185. {
  186. label: '作者(主编)',
  187. field: 'editorInChief',
  188. component: 'Input',
  189. required: true,
  190. colProps: { span: 12 },
  191. },
  192. {
  193. label: '规划教材',
  194. field: 'isTextbookPlan',
  195. component: 'ApiSelect',
  196. componentProps: {
  197. api: getDataOption,
  198. params: { code: 'judgment_method_1' },
  199. },
  200. required: true,
  201. colProps: { span: 12 },
  202. },
  203. {
  204. label: '定价(元)',
  205. field: 'price',
  206. component: 'InputNumber',
  207. defaultValue: 0,
  208. required: true,
  209. componentProps: ({ formModel }) => {
  210. return {
  211. min: 0,
  212. onChange: (e) => {
  213. if (e !== 0) {
  214. formModel.discount = ((formModel.subtotal / e) * 10).toFixed(1);
  215. } else {
  216. formModel.discount = 0;
  217. }
  218. },
  219. };
  220. },
  221. colProps: { span: 12 },
  222. },
  223. {
  224. label: '估价(元)',
  225. field: 'appraisalPrice',
  226. component: 'InputNumber',
  227. componentProps: {
  228. min: 0,
  229. },
  230. colProps: { span: 12 },
  231. },
  232. {
  233. label: '使用类型',
  234. field: 'useType',
  235. component: 'Select',
  236. required: true,
  237. componentProps: {
  238. options: [
  239. { label: '一学期', value: 1 },
  240. { label: '二学期', value: 2 },
  241. { label: '三学期', value: 3 },
  242. { label: '四学期', value: 4 },
  243. { label: '五学期', value: 5 },
  244. { label: '六学期', value: 6 },
  245. ],
  246. },
  247. colProps: { span: 12 },
  248. },
  249. {
  250. field: 'subtotal',
  251. label: '小计(元)',
  252. component: 'InputNumber',
  253. defaultValue: 0,
  254. required: true,
  255. colProps: { span: 12 },
  256. componentProps: ({ formModel }) => {
  257. return {
  258. min: 0,
  259. onChange: (e) => {
  260. if (!e) {
  261. return false;
  262. }
  263. if (formModel.price !== 0) {
  264. formModel.discount = ((e / formModel.price) * 10).toFixed(1);
  265. } else {
  266. formModel.discount = 0;
  267. }
  268. },
  269. };
  270. },
  271. },
  272. {
  273. label: '折扣(折)',
  274. field: 'discount',
  275. component: 'InputNumber',
  276. componentProps: ({ formModel }) => {
  277. return {
  278. onChange: (e) => {
  279. if (e < 1) {
  280. e = 1;
  281. }
  282. if (e > 10) {
  283. e = 10;
  284. }
  285. if (formModel.price && formModel.subtotal) {
  286. formModel.subtotal = (formModel.price * e).toFixed(2);
  287. }
  288. },
  289. };
  290. },
  291. dynamicDisabled: true,
  292. colProps: { span: 12 },
  293. },
  294. {
  295. label: '学科组',
  296. field: 'subjectGroupId',
  297. component: 'ApiSelect',
  298. required: true,
  299. ifShow: ({ values }) => {
  300. return values.textbookType == 't_textbook';
  301. },
  302. componentProps: {
  303. api: requestMagicApi,
  304. params: { url: '/educational/subjectGroup/list' },
  305. },
  306. colProps: { span: 12 },
  307. },
  308. {
  309. label: '对应课程',
  310. field: 'courseSubjectId',
  311. required: true,
  312. component: 'ApiSelect',
  313. ifShow: ({ values }) => {
  314. return values.textbookType == 't_textbook';
  315. },
  316. componentProps: ({ formModel }) => {
  317. return {
  318. api: async () => {
  319. if (!formModel.subjectGroupId) {
  320. return [];
  321. }
  322. const data = await getSubjectGroupInfo({ id: formModel.subjectGroupId });
  323. return data.subjectGroupCourseList.map((item) => {
  324. return {
  325. label: item.courseSubjectIdCN,
  326. value: item.courseSubjectId,
  327. };
  328. });
  329. },
  330. showSearch: true,
  331. // 搜索参考
  332. filterOption: (input, option) => {
  333. return (
  334. option?.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 ||
  335. option?.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
  336. );
  337. },
  338. };
  339. },
  340. colProps: { span: 12 },
  341. },
  342. // {
  343. // label: '使用年级',
  344. // field: 'gradeId',
  345. // component: 'ApiSelect',
  346. // componentProps: {
  347. // api: requestMagicApi,
  348. // params: { url: '/baseData/grade/option' },
  349. // },
  350. // colProps: { span: 12 },
  351. // },
  352. // {
  353. // label: '使用班级',
  354. // field: 'classId',
  355. // required: true,
  356. // component: 'ApiSelect',
  357. // componentProps: ({ formModel }) => {
  358. // return {
  359. // api: requestMagicApi,
  360. // params: {
  361. // url: `educational/class/gradeid?grade_id=${formModel.gradeId ? formModel.gradeId : ''}`,
  362. // },
  363. // showSearch: true,
  364. // mode: 'multiple',
  365. // // 搜索参考
  366. // filterOption: (input, option) => {
  367. // return (
  368. // option?.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 ||
  369. // option?.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
  370. // );
  371. // },
  372. // };
  373. // },
  374. // colProps: { span: 12 },
  375. // },
  376. // {
  377. // label: '使用学期',
  378. // field: 'baseSemesterId',
  379. // component: 'ApiSelect',
  380. // required: true,
  381. // componentProps: {
  382. // api: requestMagicApi,
  383. // params: { url: 'baseData/semester/option' },
  384. // },
  385. // colProps: { span: 12 },
  386. // },
  387. ];
  388. export const searchFormSchema: FormSchema[] = [
  389. {
  390. label: '教材类型',
  391. field: 'textbookType',
  392. component: 'ApiSelect',
  393. componentProps: {
  394. getPopupContainer: () => document.body,
  395. api: getDataOption,
  396. params: { code: 'textbook_type' },
  397. },
  398. colProps: { span: 6 },
  399. },
  400. {
  401. label: '学期',
  402. field: 'baseSemesterId',
  403. component: 'ApiSelect',
  404. componentProps: {
  405. getPopupContainer: () => document.body,
  406. api: requestMagicApi,
  407. params: { url: 'baseData/semester/option' },
  408. },
  409. colProps: { span: 6 },
  410. },
  411. {
  412. label: '学科组',
  413. field: 'subjectGroupId',
  414. component: 'ApiSelect',
  415. componentProps: {
  416. getPopupContainer: () => document.body,
  417. api: requestMagicApi,
  418. params: { url: '/educational/subjectGroup/list' },
  419. },
  420. colProps: { span: 6 },
  421. },
  422. {
  423. label: '书号',
  424. field: 'issn',
  425. component: 'Input',
  426. colProps: { span: 6 },
  427. },
  428. {
  429. label: '书名',
  430. field: 'bookName',
  431. component: 'Input',
  432. colProps: { span: 6 },
  433. },
  434. // {
  435. // label: '出版社名称',
  436. // field: 'publishingHouse',
  437. // component: 'Input',
  438. // colProps: { span: 6 },
  439. // },
  440. {
  441. field: 'majorSetId',
  442. label: '专业方向',
  443. component: 'ApiSelect',
  444. componentProps: ({}) => {
  445. return {
  446. getPopupContainer: () => document.body,
  447. api: getMajorSetOption,
  448. };
  449. },
  450. colProps: { span: 6 },
  451. },
  452. // {
  453. // label: '作者(主编)',
  454. // field: 'editorInChief',
  455. // component: 'Input',
  456. // colProps: { span: 6 },
  457. // },
  458. {
  459. label: '规划教材',
  460. field: 'isTextbookPlan',
  461. component: 'ApiSelect',
  462. componentProps: {
  463. getPopupContainer: () => document.body,
  464. api: getDataOption,
  465. params: { code: 'judgment_method_1' },
  466. },
  467. colProps: { span: 6 },
  468. },
  469. {
  470. label: '对应课程',
  471. field: 'courseSubjectId',
  472. component: 'ApiSelect',
  473. componentProps: ({ formModel }) => {
  474. return {
  475. getPopupContainer: () => document.body,
  476. api: async () => {
  477. if (!formModel.subjectGroupId) {
  478. return [];
  479. }
  480. const data = await getSubjectGroupInfo({ id: formModel.subjectGroupId });
  481. return data.subjectGroupCourseList.map((item) => {
  482. return {
  483. label: item.courseSubjectIdCN,
  484. value: item.courseSubjectId,
  485. };
  486. });
  487. },
  488. showSearch: true,
  489. // 搜索参考
  490. filterOption: (input, option) => {
  491. return (
  492. option?.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 ||
  493. option?.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
  494. );
  495. },
  496. };
  497. },
  498. colProps: { span: 6 },
  499. },
  500. // {
  501. // label: '使用年级',
  502. // field: 'gradeId',
  503. // component: 'ApiSelect',
  504. // componentProps: {
  505. // getPopupContainer: () => document.body,
  506. // api: requestMagicApi,
  507. // params: { url: '/baseData/grade/option' },
  508. // },
  509. // colProps: { span: 6 },
  510. // },
  511. // {
  512. // label: '使用班级',
  513. // field: 'classId',
  514. // component: 'ApiSelect',
  515. // componentProps: ({ formModel }) => {
  516. // return {
  517. // getPopupContainer: () => document.body,
  518. // api: requestMagicApi,
  519. // params: { url: `educational/class/gradeid?grade_id=${formModel.gradeId}` },
  520. // showSearch: true,
  521. // mode: 'multiple',
  522. // // 搜索参考
  523. // filterOption: (input, option) => {
  524. // return (
  525. // option?.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 ||
  526. // option?.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
  527. // );
  528. // },
  529. // };
  530. // },
  531. // colProps: { span: 6 },
  532. // },
  533. ];
  534. export const pushFormSchema: FormSchema[] = [
  535. {
  536. field: 'textbookId',
  537. component: 'Input',
  538. label: '教材管理编号',
  539. show: false,
  540. },
  541. {
  542. field: 'issn',
  543. label: '书号',
  544. component: 'Input',
  545. dynamicDisabled: true,
  546. colProps: { span: 24 },
  547. },
  548. {
  549. field: 'bookName',
  550. label: '书名',
  551. component: 'Input',
  552. required: true,
  553. dynamicDisabled: true,
  554. colProps: { span: 24 },
  555. },
  556. {
  557. field: 'stock',
  558. label: '库存',
  559. component: 'Input',
  560. defaultValue: 0,
  561. dynamicDisabled: true,
  562. colProps: { span: 24 },
  563. },
  564. {
  565. field: 'warehouseNumber',
  566. label: '入库数量',
  567. component: 'InputNumber',
  568. componentProps: ({ formModel }) => {
  569. return {
  570. min: 0,
  571. onChange: (e) => {
  572. if (!e || !formModel.price) {
  573. formModel.totalPrice = undefined;
  574. return false;
  575. }
  576. formModel.totalPrice = (
  577. e *
  578. formModel.price *
  579. (formModel.discount ? formModel.discount / 10 : 1)
  580. ).toFixed(2);
  581. },
  582. };
  583. },
  584. required: true,
  585. colProps: { span: 24 },
  586. },
  587. {
  588. field: 'source',
  589. label: '来源',
  590. component: 'Input',
  591. required: true,
  592. colProps: { span: 24 },
  593. },
  594. {
  595. field: 'price',
  596. label: '单价',
  597. component: 'InputNumber',
  598. required: true,
  599. componentProps: ({ formModel }) => {
  600. return {
  601. min: 0,
  602. onChange: (e) => {
  603. if (!e || !formModel.warehouseNumber) {
  604. formModel.totalPrice = undefined;
  605. return false;
  606. }
  607. formModel.totalPrice = (
  608. e *
  609. formModel.warehouseNumber *
  610. (formModel.discount ? formModel.discount / 10 : 1)
  611. ).toFixed(2);
  612. },
  613. };
  614. },
  615. colProps: { span: 24 },
  616. },
  617. {
  618. label: '折扣(折)',
  619. field: 'discount',
  620. component: 'InputNumber',
  621. colProps: { span: 24 },
  622. componentProps: ({ formModel }) => {
  623. return {
  624. onChange: (e) => {
  625. if (e < 1) {
  626. e = 1;
  627. }
  628. if (e > 10) {
  629. e = 10;
  630. }
  631. if (!e || !formModel.warehouseNumber || !formModel.price) {
  632. formModel.totalPrice = undefined;
  633. return false;
  634. }
  635. formModel.totalPrice = (
  636. formModel.price *
  637. formModel.warehouseNumber *
  638. (e ? e / 10 : 1)
  639. ).toFixed(2);
  640. },
  641. };
  642. },
  643. },
  644. {
  645. field: 'totalPrice',
  646. label: '总价(元)',
  647. component: 'InputNumber',
  648. componentProps: {
  649. min: 0,
  650. },
  651. required: true,
  652. colProps: { span: 24 },
  653. },
  654. ];
  655. export const infoEumns = {
  656. issn: '书号',
  657. bookName: '书名',
  658. textbookTypeCn: '类型',
  659. publishingHouse: '出版社',
  660. editorInChief: '作者(主编)',
  661. isTextbookPlanCn: '是否为规划教材',
  662. price: '定价(元)',
  663. appraisalPrice: '估价(元)',
  664. discount: '折扣(折)',
  665. stock: '库存',
  666. };
  667. export const textbookInfoEumns = {
  668. groupName: '对应学科组',
  669. courseName: '对应课程',
  670. useGrade: '使用年级',
  671. useClass: '使用班级',
  672. };
  673. export const SubscriptionsColumns: BasicColumn[] = [
  674. {
  675. title: '征订时间',
  676. dataIndex: 'createDate',
  677. },
  678. {
  679. title: '征订人',
  680. dataIndex: 'applicantUser',
  681. },
  682. {
  683. title: '书号(ISSN)',
  684. dataIndex: 'issn',
  685. },
  686. {
  687. title: '书名',
  688. dataIndex: 'bookName',
  689. },
  690. {
  691. title: '出版社',
  692. dataIndex: 'publishingHouse',
  693. },
  694. {
  695. title: '作者(主编)',
  696. dataIndex: 'editorInChief',
  697. },
  698. {
  699. title: '学科组',
  700. dataIndex: 'subjectGroupIdCN',
  701. },
  702. {
  703. title: '使用年级',
  704. dataIndex: 'gradeName',
  705. },
  706. {
  707. title: '使用班级',
  708. dataIndex: 'useClass',
  709. },
  710. {
  711. title: '对应课程',
  712. dataIndex: 'courseName',
  713. },
  714. {
  715. title: '规划教材',
  716. dataIndex: 'isTextbookPlanCn',
  717. },
  718. {
  719. title: '估价(元)',
  720. dataIndex: 'appraisalPrice',
  721. },
  722. {
  723. title: '学生用书征订数量',
  724. dataIndex: 'studentSubscriptionNumber',
  725. },
  726. {
  727. title: '教师教材用书征订数量',
  728. dataIndex: 'teacherSubscriptionNumber',
  729. },
  730. {
  731. title: '教师教参用书征订数量',
  732. dataIndex: 'teacherReferenceNumber',
  733. },
  734. {
  735. title: '有无配套资源',
  736. dataIndex: 'isSupportResourcesCn',
  737. },
  738. ];
  739. export const pushListColumns: BasicColumn[] = [
  740. {
  741. title: '入库时间',
  742. dataIndex: 'warehouseDate',
  743. },
  744. {
  745. title: '入库数量',
  746. dataIndex: 'warehouseNumber',
  747. },
  748. {
  749. title: '入库人员',
  750. dataIndex: 'warehouseUser',
  751. },
  752. {
  753. title: '来源',
  754. dataIndex: 'source',
  755. customRender: ({ text }) => {
  756. return text ? text : '/';
  757. },
  758. },
  759. ];
  760. export const popListColumns: BasicColumn[] = [
  761. {
  762. title: '出库时间',
  763. dataIndex: 'issueDate',
  764. },
  765. {
  766. title: '出库数量',
  767. dataIndex: 'issueNumber',
  768. },
  769. {
  770. title: '出库方式',
  771. dataIndex: 'issueMode',
  772. },
  773. {
  774. title: '出库人员',
  775. dataIndex: 'issueUser',
  776. },
  777. {
  778. title: '去处',
  779. dataIndex: 'remark',
  780. customRender: ({ text }) => {
  781. return text ? text : '/';
  782. },
  783. },
  784. ];
  785. export const receiveColumns: BasicColumn[] = [
  786. {
  787. title: '领取时间',
  788. dataIndex: 'claimDate',
  789. },
  790. {
  791. title: '领取人身份',
  792. dataIndex: 'claimIdentity',
  793. },
  794. {
  795. title: '班级',
  796. dataIndex: 'className',
  797. },
  798. {
  799. title: '领取人员',
  800. dataIndex: 'name',
  801. },
  802. {
  803. title: '学期',
  804. dataIndex: 'semesterName',
  805. },
  806. {
  807. title: '学号/工号',
  808. dataIndex: 'userName',
  809. },
  810. ];