This commit is contained in:
2023-11-23 22:29:13 +08:00
parent 715859c63f
commit 882419768f
39 changed files with 2190 additions and 199 deletions
+34 -39
View File
@@ -3,7 +3,7 @@
<!-- <view class="product-title">{{title}}</view> -->
<vk-data-form v-if="attributesLoaded" ref="form1" v-model="form1.data" :action="form1.props.action" :columns="form1.props.columns"
:rules="form1.props.rules" :form-type="form1.props.formType" :loading.sync="form1.props.loading"
:before-action="form1.props.beforeAction" :auto-close="true" label-width="140px" :footer-show="false"
:before-action="form1.props.beforeAction" :auto-close="true" label-width="140px" :footer-show="false"
@success="onFormSuccess">
</vk-data-form>
</view>
@@ -41,6 +41,7 @@
data: {
extraAttributes: {},
attributes: {},
addressRegion: undefined
},
// 表单属性
props: {
@@ -69,8 +70,21 @@
} = res
console.log(option);
if(option.extraAttributes) {
this.form1.props.columns[2].columns = option.extraAttributes.map((item, index) => {
return {
let groupIndex = -1
option.extraAttributes.forEach((item, index) => {
if(index%4 == 0) {
this.form1.props.columns[2].columns.push({
key: "",
title: "",
type: "group",
justify: "start",
showLabel: false,
columns: []
})
groupIndex ++
}
this.form1.props.columns[2].columns[0].columns.push({
key: index,
title: item.label,
type: "select",
@@ -82,14 +96,14 @@
label: citem
}
})
}
})
})
}else {
this.form1.props.columns[2].columns = []
}
}
},
{
@@ -142,15 +156,6 @@
}
},
],
},
{
key: "",
title: "",
type: "group",
justify: "start",
showLabel: false,
columns: [
{
key: "singleLength",
title: "单件长度",
@@ -185,6 +190,7 @@
},
],
},
{
key: "",
title: "",
@@ -225,15 +231,6 @@
}
},
],
},
{
key: "",
title: "",
type: "group",
justify: "start",
showLabel: false,
columns: [
{
key: "deliveryService",
title: "交货服务",
@@ -251,11 +248,11 @@
},
{key: "deliveryTime", title: "交货时限", type: "date",},
]
],
},
{
key: "",title: "",type: 'group',showLabel: false, justify: "start",columns:
[
@@ -275,29 +272,27 @@
return [];
}
},
{key: "addressRegion", title: "交货地点", type: "address",},
{key: "addressDetail", title: "详细地址", type: "textarea",},
]
},
{
key: "address",
title: "交货地点",
type: "object",
// justify: "start",
showLabel: false,
columns: [
{key: "region", title: "交货地点", type: "address",},
{key: "detail", title: "详细交货地址", type: "textarea",},
],
},
],
// 表单验证规则
rules: {
name:[
{ required:true, message:'商品不能为空', trigger: ["change","blur"] }
],
addressRegion:[
{ required:true, message:'交货地点不能为空', trigger: ["change","blur"] }
],
procureNumber:[
{ required:true, message:'采购数量不能为空', trigger: ["change","blur"] },
{ min: 1,type: 'number', message:'采购数量不能小于1', trigger: ["change","blur"] }
],
procureUnit:[
{ required:true, message:'采购数量不能为空', trigger: ["change","blur"] },
],
},
// add 代表添加 update 代表修改