columns.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. export default function useColumns() {
  2. const SearchColumns = [
  3. {
  4. item: { key: "code", title: "编码" },
  5. attr: {
  6. is: "el-input",
  7. placeholder: "请输入编码",
  8. clearable: true,
  9. }
  10. },
  11. {
  12. item: { key: "goalName", title: "目标名称" },
  13. attr: {
  14. is: "el-input",
  15. placeholder: "请输入目标名称",
  16. clearable: true,
  17. }
  18. },
  19. {
  20. item: { key: "documentDateRange", title: "单据日期" },
  21. attr: {
  22. is: "el-date-picker",
  23. type: "daterange",
  24. valueFormat: "yyyy-MM-dd",
  25. align: "right",
  26. rangeSeparator: "至",
  27. startPlaceholder: "开始日期",
  28. endPlaceholder: "结束日期",
  29. placeholder: "请选择单据日期",
  30. pickerOptions: pickerOptions,
  31. }
  32. },
  33. {
  34. item: { key: "annual", title: "年度" },
  35. attr: {
  36. is: "el-date-picker",
  37. type: "year",
  38. valueFormat: "yyyy",
  39. placeholder: "选择年度",
  40. clearable: true,
  41. }
  42. },
  43. {
  44. item: { key: "status", title: "单据状态" },
  45. attr: {
  46. is: "el-select",
  47. dictName: "sys_status",
  48. placeholder: "选择单据状态",
  49. clearable: true,
  50. }
  51. },
  52. {
  53. item: { key: "creator", title: "制单人" },
  54. attr: {
  55. is: "el-popover-select-v2",
  56. valueKey: "name",
  57. referName: "CONTACTS_PARAM",
  58. dataMapping: {
  59. creatorCode: 'code',
  60. },
  61. placeholder: "请输入制单人",
  62. }
  63. },
  64. {
  65. item: { key: "dept", title: "部门" },
  66. attr: {
  67. is: "el-popover-select-v2",
  68. valueKey: "name",
  69. referName: "DEPT_PARAM",
  70. dataMapping: {
  71. deptId: 'id',
  72. },
  73. placeholder: "请输入部门",
  74. }
  75. },
  76. {
  77. item: { key: "goalCategory", title: "目标类型" },
  78. attr: {
  79. is: "el-select",
  80. dictName: "annualSale_type",
  81. clearable: true,
  82. }
  83. },
  84. {
  85. item: { key: "saleZone", title: "销售区域" },
  86. attr: {
  87. is: "el-popover-select-v2",
  88. valueKey: "name",
  89. referName: "MK_SALESAREA_PARAM",
  90. dataMapping: {
  91. saleZoneCode: 'code',
  92. },
  93. placeholder: "请输入销售区域",
  94. }
  95. },
  96. {
  97. item: { key: "oneLevelClassify", title: "一级分类" },
  98. attr: {
  99. is: "el-popover-tree-select",
  100. referName: "MATERIALCLASSIFY_PARAM",
  101. placeholder: "请输入一级分类",
  102. valueKey: "name",
  103. onlyFinal: false,
  104. defaultProps: {
  105. label: function (data, node) {
  106. return data.code + "-" + data.name;
  107. },
  108. children: "children",
  109. },
  110. dataMapping: {
  111. oneLevelClassifyCode: "code",
  112. },
  113. }
  114. },
  115. {
  116. item: { key: "twoLevelClassify", title: "二级分类" },
  117. attr: {
  118. is: "el-popover-tree-select",
  119. referName: "MATERIALCLASSIFY_PARAM",
  120. placeholder: "请输入二级分类",
  121. valueKey: "name",
  122. onlyFinal: false,
  123. defaultProps: {
  124. label: function (data, node) {
  125. return data.code + "-" + data.name;
  126. },
  127. children: "children",
  128. },
  129. dataMapping: {
  130. twoLevelClassifyCode: "code",
  131. },
  132. }
  133. },
  134. ];
  135. const TableColumns = [
  136. {
  137. item: { key: "status", title: "状态", width: 100, },
  138. attr: {
  139. is: "el-dict-tag",
  140. dictName: "sys_status",
  141. },
  142. },
  143. {
  144. item: { key: "code", title: "编码", },
  145. attr: {},
  146. },
  147. {
  148. item: { key: "goalName", title: "目标名称", },
  149. attr: {},
  150. },
  151. {
  152. item: { key: "documentDate", title: "单据日期", width: 120, },
  153. attr: {},
  154. },
  155. {
  156. item: { key: "annual", title: "年度", width: 100, },
  157. attr: {},
  158. },
  159. {
  160. item: { key: "creator", title: "制单人", width: 100, },
  161. attr: {},
  162. },
  163. {
  164. item: { key: "dept", title: "部门", },
  165. attr: {},
  166. },
  167. {
  168. item: { key: "goalCategory", title: "目标类型", },
  169. attr: {},
  170. },
  171. {
  172. item: { key: "goalTotal", title: "目标值汇总(元)", },
  173. attr: {},
  174. },
  175. {
  176. item: { key: "saleZone", title: "销售区域", },
  177. attr: {},
  178. },
  179. {
  180. item: { key: "oneLevelClassify", title: "一级分类", },
  181. attr: {},
  182. },
  183. {
  184. item: { key: "twoLevelClassify", title: "二级分类", },
  185. attr: {},
  186. },
  187. {
  188. item: { key: "notes", title: "备注", },
  189. attr: {},
  190. },
  191. ].map(({ item, attr }) => ({
  192. attr,
  193. item: {
  194. ...item,
  195. sortabled: true,
  196. fixedabled: true,
  197. filterabled: true,
  198. hiddenabled: true,
  199. },
  200. }));
  201. const pickerOptions = {
  202. shortcuts: [{
  203. text: '最近一周',
  204. onClick(picker) {
  205. const end = new Date();
  206. const start = new Date();
  207. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  208. picker.$emit('pick', [start, end]);
  209. }
  210. }, {
  211. text: '最近一个月',
  212. onClick(picker) {
  213. const end = new Date();
  214. const start = new Date();
  215. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  216. picker.$emit('pick', [start, end]);
  217. }
  218. }, {
  219. text: '最近三个月',
  220. onClick(picker) {
  221. const end = new Date();
  222. const start = new Date();
  223. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  224. picker.$emit('pick', [start, end]);
  225. }
  226. }]
  227. }
  228. return { SearchColumns, TableColumns }
  229. }