diff --git a/canteen/components/wyb-table/wyb-table.vue b/canteen/components/wyb-table/wyb-table.vue index 71dbd72..1b421ca 100644 --- a/canteen/components/wyb-table/wyb-table.vue +++ b/canteen/components/wyb-table/wyb-table.vue @@ -140,14 +140,15 @@ fontSize: (fontSize[1] || fontSize[0]) + 'rpx', textDecoration: autoTextDecoration(cIndex, hIndex), color: autoContentColor(cIndex, hIndex), - backgroundColor: autoContentBgColor(cIndex, hIndex), + backgroundColor: content.disabled ? '#ecf0f1' : autoContentBgColor(cIndex, hIndex), padding: padding[0] + 'rpx ' + (padding[1] || padding[0]) + 'rpx', borderBottom: cIndex === contents.length - 1 ? '1px solid' + borderColor : 'none', borderRight: hIndex === headers.length - 1 || (!showVertBorder && hIndex !== 0) ? 'none' : '1px solid' + borderColor, zIndex: hIndex === 0 ? 20 : 0, left: enableCheck ? checkColWidth + 'rpx' : 0, position: hIndex === 0 && firstLineFixed ? 'sticky' : 'static'}"> - - @@ -77,6 +78,9 @@ },{ label: '非含税价', key: 'non_tax_price' + },{ + label: '操作', + key: 'operation' }], contents: [], is_show: false, @@ -149,7 +153,8 @@ number: item?.material?.m_sn || '', purchase_limit: {edit: true, value: 1}, tax_price: {edit: true, value: ''}, - non_tax_price: {edit: true, value: ''} + non_tax_price: {edit: true, value: ''}, + operation: {button: true, key: 'delete', value: '删除'} } }) this.contents = contents; @@ -165,7 +170,7 @@ let list = res.data.order || []; let canteen = res.data.canteen || []; let contents = list.map(item => { - return { + let obj = { name: item?.material?.m_name || '', material_id: item?.material?.id || 0, spec: item.name, @@ -176,8 +181,13 @@ purchase_limit: {edit: true, value: item?.quotation?.purchase_limit || ''}, tax_price: {edit: true, value: item?.quotation?.tax_price || ''}, non_tax_price: {edit: true, value: item?.quotation?.non_tax_price || ''}, - quotation_id: item?.quotation?.id || 0 + quotation_id: item?.quotation?.id || 0, + operation: {button: true, key: 'delete', value: '删除'} + } + if(item?.material?.state && item?.material?.state != '启用'){ + obj.disabled = true; } + return obj; }) this.contents = contents; this.getCanteenList(canteen); @@ -228,6 +238,13 @@ onInputChange(event){ this.contents[event.contentIndex][event.key].value = event.detailValue; }, + // table操作按钮被点击 + onButtonClick(event){ + if(event.content.key == 'delete'){ + let contentIndex = event.lineData.contentIndex; + this.contents.splice(contentIndex, 1); + } + }, // 切换显示关联食堂modal switchRelation(){ if(this.type == 1) return this.$msg('编辑不可更换关联食堂哦');