columns.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819
  1. import CONFIG from "@/config";
  2. import { iunitprice } from "@/utils/expression";
  3. export default function useColumns() {
  4. const TableColumns = [
  5. {
  6. item: { key: "puOrgName", title: "采购组织", required: true, width: 150 },
  7. attr: {
  8. is: "el-popover-select-v2",
  9. valueKey: "name",
  10. referName: "ORG_PARAM",
  11. dataMapping: {
  12. puOrg: "code",
  13. puOrgName: "name",
  14. },
  15. },
  16. },
  17. {
  18. item: { key: "code", title: "合同编码", width: 150 },
  19. attr: { is: "el-input" },
  20. },
  21. {
  22. item: { key: "lastPuMoney",
  23. title: "年度采购额", width: 100 ,required: true,},
  24. attr: {
  25. is: "el-input-number",
  26. },
  27. },
  28. {
  29. item: { key: "buyerName", title: "采购员", width: 100 },
  30. attr: {
  31. is: "el-popover-select-v2",
  32. valueKey: "name",
  33. referName: "CONTACTS_PARAM",
  34. dataMapping: {
  35. buyer: "code",
  36. buyerName: "name",
  37. puDept: "deptId",
  38. puDeptName: "deptName",
  39. },
  40. },
  41. },
  42. {
  43. item: {
  44. key: "isPartya",
  45. title: "采购是否甲方",
  46. required: true,
  47. width: 100,
  48. },
  49. attr: {
  50. is: "el-select",
  51. dictName: "sys_yes_no",
  52. },
  53. },
  54. {
  55. item: {
  56. key: "contractType",
  57. title: "合同类型",
  58. required: true,
  59. width: 100,
  60. },
  61. attr: { is: "el-select", dictName: "puarchase_contract_contract_type" },
  62. },
  63. {
  64. item: { key: "puMoneyYear", title: "合同总金额", width: 100 ,required: true,},
  65. attr: {
  66. is: "el-input-number",
  67. },
  68. },
  69. {
  70. item: {
  71. key: "puDeptName",
  72. title: "采购部门",
  73. width: 100,
  74. },
  75. attr: {
  76. is: "el-popover-select-v2",
  77. valueKey: "name",
  78. referName: "DEPT_PARAM",
  79. dataMapping: {
  80. puDept: "code",
  81. puDeptName: "name",
  82. },
  83. },
  84. },
  85. {
  86. item: {
  87. key: "supplierName",
  88. title: "供应商",
  89. required: true,
  90. width: 100,
  91. },
  92. attr: {
  93. is: "el-popover-select-v2",
  94. valueKey: "name",
  95. referName: "SUPPLIER_PARAM",
  96. dataMapping: {
  97. supplier: "code",
  98. supplierName: "name",
  99. },
  100. },
  101. },
  102. {
  103. item: {
  104. key: "contractName",
  105. title: "合同名称",
  106. required: true,
  107. width: 100,
  108. },
  109. attr: { is: "el-input" },
  110. },
  111. {
  112. item: {
  113. key: "grossRateAverage",
  114. title: "平均毛利率 (%)",
  115. required: true,
  116. width: 100,
  117. },
  118. attr: {
  119. is: "el-input-number",
  120. precision: 2,
  121. },
  122. },
  123. {
  124. item: {
  125. key: "approveFlow",
  126. title: "审批流程",
  127. required: true,
  128. width: 100,
  129. },
  130. attr: { is: "el-select", dictName: "puarchase_contract_approve_flow" },
  131. },
  132. {
  133. item: {
  134. key: "supplierTier",
  135. title: "供应商层级",
  136. required: true,
  137. width: 100,
  138. },
  139. attr: { is: "el-select", dictName: "puarchase_contract_supplier_tier" },
  140. },
  141. {
  142. item: {
  143. key: "effectiveDate",
  144. title: "合同生效日期",
  145. required: true,
  146. width: 100,
  147. },
  148. attr: {
  149. is: "el-date-picker",
  150. valueFormat: "yyyy-MM-dd",
  151. },
  152. },
  153. {
  154. item: {
  155. key: "brandGrossRate",
  156. title: "同类品牌及毛利率 (%)",
  157. required: true,
  158. },
  159. // attr: {
  160. // is: "el-input-number",
  161. // precision: 2,
  162. // },
  163. attr: { is: "el-input", },
  164. },
  165. {
  166. item: {
  167. key: "contractFormat",
  168. title: "合同格式",
  169. required: true,
  170. width: 100,
  171. },
  172. attr: {
  173. is: "el-select",
  174. dictName: "puarchase_contract_contract_format",
  175. },
  176. },
  177. {
  178. item: {
  179. key: "consumableClass",
  180. title: "耗材类别",
  181. required: true,
  182. width: 100,
  183. },
  184. attr: {
  185. is: "el-select",
  186. dictName: "puarchase_contract_consumable_class",
  187. },
  188. },
  189. {
  190. item: {
  191. key: "endDate",
  192. title: "合同终止日期",
  193. required: true,
  194. width: 100,
  195. },
  196. attr: {
  197. is: "el-date-picker",
  198. valueFormat: "yyyy-MM-dd",
  199. disabled: (prop) => !prop.effectiveDate,
  200. },
  201. },
  202. {
  203. item: {
  204. key: "invoiceTax",
  205. title: "发票税率 (%)",
  206. required: true,
  207. width: 100,
  208. },
  209. attr: {
  210. is: "el-popover-select-v2",
  211. valueKey: "ntaxrate",
  212. referName: "TAX_RATE_PARAM",
  213. dataMapping: {
  214. invoiceTax: "ntaxrate",
  215. },
  216. },
  217. },
  218. {
  219. item: {
  220. key: "emergencyDegree",
  221. title: "紧急程度",
  222. required: true,
  223. width: 100,
  224. },
  225. attr: {
  226. is: "el-select",
  227. dictName: "puarchase_contract_emergency_degree",
  228. },
  229. },
  230. {
  231. item: {
  232. key: "productName",
  233. title: "产品类别&名称",
  234. required: true,
  235. width: 100,
  236. },
  237. attr: { is: "el-input" },
  238. },
  239. {
  240. item: { key: "signDate", title: "合同签订日期", width: 100 ,required: true,},
  241. attr: { is: "el-date-picker", valueFormat: "yyyy-MM-dd" },
  242. },
  243. {
  244. item: {
  245. key: "deliveryType",
  246. title: "交货方式",
  247. required: true,
  248. width: 100,
  249. },
  250. attr: { is: "el-select", dictName: "puarchase_contract_delivery_type" },
  251. },
  252. {
  253. item: { key: "source", title: "合同来源", width: 100 },
  254. attr: { is: "el-input", value: "自制", disabled: true },
  255. },
  256. {
  257. item: { key: "principalManufacturers",
  258. title: "主要厂家", width: 100,
  259. required: true,
  260. },
  261. attr: { is: "el-input", },
  262. },
  263. {
  264. item: {
  265. key: "guaranteePeriodEnd",
  266. title: "质保期限",
  267. required: true,
  268. width: 100,
  269. },
  270. // attr: { is: "el-input-number", precision: 2 },
  271. attr: { is: "el-input", },
  272. },
  273. {
  274. item: { key: "freightMethods",
  275. title: "运费承担方式", width: 100 ,required: true,
  276. },
  277. attr: {
  278. is: "el-select",
  279. dictName: "puarchase_contract_freight_methods",
  280. },
  281. },
  282. {
  283. item: { key: "createTime", title: "合同创建时间", width: 100 },
  284. attr: { is: "el-date-picker", valueFormat: "yyyy-MM-dd",disabled:true,},
  285. },
  286. {
  287. item: { key: "project", title: "项目医院", required: true, width: 100 },
  288. attr: { is: "el-input" },
  289. },
  290. {
  291. item: { key: "contractPartycName", title: "合同丙方", width: 100 },
  292. attr: {
  293. is: "el-popover-select-v2",
  294. valueKey: "name",
  295. referName: "SUPPLIER_PARAM",
  296. dataMapping: {
  297. contractPartyc: "code",
  298. contractPartycName: "name",
  299. },
  300. },
  301. },
  302. {
  303. item: {
  304. key: "exemptionPostageCondtion",
  305. title: "包邮条件",
  306. span: 12,
  307. width: 100,
  308. },
  309. attr: {
  310. is: "el-input",
  311. placeholder:
  312. "当运费承担方式为供应商有条件承担时,该字段必填,填写要求,写明什么条件下供应商承担全部,什么条件下我方承担,什么条件下分别承担",
  313. },
  314. },
  315. {
  316. item: {
  317. key: "isTarget",
  318. title: "是否有指标",
  319. required: true,
  320. width: 100,
  321. },
  322. attr: { is: "el-select", dictName: "sys_yes_no" },
  323. },
  324. {
  325. item: {
  326. key: "contractTarget",
  327. title: "合同指标",
  328. width: 100,
  329. required: (prop) => prop.isTarget === "Y",
  330. },
  331. attr: { is: "el-input", placeholder: '当【是否有指标】="有"时,必填' },
  332. },
  333. // {
  334. // item: { key: "", title: "交易类型", required: true, span: 12,},
  335. // attr: { is: "el-input" },
  336. // },
  337. {
  338. item: {
  339. key: "rollbackPolicy",
  340. title: "退换货政策",
  341. required: true,
  342. span: 12,
  343. },
  344. attr: { is: "el-input" },
  345. },
  346. {
  347. item: {
  348. key: "isRebate",
  349. title: "是否有返利",
  350. required: true,
  351. width: 100,
  352. },
  353. attr: { is: "el-select", dictName: "sys_yes_no" },
  354. },
  355. {
  356. item: {
  357. key: "rebatePolicy",
  358. title: "返利政策",
  359. span: 18,
  360. width: 100,
  361. required: (prop) => prop.isRebate === "Y",
  362. },
  363. attr: {
  364. is: "el-input",
  365. placeholder: '当【是否有返利】="有"时,必填',
  366. },
  367. },
  368. {
  369. item: {
  370. key: "contractContent",
  371. title: "合同主要内容",
  372. required: true,
  373. span: 24,
  374. width: 100,
  375. },
  376. attr: { is: "el-input", type: "textarea",rows:3, },
  377. },
  378. {
  379. item: { key: "enquiryCode", title: "询价单号", width: 100 },
  380. attr: { is: "el-input" },
  381. },
  382. {
  383. item: { key: "electronicContract", title: "电子合同", span: 6, width: 100 },
  384. attr: { is: "el-input" },
  385. },
  386. {
  387. item: { key: "refusalReasons", title: "拒绝理由", span: 6, width: 100 },
  388. attr: { is: "el-input" },
  389. },
  390. {
  391. item: { key: "status", title: "状态" },
  392. attr: {
  393. is: "el-select",
  394. dictName: "documents_status",
  395. disabled: true,
  396. value: "0",
  397. },
  398. },
  399. {
  400. item: { key: "externalFile", title: "附件", span: 12, width: 100 },
  401. attr: { is: "el-file-upload", fileType: ["pdf","doc","docx","png","jpg","xls","xlsx"] },
  402. },
  403. {
  404. item: {
  405. key: "puFile",
  406. title: "盖章合同附件",
  407. span: 12,
  408. width: 100,
  409. },
  410. attr: { is: "el-file-upload", fileType: ["pdf"] },
  411. },
  412. // {
  413. // item: {
  414. // key: "supplierFile",
  415. // title: "供应商盖章合同附件",
  416. // span:12,
  417. // width: 100,
  418. // },
  419. // attr: { is: "el-file-upload", fileType: ["pdf"] },
  420. // },
  421. // {
  422. // item: {
  423. // key: "",
  424. // title: "电子合同供应商附件",
  425. // span: 12,
  426. // width: 100,
  427. // },
  428. // attr: { is: "el-file-upload", fileType: ["pdf"] },
  429. // },
  430. {
  431. item: {
  432. key: "paymentAgreement",
  433. title: "付款协议",
  434. required: true,
  435. width: 100,
  436. },
  437. attr: {
  438. is: "el-popover-select-v2",
  439. valueKey: "name",
  440. referName: "PAYAGREEMENT_PARAM",
  441. dataMapping: {
  442. paymentAgreement: "code",
  443. paymentAgreementName: "name",
  444. },
  445. },
  446. },
  447. {
  448. item: { key: "taxPrice", title: "价税合计", width: 100 },
  449. attr: {
  450. is: "el-input-number",
  451. },
  452. },
  453. {
  454. item: { key: "currencyName", title: "币种", required: true, width: 100 },
  455. attr: {
  456. is: "el-popover-select-v2",
  457. valueKey: "name",
  458. referName: "CURRENCY_PARAM",
  459. dataMapping: {
  460. currency: "code",
  461. currencyName: "name",
  462. },
  463. },
  464. },
  465. {
  466. item: { key: "guaranteePeriod", title: "质保期", width: 100 },
  467. attr: {
  468. is: "el-input-number",
  469. },
  470. },
  471. // {
  472. // item: { key: "externalContract", title: "外部合同号", width: 100 },
  473. // attr: { is: "el-input" },
  474. // },
  475. // {
  476. // item: { key: "projectCode", title: "项目编号", width: 100 },
  477. // attr: { is: "el-input" },
  478. // },
  479. // {
  480. // item: { key: "projectName", title: "项目名称", width: 100 },
  481. // attr: { is: "el-input" },
  482. // },
  483. // { item: { key: "area", title: "区域" }, attr: { is: "el-input" } },
  484. // {
  485. // item: { key: "consigneePhone", title: "收货人联系方式", width: 100 },
  486. // attr: { is: "el-input" },
  487. // },
  488. ].map(({ item, attr }) => ({
  489. attr,
  490. item: { ...item, hidden: true, span: item.span || 6 },
  491. }));
  492. const TabColumns = [
  493. {
  494. item: { title: "物料基本信息", key: "contractItemList" },
  495. attr: { value: [] },
  496. TableColumns: [
  497. {
  498. item: {
  499. title: "物料名称",
  500. key: "materialName",
  501. require: true,
  502. },
  503. attr: {
  504. is: "el-popover-select-v2",
  505. valueKey: "name",
  506. referName: "MATERIAL_PARAM",
  507. dataMapping: {
  508. material: "code",
  509. materialName: "name",
  510. puUnit: "unitIdName",
  511. registration: "registrationNo",
  512. specification: "specification",
  513. manufacturer: "manufacturerIdName",
  514. rateCode: "materialRateName",
  515. },
  516. },
  517. },
  518. {
  519. item: {
  520. title: "物料编码",
  521. key: "material",
  522. },
  523. attr: {},
  524. },
  525. {
  526. item: {
  527. title: "规格",
  528. key: "specification",
  529. },
  530. attr: {},
  531. },
  532. {
  533. item: {
  534. title: "生产厂家",
  535. key: "manufacturer",
  536. },
  537. attr: {
  538. is: "el-input",
  539. },
  540. },
  541. {
  542. item: { title: "采购单位", key: "puUnit" },
  543. attr: {
  544. is: "el-popover-select-v2",
  545. valueKey: "name",
  546. referName: "UNIT_PARAM",
  547. dataMapping: {
  548. puUnit: "name",
  549. },
  550. },
  551. },
  552. {
  553. item: { title: "税率%", key: "tax", require: true },
  554. attr: {
  555. is: "el-popover-select-v2",
  556. valueKey: "ntaxrate",
  557. referName: "TAX_RATE_PARAM",
  558. dataMapping: {
  559. tax: "ntaxrate",
  560. },
  561. },
  562. },
  563. {
  564. item: { title: "采购数量", key: "qty" },
  565. attr: {
  566. is: "el-input-number",
  567. },
  568. },
  569. {
  570. item: { title: "含税单价", key: "taxPrice", require: true },
  571. attr: {
  572. is: "el-input-number",
  573. },
  574. },
  575. {
  576. item: { title: "含税金额合计", key: "taxMoney" },
  577. attr: {
  578. formatter: (prop) => {
  579. const { qty = 0, taxPrice = 0 } = prop;
  580. prop.taxMoney = qty * taxPrice * 1;
  581. return prop.taxMoney;
  582. },
  583. },
  584. },
  585. {
  586. item: { title: "无税单价", key: "taxFreePrice", require: true },
  587. attr: {
  588. formatter: (prop) => {
  589. const { tax = 0, taxPrice = 0 } = prop;
  590. return (prop.taxFreePrice = iunitprice(tax, taxPrice));
  591. },
  592. },
  593. },
  594. {
  595. item: { title: "无税金额合计", key: "taxFreeMoney" },
  596. attr: {
  597. formatter: (prop) => {
  598. const { qty = 0, tax = 0, taxPrice = 0 } = prop;
  599. return (prop.taxFreeMoney = qty * iunitprice(tax, taxPrice));
  600. },
  601. },
  602. },
  603. {
  604. item: { title: "注册证号及备案凭证号", key: "registration" },
  605. attr: {
  606. is: "el-input",
  607. },
  608. },
  609. {
  610. item: { title: "收货客户", key: "customerName" },
  611. attr: {
  612. is: "el-popover-select-v2",
  613. valueKey: "name",
  614. referName: "CUSTOMER_PARAM",
  615. dataMapping: {
  616. customer: "code",
  617. customerName: "name",
  618. },
  619. },
  620. },
  621. ],
  622. },
  623. {
  624. item: { title: "合同条款", key: "contractClauseList" },
  625. attr: {
  626. value: [],
  627. },
  628. TableColumns: [
  629. {
  630. item: { title: "条款编码", key: "code", width: "auto" },
  631. attr: { is: "el-input" },
  632. },
  633. {
  634. item: { title: "条款名称", key: "name", width: "auto" },
  635. attr: { is: "el-input" },
  636. },
  637. {
  638. item: { title: "条款内容", key: "content", width: "auto" },
  639. attr: { is: "el-input" },
  640. },
  641. {
  642. item: { title: "变量序号", key: "variableRowno", width: "auto" },
  643. attr: { is: "el-input" },
  644. },
  645. {
  646. item: { title: "变量内容", key: "variableContent", width: "auto" },
  647. attr: { is: "el-input" },
  648. },
  649. ],
  650. },
  651. {
  652. item: { title: "合同费用", key: "contractExpenseList" },
  653. attr: {
  654. value: [],
  655. },
  656. TableColumns: [
  657. {
  658. item: { title: "费用编码", key: "code", width: "auto" },
  659. attr: { is: "el-input" },
  660. },
  661. {
  662. item: { title: "费用名称", key: "name", width: "auto" },
  663. attr: { is: "el-input" },
  664. },
  665. {
  666. item: { title: "费用金额", key: "money", width: "auto" },
  667. attr: { is: "el-input-number" },
  668. },
  669. ],
  670. },
  671. {
  672. item: { title: "付款协议信息", key: "contractAgreementList" },
  673. attr: {
  674. value: [],
  675. },
  676. TableColumns: [
  677. {
  678. item: { title: "付款阶段", key: "satge" },
  679. attr: { is: "el-input-number" },
  680. },
  681. {
  682. item: {
  683. title: "付款起点",
  684. key: "origin",
  685. require: true,
  686. },
  687. attr: {
  688. is: "el-select",
  689. dictName: "puarchase_contract_origin",
  690. },
  691. },
  692. {
  693. item: { title: "账期天数", key: "paymetDays", require: true },
  694. attr: {
  695. is: "el-input-number",
  696. precision: 2,
  697. },
  698. },
  699. {
  700. item: { title: "付款比例%", key: "ratio", require: true },
  701. attr: {
  702. is: "el-input-number",
  703. },
  704. },
  705. {
  706. item: { title: "付款金额", key: "money" },
  707. attr: {
  708. is: "el-input-number",
  709. },
  710. },
  711. {
  712. item: {
  713. title: "是否预付款",
  714. key: "isAdvance",
  715. },
  716. attr: {
  717. is: "el-select",
  718. dictName: "sys_yes_no",
  719. },
  720. },
  721. {
  722. item: {
  723. title: "是否质保金",
  724. key: "isQuality",
  725. },
  726. attr: {
  727. is: "el-select",
  728. dictName: "sys_yes_no",
  729. },
  730. },
  731. {
  732. item: {
  733. title: "结算方式",
  734. key: "paymentMeans",
  735. require: true,
  736. },
  737. attr: {
  738. is: "el-popover-select-v2",
  739. valueKey: "name",
  740. referName: "BALATYPE_PARAM",
  741. dataMapping: {
  742. paymentMeans: "name",
  743. },
  744. },
  745. },
  746. {
  747. item: {
  748. title: "需进度确认",
  749. key: "schedule",
  750. },
  751. attr: {
  752. is: "el-select",
  753. dictName: "sys_yes_no",
  754. },
  755. },
  756. ],
  757. },
  758. {
  759. item: { title: "合同执行组织范围", key: "contractApplyOrgList" },
  760. attr: { value: [] },
  761. TableColumns: [
  762. {
  763. item: {
  764. title: "组织名称",
  765. key: "orgName",
  766. width: "auto",
  767. },
  768. attr: {
  769. is: "el-popover-select-v2",
  770. valueKey: "name",
  771. referName: "ORG_PARAM",
  772. dataMapping: {
  773. org: "code",
  774. orgName: "name",
  775. },
  776. },
  777. },
  778. { item: { title: "组织编码", key: "org", width: "auto" }, attr: {} },
  779. ],
  780. },
  781. ].map(({ item, attr, TableColumns }) => ({
  782. attr,
  783. item,
  784. TableColumns: TableColumns.map(({ item, attr }) => ({
  785. attr,
  786. item: { ...item, hidden: true },
  787. })),
  788. }));
  789. return { TableColumns, TabColumns };
  790. }