Browse Source

修改数组at方法

master
邓宏 2 years ago
parent
commit
14bd1e7c3e
  1. 3
      pages/massif/plant_plan.vue
  2. 2
      pages/purchase/newAgr.vue
  3. 4
      pages/stock/list.vue
  4. 2
      pages/stock/prodWarehouse.vue

3
pages/massif/plant_plan.vue

@ -20,7 +20,7 @@
:field="k"
:required="!!rules[k]&&rules[k].required"
:value="/^select$/.test(v.type)?fields[k].value:formData[k]"
@select="fields[k].value=$event.map(v=>v.value);formData[k]=fields[k].value.at(-1)"
@select="fields[k].value=$event.map(v=>v.value);formData[k]=fields[k].value.slice(-1)[0]"
@input="formData[k]=$event"
@imgs="fields[k].value=$event"/>
</u-form>
@ -119,6 +119,7 @@ export default {
}
},
submit(){
console.log(this.formData,'----formData-----')
this.$refs.form.validate().then(async valid=>{
if(valid){
var res=await request("/api/plantPlan/add",{

2
pages/purchase/newAgr.vue

@ -20,7 +20,7 @@
:required="!!rules[k]"
:value="/^select$/.test(v.type)?fields[k].value:formData[k]"
@input="formData[k]=$event"
@select="fields[k].value=$event.map(v=>v.value);formData[k]=fields[k].value.at(-1)"/>
@select="fields[k].value=$event.map(v=>v.value);formData[k]=fields[k].value.slice(-1)[0]"/>
</u-form>
<button class="cu-btn round bg-green shadow submit" @click="submit">保存</button>

4
pages/stock/list.vue

@ -157,14 +157,14 @@
v-if="recoveryBatch.list.length>0" label="采收批次" field="inInventoryBatch" required type="select" :columns="recoveryBatch.list" custom
:tip="recoveryBatch.surplus>0?`剩余:${recoveryBatch.surplus}kg`:''"
:value="recoveryBatch.value"
@select="recoveryBatch.value=[$event[0].value];formData.inOutBatchNo=$event[0].batchNo;recoveryBatch.number=$event[0].surplus;recoveryBatch.surplus=$event[0].surplus;formData.inInventoryBatch=recoveryBatch.value.at(-1)">
@select="recoveryBatch.value=[$event[0].value];formData.inOutBatchNo=$event[0].batchNo;recoveryBatch.number=$event[0].surplus;recoveryBatch.surplus=$event[0].surplus;formData.inInventoryBatch=recoveryBatch.value.slice(-1)[0]">
<view slot-scope="{row}" style="display:flex;">
<text style="margin-left:10rpx;font-weight:bold;">{{row.batchNo}}</text>
<text style="font-size:24rpx;color:#999;margin-left:10rpx;">{{row.substanceName}}</text>
<text style="margin-left:auto;color:#999;">剩余:{{row.surplus}}</text>
</view>
</d-form>
<d-form :label="`${({in:'入',out:'出'})[mode]}库类型`" field="inOutType" required type="select" :columns="inOutType.list" :value="inOutType.value" @select="inOutType.value=$event.map(v=>v.value);formData.inOutType=inOutType.value.at(-1)"/>
<d-form :label="`${({in:'入',out:'出'})[mode]}库类型`" field="inOutType" required type="select" :columns="inOutType.list" :value="inOutType.value" @select="inOutType.value=$event.map(v=>v.value);formData.inOutType=inOutType.value.slice(-1)[0]"/>
<d-form :label="`${({in:'入',out:'出'})[mode]}库批次号`" field="inOutBatchNo" required :disabled="formData.substanceType==2" :value="formData.inOutBatchNo" @input="formData.inOutBatchNo=$event" :btnText="formData.substanceType==1?'生成':''" :btnFun="()=>this.formData.inOutBatchNo=`${({in:'RK',out:'CK'})[this.mode]}${new Date().format('yyyyMMdd')}${new Date().getTime()}`"/>
<d-form :label="({1:`${({in:'入',out:'出'})[mode]}库数量`,2:'重量'})[formData.substanceType]" field="number" required :suffix="number.suffix" :value="formData.number" @input="formData.number=$event" type="digit"/>
<d-form label="操作日期" field="operationTime" required type="calendar" v-model="formData.operateTime"/>

2
pages/stock/prodWarehouse.vue

@ -18,7 +18,7 @@
:required="!!rules[k]"
:value="/^select$/.test(v.type)?fields[k].value:formData[k]"
@input="formData[k]=$event"
@select="fields[k].value=$event.map(v=>v.value);formData[k]=fields[k].value.at(-1)"
@select="fields[k].value=$event.map(v=>v.value);formData[k]=fields[k].value.slice(-1)[0]"
@imgs="fields[k].value=$event"/>
</u-form>
</view>

Loading…
Cancel
Save