| | |
| | | </template> |
| | | <template :slot="item.prop + ''" v-for="item in slotColumnList"> |
| | | <vciWebRefer |
| | | :key="item.prop" :data-key="item.prop" |
| | | :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]" |
| | | :disabled="item.disabled" |
| | | :display="item.display" |
| | | :reloadData="item.referConfig.reloadData || false" |
| | | @setReferValue="setReferValue" |
| | | ></vciWebRefer> |
| | | </template> |
| | |
| | | |
| | | <script> |
| | | import { getFormDetail } from "@/api/formTemplate"; |
| | | import { getDictionary } from "../../api/system/dict"; |
| | | import { getEnumDictionary } from "../../api/system/dict"; |
| | | import vciWebRefer from "../refer/vciWebRefer.vue"; |
| | | export default { |
| | | name: "FormTemplate", |
| | |
| | | type: String, |
| | | default: "", |
| | | }, |
| | | LoadingStatus:{ |
| | | type: String, |
| | | default : "code" |
| | | }, |
| | | // 列表数据oid |
| | | rowOid: { |
| | | type: String, |
| | |
| | | // 表单类型(add, edit, detail) |
| | | type: { |
| | | type: String, |
| | | default: "add", |
| | | default: "", |
| | | }, |
| | | // 自定义表单类型 |
| | | selfColumnType: { |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | codeattrsecValue:'', |
| | | ValidataValue:false, |
| | | eventFlag:{}, |
| | | TreeValueForm:'', |
| | | updateIndex: 0, |
| | |
| | | mounted() { |
| | | this.handleResize(); |
| | | }, |
| | | updated() { |
| | | }, |
| | | created() { |
| | | |
| | | if (this.LoadingStatus === 'code') { |
| | | this.loading = false; |
| | | } |
| | | }, |
| | | computed: { |
| | | localTrendsSpan() { |
| | |
| | | }, |
| | | deep:true, |
| | | immediate:true |
| | | } |
| | | }, |
| | | }, |
| | | methods: { |
| | | // 渲染表单模板 |
| | |
| | | formItem.fieldMap[fieldMapKey]='id' |
| | | formItem.fieldMap[formItem.field+'id']='id' |
| | | } |
| | | |
| | | |
| | | let columnItem = { |
| | | change:(val)=>{ |
| | | // console.log(val) |
| | | if(val.column.field === "drawingno"){ |
| | | this.codeattrsecValue=val.value; |
| | | } |
| | | console.log(this.codeattrsecValue) |
| | | }, |
| | | dataKey:formItem.dataKey || formItem.field, |
| | | label: formItem.text, |
| | | labelslot: true, |
| | | prop: this.$utilFunc.isValuableObj(formItem.referConfig) |
| | |
| | | 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.codeattrsecValue : null), |
| | | placeholder: formItem.inputTip, |
| | | comboxKey: formItem.comboxKey, |
| | | tip: formItem.tooltips, |
| | |
| | | }, |
| | | ], |
| | | props: { |
| | | label: "value", |
| | | label: "itemName", |
| | | value: "key", |
| | | }, |
| | | }; |
| | | // console.log('formItem',formItem) |
| | | // console.log('columnItem',columnItem) |
| | | slotColumnList.push(columnItem); |
| | | if (group.length === 0) { |
| | | column.push(columnItem); |
| | |
| | | changeChildItem(items,TreeValue) { |
| | | let column = this.option.column; |
| | | let group = this.option.group; |
| | | let that=this; |
| | | items.forEach((item) => { |
| | | let formItem = this.resetFormConfig(item); |
| | | if (formItem.field == "lcstatus") { |
| | |
| | | }; |
| | | |
| | | if (group.length === 0) { |
| | | this.slotColumnList.forEach((index, colItem) => { |
| | | that.slotColumnList.forEach((colItem,index) => { |
| | | if (colItem.field == columnItem.field) { |
| | | this.slotColumnList[index] = columnItem; |
| | | that.slotColumnList[index] = columnItem; |
| | | column[index] = columnItem; |
| | | return; |
| | | } |
| | | }) |
| | | } else { |
| | | this.slotColumnList.forEach((index, colItem) => { |
| | | that.slotColumnList.forEach((colItem,index) => { |
| | | if (colItem.field == columnItem.field) { |
| | | this.slotColumnList[index] = columnItem; |
| | | that.slotColumnList[index] = columnItem; |
| | | return; |
| | | } |
| | | }) |
| | | group.forEach((index, groupItem) => { |
| | | groupItem.column.forEach((colIndex, colItem) => { |
| | | group.forEach((groupItem,index) => { |
| | | groupItem.column.forEach((colItem,colIndex) => { |
| | | if (colItem.field == columnItem.field) { |
| | | group[index].column[colIndex] = columnItem; |
| | | return; |
| | |
| | | }); |
| | | } |
| | | }); |
| | | this.$set(this.option, "column", column); |
| | | this.$set(this.option, "group", group); |
| | | that.$set(that.option, "column", column); |
| | | that.$set(that.option, "group", group); |
| | | }, |
| | | // 使用传入的表单数据配置 |
| | | resetFormConfig(formItem) { |
| | |
| | | // 异步获取字典数据 |
| | | geDictData(dictKeys) { |
| | | dictKeys.forEach((dictObj) => { |
| | | getDictionary({ code: dictObj.dictKey }).then((res) => { |
| | | getEnumDictionary({ code: dictObj.dictKey }).then((res) => { |
| | | console.log(res) |
| | | if (res.data && res.data.code === 200) { |
| | | this.option.column = this.option.column.map((item) => { |
| | | if (item.field === dictObj.field) { |
| | |
| | | if (valid) { |
| | | done(); |
| | | resolve(true); |
| | | this.ValidataValue=true; |
| | | } else { |
| | | resolve(false); |
| | | } |