From 33855a1961d581727cfbf59230085e6b95cc549c Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期一, 29 四月 2024 15:56:37 +0800
Subject: [PATCH] action
---
Source/ProjectWeb/src/components/actions/AddEditDialog.vue | 16 ++++++-
Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue | 6 ++-
Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue | 6 ++
Source/ProjectWeb/src/actions/base/EditAction.js | 35 ++++++++++++++++-
4 files changed, 55 insertions(+), 8 deletions(-)
diff --git a/Source/ProjectWeb/src/actions/base/EditAction.js b/Source/ProjectWeb/src/actions/base/EditAction.js
index 2f8b13f..d79c171 100644
--- a/Source/ProjectWeb/src/actions/base/EditAction.js
+++ b/Source/ProjectWeb/src/actions/base/EditAction.js
@@ -4,6 +4,7 @@
import {paramLow,callPreEvent,callPostEvent} from './BaseAction';
import {validatenull} from "@/util/validate";
import Vue from "vue";
+import AddEditDialog from "@/components/actions/AddEditDialog";
export const doAction = (options) => {
options.paramVOS = paramLow(options.paramVOS)
@@ -26,6 +27,21 @@
Vue.prototype.$message.error("浠呰兘閫夋嫨涓�鏉℃暟鎹潵鎿嶄綔");
return false;
}
+
+ if(!validatenull(paramVOS.checknotedit)) {
+ let notedit = paramVOS.checknotedit.split('&');
+ let checknotedit=false;
+ notedit.forEach((item,i)=>{
+ if (options.dataStore[0][item.split('=')[0]] == item.split('=')[1]) {
+ checknotedit=true;
+ return false;
+ }
+ })
+ if (checknotedit) {
+ Vue.prototype.$message.error(replaceFreeMarker(paramVOS.checknoteditmsg,options.dataStore,{}) || "褰撳墠鏁版嵁涓嶅厑璁镐慨鏀�");
+ return false;
+ }
+ }
callPreEvent(options, doBefore, function (options) {
doAdd(options, function () {
callPostEvent(options, doAfter, options.callback);
@@ -44,10 +60,25 @@
Vue.prototype.$message.error("鎸夐挳閰嶇疆涓嶆纭�");
return false;
}
- Vue.prototype.$message.success('鎵ц'+paramVOS.title);
+ const dialogConstructor = Vue.extend(AddEditDialog);
+ let instance = new dialogConstructor();
+ instance.sourceData = options.sourceData;
+ instance.dataStore = options.dataStore;
+ instance.paramVOS = paramVOS
+
+ instance.type = 'edit';
+ instance.dialogClose = function () {
+ vm.visible = false;
+ document.body.removeChild(vm.$el);
+ instance.$destroy();
+ instance = null;
+ };
if (callback) {
- callback(options);
+ instance.saveCallback = callback;
}
+ let vm = instance.$mount();
+ document.body.appendChild(vm.$el);
+ instance.visible = true;
}
/**
* 鍓嶇疆浜嬩欢
diff --git a/Source/ProjectWeb/src/components/actions/AddEditDialog.vue b/Source/ProjectWeb/src/components/actions/AddEditDialog.vue
index 09b5960..3d288d5 100644
--- a/Source/ProjectWeb/src/components/actions/AddEditDialog.vue
+++ b/Source/ProjectWeb/src/components/actions/AddEditDialog.vue
@@ -133,15 +133,25 @@
if (this.paramVOS.initvalue) {
this.form=this.paramVOS.initvalue;
}
- if(this.type=="edit"){
+ if(this.type=="edit") {
//鍔犺浇琛ㄥ崟鏁版嵁
- dataForm(this.params,this.paramVOS.getdataurl,this.paramVOS.getdatamethod).then(res => {
+ let sourceDataMap = {};
+ for (let i in this.sourceData) {
+ const item = this.sourceData[i]
+ if (item.constructor === Object) return;
+ sourceDataMap['sourceData["' + i + '"]'] = item;
+ }
+ dataForm(Object.assign({
+ btmname: this.paramVOS.type,
+ formDefineId: this.paramVOS.form,
+ oid: this.dataStore[0].oid
+ }, sourceDataMap), this.paramVOS.getdataurl, this.paramVOS.getdatamethod).then(res => {
this.form = res.data.obj;
this.loading = false;
}).catch(error => {
this.$message.error(error);
this.loading = false;
- });
+ })
}
}).catch(error => {
this.$message.error(error);
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
index c05ef39..15fd7f1 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
@@ -147,6 +147,7 @@
console.log(this.params)
},
onLoad:function () {
+ debugger;
if (Object.keys(this.sourceData).length>0 && this.isShow) {
this.loading = true;
dataForm(this.params).then(res => {
@@ -158,8 +159,9 @@
});
}
},
- handleRefresh(){
-
+ handleRefresh() {
+ this.form={}
+ this.onLoad();
}
}
}
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
index 9d6fdf3..886e7f7 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
@@ -323,7 +323,11 @@
},
selectionClear() {
this.selectionList = [];
- this.$refs.dataTable.toggleSelection();
+ try {
+ this.$refs.dataTable.toggleSelection();
+ }catch (e) {
+
+ }
},
handleRefresh() {
this.onLoad(this.page, this.query);
--
Gitblit v1.9.3