From 5a00f7eec311c7b71b40df4beaded505eca5329c Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期四, 11 四月 2024 17:49:23 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
Source/ProjectWeb/src/actions/base/AddAction.js | 52 ++++++++++
Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue | 21 +--
Source/ProjectWeb/src/actions/base/BaseAction.js | 98 +++++++++++++------
Source/ProjectWeb/src/views/base/UIContentArea.vue | 97 +++++++++++++++++--
Source/ProjectWeb/src/components/dynamic-components/dynamic-TreeTable.vue | 1
Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue | 8
Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue | 1
7 files changed, 219 insertions(+), 59 deletions(-)
diff --git a/Source/ProjectWeb/src/actions/base/AddAction.js b/Source/ProjectWeb/src/actions/base/AddAction.js
index 8d0e0e8..fc16632 100644
--- a/Source/ProjectWeb/src/actions/base/AddAction.js
+++ b/Source/ProjectWeb/src/actions/base/AddAction.js
@@ -1,4 +1,54 @@
/**
* 鎸夐挳澶勭悊 涓氬姟绫诲瀷鏂板
*/
-import BaseAction from './BaseAction';
+import {callPreEvent,callPostEvent} from './BaseAction';
+import {validatenull} from "@/util/validate";
+
+export const doAction = (options) => {
+ let paramVOS = Object.assign({
+ url: 'uiDataController/addSave',
+ method: 'post',
+ uploadFileUrl: 'vciFileUploadController/uploadFile'
+ }, options.paramVOS)
+ options.paramVOS = paramVOS;
+
+ callPreEvent(options, doBefore,function (options) {
+ doAdd(options, function () {
+ callPostEvent(options,doAfter, options.callback);
+ });
+ });
+};
+
+/**
+ * 鎵ц
+ * @param options 鎸夐挳鐨勯厤缃俊鎭�
+ * @param callback 鍥炶皟
+ */
+export const doAdd = (options,callback)=> {
+ this.$message.success('鎵ц澧炲姞');
+ if(callback){
+ callback(options);
+ }
+}
+/**
+ * 鍓嶇疆浜嬩欢
+ * @param options 鎸夐挳鐨勯厤缃俊鎭�
+ * @param callback 鍥炶皟
+ */
+export const doBefore = (options,callback)=> {
+ this.$message.success('鎵ц鍓嶇疆浜嬩欢');
+ if(callback){
+ callback(options);
+ }
+}
+/**
+ * 鍚庣疆浜嬩欢
+ * @param options 鎸夐挳鐨勯厤缃俊鎭�
+ * @param callback 鍥炶皟
+ */
+export const doAfter = (options,callback)=> {
+ this.$message.success('鎵ц鍚庣疆浜嬩欢');
+ if(callback){
+ callback(options);
+ }
+}
diff --git a/Source/ProjectWeb/src/actions/base/BaseAction.js b/Source/ProjectWeb/src/actions/base/BaseAction.js
index 528dbe4..e2583fe 100644
--- a/Source/ProjectWeb/src/actions/base/BaseAction.js
+++ b/Source/ProjectWeb/src/actions/base/BaseAction.js
@@ -1,9 +1,36 @@
import {validatenull} from "@/util/validate";
-import {findArray} from "@/util/util";
/**
* 鎸夐挳鐨勫熀纭�鏈嶅姟
*/
+
+/**
+ * action閫氱敤鍏ュ彛
+ */
+export const doAction = (button,options) => {
+ debugger;
+ if(button.url && button.url!='null'){
+ let buttonParse = parseEventByUrl(button.url,options,false);
+ import("../"+buttonParse.jsPath).then(module => {
+ module.doAction(options);
+ })
+ }else {
+ const handlers = {
+ add: () => {import("@/actions/base/AddAction").then(module => {
+ module.doAction(options);
+ })},
+ edit: () => {},
+ delete: () => {},
+ };
+ if(handlers[button.actionVO.id]){
+ handlers[button.actionVO.id]()
+ }else{
+ this.$message.error('鏈壘鍒板搴攁ction锛岃閲嶆柊閰嶇疆鎸夐挳锛�');
+ }
+ }
+
+};
+
/**
* 鏇挎崲鏂囨湰涓殑${xxx}
@@ -28,7 +55,7 @@
let temp = text.substring(0, text.indexOf(reg));
let field = text.substring(text.indexOf(reg) + reg.length, text.indexOf("}"));
let end = text.substring(text.indexOf("}") + 1);
- field = replaceData[field] || sourceData[field] || '';
+ field = sourceData[field] || '';
text = temp + field + end;
}
reg = "sourceData.${";
@@ -36,7 +63,7 @@
let temp = text.substring(0, text.indexOf(reg));
let field = text.substring(text.indexOf(reg) + reg.length, text.indexOf("}"));
let end = text.substring(text.indexOf("}") + 1);
- field = replaceData[field] || sourceData[field] || '';
+ field = sourceData[field] || '';
text = temp + field + end;
}
reg = "${";
@@ -44,7 +71,7 @@
let temp = text.substring(0, text.indexOf(reg));
let field = text.substring(text.indexOf(reg) + reg.length, text.indexOf("}"));
let end = text.substring(text.indexOf("}") + 1);
- field = replaceData[field] || sourceData[field] || '';
+ field = replaceData[field] || '';
text = temp + field + end;
}
}
@@ -70,23 +97,26 @@
/**
* 鎵ц鍓嶇疆浜嬩欢
* @param options 鎸夐挳鐨勯厤缃俊鎭紝鍓嶇疆浜嬩欢閲岄厤缃殑鍙傛暟浼氭浛鎹㈣繖涓噷鐨勫弬鏁扮殑淇℃伅
- * @param buttonTarget 鎸夐挳js鎵�鍦ㄧ殑瀵硅薄
+ * @param fnTarget 鎵ц鏂规硶
* @param callback 鍥炶皟锛屽鏋滃瓨鍦ㄥ墠缃簨浠讹紝浼氬湪鎵ц瀹屾垚鍚庢墽琛屽洖璋冿紝鍚﹀垯鐩存帴鍥炶皟
* @param preEventName 鍓嶇疆浜嬩欢鍚嶇О锛岄粯璁eforeevent
*/
-export const callPreEvent = (options,buttonTarget,callback,preEventName) => {
+export const callPreEvent = (options,fnTarget,callback,preEventName) => {
const params = paramLow(options.paramVOS);
options.paramVOS = params;
let beforeEvent = params[preEventName || 'beforeevent'];
if(beforeEvent) {
let buttonParse = parseEventByUrl(beforeEvent,options,true);
- buttonParse.options.callback = callback;
- if(validatenull(buttonParse)){
- buttonTarget[buttonParse.methodName](buttonParse);
+ if(validatenull(buttonParse.jsPath)){
+ fnTarget(buttonParse,callback);
}else{
- layui.use(buttonParse.jsPath,function () {
- layui[buttonParse.jsPath][buttonParse.methodName](options);
- });
+ try {
+ import("../"+buttonParse.jsPath).then(module => {
+ module[buttonParse.methodName](options,callback);
+ })
+ } catch (error) {
+ this.$message.error('鏈壘鍒板墠缃簨浠舵墽琛宩s');
+ }
}
}else{
if(callback){
@@ -95,22 +125,28 @@
}
};
/**
- * 鎵ц鍚庣疆鏃堕棿
+ * 鎵ц鍚庣疆浜嬩欢
* @param options 鎸夐挳鐨勯厤缃俊鎭紝鍚庣疆浜嬩欢閲岄厤缃殑鍙傛暟浼氭浛鎹㈣繖涓噷鐨勫弬鏁扮殑淇℃伅
- * @param buttonTarget 鎸夐挳Js鎵�鍦ㄧ殑瀵硅薄
+ * @param fnTarget 鎵ц鏂规硶
+ * @param callback 鍥炶皟锛屽鏋滃瓨鍦ㄥ悗缃簨浠讹紝浼氬湪鎵ц瀹屾垚鍚庢墽琛屽洖璋冿紝鍚﹀垯鐩存帴鍥炶皟
+ * @param preEventName 鍚庣疆浜嬩欢鍚嶇О锛岄粯璁� afterevent
*/
-export const callPostEvent = (options,buttonTarget,callback,postEventName)=>{
+export const callPostEvent = (options,fnTarget,callback,postEventName)=>{
const params = paramLow(options.paramVOS);
options.paramVOS = params;
- var afterEvent = params[postEventName || 'afterevent'];
+ let afterEvent = params[postEventName || 'afterevent'];
if(afterEvent) {
- var buttonParse = parseEventByUrl(afterEvent,options,false);
- if(validatenull(buttonParse)){
- buttonTarget[buttonParse.methodName](buttonParse);
+ let buttonParse = parseEventByUrl(afterEvent,options,false);
+ if(validatenull(buttonParse.jsPath)){
+ fnTarget(buttonParse,callback);
}else{
- layui.use(buttonParse.jsPath,function () {
- layui[buttonParse.jsPath][buttonParse.methodName](options);
- });
+ try {
+ import("../"+buttonParse.jsPath).then(module => {
+ module[buttonParse.methodName](options,callback);
+ })
+ } catch (error) {
+ this.$message.error('鏈壘鍒板悗缃簨浠舵墽琛宩s');
+ }
}
}else{
if(callback){
@@ -127,13 +163,13 @@
*/
export const parseEventByUrl = (url,options,isBefore) => {
//鏍规嵁閰嶇疆鏍煎紡鍖栦簨浠�
- var jsPath = url;
- var methodName = isBefore?"doBefore":"doAfter";
- var params = {};
+ let jsPath = url;
+ let methodName = isBefore?"doBefore":"doAfter";
+ let params = {};
if (url.indexOf("?")) {
- var temp = url.substring(0, url.indexOf("?"));
+ let temp = url.substring(0, url.indexOf("?"));
if (temp.indexOf("#") > -1) {
- var array = temp.split("#");
+ let array = temp.split("#");
if(array.length == 1){
jsPath = array[0];
}else{
@@ -143,17 +179,17 @@
}else{
jsPath = temp;
}
- var paramArray = url.substring(url.indexOf("?") + 1).split("&");
- layui.each(paramArray, function (_index, _item) {
+ let paramArray = url.substring(url.indexOf("?") + 1).split("&");
+ paramArray.forEach(_item=>{
if (_item.indexOf("=") < 0) {
this.$message.error(isBefore?"鍓嶇疆浜嬩欢":"鍚庣疆浜嬩欢" + "鐨勫弬鏁伴厤缃敊璇紝闇�瑕佽xxx=yyy&zzz=a鐨勬柟寮�");
return true;
}
params[_item.split("=")[0]] = _item.split("=")[1];
- });
+ })
}else{
if (url.indexOf("#") > -1) {
- var array = url.split("#");
+ let array = url.split("#");
if(array.length == 1){
jsPath = array[0];
}else{
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-TreeTable.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-TreeTable.vue
index b563d16..72354eb 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-TreeTable.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-TreeTable.vue
@@ -396,6 +396,7 @@
this.TreeSelectList = row;
this.$emit("setDataStore", {
area: this.areasName,
+ type:this.componentVO.uiComponentType,
dataStore:row
});
},
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue
index 2aa8c65..7b8dee8 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue
@@ -56,6 +56,7 @@
<script>
import func from "@/util/func";
import {validatenull} from "@/util/validate";
+import {doAction} from '@/actions/base/BaseAction';
export default {
name: "dynamic-button",
@@ -278,18 +279,14 @@
this.$refs.dynamicForm.form = row;
},
buttonClick(item) {
- // 鏍规嵁 type 鏉′欢鍔ㄦ�佸紩鍏ヤ笉鍚岀殑JS鏂囦欢锛屽苟浼犻�� item this 鍙傛暟
- if (this.type === 'table') {
- import('@/views/base/buttonTable').then(module => {
- const buttonClickTable = module.default;
- buttonClickTable.buttonClick(item,this);
- })
- } else if (this.type === 'form') {
- import('@/views/base/buttonForm').then(module => {
- const buttonClickForm = module.default;
- buttonClickForm.buttonClick(item,this);
- })
- }
+ doAction(item,{
+ paramVOS: item.paramVOS,
+ dataStore: [],
+ sourceData: {},
+ callback: function (){
+
+ }
+ });
}
},
}
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
index 5c04b55..f4495f6 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
@@ -555,14 +555,14 @@
},
selectChange(row) {
this.selectList = row;
- },
- searchChange(form,done){
- console.log(form)
- done()
this.$emit("setDataStore", {
area: this.areasName,
+ type:this.componentVO.uiComponentType,
dataStore:row
});
+ },
+ searchChange(form,done){
+ done();
}
}
}
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue
index f6b272f..4cc211c 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue
@@ -75,6 +75,7 @@
if(newval) {
this.$emit("setDataStore", {
area: this.areasName,
+ type:this.componentVO.uiComponentType,
dataStore:newval
});
}
diff --git a/Source/ProjectWeb/src/views/base/UIContentArea.vue b/Source/ProjectWeb/src/views/base/UIContentArea.vue
index 3a368ff..41c9ee3 100644
--- a/Source/ProjectWeb/src/views/base/UIContentArea.vue
+++ b/Source/ProjectWeb/src/views/base/UIContentArea.vue
@@ -1,7 +1,7 @@
<template>
<basic-container :cradStyle="cradStyle" cardBodyStyle="height:100%;box-sizing: border-box;padding-bottom:5px;">
- <el-tabs style="height: 100%;" class="UITabs" v-if="areasData.length>1" v-model="activeName" type="card" @tab-click="tabHandleClick">
- <el-tab-pane style="height:100%;overflow: auto" v-for="(areaItem,index) in areasData" :key="areaItem.oid" :label="areaItem.name" :name="areasName+'-Tab-'+index">
+ <el-tabs style="height: 100%;" class="UITabs" v-if="newAreasData.length>1" v-model="activeName" type="card" @tab-click="tabHandleClick">
+ <el-tab-pane style="height:100%;overflow: auto" v-for="(areaItem,index) in newAreasData" :key="areaItem.oid" :label="areaItem.name" :name="areasName+'-Tab-'+index">
<el-collapse class="UI-collapse" :key="areaItem.oid+'-collapse'" v-model="collapseActiveNames" v-if="areaItem.componentVOs.length>1" @change="handleChange">
<el-collapse-item v-for="(componentVO,componentIndex) in areaItem.componentVOs" :name="areasName+'-collapse-'+componentIndex">
<template slot="title">
@@ -11,7 +11,7 @@
<compoent-index :key="areasName+'componentVO-'+componentVO.oid"
:inDialog="inDialog"
:componentVO="componentVO"
- :sourceData="sourceData"
+ :sourceData="newSourceData"
:dataStore="dataStore"
:areasName="areasName"
:paramVOS="paramVOS"
@@ -24,7 +24,7 @@
<compoent-index :key="areasName+'componentVO-'+areaItem.componentVOs[0].oid"
:inDialog="inDialog"
:componentVO="areaItem.componentVOs[0]"
- :sourceData="sourceData"
+ :sourceData="newSourceData"
:dataStore="dataStore"
:areasName="areasName"
:paramVOS="paramVOS"
@@ -33,9 +33,9 @@
</div>
</el-tab-pane>
</el-tabs>
- <div v-else style="height:100%;overflow: auto">
- <el-collapse class="UI-collapse" :key="areasData[0].oid+'-collapse'" v-model="collapseActiveNames" v-if="areasData[0].componentVOs.length>1" @change="handleChange">
- <el-collapse-item v-for="(componentVO,componentIndex) in areasData[0].componentVOs" :name="areasName+'-collapse-'+componentIndex">
+ <div v-else-if="newAreasData.length===1" style="height:100%;overflow: auto">
+ <el-collapse class="UI-collapse" :key="newAreasData[0].oid+'-collapse'" v-model="collapseActiveNames" v-if="newAreasData[0].componentVOs.length>1" @change="handleChange">
+ <el-collapse-item v-for="(componentVO,componentIndex) in newAreasData[0].componentVOs" :name="areasName+'-collapse-'+componentIndex">
<template slot="title">
{{componentVO.name}}
</template>
@@ -43,7 +43,7 @@
<compoent-index :key="areasName+'componentVO-'+componentVO.oid"
:inDialog="inDialog"
:componentVO="componentVO"
- :sourceData="sourceData"
+ :sourceData="newSourceData"
:dataStore="dataStore"
:areasName="areasName"
:paramVOS="paramVOS"
@@ -53,10 +53,10 @@
</el-collapse-item>
</el-collapse>
<div v-else class="componentVO">
- <compoent-index :key="areasName+'componentVO-'+areasData[0].componentVOs[0].oid"
+ <compoent-index :key="areasName+'componentVO-'+newAreasData[0].componentVOs[0].oid"
:inDialog="inDialog"
- :componentVO="areasData[0].componentVOs[0]"
- :sourceData="sourceData"
+ :componentVO="newAreasData[0].componentVOs[0]"
+ :sourceData="newSourceData"
:dataStore="dataStore"
:areasName="areasName"
:paramVOS="paramVOS"
@@ -64,11 +64,42 @@
:isShow="true"></compoent-index>
</div>
</div>
+ <div v-else>
+ <el-alert
+ v-if="areasData.length==0"
+ class="alert"
+ :closable="false"
+ title="閰嶇疆閿欒"
+ type="error"
+ show-icon
+ description="璇ュ尯鍩熸病鏈夐厤缃樉绀虹殑鍐呭">
+ </el-alert>
+ <el-alert
+ v-else-if="Object.keys(newSourceData).length === 0"
+ class="alert"
+ :closable="false"
+ title="婧愭暟鎹负绌�"
+ type="error"
+ show-icon
+ description="涓嶆弧瓒虫樉绀鸿〃杈惧紡鏉′欢锛屾病鏈夊彲鏄剧ず鐨勫唴瀹�">
+ </el-alert>
+ <el-alert
+ v-else
+ class="alert"
+ :closable="false"
+ title=""
+ type="error"
+ show-icon
+ description="涓嶆弧瓒虫樉绀鸿〃杈惧紡鏉′欢锛屾病鏈夊彲鏄剧ず鐨勫唴瀹广��">
+ </el-alert>
+ {{newSourceData}}
+ </div>
</basic-container>
</template>
<script>
import compoentIndex from "@/components/dynamic-components/index"
+import {validatenull, verifyNotNull} from "@/util/validate";
export default {
name: "UIContentArea",
components:{compoentIndex},
@@ -107,10 +138,54 @@
collapseActiveNames:[this.areasName+'-collapse-0']
}
},
+ computed:{
+ newAreasData(){
+ let newAreasData = [];
+ this.areasData.forEach(areaData => {
+ //楠岃瘉鏄惧紡琛ㄨ揪寮�
+ if (!validatenull(areaData.displayExpression)) {
+ if (this.checkDisplayExpression(areaData.displayExpression)) {
+ newAreasData.push(areaData)
+ }
+ } else {
+ newAreasData.push(areaData)
+ }
+ })
+ return newAreasData;
+ },
+ newSourceData(){
+ if(this.sourceData.attributes && this.sourceData.parentId!=undefined && this.sourceData.parentId !=null){
+ //婧愭暟鎹槸鏍戣妭鐐�
+ return this.sourceData.attributes
+ }
+ return this.sourceData;
+ }
+ },
+ created() {
+
+ },
mounted() {
// console.log(this.areasData);
},
methods:{
+ checkDisplayExpression(displayExpressionStr){
+ //"${folderbusinesstype}"<>"workunit" and "${folderbusinesstype}"<>"part" and "${folderbusinesstype}"<>"Terminology" and "${folderbusinesstype}"<>"AssMaterial" and "${folderbusinesstype}"<>"resourcelib" and "${folderbusinesstype}"<>"material" and "${folderbusinesstype}"<>"machine"
+ // "${folderbusinesstype}"="AssMaterial" or "${folderbusinesstype}"="assmaterial"
+ //"${folderbusinesstype}"="material"
+ //${folderbusinesstype}涓烘簮鏁版嵁涓殑灞炴��
+
+ let checkdisplay=false;
+ //鏇挎崲and鍜宱r
+ let newDisplayExpressionStr=displayExpressionStr.replace(/"\s*and\s*"/g,'" && "').replace(/"\s*AND\s*"/g,'" && "').replace(/"\s*or\s*"/g,'" || "').replace(/"\s*OR\s*"/g,'" || "');
+ newDisplayExpressionStr=newDisplayExpressionStr.replace(/"\s*<>\s*"/g,'" != "').replace(/"\s*=\s*"/g,'" == "');
+ newDisplayExpressionStr=newDisplayExpressionStr.replace(/"\$\{/g,'this.newSourceData.').replace(/\}"/g,'')
+
+ const sandbox = {};
+ if(eval('('+newDisplayExpressionStr+')')){
+ checkdisplay=true;
+ }
+ return checkdisplay;
+ },
tabHandleClick(tab, event) {
// console.log(tab, event);
},
--
Gitblit v1.9.3