| | |
| | | </el-collapse> |
| | | <div v-else class="componentVO"> |
| | | <compoent-index :key="areasName+'componentVO-'+areaItem.componentVOs[0].oid" |
| | | :uiBtmType="uiBtmType" |
| | | :uiContext="uiContext" |
| | | :inDialog="inDialog" |
| | | :componentVO="areaItem.componentVOs[0]" |
| | | :sourceData="newSourceData" |
| | | :sourceBtmType="sourceBtmType" |
| | | :dataStore="dataStore" |
| | | :areasName="areasName" |
| | | :paramVOS="paramVOS" |
| | |
| | | </template> |
| | | <div class="componentVO"> |
| | | <compoent-index :key="areasName+'componentVO-'+componentVO.oid" |
| | | :uiBtmType="uiBtmType" |
| | | :uiContext="uiContext" |
| | | :inDialog="inDialog" |
| | | :componentVO="componentVO" |
| | | :sourceData="newSourceData" |
| | | :sourceBtmType="sourceBtmType" |
| | | :dataStore="dataStore" |
| | | :areasName="areasName" |
| | | :paramVOS="paramVOS" |
| | |
| | | </el-collapse> |
| | | <div v-else class="componentVO"> |
| | | <compoent-index :key="areasName+'componentVO-'+newAreasData[0].componentVOs[0].oid" |
| | | :uiBtmType="uiBtmType" |
| | | :uiContext="uiContext" |
| | | :inDialog="inDialog" |
| | | :componentVO="newAreasData[0].componentVOs[0]" |
| | | :sourceData="newSourceData" |
| | | :sourceBtmType="sourceBtmType" |
| | | :dataStore="dataStore" |
| | | :areasName="areasName" |
| | | :paramVOS="paramVOS" |
| | |
| | | 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 |
| | | v-else-if="Object.keys(newSourceData).length== 0" |
| | | class="alert" |
| | | :closable="false" |
| | | title="" |
| | | type="error" |
| | | show-icon |
| | | type="info" |
| | | description="没有可显示的内容,请选择来源数据。"> |
| | | </el-alert> |
| | | <el-alert |
| | | v-else-if="newAreasData.length== 0" |
| | | class="alert" |
| | | :closable="false" |
| | | title="" |
| | | type="info" |
| | | description="不满足显示表达式条件,没有可显示的内容。"> |
| | | </el-alert> |
| | | {{newSourceData}} |
| | | </div> |
| | | </basic-container> |
| | | </template> |
| | |
| | | name: "UIContentArea", |
| | | components:{compoentIndex}, |
| | | props:{ |
| | | //ui上下文的业务类型(或链接类型) |
| | | uiBtmType: { |
| | | type: String |
| | | }, |
| | | //ui上下文 |
| | | uiContext:{ |
| | | type: String |
| | | }, |
| | | inDialog: { |
| | | type: Boolean, |
| | | default: false |
| | |
| | | type:Object, |
| | | default: {} |
| | | }, |
| | | //上一区域业务类型 |
| | | sourceBtmType:{ |
| | | type: String |
| | | }, |
| | | dataStore:{ |
| | | //弹窗时按钮所属区域选中数据 |
| | | type:Array, |
| | |
| | | data(){ |
| | | return{ |
| | | activeName:this.areasName+'-Tab-0', |
| | | collapseActiveNames:[this.areasName+'-collapse-0'] |
| | | collapseActiveNames:[this.areasName+'-collapse-0'], |
| | | newAreasData:[] |
| | | } |
| | | }, |
| | | 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; |
| | | } |
| | | }, |
| | | watch: { |
| | | 'newSourceData':{ |
| | | handler(newval) { |
| | | this.getNewAreasData(); |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | |
| | | this.getNewAreasData(); |
| | | }, |
| | | mounted() { |
| | | // console.log(this.areasData); |
| | | }, |
| | | methods:{ |
| | | checkDisplayExpression(displayExpressionStr){ |
| | | getNewAreasData(){ |
| | | if(Object.keys(this.newSourceData).length> 0){ |
| | | let newAreasData = []; |
| | | this.areasData.forEach(areaData => { |
| | | //验证显式表达式 |
| | | if (!validatenull(areaData.displayExpression)) { |
| | | if (this.checkDisplayExpression(areaData.displayExpression)) { |
| | | newAreasData.push(areaData) |
| | | } |
| | | } else { |
| | | newAreasData.push(areaData) |
| | | } |
| | | }) |
| | | this.newAreasData = newAreasData; |
| | | }else { |
| | | this.newAreasData=this.areasData; |
| | | } |
| | | }, |
| | | 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" |
| | | //("${btmname}"="产品型号" and "${producttype}"<>"试验件") or "${btmname}"="ppart"or "${btmname}"="工艺零件"or "${btmname}"="part"or "${btmname}"="零件" |
| | | //${folderbusinesstype}为源数据中的属性 |
| | | |
| | | let checkdisplay=false; |
| | | let checkdisplay = false; |
| | | //替换and和or |
| | | 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,'') |
| | | if(eval('('+newDisplayExpressionStr+')')){ |
| | | checkdisplay=true; |
| | | 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*and\s*"/g, ') && "').replace(/\)\s*AND\s*"/g, ') && "').replace(/\)\s*or\s*"/g, ') || "').replace(/\)\s*OR\s*"/g, ') || "'); |
| | | newDisplayExpressionStr = newDisplayExpressionStr.replace(/"\s*and\s*\(/g, '" && (').replace(/"\s*AND\s*\(/g, '" && (').replace(/"\s*or\s*\(/g, '" || (').replace(/"\s*OR\s*\(/g, '" || ('); |
| | | newDisplayExpressionStr = newDisplayExpressionStr.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, '') |
| | | |
| | | try { |
| | | if (eval('(' + newDisplayExpressionStr + ')')) { |
| | | checkdisplay = true; |
| | | } |
| | | }catch (e) { |
| | | console.log(displayExpressionStr); |
| | | } |
| | | |
| | | return checkdisplay; |
| | | }, |
| | | tabHandleClick(tab, event) { |