Enzo 5 years ago
parent
commit
592d5f6734
  1. 8
      canteen/components/wyb-table/wyb-table.vue
  2. 16
      canteen/pages/delivery/apply.vue
  3. 8
      supplier/components/wyb-table/wyb-table.vue

8
canteen/components/wyb-table/wyb-table.vue

@ -147,7 +147,13 @@
zIndex: hIndex === 0 ? 20 : 0,
left: enableCheck ? checkColWidth + 'rpx' : 0,
position: hIndex === 0 && firstLineFixed ? 'sticky' : 'static'}">
<input class="lf-w-100" :disabled="false" placeholder="请输入.." v-if="isObject(autoContentItem(cIndex, hIndex), 'edit')" :style="{minHeight: (minHeight[1] || minHeight[0]) + 'rpx'}" @blur="inputBlur(cIndex, hIndex, $event)" :value="autoContentItem(cIndex, hIndex).value" />
<input class="lf-w-100" :disabled="false" placeholder="请输入.."
v-if="isObject(autoContentItem(cIndex, hIndex), 'edit')"
:style="{minHeight: (minHeight[1] || minHeight[0]) + 'rpx'}"
placeholder-style="30rpx"
:type="autoContentItem(cIndex, hIndex).type || 'number'"
@blur="inputBlur(cIndex, hIndex, $event)"
:value="autoContentItem(cIndex, hIndex).value" />
<button class="diy-btn" v-else-if="isObject(autoContentItem(cIndex, hIndex), 'button')" @click="buttonClick(cIndex, hIndex)">{{ autoContentItem(cIndex, hIndex).value }}</button>
<view class="lf-w-100 lf-h-100 lf-row-center" v-else :style="{minHeight: (minHeight[1] || minHeight[0]) + 'rpx', 'word-break': 'break-all'}">{{ autoContentItem(cIndex, hIndex) }}</view>
</view>

16
canteen/pages/delivery/apply.vue

@ -17,7 +17,8 @@
<wyb-table :headers="headers" :contents="contents"
contentBgColor="#ecfaf5"
:first-line-fixed="true"
@onInputChange="onInputChange"
@onInputChange="onInputChange"
@onButtonClick="onButtonClick"
width="max-content" height="80vh"
v-if="contents.length"></wyb-table>
</view>
@ -68,6 +69,9 @@
},{
key: 'delivery_number',
label: '出库数量'
},{
key: 'operation',
label: '操作'
}],
contents: [],
warehouse_list: {},
@ -98,6 +102,7 @@
warehouse_list = JSON.parse(warehouse_list);
for(let i in warehouse_list){
warehouse_list[i].delivery_number = {edit: true, value: warehouse_list[i].delivery_number || 1};
warehouse_list[i].operation = {button: true, key: 'delete', value: '删除'};
contents.push(warehouse_list[i]);
}
this.contents = contents;
@ -149,6 +154,15 @@
console.log("检测到table input被更改", event);
this.contents[event.contentIndex][event.key].value = event.detailValue;
},
// table
onButtonClick(event){
if(event.content.key == 'delete'){
let order_id = event.lineData.order_id;
let material_index = event.lineData.contentIndex;
this.contents.splice(material_index, 1);
delete this.warehouse_list[order_id];
}
},
//
save(_t){
console.log("dddddd", this.contents)

8
supplier/components/wyb-table/wyb-table.vue

@ -147,7 +147,13 @@
zIndex: hIndex === 0 ? 20 : 0,
left: enableCheck ? checkColWidth + 'rpx' : 0,
position: hIndex === 0 && firstLineFixed ? 'sticky' : 'static'}">
<input class="lf-w-100" :disabled="false" placeholder="请输入.." v-if="isObject(autoContentItem(cIndex, hIndex), 'edit')" :style="{minHeight: (minHeight[1] || minHeight[0]) + 'rpx'}" @blur="inputBlur(cIndex, hIndex, $event)" :value="autoContentItem(cIndex, hIndex).value" />
<input class="lf-w-100" :disabled="false" placeholder="请输入.."
v-if="isObject(autoContentItem(cIndex, hIndex), 'edit')"
:style="{minHeight: (minHeight[1] || minHeight[0]) + 'rpx'}"
placeholder-style="30rpx"
:type="autoContentItem(cIndex, hIndex).type || 'number'"
@blur="inputBlur(cIndex, hIndex, $event)"
:value="autoContentItem(cIndex, hIndex).value" />
<button class="diy-btn" v-else-if="isObject(autoContentItem(cIndex, hIndex), 'button')" @click="buttonClick(cIndex, hIndex)">{{ autoContentItem(cIndex, hIndex).value }}</button>
<view class="lf-w-100 lf-h-100 lf-row-center" v-else :style="{minHeight: (minHeight[1] || minHeight[0]) + 'rpx', 'word-break': 'break-all'}">{{ autoContentItem(cIndex, hIndex) }}</view>
</view>

Loading…
Cancel
Save