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

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/views/ship-approval/ShipApproval.vue
parents d91b3f08 14700e8a
......@@ -28,7 +28,7 @@
<van-cell title="本次要货件数" :value="item.wantQuantity" />
<van-cell title="年销售计划量" :value="item.yearSalePlanQty" />
<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.roadQuantity" />
<van-cell title="已审在发运量" :value="item.auditShipmentQuantity" />
......@@ -49,14 +49,14 @@
v-if="isShowBase"
v-model="form.baseAuditQuantity"
:required="taskNode.subProcUnitId === 'base'"
label="基地审批量"
label="基地协助量"
placeholder=""
:disabled="taskNode.subProcUnitId !== 'base'"
/>
<van-field
v-if="isShowWarZone"
v-model="form.warAuditQuantity"
label="战区审批量"
label="战区协助量"
:required="taskNode.subProcUnitId === 'warZone'"
placeholder=""
error-message=""
......@@ -66,7 +66,7 @@
v-if="isShowWork"
v-model="form.salecenterAuditQuantity"
:required="taskNode.subProcUnitId === 'work'"
label="内勤审批量"
label="内勤协助量"
placeholder=""
error-message=""
:disabled="taskNode.subProcUnitId !== 'work'"
......@@ -365,14 +365,21 @@ export default {
isReadonly() {
return false
},
// 查找第一个审批节点(排除发起人节点和分流审批节点)
firstApprovalNode() {
var node = this.findFirstApprovalNode()
return node;
return this.findFirstApprovalNode()
},
// 判断当前是否是第一个审批节点
isFirstApprovalNode() {
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() {
const node = this.firstApprovalNode
return node ? (node.opinion || '') : ''
......@@ -387,37 +394,51 @@ export default {
this.initDetail()
}
},
mounted() {
// 强制刷新,解决企业微信缓存问题
// 在mounted中执行,确保DOM已加载
this.$nextTick(() => {
if (typeof window !== 'undefined' && window.location) {
try {
const searchParams = new URLSearchParams(window.location.search)
if (!searchParams.has('_t')) {
searchParams.set('_t', Date.now().toString())
const newUrl = window.location.pathname + '?' + searchParams.toString() + (window.location.hash || '')
window.history.replaceState({}, '', newUrl)
// 强制重新加载页面资源(仅在企业微信环境下)
if (window.navigator.userAgent.indexOf('wxwork') !== -1) {
// 企业微信环境,尝试清除可能的缓存
const links = document.querySelectorAll('link[rel="stylesheet"]')
links.forEach(link => {
if (link.href) {
const href = new URL(link.href, window.location.origin)
href.searchParams.set('_v', Date.now().toString())
link.href = href.toString()
methods: {
/**
* 查找第一个审批节点
* 排除规则:
* 1. 排除第一个节点(发起人节点,索引0)
* 2. 如果第二个节点的 subProcUnitId === 'shunt',也排除(分流审批)
* @returns {Object|null} 第一个审批节点,如果不存在则返回 null
*/
findFirstApprovalNode() {
const data = this.tablePathData
if (!data || data.length === 0) {
return null
}
})
// 从索引1开始查找(排除第一个节点,发起人节点)
let startIndex = 1
// 如果第二个节点是分流审批(subProcUnitId === 'shunt'),也排除
if (data.length > 1 && data[1].subProcUnitId === 'shunt') {
startIndex = 2
}
// 从 startIndex 开始查找第一个审批节点
for (let i = startIndex; i < data.length; i++) {
const node = data[i]
// 返回找到的第一个节点
return node
}
} catch (e) {
console.warn('缓存控制处理失败:', e)
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() {
this.showPicker = this.flag
},
......@@ -439,7 +460,13 @@ export default {
initDetail() {
apiWantgoodsFindById(this.conditions).then(res => {
res.data.pyear += ''
// 保存 taskId,避免被 res.data 覆盖
const savedTaskId = this.conditions.taskId
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.flowPath()
for (const key in this.conditions) {
......@@ -574,22 +601,22 @@ export default {
if (this.isShowBase && this.taskNode.subProcUnitId === 'base') {
if (this.form.baseAuditQuantity - 0 <= 0 || !Number(this.form.baseAuditQuantity)) {
Toast('请正确填写基地审批量')
Toast('请正确填写基地协助量')
return
} else if (
this.form.baseAuditQuantity - 0 >
params.wantGoodsDetailList[0].wantQuantity - 0
) {
Toast('基地审批数量不能大于本次要货数量')
Toast('基地协助量不能大于本次要货数量')
return
}
}
if (this.isShowWarZone && this.taskNode.subProcUnitId === 'warZone') {
if (this.form.warAuditQuantity - 0 <= 0 || !Number(this.form.warAuditQuantity)) {
Toast('请正确填写战区审批量')
Toast('请正确填写战区协助量')
return
} else if (this.form.warAuditQuantity - 0 > this.form.baseAuditQuantity - 0) {
Toast('战区审批数量不能大于本次要货数量')
Toast('战区协助量不能大于本次要货数量')
return
}
}
......@@ -598,10 +625,10 @@ export default {
this.form.salecenterAuditQuantity - 0 <= 0 ||
!Number(this.form.salecenterAuditQuantity)
) {
Toast('请正确填写内勤审批量')
Toast('请正确填写内勤协助量')
return
} else if (this.form.salecenterAuditQuantity - 0 > this.form.warAuditQuantity - 0) {
Toast('销售内勤审批数量不能大于本次要货数量')
Toast('销售内勤协助量不能大于本次要货数量')
return
}
}
......@@ -679,23 +706,6 @@ export default {
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() {
window.opener = null
window.open('', '_self', '')
......@@ -916,6 +926,15 @@ export default {
line-height: 22px;
color: #333;
}
:deep(.van-field) {
.van-cell__title {
flex: 0 0 140px;
white-space: nowrap;
}
.van-cell__value {
flex: 1;
}
}
}
.approval-block {
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