From e90fea95905f523d278c7e10a181ddbc47e74c2b Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期五, 08 九月 2023 15:44:58 +0800 Subject: [PATCH] 集成日志bug --- Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue | 109 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 92 insertions(+), 17 deletions(-) diff --git a/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue b/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue index b72f827..610ff04 100644 --- a/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue +++ b/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue @@ -50,7 +50,7 @@ // 榛樿绂佺敤鍏冪礌 disabledProp: { type: Array, - default: () => ["id","lcstatus"], + default: () => ["id", "lcstatus"], }, templateOid: { type: String, @@ -80,6 +80,11 @@ type: Object, default: () => ({}), }, + // 涓�琛屾斁鍑犱釜琛ㄥ崟 + trendsSpan: { + type: Number, + default: 8, + } }, data() { return { @@ -103,9 +108,6 @@ date: "date", refer: "refer", }, - // 鍋囨暟鎹� - testItems: [], - trendsSpan: 8, defaultValue: {}, // 琛ㄥ崟灞炴�� attributes: [], @@ -115,6 +117,16 @@ mounted() { this.handleResize(); }, + computed: { + localTrendsSpan() { + if (this.trendsSpan) { + return this.trendsSpan; + } else { + let windowWidth = document.body.clientWidth; + return 24 / Math.floor(windowWidth / 500); + } + }, + }, methods: { // 娓叉煋琛ㄥ崟妯℃澘 templateRender(formItemList) { @@ -123,8 +135,11 @@ let group = []; let dictKeys = []; let slotColumnList = []; + let value='' formItemList.forEach((formItem) => { formItem = this.resetFormConfig(formItem); + // console.log('formItem',formItem) + // console.log('formItem.dicData.value',formItem.dicData) if (formItem.type === "line") { group.push({ label: formItem.text, @@ -137,7 +152,8 @@ if ( formItem.type === "combox" && formItem.comboxKey && - (!Array.isArray(formItem.dicData) || formItem.dicData.length === 0) &&(!Array.isArray(formItem.data) || formItem.data.length === 0) + (!Array.isArray(formItem.dicData) || formItem.dicData.length === 0) && + (!Array.isArray(formItem.data) || formItem.data.length === 0) ) { dictKeys.push({ dictKey: formItem.comboxKey, field: formItem.field }); } @@ -145,9 +161,9 @@ if (this.disabledProp.includes(formItem.field)) { formItem.readOnly = true; } - if(formItem.field=='lcstatus'){ - formItem.field=formItem.field+'_text'; - formItem.readOnly=true; + if (formItem.field == "lcstatus") { + formItem.field = formItem.field + "_text"; + formItem.readOnly = true; } // 璁剧疆琛ㄥ崟鏍¢獙鐨勮鍒欙紝鏂囨湰 let message = "璇烽�夋嫨"; @@ -155,6 +171,12 @@ if (formItem.type === "text") { message = "璇疯緭鍏�"; trigger = "blur"; + } + let fieldMapKey='' + if( formItem.type == "refer"){ + if(!formItem.fieldMap){ + fieldMapKey=formItem.field+'Id' + } } let columnItem = { label: formItem.text, @@ -165,18 +187,21 @@ field: formItem.field, type: this.columnType[formItem.type], dicData: this.getDataList(formItem.type, formItem.data), - disabled: this.type === "detail" ? true : formItem.readOnly, + 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, + valueFormat:formItem.dateFormate, format: formItem.dateFormate, keyAttr: formItem.keyAttr, - value: formItem.defaultValue, + value: (formItem.dicData && formItem.dicData.length > 0 && formItem.secType == "codefixedsec" ? formItem.dicData[0].id : null) || + (formItem.secType == "codedatesec"?formItem.codeDateFormatStr: null), placeholder: formItem.inputTip, comboxKey: formItem.comboxKey, tip: formItem.tooltips, + // hidden:formItem.secType && formItem.codeValueApplyStatus == 3 ? true : false, + // readonly:formItem.codeValueApplyStatus && formItem.codeValueApplyStatus == 2 ?true : false , display: !formItem.hidden, maxlength: formItem.maxlength, filterable: true, @@ -186,15 +211,20 @@ title: formItem.text, showField: formItem.showField || formItem.field, field: formItem.field, + fieldMap:formItem.fieldMap || {fieldMapKey:'id'}, placeholder: formItem.inputTip, - options: formItem.referConfig, + options: formItem.referConfig } : {}, - span: formItem.span ? formItem.span : formItem.type === "textarea" ? 24 : this.trendsSpan, + span: formItem.span + ? formItem.span + : formItem.type === "textarea" + ? 24 + : this.localTrendsSpan, rules: [ { required: formItem.required, - message: `璇�${message}${formItem.text}`, + message: `${message}${formItem.text}`, trigger, }, { @@ -209,7 +239,9 @@ value: "key", }, }; + // console.log('columnItem',columnItem) slotColumnList.push(columnItem); + // console.log('slotColumnList',slotColumnList) if (group.length === 0) { column.push(columnItem); } else { @@ -226,9 +258,12 @@ this.geDictData(dictKeys); this.getFormDetail(); + // console.log('selfColumnConfig',this.selfColumnConfig) + }, // 浣跨敤浼犲叆鐨勮〃鍗曟暟鎹厤缃� resetFormConfig(formItem) { + // console.log(this.selfColumnConfig) for (const configType in this.selfColumnConfig) { if (Object.hasOwnProperty.call(this.selfColumnConfig, configType)) { const element = this.selfColumnConfig[configType]; @@ -244,6 +279,9 @@ if (Object.hasOwnProperty.call(element, newAttr)) { const oldAttr = element[newAttr]; formItem[newAttr] = formItem[oldAttr]; + // console.log(formItem) + // console.log(newAttr,oldAttr) + // console.log(formItem[newAttr],formItem[oldAttr]) } } } else if (configType === "directVoluation") { @@ -260,9 +298,9 @@ }, // 鏍规嵁灞忓箷鍔ㄦ�侀厤缃〃鍗曞竷灞� handleResize() { - let windowWidth = document.body.clientWidth; - this.trendsSpan = 24 / Math.floor(windowWidth / 500); - this.updateIndex++; + // let windowWidth = document.body.clientWidth; + // this.trendsSpan = 24 / Math.floor(windowWidth / 500); + // this.updateIndex++; }, // 鍓嶅悗缂� preOrSufFixShow(type, val) { @@ -334,9 +372,46 @@ ); }, setReferValue(data) { + // console.log(data) if (data.field) { this.form[data.field] = data.value || ""; this.form[data.showField] = data.text || ""; + if (data.fieldMap) { + //璇存槑闇�瑕佹槧灏� + for (let key in data.fieldMap) { + let mapFields = data.fieldMap[key].split(","); + let value = []; + data.rawData.forEach(_item => { + var temp; + if (!_item.attributes) { + _item.attributes = _item; + } + if (mapFields.length == 1) { + var mapField = mapFields[0]; + if (mapField.indexOf("attribute.") > -1) { + temp = _item['attributes'][mapField.subString("attribute.".length)]; + } else { + temp = _item['attributes'][mapField] || _item[mapField]; + } + } else { + //鏈夊涓� + var mutiTemp = []; + layui.each(mapFields, function (_indexField, _itemField) { + if (_itemField.indexOf("attribute.") > -1) { + mutiTemp.push(_item['attributes'][_itemField.subString("attribute.".length)]); + } else { + mutiTemp.push(_item['attributes'][_itemField] || _item[_itemField]); + } + }); + temp = mutiTemp.join(' '); + } + if (temp != null && temp != '') { + value.push(temp); + } + }) + this.form[key] = value.join(','); + } + } this.$emit("getFormData", this.form); this.$emit("referConfigDataUpdate", data); } -- Gitblit v1.9.3