From c18eda026ce851985fd875fdf0c34289625c536e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=99=8C?= Date: Tue, 9 Jan 2024 17:37:03 +0800 Subject: [PATCH] no message --- src/components/xStat/index.vue | 7 ++++++- src/components/xTable/index.vue | 13 +++++++++++++ src/views/table/1/index.vue | 20 -------------------- src/views/table/2/index.vue | 20 -------------------- 4 files changed, 19 insertions(+), 41 deletions(-) diff --git a/src/components/xStat/index.vue b/src/components/xStat/index.vue index 2862f1d..598d0d9 100644 --- a/src/components/xStat/index.vue +++ b/src/components/xStat/index.vue @@ -112,6 +112,11 @@ export default { Object.assign(this.config, o); this.loading = true; + + if (this.config.param && typeof this.config.param === "object" && this.config.param !== null) { + Object.assign(this.search, this.config.param); + } + this.search.name = this.config.value || this.config.name || this.name; // 获取参数 if (typeof this.config.key !== 'undefined' && this.config.key) { @@ -127,7 +132,7 @@ export default { cacheparameters: this.config.cacheparameters || false }; - this.$http.get(this.config.remoteurl || 'stat/admin/get', this.search, options).then((res) => { + this.$http.get(this.config.url || this.config.remoteurl || 'stat/admin/get', this.search, options).then((res) => { this.loading = false; if (res.code == 200) { // 更改配置 diff --git a/src/components/xTable/index.vue b/src/components/xTable/index.vue index 2703f3e..03fe95c 100644 --- a/src/components/xTable/index.vue +++ b/src/components/xTable/index.vue @@ -200,6 +200,19 @@ export default { }, methods: { + //编辑弹窗,成功后本地更新数据 + handleSuccess(data, message) { + if (data && this.rowKey && data[this.rowKey]) { + this.tableData.filter(item => item[this.rowKey] === data[this.rowKey]).forEach(item => { + Object.assign(item, data) + }) + } else { + this.refresh() + } + this.$message.success(message || "操作成功") + return; + }, + //批量删除 async operation(o) { diff --git a/src/views/table/1/index.vue b/src/views/table/1/index.vue index fabf9be..0a4733e 100644 --- a/src/views/table/1/index.vue +++ b/src/views/table/1/index.vue @@ -145,26 +145,6 @@ export default { tabChange() { this.$refs.table.reload(this.search) }, - //本地更新数据 - handleSuccess(data, mode, message) { - if (mode == 'edit') { - if (data) { - this.$refs.table.tableData.filter(item => item[this.key] === data[this.key]).forEach(item => { - Object.assign(item, data, data) - }) - } else { - this.$refs.table.refresh() - } - } else { - if (data) { - this.$refs.table.tableData.unshift(data) - } else { - this.$refs.table.reload({}) - } - } - this.$message.success(message || "操作成功") - return; - }, //增加 plus() { this.$nextTick(() => { diff --git a/src/views/table/2/index.vue b/src/views/table/2/index.vue index 1ef2241..1684b62 100644 --- a/src/views/table/2/index.vue +++ b/src/views/table/2/index.vue @@ -183,26 +183,6 @@ export default { tabChange() { this.$refs.table.reload(this.search) }, - //本地更新数据 - handleSuccess(data, mode, message) { - if (mode == 'edit') { - if (data) { - this.$refs.table.tableData.filter(item => item[this.key] === data[this.key]).forEach(item => { - Object.assign(item, data, data) - }) - } else { - this.$refs.table.refresh() - } - } else { - if (data) { - this.$refs.table.tableData.unshift(data) - } else { - this.$refs.table.reload({}) - } - } - this.$message.success(message || "操作成功") - return; - }, //增加 plus() { this.$nextTick(() => {