Browse Source

去除冲突

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

435
src/components/DesignForm/formControlPropertiNew.vue

@ -1267,40 +1267,18 @@ const getPropByPath = (obj: any, path: string, val: any) => {
};
//
<<<<<<< HEAD
//----bug
//穿退----bug
const showAssociatedFormsFillRole = ref(true)
//----bug
//穿退----bug
const saveRefreshFormControlAttr = () => {
getAssociatedFormsCurrentFieldTree1()
showAssociatedFormsFillRole.value = false;
//
setTimeout(() => {
showAssociatedFormsFillRole.value = true;
}, 200);
};
=======
const showAssociatedFormsFillRole = ref(true);
//----bug
const saveRefreshFormControlAttr = () => {
//
//setTimeout(() => {
>>>>>>> qin_v6
getAssociatedFormsCurrentFieldTree1();
showAssociatedFormsFillRole.value = false;
//
setTimeout(() => {
showAssociatedFormsFillRole.value = true;
}, 200);
//}, 13000);
};
//
@ -1691,8 +1669,6 @@ const isNotWriteWord = (val: any) => {
// if(props.formField.includes(val.value)){
return true;
// }
} else if (val.label == "字段标识") {
return true;
}
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() {
getAsfasfFieldTree().then(({ data }) => {
if (data.id === "cfid为空") {
@ -2688,7 +2591,7 @@ function associatedFormsDataRangeDialoghandle() {
dataExceptChild = dataExceptChild.filter(
(obj: { type: string }) => obj.type !== "table"
);
console.log(dataExceptChild);
//console.log(dataExceptChild)
dataExceptChild = removeFirstNumElements(dataExceptChild, 8);
dataOnlyChild = dataOnlyChild.filter(
(obj: { type: string }) => obj.type == "table"
@ -2696,7 +2599,7 @@ function associatedFormsDataRangeDialoghandle() {
dataOnlyChild1 = dataOnlyChild1.filter(
(obj: { type: string }) => obj.type == "table"
);
console.log(dataOnlyChild1);
//console.log(dataOnlyChild1)
dataOnlyChild1.forEach((element: any) => {
element.children = removeFirstNumElements(element.children, 6);
});
@ -2708,16 +2611,16 @@ function associatedFormsDataRangeDialoghandle() {
let resDataExceptChild = ref(dataExceptChild);
let resDataOnlyChild = ref(dataOnlyChild);
let resDataOnlyChild1 = ref(dataOnlyChild1);
console.log(resDataOnlyChild1.value);
//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]);
//console.log(resDataOnlyChild.value[n])
resDataOnlyChild.value[n].disabled = false;
childTableCount = n;
}
console.log(childTableCount);
//console.log(childTableCount)
currentChildTableCount = childTableCount;
asfasfFieldTree.value = [
{
@ -2757,7 +2660,6 @@ function associatedFormsDataRangeDialoghandle() {
];
}
});
>>>>>>> qin_v6
associatedFormsDataRangeDialogFlag.value = true;
controlData.value.control.dataRangeConditionHtmlCopy =
@ -3261,7 +3163,6 @@ const activeFormName = ref("0");
@ 功能: 判断是否是组件
*/
const cssIsShouw = (val: any) => {
console.log("判断是否是组件", val);
if (val.length && val.length > 0) {
return true;
}
@ -4617,30 +4518,6 @@ const radioChangeSet = (val: any) => {
/>
</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-form-item label="组件尺寸" class="form_cont">
<el-radio-group v-model="formData.size">
@ -4729,7 +4606,6 @@ const radioChangeSet = (val: any) => {
<QuestionFilled />
</el-icon>
</el-tooltip>
>>>>>>> qin_v6
</el-button>
<el-button @click="editFormDict(state.tooltip.dict)">
设置数据字典
@ -5015,6 +4891,7 @@ const radioChangeSet = (val: any) => {
check-strictly
:render-after-expand="false"
filterable
node-key="id"
@change="formidChanged"
/>
</div>
@ -5320,7 +5197,7 @@ const radioChangeSet = (val: any) => {
:close-on-click-modal="false"
:show-close="false"
style="margin-top: 70px; min-height: 300px; max-height: 900px"
width="50%"
width="60%"
>
<template v-if="controlData.type == 'associatedForms'">
<el-button
@ -5361,299 +5238,6 @@ const radioChangeSet = (val: any) => {
</AssociatedFormsFillRole>
</template>
</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>
<el-popover
v-if="currentChildTableCount > 0"
@ -5673,7 +5257,6 @@ const radioChangeSet = (val: any) => {
@click="addChildFillRole"
> 子表填充规则</el-button
>
>>>>>>> qin_v6
</template>
</el-popover>
<div

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

@ -3,360 +3,268 @@
@ 时间: 2023-07-14 08:51:25
@ 备注: 表单子表
-->
<script lang='ts' setup>
import FormItem from './formItem.vue'
import { inject, computed } from 'vue'
import Tooltips from '@/components/DesignForm/tooltip.vue'
import {constFormProps } from '@/api/DesignForm/utils'
import { jsonParseStringify } from '@/utils/DesignForm'
import LowcodeImagePage from '@/components/DesignForm/public/expand/lowcodeImage.vue'
import AssociatedForms from '@/widget/associatedforms/index.vue'
import UploadPageList from '@/components/DesignForm/public/expand/uploadPageList.vue'
import LokOrgCentent from '@/widget/org/cont.vue'
import { SCOPE } from 'element-plus'
<script lang="ts" setup>
import FormItem from "./formItem.vue";
import { inject, computed } from "vue";
import Tooltips from "@/components/DesignForm/tooltip.vue";
import { constFormProps } from "@/api/DesignForm/utils";
import { jsonParseStringify } from "@/utils/DesignForm";
import LowcodeImagePage from "@/components/DesignForm/public/expand/lowcodeImage.vue";
import AssociatedForms from "@/widget/associatedforms/index.vue";
import UploadPageList from "@/components/DesignForm/public/expand/uploadPageList.vue";
import LokOrgCentent from "@/widget/org/cont.vue";
import { SCOPE } from "element-plus";
const props = withDefaults(
defineProps<{
data: any
}>(),
{
data: () => {
return {}
}
}
)
const formProps = inject(constFormProps, {}) as any
defineProps<{
data: any;
}>(),
{
data: () => {
return {};
},
}
);
const formProps = inject(constFormProps, {}) as any;
const tableDataNew = computed(() => {
// console.log("-----1---->",props.data.name)
// console.log("-----2---->",formProps.value.model[props.data.name])
// console.log("-----3---->",formProps.value.model)
// console.log("-----4---->",formProps.value)
return formProps.value.model[props.data.name]
})
// console.log("-----1---->",props.data.name)
// console.log("-----2---->",formProps.value.model[props.data.name])
// console.log("-----3---->",formProps.value.model)
// console.log("-----4---->",formProps.value)
return formProps.value.model[props.data.name];
});
const type = computed(() => {
return formProps.value.type
})
return formProps.value.type;
});
// true
const editDisabled = computed(() => {
return formProps.value.type === 2 && props.data.config?.editDisabled
})
return formProps.value.type === 2 && props.data.config?.editDisabled;
});
const addColumn = () => {
// console.log("--------->",tableDataNew.value)
const temp: any = {}
if (props.data.list) {
props.data.list.forEach((item: any) => {
if (item.name) {
temp[item.name] = item.control.modelValue
}
})
tableDataNew.value.push(jsonParseStringify(temp))
}
}
const getText = (text: any,val:any,name:any) => {
// console.log("text===>",text)
// console.log("name===>",name)
// console.log("val===>",val)
if (typeof text === 'string') {
return text
} else {
return text && text.toString()
}
}
// console.log("--------->",tableDataNew.value)
const temp: any = {};
if (props.data.list) {
props.data.list.forEach((item: any) => {
if (item.name) {
temp[item.name] = item.control.modelValue;
}
});
tableDataNew.value.push(jsonParseStringify(temp));
}
};
const getText = (text: any, val: any, name: any) => {
console.log("text===>", text);
console.log("name===>", name);
console.log("val===>", val);
if (typeof text === "string") {
return text;
} else {
return text && text.toString();
}
};
const delColumn = (index: number) => {
tableDataNew.value.splice(index, 1)
}
tableDataNew.value.splice(index, 1);
};
/**
@ 作者: 秦东
@ 时间: 2024-08-02 13:22:14
@ 功能: 时间戳转换对象
*/
const timeToAry = (timestamp:number) => {
const date = new Date(timestamp);
const year = date.getFullYear();
const month = ('0' + (date.getMonth() + 1)).slice(-2);
const day = ('0' + date.getDate()).slice(-2);
const hours = ('0' + date.getHours()).slice(-2);
const minutes = ('0' + date.getMinutes()).slice(-2);
const seconds = ('0' + date.getSeconds()).slice(-2);
return {
year:year,
month:month,
day:day,
hours:hours,
minutes:minutes,
seconds
}
}
const timeToAry = (timestamp: number) => {
const date = new Date(timestamp);
const year = date.getFullYear();
const month = ("0" + (date.getMonth() + 1)).slice(-2);
const day = ("0" + date.getDate()).slice(-2);
const hours = ("0" + date.getHours()).slice(-2);
const minutes = ("0" + date.getMinutes()).slice(-2);
const seconds = ("0" + date.getSeconds()).slice(-2);
return {
year: year,
month: month,
day: day,
hours: hours,
minutes: minutes,
seconds,
};
};
/**
@ 作者: 秦东
@ 时间: 2024-08-02 13:02:49
@ 功能: 将时间戳转换成字符串
*/
const timeToString = (timeVal:any,types:int) => {
// console.log("",timeVal,types)
let timeStr = ""
if(Array.isArray(timeVal)){
if(timeVal.length >= 2){
let startTime = timeToAry(timeVal[0])
let endTime = timeToAry(timeVal[1])
switch(types){
case "year": //
timeStr = `${startTime.year}${endTime.year}`;
break;
case "month": //
timeStr = `${startTime.year}-${startTime.month}${endTime.year}-${endTime.month}`;
break;
case "datetime": //+
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;
case "week": //
let startWeek = getYearWeek(startTime)
let endWeek = getYearWeek(endTime)
timeStr = `${startWeek}${endWeek}`;
break;
case "timeCalss": //
timeStr = `${startTime.hours}:${startTime.minutes}:${startTime.seconds}${endTime.hours}:${endTime.minutes}:${endTime.seconds}`;
break;
case "datetimerange":
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;
case "daterange":
timeStr = `${startTime.year}-${startTime.month}-${startTime.day}${endTime.year}-${endTime.month}-${endTime.day}`;
break;
case "monthrange":
timeStr = `${startTime.year}-${startTime.month}${endTime.year}-${endTime.month}`;
break;
default:
timeStr = `${startTime.year}-${startTime.month}-${startTime.day}${endTime.year}-${endTime.month}-${endTime.day}`;
break;
}
}else if(timeVal.length == 1){
let {year,month,day,hours,minutes,seconds} = timeToAry(timeVal[0])
switch(types){
case "year": //
timeStr = `${year}`;
break;
case "month": //
timeStr = `${year}-${month}`;
break;
case "datetime": //+
timeStr = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
break;
case "week": //
timeStr = getYearWeek(timeVal)
break;
case "timeCalss": //
timeStr = `${hours}:${minutes}:${seconds}`;
break;
default:
timeStr = `${year}-${month}-${day}`
break;
}
}else{
timeStr = "未知时间"
}
}else{
let {year,month,day,hours,minutes,seconds} = timeToAry(timeVal)
switch(types){
case "year": //
timeStr = `${year}`;
break;
case "month": //
timeStr = `${year}-${month}`;
break;
case "datetime": //+
timeStr = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
break;
case "week": //
timeStr = getYearWeek(timeVal)
break;
case "timePicker": //
timeStr = `${hours}:${minutes}:${seconds}`;
break;
default:
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;
}
if(strArt.length > 0){
timeStr = strArt.toString()
}
}
}
return timeStr
=======
let associatedFormsIndexTablekey = 0
const timeToString = (timeVal: any, types: int) => {
let timeStr = "";
if (Array.isArray(timeVal)) {
if (timeVal.length >= 2) {
let startTime = timeToAry(timeVal[0]);
let endTime = timeToAry(timeVal[1]);
switch (types) {
case "year": //
timeStr = `${startTime.year}${endTime.year}`;
break;
case "month": //
timeStr = `${startTime.year}-${startTime.month}${endTime.year}-${endTime.month}`;
break;
case "datetime": //+
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;
case "week": //
let startWeek = getYearWeek(startTime);
let endWeek = getYearWeek(endTime);
timeStr = `${startWeek}${endWeek}`;
break;
case "timeCalss": //
timeStr = `${startTime.hours}:${startTime.minutes}:${startTime.seconds}${endTime.hours}:${endTime.minutes}:${endTime.seconds}`;
break;
case "datetimerange":
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;
case "daterange":
timeStr = `${startTime.year}-${startTime.month}-${startTime.day}${endTime.year}-${endTime.month}-${endTime.day}`;
break;
case "monthrange":
timeStr = `${startTime.year}-${startTime.month}${endTime.year}-${endTime.month}`;
break;
default:
timeStr = `${startTime.year}-${startTime.month}-${startTime.day}${endTime.year}-${endTime.month}-${endTime.day}`;
break;
}
} else if (timeVal.length == 1) {
let { year, month, day, hours, minutes, seconds } = timeToAry(timeVal[0]);
switch (types) {
case "year": //
timeStr = `${year}`;
break;
case "month": //
timeStr = `${year}-${month}`;
break;
case "datetime": //+
timeStr = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
break;
case "week": //
timeStr = getYearWeek(timeVal);
break;
case "timeCalss": //
timeStr = `${hours}:${minutes}:${seconds}`;
break;
default:
timeStr = `${year}-${month}-${day}`;
break;
}
} else {
timeStr = "未知时间";
}
} else {
let { year, month, day, hours, minutes, seconds } = timeToAry(timeVal);
switch (types) {
case "year": //
timeStr = `${year}`;
break;
case "month": //
timeStr = `${year}-${month}`;
break;
case "datetime": //+
timeStr = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
break;
case "week": //
timeStr = getYearWeek(timeVal);
break;
case "timeCalss": //
timeStr = `${hours}:${minutes}:${seconds}`;
break;
default:
timeStr = `${year}-${month}-${day}`;
break;
}
}
return timeStr;
};
let associatedFormsIndexTablekey = 0;
const emits = defineEmits<{
(e: 'asfValueChanged', val: any): void
}>()
(e: "asfValueChanged", val: any): void;
}>();
function asfValueChanged(val:any){
//console.log("childTable-asfValueChanged",val)
emits("asfValueChanged",val)
>>>>>>> lwx_v10
function asfValueChanged(val: any) {
//console.log("childTable-asfValueChanged",val)
emits("asfValueChanged", val);
}
</script>
<template>
<div class="form-table form-table-add">
<el-table
v-bind="data.control"
:class="[data.className]"
:data="tableDataNew"
>
<el-table-column
v-for="(item, index) in data.list"
:key="index"
:prop="item.name"
:label="item.item.label"
:width="item.item.span"
>
<template #default="scope">
<span v-if="item.type === 'index'">{{ scope.$index + 1 }}</span>
<div v-if="type === 4 || editDisabled">
<LokOrgCentent v-if="item.type == 'orgCentent'" :orgid="scope.row[item.name].toString()" />
<div v-else-if="item.type=='lowcodeImage'">
<LowcodeImagePage :data="item"
v-model="scope.row[item.name]" />
</div>
<div v-else-if="item.type=='upload'" >
<UploadPageList :data="item" :img-list="scope.row[item.name]" :control="item.control" />
</div>
<div v-else-if="item.type=='datePicker'" v-html="timeToString(scope.row[item.name],item.control.type)">
</div>
<<<<<<< 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 v-else-if="item.type=='select'" v-html="optToString(scope.row[item.name],item)">
=======
<div v-else-if="item.type=='associatedForms'">
<AssociatedForms :data="item"
v-model="scope.row[item.name]" :tablekey="associatedFormsIndexTablekey" :row-index="scope.$index"/>
>>>>>>> lwx_v10
</div>
<div v-else>{{ getText(scope.row[item.name],scope.row,item.name) }}</div>
</div>
<div v-else>
<form-item
v-model="scope.row[item.name]"
:tProp="`${data.name}.${scope.$index}.${item.name}`"
:row-index="scope.$index"
:data="item"
@asf-value-changed="asfValueChanged"
/>
</div>
</template>
<template #header="scope" v-if="item.help">
{{ scope.column.label }}
<Tooltip :content="item.help" />
</template>
</el-table-column>
<el-table-column
prop="del"
label="操作"
v-if="[1, 2].includes(type as number) && data.config.delBtnText && !editDisabled"
>
<template #default="scope">
<el-button link type="primary" @click="delColumn(scope.$index)">{{ data.config.delBtnText }}</el-button>
</template>
</el-table-column>
</el-table>
<div
class="table-btn"
v-if="[1, 2].includes(type as number) && data.config.addBtnText && !editDisabled"
>
<el-button size="small" @click="addColumn">{{ data.config.addBtnText }}</el-button>
</div>
</div>
<div class="form-table form-table-add">
<el-table v-bind="data.control" :class="[data.className]" :data="tableDataNew">
<el-table-column
v-for="(item, index) in data.list"
:key="index"
:prop="item.name"
:label="item.item.label"
:width="item.item.span"
>
<template #default="scope">
<span v-if="item.type === 'index'">{{ scope.$index + 1 }}</span>
<div v-if="type === 4 || editDisabled">
<LokOrgCentent
v-if="item.type == 'orgCentent'"
:orgid="scope.row[item.name].toString()"
/>
<div v-else-if="item.type == 'lowcodeImage'">
<LowcodeImagePage :data="item" v-model="scope.row[item.name]" />
</div>
<div v-else-if="item.type == 'upload'">
<UploadPageList
:data="item"
:img-list="scope.row[item.name]"
:control="item.control"
/>
</div>
<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'">
<AssociatedForms
:data="item"
v-model="scope.row[item.name]"
:tablekey="associatedFormsIndexTablekey"
:row-index="scope.$index"
/>
</div>
<div v-else>{{ getText(scope.row[item.name], scope.row, item.name) }}</div>
</div>
<div v-else>
<form-item
v-model="scope.row[item.name]"
:tProp="`${data.name}.${scope.$index}.${item.name}`"
:row-index="scope.$index"
:data="item"
@asf-value-changed="asfValueChanged"
/>
</div>
</template>
<template #header="scope" v-if="item.help">
{{ scope.column.label }}
<Tooltip :content="item.help" />
</template>
</el-table-column>
<el-table-column
prop="del"
label="操作"
v-if="[1, 2].includes(type as number) && data.config.delBtnText && !editDisabled"
>
<template #default="scope">
<el-button link type="primary" @click="delColumn(scope.$index)">{{
data.config.delBtnText
}}</el-button>
</template>
</el-table-column>
</el-table>
<div
class="table-btn"
v-if="[1, 2].includes(type as number) && data.config.addBtnText && !editDisabled"
>
<el-button size="small" @click="addColumn">{{ data.config.addBtnText }}</el-button>
</div>
</div>
</template>
<style lang='scss' scoped>
</style>
<style lang="scss" scoped></style>

Loading…
Cancel
Save