From 59765cab961847dfd101e69ae6d8d1d501a5284c Mon Sep 17 00:00:00 2001
From: yuxc <yuxc@vci-tech.com>
Date: 星期二, 04 六月 2024 11:10:28 +0800
Subject: [PATCH] 1、ice配置文件上传
---
Source/ProjectWeb/src/components/PLT-basic-component/basicForm.vue | 81 ++++++++++++++++++++++++++++++++++------
1 files changed, 69 insertions(+), 12 deletions(-)
diff --git a/Source/ProjectWeb/src/components/PLT-basic-component/basicForm.vue b/Source/ProjectWeb/src/components/PLT-basic-component/basicForm.vue
index fd07194..ca5e5b4 100644
--- a/Source/ProjectWeb/src/components/PLT-basic-component/basicForm.vue
+++ b/Source/ProjectWeb/src/components/PLT-basic-component/basicForm.vue
@@ -1,6 +1,6 @@
<template>
<!--鍔ㄦ�佹ā鏉�-->
- <avue-form ref="formRef" :option="option" v-model="form">
+ <avue-form ref="form" :option="option" v-model="form">
<template v-for="item in allColumn" :slot="item.prop+ ''">
<vciWebRefer
v-if="item.type === 'refer'"
@@ -70,7 +70,16 @@
//琛ㄥ崟鏄惁鍙紪杈�
type:Boolean,
default:true
- }
+ },
+ initValue:{
+ type: Object,
+ default: () => {},
+ },
+ uploadattachment:{
+ //鏄惁鏄剧ず涓婁紶闄勪欢
+ type:Boolean,
+ default:false
+ },
},
data() {
return {
@@ -103,10 +112,13 @@
watch: {
formItems: {
handler(val) {
- if(val[0] &&val[0].column && val[0].column.isArray()){
+ if (val[0] && val[0].column && val[0].column.isArray()) {
this.getInitGroup(val);
- }else{
+ } else {
this.getInit(val);
+ }
+ if (this.initValue) {
+ Object.assign(this.form, this.initValue);
}
},
immediate: true,
@@ -141,7 +153,7 @@
}
}
}
- this.$emit("input", val);
+ this.$emit("getFormData", val);
},
deep: true,
immediate: true
@@ -154,7 +166,6 @@
code = this.initItem(code);
column.push(code);
this.allColumn.push(code);
- console.log('allColumn',this.allColumn)
}
this.option.column = column;
},
@@ -180,24 +191,37 @@
showProp:item.showField,
type: type,
labelWidth: this.labelWidth || (item.text.length >= 6 ? 115 : 90),
- disabled: item.readOnly || this.disabled,
+ disabled: !this.isEdit || item.readOnly || this.disabled,
span: item.span
? item.span
: item.type === "textarea"
? 24
: this.span,
value: item.defaultValue,
- dicData: type === 'select' ? item.dicData : item.dicUrl,
display: !item.hidden,
labelSuffix: item.suffix,
suffixIcon: item.prefix,
tip: item.tooltips,
dictCode: item.comboxKey,
- rules: this.isEdit?[{
+ valueFormat: item.dateFormate || "yyyy-MM-dd HH:mm:ss",
+ format: item.dateFormate,
+ rules: this.isEdit?(type=="select" || type=="refer" || type=="date" || type=="datetime"?[{
+ required: item.required,
+ message: `璇烽�夋嫨${item.text}!`,
+ trigger: "change"
+ },{
+ required: item.required,
+ message: `璇烽�夋嫨${item.text}!`,
+ trigger: "submit"
+ }]:[{
required: item.required,
message: `璇疯緭鍏�${item.text}!`,
trigger: "blur"
- }]:[]
+ },{
+ required: item.required,
+ message: `璇疯緭鍏�${item.text}!`,
+ trigger: "submit"
+ }]):[]
};
if(!this.isEdit){
col.placeholder=col.label;
@@ -206,10 +230,22 @@
this.subitemName = col.field;
}else if(col.type === 'upload'){
console.log('col',col)
+ }else if(col.type=="multiFile"){
+ if(this.uploadattachment == "false" || this.uploadattachment == false){
+ col.display=false
+ }
}
if (col.type === "select") {
- // console.log('col',col)
- if(!validatenull(col.dictCode)) {
+ if(col.data && col.data.length>0){
+ col.dicData = col.data.map((d) => {
+ return {
+ label: d.key,
+ key: d.value,
+ value: d.value,
+ attributes:d.attributes
+ };
+ });
+ }else if(!validatenull(col.dictCode)) {
getDicts(col.dictCode).then((res) => {
if (res.data.success){
if(res.data.data && res.data.obj == null){
@@ -283,6 +319,27 @@
}
}
}
+ },
+ // 琛ㄥ崟鏍¢獙
+ validate(done) {
+ return new Promise((resolve) => {
+ this.$refs.form.validate((valid,fields) => {
+ done(valid,fields);
+ if (valid) {
+ resolve(true);
+ this.ValidataValue = true;
+ } else {
+ resolve(false);
+ return false;
+ }
+ });
+ });
+ },
+ resetFields(){
+ this.$refs.form.resetFields()
+ },
+ clearValidate(props){
+ this.$refs.form.clearValidate(props)
}
},
};
--
Gitblit v1.9.3