From f5b7cec75d47c5eedf96a1d10043bf7c51b849a1 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期四, 16 十一月 2023 15:09:10 +0800
Subject: [PATCH] 属性码段-联动效果
---
Source/UBCS-WEB/src/components/FormTemplate/index.vue | 13 ++++
Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue | 141 +++++++++++++++++++++++++---------------------
2 files changed, 89 insertions(+), 65 deletions(-)
diff --git a/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue b/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue
index ea31d7c..dff9401 100644
--- a/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue
+++ b/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue
@@ -3,37 +3,37 @@
<template>
<div>
<avue-form
- v-model="form"
- :option="option"
- v-loading="loading"
- ref="form"
- :style="{ minHeight: loading ? '300px' : '' }"
:key="updateIndex"
+ ref="form"
+ v-model="form"
+ v-loading="loading"
+ :option="option"
+ :style="{ minHeight: loading ? '300px' : '' }"
>
- <template :slot="item.prop + 'Label'" v-for="item in slotColumnList">
+ <template v-for="item in slotColumnList" :slot="item.prop + 'Label'">
<span>
<span>{{ item.label }} </span>
<el-tooltip
v-if="item.keyAttr"
class="item"
- effect="dark"
content="璇ュ睘鎬т负鍏抽敭灞炴��"
+ effect="dark"
placement="top-start"
>
<i class="el-icon-star-on key_attr_icon"></i>
</el-tooltip>
</span>
</template>
- <template :slot="item.prop + ''" v-for="item in slotColumnList">
+ <template v-for="item in slotColumnList" :slot="item.prop + ''">
<vciWebRefer
- :key="item.dataKey" :data-key="item.dataKey"
- v-if="item.type == 'refer'"
- :referConfig="item.referConfig || {}"
- :value="form[item.referConfig.field] || item.value"
- :text="form[item.referConfig.showField]"
+ v-if="item.type == 'refer'" :key="item.dataKey"
+ :data-key="item.dataKey"
:disabled="item.disabled"
:display="item.display"
+ :referConfig="item.referConfig || {}"
:reloadData="item.referConfig.reloadData || false"
+ :text="form[item.referConfig.showField]"
+ :value="form[item.referConfig.field] || item.value"
@setReferValue="setReferValue"
></vciWebRefer>
</template>
@@ -42,12 +42,13 @@
</template>
<script>
-import { getFormDetail } from "@/api/formTemplate";
-import { getEnumDictionary } from "../../api/system/dict";
+import {getFormDetail} from "@/api/formTemplate";
+import {getEnumDictionary} from "../../api/system/dict";
import vciWebRefer from "../refer/vciWebRefer.vue";
+
export default {
name: "FormTemplate",
- components: { vciWebRefer },
+ components: {vciWebRefer},
props: {
// 榛樿绂佺敤鍏冪礌
disabledProp: {
@@ -62,9 +63,9 @@
type: String,
default: "",
},
- LoadingStatus:{
+ LoadingStatus: {
type: String,
- default : "code"
+ default: "code"
},
// 鍒楄〃鏁版嵁oid
rowOid: {
@@ -91,21 +92,22 @@
type: Number,
default: 8,
},
- TreeValue:{
+ TreeValue: {
type: String,
default: "",
},
- eventList:{
- type:Array
+ eventList: {
+ type: Array
}
},
data() {
return {
- add:'',
- codeattrsecValue:'',
- ValidataValue:false,
- eventFlag:{},
- TreeValueForm:'',
+ attrList: [],
+ add: '',
+ codeattrsecValue: '',
+ ValidataValue: false,
+ eventFlag: {},
+ TreeValueForm: '',
updateIndex: 0,
form: {},
option: {
@@ -160,24 +162,33 @@
immediate: true,
handler(newV) {
this.$emit("getFormData", newV);
- // console.log("getFormData", newV)
},
},
- TreeValue:{
- handler(newval,oldval){
- if(newval){
- this.TreeValueForm=newval;
+
+ attrList: {
+ deep: true,
+ immediate: true,
+ handler(newVal, oldVal) {
+ if (newVal) {
+ this.$emit("attrList", newVal)
+ }
+ }
+ },
+ TreeValue: {
+ handler(newval, oldval) {
+ if (newval) {
+ this.TreeValueForm = newval;
}
},
- deep:true,
- immediate:true
+ deep: true,
+ immediate: true
},
},
methods: {
// 娓叉煋琛ㄥ崟妯℃澘
- templateRender(formItemList,TreeValue) {
+ templateRender(formItemList, TreeValue) {
if (this.eventList) {
- this.eventFlag= this.eventList.some(item => {
+ this.eventFlag = this.eventList.some(item => {
if (item.classifyInvokeEditFlag === 'true') {
this.eventObject = item;
return true;
@@ -192,9 +203,9 @@
formItemList.forEach((formItem) => {
// console.log('formItem',formItem)
formItem = this.resetFormConfig(formItem);
- // if(formItem.type === "datetime"){
- // return;
- // }
+ if (formItem.secType === "codeattrsec") {
+ this.attrList.push(formItem);
+ }
if (formItem.type === "line") {
group.push({
label: formItem.text,
@@ -210,7 +221,7 @@
(!Array.isArray(formItem.dicData) || formItem.dicData.length === 0) &&
(!Array.isArray(formItem.data) || formItem.data.length === 0)
) {
- dictKeys.push({ dictKey: formItem.comboxKey, field: formItem.field });
+ dictKeys.push({dictKey: formItem.comboxKey, field: formItem.field});
}
// 绂佺敤閮ㄥ垎灞炴�э紙澶栭儴浼犲�肩鐢ㄥ拰鍙傜収绂佺敤锛�
if (this.disabledProp.includes(formItem.field)) {
@@ -227,23 +238,23 @@
message = "璇疯緭鍏�";
trigger = "blur";
}
- let fieldMapKey=''
- if( formItem.type == "refer" && !formItem.fieldMap){
- fieldMapKey=formItem.field+'Id'
- formItem.fieldMap={}
- formItem.fieldMap[fieldMapKey]='id'
- formItem.fieldMap[formItem.field+'id']='id'
+ let fieldMapKey = ''
+ if (formItem.type == "refer" && !formItem.fieldMap) {
+ fieldMapKey = formItem.field + 'Id'
+ formItem.fieldMap = {}
+ formItem.fieldMap[fieldMapKey] = 'id'
+ formItem.fieldMap[formItem.field + 'id'] = 'id'
}
let columnItem = {
- change:(val)=>{
- if(val.column.field === "drawingno"){
- this.codeattrsecValue=val.value;
+ change: (val) => {
+ if (val.column.field === "drawingno") {
+ this.codeattrsecValue = val.value;
}
// console.log(this.codeattrsecValue)
},
- dataKey:formItem.dataKey || formItem.field,
+ dataKey: formItem.dataKey || formItem.field,
label: formItem.text,
labelslot: true,
prop: this.$utilFunc.isValuableObj(formItem.referConfig)
@@ -252,16 +263,16 @@
field: formItem.field,
type: this.columnType[formItem.type],
dicData: this.getDataList(formItem.type, formItem.data),
- disabled: this.type === "detail" ? true : formItem.readOnly || (formItem.codeValueApplyStatus && formItem.codeValueApplyStatus == 2 ?true : false) ,
+ disabled: this.type === "detail" ? true : formItem.readOnly || (formItem.codeValueApplyStatus && formItem.codeValueApplyStatus == 2 ? true : false),
prepend: this.preOrSufFixShow("text", formItem.prefix),
append: this.preOrSufFixShow("text", formItem.suffix),
prefixIcon: this.preOrSufFixShow("icon", formItem.prefix),
suffixIcon: this.preOrSufFixShow("icon", formItem.suffix),
- valueFormat:formItem.dateFormate || "yyyy-MM-dd HH:mm:ss",
+ valueFormat: formItem.dateFormate || "yyyy-MM-dd HH:mm:ss",
format: formItem.dateFormate,
keyAttr: formItem.keyAttr,
value: (formItem.dicData && formItem.dicData.length > 0 && formItem.secType == "codefixedsec" ? formItem.dicData[0].id : null) ||
- (formItem.secType == "codedatesec" ? formItem.codeDateValue: null) || ( TreeValue && formItem.secType == "codelevelsec" ? TreeValue : null) ||
+ (formItem.secType == "codedatesec" ? formItem.codeDateValue : null) || (TreeValue && formItem.secType == "codelevelsec" ? TreeValue : null) ||
(formItem.secType == "codeattrsec" ? this.add : null),
placeholder: formItem.inputTip,
comboxKey: formItem.comboxKey,
@@ -277,7 +288,7 @@
title: formItem.text,
showField: formItem.showField || formItem.field,
field: formItem.field,
- fieldMap:formItem.fieldMap || {},
+ fieldMap: formItem.fieldMap || {},
placeholder: formItem.inputTip,
options: formItem.referConfig
}
@@ -326,10 +337,10 @@
this.getFormDetail();
},
//淇敼绾ц仈椤�
- changeChildItem(items,TreeValue) {
+ changeChildItem(items, TreeValue) {
let column = this.option.column;
let group = this.option.group;
- let that=this;
+ let that = this;
items.forEach((item) => {
let formItem = this.resetFormConfig(item);
@@ -352,8 +363,8 @@
formItem.fieldMap[formItem.field + 'id'] = 'id'
}
let columnItem = {
- change:(val)=>{
- console.log('1',val)
+ change: (val) => {
+ console.log('1', val)
},
label: formItem.text,
labelslot: true,
@@ -417,7 +428,7 @@
};
if (group.length === 0) {
- that.slotColumnList.forEach((colItem,index) => {
+ that.slotColumnList.forEach((colItem, index) => {
if (colItem.field == columnItem.field) {
that.slotColumnList[index] = columnItem;
column[index] = columnItem;
@@ -425,14 +436,14 @@
}
})
} else {
- that.slotColumnList.forEach((colItem,index) => {
+ that.slotColumnList.forEach((colItem, index) => {
if (colItem.field == columnItem.field) {
that.slotColumnList[index] = columnItem;
return;
}
})
- group.forEach((groupItem,index) => {
- groupItem.column.forEach((colItem,colIndex) => {
+ group.forEach((groupItem, index) => {
+ groupItem.column.forEach((colItem, colIndex) => {
if (colItem.field == columnItem.field) {
group[index].column[colIndex] = columnItem;
return;
@@ -511,7 +522,7 @@
// 寮傛鑾峰彇瀛楀吀鏁版嵁
geDictData(dictKeys) {
dictKeys.forEach((dictObj) => {
- getEnumDictionary({ code: dictObj.dictKey }).then((res) => {
+ getEnumDictionary({code: dictObj.dictKey}).then((res) => {
if (res.data && res.data.code === 200) {
this.option.column = this.option.column.map((item) => {
if (item.field === dictObj.field) {
@@ -535,7 +546,7 @@
if (valid) {
done();
resolve(true);
- this.ValidataValue=true;
+ this.ValidataValue = true;
} else {
resolve(false);
}
@@ -545,7 +556,7 @@
// 鑾峰彇琛ㄥ崟璇︽儏鏁版嵁
getFormDetail() {
if (this.type === "add") return;
- getFormDetail({ templateOid: this.templateOid, oid: this.rowOid }).then(
+ getFormDetail({templateOid: this.templateOid, oid: this.rowOid}).then(
(res) => {
this.form = Object.assign(this.form, res.data.data[0]);
this.loading = false;
@@ -574,7 +585,7 @@
if (mapField.indexOf("attribute.") > -1) {
temp = _item['attributes'][mapField.subString("attribute.".length)] || _item['attributes']['data'][mapField.subString("attribute.".length)];
} else {
- temp = _item['attributes'][mapField] ||_item['attributes']['data'][mapField] || _item[mapField];
+ temp = _item['attributes'][mapField] || _item['attributes']['data'][mapField] || _item[mapField];
}
} else {
//鏈夊涓�
diff --git a/Source/UBCS-WEB/src/components/FormTemplate/index.vue b/Source/UBCS-WEB/src/components/FormTemplate/index.vue
index d129e12..fd884ed 100644
--- a/Source/UBCS-WEB/src/components/FormTemplate/index.vue
+++ b/Source/UBCS-WEB/src/components/FormTemplate/index.vue
@@ -41,6 +41,7 @@
:selfColumnConfig="selfColumnConfig"
ref="CodeApply"
@getFormData="getCodeApplyFormData"
+ @attrList="attrListForm"
@referConfigDataUpdate="referConfigDataUpdate"
></FormTemplate>
</el-tab-pane>
@@ -131,6 +132,7 @@
},
data() {
return {
+ attrList:[],
eventList:[],
//鐮佸�肩殑绗簩绉嶅彧璇婚殣钘忔儏鍐�
codeValueApplyStatus:'',
@@ -318,6 +320,17 @@
},
getFormData(form) {
this.form = form;
+ if (this.attrList) {
+ this.attrList.forEach(item => {
+ if (this.form.hasOwnProperty(item.referAttributeId)) {
+ let oid = item.oid; // 澹版槑涓�涓彉閲忚褰曚笅涓�鑷寸殑item鐨刼id
+ this.codeApplyForm[oid] = this.form[item.referAttributeId] ;
+ }
+ })
+ }
+ },
+ attrListForm(attrListForm){
+ this.attrList=attrListForm;
},
getCodeApplyFormData(codeApplyForm) {
this.codeApplyForm = codeApplyForm;
--
Gitblit v1.9.3