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 @@
<van-cell title="年度" :value="conditions.quotasYear" />
</div>
<div
class="top-block top-detail-block"
v-for="(item, index) in conditions.wantGoodsDetailList"
:key="index"
class="top-block top-detail-block"
v-for="(item, index) in conditions.wantGoodsDetailList"
:key="index"
>
<van-cell title="产品类别" :value="item.brandBqTextView" />
<van-cell title="产品描述" :value="item.productDesc" />
......@@ -28,17 +28,17 @@
<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" />
</div>
<van-button
class="download-btn"
icon-position="right"
:icon="downloadIcon"
@click="checkDetail"
type="primary"
class="download-btn"
icon-position="right"
:icon="downloadIcon"
@click="checkDetail"
type="primary"
>
查看发票占用情况
</van-button>
......@@ -46,133 +46,133 @@
<div class="block form-block">
<van-cell-group>
<van-field
v-if="isShowBase"
v-model="form.baseAuditQuantity"
:required="taskNode.subProcUnitId === 'base'"
label="基地审批量"
placeholder=""
:disabled="taskNode.subProcUnitId !== 'base'"
v-if="isShowBase"
v-model="form.baseAuditQuantity"
:required="taskNode.subProcUnitId === 'base'"
label="基地协助量"
placeholder=""
:disabled="taskNode.subProcUnitId !== 'base'"
/>
<van-field
v-if="isShowWarZone"
v-model="form.warAuditQuantity"
label="战区审批量"
:required="taskNode.subProcUnitId === 'warZone'"
placeholder=""
error-message=""
:disabled="taskNode.subProcUnitId !== 'warZone'"
v-if="isShowWarZone"
v-model="form.warAuditQuantity"
label="战区协助量"
:required="taskNode.subProcUnitId === 'warZone'"
placeholder=""
error-message=""
:disabled="taskNode.subProcUnitId !== 'warZone'"
/>
<van-field
v-if="isShowWork"
v-model="form.salecenterAuditQuantity"
:required="taskNode.subProcUnitId === 'work'"
label="内勤审批量"
placeholder=""
error-message=""
:disabled="taskNode.subProcUnitId !== 'work'"
v-if="isShowWork"
v-model="form.salecenterAuditQuantity"
:required="taskNode.subProcUnitId === 'work'"
label="内勤协助量"
placeholder=""
error-message=""
:disabled="taskNode.subProcUnitId !== 'work'"
/>
</van-cell-group>
</div>
<div class="block form-block">
<van-cell-group>
<van-field
v-model="conditions.kaStoreShortName"
label="卖场简称"
placeholder=""
disabled
v-model="conditions.kaStoreShortName"
label="卖场简称"
placeholder=""
disabled
/>
<van-field
v-model="conditions.kaStoreFullName"
label="卖场全称"
placeholder=""
error-message=""
disabled
v-model="conditions.kaStoreFullName"
label="卖场全称"
placeholder=""
error-message=""
disabled
/>
<van-field
v-model="conditions.kaStoreArea"
label="卖场区域"
placeholder=""
error-message=""
disabled
v-model="conditions.kaStoreArea"
label="卖场区域"
placeholder=""
error-message=""
disabled
/>
</van-cell-group>
</div>
<div class="block form-block">
<van-cell-group>
<van-field
v-model="conditions.isShuntTextView"
label="是否分流"
placeholder=""
disabled
v-model="conditions.isShuntTextView"
label="是否分流"
placeholder=""
disabled
/>
<van-field
v-model="conditions.shuntDealer"
label="分流经销商"
placeholder=""
error-message=""
disabled
v-model="conditions.shuntDealer"
label="分流经销商"
placeholder=""
error-message=""
disabled
/>
<van-field
v-model="conditions.noticeSheetTypeTextView"
label="分流经渠道"
placeholder=""
error-message=""
disabled
v-model="conditions.noticeSheetTypeTextView"
label="分流经渠道"
placeholder=""
error-message=""
disabled
/>
</van-cell-group>
</div>
<div class="block form-block">
<van-cell-group>
<van-field
v-model="conditions.shuntReceiveUnitName"
label="分流收货单位"
placeholder=""
disabled
v-model="conditions.shuntReceiveUnitName"
label="分流收货单位"
placeholder=""
disabled
/>
<van-field
v-model="conditions.receiveUnitName"
:label="conditions.demandType == 'ZDZG' ? '收货终端' :'收货单位'"
placeholder=""
error-message=""
disabled
v-model="conditions.receiveUnitName"
:label="conditions.demandType == 'ZDZG' ? '收货终端' :'收货单位'"
placeholder=""
error-message=""
disabled
/>
<van-field
v-model="conditions.spurtCodeUnit"
label="喷码单位"
placeholder=""
error-message=""
disabled
v-model="conditions.spurtCodeUnit"
label="喷码单位"
placeholder=""
error-message=""
disabled
/>
<van-field
v-model="conditions.contacPerson"
label="收货联系人"
placeholder=""
disabled
v-model="conditions.contacPerson"
label="收货联系人"
placeholder=""
disabled
/>
</van-cell-group>
</div>
<div class="block form-block">
<van-cell-group>
<van-field
v-model="conditions.contactNumber"
label="联系人电话"
placeholder=""
disabled
v-model="conditions.contactNumber"
label="联系人电话"
placeholder=""
disabled
/>
<van-field
v-model="conditions.receiveAddress"
label="收货地址"
placeholder=""
error-message=""
disabled
v-model="conditions.receiveAddress"
label="收货地址"
placeholder=""
error-message=""
disabled
/>
<van-field
v-model="conditions.selfacceptanceTextView"
label="是否自提"
placeholder=""
error-message=""
disabled
v-model="conditions.selfacceptanceTextView"
label="是否自提"
placeholder=""
error-message=""
disabled
/>
<van-field v-model="conditions.remark" label="备注" placeholder="" disabled />
</van-cell-group>
......@@ -181,10 +181,10 @@
<van-collapse class="step-block" v-model="activeNames" :border="false">
<van-collapse-item title="操作" name="1" :border="false">
<van-steps
direction="vertical"
:active="stepActive"
active-color="#FF1D32"
inactive-color="#999"
direction="vertical"
:active="stepActive"
active-color="#FF1D32"
inactive-color="#999"
>
<van-step v-for="(item, index) in tablePathData" :key="index">
<template #active-icon>
......@@ -217,41 +217,41 @@
<div class="approval-block">
<span class="title">操作结果</span>
<van-field
:disabled="!flag"
v-model="pickerVal"
is-link
readonly
label=""
placeholder=""
@click="handlePicker"
:disabled="!flag"
v-model="pickerVal"
is-link
readonly
label=""
placeholder=""
@click="handlePicker"
/>
</div>
<div class="remark-block">
<span class="title">情况说明</span>
<template v-if="isFirstApprovalNode">
<van-field
v-model="form.orderQuantity"
:disabled="!flag"
label="要货量(件)"
type="number"
placeholder="请输入"
required
v-model="form.orderQuantity"
:disabled="!flag"
label="要货量(件)"
type="number"
placeholder="请输入"
required
/>
<van-field
v-model="form.systemStock"
:disabled="!flag"
label="系统库存量(件)"
type="number"
placeholder="请输入"
required
v-model="form.systemStock"
:disabled="!flag"
label="系统库存量(件)"
type="number"
placeholder="请输入"
required
/>
<van-field
v-model="form.realTimeStock"
:disabled="!flag"
label="实时库存量(件)"
type="number"
placeholder="请输入"
required
v-model="form.realTimeStock"
:disabled="!flag"
label="实时库存量(件)"
type="number"
placeholder="请输入"
required
/>
</template>
<template v-else>
......@@ -269,12 +269,12 @@
<div class="bottom">
<!-- <van-button plain type="primary">确认</van-button> -->
<van-button
v-if="pickerVal === '已阅'"
plain
:disabled="!flag"
type="primary"
@click="submit('1')"
>确认</van-button
v-if="pickerVal === '已阅'"
plain
:disabled="!flag"
type="primary"
@click="submit('1')"
>确认</van-button
>
<van-button v-else plain :disabled="!flag" type="primary" @click="submit('2')">退回</van-button>
</div>
......@@ -282,15 +282,15 @@
<van-picker :columns="columns" @cancel="showPicker = false" @confirm="onConfirm" />
</van-popup>
<van-popup
v-model:show="invoiceOccupancyDetailShow"
position="right"
:style="{ width: '100%', height: '100%' }"
v-model:show="invoiceOccupancyDetailShow"
position="right"
:style="{ width: '100%', height: '100%' }"
>
<InvoiceOccupancyDetail
@close="onDetailClose"
v-if="invoiceOccupancyDetailShow"
:source-data="conditions.invoiceUsedList"
:invoice-condition="invoiceCondition"
@close="onDetailClose"
v-if="invoiceOccupancyDetailShow"
:source-data="conditions.invoiceUsedList"
:invoice-condition="invoiceCondition"
></InvoiceOccupancyDetail>
</van-popup>
</div>
......@@ -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()
}
})
}
}
} catch (e) {
console.warn('缓存控制处理失败:', e)
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
}
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
}
}
})
},
methods: {
return null
},
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) {
......@@ -448,7 +475,7 @@ export default {
this.conditions.isShuntTextView = this.FormDictionaryForYesOrNot(this.conditions[key])
} else if (key === 'selfacceptance') {
this.conditions.selfacceptanceTextView = this.FormDictionaryForYesOrNot(
this.conditions[key]
this.conditions[key]
)
}
}
......@@ -472,22 +499,22 @@ export default {
},
flowPath() {
queryApprovalHistoryByBizId({ bizId: this.conditions.id })
.then(res => {
if (res.data) {
this.tablePathData = res.data.Rows
this.stepActive = this.tablePathData.length
this.selectSelfTask(res.data.Rows)
this.flag = res.data.Rows.some(item => {
return (
item.executorPersonId === Cookies.get('HEADER_USERID_KEY') &&
(item.statusId === 'executing' || item.statusId === 'ready') &&
item.id === this.conditions.taskId &&
this.status - 1 === 0
)
})
}
})
.catch(() => {})
.then(res => {
if (res.data) {
this.tablePathData = res.data.Rows
this.stepActive = this.tablePathData.length
this.selectSelfTask(res.data.Rows)
this.flag = res.data.Rows.some(item => {
return (
item.executorPersonId === Cookies.get('HEADER_USERID_KEY') &&
(item.statusId === 'executing' || item.statusId === 'ready') &&
item.id === this.conditions.taskId &&
this.status - 1 === 0
)
})
}
})
.catch(() => {})
},
buildOpinionText() {
const parts = []
......@@ -574,34 +601,34 @@ 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
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
}
}
if (this.isShowWork) {
if (
this.form.salecenterAuditQuantity - 0 <= 0 ||
!Number(this.form.salecenterAuditQuantity)
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