diff --git a/src/api/order/poOrder.js b/src/api/order/poOrder.js
index c99e638..b6c10ab 100644
--- a/src/api/order/poOrder.js
+++ b/src/api/order/poOrder.js
@@ -22,6 +22,9 @@ export const closePoDetail = (data) => createAPI(`/pODetail/closePoDetail`, 'pos
/** 打开 PO 订单行(已关闭 → 按验货数量恢复状态) */
export const openPoDetail = (data) => createAPI(`/pODetail/openPoDetail`, 'post', data)
+/** 下达 PO 订单行(草稿 → 已下达) */
+export const issuePoDetail = (data) => createAPI(`/pODetail/issuePoDetail`, 'post', data)
+
// 根据PO订单查询验货申请明细
export const getInspectionByPODetail = (data) => createAPI(`/pODetail/getInspectionByPODetail`, 'post', data)
diff --git a/src/views/modules/order/com_poOrder_CustomerPicker.vue b/src/views/modules/order/com_poOrder_CustomerPicker.vue
index a00d265..c919748 100644
--- a/src/views/modules/order/com_poOrder_CustomerPicker.vue
+++ b/src/views/modules/order/com_poOrder_CustomerPicker.vue
@@ -20,26 +20,6 @@
当前账号无 Customer 权限
-
-
- 请先选择本次会话要操作的 Customer:
-
-
-
-
- 确定
-
-
@@ -56,14 +36,18 @@ export default {
data () {
return {
options: [],
- innerCustomer: this.value,
- forceDialogVisible: false,
- dialogCustomer: ''
+ innerCustomer: this.value
}
},
watch: {
value (val) {
this.innerCustomer = val
+ if (!val) {
+ this.ensureDefaultCustomer()
+ }
+ },
+ site () {
+ this.loadOptions()
}
},
mounted () {
@@ -79,12 +63,7 @@ export default {
return getPoCustomerScope({ site: this.site }).then(({ data }) => {
if (data && data.code === 0) {
this.options = data.data || []
- if (this.options.length === 1) {
- this.selectCustomer(this.options[0].code)
- } else if (this.options.length > 1 && !this.innerCustomer) {
- this.forceDialogVisible = true
- this.dialogCustomer = ''
- }
+ this.ensureDefaultCustomer()
} else {
this.options = []
this.$message.error((data && data.msg) || '加载 Customer 权限失败')
@@ -94,6 +73,18 @@ export default {
this.$message.error('加载 Customer 权限失败')
})
},
+ ensureDefaultCustomer () {
+ if (!Array.isArray(this.options) || this.options.length === 0) {
+ return
+ }
+ if (this.innerCustomer) {
+ const exists = this.options.some(item => item && item.code === this.innerCustomer)
+ if (exists) {
+ return
+ }
+ }
+ this.selectCustomer(this.options[0].code)
+ },
selectCustomer (code) {
const option = this.options.find(item => item.code === code) || null
this.innerCustomer = code
@@ -104,11 +95,6 @@ export default {
const option = this.options.find(item => item.code === code) || null
this.$emit('input', code)
this.$emit('change', code, option)
- },
- confirmDialog () {
- if (!this.dialogCustomer) return
- this.forceDialogVisible = false
- this.selectCustomer(this.dialogCustomer)
}
}
}
diff --git a/src/views/modules/order/poOrder.vue b/src/views/modules/order/poOrder.vue
index 0dcf1b1..c6a1a1f 100644
--- a/src/views/modules/order/poOrder.vue
+++ b/src/views/modules/order/poOrder.vue
@@ -69,6 +69,10 @@
align="center"
width="70">
+ 下达
{})
},
+ handleIssuePoOrder (row) {
+ const params = buildPoDetailActionParams(row, this.$store.state.user.site)
+ if (!params.id && !(params.orderNo && params.site && params.itemNo != null)) {
+ this.$message.error('无法识别订单行,请刷新后重试')
+ return
+ }
+ const poLabel = row.poNo ? `PO ${row.poNo}` : '该订单'
+ const itemLabel = row.itemNo != null ? ` 行 ${row.itemNo}` : ''
+ this.$confirm(`确定下达${poLabel}${itemLabel}?`, '提示', { type: 'warning' }).then(() => {
+ issuePoDetail(params).then(({ data }) => {
+ if (data && data.code === 0) {
+ this.$message.success('下达成功')
+ this.getDataList()
+ } else {
+ this.$message.error((data && data.msg) || '下达失败')
+ }
+ }).catch(err => {
+ this.$message.error((err && err.message) || '下达失败')
+ })
+ }).catch(() => {})
+ },
+
handleOpenPoOrder (row) {
const params = buildPoDetailActionParams(row, this.$store.state.user.site)
if (!params.id && !(params.orderNo && params.site && params.itemNo != null)) {
@@ -2709,7 +2738,7 @@ export default {
shipVia: '',
orderDate: '',
enquiry: '',
- status: '已下达',
+ status: '草稿',
confirmed: '',
wantReceiveDate: '',
narrival: '',
diff --git a/src/views/modules/order/poOrderStatusOptions.js b/src/views/modules/order/poOrderStatusOptions.js
index c73b2b4..0ea3451 100644
--- a/src/views/modules/order/poOrderStatusOptions.js
+++ b/src/views/modules/order/poOrderStatusOptions.js
@@ -2,6 +2,7 @@
* PO 订单行状态选项(静态数据,查询下拉用,不查库)
*/
export const PO_ORDER_STATUS_OPTIONS = [
+ { label: '草稿', value: '草稿' },
{ label: '已下达', value: '已下达' },
{ label: '待验货', value: '待验货' },
{ label: '验货中', value: '验货中' },
@@ -30,7 +31,7 @@ export function canEditPoColumnByStatus (status, columnProp) {
/** 是否可「关闭」 */
export function canClosePoOrder (status) {
- return !!status && status !== '已关闭' && status !== '已取消'
+ return !!status && status !== '草稿' && status !== '已关闭' && status !== '已取消'
}
/** 是否可「打开」(仅已关闭) */
@@ -38,6 +39,11 @@ export function canOpenPoOrder (status) {
return status === '已关闭'
}
+/** 是否可「下达」(仅草稿) */
+export function canIssuePoOrder (status) {
+ return status === '草稿'
+}
+
/**
* 打开时根据验货数量推算恢复状态(与后端 PoDetailStatusSupport 规则一致)
*/
diff --git a/src/views/modules/order/poOrder_search.vue b/src/views/modules/order/poOrder_search.vue
index 1742a41..9bebfd0 100644
--- a/src/views/modules/order/poOrder_search.vue
+++ b/src/views/modules/order/poOrder_search.vue
@@ -695,9 +695,10 @@ export default {
/** 外部重置:仅清空顶部基础条件,不清 advancedQueryData */
resetSearch() {
+ const currentCustomer = this.searchData.customer
this.searchData = {
site: this.$store.state.user.site,
- customer: '',
+ customer: currentCustomer,
buyer: '',
poNo: '',
orderType: '',