123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- import * as api from './api'
- import {AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery} from '@fast-crud/fast-crud'
- import {inject} from 'vue'
- import {SbBaseColumn} from '/@/views/adManage/utils/commonTabColumn.js'
- import {parseQueryParams} from '/@/views/adManage/utils/tools.js'
- import XEUtils from 'xe-utils'
- export const createCrudOptions = function ({crudExpose, context}: CreateCrudOptionsProps): CreateCrudOptionsRet {
- const pageRequest = async (query: UserPageQuery) => {
- const params = parseQueryParams(context.value)
- XEUtils.assign(query, params)
- return await api.GetList(query)
- }
- const editRequest = async ({form, row}: EditReq) => {
- form.id = row.id
- return await api.UpdateObj(form)
- }
- const delRequest = async ({row}: DelReq) => {
- return await api.DelObj(row.id)
- }
- const addRequest = async ({form}: AddReq) => {
- return await api.AddObj(form)
- }
- //权限判定
- const hasPermissions = inject('$hasPermissions')
- return {
- crudOptions: {
- table: {
- height: 800,
- headerCellStyle: {
- backgroundColor: '#f6f7fa', // 直接设置背景颜色
- height: '20px',
- borderRight: 'none',
- },
- cellStyle: {
- border: 'none',
- borderBottom: '0.5px solid #ddd',
- },
- showSummary: true,
- stripe: false
- },
- container: {
- fixedHeight: false
- },
- actionbar: {
- show: false,
- buttons: {
- add: {
- show: false
- },
- }
- },
- search: {
- show: false
- },
- toolbar: {
- buttons: {
- search: {
- show: true
- },
- compact: {
- show: false
- }
- }
- },
- request: {
- pageRequest,
- addRequest,
- editRequest,
- delRequest,
- },
- rowHandle: {
- fixed: 'right',
- width: 100,
- align: 'center',
- buttons: {
- view: {
- show: false,
- },
- edit: {
- iconRight: 'Edit',
- type: 'text',
- text: null
- // show: hasPermissions('dictionary:Update'),
- },
- remove: {
- show: false
- // iconRight: 'Delete',
- // type: 'text',
- // text: null
- // show: hasPermissions('dictionary:Delete'),
- },
- },
- },
- columns: {
- id: {
- title: 'ID',
- column: {
- show: false
- },
- form: {
- show: false
- }
- },
- resolvedExpression_value:{
- title: '商品和分类',
- column: {
- fixed: 'left',
- width: 250,
- sortable: true
- },
- },
- state: {
- title: '状态',
- column: {
- width: '90px',
- align: 'center',
- sortable: true,
- },
- type: 'dict-select',
- search: {
- show: true
- },
- dict: dict({
- data: [
- {value: 'paused', label: '已暂停', color: 'warning'},
- {value: 'enabled', label: '投放中', color: 'success'},
- ]
- })
- },
- campaignName: {
- title: '广告活动名称',
- column: {
- width: 180,
- }
- },
- adGroupName: {
- title: '广告组名称',
- column: {
- width: 180,
- }
- },
- ASIN: {
- title: 'ASIN',
- column: {
- align: 'left',
- width: 130,
- }
- },
- suggestedBid: {
- title: '建议竞价',
- column: {
- width: 130,
- align: 'right'
- }
- },
- bid: {
- title: '出价',
- column: {
- width: 80,
- align: 'left',
- sortable: true,
- formatter: (row) => {
- return '$' + row.value
- }
- }
- },
- suggestedBid_lower: {
- column: {
- show: false,
- }
- },
- suggestedBid_upper: {
- column: {
- show: false,
- }
- },
- ...SbBaseColumn
- }
- }
- }
- }
|