Commit c5b9da53 authored by 李驰骋's avatar 李驰骋

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/views/ship-approval/ShipApproval.vue
parents d91b3f08 14700e8a
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
<van-cell title="年度" :value="conditions.quotasYear" /> <van-cell title="年度" :value="conditions.quotasYear" />
</div> </div>
<div <div
class="top-block top-detail-block" class="top-block top-detail-block"
v-for="(item, index) in conditions.wantGoodsDetailList" v-for="(item, index) in conditions.wantGoodsDetailList"
:key="index" :key="index"
> >
<van-cell title="产品类别" :value="item.brandBqTextView" /> <van-cell title="产品类别" :value="item.brandBqTextView" />
<van-cell title="产品描述" :value="item.productDesc" /> <van-cell title="产品描述" :value="item.productDesc" />
...@@ -28,17 +28,17 @@ ...@@ -28,17 +28,17 @@
<van-cell title="本次要货件数" :value="item.wantQuantity" /> <van-cell title="本次要货件数" :value="item.wantQuantity" />
<van-cell title="年销售计划量" :value="item.yearSalePlanQty" /> <van-cell title="年销售计划量" :value="item.yearSalePlanQty" />
<van-cell title="月销售计划量" :value="item.monthSalePlanQty" /> <van-cell title="月销售计划量" :value="item.monthSalePlanQty" />
<van-cell title="当月审批量" :value="item.monthAuditQty" /> <van-cell title="当月协助量" :value="item.monthAuditQty" />
<van-cell title="库存量(发货申请时的实时库存)" :value="item.stockQuantity" /> <van-cell title="库存量(发货申请时的实时库存)" :value="item.stockQuantity" />
<van-cell title="在途量" :value="item.roadQuantity" /> <van-cell title="在途量" :value="item.roadQuantity" />
<van-cell title="已审在发运量" :value="item.auditShipmentQuantity" /> <van-cell title="已审在发运量" :value="item.auditShipmentQuantity" />
</div> </div>
<van-button <van-button
class="download-btn" class="download-btn"
icon-position="right" icon-position="right"
:icon="downloadIcon" :icon="downloadIcon"
@click="checkDetail" @click="checkDetail"
type="primary" type="primary"
> >
查看发票占用情况 查看发票占用情况
</van-button> </van-button>
...@@ -46,133 +46,133 @@ ...@@ -46,133 +46,133 @@
<div class="block form-block"> <div class="block form-block">
<van-cell-group> <van-cell-group>
<van-field <van-field
v-if="isShowBase" v-if="isShowBase"
v-model="form.baseAuditQuantity" v-model="form.baseAuditQuantity"
:required="taskNode.subProcUnitId === 'base'" :required="taskNode.subProcUnitId === 'base'"
label="基地审批量" label="基地协助量"
placeholder="" placeholder=""
:disabled="taskNode.subProcUnitId !== 'base'" :disabled="taskNode.subProcUnitId !== 'base'"
/> />
<van-field <van-field
v-if="isShowWarZone" v-if="isShowWarZone"
v-model="form.warAuditQuantity" v-model="form.warAuditQuantity"
label="战区审批量" label="战区协助量"
:required="taskNode.subProcUnitId === 'warZone'" :required="taskNode.subProcUnitId === 'warZone'"
placeholder="" placeholder=""
error-message="" error-message=""
:disabled="taskNode.subProcUnitId !== 'warZone'" :disabled="taskNode.subProcUnitId !== 'warZone'"
/> />
<van-field <van-field
v-if="isShowWork" v-if="isShowWork"
v-model="form.salecenterAuditQuantity" v-model="form.salecenterAuditQuantity"
:required="taskNode.subProcUnitId === 'work'" :required="taskNode.subProcUnitId === 'work'"
label="内勤审批量" label="内勤协助量"
placeholder="" placeholder=""
error-message="" error-message=""
:disabled="taskNode.subProcUnitId !== 'work'" :disabled="taskNode.subProcUnitId !== 'work'"
/> />
</van-cell-group> </van-cell-group>
</div> </div>
<div class="block form-block"> <div class="block form-block">
<van-cell-group> <van-cell-group>
<van-field <van-field
v-model="conditions.kaStoreShortName" v-model="conditions.kaStoreShortName"
label="卖场简称" label="卖场简称"
placeholder="" placeholder=""
disabled disabled
/> />
<van-field <van-field
v-model="conditions.kaStoreFullName" v-model="conditions.kaStoreFullName"
label="卖场全称" label="卖场全称"
placeholder="" placeholder=""
error-message="" error-message=""
disabled disabled
/> />
<van-field <van-field
v-model="conditions.kaStoreArea" v-model="conditions.kaStoreArea"
label="卖场区域" label="卖场区域"
placeholder="" placeholder=""
error-message="" error-message=""
disabled disabled
/> />
</van-cell-group> </van-cell-group>
</div> </div>
<div class="block form-block"> <div class="block form-block">
<van-cell-group> <van-cell-group>
<van-field <van-field
v-model="conditions.isShuntTextView" v-model="conditions.isShuntTextView"
label="是否分流" label="是否分流"
placeholder="" placeholder=""
disabled disabled
/> />
<van-field <van-field
v-model="conditions.shuntDealer" v-model="conditions.shuntDealer"
label="分流经销商" label="分流经销商"
placeholder="" placeholder=""
error-message="" error-message=""
disabled disabled
/> />
<van-field <van-field
v-model="conditions.noticeSheetTypeTextView" v-model="conditions.noticeSheetTypeTextView"
label="分流经渠道" label="分流经渠道"
placeholder="" placeholder=""
error-message="" error-message=""
disabled disabled
/> />
</van-cell-group> </van-cell-group>
</div> </div>
<div class="block form-block"> <div class="block form-block">
<van-cell-group> <van-cell-group>
<van-field <van-field
v-model="conditions.shuntReceiveUnitName" v-model="conditions.shuntReceiveUnitName"
label="分流收货单位" label="分流收货单位"
placeholder="" placeholder=""
disabled disabled
/> />
<van-field <van-field
v-model="conditions.receiveUnitName" v-model="conditions.receiveUnitName"
:label="conditions.demandType == 'ZDZG' ? '收货终端' :'收货单位'" :label="conditions.demandType == 'ZDZG' ? '收货终端' :'收货单位'"
placeholder="" placeholder=""
error-message="" error-message=""
disabled disabled
/> />
<van-field <van-field
v-model="conditions.spurtCodeUnit" v-model="conditions.spurtCodeUnit"
label="喷码单位" label="喷码单位"
placeholder="" placeholder=""
error-message="" error-message=""
disabled disabled
/> />
<van-field <van-field
v-model="conditions.contacPerson" v-model="conditions.contacPerson"
label="收货联系人" label="收货联系人"
placeholder="" placeholder=""
disabled disabled
/> />
</van-cell-group> </van-cell-group>
</div> </div>
<div class="block form-block"> <div class="block form-block">
<van-cell-group> <van-cell-group>
<van-field <van-field
v-model="conditions.contactNumber" v-model="conditions.contactNumber"
label="联系人电话" label="联系人电话"
placeholder="" placeholder=""
disabled disabled
/> />
<van-field <van-field
v-model="conditions.receiveAddress" v-model="conditions.receiveAddress"
label="收货地址" label="收货地址"
placeholder="" placeholder=""
error-message="" error-message=""
disabled disabled
/> />
<van-field <van-field
v-model="conditions.selfacceptanceTextView" v-model="conditions.selfacceptanceTextView"
label="是否自提" label="是否自提"
placeholder="" placeholder=""
error-message="" error-message=""
disabled disabled
/> />
<van-field v-model="conditions.remark" label="备注" placeholder="" disabled /> <van-field v-model="conditions.remark" label="备注" placeholder="" disabled />
</van-cell-group> </van-cell-group>
...@@ -181,10 +181,10 @@ ...@@ -181,10 +181,10 @@
<van-collapse class="step-block" v-model="activeNames" :border="false"> <van-collapse class="step-block" v-model="activeNames" :border="false">
<van-collapse-item title="操作" name="1" :border="false"> <van-collapse-item title="操作" name="1" :border="false">
<van-steps <van-steps
direction="vertical" direction="vertical"
:active="stepActive" :active="stepActive"
active-color="#FF1D32" active-color="#FF1D32"
inactive-color="#999" inactive-color="#999"
> >
<van-step v-for="(item, index) in tablePathData" :key="index"> <van-step v-for="(item, index) in tablePathData" :key="index">
<template #active-icon> <template #active-icon>
...@@ -217,41 +217,41 @@ ...@@ -217,41 +217,41 @@
<div class="approval-block"> <div class="approval-block">
<span class="title">操作结果</span> <span class="title">操作结果</span>
<van-field <van-field
:disabled="!flag" :disabled="!flag"
v-model="pickerVal" v-model="pickerVal"
is-link is-link
readonly readonly
label="" label=""
placeholder="" placeholder=""
@click="handlePicker" @click="handlePicker"
/> />
</div> </div>
<div class="remark-block"> <div class="remark-block">
<span class="title">情况说明</span> <span class="title">情况说明</span>
<template v-if="isFirstApprovalNode"> <template v-if="isFirstApprovalNode">
<van-field <van-field
v-model="form.orderQuantity" v-model="form.orderQuantity"
:disabled="!flag" :disabled="!flag"
label="要货量(件)" label="要货量(件)"
type="number" type="number"
placeholder="请输入" placeholder="请输入"
required required
/> />
<van-field <van-field
v-model="form.systemStock" v-model="form.systemStock"
:disabled="!flag" :disabled="!flag"
label="系统库存量(件)" label="系统库存量(件)"
type="number" type="number"
placeholder="请输入" placeholder="请输入"
required required
/> />
<van-field <van-field
v-model="form.realTimeStock" v-model="form.realTimeStock"
:disabled="!flag" :disabled="!flag"
label="实时库存量(件)" label="实时库存量(件)"
type="number" type="number"
placeholder="请输入" placeholder="请输入"
required required
/> />
</template> </template>
<template v-else> <template v-else>
...@@ -269,12 +269,12 @@ ...@@ -269,12 +269,12 @@
<div class="bottom"> <div class="bottom">
<!-- <van-button plain type="primary">确认</van-button> --> <!-- <van-button plain type="primary">确认</van-button> -->
<van-button <van-button
v-if="pickerVal === '已阅'" v-if="pickerVal === '已阅'"
plain plain
:disabled="!flag" :disabled="!flag"
type="primary" type="primary"
@click="submit('1')" @click="submit('1')"
>确认</van-button >确认</van-button
> >
<van-button v-else plain :disabled="!flag" type="primary" @click="submit('2')">退回</van-button> <van-button v-else plain :disabled="!flag" type="primary" @click="submit('2')">退回</van-button>
</div> </div>
...@@ -282,15 +282,15 @@ ...@@ -282,15 +282,15 @@
<van-picker :columns="columns" @cancel="showPicker = false" @confirm="onConfirm" /> <van-picker :columns="columns" @cancel="showPicker = false" @confirm="onConfirm" />
</van-popup> </van-popup>
<van-popup <van-popup
v-model:show="invoiceOccupancyDetailShow" v-model:show="invoiceOccupancyDetailShow"
position="right" position="right"
:style="{ width: '100%', height: '100%' }" :style="{ width: '100%', height: '100%' }"
> >
<InvoiceOccupancyDetail <InvoiceOccupancyDetail
@close="onDetailClose" @close="onDetailClose"
v-if="invoiceOccupancyDetailShow" v-if="invoiceOccupancyDetailShow"
:source-data="conditions.invoiceUsedList" :source-data="conditions.invoiceUsedList"
:invoice-condition="invoiceCondition" :invoice-condition="invoiceCondition"
></InvoiceOccupancyDetail> ></InvoiceOccupancyDetail>
</van-popup> </van-popup>
</div> </div>
...@@ -365,14 +365,21 @@ export default { ...@@ -365,14 +365,21 @@ export default {
isReadonly() { isReadonly() {
return false return false
}, },
// 查找第一个审批节点(排除发起人节点和分流审批节点)
firstApprovalNode() { firstApprovalNode() {
var node = this.findFirstApprovalNode() return this.findFirstApprovalNode()
return node;
}, },
// 判断当前是否是第一个审批节点
isFirstApprovalNode() { isFirstApprovalNode() {
const node = this.firstApprovalNode const node = this.firstApprovalNode
return node && (node.statusId === 'executing' || node.statusId === 'ready') const currNode = this.findCurrApprovalNode()
if (currNode == null || node == null) {
return false
}
// 判断找到的节点是否为执行中状态
return node.subProcUnitName === currNode.subProcUnitName
}, },
// 获取第一条审批节点的opinion数据
firstApprovalOpinion() { firstApprovalOpinion() {
const node = this.firstApprovalNode const node = this.firstApprovalNode
return node ? (node.opinion || '') : '' return node ? (node.opinion || '') : ''
...@@ -387,37 +394,51 @@ export default { ...@@ -387,37 +394,51 @@ export default {
this.initDetail() this.initDetail()
} }
}, },
mounted() { methods: {
// 强制刷新,解决企业微信缓存问题 /**
// 在mounted中执行,确保DOM已加载 * 查找第一个审批节点
this.$nextTick(() => { * 排除规则:
if (typeof window !== 'undefined' && window.location) { * 1. 排除第一个节点(发起人节点,索引0)
try { * 2. 如果第二个节点的 subProcUnitId === 'shunt',也排除(分流审批)
const searchParams = new URLSearchParams(window.location.search) * @returns {Object|null} 第一个审批节点,如果不存在则返回 null
if (!searchParams.has('_t')) { */
searchParams.set('_t', Date.now().toString()) findFirstApprovalNode() {
const newUrl = window.location.pathname + '?' + searchParams.toString() + (window.location.hash || '') const data = this.tablePathData
window.history.replaceState({}, '', newUrl) if (!data || data.length === 0) {
// 强制重新加载页面资源(仅在企业微信环境下) return null
if (window.navigator.userAgent.indexOf('wxwork') !== -1) { }
// 企业微信环境,尝试清除可能的缓存
const links = document.querySelectorAll('link[rel="stylesheet"]') // 从索引1开始查找(排除第一个节点,发起人节点)
links.forEach(link => { let startIndex = 1
if (link.href) {
const href = new URL(link.href, window.location.origin) // 如果第二个节点是分流审批(subProcUnitId === 'shunt'),也排除
href.searchParams.set('_v', Date.now().toString()) if (data.length > 1 && data[1].subProcUnitId === 'shunt') {
link.href = href.toString() startIndex = 2
} }
})
} // 从 startIndex 开始查找第一个审批节点
} for (let i = startIndex; i < data.length; i++) {
} catch (e) { const node = data[i]
console.warn('缓存控制处理失败:', e) // 返回找到的第一个节点
return node
}
return null
},
// 查找当前审批节点
findCurrApprovalNode() {
const data = this.tablePathData
if (!Array.isArray(data) || data.length === 0) {
return null
}
for (let i = 1; i < data.length; i++) {
const node = data[i]
if (node.statusId === 'executing' || node.statusId === 'ready') {
return node
} }
} }
}) return null
}, },
methods: {
handlePicker() { handlePicker() {
this.showPicker = this.flag this.showPicker = this.flag
}, },
...@@ -439,7 +460,13 @@ export default { ...@@ -439,7 +460,13 @@ export default {
initDetail() { initDetail() {
apiWantgoodsFindById(this.conditions).then(res => { apiWantgoodsFindById(this.conditions).then(res => {
res.data.pyear += '' res.data.pyear += ''
// 保存 taskId,避免被 res.data 覆盖
const savedTaskId = this.conditions.taskId
this.conditions = { ...this.conditions, ...res.data } this.conditions = { ...this.conditions, ...res.data }
// 如果 res.data 中没有 taskId 或 taskId 为空,则恢复保存的值
if (!this.conditions.taskId && savedTaskId) {
this.conditions.taskId = savedTaskId
}
this.status = res.data.status this.status = res.data.status
this.flowPath() this.flowPath()
for (const key in this.conditions) { for (const key in this.conditions) {
...@@ -448,7 +475,7 @@ export default { ...@@ -448,7 +475,7 @@ export default {
this.conditions.isShuntTextView = this.FormDictionaryForYesOrNot(this.conditions[key]) this.conditions.isShuntTextView = this.FormDictionaryForYesOrNot(this.conditions[key])
} else if (key === 'selfacceptance') { } else if (key === 'selfacceptance') {
this.conditions.selfacceptanceTextView = this.FormDictionaryForYesOrNot( this.conditions.selfacceptanceTextView = this.FormDictionaryForYesOrNot(
this.conditions[key] this.conditions[key]
) )
} }
} }
...@@ -472,22 +499,22 @@ export default { ...@@ -472,22 +499,22 @@ export default {
}, },
flowPath() { flowPath() {
queryApprovalHistoryByBizId({ bizId: this.conditions.id }) queryApprovalHistoryByBizId({ bizId: this.conditions.id })
.then(res => { .then(res => {
if (res.data) { if (res.data) {
this.tablePathData = res.data.Rows this.tablePathData = res.data.Rows
this.stepActive = this.tablePathData.length this.stepActive = this.tablePathData.length
this.selectSelfTask(res.data.Rows) this.selectSelfTask(res.data.Rows)
this.flag = res.data.Rows.some(item => { this.flag = res.data.Rows.some(item => {
return ( return (
item.executorPersonId === Cookies.get('HEADER_USERID_KEY') && item.executorPersonId === Cookies.get('HEADER_USERID_KEY') &&
(item.statusId === 'executing' || item.statusId === 'ready') && (item.statusId === 'executing' || item.statusId === 'ready') &&
item.id === this.conditions.taskId && item.id === this.conditions.taskId &&
this.status - 1 === 0 this.status - 1 === 0
) )
}) })
} }
}) })
.catch(() => {}) .catch(() => {})
}, },
buildOpinionText() { buildOpinionText() {
const parts = [] const parts = []
...@@ -574,34 +601,34 @@ export default { ...@@ -574,34 +601,34 @@ export default {
if (this.isShowBase && this.taskNode.subProcUnitId === 'base') { if (this.isShowBase && this.taskNode.subProcUnitId === 'base') {
if (this.form.baseAuditQuantity - 0 <= 0 || !Number(this.form.baseAuditQuantity)) { if (this.form.baseAuditQuantity - 0 <= 0 || !Number(this.form.baseAuditQuantity)) {
Toast('请正确填写基地审批量') Toast('请正确填写基地协助量')
return return
} else if ( } else if (
this.form.baseAuditQuantity - 0 > this.form.baseAuditQuantity - 0 >
params.wantGoodsDetailList[0].wantQuantity - 0 params.wantGoodsDetailList[0].wantQuantity - 0
) { ) {
Toast('基地审批数量不能大于本次要货数量') Toast('基地协助量不能大于本次要货数量')
return return
} }
} }
if (this.isShowWarZone && this.taskNode.subProcUnitId === 'warZone') { if (this.isShowWarZone && this.taskNode.subProcUnitId === 'warZone') {
if (this.form.warAuditQuantity - 0 <= 0 || !Number(this.form.warAuditQuantity)) { if (this.form.warAuditQuantity - 0 <= 0 || !Number(this.form.warAuditQuantity)) {
Toast('请正确填写战区审批量') Toast('请正确填写战区协助量')
return return
} else if (this.form.warAuditQuantity - 0 > this.form.baseAuditQuantity - 0) { } else if (this.form.warAuditQuantity - 0 > this.form.baseAuditQuantity - 0) {
Toast('战区审批数量不能大于本次要货数量') Toast('战区协助量不能大于本次要货数量')
return return
} }
} }
if (this.isShowWork) { if (this.isShowWork) {
if ( if (
this.form.salecenterAuditQuantity - 0 <= 0 || this.form.salecenterAuditQuantity - 0 <= 0 ||
!Number(this.form.salecenterAuditQuantity) !Number(this.form.salecenterAuditQuantity)
) { ) {
Toast('请正确填写内勤审批量') Toast('请正确填写内勤协助量')
return return
} else if (this.form.salecenterAuditQuantity - 0 > this.form.warAuditQuantity - 0) { } else if (this.form.salecenterAuditQuantity - 0 > this.form.warAuditQuantity - 0) {
Toast('销售内勤审批数量不能大于本次要货数量') Toast('销售内勤协助量不能大于本次要货数量')
return return
} }
} }
...@@ -679,23 +706,6 @@ export default { ...@@ -679,23 +706,6 @@ export default {
1: '是' 1: '是'
}[val * 1] }[val * 1]
}, },
findFirstApprovalNode() {
const data = this.tablePathData
if (!Array.isArray(data) || data.length === 0) {
return null
}
let startIndex = 1
if (data.length > 1 && data[1].subProcUnitId === 'shunt') {
startIndex = 2
}
for (let i = startIndex; i < data.length; i++) {
const node = data[i]
if (node) {
return node
}
}
return null
},
onClickLeft() { onClickLeft() {
window.opener = null window.opener = null
window.open('', '_self', '') window.open('', '_self', '')
...@@ -916,6 +926,15 @@ export default { ...@@ -916,6 +926,15 @@ export default {
line-height: 22px; line-height: 22px;
color: #333; color: #333;
} }
:deep(.van-field) {
.van-cell__title {
flex: 0 0 140px;
white-space: nowrap;
}
.van-cell__value {
flex: 1;
}
}
} }
.approval-block { .approval-block {
display: flex; display: flex;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment