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: "是否有指标", require: true },
  200. attr: { is: "el-select", dictName: "sys_yes_no" },
  201. },
  202. {
  203. item: { key: "contractTarget", title: "合同指标", require: true },
  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 },
  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. },
  335. attr: {
  336. is: "el-popover-select-v2",
  337. valueKey: "name",
  338. referName: "MATERIAL_PARAM",
  339. dataMapping: {
  340. material: "code",
  341. materialName: "name",
  342. puUnit: "unitIdName",
  343. registration: "registrationNo",
  344. specification: "specification",
  345. manufacturer: "manufacturerIdName",
  346. },
  347. },
  348. },
  349. {
  350. item: {
  351. title: "物料编码",
  352. key: "material",
  353. },
  354. attr: {},
  355. },
  356. {
  357. item: {
  358. title: "规格",
  359. key: "specification",
  360. },
  361. attr: {},
  362. },
  363. {
  364. item: {
  365. title: "生产厂家",
  366. key: "manufacturer",
  367. },
  368. attr: {
  369. is: "el-input",
  370. },
  371. },
  372. {
  373. item: { title: "采购单位", key: "puUnit" },
  374. attr: {
  375. is: "el-popover-select-v2",
  376. valueKey: "name",
  377. referName: "UNIT_PARAM",
  378. dataMapping: {
  379. puUnit: "name",
  380. },
  381. },
  382. },
  383. {
  384. item: { title: "税率%", key: "tax" },
  385. attr: {
  386. is: "el-popover-select-v2",
  387. valueKey: "ntaxrate",
  388. referName: "TAX_RATE_PARAM",
  389. dataMapping: {
  390. tax: "ntaxrate",
  391. },
  392. },
  393. },
  394. {
  395. item: { title: "采购数量", key: "qty" },
  396. attr: {
  397. is: "el-input-number",
  398. },
  399. },
  400. {
  401. item: { title: "含税单价", key: "taxPrice" },
  402. attr: {
  403. is: "el-input-number",
  404. precision: CONFIG.precision,
  405. },
  406. },
  407. {
  408. item: { title: "含税金额合计", key: "taxMoney" },
  409. attr: {
  410. formatter: (prop) => {
  411. const { qty = 0, taxPrice = 0 } = prop;
  412. prop.taxMoney = (qty * taxPrice * 1).toFixed(CONFIG.precision);
  413. return prop.taxMoney;
  414. },
  415. },
  416. },
  417. {
  418. item: { title: "无税单价", key: "taxFreePrice" },
  419. attr: {
  420. formatter: (prop) => {
  421. const { tax = 0, taxPrice = 0 } = prop;
  422. prop.taxFreePrice = ((taxPrice / (tax / 100 + 1)) * 1).toFixed(
  423. CONFIG.precision
  424. );
  425. return prop.taxFreePrice;
  426. },
  427. },
  428. },
  429. {
  430. item: { title: "无税金额合计", key: "taxFreeMoney" },
  431. attr: {
  432. formatter: (prop) => {
  433. const { qty = 0, tax = 0, taxPrice = 0 } = prop;
  434. prop.taxFreeMoney = (
  435. qty *
  436. (taxPrice / (tax / 100 + 1)) *
  437. 1
  438. ).toFixed(CONFIG.precision);
  439. return prop.taxFreeMoney;
  440. },
  441. },
  442. },
  443. {
  444. item: { title: "注册证号及备案凭证号", key: "registration" },
  445. attr: {
  446. is: "el-input",
  447. },
  448. },
  449. {
  450. item: { title: "收货客户", key: "customerName" },
  451. attr: {
  452. is: "el-popover-select-v2",
  453. valueKey: "name",
  454. referName: "CUSTOMER_PARAM",
  455. dataMapping: {
  456. customer: "code",
  457. customerName: "name",
  458. },
  459. },
  460. },
  461. ],
  462. },
  463. {
  464. item: { title: "合同条款", key: "contractClauseList" },
  465. attr: {
  466. value: [],
  467. },
  468. TableColumns: [
  469. {
  470. item: { title: "条款编码", key: "code", width: "auto" },
  471. attr: { is: "el-input" },
  472. },
  473. {
  474. item: { title: "条款名称", key: "name", width: "auto" },
  475. attr: { is: "el-input" },
  476. },
  477. {
  478. item: { title: "条款内容", key: "content", width: "auto" },
  479. attr: { is: "el-input" },
  480. },
  481. {
  482. item: { title: "变量序号", key: "variableRowno", width: "auto" },
  483. attr: { is: "el-input" },
  484. },
  485. {
  486. item: { title: "变量内容", key: "variableContent", width: "auto" },
  487. attr: { is: "el-input" },
  488. },
  489. ],
  490. },
  491. {
  492. item: { title: "合同费用", key: "contractExpenseList" },
  493. attr: {
  494. value: [],
  495. },
  496. TableColumns: [
  497. {
  498. item: { title: "费用编码", key: "code", width: "auto" },
  499. attr: { is: "el-input" },
  500. },
  501. {
  502. item: { title: "费用名称", key: "name", width: "auto" },
  503. attr: { is: "el-input" },
  504. },
  505. {
  506. item: { title: "费用金额", key: "money", width: "auto" },
  507. attr: { is: "el-input-number", precision: CONFIG.precision },
  508. },
  509. ],
  510. },
  511. {
  512. item: { title: "付款协议信息", key: "contractAgreementList" },
  513. attr: {
  514. value: [],
  515. },
  516. TableColumns: [
  517. {
  518. item: { title: "付款阶段", key: "satge" },
  519. attr: { is: "el-input-number" },
  520. },
  521. {
  522. item: {
  523. title: "付款起点",
  524. key: "origin",
  525. },
  526. attr: {
  527. is: "el-select",
  528. dictName: "puarchase_contract_origin",
  529. },
  530. },
  531. {
  532. item: { title: "账期天数", key: "paymetDays" },
  533. attr: {
  534. is: "el-input-number",
  535. precision: 2,
  536. },
  537. },
  538. {
  539. item: { title: "付款比例%", key: "ratio" },
  540. attr: {
  541. is: "el-input-number",
  542. precision: CONFIG.precision,
  543. },
  544. },
  545. {
  546. item: { title: "付款金额", key: "money" },
  547. attr: {
  548. is: "el-input-number",
  549. precision: CONFIG.precision,
  550. },
  551. },
  552. {
  553. item: {
  554. title: "是否预付款",
  555. key: "isAdvance",
  556. },
  557. attr: {
  558. is: "el-select",
  559. dictName: "sys_yes_no",
  560. },
  561. },
  562. {
  563. item: {
  564. title: "是否质保金",
  565. key: "isQuality",
  566. },
  567. attr: {
  568. is: "el-select",
  569. dictName: "sys_yes_no",
  570. },
  571. },
  572. {
  573. item: {
  574. title: "结算方式",
  575. key: "paymentMeans",
  576. },
  577. attr: {
  578. is: "el-popover-select-v2",
  579. valueKey: "name",
  580. referName: "BALATYPE_PARAM",
  581. dataMapping: {
  582. paymentMeans: "name",
  583. },
  584. },
  585. },
  586. {
  587. item: {
  588. title: "需进度确认",
  589. key: "schedule",
  590. },
  591. attr: {
  592. is: "el-select",
  593. dictName: "sys_yes_no",
  594. },
  595. },
  596. ],
  597. },
  598. {
  599. item: { title: "合同执行组织范围", key: "contractApplyOrgList" },
  600. attr: { value: [] },
  601. TableColumns: [
  602. {
  603. item: {
  604. title: "组织名称",
  605. key: "orgName",
  606. width: "auto",
  607. },
  608. attr: {
  609. is: "el-popover-select-v2",
  610. valueKey: "name",
  611. referName: "ORG_PARAM",
  612. dataMapping: {
  613. org: "code",
  614. orgName: "name",
  615. },
  616. },
  617. },
  618. { item: { title: "组织编码", key: "org", width: "auto" }, attr: {} },
  619. ],
  620. },
  621. ].map(({item,attr,TableColumns}) =>({
  622. attr,
  623. item,
  624. TableColumns:TableColumns.map(({item, attr}) =>({
  625. attr,
  626. item: { ...item, hidden: true, span: item.span || 6 },
  627. }))
  628. }))
  629. ;
  630. return { TableColumns, TabColumns };
  631. }