20231129
This commit is contained in:
@@ -1,351 +1,571 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- <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"
|
||||
@success="onFormSuccess">
|
||||
</vk-data-form>
|
||||
</view>
|
||||
<view class="border-bottom pt-20">
|
||||
<el-form ref="form" :model="form1" label-width="80px" :rules="form1.props.rules">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="商品名称">
|
||||
<el-select v-model="form1.data.goodsId" placeholder="请选择商品" @change="selectGoods">
|
||||
<el-option
|
||||
v-for="(item, index) in goodsList"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item._id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="规格型号">
|
||||
<el-select v-model="form1.data.model" placeholder="请选择">
|
||||
<template v-if=" attributes.find(attr => attr.label === '规格型号')">
|
||||
<el-option
|
||||
v-for="(item, index) in attributes.find(attr => attr.label === '规格型号').options"
|
||||
:key="index"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</template>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="其他数据">
|
||||
<el-select v-model="form1.data.otherData" placeholder="请选择">
|
||||
<template v-if=" attributes.find(attr => attr.label === '其他数据')">
|
||||
<el-option
|
||||
v-for="(item, index) in attributes.find(attr => attr.label === '其他数据').options"
|
||||
:key="index"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</template>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="执行标准">
|
||||
<el-select v-model="form1.data.standard" placeholder="请选择">
|
||||
<template v-if="form1.data.goodsId">
|
||||
<el-option
|
||||
v-for="(item, index) in goodsList.find(goods => goods._id === form1.data.goodsId).attributes.filter(attr => attr.label === '执行标准')[0].values"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</template>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="10">
|
||||
<el-form-item label="单件长度">
|
||||
<el-input placeholder="请输入内容" v-model="form1.data.singleLength" class="input-with-select">
|
||||
<el-select v-model="form1.data.singleLengthUnit" slot="append" placeholder="请选择">
|
||||
<template v-if=" attributes.find(attr => attr.label === '单件长度')">
|
||||
<el-option
|
||||
v-for="(item, index) in attributes.find(attr => attr.label === '单件长度').options"
|
||||
:key="index"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</template>
|
||||
</el-select>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="材质">
|
||||
<el-select v-model="form1.data.materialQuality" placeholder="请选择">
|
||||
<template v-if=" attributes.find(attr => attr.label === '材质')">
|
||||
<el-option
|
||||
v-for="(item, index) in attributes.find(attr => attr.label === '材质').options"
|
||||
:key="index"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</template>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="交货服务">
|
||||
<el-select v-model="form1.data.deliverService" placeholder="请选择">
|
||||
<template v-if=" attributes.find(attr => attr.label === '交货服务')">
|
||||
<el-option
|
||||
v-for="(item, index) in attributes.find(attr => attr.label === '交货服务').options"
|
||||
:key="index"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</template>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="采购数量">
|
||||
<el-input v-model="form1.data.procureNumber">
|
||||
<el-select v-model="form1.data.procureUnit" slot="append" placeholder="请选择">
|
||||
<template v-if=" attributes.find(attr => attr.label === '单位')">
|
||||
<el-option
|
||||
v-for="(item, index) in attributes.find(attr => attr.label === '单位').options"
|
||||
:key="index"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</template>
|
||||
</el-select>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="计价形式">
|
||||
<el-select v-model="form1.data.pricingForm" placeholder="请选择">
|
||||
<template v-if="attributes.find(attr => attr.label === '计价形式')">
|
||||
<el-option
|
||||
v-for="(item, index) in attributes.find(attr => attr.label === '计价形式').options"
|
||||
:key="index"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</template>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="交货时限">
|
||||
<el-date-picker
|
||||
v-model="form1.data.deliveryTime"
|
||||
type="date"
|
||||
placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="18">
|
||||
<el-form-item label="交货地点" class="ml-10">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="5">
|
||||
<el-select v-model="provinceIndex" placeholder="省" @change="selectProvince">
|
||||
<el-option v-for="(item, index) in provinceData" :key="index" :value="index"
|
||||
:label="item.name"/>
|
||||
<!-- <span slot="prefix">省</span>-->
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-select v-model="cityIndex" placeholder="市">
|
||||
<template v-if="provinceIndex !== null">
|
||||
<el-option v-for="(item, index) in cityData[provinceIndex]" :key="index"
|
||||
:value="index"
|
||||
:label="item.name"/>
|
||||
</template>
|
||||
<!-- <span slot="prefix">市</span>-->
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-select v-model="areaIndex" placeholder="区/县">
|
||||
<template v-if="provinceIndex !== null && cityIndex !== null">
|
||||
<el-option v-for="(item, index) in areaData[provinceIndex][cityIndex]" :key="index" :value="index"
|
||||
:label="item.name"/>
|
||||
</template>
|
||||
<!-- <span slot="prefix">区/县</span>-->
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-input v-model="form1.data.addressRegion"
|
||||
placeholder="详细地址或几公里范围内"></el-input>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue from 'vue'
|
||||
export default {
|
||||
props: {
|
||||
value: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
baseAttributes: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
productIndex: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: '商品',
|
||||
attributesLoaded: false,
|
||||
attributes: [],
|
||||
// 表单相关开始-----------------------------------------------------------
|
||||
form1: {
|
||||
// 表单请求数据,此处可以设置默认值
|
||||
data: {
|
||||
extraAttributes: {},
|
||||
attributes: {},
|
||||
addressRegion: undefined
|
||||
},
|
||||
// 表单属性
|
||||
props: {
|
||||
// 表单请求地址
|
||||
action: "client/enquiry/kh/add",
|
||||
// 表单字段显示规则
|
||||
columns: [
|
||||
{key: "", title: "商品1", type: "bar-title", component: 'custom-form-section'},
|
||||
{
|
||||
key: "name",
|
||||
title: "模板",
|
||||
type: "remote-select",
|
||||
action: "client/enquiry/template/pub/getList",
|
||||
showAll: true,
|
||||
actionData: {
|
||||
pageSize: 1000
|
||||
},
|
||||
props: {
|
||||
list: "rows",
|
||||
value: "name",
|
||||
label: "name"
|
||||
},
|
||||
watch: (res) => {
|
||||
const {
|
||||
option
|
||||
} = res
|
||||
console.log(option);
|
||||
if(option.extraAttributes) {
|
||||
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",
|
||||
allowCreate: true,
|
||||
filterable: true,
|
||||
data: item.values.map(citem => {
|
||||
return {
|
||||
value: JSON.stringify({keyName: item.lable,keyValue: citem}),
|
||||
label: citem
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
}else {
|
||||
this.form1.props.columns[2].columns = []
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "extraAttributes",
|
||||
title: "额外属性",
|
||||
type: "object",
|
||||
justify: "start",
|
||||
showLabel: false,
|
||||
columns: [
|
||||
|
||||
],
|
||||
},
|
||||
{
|
||||
key: "",
|
||||
title: "",
|
||||
type: "group",
|
||||
justify: "start",
|
||||
showLabel: false,
|
||||
columns: [
|
||||
{
|
||||
key: "brand",
|
||||
title: "品牌厂家",
|
||||
type: "select",
|
||||
showAll: true,
|
||||
allowCreate: true,
|
||||
filterable: true,
|
||||
data: () => {
|
||||
const row = this.attributes.find(item => item.label == '品牌厂家')
|
||||
if(row) {
|
||||
return row.options
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
key: "materialQuality",
|
||||
title: "材质",
|
||||
type: "select",
|
||||
showAll: true,
|
||||
allowCreate: true,
|
||||
filterable: true,
|
||||
data: () => {
|
||||
const row = this.attributes.find(item => item.label == '材质')
|
||||
if(row) {
|
||||
return row.options
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
key: "singleLength",
|
||||
title: "单件长度",
|
||||
type: "select",
|
||||
showAll: true,
|
||||
allowCreate: true,
|
||||
filterable: true,
|
||||
data: () => {
|
||||
const row = this.attributes.find(item => item.label == '单件长度')
|
||||
if(row) {
|
||||
return row.options
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
key: "productStandard",
|
||||
title: "产品标准",
|
||||
type: "select",
|
||||
showAll: true,
|
||||
allowCreate: true,
|
||||
filterable: true,
|
||||
data: () => {
|
||||
const row = this.attributes.find(item => item.label == '产品标准')
|
||||
if(row) {
|
||||
return row.options
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
key: "",
|
||||
title: "",
|
||||
type: "group",
|
||||
justify: "start",
|
||||
showLabel: false,
|
||||
columns: [
|
||||
|
||||
{
|
||||
key: "pricingForm",
|
||||
title: "计价形式",
|
||||
type: "select",
|
||||
showAll: true,
|
||||
allowCreate: true,
|
||||
filterable: true,
|
||||
data: () => {
|
||||
const row = this.attributes.find(item => item.label == '计价形式')
|
||||
if(row) {
|
||||
return row.options
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
key: "processStandard",
|
||||
title: "加工标准",
|
||||
type: "select",
|
||||
showAll: true,
|
||||
allowCreate: true,
|
||||
filterable: true,
|
||||
data: () => {
|
||||
const row = this.attributes.find(item => item.label == '加工标准')
|
||||
if(row) {
|
||||
return row.options
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
key: "deliveryService",
|
||||
title: "交货服务",
|
||||
type: "select",
|
||||
showAll: true,
|
||||
allowCreate: true,
|
||||
filterable: true,
|
||||
data: () => {
|
||||
const row = this.attributes.find(item => item.label == '交货服务')
|
||||
if(row) {
|
||||
return row.options
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
},
|
||||
{key: "deliveryTime", title: "交货时限", type: "date",},
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
key: "",title: "",type: 'group',showLabel: false, justify: "start",columns:
|
||||
[
|
||||
{key: "procureNumber", title: "采购数量", type: "number",},
|
||||
{
|
||||
key: "procureUnit",
|
||||
title: "单位",
|
||||
type: "select",
|
||||
showAll: true,
|
||||
allowCreate: true,
|
||||
filterable: true,
|
||||
data: () => {
|
||||
const row = this.attributes.find(item => item.label == '单位')
|
||||
if(row) {
|
||||
return row.options
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
},
|
||||
{key: "addressRegion", title: "交货地点", type: "address",},
|
||||
{key: "addressDetail", 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 代表修改
|
||||
formType: "add",
|
||||
// 表单是否在请求中
|
||||
loading: false,
|
||||
// 是否显示表单1 的弹窗
|
||||
show: false,
|
||||
beforeAction: (formData)=> {
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
// 表单相关结束-----------------------------------------------------------
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.form1.props.columns[0].title = '商品' + (this.productIndex + 1)
|
||||
|
||||
vk.callFunction({
|
||||
url: 'client/enquiry/attributes/pub/getList',
|
||||
title: '请求中...',
|
||||
data: {
|
||||
|
||||
},
|
||||
success: (data) => {
|
||||
this.attributes = data.rows
|
||||
this.attributesLoaded = true
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
|
||||
},
|
||||
watch: {
|
||||
"form1.data"(val){
|
||||
this.$emit('input', val)
|
||||
console.log("this.$emit('input', val.data)");
|
||||
},
|
||||
value(val) {
|
||||
this.form1.data = val
|
||||
console.log("this.form1.data = val", val);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
import provinces from "@/uni_modules/vk-uview-ui/libs/address/provinces.json";
|
||||
import citys from "@/uni_modules/vk-uview-ui/libs/address/citys.json";
|
||||
import areas from "@/uni_modules/vk-uview-ui/libs/address/areas.json";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
value: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
baseAttributes: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
productIndex: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
provinceData: provinces,
|
||||
cityData: citys,
|
||||
areaData: areas,
|
||||
provinceIndex: null,
|
||||
cityIndex: null,
|
||||
areaIndex: null,
|
||||
title: '商品',
|
||||
attributesLoaded: false,
|
||||
goodsList: [],
|
||||
attributes: [],
|
||||
form: {
|
||||
addressDetail: ''
|
||||
},
|
||||
// 表单相关开始-----------------------------------------------------------
|
||||
form1: {
|
||||
// 表单请求数据,此处可以设置默认值
|
||||
data: {
|
||||
goodsId: null,
|
||||
model: null,
|
||||
otherData: null,
|
||||
materialQuality: null,
|
||||
singleLength: null,
|
||||
singleLengthUnit: null,
|
||||
deliverService: null,
|
||||
standard: null,
|
||||
pricingForm: null,
|
||||
deliveryTime: null,
|
||||
len: null,
|
||||
extraAttributes: {},
|
||||
attributes: {},
|
||||
addressRegion: undefined
|
||||
},
|
||||
// 表单属性
|
||||
props: {
|
||||
// 表单请求地址
|
||||
action: "client/enquiry/kh/add",
|
||||
// 表单字段显示规则
|
||||
columns: [
|
||||
{key: "", title: "商品1", type: "bar-title", component: 'custom-form-section'},
|
||||
{
|
||||
key: "name",
|
||||
title: "模板",
|
||||
type: "remote-select",
|
||||
action: "client/enquiry/template/pub/getList",
|
||||
showAll: true,
|
||||
actionData: {
|
||||
pageSize: 1000
|
||||
},
|
||||
props: {
|
||||
list: "rows",
|
||||
value: "name",
|
||||
label: "name"
|
||||
},
|
||||
watch: (res) => {
|
||||
const {
|
||||
option
|
||||
} = res
|
||||
console.log(option);
|
||||
if (option.extraAttributes) {
|
||||
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",
|
||||
allowCreate: true,
|
||||
filterable: true,
|
||||
data: item.values.map(citem => {
|
||||
return {
|
||||
value: JSON.stringify({keyName: item.lable, keyValue: citem}),
|
||||
label: citem
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
} else {
|
||||
this.form1.props.columns[2].columns = []
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "extraAttributes",
|
||||
title: "额外属性",
|
||||
type: "object",
|
||||
justify: "start",
|
||||
showLabel: false,
|
||||
columns: [],
|
||||
},
|
||||
{
|
||||
key: "",
|
||||
title: "",
|
||||
type: "group",
|
||||
justify: "start",
|
||||
showLabel: false,
|
||||
columns: [
|
||||
{
|
||||
key: "brand",
|
||||
title: "品牌厂家",
|
||||
type: "select",
|
||||
showAll: true,
|
||||
allowCreate: true,
|
||||
filterable: true,
|
||||
data: () => {
|
||||
const row = this.attributes.find(item => item.label == '品牌厂家')
|
||||
if (row) {
|
||||
return row.options
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
key: "materialQuality",
|
||||
title: "材质",
|
||||
type: "select",
|
||||
showAll: true,
|
||||
allowCreate: true,
|
||||
filterable: true,
|
||||
data: () => {
|
||||
const row = this.attributes.find(item => item.label == '材质')
|
||||
if (row) {
|
||||
return row.options
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
key: "singleLength",
|
||||
title: "单件长度",
|
||||
type: "select",
|
||||
showAll: true,
|
||||
allowCreate: true,
|
||||
filterable: true,
|
||||
data: () => {
|
||||
const row = this.attributes.find(item => item.label == '单件长度')
|
||||
if (row) {
|
||||
return row.options
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
key: "productStandard",
|
||||
title: "产品标准",
|
||||
type: "select",
|
||||
showAll: true,
|
||||
allowCreate: true,
|
||||
filterable: true,
|
||||
data: () => {
|
||||
const row = this.attributes.find(item => item.label == '产品标准')
|
||||
if (row) {
|
||||
return row.options
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
key: "",
|
||||
title: "",
|
||||
type: "group",
|
||||
justify: "start",
|
||||
showLabel: false,
|
||||
columns: [
|
||||
|
||||
{
|
||||
key: "pricingForm",
|
||||
title: "计价形式",
|
||||
type: "select",
|
||||
showAll: true,
|
||||
allowCreate: true,
|
||||
filterable: true,
|
||||
data: () => {
|
||||
const row = this.attributes.find(item => item.label == '计价形式')
|
||||
if (row) {
|
||||
return row.options
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
key: "processStandard",
|
||||
title: "加工标准",
|
||||
type: "select",
|
||||
showAll: true,
|
||||
allowCreate: true,
|
||||
filterable: true,
|
||||
data: () => {
|
||||
const row = this.attributes.find(item => item.label == '加工标准')
|
||||
if (row) {
|
||||
return row.options
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
key: "deliveryService",
|
||||
title: "交货服务",
|
||||
type: "select",
|
||||
showAll: true,
|
||||
allowCreate: true,
|
||||
filterable: true,
|
||||
data: () => {
|
||||
const row = this.attributes.find(item => item.label == '交货服务')
|
||||
if (row) {
|
||||
return row.options
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
},
|
||||
{key: "deliveryTime", title: "交货时限", type: "date",},
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
key: "", title: "", type: 'group', showLabel: false, justify: "start", columns:
|
||||
[
|
||||
{key: "procureNumber", title: "采购数量", type: "number",},
|
||||
{
|
||||
key: "procureUnit",
|
||||
title: "单位",
|
||||
type: "select",
|
||||
showAll: true,
|
||||
allowCreate: true,
|
||||
filterable: true,
|
||||
data: () => {
|
||||
const row = this.attributes.find(item => item.label == '单位')
|
||||
if (row) {
|
||||
return row.options
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
},
|
||||
{key: "addressRegion", title: "交货地点", type: "address",},
|
||||
{key: "addressDetail", title: "详细地址", type: "textarea",},
|
||||
]
|
||||
},
|
||||
],
|
||||
// 表单验证规则
|
||||
rules: {
|
||||
goodsId: [
|
||||
{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 代表修改
|
||||
formType: "add",
|
||||
// 表单是否在请求中
|
||||
loading: false,
|
||||
// 是否显示表单1 的弹窗
|
||||
show: false,
|
||||
beforeAction: (formData) => {
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
// 表单相关结束-----------------------------------------------------------
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.form1.props.columns[0].title = '商品' + (this.productIndex + 1)
|
||||
vk.callFunction({
|
||||
url: 'client/enquiry/attributes/pub/getList',
|
||||
title: '请求中...',
|
||||
data: {},
|
||||
success: (data) => {
|
||||
this.attributes = data.rows
|
||||
this.attributesLoaded = true
|
||||
}
|
||||
});
|
||||
this.getGoodsList()
|
||||
},
|
||||
methods: {
|
||||
getGoodsList() {
|
||||
vk.callFunction({
|
||||
url: 'client/enquiry/template/pub/getList',
|
||||
title: '请求中',
|
||||
success: ({rows}) => {
|
||||
this.goodsList = rows
|
||||
}
|
||||
})
|
||||
},
|
||||
selectGoods(val) {
|
||||
this.goodsList.forEach(({_id, name}) => {
|
||||
if (_id === val) this.form1.data.goodsName = name
|
||||
})
|
||||
},
|
||||
selectProvince(index){
|
||||
console.log(index, this.provinceIndex)
|
||||
console.log(this.cityData, this.cityData[index])
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
"form1.data"(val) {
|
||||
this.$emit('input', val)
|
||||
console.log("this.$emit('input', val.data)");
|
||||
},
|
||||
value(val) {
|
||||
this.form1.data = val
|
||||
console.log("this.form1.data = val", val);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.product-title {
|
||||
margin: 10px;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
.product-title {
|
||||
margin: 10px;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.input-with-select .el-input-group__append {
|
||||
background-color: #fff !important;
|
||||
width: 130px !important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user