赞
踩
<a-col :span="24" v-for="item in formItem" :key="item.code"> <a-form-item :label="item.name"> <a-input v-decorator="[item.code]" :placeholder="`请输入${item.name}`" :suffix="item.unit" oninput="value=value.replace(/^\D*([0-9]\d*\.?\d{0,3})?.*$/,'$1')" /> </a-form-item> </a-col> async serValues(e){ if(e.target.value.length < 10) return; clearTimeout(this.timer); this.timer = setTimeout(async() =>{ this.loading = true let res = await this.$http(this.$url.SEARCH_TAB_FORM_CODE,'get',{deviceCode:e.target.value}) .finally(()=>{ this.loading = false }) let {data} = res if(data.code == 200){ this.formItem.length ? this.formItem.splice(0,this.formItem.length, ...data.data) : this.formItem = data.data } },200) }, getValues(){ let query this.form.validateFields((err,value)=>{ if(!err){ value.labelDataList = this.formItem.map(item=>{ item.value = value[item.code] return item }) value.testTime = value.testTime.format('YYYY-MM-DD HH:mm:ss') value.reportSource = 1 query = value } }) return query },
<a-row :gutter="8" v-for="item in formData.formItem" :key="item.code"> <a-col :lg="24"> <a-form-item :label="item.name"> <a-input v-model:value="item.value" :placeholder="`请输入${item.name}`" :suffix="item.unit" oninput="value=value.replace(/^\D*([0-9]\d*\.?\d{0,3})?.*$/,'$1')" /> </a-form-item> </a-col> </a-row> const setValues = async (data) => { if (data) { await getItem(data.id); formData.deviceCode = data.deviceCode; } }; const getItem = async (id) => { deviceid.value = id; let res = await request(url.GET_FILL_ITEM_BY_DEVICE_ID, "get", { deviceId: id, }); res.map((i) => { return formData.formItem.push({ code: i.code, name: i.name, unit: i.unit, value: "", key: i.code, }); }); }; const getValues = () => { validate() .then(() => { let data = {}; data.reportSource = 1; data.deviceId = deviceid.value; let labelDataList = []; formData.formItem.map(i => { labelDataList.push({ code: i.code, value: i.value }) }); data.labelDataList = labelDataList; data.testTime = formData.testTime.format('YYYY-MM-DD HH:mm:ss'); emit('getFillData', data); }) };
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。