columns.js 19 KB

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