From 2d1d8d97966cbdb119456a35959b8e783476a2a9 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期三, 18 六月 2025 13:50:04 +0800
Subject: [PATCH] ~
---
admin/src/components/base/BaseOpera.vue | 75 ++++++++++++++++++++-----------------
1 files changed, 41 insertions(+), 34 deletions(-)
diff --git a/admin/src/components/base/BaseOpera.vue b/admin/src/components/base/BaseOpera.vue
index 697e7f5..0c07a27 100644
--- a/admin/src/components/base/BaseOpera.vue
+++ b/admin/src/components/base/BaseOpera.vue
@@ -1,5 +1,8 @@
<script>
+import { memberSync } from '@/api/business/member'
+
export default {
+ name: 'BaseOpera',
data () {
return {
title: '',
@@ -13,18 +16,12 @@
}
}
},
- // watch: {
- // visible() {
- // console.log(this.visible);
- // }
- // },
- watch: {
- $route (to, from) {
- this.close()
- }
- },
methods: {
- // 閰嶇疆
+ /**
+ * 閰嶇疆
+ *
+ * @param extParams 閰嶇疆鍙傛暟
+ */
config (extParams = {}) {
if (extParams == null) {
throw new Error('Parameter can not be null of method \'config\' .')
@@ -32,17 +29,14 @@
if (extParams.api == null) {
throw new Error('Missing config option \'api\'.')
}
- if(extParams.api.indexOf('@/',0) === 0){
- this.api = require(extParams.api)
- }else {
- this.api = require('@/api' + extParams.api)
- }
+ this.api = require('@/api' + extParams.api)
extParams['field.id'] && (this.configData['field.id'] = extParams['field.id'])
},
/**
* 鎵撳紑绐楀彛
- * @title 绐楀彛鏍囬
- * @target 缂栬緫鐨勫璞�
+ *
+ * @param title 绐楀彛鏍囬
+ * @param target 琛屽璞★紙浠呯紪杈戦渶璇ュ弬鏁帮級
*/
open (title, target) {
this.title = title
@@ -62,49 +56,62 @@
}
})
},
- close () {
- this.visible = false
- },
- // 纭鏂板缓/淇敼
+ /**
+ * 纭锛堢偣鍑荤‘璁ゆ寜閽悗瑙﹀彂锛�
+ */
confirm () {
- if (this.form.id == null || this.form.id === '') {
+ if (this.form[this.configData['field.id']] == null || this.form[this.configData['field.id']] === '') {
this.__confirmCreate()
return
}
this.__confirmEdit()
},
- // 纭鏂板缓
+ /**
+ * 纭鏂板缓
+ *
+ * @private
+ */
__confirmCreate () {
this.$refs.form.validate((valid) => {
- // debugger
if (!valid) {
return
}
- // console.log(this.form);
- // debugger
// 璋冪敤鏂板缓鎺ュ彛
this.isWorking = true
+ var that = this
this.api.create(this.form)
.then(() => {
- this.visible = false
- this.$tip.apiSuccess('鏂板缓鎴愬姛')
- this.$emit('success')
+ // that.$tip.apiSuccess('鏂板缓鎴愬姛')
+ that.$dialog.actionConfirmButton('鏄惁鍋滅暀璇ラ〉闈㈢户缁柊寤烘暟鎹紵', '鏂板缓鎴愬姛','缁х画娣诲姞','鍏抽棴杩斿洖')
+ .then(() => {
+ that.$refs.form.resetFields()
+ that.form[this.configData['field.id']] = null
+ that.$emit('success')
+ })
+ .catch(() => {
+ that.visible = false
+ that.$emit('success')
+ })
})
.catch(e => {
- // this.$tip.apiFailed(e)
+ this.$tip.apiFailed(e)
})
.finally(() => {
this.isWorking = false
})
})
},
- // 纭淇敼
+ /**
+ * 纭淇敼
+ *
+ * @private
+ */
__confirmEdit () {
this.$refs.form.validate((valid) => {
if (!valid) {
return
}
- // 璋冪敤鏂板缓鎺ュ彛
+ // 璋冪敤鏇存柊鎺ュ彛
this.isWorking = true
this.api.updateById(this.form)
.then(() => {
@@ -113,7 +120,7 @@
this.$emit('success')
})
.catch(e => {
- // this.$tip.apiFailed(e)
+ this.$tip.apiFailed(e)
})
.finally(() => {
this.isWorking = false
--
Gitblit v1.9.3