columns.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. import CONFIG from "@/config";
  2. export default function useColumns() {
  3. const TableColumns = [
  4. {
  5. item: { key: "priceCode", title: "价格编码" },
  6. attr: { is: "el-input", disabled: true, readonly: true },
  7. },
  8. {
  9. item: { key: "supplierName", title: "供应商", require: true },
  10. attr: {
  11. is: "el-popover-select-v2",
  12. valueKey: "name",
  13. referName: "SUPPLIER_PARAM",
  14. dataMapping: {
  15. supplier: "id",
  16. supplierCode: "code",
  17. supplierName: "name",
  18. },
  19. },
  20. },
  21. {
  22. item: { key: "puOrgName", title: "采购组织", require: true },
  23. attr: {
  24. is: "el-popover-select-v2",
  25. valueKey: "name",
  26. referName: "ORG_PARAM",
  27. dataMapping: { puOrg: "id", puOrgCode: "code", puOrgName: "name" },
  28. },
  29. },
  30. {
  31. item: { key: "currencyName", title: "币种", require: true },
  32. attr: {
  33. is: "el-popover-select-v2",
  34. valueKey: "name",
  35. referName: "CURRENCY_PARAM",
  36. dataMapping: {
  37. currency: "id",
  38. currencyCode: "code",
  39. currencyName: "name",
  40. },
  41. },
  42. },
  43. {
  44. item: { key: "explainStr", title: "价格合理性说明", require: true },
  45. attr: { is: "el-input" },
  46. },
  47. {
  48. item: { key: "buyerName", title: "采购员", require: true },
  49. attr: {
  50. is: "el-popover-select-v2",
  51. valueKey: "name",
  52. referName: "CONTACTS_PARAM",
  53. dataMapping: { buyer: "code", buyerName: "name" },
  54. },
  55. },
  56. {
  57. item: { key: "puDeptName", title: "采购部门", require: true },
  58. attr: {
  59. is: "el-popover-select-v2",
  60. valueKey: "name",
  61. referName: "DEPT_PARAM",
  62. dataMapping: { puDept: "id", puDeptCode: "code", puDeptName: "name" },
  63. },
  64. },
  65. {
  66. item: { key: "createByName", title: "创建人" },
  67. attr: { is: "el-input", disabled: true, readonly: true },
  68. },
  69. {
  70. item: { key: "source", title: "来源单据号" },
  71. attr: { is: "el-input", disabled: true, readonly: true },
  72. },
  73. {
  74. item: { key: "isEffective", title: "是否已推价格" },
  75. attr: {
  76. is: "el-select",
  77. dictName: "is_effective",
  78. value: "N",
  79. },
  80. },
  81. {
  82. item: { key: "effectiveDate", title: "生效日期" },
  83. attr: { is: "el-input", disabled: true, readonly: true },
  84. },
  85. {
  86. item: { key: "file", title: "附件", require: true, span: 24 },
  87. attr: { is: "el-file-upload" },
  88. },
  89. {
  90. item: { key: "sourceType", title: "来源单据类型" },
  91. attr: { is: "el-input", disabled: true, readonly: true },
  92. },
  93. {
  94. item: { key: "status", title: "单据状态" },
  95. attr: {
  96. is: "el-select",
  97. dictName: "sys_status",
  98. disabled: true,
  99. readonly: true,
  100. value: "0",
  101. },
  102. },
  103. ].map(({ item, attr }) => ({
  104. attr,
  105. item: { ...item, hidden: true, span: item.span || 6 },
  106. }));
  107. const TabColumns = [
  108. {
  109. item: {
  110. title: "物料信息表",
  111. key: "priceApplyItems",
  112. },
  113. attr: {
  114. value: [],
  115. },
  116. TableColumns: [
  117. {
  118. item: { key: "materialName", title: "物料名称", require: true },
  119. attr: {
  120. is: "el-popover-select-v2",
  121. valueKey: "name",
  122. referName: "MATERIAL_PARAM",
  123. dataMapping: {
  124. model: "model",
  125. material: "id",
  126. materialCode: "code",
  127. materialName: "name",
  128. unitName: "unitIdName",
  129. puUnitName: "unitIdName",
  130. specification: "specification",
  131. manufacturer: "manufacturerId",
  132. manufacturerName: "manufacturerIdName",
  133. },
  134. },
  135. },
  136. {
  137. item: { key: "materialCode", title: "物料编码", require: true },
  138. attr: {},
  139. },
  140. { item: { key: "manufacturerName", title: "生产厂家" }, attr: {} },
  141. { item: { key: "specification", title: "规格" }, attr: {} },
  142. { item: { key: "model", title: "型号" }, attr: {} },
  143. {
  144. item: { key: "unitName", title: "单位" },
  145. attr: {
  146. is: "el-popover-select-v2",
  147. valueKey: "name",
  148. referName: "UNIT_PARAM",
  149. dataMapping: { unit: "id", unitCode: "code", unitName: "name" },
  150. },
  151. },
  152. {
  153. item: { key: "puUnitName", title: "采购单位" },
  154. attr: {
  155. is: "el-popover-select-v2",
  156. valueKey: "name",
  157. referName: "UNIT_PARAM",
  158. dataMapping: {
  159. puUnit: "id",
  160. puUnitCode: "code",
  161. puUnitName: "name",
  162. },
  163. },
  164. },
  165. {
  166. item: { key: "conversionRate", title: "采购换算率", require: true },
  167. attr: {
  168. is: "el-input-number",
  169. precision: CONFIG.precision,
  170. },
  171. },
  172. {
  173. item: { key: "tax", title: "税率%", require: true },
  174. attr: {
  175. is: "el-popover-select-v2",
  176. valueKey: "ntaxrate",
  177. referName: "TAX_RATE_PARAM",
  178. dataMapping: { tax: "ntaxrate" },
  179. },
  180. },
  181. {
  182. item: { key: "taxPrice", title: "含税单价", require: true },
  183. attr: {
  184. is: "el-input-number",
  185. precision: CONFIG.precision,
  186. },
  187. },
  188. {
  189. item: { key: "price", title: "无税单价", require: true },
  190. attr: {
  191. formatter: (prop) => {
  192. const { tax = 0, taxPrice = 0 } = prop;
  193. prop.price = ((taxPrice / (tax / 100 + 1)) * 1).toFixed(
  194. CONFIG.precision
  195. );
  196. return prop.price;
  197. },
  198. },
  199. },
  200. {
  201. item: { key: "currencyName", title: "币种" },
  202. attr: {
  203. is: "el-popover-select-v2",
  204. valueKey: "name",
  205. referName: "CURRENCY_PARAM",
  206. dataMapping: {
  207. currency: "id",
  208. currencyCode: "code",
  209. currencyName: "name",
  210. },
  211. },
  212. },
  213. {
  214. item: {
  215. key: "periodBegin",
  216. title: "价格有效期(起)",
  217. require: true,
  218. },
  219. attr: {
  220. is: "el-date-picker",
  221. valueFormat: "yyyy-MM-dd",
  222. value: new Date(),
  223. },
  224. },
  225. {
  226. item: { key: "periodEnd", title: "价格有效期(止)", require: true },
  227. attr: {
  228. is: "el-date-picker",
  229. valueFormat: "yyyy-MM-dd",
  230. pickerOptions: {
  231. disabledDate(time) {
  232. return time.getTime() < Date.now() + 3600 * 1000 * 24 * 365;
  233. },
  234. },
  235. value: new Date(new Date().getTime() + 3600 * 1000 * 24 * 366),
  236. },
  237. },
  238. {
  239. item: { key: "customerName", title: "客户" },
  240. attr: {
  241. is: "el-popover-select-v2",
  242. valueKey: "name",
  243. referName: "CUSTOMER_PARAM",
  244. dataMapping: {
  245. customer: "id",
  246. customerCode: "code",
  247. customerName: "name",
  248. },
  249. },
  250. },
  251. { item: { key: "recentlyPrice", title: "最近价格" }, attr: {} },
  252. {
  253. item: { key: "isApprovalFirst", title: "首次报批" },
  254. attr: {
  255. is: "el-select",
  256. dictName: "is_effective",
  257. },
  258. },
  259. {
  260. item: { key: "isPriceAdjustment", title: "价格调整" },
  261. attr: {
  262. is: "el-select",
  263. dictName: "is_effective",
  264. },
  265. },
  266. {
  267. item: { key: "priceType", title: "价格类型", require: true },
  268. attr: {
  269. is: "el-select",
  270. dictName: "sys_price_type",
  271. value: "order",
  272. },
  273. },
  274. {
  275. item: { key: "isDistributionPrice", title: "配送价", require: true },
  276. attr: {
  277. is: "el-select",
  278. dictName: "is_effective",
  279. value: "N",
  280. },
  281. },
  282. {
  283. item: { width:100,key: "isChannel", title: "是否渠道变更" },
  284. attr: {
  285. is: "el-select",
  286. dictName: "is_effective",
  287. value: "N",
  288. },
  289. },
  290. {
  291. item: { width:100,key: "brandReplacement", title: "是否品牌替换" },
  292. attr: {
  293. is: "el-select",
  294. dictName: "is_effective",
  295. value: "N",
  296. },
  297. },{
  298. item: { width:100,key: "priceDiffer", title: "单价差" },
  299. attr: {
  300. is: "el-computed-input-v2",
  301. formatter: (prop) => {
  302. return prop == null ? 0 :(prop * 1).toFixed(CONFIG.precision);
  303. },
  304. },
  305. },
  306. {
  307. item: { width:100,key: "increase", title: "涨幅" },
  308. attr: {
  309. is: "el-computed-input-v2",
  310. formatter: (prop) => {
  311. return prop == null ? 0 :(prop * 1).toFixed(CONFIG.precision);
  312. },
  313. },
  314. },
  315. {
  316. item: { width:100,key: "yPurchaseQuantity", title: "预计年采购量" },
  317. attr: {
  318. is: "el-computed-input-v2",
  319. formatter: (prop) => {
  320. return prop == null ? 0 :(prop * 1).toFixed(CONFIG.precision);
  321. },
  322. },
  323. },
  324. {
  325. item: { width:100,key: "yAffectedAmount", title: "预计年影响量" },
  326. attr: {
  327. is: "el-computed-input-v2",
  328. formatter: (prop) => {
  329. return prop == null ? 0 :(prop * 1).toFixed(CONFIG.precision);
  330. },
  331. },
  332. },
  333. {
  334. item: { width:150,key: "supplierName", title: "供应商名称" },
  335. attr: {is: "el-input"},
  336. },{
  337. item: { width:150,key: "bidPrice", title: "中标价" },
  338. attr: {
  339. is: "el-input-number",
  340. precision: CONFIG.precision,
  341. },
  342. },{
  343. item: { width:150,key: "unitPrice", title: "单价" },
  344. attr: {
  345. is: "el-input-number",
  346. precision: CONFIG.precision,
  347. },
  348. },{
  349. item: { width:150,key: "profit", title: "利润比" },
  350. attr: {
  351. is: "el-input-number",
  352. precision: CONFIG.precision,
  353. },
  354. },
  355. {
  356. item: { width:150,key: "supplierName1", title: "供应商名称1" },
  357. attr: {is: "el-input"},
  358. },{
  359. item: { width:150,key: "bidPrice1", title: "中标价1" },
  360. attr: {
  361. is: "el-input-number",
  362. precision: CONFIG.precision,
  363. },
  364. },{
  365. item: { width:150,key: "unitPrice1", title: "单价1" },
  366. attr: {
  367. is: "el-input-number",
  368. precision: CONFIG.precision,
  369. },
  370. },{
  371. item: { width:150,key: "profit1", title: "利润比1" },
  372. attr: {
  373. is: "el-input-number",
  374. precision: CONFIG.precision,
  375. },
  376. },
  377. {
  378. item: { width:150,key: "supplierName2", title: "供应商名称2" },
  379. attr: {is: "el-input"},
  380. },{
  381. item: { width:150,key: "bidPrice2", title: "中标价2" },
  382. attr: {
  383. is: "el-input-number",
  384. precision: CONFIG.precision,
  385. },
  386. },{
  387. item: { width:150,key: "unitPrice2", title: "单价2" },
  388. attr: {
  389. is: "el-input-number",
  390. precision: CONFIG.precision,
  391. },
  392. },{
  393. item: { width:150,key: "profit2", title: "利润比2" },
  394. attr: {
  395. is: "el-input-number",
  396. precision: CONFIG.precision,
  397. },
  398. },
  399. { item: { key: "createByName", title: "创建人名称" }, attr: {} },
  400. { item: { key: "updateByName", title: "更新人名称" }, attr: {} },
  401. ],
  402. },
  403. ];
  404. return { TableColumns, TabColumns };
  405. }