123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- const queryFormBtnList = [
- {
- name: 'search',
- label: '搜索',
- type: 'primary',
- click: `() => {
- queryApi()
- }`,
- },
- {
- name: 'clear',
- label: '清空',
- type: 'warning',
- click: `() => {
- queryForm_Data.value = {}
- }`,
- },
- ]
- const tableRowBtnList = [
- {
- name: 'import',
- $import: true,
- label: '导入',
- type: 'primary',
- click: `async ({ file }: { file: File }) => {
- const res = await API_MAP['import']({ file })
- if(res.code === '1'){
- queryApi()
- ElMessage.success(res.msg)
- }
- }`,
- },
- {
- name: 'export',
- label: '导出',
- type: 'success',
- click: `() => {
- exportApi()
- }`,
- },
- {
- name: 'add',
- label: '新增',
- type: 'primary',
- click: `() => {
- whichDialogSubmit = 'add'
- dialogForm_Data.value = {}
- dialogVisible_addOrEdit.value = true
- }`,
- },
- {
- name: 'delete',
- label: '删除',
- type: 'danger',
- click: `async () => {
- await deleteApi(multipleSelection.value.map((item: TYPE_TABLE_FIELD)=>item[TABLE_KEY]))
- queryApi()
- }`,
- },
- ]
- const tableColBtnList = [
- {
- name: 'edit',
- label: '编辑',
- type: 'primary',
- click: `async (scope:{row:TYPE_TABLE_FIELD}) => {
- whichDialogSubmit = 'edit'
- const res = await detailApi(scope.row[TABLE_KEY])
- dialogForm_Data.value = (res.data.one_info)
- dialogVisible_addOrEdit.value = true
- }`,
- },
- {
- name: 'audit',
- label: '审核',
- type: 'primary',
- click: `(scope:{row:TYPE_TABLE_FIELD}) => {
- whichDialogSubmit = 'edit'
- dialogForm_Data.value = pick(scope.row, [\`\${TABLE_KEY}\`, ...Object.keys(dialogForm_Rules_audit)])
- dialogVisible_audit.value = true
- }`,
- },
- {
- name: 'detail',
- label: '详情',
- type: 'primary',
- click: `(scope:{row:TYPE_TABLE_FIELD}) => {
- router.push({ name:DetailName, params:{ [DetailParam]:scope.row[TABLE_KEY]} })
- }`,
- },
- {
- name: 'delete',
- label: '删除',
- type: 'primary',
- click: `async (scope:{row:TYPE_TABLE_FIELD}) => {
- await deleteApi(scope.row[TABLE_KEY])
- queryApi()
- }`,
- },
- ]
- const dialogFormBtnList = [
- {
- name: 'submit',
- label: '提交',
- type: 'primary',
- click: `async (formRefKey:string,extendData?:Partial<TYPE_TABLE_FIELD>) => {
- const isValid = await (instance?.refs[formRefKey] as FormInstance).validate((valid:boolean) => valid)
- if (isValid) {
- await API_MAP[whichDialogSubmit](<TYPE_TABLE_FIELD>({...dialogForm_Data.value,...extendData}))
- handleDialogFormBtn_cancel()
- queryApi()
- }
- }`,
- },
- {
- name: 'cancel',
- label: '取消',
- type: 'default',
- click: `(formRefKey?:string) => {
- dialogVisible_addOrEdit.value = false
- dialogVisible_audit.value = false
- }`,
- },
- ]
- export default {
- queryFormBtnList,
- tableColBtnList,
- tableRowBtnList,
- dialogFormBtnList,
- }
|