columns.js 6.8 KB

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