123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- export default function useColumns() {
- const SearchColumns = [
- {
- item: { key: "code", title: "编码" },
- attr: {
- is: "el-input",
- placeholder: "请输入编码",
- clearable: true,
- }
- },
- {
- item: { key: "goalName", title: "目标名称" },
- attr: {
- is: "el-input",
- placeholder: "请输入目标名称",
- clearable: true,
- }
- },
- {
- item: { key: "documentDateRange", title: "单据日期" },
- attr: {
- is: "el-date-picker",
- type: "daterange",
- valueFormat: "yyyy-MM-dd",
- align: "right",
- rangeSeparator: "至",
- startPlaceholder: "开始日期",
- endPlaceholder: "结束日期",
- placeholder: "请选择单据日期",
- pickerOptions: pickerOptions,
- }
- },
- {
- item: { key: "annual", title: "年度" },
- attr: {
- is: "el-date-picker",
- type: "year",
- valueFormat: "yyyy",
- placeholder: "选择年度",
- clearable: true,
- }
- },
- {
- item: { key: "status", title: "单据状态" },
- attr: {
- is: "el-select",
- dictName: "sys_status",
- placeholder: "选择单据状态",
- clearable: true,
- }
- },
- {
- item: { key: "creator", title: "制单人" },
- attr: {
- is: "el-popover-select-v2",
- valueKey: "name",
- referName: "CONTACTS_PARAM",
- dataMapping: {
- creatorCode: 'code',
- },
- placeholder: "请输入制单人",
- }
- },
- {
- item: { key: "dept", title: "部门" },
- attr: {
- is: "el-popover-select-v2",
- valueKey: "name",
- referName: "DEPT_PARAM",
- dataMapping: {
- deptId: 'id',
- },
- placeholder: "请输入部门",
- }
- },
- {
- item: { key: "goalCategory", title: "目标类型" },
- attr: {
- is: "el-select",
- dictName: "annualSale_type",
- clearable: true,
- }
- },
- {
- item: { key: "saleZone", title: "销售区域" },
- attr: {
- is: "el-popover-select-v2",
- valueKey: "name",
- referName: "MK_SALESAREA_PARAM",
- dataMapping: {
- saleZoneCode: 'code',
- },
- placeholder: "请输入销售区域",
- }
- },
- {
- item: { key: "oneLevelClassify", title: "一级分类" },
- attr: {
- is: "el-popover-tree-select",
- referName: "MATERIALCLASSIFY_PARAM",
- placeholder: "请输入一级分类",
- valueKey: "name",
- onlyFinal: false,
- defaultProps: {
- label: function (data, node) {
- return data.code + "-" + data.name;
- },
- children: "children",
- },
- dataMapping: {
- oneLevelClassifyCode: "code",
- },
- }
- },
- {
- item: { key: "twoLevelClassify", title: "二级分类" },
- attr: {
- is: "el-popover-tree-select",
- referName: "MATERIALCLASSIFY_PARAM",
- placeholder: "请输入二级分类",
- valueKey: "name",
- onlyFinal: false,
- defaultProps: {
- label: function (data, node) {
- return data.code + "-" + data.name;
- },
- children: "children",
- },
- dataMapping: {
- twoLevelClassifyCode: "code",
- },
- }
- },
- ];
- const TableColumns = [
- {
- item: { key: "status", title: "状态", width: 100, },
- attr: {
- is: "el-dict-tag",
- dictName: "sys_status",
- },
- },
- {
- item: { key: "code", title: "编码", },
- attr: {},
- },
- {
- item: { key: "goalName", title: "目标名称", },
- attr: {},
- },
- {
- item: { key: "documentDate", title: "单据日期", width: 120, },
- attr: {},
- },
- {
- item: { key: "annual", title: "年度", width: 100, },
- attr: {},
- },
- {
- item: { key: "creator", title: "制单人", width: 100, },
- attr: {},
- },
- {
- item: { key: "dept", title: "部门", },
- attr: {},
- },
- {
- item: { key: "goalCategory", title: "目标类型", },
- attr: {},
- },
- {
- item: { key: "goalTotal", title: "目标值汇总(元)", },
- attr: {},
- },
- {
- item: { key: "saleZone", title: "销售区域", },
- attr: {},
- },
- {
- item: { key: "oneLevelClassify", title: "一级分类", },
- attr: {},
- },
- {
- item: { key: "twoLevelClassify", title: "二级分类", },
- attr: {},
- },
- {
- item: { key: "notes", title: "备注", },
- attr: {},
- },
- ].map(({ item, attr }) => ({
- attr,
- item: {
- ...item,
- sortabled: true,
- fixedabled: true,
- filterabled: true,
- hiddenabled: true,
- },
- }));
- const pickerOptions = {
- shortcuts: [{
- text: '最近一周',
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
- picker.$emit('pick', [start, end]);
- }
- }, {
- text: '最近一个月',
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
- picker.$emit('pick', [start, end]);
- }
- }, {
- text: '最近三个月',
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
- picker.$emit('pick', [start, end]);
- }
- }]
- }
- return { SearchColumns, TableColumns }
- }
|