| | |
| | | // 表单类型(add, edit, detail) |
| | | type: { |
| | | type: String, |
| | | default: "", |
| | | default: "add", |
| | | }, |
| | | // 自定义表单类型 |
| | | selfColumnType: { |
| | |
| | | }, |
| | | eventList: { |
| | | type: Array |
| | | }, |
| | | status: { |
| | | type: String, |
| | | default: "", |
| | | }, |
| | | selectRow:{ |
| | | type:Array, |
| | | default:[] |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | selectValue:"", |
| | | //年代号 |
| | | dataYearCode: { |
| | | type: "", |
| | | value: "" |
| | | }, |
| | | filteredObject: {}, |
| | | filteredArray: [], |
| | | isSeriesType: {}, |
| | | attrList: [], |
| | | add: '', |
| | | codeattrsecValue: '', |
| | |
| | | // 表单属性 |
| | | attributes: [], |
| | | slotColumnList: [], |
| | | isShow: "", |
| | | }; |
| | | }, |
| | | mounted() { |
| | |
| | | this.$emit("getFormData", newV); |
| | | }, |
| | | }, |
| | | |
| | | attrList: { |
| | | deep: true, |
| | | immediate: true, |
| | |
| | | deep: true, |
| | | immediate: true |
| | | }, |
| | | isShow: { |
| | | handler(newV) { |
| | | this.$emit("isShow", newV) |
| | | } |
| | | }, |
| | | dataYearCode: { |
| | | deep:true, |
| | | immediate:true, |
| | | handler(newV) { |
| | | this.$emit("dataYearCode", newV) |
| | | } |
| | | }, |
| | | selectRow:{ |
| | | handler(newval){ |
| | | console.log(newval); |
| | | let ids = newval.map(item => item.id); |
| | | this.selectValue= ids.join(","); |
| | | }, |
| | | deep:true, |
| | | immediate:true |
| | | } |
| | | }, |
| | | methods: { |
| | | // 渲染表单模板 |
| | |
| | | let dictKeys = []; |
| | | let slotColumnList = []; |
| | | formItemList.forEach((formItem) => { |
| | | // console.log('formItem',formItem) |
| | | formItem = this.resetFormConfig(formItem); |
| | | //属性码段规则 |
| | | if (formItem.secType === "codeattrsec") { |
| | | this.attrList.push(formItem); |
| | | } |
| | | //系列号规则 |
| | | if (formItem.field === "codeStandardEditType") { |
| | | if (this.status === "amend") { |
| | | formItem.readOnly = true; |
| | | } |
| | | } |
| | | if (formItem.type === "line") { |
| | | group.push({ |
| | |
| | | formItem.fieldMap[formItem.field + 'id'] = 'id' |
| | | } |
| | | |
| | | |
| | | let columnItem = { |
| | | change: (val) => { |
| | | if (val.column.field === "drawingno") { |
| | | this.codeattrsecValue = val.value; |
| | | return; |
| | | } |
| | | // console.log(this.codeattrsecValue) |
| | | //是否系列-系列号 |
| | | if (val.column.field === "isSeries") { |
| | | if (val.value === "false") { |
| | | this.isShow = true; |
| | | } else { |
| | | this.isShow = false; |
| | | } |
| | | } |
| | | if (val.column.field === "releaseDate") { |
| | | if (val.value) { |
| | | this.dataYearCode.type = val.column.valueFormat; |
| | | this.dataYearCode.value = val.value; |
| | | } else { |
| | | this.dataYearCode.type = ""; |
| | | this.dataYearCode.value = ""; |
| | | } |
| | | } |
| | | }, |
| | | dataKey: formItem.dataKey || formItem.field, |
| | | label: formItem.text, |
| | |
| | | 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) || |
| | | value:formItem.defaultValue || (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 == "codeattrsec" ? this.add : null), |
| | | (formItem.secType == "codeattrsec" ? this.add : null) || (this.status === "apply" && formItem.field === "codeStandardEditType" ? "1" : null) || |
| | | (this.status === "amend" && formItem.field === "codeStandardEditType" ? "2" : null) || |
| | | //父组件如果是参照数据会将selectRow置空,selectRow不为空就说明不是参照要回填源标准号数据 |
| | | (this.status === "amend" && this.selectRow && (formItem.field === "oldcode" ? this.selectValue : 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, |
| | |
| | | value: "key", |
| | | }, |
| | | }; |
| | | this.filteredObject = columnItem |
| | | slotColumnList.push(columnItem); |
| | | if (group.length === 0) { |
| | | column.push(columnItem); |
| | |
| | | group[group.length - 1]["column"].push(columnItem); |
| | | } |
| | | }); |
| | | |
| | | this.slotColumnList = slotColumnList; |
| | | this.$set(this.option, "column", column); |
| | | this.$set(this.option, "group", group); |
| | |
| | | this.getFormDetail(); |
| | | }, |
| | | //修改级联项 |
| | | changeChildItem(items, TreeValue) { |
| | | let column = this.option.column; |
| | | let group = this.option.group; |
| | | changeChildItem(items, TreeValue, type) { |
| | | type = type || "add" |
| | | // let column = this.option.column; |
| | | // let group = this.option.group; |
| | | let column = []; |
| | | let group = []; |
| | | let that = this; |
| | | items.forEach((item) => { |
| | | let formItem = this.resetFormConfig(item); |
| | | |
| | | if (formItem.field == "lcstatus") { |
| | | formItem.field = formItem.field + "_text"; |
| | | formItem.readOnly = true; |
| | |
| | | formItem.fieldMap[formItem.field + 'id'] = 'id' |
| | | } |
| | | let columnItem = { |
| | | change: (val) => { |
| | | console.log('1', val) |
| | | }, |
| | | label: formItem.text, |
| | | labelslot: true, |
| | | prop: this.$utilFunc.isValuableObj(formItem.referConfig) |
| | |
| | | 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: 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), |
| | |
| | | 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) || (this.status === "apply" && formItem.field === "codeStandardEditType" ? "1" : null) || |
| | | (this.status === "amend" && formItem.field === "codeStandardEditType" ? "2" : null), |
| | | placeholder: formItem.inputTip, |
| | | comboxKey: formItem.comboxKey, |
| | | tip: formItem.tooltips, |
| | |
| | | value: "key", |
| | | }, |
| | | }; |
| | | |
| | | if (group.length === 0) { |
| | | that.slotColumnList.forEach((colItem, index) => { |
| | | if (colItem.field == columnItem.field) { |
| | |
| | | // 获取表单详情数据 |
| | | getFormDetail() { |
| | | if (this.type === "add") return; |
| | | getFormDetail({templateOid: this.templateOid, oid: this.rowOid}).then( |
| | | (res) => { |
| | | this.form = Object.assign(this.form, res.data.data[0]); |
| | | this.loading = false; |
| | | } |
| | | ); |
| | | if(this.templateOid){ |
| | | getFormDetail({templateOid: this.templateOid, oid: this.rowOid}).then( |
| | | (res) => { |
| | | this.form = Object.assign(this.form, res.data.data[0]); |
| | | this.loading = false; |
| | | } |
| | | ); |
| | | return; |
| | | } |
| | | |
| | | }, |
| | | setReferValue(data) { |
| | | if (data.field) { |