columns.js 17 KB

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