| | |
| | | </template> |
| | | <template :slot="item.prop + ''" v-for="item in slotColumnList"> |
| | | <vciWebRefer |
| | | :key="item.prop" :data-key="item.prop" |
| | | v-if="item.type == 'refer'" |
| | | :referConfig="item.referConfig || {}" |
| | | :value="form[item.referConfig.field] || item.value" |
| | |
| | | trendsSpan: { |
| | | type: Number, |
| | | default: 8, |
| | | }, |
| | | TreeValue:{ |
| | | type: String, |
| | | default: "", |
| | | }, |
| | | eventList:{ |
| | | type:Array |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | eventFlag:{}, |
| | | TreeValueForm:'', |
| | | updateIndex: 0, |
| | | form: {}, |
| | | option: { |
| | |
| | | mounted() { |
| | | this.handleResize(); |
| | | }, |
| | | created() { |
| | | |
| | | }, |
| | | computed: { |
| | | localTrendsSpan() { |
| | | if (this.trendsSpan) { |
| | |
| | | return 24 / Math.floor(windowWidth / 500); |
| | | } |
| | | }, |
| | | |
| | | }, |
| | | watch: { |
| | | // 表单数据修改反馈到父组件 |
| | | form: { |
| | | deep: true, |
| | | immediate: true, |
| | | handler(newV) { |
| | | this.$emit("getFormData", newV); |
| | | }, |
| | | }, |
| | | TreeValue:{ |
| | | handler(newval,oldval){ |
| | | if(newval){ |
| | | this.TreeValueForm=newval; |
| | | } |
| | | }, |
| | | deep:true, |
| | | immediate:true |
| | | } |
| | | }, |
| | | methods: { |
| | | // 渲染表单模板 |
| | | templateRender(formItemList) { |
| | | templateRender(formItemList,TreeValue) { |
| | | if (this.eventList) { |
| | | this.eventFlag= this.eventList.some(item => { |
| | | if (item.classifyInvokeEditFlag === 'true') { |
| | | this.eventObject = item; |
| | | return true; |
| | | } |
| | | }); |
| | | } |
| | | // 无需分组数据 |
| | | let column = []; |
| | | 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, |
| | |
| | | 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), |
| | |
| | | valueFormat:formItem.dateFormate, |
| | | format: formItem.dateFormate, |
| | | keyAttr: formItem.keyAttr, |
| | | value: formItem.dicData && formItem.dicData.length > 0 && formItem.type == 'combox' ? formItem.dicData[0].id : null, |
| | | 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) , |
| | | placeholder: formItem.inputTip, |
| | | comboxKey: formItem.comboxKey, |
| | | tip: formItem.tooltips, |
| | | // readonly:true, |
| | | // hidden:formItem.secType && formItem.codeValueApplyStatus == 3 ? true : false, |
| | | // readonly:formItem.codeValueApplyStatus && formItem.codeValueApplyStatus == 2 ?true : false , |
| | | display: !formItem.hidden, |
| | | maxlength: formItem.maxlength, |
| | | filterable: true, |
| | |
| | | value: "key", |
| | | }, |
| | | }; |
| | | if(columnItem.type == "select"){ |
| | | |
| | | } |
| | | console.log('columnItem',columnItem) |
| | | slotColumnList.push(columnItem); |
| | | if (group.length === 0) { |
| | | column.push(columnItem); |
| | |
| | | |
| | | this.geDictData(dictKeys); |
| | | this.getFormDetail(); |
| | | // console.log('selfColumnConfig',this.selfColumnConfig) |
| | | |
| | | }, |
| | | // 使用传入的表单数据配置 |
| | |
| | | ); |
| | | }, |
| | | setReferValue(data) { |
| | | debugger; |
| | | if (data.field) { |
| | | this.form[data.field] = data.value || ""; |
| | | this.form[data.showField] = data.text || ""; |
| | |
| | | if (!_item.attributes) { |
| | | _item.attributes = _item; |
| | | } |
| | | if (!_item.attributes.data) { |
| | | _item.attributes.data = {}; |
| | | } |
| | | if (mapFields.length == 1) { |
| | | var mapField = mapFields[0]; |
| | | if (mapField.indexOf("attribute.") > -1) { |
| | | temp = _item['attributes'][mapField.subString("attribute.".length)]; |
| | | temp = _item['attributes'][mapField.subString("attribute.".length)] || _item['attributes']['data'][mapField.subString("attribute.".length)]; |
| | | } else { |
| | | temp = _item['attributes'][mapField] || _item[mapField]; |
| | | temp = _item['attributes'][mapField] ||_item['attributes']['data'][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)]); |
| | | mutiTemp.push(_item['attributes'][_itemField.subString("attribute.".length)] || _item['attributes']['data'][_itemField.subString("attribute.".length)]); |
| | | } else { |
| | | mutiTemp.push(_item['attributes'][_itemField] || _item[_itemField]); |
| | | mutiTemp.push(_item['attributes'][_itemField] || _item['attributes']['data'][_itemField] || _item[_itemField]); |
| | | } |
| | | }); |
| | | temp = mutiTemp.join(' '); |
| | |
| | | this.$emit("getFormData", this.form); |
| | | this.$emit("referConfigDataUpdate", data); |
| | | } |
| | | }, |
| | | }, |
| | | watch: { |
| | | // 表单数据修改反馈到父组件 |
| | | form: { |
| | | deep: true, |
| | | immediate: true, |
| | | handler(newV) { |
| | | this.$emit("getFormData", newV); |
| | | }, |
| | | }, |
| | | }, |
| | | }; |