table.data.js 2.65 KB
import { cloneDeep } from "lodash-es";
import { shelfTypeOpt } from "@/common/constants";
import { Util } from "@/common/util";
import { sceneTypeOptions, shelfModelOptions, statusOptions } from "../../constant/index";

export const shelfProductTableFormSchema = [
	{
		label: "单据编号",
		name: "businessCode",
		type: "input",
		maxlength: "20",
		isClear: true,
		input({ value, schema, formModel }) {
			formModel.businessCode = (value || "").replace(/[^a-z0-9]/gi, "");
		},
	},
	{
		label: "流量方信息",
		name: "merchantName",
		type: "input",
		maxlength: "50",
		isClear: true,
	},
	{
		label: "业务场景",
		name: "baseSceneCode",
		type: "select",
		isClear: true,
		optionList: cloneDeep(sceneTypeOptions),
		optionId: "value",
		optionLabel: "label",
	},
	{
		label: "上架模式",
		name: "shelfModel",
		type: "select",
		isClear: true,
		optionList: cloneDeep(shelfModelOptions),
		optionId: "value",
		optionLabel: "label",
	},
	{
		label: "上架类型",
		name: "shelfType",
		type: "select",
		isClear: true,
		optionList: cloneDeep(shelfTypeOpt),
		optionId: "confId",
		optionLabel: "confValue",
	},
	{
		label: "状态",
		name: "systemStatus",
		type: "select",
		isClear: true,
		optionList: statusOptions,
		optionId: "value",
		optionLabel: "label",
	},

];

export const shelfProductTableColumn = [
	{
		label: "单据编号",
		prop: "businessCode",
		width: "180px",
	},
	{
		label: "上架模式",
		prop: "shelfModel",
		width: "180px",
		formatter: (row) => {
			return shelfModelOptions.find(item => item.value === row.shelfModel)?.label || "特殊商品上架";
		},
	},
	{
		label: "上架类型",
		prop: "shelfType",
		width: "150px",
		formatter: (row) => {
			return shelfTypeOpt.find(item => item.confId === row.shelfType)?.confValue || "-";
		},
	},
	{
		label: "业务场景",
		prop: "baseSceneCode",
		width: "180px",
		formatter: (row) => {
			return sceneTypeOptions.find(item => item.value === row.baseSceneCode)?.label || "-";
		},
	},
	{
		label: "流量方信息",
		prop: "merchantNames",
		minWidth: "188px",
		addHtml: "merchantNames",
	},
	{
		label: "提交时间",
		prop: "createdDate",
		width: "160px",
		formatter: (row) => {
			return row.createdDate ? Util.dateFormate(row.createdDate, "YYYY-MM-DD HH:mm:ss") : "-";
		},
	},
	{
		label: "提交人",
		width: "120px",
		prop: "createdBy",
	},
	{
		label: "状态",
		prop: "systemStatus",
		width: "150px",
		formatter: (row) => {
			return statusOptions.find(item => item.value === row.systemStatus)?.label || "-";
		},
		className: (cellValue) => {
			return {
				0: "ashSpot",
				1: "yellowSpot",
				2: "greenSpot",
				3: "redSpot",
			}[cellValue.systemStatus];
		},
	},
];