|
@@ -1,26 +1,25 @@
|
|
|
-import * as api from './api';
|
|
|
-import { dict, UserPageQuery, AddReq, DelReq, EditReq, compute, CreateCrudOptionsProps, CreateCrudOptionsRet } from '@fast-crud/fast-crud';
|
|
|
-import { inject, nextTick, ref } from 'vue';
|
|
|
-import { successMessage } from '/@/utils/message';
|
|
|
-import { BaseColumn } from '/@/views/adManage/utils/commonTabColumn.js';
|
|
|
+import * as api from './api'
|
|
|
+import { dict, UserPageQuery, AddReq, DelReq, EditReq, compute, CreateCrudOptionsProps, CreateCrudOptionsRet } from '@fast-crud/fast-crud'
|
|
|
+import { inject, nextTick, ref } from 'vue'
|
|
|
+import { BaseColumn } from '/@/views/adManage/utils/commonTabColumn.js'
|
|
|
|
|
|
export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
|
|
const pageRequest = async (query: UserPageQuery) => {
|
|
|
- return await api.GetList(query);
|
|
|
- };
|
|
|
+ return await api.GetList(query)
|
|
|
+ }
|
|
|
const editRequest = async ({ form, row }: EditReq) => {
|
|
|
- form.id = row.id;
|
|
|
- return await api.UpdateObj(form);
|
|
|
- };
|
|
|
+ form.id = row.id
|
|
|
+ return await api.UpdateObj(form)
|
|
|
+ }
|
|
|
const delRequest = async ({ row }: DelReq) => {
|
|
|
- return await api.DelObj(row.id);
|
|
|
- };
|
|
|
+ return await api.DelObj(row.id)
|
|
|
+ }
|
|
|
const addRequest = async ({ form }: AddReq) => {
|
|
|
- return await api.AddObj(form);
|
|
|
- };
|
|
|
+ return await api.AddObj(form)
|
|
|
+ }
|
|
|
|
|
|
//权限判定
|
|
|
- const hasPermissions = inject('$hasPermissions');
|
|
|
+ const hasPermissions = inject('$hasPermissions')
|
|
|
|
|
|
return {
|
|
|
crudOptions: {
|
|
@@ -28,8 +27,8 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
|
height: 800,
|
|
|
},
|
|
|
container: {
|
|
|
- fixedHeight: false
|
|
|
- },
|
|
|
+ fixedHeight: false,
|
|
|
+ },
|
|
|
request: {
|
|
|
pageRequest,
|
|
|
addRequest,
|
|
@@ -46,13 +45,13 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
|
edit: {
|
|
|
iconRight: 'Edit',
|
|
|
type: 'text',
|
|
|
- text: null
|
|
|
+ text: null,
|
|
|
// show: hasPermissions('dictionary:Update'),
|
|
|
},
|
|
|
remove: {
|
|
|
iconRight: 'Delete',
|
|
|
type: 'text',
|
|
|
- text: null
|
|
|
+ text: null,
|
|
|
// show: hasPermissions('dictionary:Delete'),
|
|
|
},
|
|
|
// custom: {
|
|
@@ -75,6 +74,16 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
|
// },
|
|
|
},
|
|
|
},
|
|
|
+ toolbar: {
|
|
|
+ buttons: {
|
|
|
+ search: {
|
|
|
+ show: true,
|
|
|
+ },
|
|
|
+ compact: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
columns: {
|
|
|
// _index: {
|
|
|
// title: '序号',
|
|
@@ -93,36 +102,36 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
|
// },
|
|
|
// },
|
|
|
// },
|
|
|
- name: {
|
|
|
- title: '广告组合',
|
|
|
- column: {
|
|
|
- width: '150px'
|
|
|
- },
|
|
|
+ name: {
|
|
|
+ title: '广告组合',
|
|
|
+ column: {
|
|
|
+ width: '150px',
|
|
|
+ },
|
|
|
search: {
|
|
|
show: true,
|
|
|
component: {
|
|
|
props: {
|
|
|
- clearable: true
|
|
|
- }
|
|
|
- }
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
},
|
|
|
form: {
|
|
|
- rules: [{required: true, message:'必填项'}]
|
|
|
- }
|
|
|
- },
|
|
|
- state: {
|
|
|
- title: '状态',
|
|
|
- type: 'dict-select',
|
|
|
- dict: dict({
|
|
|
- data:[
|
|
|
- {value:'enabled', label:'投放中'},
|
|
|
- {value:'disable', label:'禁用'},
|
|
|
- ]
|
|
|
- }),
|
|
|
+ rules: [{ required: true, message: '必填项' }],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ state: {
|
|
|
+ title: '状态',
|
|
|
+ type: 'dict-select',
|
|
|
+ dict: dict({
|
|
|
+ data: [
|
|
|
+ { value: 'enabled', label: '投放中' },
|
|
|
+ { value: 'disable', label: '禁用' },
|
|
|
+ ],
|
|
|
+ }),
|
|
|
form: {
|
|
|
- show: false
|
|
|
- }
|
|
|
- },
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ },
|
|
|
budget_policy: {
|
|
|
title: '预算类型',
|
|
|
type: 'dict-select',
|
|
@@ -131,49 +140,49 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|
|
{ value: '', label: '无预算上限' },
|
|
|
{ value: 'dateRange', label: '日期范围' },
|
|
|
{ value: 'monthlyRecurring', label: '按月' },
|
|
|
- ]
|
|
|
+ ],
|
|
|
}),
|
|
|
form: {
|
|
|
- value: ''
|
|
|
- }
|
|
|
+ value: '',
|
|
|
+ },
|
|
|
},
|
|
|
- budget_startDate: {
|
|
|
- title: '开始日期',
|
|
|
+ budget_startDate: {
|
|
|
+ title: '开始日期',
|
|
|
type: 'date',
|
|
|
form: {
|
|
|
- show: compute(context => context.form.budget_policy === "dateRange"),
|
|
|
- rules: [{required: true, message:'必填项'}]
|
|
|
- }
|
|
|
- },
|
|
|
- budget_endDate: {
|
|
|
- title: '结束日期',
|
|
|
+ show: compute((context) => context.form.budget_policy === 'dateRange'),
|
|
|
+ rules: [{ required: true, message: '必填项' }],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ budget_endDate: {
|
|
|
+ title: '结束日期',
|
|
|
type: 'date',
|
|
|
form: {
|
|
|
- show: compute(context => context.form.budget_policy !== '')
|
|
|
- }
|
|
|
- },
|
|
|
- budget_amount: {
|
|
|
- title: '预算',
|
|
|
+ show: compute((context) => context.form.budget_policy !== ''),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ budget_amount: {
|
|
|
+ title: '预算',
|
|
|
type: 'number',
|
|
|
form: {
|
|
|
value: 0,
|
|
|
- show: compute(context => context.form.budget_policy !== ''),
|
|
|
- rules: [{required: true, message:'必填项'}],
|
|
|
+ show: compute((context) => context.form.budget_policy !== ''),
|
|
|
+ rules: [{ required: true, message: '必填项' }],
|
|
|
component: {
|
|
|
min: 0,
|
|
|
precision: 2,
|
|
|
- controlsPosition: "right"
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- inBudget: {
|
|
|
- title: '是否预算内',
|
|
|
+ controlsPosition: 'right',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ inBudget: {
|
|
|
+ title: '是否预算内',
|
|
|
form: {
|
|
|
- show: false
|
|
|
- }
|
|
|
- },
|
|
|
- ...BaseColumn
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ...BaseColumn,
|
|
|
},
|
|
|
},
|
|
|
- };
|
|
|
-};
|
|
|
+ }
|
|
|
+}
|