Commit 8596cc26 by wangzhihui

```

feat(StickyTable): 添加列隐藏功能支持

添加了isHidden属性来控制表格列的显示和隐藏,
使表格可以根据不同用户角色动态调整显示内容

fix(detail): 修复条件渲染和格式化逻辑问题

修复了v-if条件渲染语法错误,统一了三元运算符的格式,
并解决了数据格式化中的逻辑问题

refactor(cannibalize): 优化库存调配页面代码结构

重构了组件的数据初始化逻辑,添加了运营审核角色的权限控制,
移除了注释掉的冗余代码,并优化了数据处理流程
```
1 parent 35045650
...@@ -4,17 +4,17 @@ ...@@ -4,17 +4,17 @@
<table class="sticky-table"> <table class="sticky-table">
<thead> <thead>
<tr> <tr>
<th v-for="(col, index) in columns" :key="index" :class="{ 'fixed-col': index === 0 && fixedFirstColumn }" :style="getHeaderStyle(index)"> <th v-for="(col, index) in columns" v-if="!col.isHidden" :key="index" :class="{ 'fixed-col': index === 0 && fixedFirstColumn }" :style="getHeaderStyle(index)">
{{ col.label }} {{ col.label }}
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="(row, rowIndex) in data" :key="rowIndex"> <tr v-for="(row, rowIndex) in data" :key="rowIndex">
<td v-for="(col, colIndex) in columns" :key="colIndex" :class="{ 'fixed-col': colIndex === 0 && fixedFirstColumn }" :style="getCellStyle(colIndex)"> <td v-for="(col, colIndex) in columns" v-if="!col.isHidden" :key="colIndex" :class="{ 'fixed-col': colIndex === 0 && fixedFirstColumn }" :style="getCellStyle(colIndex)">
<div class="cell-content"> <div class="cell-content">
<slot :name="col.prop" :row="row" :index="rowIndex"> <slot :name="col.prop" :row="row" :index="rowIndex">
{{ col.formatter ? col.formatter(row) : ((row[col.prop] ||row[col.prop]===0) ? row[col.prop] : '-') }} {{ col.formatter ? col.formatter(row) : row[col.prop] || row[col.prop] === 0 ? row[col.prop] : '-' }}
</slot> </slot>
</div> </div>
</td> </td>
...@@ -52,7 +52,7 @@ export default { ...@@ -52,7 +52,7 @@ export default {
}, },
methods: { methods: {
getHeaderStyle(index) { getHeaderStyle(index) {
const style = {}; const style = {}
if (this.columns[index].width) { if (this.columns[index].width) {
style.minWidth = this.columns[index].width style.minWidth = this.columns[index].width
style.maxWidth = this.columns[index].width style.maxWidth = this.columns[index].width
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="detail-container"> <div class="detail-container">
<div class="info-section"> <div class="info-section">
<div class="title">基本信息</div> <div class="title">基本信息</div>
<div v-for="(item, index) in orderBasicInfoList" :key="index" class="info-item"> <div v-for="(item, index) in orderBasicInfoList" v-if="!item.isHidden" :key="index" class="info-item">
<span>{{ item.label }}</span> <span>{{ item.label }}</span>
<span class="value" v-if="item.formatter">{{ item.formatter(orderInfo) }}</span> <span class="value" v-if="item.formatter">{{ item.formatter(orderInfo) }}</span>
<span class="value" v-else>{{ orderInfo[item.value] || orderInfo[item.value] === 0 ? orderInfo[item.value] : '--' }}</span> <span class="value" v-else>{{ orderInfo[item.value] || orderInfo[item.value] === 0 ? orderInfo[item.value] : '--' }}</span>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<div class="item" :key="index"> <div class="item" :key="index">
<div class="name">{{ item.merchantName }}</div> <div class="name">{{ item.merchantName }}</div>
<!-- 运营审核角色需要隐藏 --> <!-- 运营审核角色需要隐藏 -->
<div class="line" v-if="staffType!=2"> <div class="line" v-if="staffType != 2">
<!-- [1, 4, 6, 12, 14] --> <!-- [1, 4, 6, 12, 14] -->
<div class="label">当前库存</div> <div class="label">当前库存</div>
<div class="value">{{ item.stock || item.stock === 0 ? item.stock + ([1, 4, 6, 12, 14].includes(item.goodsType) ? '米' : '件') : '--' }}</div> <div class="value">{{ item.stock || item.stock === 0 ? item.stock + ([1, 4, 6, 12, 14].includes(item.goodsType) ? '米' : '件') : '--' }}</div>
...@@ -50,13 +50,13 @@ import allocateApi from '@/api/allocate' ...@@ -50,13 +50,13 @@ import allocateApi from '@/api/allocate'
export default { export default {
data() { data() {
return { return {
staffType:this.$route.query.staffType, staffType: this.$route.query.staffType,
page: { page: {
currentPage: 1, currentPage: 1,
pageSize: 10 pageSize: 10
}, },
flag: false, flag: false,
total:0, total: 0,
StockList: [], StockList: [],
id: this.$route.query.id, id: this.$route.query.id,
orderInfo: {}, orderInfo: {},
...@@ -79,18 +79,25 @@ export default { ...@@ -79,18 +79,25 @@ export default {
return cellValue.inStockQty || cellValue.inStockQty === 0 ? cellValue.inStockQty + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--' return cellValue.inStockQty || cellValue.inStockQty === 0 ? cellValue.inStockQty + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--'
} }
}, },
// { {
// label: '调出门店库存', label: '调出门店库存',
// value: 'outStockQty', value: 'outStockQty',
// formatter: cellValue => { formatter: cellValue => {
// return cellValue.outStockQty || cellValue.outStockQty === 0 ? cellValue.outStockQty + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--' return cellValue.outStockQty || cellValue.outStockQty === 0 ? cellValue.outStockQty + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--'
// } },
// }, isHidden: false
},
{ label: '膜卷号', value: 'filmRollNo' } { label: '膜卷号', value: 'filmRollNo' }
] ]
} }
}, },
created() { created() {
this.orderBasicInfoList.forEach(item => {
//运营审核屏蔽调出门店
if (item.label == '调出门店库存' && this.staffType == 2) {
item.isHidden = true
}
})
this.getAllocateGoodsDetail() this.getAllocateGoodsDetail()
}, },
methods: { methods: {
...@@ -106,13 +113,13 @@ export default { ...@@ -106,13 +113,13 @@ export default {
}, },
getList() { getList() {
let list = this.StockList let list = this.StockList
allocateApi.getAllocateGoodsStockDetail({ ...this.page, merchantName: this.keyword, upgradeGoodsId: this.orderInfo.goodsId}).then(({ code, data, message }) => { allocateApi.getAllocateGoodsStockDetail({ ...this.page, merchantName: this.keyword, upgradeGoodsId: this.orderInfo.goodsId }).then(({ code, data, message }) => {
this.hideLoading() this.hideLoading()
if (code == 0) { if (code == 0) {
this.total = data.total this.total = data.total
this.StockList = [...list, ...data.list] this.StockList = [...list, ...data.list]
if (this.page.currentPage > 1) this.$refs.scrollView.loading = false if (this.page.currentPage > 1) this.$refs.scrollView.loading = false
if( this.StockList.length<this.total) this.$refs.scrollView.finished = false if (this.StockList.length < this.total) this.$refs.scrollView.finished = false
if (data.list == 0 && this.flag) { if (data.list == 0 && this.flag) {
this.$refs.scrollView.finished = true this.$refs.scrollView.finished = true
} }
...@@ -179,7 +186,7 @@ export default { ...@@ -179,7 +186,7 @@ export default {
width: 223px; width: 223px;
white-space: wrap; white-space: wrap;
display: inline-block; display: inline-block;
white-space: pre-wrap; white-space: pre-wrap;
word-break: break-word; word-break: break-word;
} }
.search-pop-input { .search-pop-input {
...@@ -254,12 +261,12 @@ export default { ...@@ -254,12 +261,12 @@ export default {
margin-right: 12px; margin-right: 12px;
} }
.value { .value {
width:calc(100% - 100px); width: calc(100% - 100px);
color: #333333; color: #333333;
font-size: 14px; font-size: 14px;
white-space: wrap; white-space: wrap;
white-space: pre-wrap; white-space: pre-wrap;
word-break: break-word; word-break: break-word;
} }
} }
} }
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</div> </div>
<StickyTable :columns="tableColumns" :data="allocateOrderInfo.stockAllocateDetailList" :height="allocateOrderInfo.stockAllocateDetailList.length > 5 ? '216px' : 'auto'"> <StickyTable :columns="tableColumns" :data="allocateOrderInfo.stockAllocateDetailList" :height="allocateOrderInfo.stockAllocateDetailList.length > 5 ? '216px' : 'auto'">
<template #goodsName="{ row }"> <template #goodsName="{ row }">
<span style="color: #347bff; cursor: pointer" @click="handleProductClick(row)">{{ row.goodsName||'-' }}</span> <span style="color: #347bff; cursor: pointer" @click="handleProductClick(row)">{{ row.goodsName || '-' }}</span>
</template> </template>
</StickyTable> </StickyTable>
</div> </div>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<div class="title">其他信息</div> <div class="title">其他信息</div>
<div class="info-item"> <div class="info-item">
<span>备注</span> <span>备注</span>
<span class="word-break">{{formatOpinionText(allocateOrderInfo.remark) }}</span> <span class="word-break">{{ formatOpinionText(allocateOrderInfo.remark) }}</span>
</div> </div>
</div> </div>
<!-- 审核流程进度 --> <!-- 审核流程进度 -->
...@@ -110,13 +110,14 @@ export default { ...@@ -110,13 +110,14 @@ export default {
width: '120px', width: '120px',
formatter: cellValue => { formatter: cellValue => {
return cellValue.inStockQty || cellValue.inStockQty === 0 ? cellValue.inStockQty + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--' return cellValue.inStockQty || cellValue.inStockQty === 0 ? cellValue.inStockQty + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--'
},
isHidden:false
},
{
label: '调出门店库存', prop: 'outStockQty', width: '120px', formatter: cellValue => {
return cellValue.outStockQty || cellValue.outStockQty === 0 ? cellValue.outStockQty + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--'
} }
}, },
// {
// label: '调出门店库存', prop: 'outStockQty', width: '120px', formatter: cellValue => {
// return cellValue.outStockQty || cellValue.outStockQty === 0 ? cellValue.outStockQty + ([1, 4, 6, 12, 14].includes(cellValue.goodsType) ? '米' : '件') : '--'
// }
// },
{ {
label: '膜卷号', prop: 'filmRollNo', width: '90px' label: '膜卷号', prop: 'filmRollNo', width: '90px'
} }
...@@ -192,9 +193,10 @@ export default { ...@@ -192,9 +193,10 @@ export default {
} }
} }
}, },
// 第一步:http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/cannibalize?orderCode=CG26012916474916&staffType=2&name=glsadmin 运营审核 //D+调拨管理查找调拨单号
// 第二步:http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/cannibalize?orderCode=CG202407158682&staffType=3&name=glsadmin 商务审核 // 第一步:http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/cannibalize?orderCode=DB202604152929&staffType=2&name=glsadmin 运营审核
// 第二步: http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/cannibalize?orderCode=CG202407158682&staffType=4&name=glsadmin 采购发货审核 // 第二步:http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/cannibalize?orderCode=DB202604152929&staffType=3&name=glsadmin 商务审核
// 第二步: http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/cannibalize?orderCode=DB202604152929&staffType=4&name=glsadmin 采购发货审核
created() { created() {
this.allocateOrderDetail() this.allocateOrderDetail()
...@@ -210,7 +212,14 @@ export default { ...@@ -210,7 +212,14 @@ export default {
) )
} }
}, },
mounted() { }, mounted() {
this.tableColumns.forEach(item=>{
//运营审核屏蔽调出门店
if(item.label == '调出门店库存'&&this.staffType == 2){
item.isHidden = true
}
})
},
methods: { methods: {
formatOpinionText(opinion) { formatOpinionText(opinion) {
const s = String(opinion == null ? "-" : opinion); const s = String(opinion == null ? "-" : opinion);
...@@ -257,12 +266,12 @@ export default { ...@@ -257,12 +266,12 @@ export default {
}, },
async allocateOrderDetail() { async allocateOrderDetail() {
let result = await allocateApi.allocateOrderDetail({ allocateCode: this.orderCode }) let result = await allocateApi.allocateOrderDetail({ allocateCode: this.orderCode })
if (result.code == 0) { if (result.code == 0) {
this.allocateOrderInfo = result.data this.allocateOrderInfo = result.data
} }
}, },
//驳回 //驳回
handleReject() { handleReject() {
this.rejectVisible = true this.rejectVisible = true
...@@ -361,8 +370,8 @@ export default { ...@@ -361,8 +370,8 @@ export default {
word-break: break-word; word-break: break-word;
} }
.word-break { .word-break {
white-space: pre-wrap; white-space: pre-wrap;
word-break: break-word; word-break: break-word;
} }
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!