columns.js 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. export default function useColumns() {
  2. const TableColumns = [
  3. {
  4. item: { key: "status", title: "状态" ,width :100},
  5. attr: {
  6. is: "el-dict-tag",
  7. dictName: "purchase_task_status",
  8. },
  9. },
  10. {
  11. item: { key: "existPrice", title: "是否有价格",width :100 },
  12. attr: { is: "el-dict-tag", dictName: "sys_true_false" },
  13. },
  14. {
  15. item: { key: "materialCode", title: "物料编码",width :150 },
  16. attr: {},
  17. },
  18. { item: { key: "materialName", title: "物料名称",width :150 }, attr: {} },
  19. { item: { key: "specification", title: "规格",width :100 }, attr: {} },
  20. {
  21. item: { key: "manufacturerName", title: "生产厂家" ,width :100},
  22. attr: {},
  23. },
  24. { item: { key: "unitName", title: "单位" ,width :100}, attr: {} },
  25. { item: { key: "puQty", title: "采购数量",width :100 },
  26. attr: {
  27. isSummary:true,
  28. }
  29. },
  30. {
  31. item: { key: "executeQty", title: "已执行数量" ,width :100},
  32. attr: {
  33. isSummary:true,
  34. },
  35. },
  36. {
  37. item: { key: "residueQty", title: "未执行数量",width :100 },
  38. attr: {
  39. isSummary:true,
  40. },
  41. },
  42. {
  43. item: { key: "closeQty", title: "关闭数量",width :100 },
  44. attr: {
  45. isSummary:true,
  46. },
  47. },
  48. { item: { key: "buyerName", title: "采购员",width :100 }, attr: {} },
  49. {
  50. item: { key: "customerName", title: "收货客户",width :100 },
  51. attr: {},
  52. },
  53. { item: { key: "demandCode", title: "需求单号",width :150 }, attr: {} },
  54. {
  55. item: { key: "assignSupplierName", title: "指定供应商" ,width :100},
  56. attr: {},
  57. },
  58. { item: { key: "code", title: "订单生成单号",width :160 }, attr: {} },
  59. {
  60. item: { key: "demandOrgName", title: "需求组织" ,width :100},
  61. attr: {},
  62. },
  63. { item: { key: "demandDate", title: "需求时间",width :100 }, attr: {} },
  64. {
  65. item: { key: "isBack", title: "是否退回",width :100 },
  66. attr: { is: "el-dict-tag", dictName: "sys_yes_no" ,width :100},
  67. },
  68. { item: { key: "baskCause", title: "退回原因" ,width :100}, attr: {} },
  69. { item: { key: "backDate", title: "退回日期",width :100 }, attr: {} },
  70. {
  71. item: { key: "demandPersonalName", title: "需求人",width :100 },
  72. attr: {},
  73. },
  74. {
  75. item: { key: "demandDeptName", title: "需求部门",width :100 },
  76. attr: {},
  77. },
  78. // {
  79. // item: {
  80. // key: "isUrgency",
  81. // title: "紧急程度",
  82. // width :100 ,
  83. // },
  84. // attr: {
  85. // is: "el-dict-tag",
  86. // dictName: "sys_yes_no"
  87. // },
  88. // },
  89. // {
  90. // item: { key: "materialDesc", title: "物料描述",width :100 },
  91. // attr: {},
  92. // },
  93. // {
  94. // item: { key: "priceType", title: "价格类型" ,width :100},
  95. // attr: { is: "el-dict-tag", dictName: "sys_price_type" },
  96. // },
  97. // { item: { key: "puUnitName", title: "采购单位",width :100 }, attr: {} },
  98. // {
  99. // item: { key: "supplierName", title: "建议供应商",width :100 },
  100. // attr: {},
  101. // },
  102. // { item: { key: "puOrgName", title: "采购组织",width :100 }, attr: {} },
  103. // { item: { key: "currencyName", title: "币种",width :100 }, attr: {} },
  104. // { item: { key: "source", title: "需求单号" ,width :100}, attr: {} },
  105. // { item: { key: "projectName", title: "项目名称",width :100 }, attr: {} },
  106. ].map(({ item, attr }) => ({
  107. attr,
  108. item: {
  109. ...item,
  110. sortabled: true,
  111. fixedabled: true,
  112. filterabled: true,
  113. hiddenabled: true,
  114. },
  115. }));
  116. const SearchColumns = [
  117. {
  118. item: {
  119. key: "classIds",
  120. title: "物料分类",
  121. },
  122. attr: {
  123. is: "el-popover-multiple-tree-select",
  124. referName: "MATERIALCLASSIFY_PARAM",
  125. valueKey: "id",
  126. },
  127. },
  128. {
  129. item: {
  130. key: "materialCodes",
  131. title: "物料编码",
  132. },
  133. attr: {
  134. is: "el-popover-multiple-select-v2",
  135. valueKey: "code",
  136. referName: "MATERIAL_PARAM",
  137. },
  138. },
  139. {
  140. item: {
  141. key: "existPrice",
  142. title: "是否有价格",
  143. },
  144. attr: {
  145. is: "el-select",
  146. dictName: "sys_true_false" ,
  147. clearable: true,
  148. },
  149. },
  150. // {
  151. // item: {
  152. // key: "materialDesc",
  153. // title: "物料描述",
  154. // },
  155. // attr: {
  156. // is: "el-input",
  157. // },
  158. // },
  159. {
  160. item: {
  161. key: "code",
  162. title: "单据号",
  163. },
  164. attr: {
  165. is: "el-input",
  166. },
  167. },
  168. {
  169. item: {
  170. key: "puOrgIds",
  171. title: "采购组织",
  172. },
  173. attr: {
  174. is: "el-popover-multiple-select-v2",
  175. referName: "ORG_PARAM",
  176. valueKey: "id",
  177. },
  178. },
  179. {
  180. item: {
  181. // key: "status",
  182. key: "statusList",
  183. title: "状态",
  184. },
  185. attr: {
  186. is: "el-select",
  187. multiple:true,
  188. collapseTags:true,
  189. dictName: "purchase_task_status",
  190. clearable: true,
  191. },
  192. },
  193. {
  194. item: {
  195. key: "date",
  196. title: "创建时间",
  197. },
  198. attr: {
  199. is: "el-date-picker",
  200. type: "daterange",
  201. unlinkPanels: true,
  202. rangeSeparator: "至",
  203. valueFormat: "yyyy-MM-dd",
  204. endPlaceholder: "结束日期",
  205. startPlaceholder: "开始日期",
  206. pickerOptions: pickerOptions,
  207. value: [],
  208. },
  209. },
  210. {
  211. item: {
  212. key: "buyers",
  213. title: "采购员",
  214. },
  215. attr: {
  216. is: "el-popover-multiple-select-v2",
  217. referName: "CONTACTS_PARAM",
  218. valueKey: "code",
  219. },
  220. },
  221. {
  222. item: {
  223. key: "manufacturerName",
  224. title: "生产厂家",
  225. },
  226. attr: {
  227. is: "el-input",
  228. },
  229. },
  230. {
  231. item: {
  232. key: "customerName",
  233. title: "收货客户",
  234. },
  235. attr: {
  236. is: "el-popover-select-v2",
  237. referName: "CUSTOMERDEPT_PARAM",
  238. valueKey: "name",
  239. },
  240. },
  241. // {
  242. // item: {
  243. // key: "isUrgency",
  244. // title: "紧急标识",
  245. // },
  246. // attr: {
  247. // clearable: true,
  248. // is: "el-select",
  249. // dictName: "sys_yes_no"
  250. // },
  251. // },
  252. // {
  253. // item: {
  254. // key: "isReplenishment",
  255. // title: "补单标识",
  256. // },
  257. // attr: {
  258. // clearable: true,
  259. // is: "el-select",
  260. // dictName: "sys_yes_no"
  261. // },
  262. // },
  263. {
  264. item: {
  265. key: "documentsCodes",
  266. title: "采购需求单号",
  267. span: 12,
  268. },
  269. attr: {
  270. is: "el-input",
  271. placeholder: "请输入来源单据号,多个用,分隔",
  272. },
  273. },
  274. {
  275. item: {
  276. key: "materialCodes",
  277. title: "物料编码",
  278. span: 12,
  279. },
  280. attr: {
  281. is: "el-input",
  282. placeholder: "请输入物料编码,多个用,分隔",
  283. },
  284. },
  285. ].map(({ item, attr }) => ({
  286. attr,
  287. item: { ...item, hidden: true, span: item.span || 6 },
  288. }));
  289. const pickerOptions = {
  290. shortcuts: [
  291. {
  292. text: "昨天",
  293. onClick(picker) {
  294. const end = new Date();
  295. const start = new Date();
  296. start.setTime(start.getTime() - 3600 * 1000 * 24 * 1);
  297. picker.$emit("pick", [start, end]);
  298. },
  299. },
  300. {
  301. text: "最近三天",
  302. onClick(picker) {
  303. const end = new Date();
  304. const start = new Date();
  305. start.setTime(start.getTime() - 3600 * 1000 * 24 * 3);
  306. picker.$emit("pick", [start, end]);
  307. },
  308. },
  309. {
  310. text: "最近一周",
  311. onClick(picker) {
  312. const end = new Date();
  313. const start = new Date();
  314. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  315. picker.$emit("pick", [start, end]);
  316. },
  317. },
  318. {
  319. text: "最近一个月",
  320. onClick(picker) {
  321. const end = new Date();
  322. const start = new Date();
  323. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  324. picker.$emit("pick", [start, end]);
  325. },
  326. },
  327. {
  328. text: "最近三个月",
  329. onClick(picker) {
  330. const end = new Date();
  331. const start = new Date();
  332. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  333. picker.$emit("pick", [start, end]);
  334. },
  335. },
  336. {
  337. text: "最近半年",
  338. onClick(picker) {
  339. const end = new Date();
  340. const start = new Date();
  341. start.setTime(start.getTime() - 3600 * 1000 * 24 * 180);
  342. picker.$emit("pick", [start, end]);
  343. },
  344. },
  345. ],
  346. };
  347. return { TableColumns, SearchColumns };
  348. }