Browse Source

去除冲突

lwx_v12
hreenshan112 1 year ago
parent
commit
a8f60bff65
  1. 431
      src/components/DesignForm/formControlPropertiNew.vue
  2. 268
      src/components/DesignForm/public/form/childTable.vue

431
src/components/DesignForm/formControlPropertiNew.vue

@ -1267,40 +1267,18 @@ const getPropByPath = (obj: any, path: string, val: any) => {
}; };
// //
<<<<<<< HEAD
//----bug //----bug
//穿退----bug //穿退----bug
const showAssociatedFormsFillRole = ref(true)
const saveRefreshFormControlAttr = () => {
getAssociatedFormsCurrentFieldTree1()
showAssociatedFormsFillRole.value = false;
//
setTimeout(() => {
showAssociatedFormsFillRole.value = true;
}, 200);
};
=======
const showAssociatedFormsFillRole = ref(true); const showAssociatedFormsFillRole = ref(true);
//----bug
const saveRefreshFormControlAttr = () => { const saveRefreshFormControlAttr = () => {
//
//setTimeout(() => {
>>>>>>> qin_v6
getAssociatedFormsCurrentFieldTree1(); getAssociatedFormsCurrentFieldTree1();
showAssociatedFormsFillRole.value = false; showAssociatedFormsFillRole.value = false;
// //
setTimeout(() => { setTimeout(() => {
showAssociatedFormsFillRole.value = true; showAssociatedFormsFillRole.value = true;
}, 200); }, 200);
//}, 13000);
}; };
// //
@ -1691,8 +1669,6 @@ const isNotWriteWord = (val: any) => {
// if(props.formField.includes(val.value)){ // if(props.formField.includes(val.value)){
return true; return true;
// } // }
} else if (val.label == "字段标识") {
return true;
} }
return false; return false;
}; };
@ -2603,79 +2579,6 @@ function associatedFormsHideDialoghandle() {
}); });
} }
<<<<<<< HEAD
function associatedFormsDataRangeDialoghandle(){
getAsfasfFieldTree().then(({ data }) => {
if(data.id==="cfid为空"){
//alert("cfid")
}else{
let resData = ref(data.children)
let dataExceptChild = JSON.parse(JSON.stringify(data.children))
let dataOnlyChild = JSON.parse(JSON.stringify(data.children))
let dataOnlyChild1 = JSON.parse(JSON.stringify(data.children))
dataExceptChild = dataExceptChild.filter((obj: { type: string }) => obj.type!== 'table');
//console.log(dataExceptChild)
dataExceptChild = removeFirstNumElements(dataExceptChild,8);
dataOnlyChild = dataOnlyChild.filter((obj: { type: string }) => obj.type== 'table');
dataOnlyChild1 = dataOnlyChild1.filter((obj: { type: string }) => obj.type== 'table');
//console.log(dataOnlyChild1)
dataOnlyChild1.forEach((element: any) => {
element.children = removeFirstNumElements(element.children,6);
});
/* console.log(dataOnlyChild1)
console.log(dataOnlyChild) */
for(let m = 0;m<dataOnlyChild.length;m++){
dataOnlyChild[m].children = []
}
let resDataExceptChild = ref(dataExceptChild)
let resDataOnlyChild = ref(dataOnlyChild)
let resDataOnlyChild1 = ref(dataOnlyChild1)
//console.log(resDataOnlyChild1.value)
//console.log(asfasfChildTableList.value)
//console.log(resDataOnlyChild.value)
let childTableCount = 0
for(let n = 0;n<resDataOnlyChild.value.length;n++){
//console.log(resDataOnlyChild.value[n])
resDataOnlyChild.value[n].disabled=false
childTableCount = n;
}
//console.log(childTableCount)
currentChildTableCount = childTableCount
asfasfFieldTree.value = [{
id: 'rootid_'+data.label,
label: '关联的表单-'+data.label,
children: [...resData.value],
treeAttrs: data.treeAttrs,
disabled:true,
}]
asfasfMasterFieldTree.value = [{
id: 'rootid_'+data.label,
label: '关联的表单-'+data.label,
children: [...resDataExceptChild.value],
treeAttrs: data.treeAttrs,
disabled:true,
}]
asfasfChildTableList.value = [{
id: 'rootid_'+data.label,
label: '关联的表单-'+data.label,
children: [...resDataOnlyChild.value],
treeAttrs: data.treeAttrs,
disabled:true,
}]
asfasfChildTableFields.value = [{
id: 'rootid_'+data.label,
label: '关联的表单-'+data.label,
children: [...resDataOnlyChild1.value],
treeAttrs: data.treeAttrs,
disabled:true,
}]
}
});
=======
function associatedFormsDataRangeDialoghandle() { function associatedFormsDataRangeDialoghandle() {
getAsfasfFieldTree().then(({ data }) => { getAsfasfFieldTree().then(({ data }) => {
if (data.id === "cfid为空") { if (data.id === "cfid为空") {
@ -2688,7 +2591,7 @@ function associatedFormsDataRangeDialoghandle() {
dataExceptChild = dataExceptChild.filter( dataExceptChild = dataExceptChild.filter(
(obj: { type: string }) => obj.type !== "table" (obj: { type: string }) => obj.type !== "table"
); );
console.log(dataExceptChild); //console.log(dataExceptChild)
dataExceptChild = removeFirstNumElements(dataExceptChild, 8); dataExceptChild = removeFirstNumElements(dataExceptChild, 8);
dataOnlyChild = dataOnlyChild.filter( dataOnlyChild = dataOnlyChild.filter(
(obj: { type: string }) => obj.type == "table" (obj: { type: string }) => obj.type == "table"
@ -2696,7 +2599,7 @@ function associatedFormsDataRangeDialoghandle() {
dataOnlyChild1 = dataOnlyChild1.filter( dataOnlyChild1 = dataOnlyChild1.filter(
(obj: { type: string }) => obj.type == "table" (obj: { type: string }) => obj.type == "table"
); );
console.log(dataOnlyChild1); //console.log(dataOnlyChild1)
dataOnlyChild1.forEach((element: any) => { dataOnlyChild1.forEach((element: any) => {
element.children = removeFirstNumElements(element.children, 6); element.children = removeFirstNumElements(element.children, 6);
}); });
@ -2708,16 +2611,16 @@ function associatedFormsDataRangeDialoghandle() {
let resDataExceptChild = ref(dataExceptChild); let resDataExceptChild = ref(dataExceptChild);
let resDataOnlyChild = ref(dataOnlyChild); let resDataOnlyChild = ref(dataOnlyChild);
let resDataOnlyChild1 = ref(dataOnlyChild1); let resDataOnlyChild1 = ref(dataOnlyChild1);
console.log(resDataOnlyChild1.value); //console.log(resDataOnlyChild1.value)
//console.log(asfasfChildTableList.value) //console.log(asfasfChildTableList.value)
//console.log(resDataOnlyChild.value) //console.log(resDataOnlyChild.value)
let childTableCount = 0; let childTableCount = 0;
for (let n = 0; n < resDataOnlyChild.value.length; n++) { for (let n = 0; n < resDataOnlyChild.value.length; n++) {
console.log(resDataOnlyChild.value[n]); //console.log(resDataOnlyChild.value[n])
resDataOnlyChild.value[n].disabled = false; resDataOnlyChild.value[n].disabled = false;
childTableCount = n; childTableCount = n;
} }
console.log(childTableCount); //console.log(childTableCount)
currentChildTableCount = childTableCount; currentChildTableCount = childTableCount;
asfasfFieldTree.value = [ asfasfFieldTree.value = [
{ {
@ -2757,7 +2660,6 @@ function associatedFormsDataRangeDialoghandle() {
]; ];
} }
}); });
>>>>>>> qin_v6
associatedFormsDataRangeDialogFlag.value = true; associatedFormsDataRangeDialogFlag.value = true;
controlData.value.control.dataRangeConditionHtmlCopy = controlData.value.control.dataRangeConditionHtmlCopy =
@ -3261,7 +3163,6 @@ const activeFormName = ref("0");
@ 功能: 判断是否是组件 @ 功能: 判断是否是组件
*/ */
const cssIsShouw = (val: any) => { const cssIsShouw = (val: any) => {
console.log("判断是否是组件", val);
if (val.length && val.length > 0) { if (val.length && val.length > 0) {
return true; return true;
} }
@ -4617,30 +4518,6 @@ const radioChangeSet = (val: any) => {
/> />
</el-form-item> </el-form-item>
<<<<<<< HEAD
<el-dialog v-model="associatedFormsChooseDialogFlag" class="glxxsztc" top="150px" :close-on-click-modal="false" title="选择关联表单" :show-close="false" style="margin-top:70px;" width="50%" >
<template v-if="controlData.type=='associatedForms'">
<div style="display:flex;margin-bottom: 2px;margin-top:28px"><span style="font-size: larger;margin-left: 35px;margin-right: 15px;">请选择表单</span>
<el-tree-select
v-model="controlData.control.formid"
style="width: 390px;"
:data="customerFormTree[0].children"
check-strictly
:render-after-expand="false"
filterable
node-key="id"
@change="formidChanged"
/>
</div>
</template>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="handleDetermineAssociatedFormsChooseDialog">
确定
=======
<el-divider content-position="left">表单整体布局</el-divider> <el-divider content-position="left">表单整体布局</el-divider>
<el-form-item label="组件尺寸" class="form_cont"> <el-form-item label="组件尺寸" class="form_cont">
<el-radio-group v-model="formData.size"> <el-radio-group v-model="formData.size">
@ -4729,7 +4606,6 @@ const radioChangeSet = (val: any) => {
<QuestionFilled /> <QuestionFilled />
</el-icon> </el-icon>
</el-tooltip> </el-tooltip>
>>>>>>> qin_v6
</el-button> </el-button>
<el-button @click="editFormDict(state.tooltip.dict)"> <el-button @click="editFormDict(state.tooltip.dict)">
设置数据字典 设置数据字典
@ -5015,6 +4891,7 @@ const radioChangeSet = (val: any) => {
check-strictly check-strictly
:render-after-expand="false" :render-after-expand="false"
filterable filterable
node-key="id"
@change="formidChanged" @change="formidChanged"
/> />
</div> </div>
@ -5320,7 +5197,7 @@ const radioChangeSet = (val: any) => {
:close-on-click-modal="false" :close-on-click-modal="false"
:show-close="false" :show-close="false"
style="margin-top: 70px; min-height: 300px; max-height: 900px" style="margin-top: 70px; min-height: 300px; max-height: 900px"
width="50%" width="60%"
> >
<template v-if="controlData.type == 'associatedForms'"> <template v-if="controlData.type == 'associatedForms'">
<el-button <el-button
@ -5361,299 +5238,6 @@ const radioChangeSet = (val: any) => {
</AssociatedFormsFillRole> </AssociatedFormsFillRole>
</template> </template>
</div> </div>
<<<<<<< HEAD
</template>
</el-dialog>
<el-dialog v-model="associatedFormsHideDialogFlag" title="隐藏条件" top="150px" :close-on-click-modal="false" :show-close="false" style="margin-top:70px ;min-height: 500px" width="50%" >
<template v-if="controlData.type=='associatedForms'">
<div class="common-layout">
<el-container>
<el-aside width="300px" style="height:420px;border: 1px solid gainsboro;margin-right: 5px;">
<!-- <el-input
v-show="fieldTreeSearchFlag"
v-model="fieldTreeFilterText"
style="width:98%;margin: 3px;"
placeholder="搜索字段"
class="filter-tree"
/> -->
<el-tree
ref="fieldTreeRef"
node-key="id"
empty-text="请先保存当前表单"
:data="associatedFormsCurrentFormFieldTree"
:props="treeDefaultProps"
:filter-node-method="filterNode"
style="max-width: 600px; border: 1px solid gainsboro; margin: 3px;"
@node-expand="handleFieldTreeExpand"
@node-collapse="handleFieldTreeCollapse"
@node-contextmenu="handleFieldTreeContextmenu"
/>
<!-- <el-input
v-show="orgTreeSearchFlag"
v-model="orgTreeFilterText"
style="width:98%;margin: 3px;"
placeholder="搜索字段"
class="filter-tree"
/> -->
<el-tree
ref="orgTreeRef"
style="max-width: 600px; border: 1px solid gainsboro; margin: 3px;"
:data="orgAndManTree"
:props="treeDefaultProps"
:filter-node-method="filterNode"
@node-expand="handleOrgTreeExpand"
@node-collapse="handleOrgTreeCollapse"
@node-contextmenu="handleOrgTreeContextmenu"
/>
<!-- <el-input
v-show="roleTreeSearchFlag"
v-model="roleTreeFilterText"
style="width:98%;margin: 3px;"
placeholder="搜索字段"
class="filter-tree"
/> -->
<el-tree
ref="roleTreeRef"
style="max-width: 600px; border: 1px solid gainsboro; margin: 3px;"
:data="roleTree"
:props="treeDefaultProps"
:filter-node-method="filterNode"
@node-expand="handleRoleTreeExpand"
@node-collapse="handleRoleTreeCollapse"
@node-contextmenu="handleRoleTreeContextmenu"
/>
</el-aside>
<el-main style="border: 1px solid gainsboro; padding: 3px;" class="associatedFormsHideDialogMain">
<div style="border: 1px solid gainsboro; height: 7%; border-bottom: 0px; padding-top: 3px; padding-left: 5px; background-color: #E6F3FE;">当满足以下条件时此控件隐藏</div>
<div id="associatedFormsHideEditArea" style="border: 1px solid gainsboro; height: 38%; border-bottom: 0px;">
<AssociatedFormsTinyace ref="aft" :aft-text="controlData.control.hideConditionHtml" :aft-text-copy = "controlData.control.hideConditionHtmlCopy" @text-change = "aftTextChanged" @gongshi-change = "aftGongshiChanged"></AssociatedFormsTinyace>
<!-- <div style="border: 1px solid #4189EF;width:90px;height:26px;border-radius: 3px;padding:2px;text-align: center;cursor:pointer;float: right;margin-top: -32px;margin-right: 5px;z-index:99999999;position: relative;">
<span style="color: #4189EF;font:6px;margin-right: 5px;">fx</span>插入函数
</div> -->
</div>
<div style="border: 1px solid gainsboro; height: 55%; padding-top: 20px;">
<ul>
<li>请从左侧面板<span style="color: red">右击</span>选择字段或选项</li>
<li>支持的符号<span style="color: red">'==', '>=', '>', '<=', '<', '!='</span></li>
<li>支持<span style="color: red">"包含,不包含,当前用户"</span>关键字,用于组织机构条件和角色条件</li>
<li>参考举例</li>
<span style="margin-left: 14px;">年龄>10</span><br>
<span style="margin-left: 14px;">企管部包含当前用户</span><br>
<span style="margin-left: 14px;">绩效考核执行人包含当前用户</span><br>
<span style="margin-left: 14px;">张三!=当前用户</span>
</ul>
</div>
</el-main>
</el-container>
</div>
</template>
<template #footer>
<div class="dialog-footer">
<el-button @click="asfhTextCancel">取消</el-button>
<el-button type="primary" @click="handleDetermine">
确定
</el-button>
</div>
</template>
</el-dialog>
<!-- 数据范围编辑弹窗 -->
<el-dialog v-model="associatedFormsDataRangeDialogFlag" title="数据范围" top="150px" :close-on-click-modal="false" :show-close="false" style="margin-top:70px ;min-height: 500px" width="50%" >
<template v-if="controlData.type=='associatedForms'">
<div class="common-layout">
<el-container>
<el-aside width="300px" style="height:420px;border: 1px solid gainsboro;margin-right: 5px;">
<el-tree
ref="fieldTreeRef"
node-key="id"
empty-text="选择关联的表单后展示"
:data="asfasfFieldTree"
:props="treeDefaultProps"
:filter-node-method="filterNode"
style="max-width: 600px; border: 1px solid gainsboro; margin: 3px;"
@node-expand="handleFieldTreeExpand"
@node-collapse="handleFieldTreeCollapse"
@node-contextmenu="handleFieldTreeContextmenuRange"
/>
<!-- <el-input
v-show="fieldTreeSearchFlag"
v-model="fieldTreeFilterText"
style="width:98%;margin: 3px;"
placeholder="搜索字段"
class="filter-tree"
/> -->
<el-tree
ref="fieldTreeRef"
node-key="id"
empty-text="请先保存当前表单"
:data="associatedFormsCurrentFormFieldTree"
:props="treeDefaultProps"
:filter-node-method="filterNode"
style="max-width: 600px; border: 1px solid gainsboro; margin: 3px;"
@node-expand="handleFieldTreeExpand"
@node-collapse="handleFieldTreeCollapse"
@node-contextmenu="handleFieldTreeContextmenuRange"
/>
<!-- <el-input
v-show="orgTreeSearchFlag"
v-model="orgTreeFilterText"
style="width:98%;margin: 3px;"
placeholder="搜索字段"
class="filter-tree"
/> -->
<el-tree
ref="orgTreeRef"
style="max-width: 600px; border: 1px solid gainsboro; margin: 3px;"
:data="orgAndManTree"
:props="treeDefaultProps"
:filter-node-method="filterNode"
@node-expand="handleOrgTreeExpand"
@node-collapse="handleOrgTreeCollapse"
@node-contextmenu="handleOrgTreeContextmenuRange"
/>
<!-- <el-input
v-show="roleTreeSearchFlag"
v-model="roleTreeFilterText"
style="width:98%;margin: 3px;"
placeholder="搜索字段"
class="filter-tree"
/> -->
<el-tree
ref="roleTreeRef"
style="max-width: 600px; border: 1px solid gainsboro; margin: 3px;"
:data="roleTree"
:props="treeDefaultProps"
:filter-node-method="filterNode"
@node-expand="handleRoleTreeExpand"
@node-collapse="handleRoleTreeCollapse"
@node-contextmenu="handleRoleTreeContextmenuRange"
/>
</el-aside>
<el-main style="border: 1px solid gainsboro; padding: 3px;" class="associatedFormsHideDialogMain">
<div style="border: 1px solid gainsboro; height: 7%; border-bottom: 0px; padding-top: 3px; padding-left: 5px; background-color: #E6F3FE;">仅可选择符合以下条件的数据</div>
<div id="associatedFormsHideEditArea" style="border: 1px solid gainsboro; height: 38%; border-bottom: 0px;">
<AssociatedFormsTinyaceRange ref="aftRange" :aft-text="controlData.control.dataRangeConditionHtml" :aft-text-copy = "controlData.control.dataRangeConditionHtmlCopy" @text-change = "aftTextChangedRange" @gongshi-change = "aftGongshiChangedRange"></AssociatedFormsTinyaceRange>
<!-- <div style="border: 1px solid #4189EF;width:90px;height:26px;border-radius: 3px;padding:2px;text-align: center;cursor:pointer;float: right;margin-top: -32px;margin-right: 5px;z-index:99999999;position: relative;">
<span style="color: #4189EF;font:6px;margin-right: 5px;">fx</span>插入函数
</div> -->
</div>
<div style="border: 1px solid gainsboro; height: 55%; padding-top: 20px;">
<ul>
<li>请从左侧面板<span style="color: red">右击</span>选择字段或选项</li>
<li>支持的符号<span style="color: red">'==', '>=', '>', '<=', '<', '!='</span></li>
<li>支持<span style="color: red">"包含,不包含,数据拥有者,数据所属部门"</span>关键字,用于组织机构条件,角色条件,==运算符和!=运算符</li>
<li>参考举例</li>
<span style="margin-left: 14px;">年龄>10</span><br>
<span style="margin-left: 14px;">企管部==数据所属部门</span><br>
<span style="margin-left: 14px;">绩效考核执行人包含数据拥有者</span><br>
<span style="margin-left: 14px;">生产部包含数据所属部门</span>
</ul>
</div>
</el-main>
</el-container>
</div>
</template>
<template #footer>
<div class="dialog-footer">
<el-button @click="asfhTextCancelRange">取消</el-button>
<el-button type="primary" @click="handleDetermineRange">
确定
</el-button>
</div>
</template>
</el-dialog>
<!-- 数据填充规则弹窗 -->
<el-dialog v-model="associatedFormsFillRolesDialogFlag" title="数据填充规则" top="150px" :close-on-click-modal="false" :show-close="false" style="margin-top:70px ;min-height: 300px;max-height:900px" width="60%" >
<template v-if="controlData.type=='associatedForms'">
<el-button style="font-size: large;margin-top: 10px;margin-bottom: 15px;" type="primary" link append-to-body="true" modal="true" @click="addFillRole"> 主表填充规则</el-button>
<div style="max-height:230px;border:1px solid white;overflow-y:auto;">
<div style="background-color: #F0F0F0;padding: 12px;border-radius: 5px;padding-left:45px;padding-bottom: 10px;margin-right: 10px;"><!-- #F5F7FA #E6F3FE #F0F0F0 #F5F7FA-->
<template v-for="(item, index) in controlData.control.fillRoles.master" :key="controlData.control.fillRoles.master[index].id">
<AssociatedFormsFillRole
v-if="showAssociatedFormsFillRole"
v-model:left-value="controlData.control.fillRoles.master[index].leftValue"
v-model:right-value="controlData.control.fillRoles.master[index].rightValue"
:left-tree-source = "asfasfMasterFieldTree"
:right-tree-source = "associatedFormsCurrentFormFieldTree1"
:current-key="controlData.control.fillRoles.master[index].id"
@del-role = "delRole"
@child-role-right-changed = "childRoleRightChanged"
>
</AssociatedFormsFillRole>
</template>
</div>
</div>
<el-popover
v-if="currentChildTableCount>0"
placement="right-start"
title=""
:width="200"
trigger="hover"
content="【关联表单子表字段】暂不支持填充至【当前表单主表字段】"
>
<template #reference>
<el-button style="font-size: large;margin-top: 23px;margin-bottom: 15px;" type="primary" link append-to-body="true" modal="true" @click="addChildFillRole"> 子表填充规则</el-button>
</template>
</el-popover>
<div v-if="currentChildTableCount>0" style="max-height: 330px;overflow-y:auto;padding-top: 7px;">
<template v-for="(item, index) in controlData.control.fillRoles.child" :key="controlData.control.fillRoles.child[index].id">
<AssociatedFormsChildFillRole
v-model:selected-child-table="controlData.control.fillRoles.child[index].asfChildTableKey"
v-model:filter-condition="controlData.control.fillRoles.child[index].filterCondition"
v-model:child-roles = "controlData.control.fillRoles.child[index].childRoles"
:child-table-list="asfasfChildTableList"
:asfasf-field-tree="asfasfFieldTree"
:tree-default-props="treeDefaultProps"
:filter-node="filterNode"
:org-and-man-tree="orgAndManTree"
:handle-org-tree-contextmenu-range = "handleOrgTreeContextmenuRange"
:role-tree="roleTree"
:handle-role-tree-contextmenu-range="handleRoleTreeContextmenuRange"
:associated-forms-current-form-field-tree= "associatedFormsCurrentFormFieldTree"
:asfasf-child-table-fields = "asfasfChildTableFields"
:current-key="controlData.control.fillRoles.child[index].id"
:current-form-child-table-fields-for-fill-role = "currentFormChildTableFieldsForFillRole"
@selected-or-del-child-role = "selectedOrDelChildRole"
@child-role-right-changed = "childRoleRightChanged"
@del-role = "delChildRole"
>
</AssociatedFormsChildFillRole>
</template>
</div>
</template>
<template #footer>
<div class="dialog-footer">
<!-- <el-button @click="asfhTextCancelFillRoles">取消</el-button> -->
<el-button type="primary" @click="handleDetermineFillRoles">
确定
</el-button>
</div>
=======
</div> </div>
<el-popover <el-popover
v-if="currentChildTableCount > 0" v-if="currentChildTableCount > 0"
@ -5673,7 +5257,6 @@ const radioChangeSet = (val: any) => {
@click="addChildFillRole" @click="addChildFillRole"
> 子表填充规则</el-button > 子表填充规则</el-button
> >
>>>>>>> qin_v6
</template> </template>
</el-popover> </el-popover>
<div <div

268
src/components/DesignForm/public/form/childTable.vue

@ -3,70 +3,69 @@
@ 时间: 2023-07-14 08:51:25 @ 时间: 2023-07-14 08:51:25
@ 备注: 表单子表 @ 备注: 表单子表
--> -->
<script lang='ts' setup> <script lang="ts" setup>
import FormItem from './formItem.vue' import FormItem from "./formItem.vue";
import { inject, computed } from 'vue' import { inject, computed } from "vue";
import Tooltips from '@/components/DesignForm/tooltip.vue' import Tooltips from "@/components/DesignForm/tooltip.vue";
import {constFormProps } from '@/api/DesignForm/utils' import { constFormProps } from "@/api/DesignForm/utils";
import { jsonParseStringify } from '@/utils/DesignForm' import { jsonParseStringify } from "@/utils/DesignForm";
import LowcodeImagePage from '@/components/DesignForm/public/expand/lowcodeImage.vue' import LowcodeImagePage from "@/components/DesignForm/public/expand/lowcodeImage.vue";
import AssociatedForms from '@/widget/associatedforms/index.vue' import AssociatedForms from "@/widget/associatedforms/index.vue";
import UploadPageList from '@/components/DesignForm/public/expand/uploadPageList.vue' import UploadPageList from "@/components/DesignForm/public/expand/uploadPageList.vue";
import LokOrgCentent from '@/widget/org/cont.vue'
import { SCOPE } from 'element-plus'
import LokOrgCentent from "@/widget/org/cont.vue";
import { SCOPE } from "element-plus";
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
data: any data: any;
}>(), }>(),
{ {
data: () => { data: () => {
return {} return {};
} },
} }
) );
const formProps = inject(constFormProps, {}) as any const formProps = inject(constFormProps, {}) as any;
const tableDataNew = computed(() => { const tableDataNew = computed(() => {
// console.log("-----1---->",props.data.name) // console.log("-----1---->",props.data.name)
// console.log("-----2---->",formProps.value.model[props.data.name]) // console.log("-----2---->",formProps.value.model[props.data.name])
// console.log("-----3---->",formProps.value.model) // console.log("-----3---->",formProps.value.model)
// console.log("-----4---->",formProps.value) // console.log("-----4---->",formProps.value)
return formProps.value.model[props.data.name] return formProps.value.model[props.data.name];
}) });
const type = computed(() => { const type = computed(() => {
return formProps.value.type return formProps.value.type;
}) });
// true // true
const editDisabled = computed(() => { const editDisabled = computed(() => {
return formProps.value.type === 2 && props.data.config?.editDisabled return formProps.value.type === 2 && props.data.config?.editDisabled;
}) });
const addColumn = () => { const addColumn = () => {
// console.log("--------->",tableDataNew.value) // console.log("--------->",tableDataNew.value)
const temp: any = {} const temp: any = {};
if (props.data.list) { if (props.data.list) {
props.data.list.forEach((item: any) => { props.data.list.forEach((item: any) => {
if (item.name) { if (item.name) {
temp[item.name] = item.control.modelValue temp[item.name] = item.control.modelValue;
}
})
tableDataNew.value.push(jsonParseStringify(temp))
} }
});
tableDataNew.value.push(jsonParseStringify(temp));
} }
};
const getText = (text: any, val: any, name: any) => { const getText = (text: any, val: any, name: any) => {
// console.log("text===>",text) console.log("text===>", text);
// console.log("name===>",name) console.log("name===>", name);
// console.log("val===>",val) console.log("val===>", val);
if (typeof text === 'string') { if (typeof text === "string") {
return text return text;
} else { } else {
return text && text.toString() return text && text.toString();
}
} }
};
const delColumn = (index: number) => { const delColumn = (index: number) => {
tableDataNew.value.splice(index, 1) tableDataNew.value.splice(index, 1);
} };
/** /**
@ 作者: 秦东 @ 作者: 秦东
@ 时间: 2024-08-02 13:22:14 @ 时间: 2024-08-02 13:22:14
@ -75,32 +74,31 @@ const delColumn = (index: number) => {
const timeToAry = (timestamp: number) => { const timeToAry = (timestamp: number) => {
const date = new Date(timestamp); const date = new Date(timestamp);
const year = date.getFullYear(); const year = date.getFullYear();
const month = ('0' + (date.getMonth() + 1)).slice(-2); const month = ("0" + (date.getMonth() + 1)).slice(-2);
const day = ('0' + date.getDate()).slice(-2); const day = ("0" + date.getDate()).slice(-2);
const hours = ('0' + date.getHours()).slice(-2); const hours = ("0" + date.getHours()).slice(-2);
const minutes = ('0' + date.getMinutes()).slice(-2); const minutes = ("0" + date.getMinutes()).slice(-2);
const seconds = ('0' + date.getSeconds()).slice(-2); const seconds = ("0" + date.getSeconds()).slice(-2);
return { return {
year: year, year: year,
month: month, month: month,
day: day, day: day,
hours: hours, hours: hours,
minutes: minutes, minutes: minutes,
seconds seconds,
} };
} };
/** /**
@ 作者: 秦东 @ 作者: 秦东
@ 时间: 2024-08-02 13:02:49 @ 时间: 2024-08-02 13:02:49
@ 功能: 将时间戳转换成字符串 @ 功能: 将时间戳转换成字符串
*/ */
const timeToString = (timeVal: any, types: int) => { const timeToString = (timeVal: any, types: int) => {
// console.log("",timeVal,types) let timeStr = "";
let timeStr = ""
if (Array.isArray(timeVal)) { if (Array.isArray(timeVal)) {
if (timeVal.length >= 2) { if (timeVal.length >= 2) {
let startTime = timeToAry(timeVal[0]) let startTime = timeToAry(timeVal[0]);
let endTime = timeToAry(timeVal[1]) let endTime = timeToAry(timeVal[1]);
switch (types) { switch (types) {
case "year": // case "year": //
timeStr = `${startTime.year}${endTime.year}`; timeStr = `${startTime.year}${endTime.year}`;
@ -112,8 +110,8 @@ const timeToString = (timeVal:any,types:int) => {
timeStr = `${startTime.year}-${startTime.month}-${startTime.day} ${startTime.hours}:${startTime.minutes}:${startTime.seconds}${endTime.year}-${endTime.month}-${endTime.day} ${endTime.hours}:${endTime.minutes}:${endTime.seconds}`; timeStr = `${startTime.year}-${startTime.month}-${startTime.day} ${startTime.hours}:${startTime.minutes}:${startTime.seconds}${endTime.year}-${endTime.month}-${endTime.day} ${endTime.hours}:${endTime.minutes}:${endTime.seconds}`;
break; break;
case "week": // case "week": //
let startWeek = getYearWeek(startTime) let startWeek = getYearWeek(startTime);
let endWeek = getYearWeek(endTime) let endWeek = getYearWeek(endTime);
timeStr = `${startWeek}${endWeek}`; timeStr = `${startWeek}${endWeek}`;
break; break;
case "timeCalss": // case "timeCalss": //
@ -133,7 +131,7 @@ const timeToString = (timeVal:any,types:int) => {
break; break;
} }
} else if (timeVal.length == 1) { } else if (timeVal.length == 1) {
let {year,month,day,hours,minutes,seconds} = timeToAry(timeVal[0]) let { year, month, day, hours, minutes, seconds } = timeToAry(timeVal[0]);
switch (types) { switch (types) {
case "year": // case "year": //
timeStr = `${year}`; timeStr = `${year}`;
@ -145,20 +143,20 @@ const timeToString = (timeVal:any,types:int) => {
timeStr = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; timeStr = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
break; break;
case "week": // case "week": //
timeStr = getYearWeek(timeVal) timeStr = getYearWeek(timeVal);
break; break;
case "timeCalss": // case "timeCalss": //
timeStr = `${hours}:${minutes}:${seconds}`; timeStr = `${hours}:${minutes}:${seconds}`;
break; break;
default: default:
timeStr = `${year}-${month}-${day}` timeStr = `${year}-${month}-${day}`;
break; break;
} }
} else { } else {
timeStr = "未知时间" timeStr = "未知时间";
} }
} else { } else {
let {year,month,day,hours,minutes,seconds} = timeToAry(timeVal) let { year, month, day, hours, minutes, seconds } = timeToAry(timeVal);
switch (types) { switch (types) {
case "year": // case "year": //
timeStr = `${year}`; timeStr = `${year}`;
@ -170,119 +168,32 @@ const timeToString = (timeVal:any,types:int) => {
timeStr = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; timeStr = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
break; break;
case "week": // case "week": //
timeStr = getYearWeek(timeVal) timeStr = getYearWeek(timeVal);
break; break;
case "timePicker": // case "timeCalss": //
timeStr = `${hours}:${minutes}:${seconds}`; timeStr = `${hours}:${minutes}:${seconds}`;
break; break;
default: default:
timeStr = `${year}-${month}-${day}` timeStr = `${year}-${month}-${day}`;
break;
}
}
return timeStr
}
<<<<<<< HEAD
/**
@ 作者: 秦东
@ 时间: 2024-10-11 14:49:23
@ 功能: 计算有options属性的结果
*/
const optToString = (timeVal:any,item:any) => {
let timeStr = ""
if(item.options && Array.isArray(item.options)){
if(Array.isArray(timeVal)){
let strArt = new Array
switch(item.type){
case "radio":
timeVal.forEach((tim:any)=>{
item.options.forEach((it:any)=>{
if(it.value == tim){
strArt.push(it.label)
}
})
})
break;
case "checkbox":
timeVal.forEach((tim:any)=>{
item.options.forEach((it:any)=>{
if(it.value == tim){
strArt.push(it.label)
}
})
})
break;
case "select":
timeVal.forEach((tim:any)=>{
item.options.forEach((it:any)=>{
if(it.value == tim){
strArt.push(it.label)
}
})
})
break;
default:
break;
}
if(strArt.length > 0){
timeStr = strArt.toString()
}
}else{
let strArt = new Array
switch(item.type){
case "radio":
item.options.forEach((it:any)=>{
if(it.value == timeVal){
strArt.push(it.label)
}
})
break;
case "checkbox":
item.options.forEach((it:any)=>{
if(it.value == timeVal){
strArt.push(it.label)
}
})
break;
case "select":
item.options.forEach((it:any)=>{
if(it.value == timeVal){
strArt.push(it.label)
}
})
break;
default:
break; break;
} }
if(strArt.length > 0){
timeStr = strArt.toString()
}
}
} }
return timeStr;
return timeStr };
======= let associatedFormsIndexTablekey = 0;
let associatedFormsIndexTablekey = 0
const emits = defineEmits<{ const emits = defineEmits<{
(e: 'asfValueChanged', val: any): void (e: "asfValueChanged", val: any): void;
}>() }>();
function asfValueChanged(val: any) { function asfValueChanged(val: any) {
//console.log("childTable-asfValueChanged",val) //console.log("childTable-asfValueChanged",val)
emits("asfValueChanged",val) emits("asfValueChanged", val);
>>>>>>> lwx_v10
} }
</script> </script>
<template> <template>
<div class="form-table form-table-add"> <div class="form-table form-table-add">
<el-table <el-table v-bind="data.control" :class="[data.className]" :data="tableDataNew">
v-bind="data.control"
:class="[data.className]"
:data="tableDataNew"
>
<el-table-column <el-table-column
v-for="(item, index) in data.list" v-for="(item, index) in data.list"
:key="index" :key="index"
@ -291,40 +202,37 @@ function asfValueChanged(val:any){
:width="item.item.span" :width="item.item.span"
> >
<template #default="scope"> <template #default="scope">
<span v-if="item.type === 'index'">{{ scope.$index + 1 }}</span> <span v-if="item.type === 'index'">{{ scope.$index + 1 }}</span>
<div v-if="type === 4 || editDisabled"> <div v-if="type === 4 || editDisabled">
<LokOrgCentent v-if="item.type == 'orgCentent'" :orgid="scope.row[item.name].toString()" /> <LokOrgCentent
v-if="item.type == 'orgCentent'"
:orgid="scope.row[item.name].toString()"
/>
<div v-else-if="item.type == 'lowcodeImage'"> <div v-else-if="item.type == 'lowcodeImage'">
<LowcodeImagePage :data="item" <LowcodeImagePage :data="item" v-model="scope.row[item.name]" />
v-model="scope.row[item.name]" />
</div> </div>
<div v-else-if="item.type == 'upload'"> <div v-else-if="item.type == 'upload'">
<UploadPageList :data="item" :img-list="scope.row[item.name]" :control="item.control" /> <UploadPageList
</div> :data="item"
<div v-else-if="item.type=='datePicker'" v-html="timeToString(scope.row[item.name],item.control.type)"> :img-list="scope.row[item.name]"
</div> :control="item.control"
<<<<<<< HEAD />
<div v-else-if="item.type=='timePicker'" v-html="timeToString(scope.row[item.name],item.type)">
</div>
<div v-else-if="item.type=='radio'" v-html="optToString(scope.row[item.name],item)">
</div>
<div v-else-if="item.type=='checkbox'" v-html="optToString(scope.row[item.name],item)">
</div> </div>
<div v-else-if="item.type=='select'" v-html="optToString(scope.row[item.name],item)"> <div
v-else-if="item.type == 'datePicker'"
======= v-html="timeToString(scope.row[item.name], item.control.type)"
></div>
<div v-else-if="item.type == 'associatedForms'"> <div v-else-if="item.type == 'associatedForms'">
<AssociatedForms :data="item" <AssociatedForms
v-model="scope.row[item.name]" :tablekey="associatedFormsIndexTablekey" :row-index="scope.$index"/> :data="item"
>>>>>>> lwx_v10 v-model="scope.row[item.name]"
:tablekey="associatedFormsIndexTablekey"
:row-index="scope.$index"
/>
</div> </div>
<div v-else>{{ getText(scope.row[item.name], scope.row, item.name) }}</div> <div v-else>{{ getText(scope.row[item.name], scope.row, item.name) }}</div>
</div> </div>
<div v-else> <div v-else>
<form-item <form-item
v-model="scope.row[item.name]" v-model="scope.row[item.name]"
:tProp="`${data.name}.${scope.$index}.${item.name}`" :tProp="`${data.name}.${scope.$index}.${item.name}`"
@ -345,7 +253,9 @@ function asfValueChanged(val:any){
v-if="[1, 2].includes(type as number) && data.config.delBtnText && !editDisabled" v-if="[1, 2].includes(type as number) && data.config.delBtnText && !editDisabled"
> >
<template #default="scope"> <template #default="scope">
<el-button link type="primary" @click="delColumn(scope.$index)">{{ data.config.delBtnText }}</el-button> <el-button link type="primary" @click="delColumn(scope.$index)">{{
data.config.delBtnText
}}</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -357,6 +267,4 @@ function asfValueChanged(val:any){
</div> </div>
</div> </div>
</template> </template>
<style lang='scss' scoped> <style lang="scss" scoped></style>
</style>

Loading…
Cancel
Save