update AddForm、Search组件修改

This commit is contained in:
赵霄
2023-08-29 16:44:45 +08:00
parent f560c8a64c
commit fecd8c01cc
10 changed files with 577 additions and 93 deletions
+9 -9
View File
@@ -1,7 +1,7 @@
/**
* 表头通过标签管理配置的模块的表格数据的混入
*/
import { downFile, downloadFile, getAction, postAction } from '@api/manage'
import { downFile, downloadFile, postAction } from '@api/manage'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import store from '@/store'
@@ -42,8 +42,8 @@ export const ConfigurableTableMixin = {
// type: '', // 这个字段不知道什么含义
filters: {}, // 固定的搜索条件
needFilterTableBtn: true, // 是否需要过滤没有权限的按钮
tokenHeader: { 'X-Access-Token': Vue.ls.get(ACCESS_TOKEN) }
tokenHeader: { 'X-Access-Token': Vue.ls.get(ACCESS_TOKEN) },
getTableHeaderFunc: null // 获取表头的方法
}
},
computed: {
@@ -87,11 +87,11 @@ export const ConfigurableTableMixin = {
* 获取表头数据
*/
getTableHeader () {
if (!this.url.tableHeader) {
if (!this.getTableHeaderFunc && typeof this.getTableHeaderFunc !== 'function') {
return
}
const params = { module: this.flag }
getAction(this.url.tableHeader, params).then(res => {
this.getTableHeaderFunc(params).then(res => {
if (res.success) {
this.columns = this.dealColumns(res.result || [])
this.isTrue = false
@@ -326,7 +326,7 @@ export const ConfigurableTableMixin = {
* 批量删除
*/
batchDel () {
if (!this.url.deleteBatch) {
if (!this.url.delete) {
this.$message.error('请设置url.deleteBatch属性!')
return
}
@@ -341,9 +341,9 @@ export const ConfigurableTableMixin = {
this.$confirm({
title: this.$t('confirmBatchDeletion'),
content: this.$t('deleteAData'),
onOk: function() {
onOk: function () {
that.loading = true
postAction(that.url.deleteBatch, { ids: ids }).then((res) => {
postAction(that.url.delete, { ids: ids }).then((res) => {
if (res.success) {
// 重新计算分页问题
that.reCalculatePage(that.selectedRowKeys.length)
@@ -374,7 +374,7 @@ export const ConfigurableTableMixin = {
title: this.$t('confirmDeletion'),
content: this.$t('areYouSure'),
onOk: () => {
postAction(that.url.delete, { id: id }).then((res) => {
postAction(that.url.delete, { ids: id }).then((res) => {
if (res.success) {
that.$message.success(res.message)
// 判断当前删除的数据是否是最后一页的最后一条数据,如果是的话页码减一