columns.js 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. import CONFIG from "@/config";
  2. export default function useColumns() {
  3. const TableColumns = [
  4. {
  5. item: { key: "priceName", title: "价格名称" },
  6. attr: { is: "el-input", value: "价格申报单" },
  7. },
  8. {
  9. item: { key: "priceCode", title: "价格编码" },
  10. attr: { is: "el-input", disabled: true, readonly: true },
  11. },
  12. {
  13. item: { key: "supplierName", title: "供应商", require: true },
  14. attr: {
  15. is: "el-popover-select-v2",
  16. valueKey: "name",
  17. referName: "SUPPLIER_PARAM",
  18. dataMapping: {
  19. supplier: "id",
  20. supplierCode: "code",
  21. supplierName: "name",
  22. },
  23. },
  24. },
  25. {
  26. item: { key: "puOrgName", title: "采购组织", require: true },
  27. attr: {
  28. is: "el-popover-select-v2",
  29. valueKey: "name",
  30. referName: "ORG_PARAM",
  31. dataMapping: { puOrg: "id", puOrgCode: "code", puOrgName: "name" },
  32. },
  33. },
  34. {
  35. item: { key: "currencyName", title: "币种", require: true },
  36. attr: {
  37. is: "el-popover-select-v2",
  38. valueKey: "name",
  39. referName: "CURRENCY_PARAM",
  40. dataMapping: {
  41. currency: "id",
  42. currencyCode: "code",
  43. currencyName: "name",
  44. },
  45. },
  46. },
  47. {
  48. item: { key: "explainStr", title: "价格合理性说明", require: true },
  49. attr: { is: "el-input" },
  50. },
  51. {
  52. item: { key: "buyerName", title: "采购员", require: true },
  53. attr: {
  54. is: "el-popover-select-v2",
  55. valueKey: "name",
  56. referName: "CONTACTS_PARAM",
  57. dataMapping: { buyer: "code", buyerName: "name" },
  58. },
  59. },
  60. {
  61. item: { key: "puDeptName", title: "采购部门", require: true },
  62. attr: {
  63. is: "el-popover-select-v2",
  64. valueKey: "name",
  65. referName: "DEPT_PARAM",
  66. dataMapping: { puDept: "id", puDeptCode: "code", puDeptName: "name" },
  67. },
  68. },
  69. {
  70. item: { key: "createByName", title: "创建人" },
  71. attr: { is: "el-input", disabled: true, readonly: true },
  72. },
  73. {
  74. item: { key: "source", title: "来源单据号" },
  75. attr: { is: "el-input", disabled: true, readonly: true },
  76. },
  77. {
  78. item: { key: "isEffective", title: "是否已推价格" },
  79. attr: {
  80. is: "el-select",
  81. dictName: "is_effective",
  82. },
  83. },
  84. {
  85. item: { key: "effectiveDate", title: "生效日期" },
  86. attr: { is: "el-input", disabled: true, readonly: true },
  87. },
  88. {
  89. item: { key: "file", title: "附件", require: true, span: 24 },
  90. attr: { is: "el-file-upload" },
  91. },
  92. {
  93. item: { key: "sourceType", title: "来源单据类型" },
  94. attr: { is: "el-input", disabled: true, readonly: true },
  95. },
  96. {
  97. item: { key: "status", title: "单据状态" },
  98. attr: {
  99. is: "el-select",
  100. dictName: "sys_status",
  101. disabled: true,
  102. readonly: true,
  103. value: "0",
  104. },
  105. },
  106. ].map(({ item, attr }) => ({
  107. attr,
  108. item: { ...item, hidden: true, span: item.span || 6 },
  109. }));
  110. const TabColumns = [
  111. {
  112. item: {
  113. title: "物料信息表",
  114. key: "priceApplyItems",
  115. },
  116. attr: {
  117. value: [],
  118. },
  119. TableColumns: [
  120. {
  121. item: { key: "materialName", title: "物料名称", require: true },
  122. attr: {
  123. is: "el-popover-select-v2",
  124. valueKey: "name",
  125. referName: "MATERIAL_PARAM",
  126. dataMapping: {
  127. model: "model",
  128. material: "id",
  129. materialCode: "code",
  130. materialName: "name",
  131. unitName: "unitIdName",
  132. puUnitName: "unitIdName",
  133. specification: "specification",
  134. manufacturer: "manufacturerId",
  135. manufacturerName: "manufacturerIdName",
  136. },
  137. },
  138. },
  139. { item: { key: "materialCode", title: "物料编码" }, attr: {} },
  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: "价格类型" },
  268. attr: {
  269. is: "el-select",
  270. dictName: "sys_price_type",
  271. },
  272. },
  273. {
  274. item: { key: "isDistributionPrice", title: "配送价", require: true },
  275. attr: {
  276. is: "el-select",
  277. dictName: "is_effective",
  278. },
  279. },
  280. { item: { key: "createByName", title: "创建人名称" }, attr: {} },
  281. { item: { key: "updateByName", title: "更新人名称" }, attr: {} },
  282. ],
  283. },
  284. {
  285. item: {
  286. title: "合同执行组织范围",
  287. key: "priceApplyOrgs",
  288. },
  289. attr: {
  290. value: [],
  291. },
  292. TableColumns: [
  293. {
  294. item: { key: "orgName", title: "组织", require: true, width: "auto" },
  295. attr: {
  296. is: "el-popover-select-v2",
  297. valueKey: "name",
  298. referName: "ORG_PARAM",
  299. dataMapping: {
  300. org: "id",
  301. orgCode: "code",
  302. orgName: "name",
  303. },
  304. },
  305. },
  306. {
  307. item: { key: "createByName", title: "创建人名称", width: "auto" },
  308. attr: {},
  309. },
  310. {
  311. item: { key: "updateByName", title: "更新人名称", width: "auto" },
  312. attr: {},
  313. },
  314. ],
  315. },
  316. ];
  317. return { TableColumns, TabColumns };
  318. }