From 4e778d7f61e2508455e3a69815f7a17c455d81da Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期四, 09 五月 2024 18:20:27 +0800
Subject: [PATCH] 调整列表中按钮展示位置及默认按钮
---
Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue | 50 ++++++++----
Source/ProjectWeb/src/components/actions/base/AddAction.js | 0
Source/ProjectWeb/src/components/actions/base/BaseAction.js | 13 ++-
Source/ProjectWeb/src/components/actions/base/DeleteAction.js | 4
Source/ProjectWeb/src/components/actions/base/TabViewAction.js | 98 ++++++++++++++++++++++++
Source/ProjectWeb/src/components/actions/AddEditDialog.vue | 2
Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue | 2
Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue | 36 +++++++-
Source/ProjectWeb/src/components/PLT-basic-component/basicForm.vue | 4 +
Source/ProjectWeb/src/components/actions/base/EditAction.js | 4
Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue | 6 -
11 files changed, 181 insertions(+), 38 deletions(-)
diff --git a/Source/ProjectWeb/src/components/PLT-basic-component/basicForm.vue b/Source/ProjectWeb/src/components/PLT-basic-component/basicForm.vue
index 718ae8f..b761268 100644
--- a/Source/ProjectWeb/src/components/PLT-basic-component/basicForm.vue
+++ b/Source/ProjectWeb/src/components/PLT-basic-component/basicForm.vue
@@ -212,6 +212,10 @@
required: item.required,
message: `璇疯緭鍏�${item.text}!`,
trigger: "blur"
+ },{
+ required: item.required,
+ message: `璇疯緭鍏�${item.text}!`,
+ trigger: "submit"
}]):[]
};
if(!this.isEdit){
diff --git a/Source/ProjectWeb/src/components/actions/AddEditDialog.vue b/Source/ProjectWeb/src/components/actions/AddEditDialog.vue
index 188ff0f..552c258 100644
--- a/Source/ProjectWeb/src/components/actions/AddEditDialog.vue
+++ b/Source/ProjectWeb/src/components/actions/AddEditDialog.vue
@@ -43,7 +43,7 @@
<script>
import uiView from "@/views/base/UIContentViewerInDialog"
-import {parseEventByUrl} from "@/actions/base/BaseAction"
+import {parseEventByUrl} from "@/components/actions/base/BaseAction"
import {getFormDefineById,dataForm} from "@/api/base/ui";
import {addSave,editSave} from "@/api/base/actions"
import {validatenull} from "@/util/validate"
diff --git a/Source/ProjectWeb/src/actions/base/AddAction.js b/Source/ProjectWeb/src/components/actions/base/AddAction.js
similarity index 100%
rename from Source/ProjectWeb/src/actions/base/AddAction.js
rename to Source/ProjectWeb/src/components/actions/base/AddAction.js
diff --git a/Source/ProjectWeb/src/actions/base/BaseAction.js b/Source/ProjectWeb/src/components/actions/base/BaseAction.js
similarity index 93%
rename from Source/ProjectWeb/src/actions/base/BaseAction.js
rename to Source/ProjectWeb/src/components/actions/base/BaseAction.js
index 528de61..732231c 100644
--- a/Source/ProjectWeb/src/actions/base/BaseAction.js
+++ b/Source/ProjectWeb/src/components/actions/base/BaseAction.js
@@ -65,17 +65,22 @@
//閫氱敤action
const handlers = {
//鏌ョ湅
- view: () => {},
+ view: () => {import("@/components/actions/base/TabViewAction").then(module => {
+ module.doAction(options,callback);
+ })},
//鍒涘缓
- add: () => {import("@/actions/base/AddAction").then(module => {
+ add: () => {import("@/components/actions/base/AddAction").then(module => {
module.doAction(options,callback);
})},
//淇敼
- edit: () => {import("@/actions/base/EditAction").then(module => {
+ edit: () => {import("@/components/actions/base/EditAction").then(module => {
module.doAction(options,callback);
})},
//鍒犻櫎
- delete: () => {import("@/actions/base/DeleteAction").then(module => {
+ delete: () => {import("@/components/actions/base/DeleteAction").then(module => {
+ module.doAction(options,callback);
+ })}, //鍒犻櫎
+ del: () => {import("@/components/actions/base/DeleteAction").then(module => {
module.doAction(options,callback);
})},
};
diff --git a/Source/ProjectWeb/src/actions/base/DeleteAction.js b/Source/ProjectWeb/src/components/actions/base/DeleteAction.js
similarity index 95%
rename from Source/ProjectWeb/src/actions/base/DeleteAction.js
rename to Source/ProjectWeb/src/components/actions/base/DeleteAction.js
index 1e199a6..db1d00b 100644
--- a/Source/ProjectWeb/src/actions/base/DeleteAction.js
+++ b/Source/ProjectWeb/src/components/actions/base/DeleteAction.js
@@ -81,7 +81,7 @@
* @param callback 鍥炶皟
*/
export const doBefore = (options,callback)=> {
- Vue.prototype.$message.success('鎵ц鍒犻櫎鍓嶇疆浜嬩欢');
+ console.log('鎵ц鍒犻櫎鍓嶇疆浜嬩欢');
if(callback){
callback(options);
}
@@ -92,7 +92,7 @@
* @param callback 鍥炶皟
*/
export const doAfter = (options,callback,actionType)=> {
- Vue.prototype.$message.success('鎵ц鍒犻櫎鍚庣疆浜嬩欢');
+ console.log('鎵ц鍒犻櫎鍚庣疆浜嬩欢');
if(callback){
callback(actionType);
}
diff --git a/Source/ProjectWeb/src/actions/base/EditAction.js b/Source/ProjectWeb/src/components/actions/base/EditAction.js
similarity index 95%
rename from Source/ProjectWeb/src/actions/base/EditAction.js
rename to Source/ProjectWeb/src/components/actions/base/EditAction.js
index c9fd534..563f16b 100644
--- a/Source/ProjectWeb/src/actions/base/EditAction.js
+++ b/Source/ProjectWeb/src/components/actions/base/EditAction.js
@@ -85,7 +85,7 @@
* @param callback 鍥炶皟
*/
export const doBefore = (options,callback)=> {
- Vue.prototype.$message.success('鎵ц淇敼鍓嶇疆浜嬩欢');
+ console.log('鎵ц淇敼鍓嶇疆浜嬩欢');
if(callback){
callback(options);
}
@@ -96,7 +96,7 @@
* @param callback 鍥炶皟
*/
export const doAfter = (options,callback,actionType)=> {
- Vue.prototype.$message.success('鎵ц淇敼鍚庣疆浜嬩欢');
+ console.log('鎵ц淇敼鍚庣疆浜嬩欢');
if(callback){
callback(actionType);
}
diff --git a/Source/ProjectWeb/src/components/actions/base/TabViewAction.js b/Source/ProjectWeb/src/components/actions/base/TabViewAction.js
new file mode 100644
index 0000000..9430fa9
--- /dev/null
+++ b/Source/ProjectWeb/src/components/actions/base/TabViewAction.js
@@ -0,0 +1,98 @@
+/**
+ * 鎸夐挳澶勭悊 椤甸潰灞曠ず涓簍ab閫夐」鍗�
+ */
+import {paramLow,callPreEvent,callPostEvent,replaceFreeMarker} from './BaseAction';
+import {validatenull} from "@/util/validate";
+import Vue from "vue";
+import AddEditDialog from "@/components/actions/AddEditDialog";
+import Layout from "@/router/page";
+import router from '@/router/router';
+
+export const doAction = (options,callback) => {
+ const paramVOS = Object.assign({
+ getdataurl: '/api/uiDataController/dataFormQuery',
+ getdatamethod: 'post',
+ url: '/api/uiDataController/editSave',
+ method: 'put',
+ uploadfileurl: 'vciFileUploadController/uploadFile'
+ }, options.paramVOS)
+ options.paramVOS = paramVOS;
+
+ options.sourceData = options.sourceData || {};
+ options.dataStore = options.dataStore || [];
+ if (!options.dataStore || options.dataStore.length < 1) {
+ Vue.prototype.$message.error("璇烽�夋嫨闇�瑕佹祻瑙堢殑鏁版嵁");
+ return false;
+ }
+ if (!paramVOS.multi && options.dataStore.length > 1) {
+ Vue.prototype.$message.error("浠呰兘閫夋嫨涓�鏉℃暟鎹潵鎿嶄綔");
+ return false;
+ }
+
+ callPreEvent(options, doBefore, function (options) {
+ doView(options, function (type,formData) {
+ callPostEvent(options, doAfter,type, callback);
+ });
+ });
+};
+
+/**
+ * 鎵ц
+ * @param options 鎸夐挳鐨勯厤缃俊鎭�
+ * @param callback 鍥炶皟
+ */
+export const doView = (options,callback)=> {
+ const paramVOS = options.paramVOS;
+ let component = '@/views/base/UIContentViewerInDialog';
+ if (!validatenull(paramVOS.customurl)) {
+ //鑷畾涔塲s
+ component = `@/views/custom-ui/` + paramVOS.customurl;
+ }else{
+ if (!paramVOS['type'] || !paramVOS['context']) {
+ Vue.prototype.$message.error("鎸夐挳閰嶇疆涓嶆纭�");
+ return false;
+ }
+ }
+ let name="鏌ョ湅鏁版嵁"
+ if(paramVOS.showname){
+ name=replaceFreeMarker(paramVOS.showname,options.dataStore,options.sourceData)
+ }
+ router.addRoutes({
+ path: '/view-form'+options.dataStore[0].oid,
+ name: name,
+ component: Layout,
+ meta: {
+ keepAlive: true,
+ isTab: true
+ },
+ children: [
+ {
+ path: '', // 绌鸿矾寰勮〃绀鸿闂� '/dynamic-form' 鏃跺姞杞� Layout 缁勪欢
+ component: () => import(component),
+ props: true
+ }
+ ]
+ })
+}
+/**
+ * 鍓嶇疆浜嬩欢
+ * @param options 鎸夐挳鐨勯厤缃俊鎭�
+ * @param callback 鍥炶皟
+ */
+export const doBefore = (options,callback)=> {
+ console.log('鎵ц鏌ョ湅鍓嶇疆浜嬩欢');
+ if(callback){
+ callback(options);
+ }
+}
+/**
+ * 鍚庣疆浜嬩欢
+ * @param options 鎸夐挳鐨勯厤缃俊鎭�
+ * @param callback 鍥炶皟
+ */
+export const doAfter = (options,callback,actionType)=> {
+ console.log('鎵ц鏌ョ湅鍚庣疆浜嬩欢');
+ if(callback){
+ callback(actionType);
+ }
+}
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue
index 0f9ca1a..8390cda 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue
@@ -5,21 +5,22 @@
<!--top灞曠ず琛ㄦ牸涓婃柟鍖哄煙 menu灞曠ず琛ㄦ牸鎿嶄綔鏍忓尯鍩� 鏃犲氨鏄粯璁� -->
<el-button v-for="item in basicButtonList.top"
v-if="LocationType === 'top'"
- :key="item.oid" :icon="item.paramVOS.webUiButtonIcon"
- :type="item.paramVOS.webUiButtonType || 'primary'" plain
+ :key="item.oid" :icon="item.paramVOS.icon"
+ :type="item.paramVOS.btnType || 'primary'" plain
size="small"
@click="buttonClick(item)">
{{ item.name }}
</el-button>
- <el-button type="text" @click="handleDefaultAddChildren(scope.row)" v-if="(LocationType === 'menu' && this.default === 'default')">鏂板瀛愮骇</el-button>
+ <el-button type="text" @click="handleDefaultAddChildren(scope.row)" v-if="(LocationType === 'menu' && type === 'TreeTable')">鏂板瀛愮骇</el-button>
+ <el-button type="text" icon="el-icon-view" size="small" plain @click="$emit('rowView',scope.row,scope.index)" v-if="LocationType === 'menu'">鏌ョ湅</el-button>
<el-button v-for="item in basicButtonList.menu"
v-if="LocationType === 'menu'"
:key="item.oid"
- :icon="item.paramVOS.webUiButtonIcon ? item.paramVOS.webUiButtonIcon : (item.paramVOS.webUiButtonMethods === 'edit' ? 'el-icon-edit' : (item.paramVOS.webUiButtonMethods === 'delete' ? 'el-icon-delete' : ''))"
- :type="item.paramVOS.webUiButtonType || 'text'" plain
+ :icon="item.paramVOS.icon ? item.paramVOS.icon : (item.id === 'edit' ? 'el-icon-edit' : (item.id === 'delete' ||item.id === 'del' ? 'el-icon-delete' : ''))"
+ :type="item.paramVOS.btnType || 'text'" plain
size="small"
- @click="buttonClick(item)">
+ @click="buttonClick(item,scope.row)">
{{ item.name }}
</el-button>
@@ -31,8 +32,8 @@
<div v-else-if="type === 'form'">
<el-button v-for="item in basicButtonList"
:key="item.oid"
- :icon="item.paramVOS.webUiButtonIcon"
- :type="(item.paramVOS.webUiButtonType !== 'text' ? item.paramVOS.webUiButtonType : 'primary') || 'primary'"
+ :icon="item.paramVOS.icon"
+ :type="item.paramVOS.btnType || 'primary'"
plain
size="small"
@click="buttonClick(item)">
@@ -42,12 +43,18 @@
<div v-else-if="type === 'tree'" class="tree-buttons">
<el-button v-for="item in basicButtonList"
:key="item.oid"
- :icon="item.paramVOS.webUiButtonIcon"
- :type="(item.paramVOS.webUiButtonType !== 'text' ? item.paramVOS.webUiButtonType : 'primary') || 'primary'"
+ :icon="item.paramVOS.icon"
+ :type="item.paramVOS.btnType || 'primary'"
plain
size="small"
@click="buttonClick(item)">
{{ item.name }}
+ </el-button>
+ <el-button type="primary"
+ plain
+ size="small"
+ @click="$emit('refresh')">
+ 鍒锋柊
</el-button>
</div>
</div>
@@ -56,7 +63,7 @@
<script>
import func from "@/util/func";
import {validatenull} from "@/util/validate";
-import {doAction} from '@/actions/base/BaseAction';
+import {doAction} from '@/components/actions/base/BaseAction';
import Vue from "vue";
export default {
@@ -77,9 +84,6 @@
},
butttonList: {
type: Array
- },
- default:{
- type:String,
},
sourceData: {
//鎸夐挳鎵�灞炲尯鍩熺殑涓婁竴鍖哄煙閫変腑鏁版嵁
@@ -111,10 +115,20 @@
return basicColumn;
} else if (this.type === 'table' || this.type === 'TreeTable') {
const top = basicColumn.filter(item => {
- return item.paramVOS && (item.paramVOS.webUiButtonLocation === 'top' || func.isEmpty(item.paramVOS.webUiButtonLocation));
+ if (item.paramVOS && item.paramVOS.webUiButtonLocation && item.paramVOS.webUiButtonLocation !== 'menu') {
+ return true;
+ } else if (item.id != "edit" && item.id != "del" && item.id != "delete" && item.id != "refresh") {
+ return true;
+ }
+ return false
});
const menu = basicColumn.filter(item => {
- return item.paramVOS && item.paramVOS.webUiButtonLocation === 'menu';
+ if (item.paramVOS && item.paramVOS.webUiButtonLocation && item.paramVOS.webUiButtonLocation === 'menu') {
+ return true
+ } else if (item.id == "edit" || item.id == "del" || item.id == "delete"){
+ return true;
+ }
+ return false;
});
return {
top: top,
@@ -130,7 +144,7 @@
this.formName = '鏂板瀛愮骇'
this.$refs.dynamicForm.form = row;
},
- buttonClick(buttonitem) {
+ buttonClick(buttonitem,rowData) {
const paramVOS = buttonitem.paramVOS;
const DefineVO = this.componentVO.treeDefineVO || this.componentVO.tableDefineVO || this.componentVO.treeTableDefineVO || this.componentVO.formDefineVO;
if (!paramVOS['title']) {
@@ -150,7 +164,7 @@
//paramVOS.customBtn //寮圭獥榛樿鏈変繚瀛樻寜閽�,customBtn涓簍rue鏃跺唴瀹瑰睍绀鸿嚜瀹氫箟鎸夐挳
doAction(buttonitem, {
paramVOS: paramVOS,
- dataStore: this.dataStore || [],
+ dataStore: rowData || this.dataStore || [],
sourceData: this.sourceData || {}
}, function (actionType,data) {
that.$emit("afterMethod",actionType,data);
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
index 46ba5ad..a529811 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
@@ -167,7 +167,7 @@
}
if (Object.keys(this.sourceData).length>0 && this.isShow && this.actionType!="add") {
this.loading = true;
- dataForm(this.params).then(res => {
+ dataForm(this.params, this.paramVOS.getdataurl, this.paramVOS.getdatamethod).then(res => {
this.form = res.data.obj;
this.loading = false;
}).catch(error => {
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
index 4db1f97..2e17737 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
@@ -13,7 +13,7 @@
@size-change="sizeChange"
@row-click="rowClickChange"
@search-change='searchChange'
- @filter-change="filterChange"
+ @filter="filterChange"
@selection-change="selectChange">
<!--top鍖哄煙鎸夐挳-->
<template slot="menuLeft" slot-scope="scope">
@@ -29,6 +29,7 @@
<dynamic-button :componentVO="componentVO" :butttonList="componentVO.buttons" :scope="scope" :dataStore="selectList" :sourceData="sourceData"
LocationType="menu"
@afterMethod="handleRefresh"
+ @rowView="rowView"
type="table"></dynamic-button>
</template>
<template slot="menuRight" slot-scope="scope">
@@ -144,6 +145,7 @@
filterBtn:false,
selection: true,
tip: false,
+ menuWidth:260,
height: '100%',
calcHeight: 15,
indexFixed: false,
@@ -313,7 +315,7 @@
onLoad(page, params = {}) {
if (Object.keys(this.sourceData).length>0 && this.isShow) {
this.loading = true;
- getList(page.currentPage, page.pageSize, Object.assign(params,this.params,this.query)).then(res => {
+ getList(page.currentPage, page.pageSize, Object.assign({},this.params,this.query,params)).then(res => {
let data = [];
if (res.data && res.data.data) {
data = res.data.data;
@@ -334,6 +336,9 @@
});
}
},
+ rowView(row,index){
+ this.$refs.dataTable.rowView(row,index)
+ },
rowClickChange(row){
this.$refs.dataTable.toggleRowSelection(row);
},
@@ -353,14 +358,33 @@
this.page.pageSize = pageSize;
},
searchChange(params,done){
- this.query = params;
+ this.query = {};
+ for (let i in params) {
+ this.query['conditionMap["' + i + '"]'] = "*" + params[i] + "*";
+ }
this.page.currentPage = 1;
this.onLoad(this.page);
done();
},
filterChange(result){
- debugger;
-
+ let parms={}
+ for (let i in result) {
+ if(!validatenull(result[i][2])) {
+ const fieldVal = result[i][2]
+ if (result[i][1] == "=") {
+ parms['conditionMap["' + result[i][0] + '"]'] = fieldVal;
+ } else if (result[i][1] == "鈮�") {
+ parms['conditionMap["' + result[i][0] + '"]'] = '!=' + fieldVal;
+ } else if (result[i][1] == "like") {
+ parms['conditionMap["' + result[i][0] + '"]'] = "*" + fieldVal + "*";
+ } else if (result[i][1] == "鈭�") {
+ parms['conditionMap["' + result[i][0] + '"]'] = "*" + fieldVal + "*";
+ } else {
+ parms['conditionMap["' + result[i][0] + '"]'] = result[i][1] + fieldVal;
+ }
+ }
+ }
+ this.onLoad(this.page,parms);
},
searchReset() {
this.query = {};
@@ -375,7 +399,7 @@
}
},
handleRefresh(type) {
- this.onLoad(this.page, this.query);
+ this.onLoad(this.page);
},
rowExcel() {
//瀵煎嚭
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue
index f2097ff..527e2e5 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue
@@ -4,6 +4,7 @@
:key="areasName+'buttons-'+componentVO.oid"
:butttonList="componentVO.buttons" :dataStore="checkDatas"
@afterMethod="handleRefresh"
+ @refresh="initData"
:sourceData="sourceData" type="tree" style="margin-bottom: 5px;"></dynamic-button>
<el-input
placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�"
@@ -155,10 +156,6 @@
}
},
created() {
- this.getParams();
- if (!this.lazy) {
- this.initData();
- }
},
mounted() {
if(this.componentVO.buttons && this.componentVO.buttons.length>0){
@@ -223,6 +220,7 @@
this.params = Object.assign({}, treeParams, sourceDataMapList);
},
initData() {
+ this.data=[];
if (Object.keys(this.sourceData).length > 0 && this.isShow) {
getTree(null, null, Object.assign({
queryRoot: true
--
Gitblit v1.9.3